aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-12-25 17:35:41 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-06 20:13:06 +0000
commitcb14a3fe5122c879eae1fb480ed7ce82a699ddb6 (patch)
treeb983a613c35ece61d561b5a9ef9cd66419f6c7fb /contrib
parent3d68ee6cbdb244de9fab1df8a2525d2fa592571e (diff)
parent99aabd70801bd4bc72c4942747f6d62c675112f5 (diff)
downloadsrc-cb14a3fe5122c879eae1fb480ed7ce82a699ddb6.tar.gz
src-cb14a3fe5122c879eae1fb480ed7ce82a699ddb6.zip
Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a. PR: 276104 MFC after: 1 month
Diffstat (limited to 'contrib')
-rw-r--r--contrib/llvm-project/clang/include/clang/AST/Decl.h27
-rw-r--r--contrib/llvm-project/clang/include/clang/AST/DeclBase.h10
-rw-r--r--contrib/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h7
-rw-r--r--contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h80
-rw-r--r--contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/RecordOps.h12
-rw-r--r--contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/Value.h40
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/Attr.td18
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/AttrDocs.td66
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td6
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/DiagnosticParseKinds.td4
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td28
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/LangOptions.def1
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/OpenACCKinds.h24
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/PlistSupport.h3
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h1
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/Version.h3
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/arm_sme.td317
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/arm_sve.td1399
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td18
-rw-r--r--contrib/llvm-project/clang/include/clang/Driver/Options.td5
-rw-r--r--contrib/llvm-project/clang/include/clang/Interpreter/CodeCompletion.h25
-rw-r--r--contrib/llvm-project/clang/include/clang/Interpreter/Interpreter.h1
-rw-r--r--contrib/llvm-project/clang/include/clang/Sema/Sema.h7
-rw-r--r--contrib/llvm-project/clang/include/clang/Sema/TypoCorrection.h12
-rw-r--r--contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h2
-rw-r--r--contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h88
-rw-r--r--contrib/llvm-project/clang/include/clang/Support/RISCVVIntrinsicUtils.h7
-rw-r--r--contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp2
-rw-r--r--contrib/llvm-project/clang/lib/AST/ASTImporter.cpp48
-rw-r--r--contrib/llvm-project/clang/lib/AST/ASTStructuralEquivalence.cpp12
-rw-r--r--contrib/llvm-project/clang/lib/AST/Decl.cpp41
-rw-r--r--contrib/llvm-project/clang/lib/AST/DeclBase.cpp74
-rw-r--r--contrib/llvm-project/clang/lib/AST/Expr.cpp83
-rw-r--r--contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp90
-rw-r--r--contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp31
-rw-r--r--contrib/llvm-project/clang/lib/Analysis/FlowSensitive/RecordOps.cpp33
-rw-r--r--contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Transfer.cpp25
-rw-r--r--contrib/llvm-project/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp2
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp1
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp1
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp4
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Targets/RISCV.h1
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Version.cpp18
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Warnings.cpp3
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp7
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp209
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp129
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp26
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.cpp63
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.h2
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp148
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h16
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp10
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/Targets/AArch64.cpp2
-rw-r--r--contrib/llvm-project/clang/lib/Driver/ToolChains/AIX.cpp6
-rw-r--r--contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/RISCV.cpp4
-rw-r--r--contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp15
-rw-r--r--contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp59
-rw-r--r--contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp127
-rw-r--r--contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp20
-rw-r--r--contrib/llvm-project/clang/lib/Format/Format.cpp8
-rw-r--r--contrib/llvm-project/clang/lib/Format/MatchFilePath.cpp122
-rw-r--r--contrib/llvm-project/clang/lib/Format/MatchFilePath.h22
-rw-r--r--contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp3
-rw-r--r--contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp6
-rw-r--r--contrib/llvm-project/clang/lib/Headers/adcintrin.h160
-rw-r--r--contrib/llvm-project/clang/lib/Headers/adxintrin.h143
-rw-r--r--contrib/llvm-project/clang/lib/Headers/immintrin.h8
-rw-r--r--contrib/llvm-project/clang/lib/Headers/riscv_bitmanip.h24
-rw-r--r--contrib/llvm-project/clang/lib/Interpreter/CodeCompletion.cpp223
-rw-r--r--contrib/llvm-project/clang/lib/Interpreter/Interpreter.cpp4
-rw-r--r--contrib/llvm-project/clang/lib/Lex/PPDirectives.cpp22
-rw-r--r--contrib/llvm-project/clang/lib/Parse/ParseOpenACC.cpp92
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp77
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp45
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp90
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp16
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp28
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaExprMember.cpp4
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaInit.cpp214
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp13
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaRISCVVectorLookup.cpp19
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaStmt.cpp7
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaTemplate.cpp28
-rw-r--r--contrib/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp52
-rw-r--r--contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp405
-rw-r--r--contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp15
-rw-r--r--contrib/llvm-project/clang/lib/Serialization/ASTWriterDecl.cpp574
-rw-r--r--contrib/llvm-project/clang/lib/Serialization/ASTWriterStmt.cpp241
-rw-r--r--contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp86
-rw-r--r--contrib/llvm-project/clang/lib/Support/RISCVVIntrinsicUtils.cpp2
-rw-r--r--contrib/llvm-project/clang/tools/clang-repl/ClangRepl.cpp24
-rw-r--r--contrib/llvm-project/clang/utils/TableGen/NeonEmitter.cpp28
-rw-r--r--contrib/llvm-project/clang/utils/TableGen/RISCVVEmitter.cpp40
-rw-r--r--contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp87
-rw-r--r--contrib/llvm-project/clang/utils/TableGen/TableGen.cpp18
-rw-r--r--contrib/llvm-project/clang/utils/TableGen/TableGenBackends.h3
-rw-r--r--contrib/llvm-project/compiler-rt/lib/asan/asan_posix.cpp51
-rw-r--r--contrib/llvm-project/compiler-rt/lib/asan/asan_rtl_x86_64.S10
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c151
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc36
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/apple.inc69
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/freebsd.inc27
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fuchsia.inc51
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc196
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/sysauxv.inc21
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/unimplemented.inc8
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/hwcap.inc180
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc28
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc5
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/fuchsia.inc12
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/sysauxv.inc6
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/cpu_model.h41
-rw-r--r--contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/x86.c (renamed from contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c)692
-rw-r--r--contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.cpp6
-rw-r--r--contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.h3
-rw-r--r--contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_custom.cpp12
-rw-r--r--contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp46
-rw-r--r--contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp68
-rw-r--r--contrib/llvm-project/compiler-rt/lib/lsan/lsan_posix.cpp33
-rw-r--r--contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.cpp8
-rw-r--r--contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.h4
-rw-r--r--contrib/llvm-project/compiler-rt/lib/msan/msan_linux.cpp32
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp4
-rw-r--r--contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c10
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp6
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h4
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp9
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp8
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h4
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h9
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp5
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp27
-rw-r--r--contrib/llvm-project/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp6
-rw-r--r--contrib/llvm-project/compiler-rt/lib/scudo/standalone/combined.h13
-rw-r--r--contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp19
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/binary_search.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h66
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_if.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/copy_n.h59
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/equal.h29
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/equal_range.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/fill.h26
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/fill_n.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/find.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/find_end.h92
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/fold.h125
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/generate.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/generate_n.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/half_positive.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/includes.h31
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h304
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_heap.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h56
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h177
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h49
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/make_heap.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/make_projected.h47
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/max.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/max_element.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/merge.h65
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/min.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/min_element.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/minmax.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h31
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/mismatch.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/move.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/move_backward.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/nth_element.h386
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partition.h84
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h36
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/partition_point.h34
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h64
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/push_heap.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove.h26
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/remove_if.h26
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/replace_if.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/reverse.h40
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/rotate.h264
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sample.h83
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/search.h123
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/search_n.h96
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/set_difference.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/shift_left.h43
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/shift_right.h123
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/shuffle.h127
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sift_down.h141
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sort.h245
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h487
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h332
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/transform.h29
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic.h812
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_base.h321
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h246
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h52
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h90
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h22
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/contention_t.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h560
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/fence.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/memory_order.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__availability82
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/bit_cast.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/bit_ceil.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/byteswap.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/countl.h84
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/countr.h17
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/endian.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/popcount.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/calendar.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/day.h91
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/duration.h693
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/file_clock.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/formatter.h63
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h117
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/literals.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/month.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/month_weekday.h104
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/monthday.h134
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/steady_clock.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/system_clock.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/time_point.h186
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/weekday.h201
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year.h104
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year_month.h102
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year_month_day.h460
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h369
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h27
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h68
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_three_way.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/ordering.h164
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/partial_order.h63
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/strong_order.h173
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h36
-rw-r--r--contrib/llvm-project/libcxx/include/__compare/weak_order.h115
-rw-r--r--contrib/llvm-project/libcxx/include/__config4
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h257
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h103
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__expected/expected.h205
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/copy_options.h50
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h251
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h73
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/directory_options.h44
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/file_status.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/file_type.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/operations.h224
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/path.h652
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h50
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/perm_options.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/perms.h56
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h85
-rw-r--r--contrib/llvm-project/libcxx/include/__filesystem/u8path.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__format/buffer.h52
-rw-r--r--contrib/llvm-project/libcxx/include/__format/concepts.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_arg.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_arg_store.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_args.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_context.h72
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_error.h17
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_functions.h184
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_parse_context.h30
-rw-r--r--contrib/llvm-project/libcxx/include/__format/format_string.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h92
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_integer.h37
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_integral.h77
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_output.h58
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_pointer.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__format/formatter_string.h18
-rw-r--r--contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h79
-rw-r--r--contrib/llvm-project/libcxx/include/__format/unicode.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__format/write_escaped.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binary_function.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binary_negate.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/bind.h385
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/bind_back.h34
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/bind_front.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binder1st.h35
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/binder2nd.h35
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h128
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/compose.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/default_searcher.h31
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/function.h1645
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/hash.h682
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/identity.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/invoke.h30
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/is_transparent.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/mem_fn.h36
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h183
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/not_fn.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/operations.h540
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/perfect_forward.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h20
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/ranges_operations.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h97
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/unary_function.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/unary_negate.h25
-rw-r--r--contrib/llvm-project/libcxx/include/__functional/weak_result_type.h225
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/get.h48
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/span.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/string_view.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__fwd/subrange.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__hash_table3216
-rw-r--r--contrib/llvm-project/libcxx/include/__ios/fpos.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/access.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/advance.h57
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h53
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/common_iterator.h211
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/concepts.h338
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h200
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/data.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/distance.h49
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/empty.h19
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h51
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h57
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h95
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h131
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iter_move.h68
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iter_swap.h100
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iterator.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h397
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/mergeable.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/move_iterator.h419
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h21
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/next.h13
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h55
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/permutable.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/prev.h13
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/readable_traits.h46
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/reverse_access.h60
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h366
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/size.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/sortable.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h258
-rw-r--r--contrib/llvm-project/libcxx/include/__locale2434
-rw-r--r--contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h144
-rw-r--r--contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__mbstate_t.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/addressof.h35
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h42
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocation_guard.h98
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator.h331
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h45
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator_traits.h379
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/assume_aligned.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/auto_ptr.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h23
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/compressed_pair.h81
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/concepts.h15
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/construct_at.h65
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/destruct_n.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/pointer_traits.h174
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h89
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h66
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/shared_ptr.h2495
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/temp_value.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h78
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h461
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/unique_ptr.h373
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/uses_allocator.h27
-rw-r--r--contrib/llvm-project/libcxx/include/__node_handle224
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/accumulate.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h57
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h82
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/inner_product.h34
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/iota.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/midpoint.h61
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/partial_sum.h53
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/reduce.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h33
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h42
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h160
-rw-r--r--contrib/llvm-project/libcxx/include/__random/binomial_distribution.h291
-rw-r--r--contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h161
-rw-r--r--contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h22
-rw-r--r--contrib/llvm-project/libcxx/include/__random/discard_block_engine.h256
-rw-r--r--contrib/llvm-project/libcxx/include/__random/discrete_distribution.h340
-rw-r--r--contrib/llvm-project/libcxx/include/__random/exponential_distribution.h171
-rw-r--r--contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h196
-rw-r--r--contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__random/gamma_distribution.h280
-rw-r--r--contrib/llvm-project/libcxx/include/__random/generate_canonical.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__random/geometric_distribution.h157
-rw-r--r--contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h331
-rw-r--r--contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__random/is_valid.h53
-rw-r--r--contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h491
-rw-r--r--contrib/llvm-project/libcxx/include/__random/log2.h39
-rw-r--r--contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h189
-rw-r--r--contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h1224
-rw-r--r--contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h232
-rw-r--r--contrib/llvm-project/libcxx/include/__random/normal_distribution.h278
-rw-r--r--contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h508
-rw-r--r--contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h537
-rw-r--r--contrib/llvm-project/libcxx/include/__random/poisson_distribution.h392
-rw-r--r--contrib/llvm-project/libcxx/include/__random/random_device.h87
-rw-r--r--contrib/llvm-project/libcxx/include/__random/ranlux.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__random/seed_seq.h231
-rw-r--r--contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h355
-rw-r--r--contrib/llvm-project/libcxx/include/__random/student_t_distribution.h169
-rw-r--r--contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h468
-rw-r--r--contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h403
-rw-r--r--contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__random/weibull_distribution.h185
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/access.h237
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/all.h55
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/common_view.h83
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/concepts.h126
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/counted.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/data.h91
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/drop_view.h303
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/empty.h71
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/empty_view.h40
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/enable_view.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/filter_view.h381
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/iota_view.h569
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/istream_view.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/join_view.h647
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h245
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h129
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/owning_view.h106
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h32
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/rbegin.h67
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/ref_view.h80
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/rend.h71
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/reverse_view.h297
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/single_view.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/size.h52
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/subrange.h356
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/take_view.h194
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/transform_view.h300
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/view_interface.h94
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/views.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/zip_view.h235
-rw-r--r--contrib/llvm-project/libcxx/include/__split_buffer604
-rw-r--r--contrib/llvm-project/libcxx/include/__string/char_traits.h1093
-rw-r--r--contrib/llvm-project/libcxx/include/__system_error/errc.h172
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/formatter.h62
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h37
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/this_thread.h63
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/thread.h324
-rw-r--r--contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h28
-rw-r--r--contrib/llvm-project/libcxx/include/__threading_support410
-rw-r--r--contrib/llvm-project/libcxx/include/__tree3613
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h136
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_element.h64
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h10
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h24
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_size.h47
-rw-r--r--contrib/llvm-project/libcxx/include/__tuple/tuple_types.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h11
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/as_const.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/cmp.h73
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h50
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/exchange.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/in_place.h12
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/integer_sequence.h104
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/pair.h1162
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/priority_tag.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/rel_ops.h41
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/to_underlying.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/unreachable.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__variant/monostate.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__verbose_abort4
-rw-r--r--contrib/llvm-project/libcxx/include/algorithm30
-rw-r--r--contrib/llvm-project/libcxx/include/any788
-rw-r--r--contrib/llvm-project/libcxx/include/array535
-rw-r--r--contrib/llvm-project/libcxx/include/barrier356
-rw-r--r--contrib/llvm-project/libcxx/include/bitset1290
-rw-r--r--contrib/llvm-project/libcxx/include/cctype29
-rw-r--r--contrib/llvm-project/libcxx/include/cmath173
-rw-r--r--contrib/llvm-project/libcxx/include/codecvt776
-rw-r--r--contrib/llvm-project/libcxx/include/complex1921
-rw-r--r--contrib/llvm-project/libcxx/include/condition_variable223
-rw-r--r--contrib/llvm-project/libcxx/include/cstddef52
-rw-r--r--contrib/llvm-project/libcxx/include/ctype.h28
-rw-r--r--contrib/llvm-project/libcxx/include/cuchar2
-rw-r--r--contrib/llvm-project/libcxx/include/deque3722
-rw-r--r--contrib/llvm-project/libcxx/include/errno.h522
-rw-r--r--contrib/llvm-project/libcxx/include/expected1
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__config22
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__memory90
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h55
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h13
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h52
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h41
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h2
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/simd.h2
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h2
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/traits.h15
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h6
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/iterator69
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/propagate_const305
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/simd1
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/type_traits69
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/utility2
-rw-r--r--contrib/llvm-project/libcxx/include/ext/__hash130
-rw-r--r--contrib/llvm-project/libcxx/include/ext/hash_map1132
-rw-r--r--contrib/llvm-project/libcxx/include/ext/hash_set634
-rw-r--r--contrib/llvm-project/libcxx/include/fenv.h70
-rw-r--r--contrib/llvm-project/libcxx/include/float.h12
-rw-r--r--contrib/llvm-project/libcxx/include/forward_list2031
-rw-r--r--contrib/llvm-project/libcxx/include/fstream2095
-rw-r--r--contrib/llvm-project/libcxx/include/future2551
-rw-r--r--contrib/llvm-project/libcxx/include/initializer_list71
-rw-r--r--contrib/llvm-project/libcxx/include/inttypes.h10
-rw-r--r--contrib/llvm-project/libcxx/include/iomanip754
-rw-r--r--contrib/llvm-project/libcxx/include/ios953
-rw-r--r--contrib/llvm-project/libcxx/include/iosfwd65
-rw-r--r--contrib/llvm-project/libcxx/include/istream2051
-rw-r--r--contrib/llvm-project/libcxx/include/latch98
-rw-r--r--contrib/llvm-project/libcxx/include/limits1078
-rw-r--r--contrib/llvm-project/libcxx/include/list2390
-rw-r--r--contrib/llvm-project/libcxx/include/locale6071
-rw-r--r--contrib/llvm-project/libcxx/include/locale.h2
-rw-r--r--contrib/llvm-project/libcxx/include/map2618
-rw-r--r--contrib/llvm-project/libcxx/include/math.h81
-rw-r--r--contrib/llvm-project/libcxx/include/module.modulemap.in4
-rw-r--r--contrib/llvm-project/libcxx/include/mutex467
-rw-r--r--contrib/llvm-project/libcxx/include/new220
-rw-r--r--contrib/llvm-project/libcxx/include/numbers93
-rw-r--r--contrib/llvm-project/libcxx/include/optional1759
-rw-r--r--contrib/llvm-project/libcxx/include/ostream1349
-rw-r--r--contrib/llvm-project/libcxx/include/print14
-rw-r--r--contrib/llvm-project/libcxx/include/queue1008
-rw-r--r--contrib/llvm-project/libcxx/include/ranges2
-rw-r--r--contrib/llvm-project/libcxx/include/ratio396
-rw-r--r--contrib/llvm-project/libcxx/include/regex8352
-rw-r--r--contrib/llvm-project/libcxx/include/scoped_allocator821
-rw-r--r--contrib/llvm-project/libcxx/include/semaphore193
-rw-r--r--contrib/llvm-project/libcxx/include/set1577
-rw-r--r--contrib/llvm-project/libcxx/include/span701
-rw-r--r--contrib/llvm-project/libcxx/include/sstream1274
-rw-r--r--contrib/llvm-project/libcxx/include/stack349
-rw-r--r--contrib/llvm-project/libcxx/include/stdatomic.h18
-rw-r--r--contrib/llvm-project/libcxx/include/stdbool.h10
-rw-r--r--contrib/llvm-project/libcxx/include/stddef.h28
-rw-r--r--contrib/llvm-project/libcxx/include/stdexcept232
-rw-r--r--contrib/llvm-project/libcxx/include/stdint.h6
-rw-r--r--contrib/llvm-project/libcxx/include/stdio.h36
-rw-r--r--contrib/llvm-project/libcxx/include/stdlib.h86
-rw-r--r--contrib/llvm-project/libcxx/include/streambuf530
-rw-r--r--contrib/llvm-project/libcxx/include/string4634
-rw-r--r--contrib/llvm-project/libcxx/include/string.h2
-rw-r--r--contrib/llvm-project/libcxx/include/string_view1135
-rw-r--r--contrib/llvm-project/libcxx/include/strstream334
-rw-r--r--contrib/llvm-project/libcxx/include/thread2
-rw-r--r--contrib/llvm-project/libcxx/include/tuple2126
-rw-r--r--contrib/llvm-project/libcxx/include/typeindex65
-rw-r--r--contrib/llvm-project/libcxx/include/typeinfo242
-rw-r--r--contrib/llvm-project/libcxx/include/uchar.h12
-rw-r--r--contrib/llvm-project/libcxx/include/unordered_map3111
-rw-r--r--contrib/llvm-project/libcxx/include/unordered_set1953
-rw-r--r--contrib/llvm-project/libcxx/include/valarray4682
-rw-r--r--contrib/llvm-project/libcxx/include/variant1235
-rw-r--r--contrib/llvm-project/libcxx/include/vector3836
-rw-r--r--contrib/llvm-project/libcxx/include/version6
-rw-r--r--contrib/llvm-project/libcxx/include/wchar.h157
-rw-r--r--contrib/llvm-project/libcxx/include/wctype.h43
-rw-r--r--contrib/llvm-project/libcxx/modules/std/algorithm.inc16
-rw-r--r--contrib/llvm-project/libcxx/modules/std/ostream.inc5
-rw-r--r--contrib/llvm-project/libcxx/src/any.cpp16
-rw-r--r--contrib/llvm-project/libcxx/src/atomic.cpp216
-rw-r--r--contrib/llvm-project/libcxx/src/barrier.cpp106
-rw-r--r--contrib/llvm-project/libcxx/src/bind.cpp23
-rw-r--r--contrib/llvm-project/libcxx/src/call_once.cpp62
-rw-r--r--contrib/llvm-project/libcxx/src/charconv.cpp33
-rw-r--r--contrib/llvm-project/libcxx/src/chrono.cpp118
-rw-r--r--contrib/llvm-project/libcxx/src/condition_variable.cpp95
-rw-r--r--contrib/llvm-project/libcxx/src/condition_variable_destructor.cpp20
-rw-r--r--contrib/llvm-project/libcxx/src/exception.cpp28
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/directory_entry.cpp9
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/directory_iterator.cpp84
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/error.h24
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/file_descriptor.h53
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/filesystem_clock.cpp20
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/filesystem_error.cpp12
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/int128_builtins.cpp14
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/operations.cpp323
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/path.cpp79
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/path_parser.h58
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/posix_compat.h231
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/time_utils.h164
-rw-r--r--contrib/llvm-project/libcxx/src/functional.cpp10
-rw-r--r--contrib/llvm-project/libcxx/src/future.cpp319
-rw-r--r--contrib/llvm-project/libcxx/src/hash.cpp899
-rw-r--r--contrib/llvm-project/libcxx/src/include/apple_availability.h34
-rw-r--r--contrib/llvm-project/libcxx/src/include/atomic_support.h156
-rw-r--r--contrib/llvm-project/libcxx/src/include/config_elast.h18
-rw-r--r--contrib/llvm-project/libcxx/src/include/refstring.h137
-rw-r--r--contrib/llvm-project/libcxx/src/include/ryu/ryu.h1
-rw-r--r--contrib/llvm-project/libcxx/src/include/sso_allocator.h81
-rw-r--r--contrib/llvm-project/libcxx/src/ios.cpp569
-rw-r--r--contrib/llvm-project/libcxx/src/iostream.cpp165
-rw-r--r--contrib/llvm-project/libcxx/src/locale.cpp9786
-rw-r--r--contrib/llvm-project/libcxx/src/memory.cpp229
-rw-r--r--contrib/llvm-project/libcxx/src/mutex.cpp207
-rw-r--r--contrib/llvm-project/libcxx/src/mutex_destructor.cpp20
-rw-r--r--contrib/llvm-project/libcxx/src/optional.cpp14
-rw-r--r--contrib/llvm-project/libcxx/src/ostream.cpp42
-rw-r--r--contrib/llvm-project/libcxx/src/random.cpp181
-rw-r--r--contrib/llvm-project/libcxx/src/random_shuffle.cpp35
-rw-r--r--contrib/llvm-project/libcxx/src/regex.cpp293
-rw-r--r--contrib/llvm-project/libcxx/src/std_stream.h572
-rw-r--r--contrib/llvm-project/libcxx/src/string.cpp368
-rw-r--r--contrib/llvm-project/libcxx/src/support/ibm/mbsnrtowcs.cpp30
-rw-r--r--contrib/llvm-project/libcxx/src/support/ibm/wcsnrtombs.cpp27
-rw-r--r--contrib/llvm-project/libcxx/src/support/ibm/xlocale_zos.cpp44
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_fallback.ipp139
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_glibcxx.ipp18
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxabi.ipp15
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxrt.ipp11
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_msvc.ipp145
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp73
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp61
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_msvc.ipp22
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp43
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp8
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/stdexcept_vcruntime.ipp2
-rw-r--r--contrib/llvm-project/libcxx/src/system_error.cpp225
-rw-r--r--contrib/llvm-project/libcxx/src/thread.cpp222
-rw-r--r--contrib/llvm-project/libcxx/src/typeinfo.cpp30
-rw-r--r--contrib/llvm-project/libcxx/src/valarray.cpp56
-rw-r--r--contrib/llvm-project/libcxx/src/variant.cpp6
-rw-r--r--contrib/llvm-project/libcxx/src/vector.cpp8
-rw-r--r--contrib/llvm-project/libcxx/src/verbose_abort.cpp6
-rw-r--r--contrib/llvm-project/lld/ELF/Arch/LoongArch.cpp20
-rw-r--r--contrib/llvm-project/lld/ELF/InputSection.cpp22
-rw-r--r--contrib/llvm-project/lld/MachO/InputFiles.h2
-rw-r--r--contrib/llvm-project/lld/MachO/Options.td2
-rw-r--r--contrib/llvm-project/lldb/bindings/python/python-typemaps.swig2
-rw-r--r--contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h8
-rw-r--r--contrib/llvm-project/lldb/include/lldb/Host/HostGetOpt.h4
-rw-r--r--contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h19
-rw-r--r--contrib/llvm-project/lldb/source/API/SBValue.cpp11
-rw-r--r--contrib/llvm-project/lldb/source/Core/ValueObject.cpp40
-rw-r--r--contrib/llvm-project/lldb/source/Host/common/FileSystem.cpp1
-rw-r--r--contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp6
-rw-r--r--contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp2
-rw-r--r--contrib/llvm-project/lldb/source/Target/JITLoaderList.cpp2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h8
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ADT/Twine.h2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h9
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h10
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h4
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h5
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h5
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h10
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h8
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h9
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/LowerEmuTLS.h29
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def7
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h12
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h6
-rw-r--r--contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h27
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/Constants.h7
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h1
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h13
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h4
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h24
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td28
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h26
-rw-r--r--contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h3
-rw-r--r--contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h1
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Object/Wasm.h1
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h26
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h11
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h4
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h27
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h17
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h49
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Support/raw_socket_stream.h66
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h9
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h1
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h48
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h13
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TextAPI/RecordVisitor.h54
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h14
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h3
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TextAPI/Utils.h34
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h10
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h5
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp18
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp18
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/TargetLibraryInfo.cpp10
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/VFABIDemangling.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/ValueTracking.cpp126
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp28
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp62
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h45
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/LiveRangeEdit.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/LowerEmuTLS.cpp53
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp12
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/RegAllocFast.cpp139
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/RegisterClassInfo.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp57
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/ReplaceWithVeclib.cpp211
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp19
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp18
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp23
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp17
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h2
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp12
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp24
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/ShadowStackGCLowering.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/TargetPassConfig.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp32
-rw-r--r--contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp32
-rw-r--r--contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp17
-rw-r--r--contrib/llvm-project/llvm/lib/IR/ConstantFold.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/IR/Globals.cpp12
-rw-r--r--contrib/llvm-project/llvm/lib/IR/LLVMContext.cpp11
-rw-r--r--contrib/llvm-project/llvm/lib/IR/Metadata.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/IR/Type.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/IR/Verifier.cpp11
-rw-r--r--contrib/llvm-project/llvm/lib/MC/MCAsmStreamer.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/MC/MCContext.cpp14
-rw-r--r--contrib/llvm-project/llvm/lib/MC/MCExpr.cpp24
-rw-r--r--contrib/llvm-project/llvm/lib/ObjCopy/ELF/ELFObject.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Object/ELFObjectFile.cpp69
-rw-r--r--contrib/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp16
-rw-r--r--contrib/llvm-project/llvm/lib/Object/WasmObjectFile.cpp52
-rw-r--r--contrib/llvm-project/llvm/lib/Passes/PassBuilder.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/Passes/PassRegistry.def1
-rw-r--r--contrib/llvm-project/llvm/lib/ProfileData/InstrProf.cpp36
-rw-r--r--contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/ProfileData/RawMemProfReader.cpp25
-rw-r--r--contrib/llvm-project/llvm/lib/Support/CommandLine.cpp78
-rw-r--r--contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp83
-rw-r--r--contrib/llvm-project/llvm/lib/Support/Signals.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp163
-rw-r--r--contrib/llvm-project/llvm/lib/Support/raw_socket_stream.cpp179
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64.td19
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64Combine.td11
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp18
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp11
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td126
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp36
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.h3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.td75
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp229
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp28
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h18
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp86
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td61
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedA64FX.td9
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseN2.td2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV1.td2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SystemOperands.td27
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp47
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp18
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp62
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp21
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp14
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64FixupKinds.h5
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp29
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/SMEInstrFormats.td26
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AArch64/SVEInstrFormats.td31
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPU.td4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp29
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp37
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp18
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h10
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/DSInstructions.td12
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/SIISelLowering.cpp21
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp20
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp79
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.h3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.cpp33
-rw-r--r--contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.h3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp58
-rw-r--r--contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.h10
-rw-r--r--contrib/llvm-project/llvm/lib/Target/ARM/ARMInstrVFP.td1
-rw-r--r--contrib/llvm-project/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp92
-rw-r--r--contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.h37
-rw-r--r--contrib/llvm-project/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp78
-rw-r--r--contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h9
-rw-r--r--contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.td3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h9
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFeatures.td86
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp182
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.h7
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrFormats.td9
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td125
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td12
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVMacroFusion.cpp82
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVProcessors.td27
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td1
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.h18
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp35
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp10
-rw-r--r--contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.h8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/TargetMachine.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp36
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86FastISel.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp31
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp36
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InsertPrefetch.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrAMX.td30
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrAVX512.td1082
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrArithmetic.td1457
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrAsmAlias.td13
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrCompiler.td17
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrFPStack.td8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrFormats.td7
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrKL.td22
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrMMX.td24
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrMisc.td211
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrRAOINT.td8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrSGX.td6
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrSNP.td12
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrSSE.td952
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrShiftRotate.td28
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td141
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrTBM.td4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrTDX.td14
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrTSX.td4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrUtils.td284
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrVMX.td38
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86InstrXOP.td28
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86MacroFusion.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86Subtarget.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/TargetParser/ARMTargetParserCommon.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/TargetParser/Host.cpp52
-rw-r--r--contrib/llvm-project/llvm/lib/TargetParser/Triple.cpp15
-rw-r--r--contrib/llvm-project/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp429
-rw-r--r--contrib/llvm-project/llvm/lib/TextAPI/RecordVisitor.cpp65
-rw-r--r--contrib/llvm-project/llvm/lib/TextAPI/RecordsSlice.cpp120
-rw-r--r--contrib/llvm-project/llvm/lib/TextAPI/Utils.cpp40
-rw-r--r--contrib/llvm-project/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp53
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/IPO/OpenMPOpt.cpp18
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp13
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp49
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp59
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineInternal.h17
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp134
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp44
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp106
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp75
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp6
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/GVN.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopFlatten.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp9
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/DXILUpgrade.cpp12
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/FunctionComparator.cpp25
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp2
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp8
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp7
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp123
-rw-r--r--contrib/llvm-project/llvm/tools/llc/llc.cpp17
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp24
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-dwp/Opts.td11
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-dwp/llvm-dwp.cpp20
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-objdump/ObjdumpOpts.td3
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.cpp1
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.h1
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp189
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp29
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp295
-rw-r--r--contrib/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp8
-rw-r--r--contrib/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp4
-rw-r--r--contrib/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp33
-rw-r--r--contrib/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp6
989 files changed, 79979 insertions, 92054 deletions
diff --git a/contrib/llvm-project/clang/include/clang/AST/Decl.h b/contrib/llvm-project/clang/include/clang/AST/Decl.h
index cd0878d70825..a807bcdd76b3 100644
--- a/contrib/llvm-project/clang/include/clang/AST/Decl.h
+++ b/contrib/llvm-project/clang/include/clang/AST/Decl.h
@@ -358,7 +358,8 @@ public:
///
/// \param IsKnownNewer \c true if this declaration is known to be newer
/// than \p OldD (for instance, if this declaration is newly-created).
- bool declarationReplaces(NamedDecl *OldD, bool IsKnownNewer = true) const;
+ bool declarationReplaces(const NamedDecl *OldD,
+ bool IsKnownNewer = true) const;
/// Determine whether this declaration has linkage.
bool hasLinkage() const;
@@ -4332,30 +4333,6 @@ public:
return field_begin() == field_end();
}
- FieldDecl *getLastField() {
- FieldDecl *FD = nullptr;
- for (FieldDecl *Field : fields())
- FD = Field;
- return FD;
- }
- const FieldDecl *getLastField() const {
- return const_cast<RecordDecl *>(this)->getLastField();
- }
-
- template <typename Functor>
- const FieldDecl *findFieldIf(Functor &Pred) const {
- for (const Decl *D : decls()) {
- if (const auto *FD = dyn_cast<FieldDecl>(D); FD && Pred(FD))
- return FD;
-
- if (const auto *RD = dyn_cast<RecordDecl>(D))
- if (const FieldDecl *FD = RD->findFieldIf(Pred))
- return FD;
- }
-
- return nullptr;
- }
-
/// Note that the definition of this type is now complete.
virtual void completeDefinition();
diff --git a/contrib/llvm-project/clang/include/clang/AST/DeclBase.h b/contrib/llvm-project/clang/include/clang/AST/DeclBase.h
index 5b1038582bc6..10dcbdb262d8 100644
--- a/contrib/llvm-project/clang/include/clang/AST/DeclBase.h
+++ b/contrib/llvm-project/clang/include/clang/AST/DeclBase.h
@@ -19,7 +19,6 @@
#include "clang/AST/SelectorLocationsKind.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
-#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/ArrayRef.h"
@@ -489,15 +488,6 @@ public:
// Return true if this is a FileContext Decl.
bool isFileContextDecl() const;
- /// Whether it resembles a flexible array member. This is a static member
- /// because we want to be able to call it with a nullptr. That allows us to
- /// perform non-Decl specific checks based on the object's type and strict
- /// flex array level.
- static bool isFlexibleArrayMemberLike(
- ASTContext &Context, const Decl *D, QualType Ty,
- LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel,
- bool IgnoreTemplateOrMacroSubstitution);
-
ASTContext &getASTContext() const LLVM_READONLY;
/// Helper to get the language options from the ASTContext.
diff --git a/contrib/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h b/contrib/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h
index c501801b95bd..8f2714e142bb 100644
--- a/contrib/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/contrib/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -2036,12 +2036,7 @@ bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
/* The partial specialization. */ \
- if (TemplateParameterList *TPL = D->getTemplateParameters()) { \
- for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end(); \
- I != E; ++I) { \
- TRY_TO(TraverseDecl(*I)); \
- } \
- } \
+ TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
/* The args that remains unspecialized. */ \
TRY_TO(TraverseTemplateArgumentLocsHelper( \
D->getTemplateArgsAsWritten()->getTemplateArgs(), \
diff --git a/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h b/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
index d7e39ab2616f..e8c27d6c1203 100644
--- a/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ b/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -289,6 +289,22 @@ public:
/// `E` must be a glvalue or a `BuiltinType::BuiltinFn`
StorageLocation *getStorageLocation(const Expr &E) const;
+ /// Returns the result of casting `getStorageLocation(...)` to a subclass of
+ /// `StorageLocation` (using `cast_or_null<T>`).
+ /// This assert-fails if the result of `getStorageLocation(...)` is not of
+ /// type `T *`; if the storage location is not guaranteed to have type `T *`,
+ /// consider using `dyn_cast_or_null<T>(getStorageLocation(...))` instead.
+ template <typename T>
+ std::enable_if_t<std::is_base_of_v<StorageLocation, T>, T *>
+ get(const ValueDecl &D) const {
+ return cast_or_null<T>(getStorageLocation(D));
+ }
+ template <typename T>
+ std::enable_if_t<std::is_base_of_v<StorageLocation, T>, T *>
+ get(const Expr &E) const {
+ return cast_or_null<T>(getStorageLocation(E));
+ }
+
/// Returns the storage location assigned to the `this` pointee in the
/// environment or null if the `this` pointee has no assigned storage location
/// in the environment.
@@ -325,7 +341,8 @@ public:
///
/// Requirements:
/// `E` must be a prvalue of record type.
- RecordStorageLocation &getResultObjectLocation(const Expr &RecordPRValue);
+ RecordStorageLocation &
+ getResultObjectLocation(const Expr &RecordPRValue) const;
/// Returns the return value of the current function. This can be null if:
/// - The function has a void return type
@@ -434,24 +451,14 @@ public:
/// Assigns `Val` as the value of the prvalue `E` in the environment.
///
- /// If `E` is not yet associated with a storage location, associates it with
- /// a newly created storage location. In any case, associates the storage
- /// location of `E` with `Val`.
- ///
- /// Once the migration to strict handling of value categories is complete
- /// (see https://discourse.llvm.org/t/70086), this function will be renamed to
- /// `setValue()`. At this point, prvalue expressions will be associated
- /// directly with `Value`s, and the legacy behavior of associating prvalue
- /// expressions with storage locations (as described above) will be
- /// eliminated.
- ///
/// Requirements:
///
- /// `E` must be a prvalue
- /// If `Val` is a `RecordValue`, its `RecordStorageLocation` must be the
- /// same as that of any `RecordValue` that has already been associated with
- /// `E`. This is to guarantee that the result object initialized by a prvalue
- /// `RecordValue` has a durable storage location.
+ /// - `E` must be a prvalue
+ /// - If `Val` is a `RecordValue`, its `RecordStorageLocation` must be
+ /// `getResultObjectLocation(E)`. An exception to this is if `E` is an
+ /// expression that originally creates a `RecordValue` (such as a
+ /// `CXXConstructExpr` or `CallExpr`), as these establish the location of
+ /// the result object in the first place.
void setValue(const Expr &E, Value &Val);
/// Returns the value assigned to `Loc` in the environment or null if `Loc`
@@ -466,6 +473,26 @@ public:
/// storage location in the environment, otherwise returns null.
Value *getValue(const Expr &E) const;
+ /// Returns the result of casting `getValue(...)` to a subclass of `Value`
+ /// (using `cast_or_null<T>`).
+ /// This assert-fails if the result of `getValue(...)` is not of type `T *`;
+ /// if the value is not guaranteed to have type `T *`, consider using
+ /// `dyn_cast_or_null<T>(getValue(...))` instead.
+ template <typename T>
+ std::enable_if_t<std::is_base_of_v<Value, T>, T *>
+ get(const StorageLocation &Loc) const {
+ return cast_or_null<T>(getValue(Loc));
+ }
+ template <typename T>
+ std::enable_if_t<std::is_base_of_v<Value, T>, T *>
+ get(const ValueDecl &D) const {
+ return cast_or_null<T>(getValue(D));
+ }
+ template <typename T>
+ std::enable_if_t<std::is_base_of_v<Value, T>, T *> get(const Expr &E) const {
+ return cast_or_null<T>(getValue(E));
+ }
+
// FIXME: should we deprecate the following & call arena().create() directly?
/// Creates a `T` (some subclass of `Value`), forwarding `args` to the
@@ -608,14 +635,6 @@ private:
// The copy-constructor is for use in fork() only.
Environment(const Environment &) = default;
- /// Internal version of `setStorageLocation()` that doesn't check if the
- /// expression is a prvalue.
- void setStorageLocationInternal(const Expr &E, StorageLocation &Loc);
-
- /// Internal version of `getStorageLocation()` that doesn't check if the
- /// expression is a prvalue.
- StorageLocation *getStorageLocationInternal(const Expr &E) const;
-
/// Creates a value appropriate for `Type`, if `Type` is supported, otherwise
/// return null.
///
@@ -708,20 +727,9 @@ RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME,
std::vector<FieldDecl *> getFieldsForInitListExpr(const RecordDecl *RD);
/// Associates a new `RecordValue` with `Loc` and returns the new value.
-/// It is not defined whether the field values remain the same or not.
-///
-/// This function is primarily intended for use by checks that set custom
-/// properties on `RecordValue`s to model the state of these values. Such checks
-/// should avoid modifying the properties of an existing `RecordValue` because
-/// these changes would be visible to other `Environment`s that share the same
-/// `RecordValue`. Instead, call `refreshRecordValue()`, then set the properties
-/// on the new `RecordValue` that it returns. Typical usage:
-///
-/// refreshRecordValue(Loc, Env).setProperty("my_prop", MyPropValue);
RecordValue &refreshRecordValue(RecordStorageLocation &Loc, Environment &Env);
/// Associates a new `RecordValue` with `Expr` and returns the new value.
-/// See also documentation for the overload above.
RecordValue &refreshRecordValue(const Expr &Expr, Environment &Env);
} // namespace dataflow
diff --git a/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/RecordOps.h b/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/RecordOps.h
index 7b87840d626b..783e53e980aa 100644
--- a/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/RecordOps.h
+++ b/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/RecordOps.h
@@ -22,19 +22,13 @@ namespace dataflow {
/// Copies a record (struct, class, or union) from `Src` to `Dst`.
///
/// This performs a deep copy, i.e. it copies every field (including synthetic
-/// fields) and recurses on fields of record type. It also copies properties
-/// from the `RecordValue` associated with `Src` to the `RecordValue` associated
-/// with `Dst` (if these `RecordValue`s exist).
+/// fields) and recurses on fields of record type.
///
/// If there is a `RecordValue` associated with `Dst` in the environment, this
/// function creates a new `RecordValue` and associates it with `Dst`; clients
/// need to be aware of this and must not assume that the `RecordValue`
/// associated with `Dst` remains the same after the call.
///
-/// We create a new `RecordValue` rather than modifying properties on the old
-/// `RecordValue` because the old `RecordValue` may be shared with other
-/// `Environment`s, and we don't want changes to properties to be visible there.
-///
/// Requirements:
///
/// `Src` and `Dst` must have the same canonical unqualified type.
@@ -49,9 +43,7 @@ void copyRecord(RecordStorageLocation &Src, RecordStorageLocation &Dst,
///
/// This performs a deep comparison, i.e. it compares every field (including
/// synthetic fields) and recurses on fields of record type. Fields of reference
-/// type compare equal if they refer to the same storage location. If
-/// `RecordValue`s are associated with `Loc1` and Loc2`, it also compares the
-/// properties on those `RecordValue`s.
+/// type compare equal if they refer to the same storage location.
///
/// Note on how to interpret the result:
/// - If this returns true, the records are guaranteed to be equal at runtime.
diff --git a/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/Value.h b/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/Value.h
index e6c68e5b4e93..be1bf9324c87 100644
--- a/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/Value.h
+++ b/contrib/llvm-project/clang/include/clang/Analysis/FlowSensitive/Value.h
@@ -63,7 +63,11 @@ public:
/// Assigns `Val` as the value of the synthetic property with the given
/// `Name`.
+ ///
+ /// Properties may not be set on `RecordValue`s; use synthetic fields instead
+ /// (for details, see documentation for `RecordStorageLocation`).
void setProperty(llvm::StringRef Name, Value &Val) {
+ assert(getKind() != Kind::Record);
Properties.insert_or_assign(Name, &Val);
}
@@ -184,33 +188,23 @@ private:
/// In C++, prvalues of class type serve only a limited purpose: They can only
/// be used to initialize a result object. It is not possible to access member
/// variables or call member functions on a prvalue of class type.
-/// Correspondingly, `RecordValue` also serves only two limited purposes:
-/// - It conveys a prvalue of class type from the place where the object is
-/// constructed to the result object that it initializes.
+/// Correspondingly, `RecordValue` also serves only a limited purpose: It
+/// conveys a prvalue of class type from the place where the object is
+/// constructed to the result object that it initializes.
///
-/// When creating a prvalue of class type, we already need a storage location
-/// for `this`, even though prvalues are otherwise not associated with storage
-/// locations. `RecordValue` is therefore essentially a wrapper for a storage
-/// location, which is then used to set the storage location for the result
-/// object when we process the AST node for that result object.
+/// When creating a prvalue of class type, we already need a storage location
+/// for `this`, even though prvalues are otherwise not associated with storage
+/// locations. `RecordValue` is therefore essentially a wrapper for a storage
+/// location, which is then used to set the storage location for the result
+/// object when we process the AST node for that result object.
///
-/// For example:
-/// MyStruct S = MyStruct(3);
+/// For example:
+/// MyStruct S = MyStruct(3);
///
-/// In this example, `MyStruct(3) is a prvalue, which is modeled as a
-/// `RecordValue` that wraps a `RecordStorageLocation`. This
-// `RecordStorageLocation` is then used as the storage location for `S`.
+/// In this example, `MyStruct(3) is a prvalue, which is modeled as a
+/// `RecordValue` that wraps a `RecordStorageLocation`. This
+/// `RecordStorageLocation` is then used as the storage location for `S`.
///
-/// - It allows properties to be associated with an object of class type.
-/// Note that when doing so, you should avoid mutating the properties of an
-/// existing `RecordValue` in place, as these changes would be visible to
-/// other `Environment`s that share the same `RecordValue`. Instead, associate
-/// a new `RecordValue` with the `RecordStorageLocation` and set the
-/// properties on this new `RecordValue`. (See also `refreshRecordValue()` in
-/// DataflowEnvironment.h, which makes this easy.)
-/// Note also that this implies that it is common for the same
-/// `RecordStorageLocation` to be associated with different `RecordValue`s
-/// in different environments.
/// Over time, we may eliminate `RecordValue` entirely. See also the discussion
/// here: https://reviews.llvm.org/D155204#inline-1503204
class RecordValue final : public Value {
diff --git a/contrib/llvm-project/clang/include/clang/Basic/Attr.td b/contrib/llvm-project/clang/include/clang/Basic/Attr.td
index 2b57058d3f1c..db17211747b1 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/Attr.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/Attr.td
@@ -4331,24 +4331,6 @@ def AvailableOnlyInDefaultEvalMethod : InheritableAttr {
let Documentation = [Undocumented];
}
-def CountedBy : InheritableAttr {
- let Spellings = [Clang<"counted_by">];
- let Subjects = SubjectList<[Field]>;
- let Args = [IdentifierArgument<"CountedByField">];
- let Documentation = [CountedByDocs];
- let LangOpts = [COnly];
- // FIXME: This is ugly. Let using a DeclArgument would be nice, but a Decl
- // isn't yet available due to the fact that we're still parsing the
- // structure. Maybe that code could be changed sometime in the future.
- code AdditionalMembers = [{
- private:
- SourceRange CountedByFieldLoc;
- public:
- SourceRange getCountedByFieldLoc() const { return CountedByFieldLoc; }
- void setCountedByFieldLoc(SourceRange Loc) { CountedByFieldLoc = Loc; }
- }];
-}
-
def PreferredType: InheritableAttr {
let Spellings = [Clang<"preferred_type">];
let Subjects = SubjectList<[BitField], ErrorDiag>;
diff --git a/contrib/llvm-project/clang/include/clang/Basic/AttrDocs.td b/contrib/llvm-project/clang/include/clang/Basic/AttrDocs.td
index 90041fa8dbb3..98a7ecc7fd7d 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/AttrDocs.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/AttrDocs.td
@@ -7500,72 +7500,6 @@ attribute, they default to the value ``65535``.
}];
}
-def CountedByDocs : Documentation {
- let Category = DocCatField;
- let Content = [{
-Clang supports the ``counted_by`` attribute on the flexible array member of a
-structure in C. The argument for the attribute is the name of a field member in
-the same structure holding the count of elements in the flexible array. This
-information can be used to improve the results of the array bound sanitizer and
-the ``__builtin_dynamic_object_size`` builtin.
-
-For example, the following code:
-
-.. code-block:: c
-
- struct bar;
-
- struct foo {
- size_t count;
- char other;
- struct bar *array[] __attribute__((counted_by(count)));
- };
-
-specifies that the flexible array member ``array`` has the number of elements
-allocated for it stored in ``count``. This establishes a relationship between
-``array`` and ``count``. Specifically, ``p->array`` must have at least
-``p->count`` number of elements available. It's the user's responsibility to
-ensure that this relationship is maintained through changes to the structure.
-
-In the following example, the allocated array erroneously has fewer elements
-than what's specified by ``p->count``. This would result in an out-of-bounds
-access not being detected.
-
-.. code-block:: c
-
- #define SIZE_INCR 42
-
- struct foo *p;
-
- void foo_alloc(size_t count) {
- p = malloc(MAX(sizeof(struct foo),
- offsetof(struct foo, array[0]) + count * sizeof(struct bar *)));
- p->count = count + SIZE_INCR;
- }
-
-The next example updates ``p->count``, breaking the relationship requirement
-that ``p->array`` must have at least ``p->count`` number of elements available:
-
-.. code-block:: c
-
- #define SIZE_INCR 42
-
- struct foo *p;
-
- void foo_alloc(size_t count) {
- p = malloc(MAX(sizeof(struct foo),
- offsetof(struct foo, array[0]) + count * sizeof(struct bar *)));
- p->count = count;
- }
-
- void use_foo(int index) {
- p->count += SIZE_INCR + 1; /* 'count' is now larger than the number of elements of 'array'. */
- p->array[index] = 0; /* the sanitizer can't properly check if this is an out-of-bounds access. */
- }
-
- }];
-}
-
def CoroOnlyDestroyWhenCompleteDocs : Documentation {
let Category = DocCatDecl;
let Content = [{
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td
index 80b5680b94f6..6765721ae700 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td
@@ -348,7 +348,8 @@ def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic",
CXXPre20CompatPedantic,
CXXPre23CompatPedantic]>;
-def CXX11Narrowing : DiagGroup<"c++11-narrowing">;
+def CXX11NarrowingConstReference : DiagGroup<"c++11-narrowing-const-reference">;
+def CXX11Narrowing : DiagGroup<"c++11-narrowing", [CXX11NarrowingConstReference]>;
def CXX11WarnInconsistentOverrideDestructor :
DiagGroup<"inconsistent-missing-destructor-override">;
@@ -1488,4 +1489,5 @@ def DXILValidation : DiagGroup<"dxil-validation">;
def ReadOnlyPlacementChecks : DiagGroup<"read-only-types">;
// Warnings and fixes to support the "safe buffers" programming model.
-def UnsafeBufferUsage : DiagGroup<"unsafe-buffer-usage">;
+def UnsafeBufferUsageInContainer : DiagGroup<"unsafe-buffer-usage-in-container">;
+def UnsafeBufferUsage : DiagGroup<"unsafe-buffer-usage", [UnsafeBufferUsageInContainer]>;
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticParseKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticParseKinds.td
index 6150fc36430a..e4b1069cde18 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1358,11 +1358,9 @@ def err_acc_unexpected_directive
def warn_pragma_acc_unimplemented
: Warning<"OpenACC directives not yet implemented, pragma ignored">,
InGroup<SourceUsesOpenACC>;
-def warn_pragma_acc_unimplemented_clause_parsing
- : Warning<"OpenACC clause parsing not yet implemented">,
- InGroup<SourceUsesOpenACC>;
def err_acc_invalid_directive
: Error<"invalid OpenACC directive %select{%1|'%1 %2'}0">;
+def err_acc_invalid_clause : Error<"invalid OpenACC clause %0">;
def err_acc_missing_directive : Error<"expected OpenACC directive">;
def err_acc_invalid_open_paren
: Error<"expected clause-list or newline in OpenACC directive">;
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f572b6f861fd..cb68ded1f38c 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3155,6 +3155,9 @@ def err_attribute_arm_feature_sve_bits_unsupported : Error<
def warn_attribute_arm_sm_incompat_builtin : Warning<
"builtin call has undefined behaviour when called from a %0 function">,
InGroup<DiagGroup<"undefined-arm-streaming">>;
+def warn_attribute_arm_za_builtin_no_za_state : Warning<
+ "builtin call is not valid when calling from a function without active ZA state">,
+ InGroup<DiagGroup<"undefined-arm-za">>;
def err_sve_vector_in_non_sve_target : Error<
"SVE vector type %0 cannot be used in a target without sve">;
def err_attribute_riscv_rvv_bits_unsupported : Error<
@@ -6155,12 +6158,24 @@ def err_illegal_initializer_type : Error<"illegal initializer type %0">;
def ext_init_list_type_narrowing : ExtWarn<
"type %0 cannot be narrowed to %1 in initializer list">,
InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
+// *_narrowing_const_reference diagnostics have the same messages, but are
+// controlled by -Wc++11-narrowing-const-reference for narrowing involving a
+// const reference.
+def ext_init_list_type_narrowing_const_reference : ExtWarn<
+ "type %0 cannot be narrowed to %1 in initializer list">,
+ InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
def ext_init_list_variable_narrowing : ExtWarn<
"non-constant-expression cannot be narrowed from type %0 to %1 in "
"initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
+def ext_init_list_variable_narrowing_const_reference : ExtWarn<
+ "non-constant-expression cannot be narrowed from type %0 to %1 in "
+ "initializer list">, InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
def ext_init_list_constant_narrowing : ExtWarn<
"constant expression evaluates to %0 which cannot be narrowed to type %1">,
InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
+def ext_init_list_constant_narrowing_const_reference : ExtWarn<
+ "constant expression evaluates to %0 which cannot be narrowed to type %1">,
+ InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
def warn_init_list_type_narrowing : Warning<
"type %0 cannot be narrowed to %1 in initializer list in C++11">,
InGroup<CXX11Narrowing>, DefaultIgnore;
@@ -6426,17 +6441,6 @@ def warn_superclass_variable_sized_type_not_at_end : Warning<
"field %0 can overwrite instance variable %1 with variable sized type %2"
" in superclass %3">, InGroup<ObjCFlexibleArray>;
-def err_counted_by_attr_not_on_flexible_array_member : Error<
- "'counted_by' only applies to C99 flexible array members">;
-def err_counted_by_attr_refers_to_flexible_array : Error<
- "'counted_by' cannot refer to the flexible array %0">;
-def err_counted_by_must_be_in_structure : Error<
- "field %0 in 'counted_by' not inside structure">;
-def err_flexible_array_counted_by_attr_field_not_integer : Error<
- "field %0 in 'counted_by' must be a non-boolean integer type">;
-def note_flexible_array_counted_by_attr_field : Note<
- "field %0 declared here">;
-
let CategoryName = "ARC Semantic Issue" in {
// ARC-mode diagnostics.
@@ -11368,6 +11372,8 @@ def err_openmp_vla_in_task_untied : Error<
def warn_omp_unterminated_declare_target : Warning<
"expected '#pragma omp end declare target' at end of file to match '#pragma omp %0'">,
InGroup<SourceUsesOpenMP>;
+def err_ompx_bare_no_grid : Error<
+ "'ompx_bare' clauses requires explicit grid size via 'num_teams' and 'thread_limit' clauses">;
} // end of OpenMP category
let CategoryName = "Related Result Type Issue" in {
diff --git a/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def b/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def
index 152d9f65f86d..21abc346cf17 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def
+++ b/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def
@@ -456,6 +456,7 @@ ENUM_LANGOPT(SignReturnAddressScope, SignReturnAddressScopeKind, 2, SignReturnAd
ENUM_LANGOPT(SignReturnAddressKey, SignReturnAddressKeyKind, 1, SignReturnAddressKeyKind::AKey,
"Key used for return address signing")
LANGOPT(BranchTargetEnforcement, 1, 0, "Branch-target enforcement enabled")
+LANGOPT(BranchProtectionPAuthLR, 1, 0, "Use PC as a diversifier using PAuthLR NOP instructions.")
LANGOPT(SpeculativeLoadHardening, 1, 0, "Speculative load hardening enabled")
diff --git a/contrib/llvm-project/clang/include/clang/Basic/OpenACCKinds.h b/contrib/llvm-project/clang/include/clang/Basic/OpenACCKinds.h
index 62c0a4c1a9de..3117d584d347 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/OpenACCKinds.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/OpenACCKinds.h
@@ -69,6 +69,30 @@ enum class OpenACCAtomicKind {
Capture,
Invalid,
};
+
+/// Represents the kind of an OpenACC clause.
+enum class OpenACCClauseKind {
+ // 'finalize' clause, allowed on 'exit data' directive.
+ Finalize,
+ // 'if_present' clause, allowed on 'host_data' and 'update' directives.
+ IfPresent,
+ // 'seq' clause, allowed on 'loop' and 'routine' directives.
+ Seq,
+ // 'independent' clause, allowed on 'loop' directives.
+ Independent,
+ // 'auto' clause, allowed on 'loop' directives.
+ Auto,
+ // 'worker' clause, allowed on 'loop' and 'routine' directives.
+ Worker,
+ // 'vector' clause, allowed on 'loop' and 'routine' directives. Takes no
+ // arguments for 'routine', so the 'loop' version is not yet implemented
+ // completely.
+ Vector,
+ // 'nohost' clause, allowed on 'routine' directives.
+ NoHost,
+ // Represents an invalid clause, for the purposes of parsing.
+ Invalid,
+};
} // namespace clang
#endif // LLVM_CLANG_BASIC_OPENACCKINDS_H
diff --git a/contrib/llvm-project/clang/include/clang/Basic/PlistSupport.h b/contrib/llvm-project/clang/include/clang/Basic/PlistSupport.h
index 557462a5b90d..d52d196019cf 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/PlistSupport.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/PlistSupport.h
@@ -77,8 +77,7 @@ inline raw_ostream &EmitInteger(raw_ostream &o, int64_t value) {
inline raw_ostream &EmitString(raw_ostream &o, StringRef s) {
o << "<string>";
- for (StringRef::const_iterator I = s.begin(), E = s.end(); I != E; ++I) {
- char c = *I;
+ for (char c : s) {
switch (c) {
default:
o << c;
diff --git a/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h b/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
index aa0f5023104a..ac3c324c6c29 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
@@ -1372,6 +1372,7 @@ public:
LangOptions::SignReturnAddressKeyKind SignKey =
LangOptions::SignReturnAddressKeyKind::AKey;
bool BranchTargetEnforcement = false;
+ bool BranchProtectionPAuthLR = false;
};
/// Determine if the Architecture in this TargetInfo supports branch
diff --git a/contrib/llvm-project/clang/include/clang/Basic/Version.h b/contrib/llvm-project/clang/include/clang/Basic/Version.h
index 2881d8db954e..8e4e6928fded 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/Version.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/Version.h
@@ -40,6 +40,9 @@ namespace clang {
/// string as getClangRevision.
std::string getLLVMRevision();
+ /// Retrieves the Clang vendor tag.
+ std::string getClangVendor();
+
/// Retrieves the full repository version that is an amalgamation of
/// the information in getClangRepositoryPath() and getClangRevision().
std::string getClangFullRepositoryVersion();
diff --git a/contrib/llvm-project/clang/include/clang/Basic/arm_sme.td b/contrib/llvm-project/clang/include/clang/Basic/arm_sme.td
index fcff6fe35b7b..aac3bd486de9 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/arm_sme.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/arm_sme.td
@@ -299,6 +299,44 @@ multiclass ZAAddSub<string n_suffix> {
defm SVADD : ZAAddSub<"add">;
defm SVSUB : ZAAddSub<"sub">;
+// SME2 - MOVA
+
+//
+// Single, 2 and 4 vector-group read/write intrinsics.
+//
+
+multiclass ZAWrite_VG<string n, string t, string i, list<ImmCheck> checks> {
+ def NAME # _VG2_H : Inst<"svwrite_hor_" # n # "[_{d}]_vg2", "vim2", t, MergeNone, i # "_hor_vg2", [IsSharedZA, IsStreaming], checks>;
+ def NAME # _VG2_V : Inst<"svwrite_ver_" # n # "[_{d}]_vg2", "vim2", t, MergeNone, i # "_ver_vg2", [IsSharedZA, IsStreaming], checks>;
+ def NAME # _VG4_H : Inst<"svwrite_hor_" # n # "[_{d}]_vg4", "vim4", t, MergeNone, i # "_hor_vg4", [IsSharedZA, IsStreaming], checks>;
+ def NAME # _VG4_V : Inst<"svwrite_ver_" # n # "[_{d}]_vg4", "vim4", t, MergeNone, i # "_ver_vg4", [IsSharedZA, IsStreaming], checks>;
+ def NAME # _VG1x2 : Inst<"svwrite_" # n # "[_{d}]_vg1x2", "vm2", t, MergeNone, i # "_vg1x2", [IsSharedZA, IsStreaming], []>;
+ def NAME # _VG1x4 : Inst<"svwrite_" # n # "[_{d}]_vg1x4", "vm4", t, MergeNone, i # "_vg1x4", [IsSharedZA, IsStreaming], []>;
+}
+
+let TargetGuard = "sme2" in {
+ defm SVWRITE_ZA8 : ZAWrite_VG<"za8", "cUc", "aarch64_sme_write", [ImmCheck<0, ImmCheck0_0>]>;
+ defm SVWRITE_ZA16 : ZAWrite_VG<"za16", "sUshb", "aarch64_sme_write", [ImmCheck<0, ImmCheck0_1>]>;
+ defm SVWRITE_ZA32 : ZAWrite_VG<"za32", "iUif", "aarch64_sme_write", [ImmCheck<0, ImmCheck0_3>]>;
+ defm SVWRITE_ZA64 : ZAWrite_VG<"za64", "lUld", "aarch64_sme_write", [ImmCheck<0, ImmCheck0_7>]>;
+}
+
+multiclass ZARead_VG<string n, string t, string i, list<ImmCheck> checks> {
+ def NAME # _VG2_H : Inst<"svread_hor_" # n # "_{d}_vg2", "2im", t, MergeNone, i # "_hor_vg2", [IsSharedZA, IsPreservesZA, IsStreaming], checks>;
+ def NAME # _VG2_V : Inst<"svread_ver_" # n # "_{d}_vg2", "2im", t, MergeNone, i # "_ver_vg2", [IsSharedZA, IsPreservesZA, IsStreaming], checks>;
+ def NAME # _VG4_H : Inst<"svread_hor_" # n # "_{d}_vg4", "4im", t, MergeNone, i # "_hor_vg4", [IsSharedZA, IsPreservesZA, IsStreaming], checks>;
+ def NAME # _VG4_V : Inst<"svread_ver_" # n # "_{d}_vg4", "4im", t, MergeNone, i # "_ver_vg4", [IsSharedZA, IsPreservesZA, IsStreaming], checks>;
+ def NAME # _VG1x2 : Inst<"svread_" # n # "_{d}_vg1x2", "2m", t, MergeNone, i # "_vg1x2", [IsSharedZA, IsPreservesZA, IsStreaming], []>;
+ def NAME # _VG1x4 : Inst<"svread_" # n # "_{d}_vg1x4", "4m", t, MergeNone, i # "_vg1x4", [IsSharedZA, IsPreservesZA, IsStreaming], []>;
+}
+
+let TargetGuard = "sme2" in {
+ defm SVREAD_ZA8 : ZARead_VG<"za8", "cUc", "aarch64_sme_read", [ImmCheck<0, ImmCheck0_0>]>;
+ defm SVREAD_ZA16 : ZARead_VG<"za16", "sUshb", "aarch64_sme_read", [ImmCheck<0, ImmCheck0_1>]>;
+ defm SVREAD_ZA32 : ZARead_VG<"za32", "iUif", "aarch64_sme_read", [ImmCheck<0, ImmCheck0_3>]>;
+ defm SVREAD_ZA64 : ZARead_VG<"za64", "lUld", "aarch64_sme_read", [ImmCheck<0, ImmCheck0_7>]>;
+}
+
//
// Outer product and accumulate/subtract
//
@@ -313,6 +351,285 @@ let TargetGuard = "sme2" in {
def SVBMOPA : Inst<"svbmopa_za32[_{d}]_m", "viPPdd", "iUi", MergeNone, "aarch64_sme_bmopa_za32", [IsSharedZA, IsStreaming], [ImmCheck<0, ImmCheck0_3>]>;
def SVBMOPS : Inst<"svbmops_za32[_{d}]_m", "viPPdd", "iUi", MergeNone, "aarch64_sme_bmops_za32", [IsSharedZA, IsStreaming], [ImmCheck<0, ImmCheck0_3>]>;
+
+ // VERTICAL DOT-PRODUCT
+ def SVVDOT_LANE_ZA32_VG1x2_S : Inst<"svvdot_lane_za32[_{d}]_vg1x2", "vm2di", "s", MergeNone, "aarch64_sme_svdot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVVDOT_LANE_ZA32_VG1x4_S : Inst<"svvdot_lane_za32[_{d}]_vg1x4", "vm4di", "c", MergeNone, "aarch64_sme_svdot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVVDOT_LANE_ZA32_VG1x2_U : Inst<"svvdot_lane_za32[_{d}]_vg1x2", "vm2di", "Us", MergeNone, "aarch64_sme_uvdot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVVDOT_LANE_ZA32_VG1x4_U : Inst<"svvdot_lane_za32[_{d}]_vg1x4", "vm4di", "Uc", MergeNone, "aarch64_sme_uvdot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVVDOT_LANE_ZA32_VG1x2_F : Inst<"svvdot_lane_za32[_{d}]_vg1x2", "vm2di", "hb", MergeNone, "aarch64_sme_fvdot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVSUVDOT_LANE_ZA32_VG1x4 : Inst<"svsuvdot_lane_za32[_{d}]_vg1x4", "vm4di", "c", MergeNone, "aarch64_sme_suvdot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVUSVDOT_LANE_ZA32_VG1x4 : Inst<"svusvdot_lane_za32[_{d}]_vg1x4", "vm4di", "Uc", MergeNone, "aarch64_sme_usvdot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+
+ // Multi-vector signed & unsigned integer dot-product
+ def SVDOT_MULTI_ZA32_VG1x2_S : Inst<"svdot_za32[_{d}]_vg1x2", "vm22", "cs", MergeNone, "aarch64_sme_sdot_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_MULTI_ZA32_VG1x4_S : Inst<"svdot_za32[_{d}]_vg1x4", "vm44", "cs", MergeNone, "aarch64_sme_sdot_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_MULTI_ZA32_VG1x2_U : Inst<"svdot_za32[_{d}]_vg1x2", "vm22", "UcUs", MergeNone, "aarch64_sme_udot_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_MULTI_ZA32_VG1x4_U : Inst<"svdot_za32[_{d}]_vg1x4", "vm44", "UcUs", MergeNone, "aarch64_sme_udot_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA32_VG1x2_S : Inst<"svdot[_single]_za32[_{d}]_vg1x2", "vm2d", "cs", MergeNone, "aarch64_sme_sdot_single_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA32_VG1x4_S : Inst<"svdot[_single]_za32[_{d}]_vg1x4", "vm4d", "cs", MergeNone, "aarch64_sme_sdot_single_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA32_VG1x2_U : Inst<"svdot[_single]_za32[_{d}]_vg1x2", "vm2d", "UcUs", MergeNone, "aarch64_sme_udot_single_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA32_VG1x4_U : Inst<"svdot[_single]_za32[_{d}]_vg1x4", "vm4d", "UcUs", MergeNone, "aarch64_sme_udot_single_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_LANE_ZA32_VG1x2_S : Inst<"svdot_lane_za32[_{d}]_vg1x2", "vm2di", "cs", MergeNone, "aarch64_sme_sdot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVDOT_LANE_ZA32_VG1x4_S : Inst<"svdot_lane_za32[_{d}]_vg1x4", "vm4di", "cs", MergeNone, "aarch64_sme_sdot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVDOT_LANE_ZA32_VG1x2_U : Inst<"svdot_lane_za32[_{d}]_vg1x2", "vm2di", "UcUs", MergeNone, "aarch64_sme_udot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVDOT_LANE_ZA32_VG1x4_U : Inst<"svdot_lane_za32[_{d}]_vg1x4", "vm4di", "UcUs", MergeNone, "aarch64_sme_udot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+
+ def SVUSDOT_SINGLE_ZA32_VG1x2 : Inst<"svusdot[_single]_za32[_{d}]_vg1x2", "vm2.dx", "Uc", MergeNone, "aarch64_sme_usdot_single_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVUSDOT_SINGLE_ZA32_VG1x4 : Inst<"svusdot[_single]_za32[_{d}]_vg1x4", "vm4.dx", "Uc", MergeNone, "aarch64_sme_usdot_single_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVUSDOT_MULTI_ZA32_VG1x2 : Inst<"svusdot_za32[_{d}]_vg1x2", "vm2.d2.x", "Uc", MergeNone, "aarch64_sme_usdot_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVUSDOT_MULTI_ZA32_VG1x4 : Inst<"svusdot_za32[_{d}]_vg1x4", "vm4.d4.x", "Uc", MergeNone, "aarch64_sme_usdot_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVUSDOT_LANE_ZA32_VG1x2 : Inst<"svusdot_lane_za32[_{d}]_vg1x2", "vm2.dxi", "Uc", MergeNone, "aarch64_sme_usdot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVUSDOT_LANE_ZA32_VG1x4 : Inst<"svusdot_lane_za32[_{d}]_vg1x4", "vm4.dxi", "Uc", MergeNone, "aarch64_sme_usdot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+
+ def SVSUDOT_SINGLE_ZA32_VG1x2 : Inst<"svsudot[_single]_za32[_{d}]_vg1x2", "vm2.du", "c", MergeNone, "aarch64_sme_sudot_single_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVSUDOT_SINGLE_ZA32_VG1x4 : Inst<"svsudot[_single]_za32[_{d}]_vg1x4", "vm4.du", "c", MergeNone, "aarch64_sme_sudot_single_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+
+ // Multi-multi sudot builtins are mapped to usdot, with zn & zm operands swapped
+ def SVSUDOT_MULTI_ZA32_VG1x2 : Inst<"svsudot_za32[_{d}]_vg1x2", "vm2.d2.u", "c", MergeNone, "aarch64_sme_usdot_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVSUDOT_MULTI_ZA32_VG1x4 : Inst<"svsudot_za32[_{d}]_vg1x4", "vm4.d4.u", "c", MergeNone, "aarch64_sme_usdot_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVSUDOT_LANE_ZA32_VG1x2 : Inst<"svsudot_lane_za32[_{d}]_vg1x2", "vm2.dui", "c", MergeNone, "aarch64_sme_sudot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVSUDOT_LANE_ZA32_VG1x4 : Inst<"svsudot_lane_za32[_{d}]_vg1x4", "vm4.dui", "c", MergeNone, "aarch64_sme_sudot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+
+ // Multi-vector half-precision/BFloat16 floating-point dot-product
+ def SVDOT_MULTI_ZA32_VG1x2_F16 : Inst<"svdot_za32[_{d}]_vg1x2", "vm22", "bh", MergeNone, "aarch64_sme_fdot_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_MULTI_ZA32_VG1x4_F16 : Inst<"svdot_za32[_{d}]_vg1x4", "vm44", "bh", MergeNone, "aarch64_sme_fdot_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA32_VG1x2_F16 : Inst<"svdot[_single]_za32[_{d}]_vg1x2", "vm2d", "bh", MergeNone, "aarch64_sme_fdot_single_za32_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA32_VG1x4_F16 : Inst<"svdot[_single]_za32[_{d}]_vg1x4", "vm4d", "bh", MergeNone, "aarch64_sme_fdot_single_za32_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_LANE_ZA32_VG1x2_F16 : Inst<"svdot_lane_za32[_{d}]_vg1x2", "vm2di", "bh", MergeNone, "aarch64_sme_fdot_lane_za32_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVDOT_LANE_ZA32_VG1x4_F16 : Inst<"svdot_lane_za32[_{d}]_vg1x4", "vm4di", "bh", MergeNone, "aarch64_sme_fdot_lane_za32_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+}
+
+let TargetGuard = "sme2,sme-i16i64" in {
+ def SVVDOT_LANE_ZA64_VG1x4_S : Inst<"svvdot_lane_za64[_{d}]_vg1x4", "vm4di", "s", MergeNone, "aarch64_sme_svdot_lane_za64_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+ def SVVDOT_LANE_ZA64_VG1x4_U : Inst<"svvdot_lane_za64[_{d}]_vg1x4", "vm4di", "Us", MergeNone, "aarch64_sme_uvdot_lane_za64_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+
+ def SVDOT_MULTI_ZA64_VG1x2_S16 : Inst<"svdot_za64[_{d}]_vg1x2", "vm22", "s", MergeNone, "aarch64_sme_sdot_za64_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_MULTI_ZA64_VG1x4_S16 : Inst<"svdot_za64[_{d}]_vg1x4", "vm44", "s", MergeNone, "aarch64_sme_sdot_za64_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_MULTI_ZA64_VG1x2_U16 : Inst<"svdot_za64[_{d}]_vg1x2", "vm22", "Us", MergeNone, "aarch64_sme_udot_za64_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_MULTI_ZA64_VG1x4_U16 : Inst<"svdot_za64[_{d}]_vg1x4", "vm44", "Us", MergeNone, "aarch64_sme_udot_za64_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA64_VG1x2_S16 : Inst<"svdot[_single]_za64[_{d}]_vg1x2", "vm2d", "s", MergeNone, "aarch64_sme_sdot_single_za64_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA64_VG1x4_S16 : Inst<"svdot[_single]_za64[_{d}]_vg1x4", "vm4d", "s", MergeNone, "aarch64_sme_sdot_single_za64_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA64_VG1x2_U16 : Inst<"svdot[_single]_za64[_{d}]_vg1x2", "vm2d", "Us", MergeNone, "aarch64_sme_udot_single_za64_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_SINGLE_ZA64_VG1x4_U16 : Inst<"svdot[_single]_za64[_{d}]_vg1x4", "vm4d", "Us", MergeNone, "aarch64_sme_udot_single_za64_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVDOT_LANE_ZA64_VG1x2_S16 : Inst<"svdot_lane_za64[_{d}]_vg1x2", "vm2di", "s", MergeNone, "aarch64_sme_sdot_lane_za64_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+ def SVDOT_LANE_ZA64_VG1x4_S16 : Inst<"svdot_lane_za64[_{d}]_vg1x4", "vm4di", "s", MergeNone, "aarch64_sme_sdot_lane_za64_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+ def SVDOT_LANE_ZA64_VG1x2_U16 : Inst<"svdot_lane_za64[_{d}]_vg1x2", "vm2di", "Us", MergeNone, "aarch64_sme_udot_lane_za64_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+ def SVDOT_LANE_ZA64_VG1x4_U16 : Inst<"svdot_lane_za64[_{d}]_vg1x4", "vm4di", "Us", MergeNone, "aarch64_sme_udot_lane_za64_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+}
+
+// FMLA/FMLS
+let TargetGuard = "sme2" in {
+ def SVMLA_MULTI_VG1x2_F32 : Inst<"svmla_za32[_{d}]_vg1x2", "vm22", "f", MergeNone, "aarch64_sme_fmla_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLA_MULTI_VG1x4_F32 : Inst<"svmla_za32[_{d}]_vg1x4", "vm44", "f", MergeNone, "aarch64_sme_fmla_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_MULTI_VG1x2_F32 : Inst<"svmls_za32[_{d}]_vg1x2", "vm22", "f", MergeNone, "aarch64_sme_fmls_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_MULTI_VG1x4_F32 : Inst<"svmls_za32[_{d}]_vg1x4", "vm44", "f", MergeNone, "aarch64_sme_fmls_vg1x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLA_SINGLE_VG1x2_F32 : Inst<"svmla[_single]_za32[_{d}]_vg1x2", "vm2d", "f", MergeNone, "aarch64_sme_fmla_single_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLA_SINGLE_VG1x4_F32 : Inst<"svmla[_single]_za32[_{d}]_vg1x4", "vm4d", "f", MergeNone, "aarch64_sme_fmla_single_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_SINGLE_VG1x2_F32 : Inst<"svmls[_single]_za32[_{d}]_vg1x2", "vm2d", "f", MergeNone, "aarch64_sme_fmls_single_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_SINGLE_VG1x4_F32 : Inst<"svmls[_single]_za32[_{d}]_vg1x4", "vm4d", "f", MergeNone, "aarch64_sme_fmls_single_vg1x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLA_LANE_VG1x2_F32 : Inst<"svmla_lane_za32[_{d}]_vg1x2", "vm2di", "f", MergeNone, "aarch64_sme_fmla_lane_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVMLA_LANE_VG1x4_F32 : Inst<"svmla_lane_za32[_{d}]_vg1x4", "vm4di", "f", MergeNone, "aarch64_sme_fmla_lane_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVMLS_LANE_VG1x2_F32 : Inst<"svmls_lane_za32[_{d}]_vg1x2", "vm2di", "f", MergeNone, "aarch64_sme_fmls_lane_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVMLS_LANE_VG1x4_F32 : Inst<"svmls_lane_za32[_{d}]_vg1x4", "vm4di", "f", MergeNone, "aarch64_sme_fmls_lane_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_3>]>;
+}
+
+let TargetGuard = "sme2,sme-f64f64" in {
+ def SVMLA_MULTI_VG1x2_F64 : Inst<"svmla_za64[_{d}]_vg1x2", "vm22", "d", MergeNone, "aarch64_sme_fmla_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLA_MULTI_VG1x4_F64 : Inst<"svmla_za64[_{d}]_vg1x4", "vm44", "d", MergeNone, "aarch64_sme_fmla_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_MULTI_VG1x2_F64 : Inst<"svmls_za64[_{d}]_vg1x2", "vm22", "d", MergeNone, "aarch64_sme_fmls_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_MULTI_VG1x4_F64 : Inst<"svmls_za64[_{d}]_vg1x4", "vm44", "d", MergeNone, "aarch64_sme_fmls_vg1x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLA_SINGLE_VG1x2_F64 : Inst<"svmla[_single]_za64[_{d}]_vg1x2", "vm2d", "d", MergeNone, "aarch64_sme_fmla_single_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLA_SINGLE_VG1x4_F64 : Inst<"svmla[_single]_za64[_{d}]_vg1x4", "vm4d", "d", MergeNone, "aarch64_sme_fmla_single_vg1x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_SINGLE_VG1x2_F64 : Inst<"svmls[_single]_za64[_{d}]_vg1x2", "vm2d", "d", MergeNone, "aarch64_sme_fmls_single_vg1x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLS_SINGLE_VG1x4_F64 : Inst<"svmls[_single]_za64[_{d}]_vg1x4", "vm4d", "d", MergeNone, "aarch64_sme_fmls_single_vg1x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLA_LANE_VG1x2_F64 : Inst<"svmla_lane_za64[_{d}]_vg1x2", "vm2di", "d", MergeNone, "aarch64_sme_fmla_lane_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+ def SVMLA_LANE_VG1x4_F64 : Inst<"svmla_lane_za64[_{d}]_vg1x4", "vm4di", "d", MergeNone, "aarch64_sme_fmla_lane_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+ def SVMLS_LANE_VG1x2_F64 : Inst<"svmls_lane_za64[_{d}]_vg1x2", "vm2di", "d", MergeNone, "aarch64_sme_fmls_lane_vg1x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+ def SVMLS_LANE_VG1x4_F64 : Inst<"svmls_lane_za64[_{d}]_vg1x4", "vm4di", "d", MergeNone, "aarch64_sme_fmls_lane_vg1x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_1>]>;
+}
+
+// FMLAL/FMLSL/UMLAL/SMLAL
+// SMLALL/UMLALL/USMLALL/SUMLALL
+let TargetGuard = "sme2" in {
+ // MULTI MLAL
+ def SVMLAL_MULTI_VG2x2_F16 : Inst<"svmla_za32[_{d}]_vg2x2", "vm22", "bh", MergeNone, "aarch64_sme_fmlal_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG2x4_F16 : Inst<"svmla_za32[_{d}]_vg2x4", "vm44", "bh", MergeNone, "aarch64_sme_fmlal_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG2x2_S16 : Inst<"svmla_za32[_{d}]_vg2x2", "vm22", "s", MergeNone, "aarch64_sme_smlal_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG2x4_S16 : Inst<"svmla_za32[_{d}]_vg2x4", "vm44", "s", MergeNone, "aarch64_sme_smlal_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG2x2_U16 : Inst<"svmla_za32[_{d}]_vg2x2", "vm22", "Us", MergeNone, "aarch64_sme_umlal_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG2x4_U16 : Inst<"svmla_za32[_{d}]_vg2x4", "vm44", "Us", MergeNone, "aarch64_sme_umlal_vg2x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLAL_MULTI_VG4x2_S8 : Inst<"svmla_za32[_{d}]_vg4x2", "vm22", "c", MergeNone, "aarch64_sme_smla_za32_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG4x2_U8 : Inst<"svmla_za32[_{d}]_vg4x2", "vm22", "Uc", MergeNone, "aarch64_sme_umla_za32_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG4x4_S8 : Inst<"svmla_za32[_{d}]_vg4x4", "vm44", "c", MergeNone, "aarch64_sme_smla_za32_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG4x4_U8 : Inst<"svmla_za32[_{d}]_vg4x4", "vm44", "Uc", MergeNone, "aarch64_sme_umla_za32_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // MULTI MLSL
+ def SVMLSL_MULTI_VG2x2_F16 : Inst<"svmls_za32[_{d}]_vg2x2", "vm22", "bh", MergeNone, "aarch64_sme_fmlsl_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG2x4_F16 : Inst<"svmls_za32[_{d}]_vg2x4", "vm44", "bh", MergeNone, "aarch64_sme_fmlsl_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG2x2_S16 : Inst<"svmls_za32[_{d}]_vg2x2", "vm22", "s", MergeNone, "aarch64_sme_smlsl_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG2x4_S16 : Inst<"svmls_za32[_{d}]_vg2x4", "vm44", "s", MergeNone, "aarch64_sme_smlsl_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG2x2_U16 : Inst<"svmls_za32[_{d}]_vg2x2", "vm22", "Us", MergeNone, "aarch64_sme_umlsl_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG2x4_U16 : Inst<"svmls_za32[_{d}]_vg2x4", "vm44", "Us", MergeNone, "aarch64_sme_umlsl_vg2x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLSL_MULTI_VG4x2_S8 : Inst<"svmls_za32[_{d}]_vg4x2", "vm22", "c", MergeNone, "aarch64_sme_smls_za32_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG4x2_U8 : Inst<"svmls_za32[_{d}]_vg4x2", "vm22", "Uc", MergeNone, "aarch64_sme_umls_za32_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG4x4_S8 : Inst<"svmls_za32[_{d}]_vg4x4", "vm44", "c", MergeNone, "aarch64_sme_smls_za32_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG4x4_U8 : Inst<"svmls_za32[_{d}]_vg4x4", "vm44", "Uc", MergeNone, "aarch64_sme_umls_za32_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // SINGLE MLAL
+ def SVMLAL_SINGLE_VG2x1_F16 : Inst<"svmla_za32[_{d}]_vg2x1", "vmdd", "bh", MergeNone, "aarch64_sme_fmlal_single_vg2x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x2_F16 : Inst<"svmla[_single]_za32[_{d}]_vg2x2", "vm2d", "bh", MergeNone, "aarch64_sme_fmlal_single_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x4_F16 : Inst<"svmla[_single]_za32[_{d}]_vg2x4", "vm4d", "bh", MergeNone, "aarch64_sme_fmlal_single_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x1_S16 : Inst<"svmla_za32[_{d}]_vg2x1", "vmdd", "s", MergeNone, "aarch64_sme_smlal_single_vg2x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x2_S16 : Inst<"svmla[_single]_za32[_{d}]_vg2x2", "vm2d", "s", MergeNone, "aarch64_sme_smlal_single_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x4_S16 : Inst<"svmla[_single]_za32[_{d}]_vg2x4", "vm4d", "s", MergeNone, "aarch64_sme_smlal_single_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x1_U16 : Inst<"svmla_za32[_{d}]_vg2x1", "vmdd", "Us", MergeNone, "aarch64_sme_umlal_single_vg2x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x2_U16 : Inst<"svmla[_single]_za32[_{d}]_vg2x2", "vm2d", "Us", MergeNone, "aarch64_sme_umlal_single_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG2x4_U16 : Inst<"svmla[_single]_za32[_{d}]_vg2x4", "vm4d", "Us", MergeNone, "aarch64_sme_umlal_single_vg2x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLAL_SINGLE_VG4x1_S8 : Inst<"svmla_za32[_{d}]_vg4x1", "vmdd", "c", MergeNone, "aarch64_sme_smla_za32_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x1_U8 : Inst<"svmla_za32[_{d}]_vg4x1", "vmdd", "Uc", MergeNone, "aarch64_sme_umla_za32_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x2_S8 : Inst<"svmla[_single]_za32[_{d}]_vg4x2", "vm2d", "c", MergeNone, "aarch64_sme_smla_za32_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x2_U8 : Inst<"svmla[_single]_za32[_{d}]_vg4x2", "vm2d", "Uc", MergeNone, "aarch64_sme_umla_za32_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x4_S8 : Inst<"svmla[_single]_za32[_{d}]_vg4x4", "vm4d", "c", MergeNone, "aarch64_sme_smla_za32_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x4_U8 : Inst<"svmla[_single]_za32[_{d}]_vg4x4", "vm4d", "Uc", MergeNone, "aarch64_sme_umla_za32_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // SINGLE MLSL
+ def SVMLSL_SINGLE_VG2x1_F16 : Inst<"svmls_za32[_{d}]_vg2x1", "vmdd", "bh", MergeNone, "aarch64_sme_fmlsl_single_vg2x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x2_F16 : Inst<"svmls[_single]_za32[_{d}]_vg2x2", "vm2d", "bh", MergeNone, "aarch64_sme_fmlsl_single_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x4_F16 : Inst<"svmls[_single]_za32[_{d}]_vg2x4", "vm4d", "bh", MergeNone, "aarch64_sme_fmlsl_single_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x1_S16 : Inst<"svmls_za32[_{d}]_vg2x1", "vmdd", "s", MergeNone, "aarch64_sme_smlsl_single_vg2x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x2_S16 : Inst<"svmls[_single]_za32[_{d}]_vg2x2", "vm2d", "s", MergeNone, "aarch64_sme_smlsl_single_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x4_S16 : Inst<"svmls[_single]_za32[_{d}]_vg2x4", "vm4d", "s", MergeNone, "aarch64_sme_smlsl_single_vg2x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x1_U16 : Inst<"svmls_za32[_{d}]_vg2x1", "vmdd", "Us", MergeNone, "aarch64_sme_umlsl_single_vg2x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x2_U16 : Inst<"svmls[_single]_za32[_{d}]_vg2x2", "vm2d", "Us", MergeNone, "aarch64_sme_umlsl_single_vg2x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG2x4_U16 : Inst<"svmls[_single]_za32[_{d}]_vg2x4", "vm4d", "Us", MergeNone, "aarch64_sme_umlsl_single_vg2x4", [IsStreaming, IsSharedZA], []>;
+
+ def SVMLSL_SINGLE_VG4x1_S8 : Inst<"svmls_za32[_{d}]_vg4x1", "vmdd", "c", MergeNone, "aarch64_sme_smls_za32_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x1_U8 : Inst<"svmls_za32[_{d}]_vg4x1", "vmdd", "Uc", MergeNone, "aarch64_sme_umls_za32_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x2_S8 : Inst<"svmls[_single]_za32[_{d}]_vg4x2", "vm2d", "c", MergeNone, "aarch64_sme_smls_za32_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x2_U8 : Inst<"svmls[_single]_za32[_{d}]_vg4x2", "vm2d", "Uc", MergeNone, "aarch64_sme_umls_za32_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x4_S8 : Inst<"svmls[_single]_za32[_{d}]_vg4x4", "vm4d", "c", MergeNone, "aarch64_sme_smls_za32_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x4_U8 : Inst<"svmls[_single]_za32[_{d}]_vg4x4", "vm4d", "Uc", MergeNone, "aarch64_sme_umls_za32_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // INDEXED MLAL
+ def SVMLAL_LANE_VG2x1_F16 : Inst<"svmla_lane_za32[_{d}]_vg2x1", "vmddi", "bh", MergeNone, "aarch64_sme_fmlal_lane_vg2x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x2_F16 : Inst<"svmla_lane_za32[_{d}]_vg2x2", "vm2di", "bh", MergeNone, "aarch64_sme_fmlal_lane_vg2x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x4_F16 : Inst<"svmla_lane_za32[_{d}]_vg2x4", "vm4di", "bh", MergeNone, "aarch64_sme_fmlal_lane_vg2x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x1_S16 : Inst<"svmla_lane_za32[_{d}]_vg2x1", "vmddi", "s", MergeNone, "aarch64_sme_smlal_lane_vg2x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x2_S16 : Inst<"svmla_lane_za32[_{d}]_vg2x2", "vm2di", "s", MergeNone, "aarch64_sme_smlal_lane_vg2x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x4_S16 : Inst<"svmla_lane_za32[_{d}]_vg2x4", "vm4di", "s", MergeNone, "aarch64_sme_smlal_lane_vg2x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x1_U16 : Inst<"svmla_lane_za32[_{d}]_vg2x1", "vmddi", "Us", MergeNone, "aarch64_sme_umlal_lane_vg2x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x2_U16 : Inst<"svmla_lane_za32[_{d}]_vg2x2", "vm2di", "Us", MergeNone, "aarch64_sme_umlal_lane_vg2x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG2x4_U16 : Inst<"svmla_lane_za32[_{d}]_vg2x4", "vm4di", "Us", MergeNone, "aarch64_sme_umlal_lane_vg2x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+
+ def SVMLAL_LANE_VG4x1_S8 : Inst<"svmla_lane_za32[_{d}]_vg4x1", "vmddi", "c", MergeNone, "aarch64_sme_smla_za32_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLAL_LANE_VG4x1_U8 : Inst<"svmla_lane_za32[_{d}]_vg4x1", "vmddi", "Uc", MergeNone, "aarch64_sme_umla_za32_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLAL_LANE_VG4x2_S8 : Inst<"svmla_lane_za32[_{d}]_vg4x2", "vm2di", "c", MergeNone, "aarch64_sme_smla_za32_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLAL_LANE_VG4x2_U8 : Inst<"svmla_lane_za32[_{d}]_vg4x2", "vm2di", "Uc", MergeNone, "aarch64_sme_umla_za32_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLAL_LANE_VG4x4_S8 : Inst<"svmla_lane_za32[_{d}]_vg4x4", "vm4di", "c", MergeNone, "aarch64_sme_smla_za32_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLAL_LANE_VG4x4_U8 : Inst<"svmla_lane_za32[_{d}]_vg4x4", "vm4di", "Uc", MergeNone, "aarch64_sme_umla_za32_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+
+ // INDEXED MLSL
+ def SVMLSL_LANE_VG2x1_F16 : Inst<"svmls_lane_za32[_{d}]_vg2x1", "vmddi", "bh", MergeNone, "aarch64_sme_fmlsl_lane_vg2x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x2_F16 : Inst<"svmls_lane_za32[_{d}]_vg2x2", "vm2di", "bh", MergeNone, "aarch64_sme_fmlsl_lane_vg2x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x4_F16 : Inst<"svmls_lane_za32[_{d}]_vg2x4", "vm4di", "bh", MergeNone, "aarch64_sme_fmlsl_lane_vg2x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x1_S16 : Inst<"svmls_lane_za32[_{d}]_vg2x1", "vmddi", "s", MergeNone, "aarch64_sme_smlsl_lane_vg2x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x2_S16 : Inst<"svmls_lane_za32[_{d}]_vg2x2", "vm2di", "s", MergeNone, "aarch64_sme_smlsl_lane_vg2x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x4_S16 : Inst<"svmls_lane_za32[_{d}]_vg2x4", "vm4di", "s", MergeNone, "aarch64_sme_smlsl_lane_vg2x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x1_U16 : Inst<"svmls_lane_za32[_{d}]_vg2x1", "vmddi", "Us", MergeNone, "aarch64_sme_umlsl_lane_vg2x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x2_U16 : Inst<"svmls_lane_za32[_{d}]_vg2x2", "vm2di", "Us", MergeNone, "aarch64_sme_umlsl_lane_vg2x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG2x4_U16 : Inst<"svmls_lane_za32[_{d}]_vg2x4", "vm4di", "Us", MergeNone, "aarch64_sme_umlsl_lane_vg2x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+
+ def SVMLSL_LANE_VG4x1_S8 : Inst<"svmls_lane_za32[_{d}]_vg4x1", "vmddi", "c", MergeNone, "aarch64_sme_smls_za32_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLSL_LANE_VG4x1_U8 : Inst<"svmls_lane_za32[_{d}]_vg4x1", "vmddi", "Uc", MergeNone, "aarch64_sme_umls_za32_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLSL_LANE_VG4x2_S8 : Inst<"svmls_lane_za32[_{d}]_vg4x2", "vm2di", "c", MergeNone, "aarch64_sme_smls_za32_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLSL_LANE_VG4x2_U8 : Inst<"svmls_lane_za32[_{d}]_vg4x2", "vm2di", "Uc", MergeNone, "aarch64_sme_umls_za32_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLSL_LANE_VG4x4_S8 : Inst<"svmls_lane_za32[_{d}]_vg4x4", "vm4di", "c", MergeNone, "aarch64_sme_smls_za32_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVMLSL_LANE_VG4x4_U8 : Inst<"svmls_lane_za32[_{d}]_vg4x4", "vm4di", "Uc", MergeNone, "aarch64_sme_umls_za32_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+
+ // SINGLE SUMLALL
+ // Single sumla maps to usmla, with zn & zm operands swapped
+ def SVSUMLALL_SINGLE_VG4x1 : Inst<"svsumla_za32[_{d}]_vg4x1", "vmdu", "c", MergeNone, "aarch64_sme_usmla_za32_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+
+ def SVSUMLALL_SINGLE_VG4x2 : Inst<"svsumla[_single]_za32[_{d}]_vg4x2", "vm2.du", "c", MergeNone, "aarch64_sme_sumla_za32_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVSUMLALL_SINGLE_VG4x4 : Inst<"svsumla[_single]_za32[_{d}]_vg4x4", "vm4.du", "c", MergeNone, "aarch64_sme_sumla_za32_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // Multi-multi sumla builtins are mapped to usmla, with zn & zm operands swapped
+ def SVSUMLALL_MULTI_VG4x2 : Inst<"svsumla_za32[_{d}]_vg4x2", "vm2.d2.u", "c", MergeNone, "aarch64_sme_usmla_za32_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVSUMLALL_MULTI_VG4x4 : Inst<"svsumla_za32[_{d}]_vg4x4", "vm4.d4.u", "c", MergeNone, "aarch64_sme_usmla_za32_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // INDEXED SUMLALL
+ def SVSUMLALL_LANE_VG4x1 : Inst<"svsumla_lane_za32[_{d}]_vg4x1", "vmdui", "c", MergeNone, "aarch64_sme_sumla_za32_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVSUMLALL_LANE_VG4x2 : Inst<"svsumla_lane_za32[_{d}]_vg4x2", "vm2ui", "c", MergeNone, "aarch64_sme_sumla_za32_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVSUMLALL_LANE_VG4x4 : Inst<"svsumla_lane_za32[_{d}]_vg4x4", "vm4ui", "c", MergeNone, "aarch64_sme_sumla_za32_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+
+ // SINGLE USMLALL
+ def SVUSMLALL_SINGLE_VG4x1 : Inst<"svusmla_za32[_{d}]_vg4x1", "vmdx", "Uc", MergeNone, "aarch64_sme_usmla_za32_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVUSMLALL_SINGLE_VG4x2 : Inst<"svusmla[_single]_za32[_{d}]_vg4x2", "vm2.dx", "Uc", MergeNone, "aarch64_sme_usmla_za32_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVUSMLALL_SINGLE_VG4x4 : Inst<"svusmla[_single]_za32[_{d}]_vg4x4", "vm4.dx", "Uc", MergeNone, "aarch64_sme_usmla_za32_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // MULTI USMLALL
+ def SVUSMLALL_MULTI_VG4x2 : Inst<"svusmla_za32[_{d}]_vg4x2", "vm2.d2.x", "Uc", MergeNone, "aarch64_sme_usmla_za32_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVUSMLALL_MULTI_VG4x4 : Inst<"svusmla_za32[_{d}]_vg4x4", "vm4.d4.x", "Uc", MergeNone, "aarch64_sme_usmla_za32_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // INDEXED USMLALL
+ def SVUSMLALL_LANE_VG4x1 : Inst<"svusmla_lane_za32[_{d}]_vg4x1", "vmdxi", "Uc", MergeNone, "aarch64_sme_usmla_za32_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVUSMLALL_LANE_VG4x2 : Inst<"svusmla_lane_za32[_{d}]_vg4x2", "vm2xi", "Uc", MergeNone, "aarch64_sme_usmla_za32_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+ def SVUSMLALL_LANE_VG4x4 : Inst<"svusmla_lane_za32[_{d}]_vg4x4", "vm4xi", "Uc", MergeNone, "aarch64_sme_usmla_za32_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_15>]>;
+}
+
+let TargetGuard = "sme2,sme-i16i64" in {
+ // MULTI MLAL
+ def SVMLAL_MULTI_VG4x2_S16 : Inst<"svmla_za64[_{d}]_vg4x2", "vm22", "s", MergeNone, "aarch64_sme_smla_za64_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG4x2_U16 : Inst<"svmla_za64[_{d}]_vg4x2", "vm22", "Us", MergeNone, "aarch64_sme_umla_za64_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG4x4_S16 : Inst<"svmla_za64[_{d}]_vg4x4", "vm44", "s", MergeNone, "aarch64_sme_smla_za64_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_MULTI_VG4x4_U16 : Inst<"svmla_za64[_{d}]_vg4x4", "vm44", "Us", MergeNone, "aarch64_sme_umla_za64_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // MULTI MLSL
+ def SVMLSL_MULTI_VG4x2_S16 : Inst<"svmls_za64[_{d}]_vg4x2", "vm22", "s", MergeNone, "aarch64_sme_smls_za64_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG4x2_U16 : Inst<"svmls_za64[_{d}]_vg4x2", "vm22", "Us", MergeNone, "aarch64_sme_umls_za64_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG4x4_S16 : Inst<"svmls_za64[_{d}]_vg4x4", "vm44", "s", MergeNone, "aarch64_sme_smls_za64_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_MULTI_VG4x4_U16 : Inst<"svmls_za64[_{d}]_vg4x4", "vm44", "Us", MergeNone, "aarch64_sme_umls_za64_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // SINGLE MLAL
+ def SVMLAL_SINGLE_VG4x1_S16 : Inst<"svmla_za64[_{d}]_vg4x1", "vmdd", "s", MergeNone, "aarch64_sme_smla_za64_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x1_U16 : Inst<"svmla_za64[_{d}]_vg4x1", "vmdd", "Us", MergeNone, "aarch64_sme_umla_za64_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x2_S16 : Inst<"svmla[_single]_za64[_{d}]_vg4x2", "vm2d", "s", MergeNone, "aarch64_sme_smla_za64_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x2_U16 : Inst<"svmla[_single]_za64[_{d}]_vg4x2", "vm2d", "Us", MergeNone, "aarch64_sme_umla_za64_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x4_S16 : Inst<"svmla[_single]_za64[_{d}]_vg4x4", "vm4d", "s", MergeNone, "aarch64_sme_smla_za64_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLAL_SINGLE_VG4x4_U16 : Inst<"svmla[_single]_za64[_{d}]_vg4x4", "vm4d", "Us", MergeNone, "aarch64_sme_umla_za64_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // SINGLE MLSL
+ def SVMLSL_SINGLE_VG4x1_S16 : Inst<"svmls_za64[_{d}]_vg4x1", "vmdd", "s", MergeNone, "aarch64_sme_smls_za64_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x1_U16 : Inst<"svmls_za64[_{d}]_vg4x1", "vmdd", "Us", MergeNone, "aarch64_sme_umls_za64_single_vg4x1", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x2_S16 : Inst<"svmls[_single]_za64[_{d}]_vg4x2", "vm2d", "s", MergeNone, "aarch64_sme_smls_za64_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x2_U16 : Inst<"svmls[_single]_za64[_{d}]_vg4x2", "vm2d", "Us", MergeNone, "aarch64_sme_umls_za64_single_vg4x2", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x4_S16 : Inst<"svmls[_single]_za64[_{d}]_vg4x4", "vm4d", "s", MergeNone, "aarch64_sme_smls_za64_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+ def SVMLSL_SINGLE_VG4x4_U16 : Inst<"svmls[_single]_za64[_{d}]_vg4x4", "vm4d", "Us", MergeNone, "aarch64_sme_umls_za64_single_vg4x4", [IsStreaming, IsSharedZA], []>;
+
+ // INDEXED MLAL
+ def SVMLAL_LANE_VG4x1_S16 : Inst<"svmla_lane_za64[_{d}]_vg4x1", "vmddi", "s", MergeNone, "aarch64_sme_smla_za64_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG4x1_U16 : Inst<"svmla_lane_za64[_{d}]_vg4x1", "vmddi", "Us", MergeNone, "aarch64_sme_umla_za64_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG4x2_S16 : Inst<"svmla_lane_za64[_{d}]_vg4x2", "vm2di", "s", MergeNone, "aarch64_sme_smla_za64_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG4x2_U16 : Inst<"svmla_lane_za64[_{d}]_vg4x2", "vm2di", "Us", MergeNone, "aarch64_sme_umla_za64_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG4x4_S16 : Inst<"svmla_lane_za64[_{d}]_vg4x4", "vm4di", "s", MergeNone, "aarch64_sme_smla_za64_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLAL_LANE_VG4x4_U16 : Inst<"svmla_lane_za64[_{d}]_vg4x4", "vm4di", "Us", MergeNone, "aarch64_sme_umla_za64_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+
+ // INDEXED MLSL
+ def SVMLSL_LANE_VG4x1_S16 : Inst<"svmls_lane_za64[_{d}]_vg4x1", "vmddi", "s", MergeNone, "aarch64_sme_smls_za64_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG4x1_U16 : Inst<"svmls_lane_za64[_{d}]_vg4x1", "vmddi", "Us", MergeNone, "aarch64_sme_umls_za64_lane_vg4x1", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG4x2_S16 : Inst<"svmls_lane_za64[_{d}]_vg4x2", "vm2di", "s", MergeNone, "aarch64_sme_smls_za64_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG4x2_U16 : Inst<"svmls_lane_za64[_{d}]_vg4x2", "vm2di", "Us", MergeNone, "aarch64_sme_umls_za64_lane_vg4x2", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG4x4_S16 : Inst<"svmls_lane_za64[_{d}]_vg4x4", "vm4di", "s", MergeNone, "aarch64_sme_smls_za64_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVMLSL_LANE_VG4x4_U16 : Inst<"svmls_lane_za64[_{d}]_vg4x4", "vm4di", "Us", MergeNone, "aarch64_sme_umls_za64_lane_vg4x4", [IsStreaming, IsSharedZA], [ImmCheck<3, ImmCheck0_7>]>;
}
//
diff --git a/contrib/llvm-project/clang/include/clang/Basic/arm_sve.td b/contrib/llvm-project/clang/include/clang/Basic/arm_sve.td
index 55fd35c3b6c2..91f62c4c7633 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/arm_sve.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/arm_sve.td
@@ -19,27 +19,27 @@ include "arm_sve_sme_incl.td"
// Loads
// Load one vector (scalar base)
-def SVLD1 : MInst<"svld1[_{2}]", "dPc", "csilUcUsUiUlhfd", [IsLoad], MemEltTyDefault, "aarch64_sve_ld1">;
-def SVLD1SB : MInst<"svld1sb_{d}", "dPS", "silUsUiUl", [IsLoad], MemEltTyInt8, "aarch64_sve_ld1">;
-def SVLD1UB : MInst<"svld1ub_{d}", "dPW", "silUsUiUl", [IsLoad, IsZExtReturn], MemEltTyInt8, "aarch64_sve_ld1">;
-def SVLD1SH : MInst<"svld1sh_{d}", "dPT", "ilUiUl", [IsLoad], MemEltTyInt16, "aarch64_sve_ld1">;
-def SVLD1UH : MInst<"svld1uh_{d}", "dPX", "ilUiUl", [IsLoad, IsZExtReturn], MemEltTyInt16, "aarch64_sve_ld1">;
-def SVLD1SW : MInst<"svld1sw_{d}", "dPU", "lUl", [IsLoad], MemEltTyInt32, "aarch64_sve_ld1">;
-def SVLD1UW : MInst<"svld1uw_{d}", "dPY", "lUl", [IsLoad, IsZExtReturn], MemEltTyInt32, "aarch64_sve_ld1">;
+def SVLD1 : MInst<"svld1[_{2}]", "dPc", "csilUcUsUiUlhfd", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ld1">;
+def SVLD1SB : MInst<"svld1sb_{d}", "dPS", "silUsUiUl", [IsLoad, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_ld1">;
+def SVLD1UB : MInst<"svld1ub_{d}", "dPW", "silUsUiUl", [IsLoad, IsZExtReturn, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_ld1">;
+def SVLD1SH : MInst<"svld1sh_{d}", "dPT", "ilUiUl", [IsLoad, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_ld1">;
+def SVLD1UH : MInst<"svld1uh_{d}", "dPX", "ilUiUl", [IsLoad, IsZExtReturn, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_ld1">;
+def SVLD1SW : MInst<"svld1sw_{d}", "dPU", "lUl", [IsLoad, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_ld1">;
+def SVLD1UW : MInst<"svld1uw_{d}", "dPY", "lUl", [IsLoad, IsZExtReturn, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_ld1">;
let TargetGuard = "sve,bf16" in {
- def SVLD1_BF : MInst<"svld1[_{2}]", "dPc", "b", [IsLoad], MemEltTyDefault, "aarch64_sve_ld1">;
- def SVLD1_VNUM_BF : MInst<"svld1_vnum[_{2}]", "dPcl", "b", [IsLoad], MemEltTyDefault, "aarch64_sve_ld1">;
+ def SVLD1_BF : MInst<"svld1[_{2}]", "dPc", "b", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ld1">;
+ def SVLD1_VNUM_BF : MInst<"svld1_vnum[_{2}]", "dPcl", "b", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ld1">;
}
// Load one vector (scalar base, VL displacement)
-def SVLD1_VNUM : MInst<"svld1_vnum[_{2}]", "dPcl", "csilUcUsUiUlhfd", [IsLoad], MemEltTyDefault, "aarch64_sve_ld1">;
-def SVLD1SB_VNUM : MInst<"svld1sb_vnum_{d}", "dPSl", "silUsUiUl", [IsLoad], MemEltTyInt8, "aarch64_sve_ld1">;
-def SVLD1UB_VNUM : MInst<"svld1ub_vnum_{d}", "dPWl", "silUsUiUl", [IsLoad, IsZExtReturn], MemEltTyInt8, "aarch64_sve_ld1">;
-def SVLD1SH_VNUM : MInst<"svld1sh_vnum_{d}", "dPTl", "ilUiUl", [IsLoad], MemEltTyInt16, "aarch64_sve_ld1">;
-def SVLD1UH_VNUM : MInst<"svld1uh_vnum_{d}", "dPXl", "ilUiUl", [IsLoad, IsZExtReturn], MemEltTyInt16, "aarch64_sve_ld1">;
-def SVLD1SW_VNUM : MInst<"svld1sw_vnum_{d}", "dPUl", "lUl", [IsLoad], MemEltTyInt32, "aarch64_sve_ld1">;
-def SVLD1UW_VNUM : MInst<"svld1uw_vnum_{d}", "dPYl", "lUl", [IsLoad, IsZExtReturn], MemEltTyInt32, "aarch64_sve_ld1">;
+def SVLD1_VNUM : MInst<"svld1_vnum[_{2}]", "dPcl", "csilUcUsUiUlhfd", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ld1">;
+def SVLD1SB_VNUM : MInst<"svld1sb_vnum_{d}", "dPSl", "silUsUiUl", [IsLoad, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_ld1">;
+def SVLD1UB_VNUM : MInst<"svld1ub_vnum_{d}", "dPWl", "silUsUiUl", [IsLoad, IsZExtReturn, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_ld1">;
+def SVLD1SH_VNUM : MInst<"svld1sh_vnum_{d}", "dPTl", "ilUiUl", [IsLoad, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_ld1">;
+def SVLD1UH_VNUM : MInst<"svld1uh_vnum_{d}", "dPXl", "ilUiUl", [IsLoad, IsZExtReturn, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_ld1">;
+def SVLD1SW_VNUM : MInst<"svld1sw_vnum_{d}", "dPUl", "lUl", [IsLoad, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_ld1">;
+def SVLD1UW_VNUM : MInst<"svld1uw_vnum_{d}", "dPYl", "lUl", [IsLoad, IsZExtReturn, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_ld1">;
// Load one vector (vector base)
def SVLD1_GATHER_BASES_U : MInst<"svld1_gather[_{2}base]_{d}", "dPu", "ilUiUlfd", [IsGatherLoad], MemEltTyDefault, "aarch64_sve_ld1_gather_scalar_offset">;
@@ -243,27 +243,27 @@ let TargetGuard = "sve,bf16" in {
}
// Load one vector, unextended load, non-temporal (scalar base)
-def SVLDNT1 : MInst<"svldnt1[_{2}]", "dPc", "csilUcUsUiUlhfd", [IsLoad], MemEltTyDefault, "aarch64_sve_ldnt1">;
+def SVLDNT1 : MInst<"svldnt1[_{2}]", "dPc", "csilUcUsUiUlhfd", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ldnt1">;
// Load one vector, unextended load, non-temporal (scalar base, VL displacement)
-def SVLDNT1_VNUM : MInst<"svldnt1_vnum[_{2}]", "dPcl", "csilUcUsUiUlhfd", [IsLoad], MemEltTyDefault, "aarch64_sve_ldnt1">;
+def SVLDNT1_VNUM : MInst<"svldnt1_vnum[_{2}]", "dPcl", "csilUcUsUiUlhfd", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ldnt1">;
let TargetGuard = "sve,bf16" in {
- def SVLDNT1_BF : MInst<"svldnt1[_{2}]", "dPc", "b", [IsLoad], MemEltTyDefault, "aarch64_sve_ldnt1">;
- def SVLDNT1_VNUM_BF : MInst<"svldnt1_vnum[_{2}]", "dPcl", "b", [IsLoad], MemEltTyDefault, "aarch64_sve_ldnt1">;
+ def SVLDNT1_BF : MInst<"svldnt1[_{2}]", "dPc", "b", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ldnt1">;
+ def SVLDNT1_VNUM_BF : MInst<"svldnt1_vnum[_{2}]", "dPcl", "b", [IsLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_ldnt1">;
}
// Load one quadword and replicate (scalar base)
-def SVLD1RQ : SInst<"svld1rq[_{2}]", "dPc", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_ld1rq">;
+def SVLD1RQ : SInst<"svld1rq[_{2}]", "dPc", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_ld1rq", [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- def SVLD1RQ_BF : SInst<"svld1rq[_{2}]", "dPc", "b", MergeNone, "aarch64_sve_ld1rq">;
+ def SVLD1RQ_BF : SInst<"svld1rq[_{2}]", "dPc", "b", MergeNone, "aarch64_sve_ld1rq", [IsStreamingCompatible]>;
}
multiclass StructLoad<string name, string proto, string i> {
- def : SInst<name, proto, "csilUcUsUiUlhfd", MergeNone, i, [IsStructLoad]>;
+ def : SInst<name, proto, "csilUcUsUiUlhfd", MergeNone, i, [IsStructLoad, IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- def: SInst<name, proto, "b", MergeNone, i, [IsStructLoad]>;
+ def: SInst<name, proto, "b", MergeNone, i, [IsStructLoad, IsStreamingCompatible]>;
}
}
@@ -286,16 +286,16 @@ let TargetGuard = "sve,f64mm,bf16" in {
}
let TargetGuard = "sve,bf16" in {
- def SVBFDOT : SInst<"svbfdot[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfdot", [IsOverloadNone]>;
- def SVBFMLALB : SInst<"svbfmlalb[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfmlalb", [IsOverloadNone]>;
- def SVBFMLALT : SInst<"svbfmlalt[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfmlalt", [IsOverloadNone]>;
- def SVBFMMLA : SInst<"svbfmmla[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfmmla", [IsOverloadNone]>;
- def SVBFDOT_N : SInst<"svbfdot[_n_{0}]", "MMda", "b", MergeNone, "aarch64_sve_bfdot", [IsOverloadNone]>;
- def SVBFMLAL_N : SInst<"svbfmlalb[_n_{0}]", "MMda", "b", MergeNone, "aarch64_sve_bfmlalb", [IsOverloadNone]>;
- def SVBFMLALT_N : SInst<"svbfmlalt[_n_{0}]", "MMda", "b", MergeNone, "aarch64_sve_bfmlalt", [IsOverloadNone]>;
- def SVBFDOT_LANE : SInst<"svbfdot_lane[_{0}]", "MMddi", "b", MergeNone, "aarch64_sve_bfdot_lane_v2", [IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
- def SVBFMLALB_LANE : SInst<"svbfmlalb_lane[_{0}]", "MMddi", "b", MergeNone, "aarch64_sve_bfmlalb_lane_v2", [IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
- def SVBFMLALT_LANE : SInst<"svbfmlalt_lane[_{0}]", "MMddi", "b", MergeNone, "aarch64_sve_bfmlalt_lane_v2", [IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVBFDOT : SInst<"svbfdot[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfdot", [IsOverloadNone, IsStreamingCompatible]>;
+ def SVBFMLALB : SInst<"svbfmlalb[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfmlalb", [IsOverloadNone, IsStreamingCompatible]>;
+ def SVBFMLALT : SInst<"svbfmlalt[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfmlalt", [IsOverloadNone, IsStreamingCompatible]>;
+ def SVBFMMLA : SInst<"svbfmmla[_{0}]", "MMdd", "b", MergeNone, "aarch64_sve_bfmmla", [IsOverloadNone, IsStreamingCompatible]>;
+ def SVBFDOT_N : SInst<"svbfdot[_n_{0}]", "MMda", "b", MergeNone, "aarch64_sve_bfdot", [IsOverloadNone, IsStreamingCompatible]>;
+ def SVBFMLAL_N : SInst<"svbfmlalb[_n_{0}]", "MMda", "b", MergeNone, "aarch64_sve_bfmlalb", [IsOverloadNone, IsStreamingCompatible]>;
+ def SVBFMLALT_N : SInst<"svbfmlalt[_n_{0}]", "MMda", "b", MergeNone, "aarch64_sve_bfmlalt", [IsOverloadNone, IsStreamingCompatible]>;
+ def SVBFDOT_LANE : SInst<"svbfdot_lane[_{0}]", "MMddi", "b", MergeNone, "aarch64_sve_bfdot_lane_v2", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<3, ImmCheck0_3>]>;
+ def SVBFMLALB_LANE : SInst<"svbfmlalb_lane[_{0}]", "MMddi", "b", MergeNone, "aarch64_sve_bfmlalb_lane_v2", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVBFMLALT_LANE : SInst<"svbfmlalt_lane[_{0}]", "MMddi", "b", MergeNone, "aarch64_sve_bfmlalt_lane_v2", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<3, ImmCheck0_7>]>;
}
let TargetGuard = "sve2p1" in {
@@ -334,26 +334,26 @@ let TargetGuard = "sve2p1" in {
// Stores
// Store one vector (scalar base)
-def SVST1 : MInst<"svst1[_{d}]", "vPpd", "csilUcUsUiUlhfd", [IsStore], MemEltTyDefault, "aarch64_sve_st1">;
-def SVST1B_S : MInst<"svst1b[_{d}]", "vPAd", "sil", [IsStore], MemEltTyInt8, "aarch64_sve_st1">;
-def SVST1B_U : MInst<"svst1b[_{d}]", "vPEd", "UsUiUl", [IsStore], MemEltTyInt8, "aarch64_sve_st1">;
-def SVST1H_S : MInst<"svst1h[_{d}]", "vPBd", "il", [IsStore], MemEltTyInt16, "aarch64_sve_st1">;
-def SVST1H_U : MInst<"svst1h[_{d}]", "vPFd", "UiUl", [IsStore], MemEltTyInt16, "aarch64_sve_st1">;
-def SVST1W_S : MInst<"svst1w[_{d}]", "vPCd", "l", [IsStore], MemEltTyInt32, "aarch64_sve_st1">;
-def SVST1W_U : MInst<"svst1w[_{d}]", "vPGd", "Ul", [IsStore], MemEltTyInt32, "aarch64_sve_st1">;
+def SVST1 : MInst<"svst1[_{d}]", "vPpd", "csilUcUsUiUlhfd", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_st1">;
+def SVST1B_S : MInst<"svst1b[_{d}]", "vPAd", "sil", [IsStore, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_st1">;
+def SVST1B_U : MInst<"svst1b[_{d}]", "vPEd", "UsUiUl", [IsStore, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_st1">;
+def SVST1H_S : MInst<"svst1h[_{d}]", "vPBd", "il", [IsStore, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_st1">;
+def SVST1H_U : MInst<"svst1h[_{d}]", "vPFd", "UiUl", [IsStore, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_st1">;
+def SVST1W_S : MInst<"svst1w[_{d}]", "vPCd", "l", [IsStore, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_st1">;
+def SVST1W_U : MInst<"svst1w[_{d}]", "vPGd", "Ul", [IsStore, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_st1">;
// Store one vector (scalar base, VL displacement)
-def SVST1_VNUM : MInst<"svst1_vnum[_{d}]", "vPpld", "csilUcUsUiUlhfd", [IsStore], MemEltTyDefault, "aarch64_sve_st1">;
-def SVST1B_VNUM_S : MInst<"svst1b_vnum[_{d}]", "vPAld", "sil", [IsStore], MemEltTyInt8, "aarch64_sve_st1">;
-def SVST1B_VNUM_U : MInst<"svst1b_vnum[_{d}]", "vPEld", "UsUiUl", [IsStore], MemEltTyInt8, "aarch64_sve_st1">;
-def SVST1H_VNUM_S : MInst<"svst1h_vnum[_{d}]", "vPBld", "il", [IsStore], MemEltTyInt16, "aarch64_sve_st1">;
-def SVST1H_VNUM_U : MInst<"svst1h_vnum[_{d}]", "vPFld", "UiUl", [IsStore], MemEltTyInt16, "aarch64_sve_st1">;
-def SVST1W_VNUM_S : MInst<"svst1w_vnum[_{d}]", "vPCld", "l", [IsStore], MemEltTyInt32, "aarch64_sve_st1">;
-def SVST1W_VNUM_U : MInst<"svst1w_vnum[_{d}]", "vPGld", "Ul", [IsStore], MemEltTyInt32, "aarch64_sve_st1">;
+def SVST1_VNUM : MInst<"svst1_vnum[_{d}]", "vPpld", "csilUcUsUiUlhfd", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_st1">;
+def SVST1B_VNUM_S : MInst<"svst1b_vnum[_{d}]", "vPAld", "sil", [IsStore, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_st1">;
+def SVST1B_VNUM_U : MInst<"svst1b_vnum[_{d}]", "vPEld", "UsUiUl", [IsStore, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_st1">;
+def SVST1H_VNUM_S : MInst<"svst1h_vnum[_{d}]", "vPBld", "il", [IsStore, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_st1">;
+def SVST1H_VNUM_U : MInst<"svst1h_vnum[_{d}]", "vPFld", "UiUl", [IsStore, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_st1">;
+def SVST1W_VNUM_S : MInst<"svst1w_vnum[_{d}]", "vPCld", "l", [IsStore, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_st1">;
+def SVST1W_VNUM_U : MInst<"svst1w_vnum[_{d}]", "vPGld", "Ul", [IsStore, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_st1">;
let TargetGuard = "sve,bf16" in {
- def SVST1_BF : MInst<"svst1[_{d}]", "vPpd", "b", [IsStore], MemEltTyDefault, "aarch64_sve_st1">;
- def SVST1_VNUM_BF : MInst<"svst1_vnum[_{d}]", "vPpld", "b", [IsStore], MemEltTyDefault, "aarch64_sve_st1">;
+ def SVST1_BF : MInst<"svst1[_{d}]", "vPpd", "b", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_st1">;
+ def SVST1_VNUM_BF : MInst<"svst1_vnum[_{d}]", "vPpld", "b", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_st1">;
}
// Store one vector (vector base)
@@ -426,9 +426,9 @@ def SVST1H_SCATTER_INDEX_S : MInst<"svst1h_scatter[_{2}base]_index[_{d}]", "v
def SVST1W_SCATTER_INDEX_S : MInst<"svst1w_scatter[_{2}base]_index[_{d}]", "vPuld", "lUl", [IsScatterStore], MemEltTyInt32, "aarch64_sve_st1_scatter_scalar_offset">;
multiclass StructStore<string name, string proto, string i> {
- def : SInst<name, proto, "csilUcUsUiUlhfd", MergeNone, i, [IsStructStore]>;
+ def : SInst<name, proto, "csilUcUsUiUlhfd", MergeNone, i, [IsStructStore, IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- def: SInst<name, proto, "b", MergeNone, i, [IsStructStore]>;
+ def: SInst<name, proto, "b", MergeNone, i, [IsStructStore, IsStreamingCompatible]>;
}
}
// Store N vectors into N-element structure (scalar base)
@@ -442,14 +442,14 @@ defm SVST3_VNUM : StructStore<"svst3_vnum[_{d}]", "vPpl3", "aarch64_sve_st3">;
defm SVST4_VNUM : StructStore<"svst4_vnum[_{d}]", "vPpl4", "aarch64_sve_st4">;
// Store one vector, with no truncation, non-temporal (scalar base)
-def SVSTNT1 : MInst<"svstnt1[_{d}]", "vPpd", "csilUcUsUiUlhfd", [IsStore], MemEltTyDefault, "aarch64_sve_stnt1">;
+def SVSTNT1 : MInst<"svstnt1[_{d}]", "vPpd", "csilUcUsUiUlhfd", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_stnt1">;
// Store one vector, with no truncation, non-temporal (scalar base, VL displacement)
-def SVSTNT1_VNUM : MInst<"svstnt1_vnum[_{d}]", "vPpld", "csilUcUsUiUlhfd", [IsStore], MemEltTyDefault, "aarch64_sve_stnt1">;
+def SVSTNT1_VNUM : MInst<"svstnt1_vnum[_{d}]", "vPpld", "csilUcUsUiUlhfd", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_stnt1">;
let TargetGuard = "sve,bf16" in {
- def SVSTNT1_BF : MInst<"svstnt1[_{d}]", "vPpd", "b", [IsStore], MemEltTyDefault, "aarch64_sve_stnt1">;
- def SVSTNT1_VNUM_BF : MInst<"svstnt1_vnum[_{d}]", "vPpld", "b", [IsStore], MemEltTyDefault, "aarch64_sve_stnt1">;
+ def SVSTNT1_BF : MInst<"svstnt1[_{d}]", "vPpd", "b", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_stnt1">;
+ def SVSTNT1_VNUM_BF : MInst<"svstnt1_vnum[_{d}]", "vPpld", "b", [IsStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_stnt1">;
}
let TargetGuard = "sve2p1" in {
@@ -488,16 +488,16 @@ let TargetGuard = "sve2p1" in {
// Prefetches
// Prefetch (Scalar base)
-def SVPRFB : MInst<"svprfb", "vPQJ", "c", [IsPrefetch], MemEltTyInt8, "aarch64_sve_prf">;
-def SVPRFH : MInst<"svprfh", "vPQJ", "s", [IsPrefetch], MemEltTyInt16, "aarch64_sve_prf">;
-def SVPRFW : MInst<"svprfw", "vPQJ", "i", [IsPrefetch], MemEltTyInt32, "aarch64_sve_prf">;
-def SVPRFD : MInst<"svprfd", "vPQJ", "l", [IsPrefetch], MemEltTyInt64, "aarch64_sve_prf">;
+def SVPRFB : MInst<"svprfb", "vPQJ", "c", [IsPrefetch, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_prf">;
+def SVPRFH : MInst<"svprfh", "vPQJ", "s", [IsPrefetch, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_prf">;
+def SVPRFW : MInst<"svprfw", "vPQJ", "i", [IsPrefetch, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_prf">;
+def SVPRFD : MInst<"svprfd", "vPQJ", "l", [IsPrefetch, IsStreamingCompatible], MemEltTyInt64, "aarch64_sve_prf">;
// Prefetch (Scalar base, VL displacement)
-def SVPRFB_VNUM : MInst<"svprfb_vnum", "vPQlJ", "c", [IsPrefetch], MemEltTyInt8, "aarch64_sve_prf">;
-def SVPRFH_VNUM : MInst<"svprfh_vnum", "vPQlJ", "s", [IsPrefetch], MemEltTyInt16, "aarch64_sve_prf">;
-def SVPRFW_VNUM : MInst<"svprfw_vnum", "vPQlJ", "i", [IsPrefetch], MemEltTyInt32, "aarch64_sve_prf">;
-def SVPRFD_VNUM : MInst<"svprfd_vnum", "vPQlJ", "l", [IsPrefetch], MemEltTyInt64, "aarch64_sve_prf">;
+def SVPRFB_VNUM : MInst<"svprfb_vnum", "vPQlJ", "c", [IsPrefetch, IsStreamingCompatible], MemEltTyInt8, "aarch64_sve_prf">;
+def SVPRFH_VNUM : MInst<"svprfh_vnum", "vPQlJ", "s", [IsPrefetch, IsStreamingCompatible], MemEltTyInt16, "aarch64_sve_prf">;
+def SVPRFW_VNUM : MInst<"svprfw_vnum", "vPQlJ", "i", [IsPrefetch, IsStreamingCompatible], MemEltTyInt32, "aarch64_sve_prf">;
+def SVPRFD_VNUM : MInst<"svprfd_vnum", "vPQlJ", "l", [IsPrefetch, IsStreamingCompatible], MemEltTyInt64, "aarch64_sve_prf">;
// Prefetch (Vector bases)
def SVPRFB_GATHER_BASES : MInst<"svprfb_gather[_{2}base]", "vPdJ", "UiUl", [IsGatherPrefetch], MemEltTyInt8, "aarch64_sve_prfb_gather_scalar_offset">;
@@ -552,9 +552,9 @@ def SVDUPQ_32 : SInst<"svdupq[_n]_{d}", "dssss", "iUif", MergeNone>;
def SVDUPQ_64 : SInst<"svdupq[_n]_{d}", "dss", "lUld", MergeNone>;
multiclass svdup_base<string n, string p, MergeType mt, string i> {
- def NAME : SInst<n, p, "csilUcUsUiUlhfd", mt, i>;
+ def NAME : SInst<n, p, "csilUcUsUiUlhfd", mt, i, [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- def _BF16: SInst<n, p, "b", mt, i>;
+ def _BF16: SInst<n, p, "b", mt, i, [IsStreamingCompatible]>;
}
}
@@ -563,14 +563,14 @@ defm SVDUP_M : svdup_base<"svdup[_n]_{d}", "ddPs", MergeOp1, "aarch64_sve_du
defm SVDUP_X : svdup_base<"svdup[_n]_{d}", "dPs", MergeAnyExp, "aarch64_sve_dup">;
defm SVDUP_Z : svdup_base<"svdup[_n]_{d}", "dPs", MergeZeroExp, "aarch64_sve_dup">;
-def SVINDEX : SInst<"svindex_{d}", "dss", "csilUcUsUiUl", MergeNone, "aarch64_sve_index">;
+def SVINDEX : SInst<"svindex_{d}", "dss", "csilUcUsUiUl", MergeNone, "aarch64_sve_index", [IsStreamingCompatible]>;
// Integer arithmetic
-multiclass SInstZPZ<string name, string types, string intrinsic, list<FlagType> flags=[]> {
- def _M : SInst<name # "[_{d}]", "ddPd", types, MergeOp1, intrinsic, flags>;
- def _X : SInst<name # "[_{d}]", "dPd", types, MergeAnyExp, intrinsic, flags>;
- def _Z : SInst<name # "[_{d}]", "dPd", types, MergeZeroExp, intrinsic, flags>;
+multiclass SInstZPZ<string name, string types, string intrinsic> {
+ def _M : SInst<name # "[_{d}]", "ddPd", types, MergeOp1, intrinsic, [IsStreamingCompatible]>;
+ def _X : SInst<name # "[_{d}]", "dPd", types, MergeAnyExp, intrinsic, [IsStreamingCompatible]>;
+ def _Z : SInst<name # "[_{d}]", "dPd", types, MergeZeroExp, intrinsic, [IsStreamingCompatible]>;
}
defm SVABS : SInstZPZ<"svabs", "csil", "aarch64_sve_abs">;
@@ -579,13 +579,13 @@ defm SVNEG : SInstZPZ<"svneg", "csil", "aarch64_sve_neg">;
//------------------------------------------------------------------------------
multiclass SInstZPZZ<string name, string types, string m_intrinsic, string x_intrinsic, list<FlagType> flags=[]> {
- def _M : SInst<name # "[_{d}]", "dPdd", types, MergeOp1, m_intrinsic, flags>;
- def _X : SInst<name # "[_{d}]", "dPdd", types, MergeAny, x_intrinsic, flags>;
- def _Z : SInst<name # "[_{d}]", "dPdd", types, MergeZero, m_intrinsic, flags>;
+ def _M : SInst<name # "[_{d}]", "dPdd", types, MergeOp1, m_intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
+ def _X : SInst<name # "[_{d}]", "dPdd", types, MergeAny, x_intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
+ def _Z : SInst<name # "[_{d}]", "dPdd", types, MergeZero, m_intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
- def _N_M : SInst<name # "[_n_{d}]", "dPda", types, MergeOp1, m_intrinsic, flags>;
- def _N_X : SInst<name # "[_n_{d}]", "dPda", types, MergeAny, x_intrinsic, flags>;
- def _N_Z : SInst<name # "[_n_{d}]", "dPda", types, MergeZero, m_intrinsic, flags>;
+ def _N_M : SInst<name # "[_n_{d}]", "dPda", types, MergeOp1, m_intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
+ def _N_X : SInst<name # "[_n_{d}]", "dPda", types, MergeAny, x_intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
+ def _N_Z : SInst<name # "[_n_{d}]", "dPda", types, MergeZero, m_intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
}
defm SVABD_S : SInstZPZZ<"svabd", "csil", "aarch64_sve_sabd", "aarch64_sve_sabd_u">;
@@ -617,26 +617,26 @@ multiclass SInstZPZZZ<string name, string types, string m_intrinsic, string x_in
def _N_Z : SInst<name # "[_n_{d}]", "dPdda", types, MergeZero, m_intrinsic, flags>;
}
-defm SVMAD : SInstZPZZZ<"svmad", "csilUcUsUiUl", "aarch64_sve_mad", "aarch64_sve_mla_u", [ReverseMergeAnyAccOp]>;
-defm SVMLA : SInstZPZZZ<"svmla", "csilUcUsUiUl", "aarch64_sve_mla", "aarch64_sve_mla_u">;
-defm SVMLS : SInstZPZZZ<"svmls", "csilUcUsUiUl", "aarch64_sve_mls", "aarch64_sve_mls_u">;
-defm SVMSB : SInstZPZZZ<"svmsb", "csilUcUsUiUl", "aarch64_sve_msb", "aarch64_sve_mls_u", [ReverseMergeAnyAccOp]>;
+defm SVMAD : SInstZPZZZ<"svmad", "csilUcUsUiUl", "aarch64_sve_mad", "aarch64_sve_mla_u", [ReverseMergeAnyAccOp, IsStreamingCompatible]>;
+defm SVMLA : SInstZPZZZ<"svmla", "csilUcUsUiUl", "aarch64_sve_mla", "aarch64_sve_mla_u", [IsStreamingCompatible]>;
+defm SVMLS : SInstZPZZZ<"svmls", "csilUcUsUiUl", "aarch64_sve_mls", "aarch64_sve_mls_u", [IsStreamingCompatible]>;
+defm SVMSB : SInstZPZZZ<"svmsb", "csilUcUsUiUl", "aarch64_sve_msb", "aarch64_sve_mls_u", [ReverseMergeAnyAccOp, IsStreamingCompatible]>;
//------------------------------------------------------------------------------
-def SVDOT_S : SInst<"svdot[_{0}]", "ddqq", "il", MergeNone, "aarch64_sve_sdot">;
-def SVDOT_U : SInst<"svdot[_{0}]", "ddqq", "UiUl", MergeNone, "aarch64_sve_udot">;
-def SVQADD_S : SInst<"svqadd[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqadd_x">;
-def SVQADD_U : SInst<"svqadd[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_uqadd_x">;
-def SVQSUB_S : SInst<"svqsub[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqsub_x">;
-def SVQSUB_U : SInst<"svqsub[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_uqsub_x">;
+def SVDOT_S : SInst<"svdot[_{0}]", "ddqq", "il", MergeNone, "aarch64_sve_sdot", [IsStreamingCompatible]>;
+def SVDOT_U : SInst<"svdot[_{0}]", "ddqq", "UiUl", MergeNone, "aarch64_sve_udot", [IsStreamingCompatible]>;
+def SVQADD_S : SInst<"svqadd[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqadd_x", [IsStreamingCompatible]>;
+def SVQADD_U : SInst<"svqadd[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_uqadd_x", [IsStreamingCompatible]>;
+def SVQSUB_S : SInst<"svqsub[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqsub_x", [IsStreamingCompatible]>;
+def SVQSUB_U : SInst<"svqsub[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_uqsub_x", [IsStreamingCompatible]>;
-def SVDOT_N_S : SInst<"svdot[_n_{0}]", "ddqr", "il", MergeNone, "aarch64_sve_sdot">;
-def SVDOT_N_U : SInst<"svdot[_n_{0}]", "ddqr", "UiUl", MergeNone, "aarch64_sve_udot">;
-def SVQADD_N_S : SInst<"svqadd[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqadd_x">;
-def SVQADD_N_U : SInst<"svqadd[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_uqadd_x">;
-def SVQSUB_N_S : SInst<"svqsub[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqsub_x">;
-def SVQSUB_N_U : SInst<"svqsub[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_uqsub_x">;
+def SVDOT_N_S : SInst<"svdot[_n_{0}]", "ddqr", "il", MergeNone, "aarch64_sve_sdot", [IsStreamingCompatible]>;
+def SVDOT_N_U : SInst<"svdot[_n_{0}]", "ddqr", "UiUl", MergeNone, "aarch64_sve_udot", [IsStreamingCompatible]>;
+def SVQADD_N_S : SInst<"svqadd[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqadd_x", [IsStreamingCompatible]>;
+def SVQADD_N_U : SInst<"svqadd[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_uqadd_x", [IsStreamingCompatible]>;
+def SVQSUB_N_S : SInst<"svqsub[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqsub_x", [IsStreamingCompatible]>;
+def SVQSUB_N_U : SInst<"svqsub[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_uqsub_x", [IsStreamingCompatible]>;
def SVDOT_LANE_S : SInst<"svdot_lane[_{d}]", "ddqqi", "il", MergeNone, "aarch64_sve_sdot_lane", [], [ImmCheck<3, ImmCheckLaneIndexDot, 2>]>;
def SVDOT_LANE_U : SInst<"svdot_lane[_{d}]", "ddqqi", "UiUl", MergeNone, "aarch64_sve_udot_lane", [], [ImmCheck<3, ImmCheckLaneIndexDot, 2>]>;
@@ -656,107 +656,107 @@ defm SVNOT : SInstZPZ<"svnot", "csilUcUsUiUl", "aarch64_sve_not">;
// Shifts
multiclass SInst_SHIFT<string name, string intrinsic, string ts, string wide_ts> {
- def _M : SInst<name # "[_{d}]", "dPdu", ts, MergeOp1, intrinsic>;
- def _X : SInst<name # "[_{d}]", "dPdu", ts, MergeAny, intrinsic # _u>;
- def _Z : SInst<name # "[_{d}]", "dPdu", ts, MergeZero, intrinsic>;
+ def _M : SInst<name # "[_{d}]", "dPdu", ts, MergeOp1, intrinsic, [IsStreamingCompatible]>;
+ def _X : SInst<name # "[_{d}]", "dPdu", ts, MergeAny, intrinsic # _u, [IsStreamingCompatible]>;
+ def _Z : SInst<name # "[_{d}]", "dPdu", ts, MergeZero, intrinsic, [IsStreamingCompatible]>;
- def _N_M : SInst<name # "[_n_{d}]", "dPdL", ts, MergeOp1, intrinsic>;
- def _N_X : SInst<name # "[_n_{d}]", "dPdL", ts, MergeAny, intrinsic # _u>;
- def _N_Z : SInst<name # "[_n_{d}]", "dPdL", ts, MergeZero, intrinsic>;
+ def _N_M : SInst<name # "[_n_{d}]", "dPdL", ts, MergeOp1, intrinsic, [IsStreamingCompatible]>;
+ def _N_X : SInst<name # "[_n_{d}]", "dPdL", ts, MergeAny, intrinsic # _u, [IsStreamingCompatible]>;
+ def _N_Z : SInst<name # "[_n_{d}]", "dPdL", ts, MergeZero, intrinsic, [IsStreamingCompatible]>;
- def _WIDE_M : SInst<name # _wide # "[_{d}]", "dPdg", wide_ts, MergeOp1, intrinsic # _wide>;
- def _WIDE_X : SInst<name # _wide # "[_{d}]", "dPdg", wide_ts, MergeAny, intrinsic # _wide>;
- def _WIDE_Z : SInst<name # _wide # "[_{d}]", "dPdg", wide_ts, MergeZero, intrinsic # _wide>;
+ def _WIDE_M : SInst<name # _wide # "[_{d}]", "dPdg", wide_ts, MergeOp1, intrinsic # _wide, [IsStreamingCompatible]>;
+ def _WIDE_X : SInst<name # _wide # "[_{d}]", "dPdg", wide_ts, MergeAny, intrinsic # _wide, [IsStreamingCompatible]>;
+ def _WIDE_Z : SInst<name # _wide # "[_{d}]", "dPdg", wide_ts, MergeZero, intrinsic # _wide, [IsStreamingCompatible]>;
- def _WIDE_N_M : SInst<name # _wide # "[_n_{d}]", "dPdf", wide_ts, MergeOp1, intrinsic # _wide>;
- def _WIDE_N_X : SInst<name # _wide # "[_n_{d}]", "dPdf", wide_ts, MergeAny, intrinsic # _wide>;
- def _WIDE_N_Z : SInst<name # _wide # "[_n_{d}]", "dPdf", wide_ts, MergeZero, intrinsic # _wide>;
+ def _WIDE_N_M : SInst<name # _wide # "[_n_{d}]", "dPdf", wide_ts, MergeOp1, intrinsic # _wide, [IsStreamingCompatible]>;
+ def _WIDE_N_X : SInst<name # _wide # "[_n_{d}]", "dPdf", wide_ts, MergeAny, intrinsic # _wide, [IsStreamingCompatible]>;
+ def _WIDE_N_Z : SInst<name # _wide # "[_n_{d}]", "dPdf", wide_ts, MergeZero, intrinsic # _wide, [IsStreamingCompatible]>;
}
defm SVASR : SInst_SHIFT<"svasr", "aarch64_sve_asr", "csil", "csi">;
defm SVLSL : SInst_SHIFT<"svlsl", "aarch64_sve_lsl", "csilUcUsUiUl", "csiUcUsUi">;
defm SVLSR : SInst_SHIFT<"svlsr", "aarch64_sve_lsr", "UcUsUiUl", "UcUsUi">;
-def SVASRD_M : SInst<"svasrd[_n_{d}]", "dPdi", "csil", MergeOp1, "aarch64_sve_asrd", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVASRD_X : SInst<"svasrd[_n_{d}]", "dPdi", "csil", MergeAny, "aarch64_sve_asrd", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVASRD_Z : SInst<"svasrd[_n_{d}]", "dPdi", "csil", MergeZero, "aarch64_sve_asrd", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVASRD_M : SInst<"svasrd[_n_{d}]", "dPdi", "csil", MergeOp1, "aarch64_sve_asrd", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVASRD_X : SInst<"svasrd[_n_{d}]", "dPdi", "csil", MergeAny, "aarch64_sve_asrd", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVASRD_Z : SInst<"svasrd[_n_{d}]", "dPdi", "csil", MergeZero, "aarch64_sve_asrd", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVINSR : SInst<"svinsr[_n_{d}]", "dds", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_insr">;
+def SVINSR : SInst<"svinsr[_n_{d}]", "dds", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_insr", [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- def SVINSR_BF16 : SInst<"svinsr[_n_{d}]", "dds", "b", MergeNone, "aarch64_sve_insr">;
+ def SVINSR_BF16 : SInst<"svinsr[_n_{d}]", "dds", "b", MergeNone, "aarch64_sve_insr", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
// Integer reductions
-def SVADDV_S : SInst<"svaddv[_{d}]", "lPd", "csil", MergeNone, "aarch64_sve_saddv">;
-def SVADDV_U : SInst<"svaddv[_{d}]", "nPd", "UcUsUiUl", MergeNone, "aarch64_sve_uaddv">;
-def SVANDV : SInst<"svandv[_{d}]", "sPd", "csilUcUsUiUl", MergeNone, "aarch64_sve_andv">;
-def SVEORV : SInst<"sveorv[_{d}]", "sPd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eorv">;
-def SVMAXV_S : SInst<"svmaxv[_{d}]", "sPd", "csil", MergeNone, "aarch64_sve_smaxv">;
-def SVMAXV_U : SInst<"svmaxv[_{d}]", "sPd", "UcUsUiUl", MergeNone, "aarch64_sve_umaxv">;
-def SVMINV_S : SInst<"svminv[_{d}]", "sPd", "csil", MergeNone, "aarch64_sve_sminv">;
-def SVMINV_U : SInst<"svminv[_{d}]", "sPd", "UcUsUiUl", MergeNone, "aarch64_sve_uminv">;
-def SVORV : SInst<"svorv[_{d}]", "sPd", "csilUcUsUiUl", MergeNone, "aarch64_sve_orv">;
+def SVADDV_S : SInst<"svaddv[_{d}]", "lPd", "csil", MergeNone, "aarch64_sve_saddv", [IsStreamingCompatible]>;
+def SVADDV_U : SInst<"svaddv[_{d}]", "nPd", "UcUsUiUl", MergeNone, "aarch64_sve_uaddv", [IsStreamingCompatible]>;
+def SVANDV : SInst<"svandv[_{d}]", "sPd", "csilUcUsUiUl", MergeNone, "aarch64_sve_andv", [IsStreamingCompatible]>;
+def SVEORV : SInst<"sveorv[_{d}]", "sPd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eorv", [IsStreamingCompatible]>;
+def SVMAXV_S : SInst<"svmaxv[_{d}]", "sPd", "csil", MergeNone, "aarch64_sve_smaxv", [IsStreamingCompatible]>;
+def SVMAXV_U : SInst<"svmaxv[_{d}]", "sPd", "UcUsUiUl", MergeNone, "aarch64_sve_umaxv", [IsStreamingCompatible]>;
+def SVMINV_S : SInst<"svminv[_{d}]", "sPd", "csil", MergeNone, "aarch64_sve_sminv", [IsStreamingCompatible]>;
+def SVMINV_U : SInst<"svminv[_{d}]", "sPd", "UcUsUiUl", MergeNone, "aarch64_sve_uminv", [IsStreamingCompatible]>;
+def SVORV : SInst<"svorv[_{d}]", "sPd", "csilUcUsUiUl", MergeNone, "aarch64_sve_orv", [IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// Integer comparisons
-def SVCMPEQ : SInst<"svcmpeq[_{d}]", "PPdd", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpeq">;
-def SVCMPNE : SInst<"svcmpne[_{d}]", "PPdd", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpne">;
-def SVCMPGE : SInst<"svcmpge[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpge">;
-def SVCMPGT : SInst<"svcmpgt[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpgt">;
-def SVCMPLE : SInst<"svcmple[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpge", [ReverseCompare]>;
-def SVCMPLT : SInst<"svcmplt[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpgt", [ReverseCompare]>;
-def SVCMPHI : SInst<"svcmpgt[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi">;
-def SVCMPHS : SInst<"svcmpge[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs">;
-def SVCMPLO : SInst<"svcmplt[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi", [ReverseCompare]>;
-def SVCMPLS : SInst<"svcmple[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs", [ReverseCompare]>;
-
-def SVCMPEQ_N : SInst<"svcmpeq[_n_{d}]", "PPda", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpeq">;
-def SVCMPNE_N : SInst<"svcmpne[_n_{d}]", "PPda", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpne">;
-def SVCMPGE_N : SInst<"svcmpge[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpge">;
-def SVCMPGT_N : SInst<"svcmpgt[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpgt">;
-def SVCMPLE_N : SInst<"svcmple[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpge", [ReverseCompare]>;
-def SVCMPLT_N : SInst<"svcmplt[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpgt", [ReverseCompare]>;
-def SVCMPHS_N : SInst<"svcmpge[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs">;
-def SVCMPHI_N : SInst<"svcmpgt[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi">;
-def SVCMPLS_N : SInst<"svcmple[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs", [ReverseCompare]>;
-def SVCMPLO_N : SInst<"svcmplt[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi", [ReverseCompare]>;
-
-def SVCMPEQ_WIDE : SInst<"svcmpeq_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpeq_wide">;
-def SVCMPNE_WIDE : SInst<"svcmpne_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpne_wide">;
-def SVCMPGE_WIDE : SInst<"svcmpge_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpge_wide">;
-def SVCMPGT_WIDE : SInst<"svcmpgt_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpgt_wide">;
-def SVCMPLE_WIDE : SInst<"svcmple_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmple_wide">;
-def SVCMPLT_WIDE : SInst<"svcmplt_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmplt_wide">;
-def SVCMPHI_WIDE : SInst<"svcmpgt_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmphi_wide">;
-def SVCMPHS_WIDE : SInst<"svcmpge_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmphs_wide">;
-def SVCMPLO_WIDE : SInst<"svcmplt_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmplo_wide">;
-def SVCMPLS_WIDE : SInst<"svcmple_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmpls_wide">;
-
-def SVCMPEQ_WIDE_N : SInst<"svcmpeq_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpeq_wide">;
-def SVCMPNE_WIDE_N : SInst<"svcmpne_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpne_wide">;
-def SVCMPGE_WIDE_N : SInst<"svcmpge_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpge_wide">;
-def SVCMPGT_WIDE_N : SInst<"svcmpgt_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpgt_wide">;
-def SVCMPLE_WIDE_N : SInst<"svcmple_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmple_wide">;
-def SVCMPLT_WIDE_N : SInst<"svcmplt_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmplt_wide">;
-def SVCMPHS_WIDE_N : SInst<"svcmpge_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmphs_wide">;
-def SVCMPHI_WIDE_N : SInst<"svcmpgt_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmphi_wide">;
-def SVCMPLO_WIDE_N : SInst<"svcmplt_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmplo_wide">;
-def SVCMPLS_WIDE_N : SInst<"svcmple_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmpls_wide">;
+def SVCMPEQ : SInst<"svcmpeq[_{d}]", "PPdd", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpeq", [IsStreamingCompatible]>;
+def SVCMPNE : SInst<"svcmpne[_{d}]", "PPdd", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpne", [IsStreamingCompatible]>;
+def SVCMPGE : SInst<"svcmpge[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpge", [IsStreamingCompatible]>;
+def SVCMPGT : SInst<"svcmpgt[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpgt", [IsStreamingCompatible]>;
+def SVCMPLE : SInst<"svcmple[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpge", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPLT : SInst<"svcmplt[_{d}]", "PPdd", "csil", MergeNone, "aarch64_sve_cmpgt", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPHI : SInst<"svcmpgt[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi", [IsStreamingCompatible]>;
+def SVCMPHS : SInst<"svcmpge[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs", [IsStreamingCompatible]>;
+def SVCMPLO : SInst<"svcmplt[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPLS : SInst<"svcmple[_{d}]", "PPdd", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs", [ReverseCompare, IsStreamingCompatible]>;
+
+def SVCMPEQ_N : SInst<"svcmpeq[_n_{d}]", "PPda", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpeq", [IsStreamingCompatible]>;
+def SVCMPNE_N : SInst<"svcmpne[_n_{d}]", "PPda", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmpne", [IsStreamingCompatible]>;
+def SVCMPGE_N : SInst<"svcmpge[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpge", [IsStreamingCompatible]>;
+def SVCMPGT_N : SInst<"svcmpgt[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpgt", [IsStreamingCompatible]>;
+def SVCMPLE_N : SInst<"svcmple[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpge", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPLT_N : SInst<"svcmplt[_n_{d}]", "PPda", "csil", MergeNone, "aarch64_sve_cmpgt", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPHS_N : SInst<"svcmpge[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs", [IsStreamingCompatible]>;
+def SVCMPHI_N : SInst<"svcmpgt[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi", [IsStreamingCompatible]>;
+def SVCMPLS_N : SInst<"svcmple[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphs", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPLO_N : SInst<"svcmplt[_n_{d}]", "PPda", "UcUsUiUl", MergeNone, "aarch64_sve_cmphi", [ReverseCompare, IsStreamingCompatible]>;
+
+def SVCMPEQ_WIDE : SInst<"svcmpeq_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpeq_wide", [IsStreamingCompatible]>;
+def SVCMPNE_WIDE : SInst<"svcmpne_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpne_wide", [IsStreamingCompatible]>;
+def SVCMPGE_WIDE : SInst<"svcmpge_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpge_wide", [IsStreamingCompatible]>;
+def SVCMPGT_WIDE : SInst<"svcmpgt_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmpgt_wide", [IsStreamingCompatible]>;
+def SVCMPLE_WIDE : SInst<"svcmple_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmple_wide", [IsStreamingCompatible]>;
+def SVCMPLT_WIDE : SInst<"svcmplt_wide[_{d}]", "PPdw", "csi", MergeNone, "aarch64_sve_cmplt_wide", [IsStreamingCompatible]>;
+def SVCMPHI_WIDE : SInst<"svcmpgt_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmphi_wide", [IsStreamingCompatible]>;
+def SVCMPHS_WIDE : SInst<"svcmpge_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmphs_wide", [IsStreamingCompatible]>;
+def SVCMPLO_WIDE : SInst<"svcmplt_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmplo_wide", [IsStreamingCompatible]>;
+def SVCMPLS_WIDE : SInst<"svcmple_wide[_{d}]", "PPdw", "UcUsUi", MergeNone, "aarch64_sve_cmpls_wide", [IsStreamingCompatible]>;
+
+def SVCMPEQ_WIDE_N : SInst<"svcmpeq_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpeq_wide", [IsStreamingCompatible]>;
+def SVCMPNE_WIDE_N : SInst<"svcmpne_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpne_wide", [IsStreamingCompatible]>;
+def SVCMPGE_WIDE_N : SInst<"svcmpge_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpge_wide", [IsStreamingCompatible]>;
+def SVCMPGT_WIDE_N : SInst<"svcmpgt_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmpgt_wide", [IsStreamingCompatible]>;
+def SVCMPLE_WIDE_N : SInst<"svcmple_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmple_wide", [IsStreamingCompatible]>;
+def SVCMPLT_WIDE_N : SInst<"svcmplt_wide[_n_{d}]", "PPdj", "csi", MergeNone, "aarch64_sve_cmplt_wide", [IsStreamingCompatible]>;
+def SVCMPHS_WIDE_N : SInst<"svcmpge_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmphs_wide", [IsStreamingCompatible]>;
+def SVCMPHI_WIDE_N : SInst<"svcmpgt_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmphi_wide", [IsStreamingCompatible]>;
+def SVCMPLO_WIDE_N : SInst<"svcmplt_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmplo_wide", [IsStreamingCompatible]>;
+def SVCMPLS_WIDE_N : SInst<"svcmple_wide[_n_{d}]", "PPdj", "UcUsUi", MergeNone, "aarch64_sve_cmpls_wide", [IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// While comparisons
-def SVWHILELE_S32 : SInst<"svwhilele_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilele", [IsOverloadWhile]>;
-def SVWHILELE_S64 : SInst<"svwhilele_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilele", [IsOverloadWhile]>;
-def SVWHILELO_U32 : SInst<"svwhilelt_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilelo", [IsOverloadWhile]>;
-def SVWHILELO_U64 : SInst<"svwhilelt_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilelo", [IsOverloadWhile]>;
-def SVWHILELS_U32 : SInst<"svwhilele_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilels", [IsOverloadWhile]>;
-def SVWHILELS_U64 : SInst<"svwhilele_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilels", [IsOverloadWhile]>;
-def SVWHILELT_S32 : SInst<"svwhilelt_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilelt", [IsOverloadWhile]>;
-def SVWHILELT_S64 : SInst<"svwhilelt_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilelt", [IsOverloadWhile]>;
+def SVWHILELE_S32 : SInst<"svwhilele_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilele", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILELE_S64 : SInst<"svwhilele_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilele", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILELO_U32 : SInst<"svwhilelt_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilelo", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILELO_U64 : SInst<"svwhilelt_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilelo", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILELS_U32 : SInst<"svwhilele_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilels", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILELS_U64 : SInst<"svwhilele_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilels", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILELT_S32 : SInst<"svwhilelt_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilelt", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILELT_S64 : SInst<"svwhilelt_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilelt", [IsOverloadWhile, IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// Counting bit
@@ -767,12 +767,12 @@ multiclass SInstCLS<string name, string types, string intrinsic, list<FlagType>
def _Z : SInst<name # "[_{d}]", "uPd", types, MergeZeroExp, intrinsic, flags>;
}
-defm SVCLS : SInstCLS<"svcls", "csil", "aarch64_sve_cls">;
-defm SVCLZ : SInstCLS<"svclz", "csilUcUsUiUl", "aarch64_sve_clz">;
-defm SVCNT : SInstCLS<"svcnt", "csilUcUsUiUlhfd", "aarch64_sve_cnt">;
+defm SVCLS : SInstCLS<"svcls", "csil", "aarch64_sve_cls", [IsStreamingCompatible]>;
+defm SVCLZ : SInstCLS<"svclz", "csilUcUsUiUl", "aarch64_sve_clz", [IsStreamingCompatible]>;
+defm SVCNT : SInstCLS<"svcnt", "csilUcUsUiUlhfd", "aarch64_sve_cnt", [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- defm SVCNT_BF16 : SInstCLS<"svcnt", "b", "aarch64_sve_cnt">;
+ defm SVCNT_BF16 : SInstCLS<"svcnt", "b", "aarch64_sve_cnt", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
@@ -827,13 +827,13 @@ def SVTMAD : SInst<"svtmad[_{d}]", "dddi", "hfd", MergeNone, "aarch64_sve_ftma
def SVTSMUL : SInst<"svtsmul[_{d}]", "ddu", "hfd", MergeNone, "aarch64_sve_ftsmul_x">;
def SVTSSEL : SInst<"svtssel[_{d}]", "ddu", "hfd", MergeNone, "aarch64_sve_ftssel_x">;
-def SVSCALE_M : SInst<"svscale[_{d}]", "dPdx", "hfd", MergeOp1, "aarch64_sve_fscale">;
-def SVSCALE_X : SInst<"svscale[_{d}]", "dPdx", "hfd", MergeAny, "aarch64_sve_fscale">;
-def SVSCALE_Z : SInst<"svscale[_{d}]", "dPdx", "hfd", MergeZero, "aarch64_sve_fscale">;
+def SVSCALE_M : SInst<"svscale[_{d}]", "dPdx", "hfd", MergeOp1, "aarch64_sve_fscale", [IsStreamingCompatible]>;
+def SVSCALE_X : SInst<"svscale[_{d}]", "dPdx", "hfd", MergeAny, "aarch64_sve_fscale", [IsStreamingCompatible]>;
+def SVSCALE_Z : SInst<"svscale[_{d}]", "dPdx", "hfd", MergeZero, "aarch64_sve_fscale", [IsStreamingCompatible]>;
-def SVSCALE_N_M : SInst<"svscale[_n_{d}]", "dPdK", "hfd", MergeOp1, "aarch64_sve_fscale">;
-def SVSCALE_N_X : SInst<"svscale[_n_{d}]", "dPdK", "hfd", MergeAny, "aarch64_sve_fscale">;
-def SVSCALE_N_Z : SInst<"svscale[_n_{d}]", "dPdK", "hfd", MergeZero, "aarch64_sve_fscale">;
+def SVSCALE_N_M : SInst<"svscale[_n_{d}]", "dPdK", "hfd", MergeOp1, "aarch64_sve_fscale", [IsStreamingCompatible]>;
+def SVSCALE_N_X : SInst<"svscale[_n_{d}]", "dPdK", "hfd", MergeAny, "aarch64_sve_fscale", [IsStreamingCompatible]>;
+def SVSCALE_N_Z : SInst<"svscale[_n_{d}]", "dPdK", "hfd", MergeZero, "aarch64_sve_fscale", [IsStreamingCompatible]>;
defm SVMAD_F : SInstZPZZZ<"svmad", "hfd", "aarch64_sve_fmad", "aarch64_sve_fmla_u", [ReverseMergeAnyAccOp]>;
defm SVMLA_F : SInstZPZZZ<"svmla", "hfd", "aarch64_sve_fmla", "aarch64_sve_fmla_u">;
@@ -844,42 +844,42 @@ defm SVNMLA_F : SInstZPZZZ<"svnmla", "hfd", "aarch64_sve_fnmla", "aarch64_sve_fn
defm SVNMLS_F : SInstZPZZZ<"svnmls", "hfd", "aarch64_sve_fnmls", "aarch64_sve_fnmls_u">;
defm SVNMSB_F : SInstZPZZZ<"svnmsb", "hfd", "aarch64_sve_fnmsb", "aarch64_sve_fnmls_u", [ReverseMergeAnyAccOp]>;
-def SVCADD_M : SInst<"svcadd[_{d}]", "dPddi", "hfd", MergeOp1, "aarch64_sve_fcadd", [], [ImmCheck<3, ImmCheckComplexRot90_270>]>;
-def SVCADD_X : SInst<"svcadd[_{d}]", "dPddi", "hfd", MergeAny, "aarch64_sve_fcadd", [], [ImmCheck<3, ImmCheckComplexRot90_270>]>;
-def SVCADD_Z : SInst<"svcadd[_{d}]", "dPddi", "hfd", MergeZero, "aarch64_sve_fcadd", [], [ImmCheck<3, ImmCheckComplexRot90_270>]>;
-def SVCMLA_M : SInst<"svcmla[_{d}]", "dPdddi", "hfd", MergeOp1, "aarch64_sve_fcmla", [], [ImmCheck<4, ImmCheckComplexRotAll90>]>;
-def SVCMLA_X : SInst<"svcmla[_{d}]", "dPdddi", "hfd", MergeAny, "aarch64_sve_fcmla", [], [ImmCheck<4, ImmCheckComplexRotAll90>]>;
-def SVCMLA_Z : SInst<"svcmla[_{d}]", "dPdddi", "hfd", MergeZero, "aarch64_sve_fcmla", [], [ImmCheck<4, ImmCheckComplexRotAll90>]>;
+def SVCADD_M : SInst<"svcadd[_{d}]", "dPddi", "hfd", MergeOp1, "aarch64_sve_fcadd", [IsStreamingCompatible], [ImmCheck<3, ImmCheckComplexRot90_270>]>;
+def SVCADD_X : SInst<"svcadd[_{d}]", "dPddi", "hfd", MergeAny, "aarch64_sve_fcadd", [IsStreamingCompatible], [ImmCheck<3, ImmCheckComplexRot90_270>]>;
+def SVCADD_Z : SInst<"svcadd[_{d}]", "dPddi", "hfd", MergeZero, "aarch64_sve_fcadd", [IsStreamingCompatible], [ImmCheck<3, ImmCheckComplexRot90_270>]>;
+def SVCMLA_M : SInst<"svcmla[_{d}]", "dPdddi", "hfd", MergeOp1, "aarch64_sve_fcmla", [IsStreamingCompatible], [ImmCheck<4, ImmCheckComplexRotAll90>]>;
+def SVCMLA_X : SInst<"svcmla[_{d}]", "dPdddi", "hfd", MergeAny, "aarch64_sve_fcmla", [IsStreamingCompatible], [ImmCheck<4, ImmCheckComplexRotAll90>]>;
+def SVCMLA_Z : SInst<"svcmla[_{d}]", "dPdddi", "hfd", MergeZero, "aarch64_sve_fcmla", [IsStreamingCompatible], [ImmCheck<4, ImmCheckComplexRotAll90>]>;
-def SVCMLA_LANE : SInst<"svcmla_lane[_{d}]", "ddddii", "hf", MergeNone, "aarch64_sve_fcmla_lane", [], [ImmCheck<3, ImmCheckLaneIndexCompRotate, 2>,
+def SVCMLA_LANE : SInst<"svcmla_lane[_{d}]", "ddddii", "hf", MergeNone, "aarch64_sve_fcmla_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndexCompRotate, 2>,
ImmCheck<4, ImmCheckComplexRotAll90>]>;
-def SVMLA_LANE : SInst<"svmla_lane[_{d}]", "ddddi", "hfd", MergeNone, "aarch64_sve_fmla_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLS_LANE : SInst<"svmls_lane[_{d}]", "ddddi", "hfd", MergeNone, "aarch64_sve_fmls_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMUL_LANE : SInst<"svmul_lane[_{d}]", "dddi", "hfd", MergeNone, "aarch64_sve_fmul_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVMLA_LANE : SInst<"svmla_lane[_{d}]", "ddddi", "hfd", MergeNone, "aarch64_sve_fmla_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLS_LANE : SInst<"svmls_lane[_{d}]", "ddddi", "hfd", MergeNone, "aarch64_sve_fmls_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMUL_LANE : SInst<"svmul_lane[_{d}]", "dddi", "hfd", MergeNone, "aarch64_sve_fmul_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVRECPE : SInst<"svrecpe[_{d}]", "dd", "hfd", MergeNone, "aarch64_sve_frecpe_x">;
-def SVRECPS : SInst<"svrecps[_{d}]", "ddd", "hfd", MergeNone, "aarch64_sve_frecps_x">;
-def SVRSQRTE : SInst<"svrsqrte[_{d}]", "dd", "hfd", MergeNone, "aarch64_sve_frsqrte_x">;
-def SVRSQRTS : SInst<"svrsqrts[_{d}]", "ddd", "hfd", MergeNone, "aarch64_sve_frsqrts_x">;
+def SVRECPE : SInst<"svrecpe[_{d}]", "dd", "hfd", MergeNone, "aarch64_sve_frecpe_x", [IsStreamingCompatible]>;
+def SVRECPS : SInst<"svrecps[_{d}]", "ddd", "hfd", MergeNone, "aarch64_sve_frecps_x", [IsStreamingCompatible]>;
+def SVRSQRTE : SInst<"svrsqrte[_{d}]", "dd", "hfd", MergeNone, "aarch64_sve_frsqrte_x", [IsStreamingCompatible]>;
+def SVRSQRTS : SInst<"svrsqrts[_{d}]", "ddd", "hfd", MergeNone, "aarch64_sve_frsqrts_x", [IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// Floating-point reductions
-def SVFADDA : SInst<"svadda[_{d}]", "sPsd", "hfd", MergeNone, "aarch64_sve_fadda">;
-def SVFADDV : SInst<"svaddv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_faddv">;
-def SVFMAXV : SInst<"svmaxv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fmaxv">;
-def SVFMAXNMV : SInst<"svmaxnmv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fmaxnmv">;
-def SVFMINV : SInst<"svminv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fminv">;
-def SVFMINNMV : SInst<"svminnmv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fminnmv">;
+def SVFADDA : SInst<"svadda[_{d}]", "sPsd", "hfd", MergeNone, "aarch64_sve_fadda", [IsStreamingCompatible]>;
+def SVFADDV : SInst<"svaddv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_faddv", [IsStreamingCompatible]>;
+def SVFMAXV : SInst<"svmaxv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fmaxv", [IsStreamingCompatible]>;
+def SVFMAXNMV : SInst<"svmaxnmv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fmaxnmv", [IsStreamingCompatible]>;
+def SVFMINV : SInst<"svminv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fminv", [IsStreamingCompatible]>;
+def SVFMINNMV : SInst<"svminnmv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fminnmv", [IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// Floating-point comparisons
-def SVACGE : SInst<"svacge[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facge">;
-def SVACGT : SInst<"svacgt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facgt">;
-def SVACLE : SInst<"svacle[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facge", [ReverseCompare]>;
-def SVACLT : SInst<"svaclt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facgt", [ReverseCompare]>;
-def SVCMPUO : SInst<"svcmpuo[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpuo">;
+def SVACGE : SInst<"svacge[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facge", [IsStreamingCompatible]>;
+def SVACGT : SInst<"svacgt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facgt", [IsStreamingCompatible]>;
+def SVACLE : SInst<"svacle[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facge", [ReverseCompare, IsStreamingCompatible]>;
+def SVACLT : SInst<"svaclt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_facgt", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPUO : SInst<"svcmpuo[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpuo", [IsStreamingCompatible]>;
def SVACGE_N : SInst<"svacge[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_facge">;
def SVACGT_N : SInst<"svacgt[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_facgt">;
@@ -887,19 +887,19 @@ def SVACLE_N : SInst<"svacle[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_
def SVACLT_N : SInst<"svaclt[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_facgt", [ReverseCompare]>;
def SVCMPUO_N : SInst<"svcmpuo[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpuo">;
-def SVCMPEQ_F : SInst<"svcmpeq[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpeq">;
-def SVCMPNE_F : SInst<"svcmpne[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpne">;
-def SVCMPGE_F : SInst<"svcmpge[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpge">;
-def SVCMPGT_F : SInst<"svcmpgt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpgt">;
-def SVCMPLE_F : SInst<"svcmple[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpge", [ReverseCompare]>;
-def SVCMPLT_F : SInst<"svcmplt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpgt", [ReverseCompare]>;
+def SVCMPEQ_F : SInst<"svcmpeq[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpeq", [IsStreamingCompatible]>;
+def SVCMPNE_F : SInst<"svcmpne[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpne", [IsStreamingCompatible]>;
+def SVCMPGE_F : SInst<"svcmpge[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpge", [IsStreamingCompatible]>;
+def SVCMPGT_F : SInst<"svcmpgt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpgt", [IsStreamingCompatible]>;
+def SVCMPLE_F : SInst<"svcmple[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpge", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPLT_F : SInst<"svcmplt[_{d}]", "PPdd", "hfd", MergeNone, "aarch64_sve_fcmpgt", [ReverseCompare, IsStreamingCompatible]>;
-def SVCMPEQ_F_N : SInst<"svcmpeq[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpeq">;
-def SVCMPNE_F_N : SInst<"svcmpne[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpne">;
-def SVCMPGE_F_N : SInst<"svcmpge[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpge">;
-def SVCMPGT_F_N : SInst<"svcmpgt[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpgt">;
-def SVCMPLE_F_N : SInst<"svcmple[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpge", [ReverseCompare]>;
-def SVCMPLT_F_N : SInst<"svcmplt[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpgt", [ReverseCompare]>;
+def SVCMPEQ_F_N : SInst<"svcmpeq[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpeq", [IsStreamingCompatible]>;
+def SVCMPNE_F_N : SInst<"svcmpne[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpne", [IsStreamingCompatible]>;
+def SVCMPGE_F_N : SInst<"svcmpge[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpge", [IsStreamingCompatible]>;
+def SVCMPGT_F_N : SInst<"svcmpgt[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpgt", [IsStreamingCompatible]>;
+def SVCMPLE_F_N : SInst<"svcmple[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpge", [ReverseCompare, IsStreamingCompatible]>;
+def SVCMPLT_F_N : SInst<"svcmplt[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sve_fcmpgt", [ReverseCompare, IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// Floating-point conversions
@@ -907,16 +907,16 @@ def SVCMPLT_F_N : SInst<"svcmplt[_n_{d}]", "PPda", "hfd", MergeNone, "aarch64_sv
multiclass SInstCvtMXZ<
string name, string m_types, string xz_types, string types,
string intrinsic, list<FlagType> flags = [IsOverloadNone]> {
- def _M : SInst<name, m_types, types, MergeOp1, intrinsic, flags>;
- def _X : SInst<name, xz_types, types, MergeAnyExp, intrinsic, flags>;
- def _Z : SInst<name, xz_types, types, MergeZeroExp, intrinsic, flags>;
+ def _M : SInst<name, m_types, types, MergeOp1, intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
+ def _X : SInst<name, xz_types, types, MergeAnyExp, intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
+ def _Z : SInst<name, xz_types, types, MergeZeroExp, intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
}
multiclass SInstCvtMX<string name, string m_types, string xz_types,
string types, string intrinsic,
list<FlagType> flags = [IsOverloadNone]> {
- def _M : SInst<name, m_types, types, MergeOp1, intrinsic, flags>;
- def _X : SInst<name, xz_types, types, MergeAnyExp, intrinsic, flags>;
+ def _M : SInst<name, m_types, types, MergeOp1, intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
+ def _X : SInst<name, xz_types, types, MergeAnyExp, intrinsic, !listconcat(flags, [IsStreamingCompatible])>;
}
// svcvt_s##_f16
@@ -930,7 +930,7 @@ defm SVFCVTZS_S64_F32 : SInstCvtMXZ<"svcvt_s64[_f32]", "ddPM", "dPM", "l", "aar
let TargetGuard = "sve,bf16" in {
defm SVCVT_BF16_F32 : SInstCvtMXZ<"svcvt_bf16[_f32]", "ddPM", "dPM", "b", "aarch64_sve_fcvt_bf16f32">;
- def SVCVTNT_BF16_F32 : SInst<"svcvtnt_bf16[_f32]", "ddPM", "b", MergeOp1, "aarch64_sve_fcvtnt_bf16f32", [IsOverloadNone]>;
+ def SVCVTNT_BF16_F32 : SInst<"svcvtnt_bf16[_f32]", "ddPM", "b", MergeOp1, "aarch64_sve_fcvtnt_bf16f32", [IsOverloadNone, IsStreamingCompatible]>;
}
// svcvt_s##_f64
@@ -994,11 +994,11 @@ defm SVCVTLT_F64 : SInstCvtMX<"svcvtlt_f64[_f32]", "ddPh", "dPh", "d", "aarc
defm SVCVTX_F32 : SInstCvtMXZ<"svcvtx_f32[_f64]", "MMPd", "MPd", "d", "aarch64_sve_fcvtx_f32f64">;
-def SVCVTNT_F32 : SInst<"svcvtnt_f16[_f32]", "hhPd", "f", MergeOp1, "aarch64_sve_fcvtnt_f16f32", [IsOverloadNone]>;
-def SVCVTNT_F64 : SInst<"svcvtnt_f32[_f64]", "hhPd", "d", MergeOp1, "aarch64_sve_fcvtnt_f32f64", [IsOverloadNone]>;
+def SVCVTNT_F32 : SInst<"svcvtnt_f16[_f32]", "hhPd", "f", MergeOp1, "aarch64_sve_fcvtnt_f16f32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVCVTNT_F64 : SInst<"svcvtnt_f32[_f64]", "hhPd", "d", MergeOp1, "aarch64_sve_fcvtnt_f32f64", [IsOverloadNone, IsStreamingCompatible]>;
// SVCVTNT_X : Implemented as macro by SveEmitter.cpp
-def SVCVTXNT_F32 : SInst<"svcvtxnt_f32[_f64]", "MMPd", "d", MergeOp1, "aarch64_sve_fcvtxnt_f32f64", [IsOverloadNone]>;
+def SVCVTXNT_F32 : SInst<"svcvtxnt_f32[_f64]", "MMPd", "d", MergeOp1, "aarch64_sve_fcvtxnt_f32f64", [IsOverloadNone, IsStreamingCompatible]>;
// SVCVTXNT_X_F32 : Implemented as macro by SveEmitter.cpp
}
@@ -1007,9 +1007,9 @@ def SVCVTXNT_F32 : SInst<"svcvtxnt_f32[_f64]", "MMPd", "d", MergeOp1, "aarch6
// Permutations and selection
multiclass SVEPerm<string name, string proto, string i> {
- def : SInst<name, proto, "csilUcUsUiUlhfd", MergeNone, i>;
+ def : SInst<name, proto, "csilUcUsUiUlhfd", MergeNone, i, [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- def: SInst<name, proto, "b", MergeNone, i>;
+ def: SInst<name, proto, "b", MergeNone, i, [IsStreamingCompatible]>;
}
}
@@ -1033,81 +1033,81 @@ def SVDUPQ_LANE : SInst<"svdupq_lane[_{d}]", "ddn", "csilUcUsUiUlhfd", MergeNo
let TargetGuard = "sve,bf16" in {
def SVDUPQ_LANE_BF16 : SInst<"svdupq_lane[_{d}]", "ddn", "b", MergeNone, "aarch64_sve_dupq_lane">;
}
-def SVEXT : SInst<"svext[_{d}]", "dddi", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_ext", [], [ImmCheck<2, ImmCheckExtract, 1>]>;
+def SVEXT : SInst<"svext[_{d}]", "dddi", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_ext", [IsStreamingCompatible], [ImmCheck<2, ImmCheckExtract, 1>]>;
defm SVLASTA : SVEPerm<"svlasta[_{d}]", "sPd", "aarch64_sve_lasta">;
defm SVLASTB : SVEPerm<"svlastb[_{d}]", "sPd", "aarch64_sve_lastb">;
-def SVREV : SInst<"svrev[_{d}]", "dd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_rev">;
-def SVSEL : SInst<"svsel[_{d}]", "dPdd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_sel">;
-def SVSPLICE : SInst<"svsplice[_{d}]", "dPdd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_splice">;
-def SVTBL : SInst<"svtbl[_{d}]", "ddu", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_tbl">;
+def SVREV : SInst<"svrev[_{d}]", "dd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_rev", [IsStreamingCompatible]>;
+def SVSEL : SInst<"svsel[_{d}]", "dPdd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_sel", [IsStreamingCompatible]>;
+def SVSPLICE : SInst<"svsplice[_{d}]", "dPdd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_splice", [IsStreamingCompatible]>;
+def SVTBL : SInst<"svtbl[_{d}]", "ddu", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_tbl", [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
- def SVTBL_BF16 : SInst<"svtbl[_{d}]", "ddu", "b", MergeNone, "aarch64_sve_tbl">;
+ def SVTBL_BF16 : SInst<"svtbl[_{d}]", "ddu", "b", MergeNone, "aarch64_sve_tbl", [IsStreamingCompatible]>;
}
-def SVTRN1 : SInst<"svtrn1[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn1">;
-def SVTRN2 : SInst<"svtrn2[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn2">;
-def SVUNPKHI_S : SInst<"svunpkhi[_{d}]", "dh", "sil", MergeNone, "aarch64_sve_sunpkhi">;
-def SVUNPKHI_U : SInst<"svunpkhi[_{d}]", "dh", "UsUiUl", MergeNone, "aarch64_sve_uunpkhi">;
-def SVUNPKLO_S : SInst<"svunpklo[_{d}]", "dh", "sil", MergeNone, "aarch64_sve_sunpklo">;
-def SVUNPKLO_U : SInst<"svunpklo[_{d}]", "dh", "UsUiUl", MergeNone, "aarch64_sve_uunpklo">;
-def SVUZP1 : SInst<"svuzp1[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp1">;
-def SVUZP2 : SInst<"svuzp2[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp2">;
-def SVZIP1 : SInst<"svzip1[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip1">;
-def SVZIP2 : SInst<"svzip2[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip2">;
+def SVTRN1 : SInst<"svtrn1[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn1", [IsStreamingCompatible]>;
+def SVTRN2 : SInst<"svtrn2[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn2", [IsStreamingCompatible]>;
+def SVUNPKHI_S : SInst<"svunpkhi[_{d}]", "dh", "sil", MergeNone, "aarch64_sve_sunpkhi", [IsStreamingCompatible]>;
+def SVUNPKHI_U : SInst<"svunpkhi[_{d}]", "dh", "UsUiUl", MergeNone, "aarch64_sve_uunpkhi", [IsStreamingCompatible]>;
+def SVUNPKLO_S : SInst<"svunpklo[_{d}]", "dh", "sil", MergeNone, "aarch64_sve_sunpklo", [IsStreamingCompatible]>;
+def SVUNPKLO_U : SInst<"svunpklo[_{d}]", "dh", "UsUiUl", MergeNone, "aarch64_sve_uunpklo", [IsStreamingCompatible]>;
+def SVUZP1 : SInst<"svuzp1[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp1", [IsStreamingCompatible]>;
+def SVUZP2 : SInst<"svuzp2[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp2", [IsStreamingCompatible]>;
+def SVZIP1 : SInst<"svzip1[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip1", [IsStreamingCompatible]>;
+def SVZIP2 : SInst<"svzip2[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip2", [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
-def SVEXT_BF16 : SInst<"svext[_{d}]", "dddi", "b", MergeNone, "aarch64_sve_ext", [], [ImmCheck<2, ImmCheckExtract, 1>]>;
-def SVREV_BF16 : SInst<"svrev[_{d}]", "dd", "b", MergeNone, "aarch64_sve_rev">;
-def SVSEL_BF16 : SInst<"svsel[_{d}]", "dPdd", "b", MergeNone, "aarch64_sve_sel">;
-def SVSPLICE_BF16 : SInst<"svsplice[_{d}]", "dPdd", "b", MergeNone, "aarch64_sve_splice">;
-def SVTRN1_BF16 : SInst<"svtrn1[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_trn1">;
-def SVTRN2_BF16 : SInst<"svtrn2[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_trn2">;
-def SVUZP1_BF16 : SInst<"svuzp1[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_uzp1">;
-def SVUZP2_BF16 : SInst<"svuzp2[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_uzp2">;
-def SVZIP1_BF16 : SInst<"svzip1[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_zip1">;
-def SVZIP2_BF16 : SInst<"svzip2[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_zip2">;
-}
-
-def SVREV_B8 : SInst<"svrev_b8", "PP", "Pc", MergeNone, "aarch64_sve_rev">;
-def SVREV_B16 : SInst<"svrev_b16", "PP", "Pc", MergeNone, "aarch64_sve_rev_b16", [IsOverloadNone]>;
-def SVREV_B32 : SInst<"svrev_b32", "PP", "Pc", MergeNone, "aarch64_sve_rev_b32", [IsOverloadNone]>;
-def SVREV_B64 : SInst<"svrev_b64", "PP", "Pc", MergeNone, "aarch64_sve_rev_b64", [IsOverloadNone]>;
-def SVSEL_B : SInst<"svsel[_b]", "PPPP", "Pc", MergeNone, "aarch64_sve_sel">;
-def SVTRN1_B8 : SInst<"svtrn1_b8", "PPP", "Pc", MergeNone, "aarch64_sve_trn1">;
-def SVTRN1_B16 : SInst<"svtrn1_b16", "PPP", "Pc", MergeNone, "aarch64_sve_trn1_b16", [IsOverloadNone]>;
-def SVTRN1_B32 : SInst<"svtrn1_b32", "PPP", "Pc", MergeNone, "aarch64_sve_trn1_b32", [IsOverloadNone]>;
-def SVTRN1_B64 : SInst<"svtrn1_b64", "PPP", "Pc", MergeNone, "aarch64_sve_trn1_b64", [IsOverloadNone]>;
-def SVTRN2_B8 : SInst<"svtrn2_b8", "PPP", "Pc", MergeNone, "aarch64_sve_trn2">;
-def SVTRN2_B16 : SInst<"svtrn2_b16", "PPP", "Pc", MergeNone, "aarch64_sve_trn2_b16", [IsOverloadNone]>;
-def SVTRN2_B32 : SInst<"svtrn2_b32", "PPP", "Pc", MergeNone, "aarch64_sve_trn2_b32", [IsOverloadNone]>;
-def SVTRN2_B64 : SInst<"svtrn2_b64", "PPP", "Pc", MergeNone, "aarch64_sve_trn2_b64", [IsOverloadNone]>;
-def SVPUNPKHI : SInst<"svunpkhi[_b]", "PP", "Pc", MergeNone, "aarch64_sve_punpkhi">;
-def SVPUNPKLO : SInst<"svunpklo[_b]", "PP", "Pc", MergeNone, "aarch64_sve_punpklo">;
-def SVUZP1_B8 : SInst<"svuzp1_b8", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1">;
-def SVUZP1_B16 : SInst<"svuzp1_b16", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1_b16", [IsOverloadNone]>;
-def SVUZP1_B32 : SInst<"svuzp1_b32", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1_b32", [IsOverloadNone]>;
-def SVUZP1_B64 : SInst<"svuzp1_b64", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1_b64", [IsOverloadNone]>;
-def SVUZP2_B8 : SInst<"svuzp2_b8", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2">;
-def SVUZP2_B16 : SInst<"svuzp2_b16", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2_b16", [IsOverloadNone]>;
-def SVUZP2_B32 : SInst<"svuzp2_b32", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2_b32", [IsOverloadNone]>;
-def SVUZP2_B64 : SInst<"svuzp2_b64", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2_b64", [IsOverloadNone]>;
-def SVZIP1_B8 : SInst<"svzip1_b8", "PPP", "Pc", MergeNone, "aarch64_sve_zip1">;
-def SVZIP1_B16 : SInst<"svzip1_b16", "PPP", "Pc", MergeNone, "aarch64_sve_zip1_b16", [IsOverloadNone]>;
-def SVZIP1_B32 : SInst<"svzip1_b32", "PPP", "Pc", MergeNone, "aarch64_sve_zip1_b32", [IsOverloadNone]>;
-def SVZIP1_B64 : SInst<"svzip1_b64", "PPP", "Pc", MergeNone, "aarch64_sve_zip1_b64", [IsOverloadNone]>;
-def SVZIP2_B : SInst<"svzip2_b8", "PPP", "Pc", MergeNone, "aarch64_sve_zip2">;
-def SVZIP2_B16 : SInst<"svzip2_b16", "PPP", "Pc", MergeNone, "aarch64_sve_zip2_b16", [IsOverloadNone]>;
-def SVZIP2_B32 : SInst<"svzip2_b32", "PPP", "Pc", MergeNone, "aarch64_sve_zip2_b32", [IsOverloadNone]>;
-def SVZIP2_B64 : SInst<"svzip2_b64", "PPP", "Pc", MergeNone, "aarch64_sve_zip2_b64", [IsOverloadNone]>;
+def SVEXT_BF16 : SInst<"svext[_{d}]", "dddi", "b", MergeNone, "aarch64_sve_ext", [IsStreamingCompatible], [ImmCheck<2, ImmCheckExtract, 1>]>;
+def SVREV_BF16 : SInst<"svrev[_{d}]", "dd", "b", MergeNone, "aarch64_sve_rev", [IsStreamingCompatible]>;
+def SVSEL_BF16 : SInst<"svsel[_{d}]", "dPdd", "b", MergeNone, "aarch64_sve_sel", [IsStreamingCompatible]>;
+def SVSPLICE_BF16 : SInst<"svsplice[_{d}]", "dPdd", "b", MergeNone, "aarch64_sve_splice", [IsStreamingCompatible]>;
+def SVTRN1_BF16 : SInst<"svtrn1[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_trn1", [IsStreamingCompatible]>;
+def SVTRN2_BF16 : SInst<"svtrn2[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_trn2", [IsStreamingCompatible]>;
+def SVUZP1_BF16 : SInst<"svuzp1[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_uzp1", [IsStreamingCompatible]>;
+def SVUZP2_BF16 : SInst<"svuzp2[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_uzp2", [IsStreamingCompatible]>;
+def SVZIP1_BF16 : SInst<"svzip1[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_zip1", [IsStreamingCompatible]>;
+def SVZIP2_BF16 : SInst<"svzip2[_{d}]", "ddd", "b", MergeNone, "aarch64_sve_zip2", [IsStreamingCompatible]>;
+}
+
+def SVREV_B8 : SInst<"svrev_b8", "PP", "Pc", MergeNone, "aarch64_sve_rev", [IsStreamingCompatible]>;
+def SVREV_B16 : SInst<"svrev_b16", "PP", "Pc", MergeNone, "aarch64_sve_rev_b16", [IsOverloadNone, IsStreamingCompatible]>;
+def SVREV_B32 : SInst<"svrev_b32", "PP", "Pc", MergeNone, "aarch64_sve_rev_b32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVREV_B64 : SInst<"svrev_b64", "PP", "Pc", MergeNone, "aarch64_sve_rev_b64", [IsOverloadNone, IsStreamingCompatible]>;
+def SVSEL_B : SInst<"svsel[_b]", "PPPP", "Pc", MergeNone, "aarch64_sve_sel", [IsStreamingCompatible]>;
+def SVTRN1_B8 : SInst<"svtrn1_b8", "PPP", "Pc", MergeNone, "aarch64_sve_trn1", [IsStreamingCompatible]>;
+def SVTRN1_B16 : SInst<"svtrn1_b16", "PPP", "Pc", MergeNone, "aarch64_sve_trn1_b16", [IsOverloadNone, IsStreamingCompatible]>;
+def SVTRN1_B32 : SInst<"svtrn1_b32", "PPP", "Pc", MergeNone, "aarch64_sve_trn1_b32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVTRN1_B64 : SInst<"svtrn1_b64", "PPP", "Pc", MergeNone, "aarch64_sve_trn1_b64", [IsOverloadNone, IsStreamingCompatible]>;
+def SVTRN2_B8 : SInst<"svtrn2_b8", "PPP", "Pc", MergeNone, "aarch64_sve_trn2", [IsStreamingCompatible]>;
+def SVTRN2_B16 : SInst<"svtrn2_b16", "PPP", "Pc", MergeNone, "aarch64_sve_trn2_b16", [IsOverloadNone, IsStreamingCompatible]>;
+def SVTRN2_B32 : SInst<"svtrn2_b32", "PPP", "Pc", MergeNone, "aarch64_sve_trn2_b32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVTRN2_B64 : SInst<"svtrn2_b64", "PPP", "Pc", MergeNone, "aarch64_sve_trn2_b64", [IsOverloadNone, IsStreamingCompatible]>;
+def SVPUNPKHI : SInst<"svunpkhi[_b]", "PP", "Pc", MergeNone, "aarch64_sve_punpkhi", [IsStreamingCompatible]>;
+def SVPUNPKLO : SInst<"svunpklo[_b]", "PP", "Pc", MergeNone, "aarch64_sve_punpklo", [IsStreamingCompatible]>;
+def SVUZP1_B8 : SInst<"svuzp1_b8", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1", [IsStreamingCompatible]>;
+def SVUZP1_B16 : SInst<"svuzp1_b16", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1_b16", [IsOverloadNone, IsStreamingCompatible]>;
+def SVUZP1_B32 : SInst<"svuzp1_b32", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1_b32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVUZP1_B64 : SInst<"svuzp1_b64", "PPP", "Pc", MergeNone, "aarch64_sve_uzp1_b64", [IsOverloadNone, IsStreamingCompatible]>;
+def SVUZP2_B8 : SInst<"svuzp2_b8", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2", [IsStreamingCompatible]>;
+def SVUZP2_B16 : SInst<"svuzp2_b16", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2_b16", [IsOverloadNone, IsStreamingCompatible]>;
+def SVUZP2_B32 : SInst<"svuzp2_b32", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2_b32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVUZP2_B64 : SInst<"svuzp2_b64", "PPP", "Pc", MergeNone, "aarch64_sve_uzp2_b64", [IsOverloadNone, IsStreamingCompatible]>;
+def SVZIP1_B8 : SInst<"svzip1_b8", "PPP", "Pc", MergeNone, "aarch64_sve_zip1", [IsStreamingCompatible]>;
+def SVZIP1_B16 : SInst<"svzip1_b16", "PPP", "Pc", MergeNone, "aarch64_sve_zip1_b16", [IsOverloadNone, IsStreamingCompatible]>;
+def SVZIP1_B32 : SInst<"svzip1_b32", "PPP", "Pc", MergeNone, "aarch64_sve_zip1_b32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVZIP1_B64 : SInst<"svzip1_b64", "PPP", "Pc", MergeNone, "aarch64_sve_zip1_b64", [IsOverloadNone, IsStreamingCompatible]>;
+def SVZIP2_B : SInst<"svzip2_b8", "PPP", "Pc", MergeNone, "aarch64_sve_zip2", [IsStreamingCompatible]>;
+def SVZIP2_B16 : SInst<"svzip2_b16", "PPP", "Pc", MergeNone, "aarch64_sve_zip2_b16", [IsOverloadNone, IsStreamingCompatible]>;
+def SVZIP2_B32 : SInst<"svzip2_b32", "PPP", "Pc", MergeNone, "aarch64_sve_zip2_b32", [IsOverloadNone, IsStreamingCompatible]>;
+def SVZIP2_B64 : SInst<"svzip2_b64", "PPP", "Pc", MergeNone, "aarch64_sve_zip2_b64", [IsOverloadNone, IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// Predicate creation
-def SVPFALSE : SInst<"svpfalse[_b]", "Pv", "", MergeNone, "", [IsOverloadNone]>;
+def SVPFALSE : SInst<"svpfalse[_b]", "Pv", "", MergeNone, "", [IsOverloadNone, IsStreamingCompatible]>;
-def SVPTRUE_PAT : SInst<"svptrue_pat_{d}", "PI", "PcPsPiPl", MergeNone, "aarch64_sve_ptrue">;
-def SVPTRUE : SInst<"svptrue_{d}", "Pv", "PcPsPiPl", MergeNone, "aarch64_sve_ptrue", [IsAppendSVALL]>;
+def SVPTRUE_PAT : SInst<"svptrue_pat_{d}", "PI", "PcPsPiPl", MergeNone, "aarch64_sve_ptrue", [IsStreamingCompatible]>;
+def SVPTRUE : SInst<"svptrue_{d}", "Pv", "PcPsPiPl", MergeNone, "aarch64_sve_ptrue", [IsAppendSVALL, IsStreamingCompatible]>;
def SVDUPQ_B8 : SInst<"svdupq[_n]_{d}", "Pssssssssssssssss", "Pc", MergeNone>;
def SVDUPQ_B16 : SInst<"svdupq[_n]_{d}", "Pssssssss", "Ps", MergeNone>;
@@ -1119,33 +1119,33 @@ def SVDUP_N_B : SInst<"svdup[_n]_{d}", "Ps", "PcPsPiPl", MergeNone>;
////////////////////////////////////////////////////////////////////////////////
// Predicate operations
-def SVAND_B_Z : SInst<"svand[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_and_z">;
-def SVBIC_B_Z : SInst<"svbic[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_bic_z">;
-def SVEOR_B_Z : SInst<"sveor[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_eor_z">;
-def SVMOV_B_Z : SInst<"svmov[_b]_z", "PPP", "Pc", MergeNone>; // Uses custom expansion
-def SVNAND_B_Z : SInst<"svnand[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_nand_z">;
-def SVNOR_B_Z : SInst<"svnor[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_nor_z">;
-def SVNOT_B_Z : SInst<"svnot[_b]_z", "PPP", "Pc", MergeNone>; // Uses custom expansion
-def SVORN_B_Z : SInst<"svorn[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_orn_z">;
-def SVORR_B_Z : SInst<"svorr[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_orr_z">;
-
-def SVBRKA : SInst<"svbrka[_b]_m", "PPPP", "Pc", MergeNone, "aarch64_sve_brka">;
-def SVBRKA_Z : SInst<"svbrka[_b]_z", "PPP", "Pc", MergeNone, "aarch64_sve_brka_z">;
-def SVBRKB : SInst<"svbrkb[_b]_m", "PPPP", "Pc", MergeNone, "aarch64_sve_brkb">;
-def SVBRKB_Z : SInst<"svbrkb[_b]_z", "PPP", "Pc", MergeNone, "aarch64_sve_brkb_z">;
-def SVBRKN_Z : SInst<"svbrkn[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_brkn_z">;
-def SVBRKPA_Z : SInst<"svbrkpa[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_brkpa_z">;
-def SVBRKPB_Z : SInst<"svbrkpb[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_brkpb_z">;
-
-def SVPFIRST : SInst<"svpfirst[_b]", "PPP", "Pc", MergeNone, "aarch64_sve_pfirst">;
-def SVPNEXT : SInst<"svpnext_{d}", "PPP", "PcPsPiPl", MergeNone, "aarch64_sve_pnext">;
+def SVAND_B_Z : SInst<"svand[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_and_z", [IsStreamingCompatible]>;
+def SVBIC_B_Z : SInst<"svbic[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_bic_z", [IsStreamingCompatible]>;
+def SVEOR_B_Z : SInst<"sveor[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_eor_z", [IsStreamingCompatible]>;
+def SVMOV_B_Z : SInst<"svmov[_b]_z", "PPP", "Pc", MergeNone, "", [IsStreamingCompatible]>; // Uses custom expansion
+def SVNAND_B_Z : SInst<"svnand[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_nand_z", [IsStreamingCompatible]>;
+def SVNOR_B_Z : SInst<"svnor[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_nor_z", [IsStreamingCompatible]>;
+def SVNOT_B_Z : SInst<"svnot[_b]_z", "PPP", "Pc", MergeNone, "", [IsStreamingCompatible]>; // Uses custom expansion
+def SVORN_B_Z : SInst<"svorn[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_orn_z", [IsStreamingCompatible]>;
+def SVORR_B_Z : SInst<"svorr[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_orr_z", [IsStreamingCompatible]>;
+
+def SVBRKA : SInst<"svbrka[_b]_m", "PPPP", "Pc", MergeNone, "aarch64_sve_brka", [IsStreamingCompatible]>;
+def SVBRKA_Z : SInst<"svbrka[_b]_z", "PPP", "Pc", MergeNone, "aarch64_sve_brka_z", [IsStreamingCompatible]>;
+def SVBRKB : SInst<"svbrkb[_b]_m", "PPPP", "Pc", MergeNone, "aarch64_sve_brkb", [IsStreamingCompatible]>;
+def SVBRKB_Z : SInst<"svbrkb[_b]_z", "PPP", "Pc", MergeNone, "aarch64_sve_brkb_z", [IsStreamingCompatible]>;
+def SVBRKN_Z : SInst<"svbrkn[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_brkn_z", [IsStreamingCompatible]>;
+def SVBRKPA_Z : SInst<"svbrkpa[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_brkpa_z", [IsStreamingCompatible]>;
+def SVBRKPB_Z : SInst<"svbrkpb[_b]_z", "PPPP", "Pc", MergeNone, "aarch64_sve_brkpb_z", [IsStreamingCompatible]>;
+
+def SVPFIRST : SInst<"svpfirst[_b]", "PPP", "Pc", MergeNone, "aarch64_sve_pfirst", [IsStreamingCompatible]>;
+def SVPNEXT : SInst<"svpnext_{d}", "PPP", "PcPsPiPl", MergeNone, "aarch64_sve_pnext", [IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// Testing predicates
-def SVPTEST_ANY : SInst<"svptest_any", "sPP", "Pc", MergeNone, "aarch64_sve_ptest_any">;
-def SVPTEST_FIRST : SInst<"svptest_first", "sPP", "Pc", MergeNone, "aarch64_sve_ptest_first">;
-def SVPTEST_LAST : SInst<"svptest_last", "sPP", "Pc", MergeNone, "aarch64_sve_ptest_last">;
+def SVPTEST_ANY : SInst<"svptest_any", "sPP", "Pc", MergeNone, "aarch64_sve_ptest_any", [IsStreamingCompatible]>;
+def SVPTEST_FIRST : SInst<"svptest_first", "sPP", "Pc", MergeNone, "aarch64_sve_ptest_first", [IsStreamingCompatible]>;
+def SVPTEST_LAST : SInst<"svptest_last", "sPP", "Pc", MergeNone, "aarch64_sve_ptest_last", [IsStreamingCompatible]>;
////////////////////////////////////////////////////////////////////////////////
// FFR manipulation
@@ -1158,21 +1158,21 @@ def SVWRFFR : SInst<"svwrffr", "vP", "Pc", MergeNone, "", [IsOverloadNone]>;
////////////////////////////////////////////////////////////////////////////////
// Counting elements
-def SVCNTB_PAT : SInst<"svcntb_pat", "nI", "", MergeNone, "aarch64_sve_cntb", [IsOverloadNone]>;
-def SVCNTH_PAT : SInst<"svcnth_pat", "nI", "", MergeNone, "aarch64_sve_cnth", [IsOverloadNone]>;
-def SVCNTW_PAT : SInst<"svcntw_pat", "nI", "", MergeNone, "aarch64_sve_cntw", [IsOverloadNone]>;
-def SVCNTD_PAT : SInst<"svcntd_pat", "nI", "", MergeNone, "aarch64_sve_cntd", [IsOverloadNone]>;
+def SVCNTB_PAT : SInst<"svcntb_pat", "nI", "", MergeNone, "aarch64_sve_cntb", [IsOverloadNone, IsStreamingCompatible]>;
+def SVCNTH_PAT : SInst<"svcnth_pat", "nI", "", MergeNone, "aarch64_sve_cnth", [IsOverloadNone, IsStreamingCompatible]>;
+def SVCNTW_PAT : SInst<"svcntw_pat", "nI", "", MergeNone, "aarch64_sve_cntw", [IsOverloadNone, IsStreamingCompatible]>;
+def SVCNTD_PAT : SInst<"svcntd_pat", "nI", "", MergeNone, "aarch64_sve_cntd", [IsOverloadNone, IsStreamingCompatible]>;
-def SVCNTB : SInst<"svcntb", "nv", "", MergeNone, "aarch64_sve_cntb", [IsAppendSVALL, IsOverloadNone]>;
-def SVCNTH : SInst<"svcnth", "nv", "", MergeNone, "aarch64_sve_cnth", [IsAppendSVALL, IsOverloadNone]>;
-def SVCNTW : SInst<"svcntw", "nv", "", MergeNone, "aarch64_sve_cntw", [IsAppendSVALL, IsOverloadNone]>;
-def SVCNTD : SInst<"svcntd", "nv", "", MergeNone, "aarch64_sve_cntd", [IsAppendSVALL, IsOverloadNone]>;
+def SVCNTB : SInst<"svcntb", "nv", "", MergeNone, "aarch64_sve_cntb", [IsAppendSVALL, IsOverloadNone, IsStreamingCompatible]>;
+def SVCNTH : SInst<"svcnth", "nv", "", MergeNone, "aarch64_sve_cnth", [IsAppendSVALL, IsOverloadNone, IsStreamingCompatible]>;
+def SVCNTW : SInst<"svcntw", "nv", "", MergeNone, "aarch64_sve_cntw", [IsAppendSVALL, IsOverloadNone, IsStreamingCompatible]>;
+def SVCNTD : SInst<"svcntd", "nv", "", MergeNone, "aarch64_sve_cntd", [IsAppendSVALL, IsOverloadNone, IsStreamingCompatible]>;
-def SVCNTP : SInst<"svcntp_{d}", "nPP", "PcPsPiPl", MergeNone, "aarch64_sve_cntp">;
-def SVLEN : SInst<"svlen[_{d}]", "nd", "csilUcUsUiUlhfd", MergeNone>;
+def SVCNTP : SInst<"svcntp_{d}", "nPP", "PcPsPiPl", MergeNone, "aarch64_sve_cntp", [IsStreamingCompatible]>;
+def SVLEN : SInst<"svlen[_{d}]", "nd", "csilUcUsUiUlhfd", MergeNone, "", [IsStreamingCompatible]>;
let TargetGuard = "sve,bf16" in {
-def SVLEN_BF16 : SInst<"svlen[_{d}]", "nd", "b", MergeNone>;
+def SVLEN_BF16 : SInst<"svlen[_{d}]", "nd", "b", MergeNone, "", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1189,20 +1189,20 @@ def UnsignedWord : sat_type<"U", "Ui">;
def UnsignedDoubleWord : sat_type<"U", "Ul">;
multiclass SInst_SAT1<string name, string intrinsic, sat_type type> {
- def _N32 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone], [ImmCheck<2, ImmCheck1_16>]>;
- def _N64 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone], [ImmCheck<2, ImmCheck1_16>]>;
- def _N32_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone, IsInsertOp1SVALL], [ImmCheck<1, ImmCheck1_16>]>;
- def _N64_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone, IsInsertOp1SVALL], [ImmCheck<1, ImmCheck1_16>]>;
+ def _N32 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<2, ImmCheck1_16>]>;
+ def _N64 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<2, ImmCheck1_16>]>;
+ def _N32_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone, IsInsertOp1SVALL, IsStreamingCompatible], [ImmCheck<1, ImmCheck1_16>]>;
+ def _N64_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone, IsInsertOp1SVALL, IsStreamingCompatible], [ImmCheck<1, ImmCheck1_16>]>;
}
multiclass SInst_SAT2<string name, string intrinsic, sat_type type> {
- def "" : SInst<name # "_pat[_{d}]", "ddIi", type.T, MergeNone, intrinsic, [], [ImmCheck<2, ImmCheck1_16>]>;
- def _ALL : SInst<name # "[_{d}]", "ddi", type.T, MergeNone, intrinsic, [IsInsertOp1SVALL], [ImmCheck<1, ImmCheck1_16>]>;
+ def "" : SInst<name # "_pat[_{d}]", "ddIi", type.T, MergeNone, intrinsic, [IsStreamingCompatible], [ImmCheck<2, ImmCheck1_16>]>;
+ def _ALL : SInst<name # "[_{d}]", "ddi", type.T, MergeNone, intrinsic, [IsInsertOp1SVALL, IsStreamingCompatible], [ImmCheck<1, ImmCheck1_16>]>;
- def _N32 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone], [ImmCheck<2, ImmCheck1_16>]>;
- def _N64 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone], [ImmCheck<2, ImmCheck1_16>]>;
- def _N32_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone, IsInsertOp1SVALL], [ImmCheck<1, ImmCheck1_16>]>;
- def _N64_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone, IsInsertOp1SVALL], [ImmCheck<1, ImmCheck1_16>]>;
+ def _N32 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<2, ImmCheck1_16>]>;
+ def _N64 : SInst<name # "_pat[_n_{d}]", "ssIi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<2, ImmCheck1_16>]>;
+ def _N32_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "i", MergeNone, intrinsic # "_n32", [IsOverloadNone, IsInsertOp1SVALL, IsStreamingCompatible], [ImmCheck<1, ImmCheck1_16>]>;
+ def _N64_ALL : SInst<name # "[_n_{d}]", "ssi", type.U # "l", MergeNone, intrinsic # "_n64", [IsOverloadNone, IsInsertOp1SVALL, IsStreamingCompatible], [ImmCheck<1, ImmCheck1_16>]>;
}
defm SVQDECB_S : SInst_SAT1<"svqdecb", "aarch64_sve_sqdecb", SignedByte>;
@@ -1223,32 +1223,32 @@ defm SVQINCW_U : SInst_SAT2<"svqincw", "aarch64_sve_uqincw", UnsignedWord>;
defm SVQINCD_S : SInst_SAT2<"svqincd", "aarch64_sve_sqincd", SignedDoubleWord>;
defm SVQINCD_U : SInst_SAT2<"svqincd", "aarch64_sve_uqincd", UnsignedDoubleWord>;
-def SVQDECP_S : SInst<"svqdecp[_{d}]", "ddP", "sil", MergeNone, "aarch64_sve_sqdecp">;
-def SVQDECP_U : SInst<"svqdecp[_{d}]", "ddP", "UsUiUl", MergeNone, "aarch64_sve_uqdecp">;
-def SVQINCP_S : SInst<"svqincp[_{d}]", "ddP", "sil", MergeNone, "aarch64_sve_sqincp">;
-def SVQINCP_U : SInst<"svqincp[_{d}]", "ddP", "UsUiUl", MergeNone, "aarch64_sve_uqincp">;
+def SVQDECP_S : SInst<"svqdecp[_{d}]", "ddP", "sil", MergeNone, "aarch64_sve_sqdecp", [IsStreamingCompatible]>;
+def SVQDECP_U : SInst<"svqdecp[_{d}]", "ddP", "UsUiUl", MergeNone, "aarch64_sve_uqdecp", [IsStreamingCompatible]>;
+def SVQINCP_S : SInst<"svqincp[_{d}]", "ddP", "sil", MergeNone, "aarch64_sve_sqincp", [IsStreamingCompatible]>;
+def SVQINCP_U : SInst<"svqincp[_{d}]", "ddP", "UsUiUl", MergeNone, "aarch64_sve_uqincp", [IsStreamingCompatible]>;
-def SVQDECP_N_S32 : SInst<"svqdecp[_n_s32]_{d}", "kkP", "PcPsPiPl", MergeNone, "aarch64_sve_sqdecp_n32">;
-def SVQDECP_N_S64 : SInst<"svqdecp[_n_s64]_{d}", "llP", "PcPsPiPl", MergeNone, "aarch64_sve_sqdecp_n64">;
-def SVQDECP_N_U32 : SInst<"svqdecp[_n_u32]_{d}", "mmP", "PcPsPiPl", MergeNone, "aarch64_sve_uqdecp_n32">;
-def SVQDECP_N_U64 : SInst<"svqdecp[_n_u64]_{d}", "nnP", "PcPsPiPl", MergeNone, "aarch64_sve_uqdecp_n64">;
-def SVQINCP_N_S32 : SInst<"svqincp[_n_s32]_{d}", "kkP", "PcPsPiPl", MergeNone, "aarch64_sve_sqincp_n32">;
-def SVQINCP_N_S64 : SInst<"svqincp[_n_s64]_{d}", "llP", "PcPsPiPl", MergeNone, "aarch64_sve_sqincp_n64">;
-def SVQINCP_N_U32 : SInst<"svqincp[_n_u32]_{d}", "mmP", "PcPsPiPl", MergeNone, "aarch64_sve_uqincp_n32">;
-def SVQINCP_N_U64 : SInst<"svqincp[_n_u64]_{d}", "nnP", "PcPsPiPl", MergeNone, "aarch64_sve_uqincp_n64">;
+def SVQDECP_N_S32 : SInst<"svqdecp[_n_s32]_{d}", "kkP", "PcPsPiPl", MergeNone, "aarch64_sve_sqdecp_n32", [IsStreamingCompatible]>;
+def SVQDECP_N_S64 : SInst<"svqdecp[_n_s64]_{d}", "llP", "PcPsPiPl", MergeNone, "aarch64_sve_sqdecp_n64", [IsStreamingCompatible]>;
+def SVQDECP_N_U32 : SInst<"svqdecp[_n_u32]_{d}", "mmP", "PcPsPiPl", MergeNone, "aarch64_sve_uqdecp_n32", [IsStreamingCompatible]>;
+def SVQDECP_N_U64 : SInst<"svqdecp[_n_u64]_{d}", "nnP", "PcPsPiPl", MergeNone, "aarch64_sve_uqdecp_n64", [IsStreamingCompatible]>;
+def SVQINCP_N_S32 : SInst<"svqincp[_n_s32]_{d}", "kkP", "PcPsPiPl", MergeNone, "aarch64_sve_sqincp_n32", [IsStreamingCompatible]>;
+def SVQINCP_N_S64 : SInst<"svqincp[_n_s64]_{d}", "llP", "PcPsPiPl", MergeNone, "aarch64_sve_sqincp_n64", [IsStreamingCompatible]>;
+def SVQINCP_N_U32 : SInst<"svqincp[_n_u32]_{d}", "mmP", "PcPsPiPl", MergeNone, "aarch64_sve_uqincp_n32", [IsStreamingCompatible]>;
+def SVQINCP_N_U64 : SInst<"svqincp[_n_u64]_{d}", "nnP", "PcPsPiPl", MergeNone, "aarch64_sve_uqincp_n64", [IsStreamingCompatible]>;
let TargetGuard = "sve,i8mm" in {
def SVMLLA_S32 : SInst<"svmmla[_s32]", "ddqq","i", MergeNone, "aarch64_sve_smmla">;
def SVMLLA_U32 : SInst<"svmmla[_u32]", "ddqq","Ui", MergeNone, "aarch64_sve_ummla">;
def SVUSMLLA_S32 : SInst<"svusmmla[_s32]", "ddbq","i", MergeNone, "aarch64_sve_usmmla">;
-def SVUSDOT_S : SInst<"svusdot[_s32]", "ddbq", "i", MergeNone, "aarch64_sve_usdot">;
-def SVUSDOT_N_S : SInst<"svusdot[_n_s32]", "ddbr", "i", MergeNone, "aarch64_sve_usdot">;
-def SVSUDOT_S : SInst<"svsudot[_s32]", "ddqb", "i", MergeNone, "aarch64_sve_usdot", [ReverseUSDOT]>;
-def SVSUDOT_N_S : SInst<"svsudot[_n_s32]", "ddq@", "i", MergeNone, "aarch64_sve_usdot", [ReverseUSDOT]>;
+def SVUSDOT_S : SInst<"svusdot[_s32]", "ddbq", "i", MergeNone, "aarch64_sve_usdot", [IsStreamingCompatible]>;
+def SVUSDOT_N_S : SInst<"svusdot[_n_s32]", "ddbr", "i", MergeNone, "aarch64_sve_usdot", [IsStreamingCompatible]>;
+def SVSUDOT_S : SInst<"svsudot[_s32]", "ddqb", "i", MergeNone, "aarch64_sve_usdot", [ReverseUSDOT, IsStreamingCompatible]>;
+def SVSUDOT_N_S : SInst<"svsudot[_n_s32]", "ddq@", "i", MergeNone, "aarch64_sve_usdot", [ReverseUSDOT, IsStreamingCompatible]>;
-def SVUSDOT_LANE_S : SInst<"svusdot_lane[_s32]", "ddbqi", "i", MergeNone, "aarch64_sve_usdot_lane", [], [ImmCheck<3, ImmCheckLaneIndexDot, 2>]>;
-def SVSUDOT_LANE_S : SInst<"svsudot_lane[_s32]", "ddqbi", "i", MergeNone, "aarch64_sve_sudot_lane", [], [ImmCheck<3, ImmCheckLaneIndexDot, 2>]>;
+def SVUSDOT_LANE_S : SInst<"svusdot_lane[_s32]", "ddbqi", "i", MergeNone, "aarch64_sve_usdot_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndexDot, 2>]>;
+def SVSUDOT_LANE_S : SInst<"svsudot_lane[_s32]", "ddqbi", "i", MergeNone, "aarch64_sve_sudot_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndexDot, 2>]>;
}
let TargetGuard = "sve,f32mm" in {
@@ -1257,12 +1257,12 @@ def SVMLLA_F32 : SInst<"svmmla[_f32]", "dddd","f", MergeNone, "aarch64_sve_fmmla
let TargetGuard = "sve,f64mm" in {
def SVMLLA_F64 : SInst<"svmmla[_f64]", "dddd","d", MergeNone, "aarch64_sve_fmmla">;
-def SVTRN1Q : SInst<"svtrn1q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn1q">;
-def SVTRN2Q : SInst<"svtrn2q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn2q">;
-def SVUZP1Q : SInst<"svuzp1q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp1q">;
-def SVUZP2Q : SInst<"svuzp2q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp2q">;
-def SVZIP1Q : SInst<"svzip1q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip1q">;
-def SVZIP2Q : SInst<"svzip2q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip2q">;
+def SVTRN1Q : SInst<"svtrn1q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn1q", [IsStreamingCompatible]>;
+def SVTRN2Q : SInst<"svtrn2q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_trn2q", [IsStreamingCompatible]>;
+def SVUZP1Q : SInst<"svuzp1q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp1q", [IsStreamingCompatible]>;
+def SVUZP2Q : SInst<"svuzp2q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_uzp2q", [IsStreamingCompatible]>;
+def SVZIP1Q : SInst<"svzip1q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip1q", [IsStreamingCompatible]>;
+def SVZIP2Q : SInst<"svzip2q[_{d}]", "ddd", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_zip2q", [IsStreamingCompatible]>;
}
let TargetGuard = "sve,bf16,f64mm" in {
@@ -1276,20 +1276,20 @@ def SVZIP2Q_BF16 : SInst<"svzip2q[_{d}]", "ddd", "b", MergeNone, "aarc
////////////////////////////////////////////////////////////////////////////////
// Vector creation
-def SVUNDEF_1 : SInst<"svundef_{d}", "dv", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef]>;
-def SVUNDEF_2 : SInst<"svundef2_{d}", "2v", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef]>;
-def SVUNDEF_3 : SInst<"svundef3_{d}", "3v", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef]>;
-def SVUNDEF_4 : SInst<"svundef4_{d}", "4v", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef]>;
+def SVUNDEF_1 : SInst<"svundef_{d}", "dv", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
+def SVUNDEF_2 : SInst<"svundef2_{d}", "2v", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
+def SVUNDEF_3 : SInst<"svundef3_{d}", "3v", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
+def SVUNDEF_4 : SInst<"svundef4_{d}", "4v", "csilUcUsUiUlhfd", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
def SVCREATE_2 : SInst<"svcreate2[_{d}]", "2dd", "csilUcUsUiUlhfd", MergeNone, "", [IsTupleCreate]>;
def SVCREATE_3 : SInst<"svcreate3[_{d}]", "3ddd", "csilUcUsUiUlhfd", MergeNone, "", [IsTupleCreate]>;
def SVCREATE_4 : SInst<"svcreate4[_{d}]", "4dddd", "csilUcUsUiUlhfd", MergeNone, "", [IsTupleCreate]>;
let TargetGuard = "sve,bf16" in {
-def SVUNDEF_1_BF16 : SInst<"svundef_{d}", "dv", "b", MergeNone, "", [IsUndef]>;
-def SVUNDEF_2_BF16 : SInst<"svundef2_{d}", "2v", "b", MergeNone, "", [IsUndef]>;
-def SVUNDEF_3_BF16 : SInst<"svundef3_{d}", "3v", "b", MergeNone, "", [IsUndef]>;
-def SVUNDEF_4_BF16 : SInst<"svundef4_{d}", "4v", "b", MergeNone, "", [IsUndef]>;
+def SVUNDEF_1_BF16 : SInst<"svundef_{d}", "dv", "b", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
+def SVUNDEF_2_BF16 : SInst<"svundef2_{d}", "2v", "b", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
+def SVUNDEF_3_BF16 : SInst<"svundef3_{d}", "3v", "b", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
+def SVUNDEF_4_BF16 : SInst<"svundef4_{d}", "4v", "b", MergeNone, "", [IsUndef, IsStreamingCompatible]>;
def SVCREATE_2_BF16 : SInst<"svcreate2[_{d}]", "2dd", "b", MergeNone, "", [IsTupleCreate]>;
def SVCREATE_3_BF16 : SInst<"svcreate3[_{d}]", "3ddd", "b", MergeNone, "", [IsTupleCreate]>;
@@ -1331,14 +1331,26 @@ let TargetGuard = "sve2p1" in {
////////////////////////////////////////////////////////////////////////////////
// SVE2 WhileGE/GT
let TargetGuard = "sve2" in {
-def SVWHILEGE_S32 : SInst<"svwhilege_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilege", [IsOverloadWhile]>;
-def SVWHILEGE_S64 : SInst<"svwhilege_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilege", [IsOverloadWhile]>;
-def SVWHILEGT_S32 : SInst<"svwhilegt_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilegt", [IsOverloadWhile]>;
-def SVWHILEGT_S64 : SInst<"svwhilegt_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilegt", [IsOverloadWhile]>;
-def SVWHILEHI_U32 : SInst<"svwhilegt_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehi", [IsOverloadWhile]>;
-def SVWHILEHI_U64 : SInst<"svwhilegt_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehi", [IsOverloadWhile]>;
-def SVWHILEHS_U32 : SInst<"svwhilege_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehs", [IsOverloadWhile]>;
-def SVWHILEHS_U64 : SInst<"svwhilege_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehs", [IsOverloadWhile]>;
+def SVWHILEGE_S32 : SInst<"svwhilege_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilege", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILEGE_S64 : SInst<"svwhilege_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilege", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILEGT_S32 : SInst<"svwhilegt_{d}[_{1}]", "Pkk", "PcPsPiPl", MergeNone, "aarch64_sve_whilegt", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILEGT_S64 : SInst<"svwhilegt_{d}[_{1}]", "Pll", "PcPsPiPl", MergeNone, "aarch64_sve_whilegt", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILEHI_U32 : SInst<"svwhilegt_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehi", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILEHI_U64 : SInst<"svwhilegt_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehi", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILEHS_U32 : SInst<"svwhilege_{d}[_{1}]", "Pmm", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehs", [IsOverloadWhile, IsStreamingCompatible]>;
+def SVWHILEHS_U64 : SInst<"svwhilege_{d}[_{1}]", "Pnn", "PUcPUsPUiPUl", MergeNone, "aarch64_sve_whilehs", [IsOverloadWhile, IsStreamingCompatible]>;
+}
+
+let TargetGuard = "sve2p1|sme2" in {
+ def SVWHILEGE_S64_X2 : SInst<"svwhilege_{d}[_{1}]_x2", "2ll", "PcPsPiPl", MergeNone, "aarch64_sve_whilege_x2">;
+ def SVWHILEGT_S64_X2 : SInst<"svwhilegt_{d}[_{1}]_x2", "2ll", "PcPsPiPl", MergeNone, "aarch64_sve_whilegt_x2">;
+ def SVWHILEHI_U64_X2 : SInst<"svwhilegt_{d}[_{1}]_x2", "2nn", "PcPsPiPl", MergeNone, "aarch64_sve_whilehi_x2">;
+ def SVWHILEHS_U64_X2 : SInst<"svwhilege_{d}[_{1}]_x2", "2nn", "PcPsPiPl", MergeNone, "aarch64_sve_whilehs_x2">;
+ def SVWHILELE_S64_X2 : SInst<"svwhilele_{d}[_{1}]_x2", "2ll", "PcPsPiPl", MergeNone, "aarch64_sve_whilele_x2">;
+ def SVWHILELT_S64_X2 : SInst<"svwhilelt_{d}[_{1}]_x2", "2ll", "PcPsPiPl", MergeNone, "aarch64_sve_whilelt_x2">;
+ def SVWHILELO_U64_X2 : SInst<"svwhilelt_{d}[_{1}]_x2", "2nn", "PcPsPiPl", MergeNone, "aarch64_sve_whilelo_x2">;
+ def SVWHILELS_U64_X2 : SInst<"svwhilele_{d}[_{1}]_x2", "2nn", "PcPsPiPl", MergeNone, "aarch64_sve_whilels_x2">;
+
}
////////////////////////////////////////////////////////////////////////////////
@@ -1380,49 +1392,49 @@ multiclass SInstZPZxZ<string name, string types, string pat_v, string pat_n, str
}
let TargetGuard = "sve2" in {
-defm SVQRSHL_S : SInstZPZxZ<"svqrshl", "csil", "dPdx", "dPdK", "aarch64_sve_sqrshl">;
-defm SVQRSHL_U : SInstZPZxZ<"svqrshl", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_uqrshl">;
-defm SVQSHL_S : SInstZPZxZ<"svqshl", "csil", "dPdx", "dPdK", "aarch64_sve_sqshl">;
-defm SVQSHL_U : SInstZPZxZ<"svqshl", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_uqshl">;
-defm SVRSHL_S : SInstZPZxZ<"svrshl", "csil", "dPdx", "dPdK", "aarch64_sve_srshl">;
-defm SVRSHL_U : SInstZPZxZ<"svrshl", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_urshl">;
-defm SVSQADD : SInstZPZxZ<"svsqadd", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_usqadd">;
-defm SVUQADD : SInstZPZxZ<"svuqadd", "csil", "dPdu", "dPdL", "aarch64_sve_suqadd">;
-
-def SVABA_S : SInst<"svaba[_{d}]", "dddd", "csil" , MergeNone, "aarch64_sve_saba">;
-def SVABA_U : SInst<"svaba[_{d}]", "dddd", "UcUsUiUl", MergeNone, "aarch64_sve_uaba">;
-def SVQDMULH : SInst<"svqdmulh[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqdmulh">;
-def SVQRDMULH : SInst<"svqrdmulh[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqrdmulh">;
-def SVQRDMLAH : SInst<"svqrdmlah[_{d}]", "dddd", "csil", MergeNone, "aarch64_sve_sqrdmlah">;
-def SVQRDMLSH : SInst<"svqrdmlsh[_{d}]", "dddd", "csil", MergeNone, "aarch64_sve_sqrdmlsh">;
-
-def SVABA_S_N : SInst<"svaba[_n_{d}]", "ddda", "csil", MergeNone, "aarch64_sve_saba">;
-def SVABA_U_N : SInst<"svaba[_n_{d}]", "ddda", "UcUsUiUl", MergeNone, "aarch64_sve_uaba">;
-def SVQDMULH_N : SInst<"svqdmulh[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqdmulh">;
-def SVQRDMULH_N : SInst<"svqrdmulh[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqrdmulh">;
-def SVQRDMLAH_N : SInst<"svqrdmlah[_n_{d}]", "ddda", "csil", MergeNone, "aarch64_sve_sqrdmlah">;
-def SVQRDMLSH_N : SInst<"svqrdmlsh[_n_{d}]", "ddda", "csil", MergeNone, "aarch64_sve_sqrdmlsh">;
-
-def SVQDMULH_LANE : SInst<"svqdmulh_lane[_{d}]", "dddi", "sil", MergeNone, "aarch64_sve_sqdmulh_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVQRDMULH_LANE : SInst<"svqrdmulh_lane[_{d}]", "dddi", "sil", MergeNone, "aarch64_sve_sqrdmulh_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVQRDMLAH_LANE : SInst<"svqrdmlah_lane[_{d}]", "ddddi", "sil", MergeNone, "aarch64_sve_sqrdmlah_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVQRDMLSH_LANE : SInst<"svqrdmlsh_lane[_{d}]", "ddddi", "sil", MergeNone, "aarch64_sve_sqrdmlsh_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-
-def SVQSHLU_M : SInst<"svqshlu[_n_{d}]", "uPdi", "csil", MergeOp1, "aarch64_sve_sqshlu", [], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
-def SVQSHLU_X : SInst<"svqshlu[_n_{d}]", "uPdi", "csil", MergeAny, "aarch64_sve_sqshlu", [], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
-def SVQSHLU_Z : SInst<"svqshlu[_n_{d}]", "uPdi", "csil", MergeZero, "aarch64_sve_sqshlu", [], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
-def SVRSHR_M_S : SInst<"svrshr[_n_{d}]", "dPdi", "csil", MergeOp1, "aarch64_sve_srshr", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVRSHR_M_U : SInst<"svrshr[_n_{d}]", "dPdi", "UcUsUiUl", MergeOp1, "aarch64_sve_urshr", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVRSHR_X_S : SInst<"svrshr[_n_{d}]", "dPdi", "csil", MergeAny, "aarch64_sve_srshr", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVRSHR_X_U : SInst<"svrshr[_n_{d}]", "dPdi", "UcUsUiUl", MergeAny, "aarch64_sve_urshr", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVRSHR_Z_S : SInst<"svrshr[_n_{d}]", "dPdi", "csil", MergeZero, "aarch64_sve_srshr", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVRSHR_Z_U : SInst<"svrshr[_n_{d}]", "dPdi", "UcUsUiUl", MergeZero, "aarch64_sve_urshr", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVRSRA_S : SInst<"svrsra[_n_{d}]", "dddi", "csil", MergeNone, "aarch64_sve_srsra", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVRSRA_U : SInst<"svrsra[_n_{d}]", "dddi", "UcUsUiUl", MergeNone, "aarch64_sve_ursra", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVSLI : SInst<"svsli[_n_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_sli", [], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
-def SVSRA_S : SInst<"svsra[_n_{d}]", "dddi", "csil", MergeNone, "aarch64_sve_ssra", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVSRA_U : SInst<"svsra[_n_{d}]", "dddi", "UcUsUiUl", MergeNone, "aarch64_sve_usra", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
-def SVSRI : SInst<"svsri[_n_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_sri", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+defm SVQRSHL_S : SInstZPZxZ<"svqrshl", "csil", "dPdx", "dPdK", "aarch64_sve_sqrshl", [IsStreamingCompatible]>;
+defm SVQRSHL_U : SInstZPZxZ<"svqrshl", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_uqrshl", [IsStreamingCompatible]>;
+defm SVQSHL_S : SInstZPZxZ<"svqshl", "csil", "dPdx", "dPdK", "aarch64_sve_sqshl", [IsStreamingCompatible]>;
+defm SVQSHL_U : SInstZPZxZ<"svqshl", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_uqshl", [IsStreamingCompatible]>;
+defm SVRSHL_S : SInstZPZxZ<"svrshl", "csil", "dPdx", "dPdK", "aarch64_sve_srshl", [IsStreamingCompatible]>;
+defm SVRSHL_U : SInstZPZxZ<"svrshl", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_urshl", [IsStreamingCompatible]>;
+defm SVSQADD : SInstZPZxZ<"svsqadd", "UcUsUiUl", "dPdx", "dPdK", "aarch64_sve_usqadd", [IsStreamingCompatible]>;
+defm SVUQADD : SInstZPZxZ<"svuqadd", "csil", "dPdu", "dPdL", "aarch64_sve_suqadd", [IsStreamingCompatible]>;
+
+def SVABA_S : SInst<"svaba[_{d}]", "dddd", "csil" , MergeNone, "aarch64_sve_saba", [IsStreamingCompatible]>;
+def SVABA_U : SInst<"svaba[_{d}]", "dddd", "UcUsUiUl", MergeNone, "aarch64_sve_uaba", [IsStreamingCompatible]>;
+def SVQDMULH : SInst<"svqdmulh[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqdmulh", [IsStreamingCompatible]>;
+def SVQRDMULH : SInst<"svqrdmulh[_{d}]", "ddd", "csil", MergeNone, "aarch64_sve_sqrdmulh", [IsStreamingCompatible]>;
+def SVQRDMLAH : SInst<"svqrdmlah[_{d}]", "dddd", "csil", MergeNone, "aarch64_sve_sqrdmlah", [IsStreamingCompatible]>;
+def SVQRDMLSH : SInst<"svqrdmlsh[_{d}]", "dddd", "csil", MergeNone, "aarch64_sve_sqrdmlsh", [IsStreamingCompatible]>;
+
+def SVABA_S_N : SInst<"svaba[_n_{d}]", "ddda", "csil", MergeNone, "aarch64_sve_saba", [IsStreamingCompatible]>;
+def SVABA_U_N : SInst<"svaba[_n_{d}]", "ddda", "UcUsUiUl", MergeNone, "aarch64_sve_uaba", [IsStreamingCompatible]>;
+def SVQDMULH_N : SInst<"svqdmulh[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqdmulh", [IsStreamingCompatible]>;
+def SVQRDMULH_N : SInst<"svqrdmulh[_n_{d}]", "dda", "csil", MergeNone, "aarch64_sve_sqrdmulh", [IsStreamingCompatible]>;
+def SVQRDMLAH_N : SInst<"svqrdmlah[_n_{d}]", "ddda", "csil", MergeNone, "aarch64_sve_sqrdmlah", [IsStreamingCompatible]>;
+def SVQRDMLSH_N : SInst<"svqrdmlsh[_n_{d}]", "ddda", "csil", MergeNone, "aarch64_sve_sqrdmlsh", [IsStreamingCompatible]>;
+
+def SVQDMULH_LANE : SInst<"svqdmulh_lane[_{d}]", "dddi", "sil", MergeNone, "aarch64_sve_sqdmulh_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVQRDMULH_LANE : SInst<"svqrdmulh_lane[_{d}]", "dddi", "sil", MergeNone, "aarch64_sve_sqrdmulh_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVQRDMLAH_LANE : SInst<"svqrdmlah_lane[_{d}]", "ddddi", "sil", MergeNone, "aarch64_sve_sqrdmlah_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVQRDMLSH_LANE : SInst<"svqrdmlsh_lane[_{d}]", "ddddi", "sil", MergeNone, "aarch64_sve_sqrdmlsh_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+
+def SVQSHLU_M : SInst<"svqshlu[_n_{d}]", "uPdi", "csil", MergeOp1, "aarch64_sve_sqshlu", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
+def SVQSHLU_X : SInst<"svqshlu[_n_{d}]", "uPdi", "csil", MergeAny, "aarch64_sve_sqshlu", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
+def SVQSHLU_Z : SInst<"svqshlu[_n_{d}]", "uPdi", "csil", MergeZero, "aarch64_sve_sqshlu", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
+def SVRSHR_M_S : SInst<"svrshr[_n_{d}]", "dPdi", "csil", MergeOp1, "aarch64_sve_srshr", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVRSHR_M_U : SInst<"svrshr[_n_{d}]", "dPdi", "UcUsUiUl", MergeOp1, "aarch64_sve_urshr", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVRSHR_X_S : SInst<"svrshr[_n_{d}]", "dPdi", "csil", MergeAny, "aarch64_sve_srshr", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVRSHR_X_U : SInst<"svrshr[_n_{d}]", "dPdi", "UcUsUiUl", MergeAny, "aarch64_sve_urshr", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVRSHR_Z_S : SInst<"svrshr[_n_{d}]", "dPdi", "csil", MergeZero, "aarch64_sve_srshr", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVRSHR_Z_U : SInst<"svrshr[_n_{d}]", "dPdi", "UcUsUiUl", MergeZero, "aarch64_sve_urshr", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVRSRA_S : SInst<"svrsra[_n_{d}]", "dddi", "csil", MergeNone, "aarch64_sve_srsra", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVRSRA_U : SInst<"svrsra[_n_{d}]", "dddi", "UcUsUiUl", MergeNone, "aarch64_sve_ursra", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVSLI : SInst<"svsli[_n_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_sli", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftLeft, 1>]>;
+def SVSRA_S : SInst<"svsra[_n_{d}]", "dddi", "csil", MergeNone, "aarch64_sve_ssra", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVSRA_U : SInst<"svsra[_n_{d}]", "dddi", "UcUsUiUl", MergeNone, "aarch64_sve_usra", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVSRI : SInst<"svsri[_n_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_sri", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1434,29 +1446,29 @@ multiclass SInstPairwise<string name, string types, string intrinsic, list<FlagT
}
let TargetGuard = "sve2" in {
-defm SVADDP : SInstPairwise<"svaddp", "csliUcUsUiUl", "aarch64_sve_addp">;
-defm SVADDP_F : SInstPairwise<"svaddp", "hfd", "aarch64_sve_faddp">;
-defm SVMAXNMP : SInstPairwise<"svmaxnmp", "hfd", "aarch64_sve_fmaxnmp">;
-defm SVMAXP_F : SInstPairwise<"svmaxp", "hfd", "aarch64_sve_fmaxp">;
-defm SVMAXP_S : SInstPairwise<"svmaxp", "csli", "aarch64_sve_smaxp">;
-defm SVMAXP_U : SInstPairwise<"svmaxp", "UcUsUiUl", "aarch64_sve_umaxp">;
-defm SVMINNMP : SInstPairwise<"svminnmp", "hfd", "aarch64_sve_fminnmp">;
-defm SVMINP_F : SInstPairwise<"svminp", "hfd", "aarch64_sve_fminp">;
-defm SVMINP_S : SInstPairwise<"svminp", "csli", "aarch64_sve_sminp">;
-defm SVMINP_U : SInstPairwise<"svminp", "UcUsUiUl", "aarch64_sve_uminp">;
+defm SVADDP : SInstPairwise<"svaddp", "csliUcUsUiUl", "aarch64_sve_addp", [IsStreamingCompatible]>;
+defm SVADDP_F : SInstPairwise<"svaddp", "hfd", "aarch64_sve_faddp", [IsStreamingCompatible]>;
+defm SVMAXNMP : SInstPairwise<"svmaxnmp", "hfd", "aarch64_sve_fmaxnmp", [IsStreamingCompatible]>;
+defm SVMAXP_F : SInstPairwise<"svmaxp", "hfd", "aarch64_sve_fmaxp", [IsStreamingCompatible]>;
+defm SVMAXP_S : SInstPairwise<"svmaxp", "csli", "aarch64_sve_smaxp", [IsStreamingCompatible]>;
+defm SVMAXP_U : SInstPairwise<"svmaxp", "UcUsUiUl", "aarch64_sve_umaxp", [IsStreamingCompatible]>;
+defm SVMINNMP : SInstPairwise<"svminnmp", "hfd", "aarch64_sve_fminnmp", [IsStreamingCompatible]>;
+defm SVMINP_F : SInstPairwise<"svminp", "hfd", "aarch64_sve_fminp", [IsStreamingCompatible]>;
+defm SVMINP_S : SInstPairwise<"svminp", "csli", "aarch64_sve_sminp", [IsStreamingCompatible]>;
+defm SVMINP_U : SInstPairwise<"svminp", "UcUsUiUl", "aarch64_sve_uminp", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Widening pairwise arithmetic
let TargetGuard = "sve2" in {
-def SVADALP_S_M : SInst<"svadalp[_{d}]", "dPdh", "sil", MergeOp1, "aarch64_sve_sadalp">;
-def SVADALP_S_X : SInst<"svadalp[_{d}]", "dPdh", "sil", MergeAny, "aarch64_sve_sadalp">;
-def SVADALP_S_Z : SInst<"svadalp[_{d}]", "dPdh", "sil", MergeZero, "aarch64_sve_sadalp">;
+def SVADALP_S_M : SInst<"svadalp[_{d}]", "dPdh", "sil", MergeOp1, "aarch64_sve_sadalp", [IsStreamingCompatible]>;
+def SVADALP_S_X : SInst<"svadalp[_{d}]", "dPdh", "sil", MergeAny, "aarch64_sve_sadalp", [IsStreamingCompatible]>;
+def SVADALP_S_Z : SInst<"svadalp[_{d}]", "dPdh", "sil", MergeZero, "aarch64_sve_sadalp", [IsStreamingCompatible]>;
-def SVADALP_U_M : SInst<"svadalp[_{d}]", "dPdh", "UsUiUl", MergeOp1, "aarch64_sve_uadalp">;
-def SVADALP_U_X : SInst<"svadalp[_{d}]", "dPdh", "UsUiUl", MergeAny, "aarch64_sve_uadalp">;
-def SVADALP_U_Z : SInst<"svadalp[_{d}]", "dPdh", "UsUiUl", MergeZero, "aarch64_sve_uadalp">;
+def SVADALP_U_M : SInst<"svadalp[_{d}]", "dPdh", "UsUiUl", MergeOp1, "aarch64_sve_uadalp", [IsStreamingCompatible]>;
+def SVADALP_U_X : SInst<"svadalp[_{d}]", "dPdh", "UsUiUl", MergeAny, "aarch64_sve_uadalp", [IsStreamingCompatible]>;
+def SVADALP_U_Z : SInst<"svadalp[_{d}]", "dPdh", "UsUiUl", MergeZero, "aarch64_sve_uadalp", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1464,56 +1476,56 @@ def SVADALP_U_Z : SInst<"svadalp[_{d}]", "dPdh", "UsUiUl", MergeZero, "aarch64_s
//
let TargetGuard = "sve2" in {
-def SVBCAX : SInst<"svbcax[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bcax">;
-def SVBSL : SInst<"svbsl[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl">;
-def SVBSL1N : SInst<"svbsl1n[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl1n">;
-def SVBSL2N : SInst<"svbsl2n[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl2n">;
-def SVEOR3 : SInst<"sveor3[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eor3">;
-def SVNBSL : SInst<"svnbsl[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_nbsl">;
-
-def SVBCAX_N : SInst<"svbcax[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bcax">;
-def SVBSL_N : SInst<"svbsl[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl">;
-def SVBSL1N_N : SInst<"svbsl1n[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl1n">;
-def SVBSL2N_N : SInst<"svbsl2n[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl2n">;
-def SVEOR3_N : SInst<"sveor3[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_eor3">;
-def SVNBSL_N : SInst<"svnbsl[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_nbsl">;
-def SVXAR_N : SInst<"svxar[_n_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_xar", [], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
+def SVBCAX : SInst<"svbcax[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bcax", [IsStreamingCompatible]>;
+def SVBSL : SInst<"svbsl[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl", [IsStreamingCompatible]>;
+def SVBSL1N : SInst<"svbsl1n[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl1n", [IsStreamingCompatible]>;
+def SVBSL2N : SInst<"svbsl2n[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl2n", [IsStreamingCompatible]>;
+def SVEOR3 : SInst<"sveor3[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eor3", [IsStreamingCompatible]>;
+def SVNBSL : SInst<"svnbsl[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_nbsl", [IsStreamingCompatible]>;
+
+def SVBCAX_N : SInst<"svbcax[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bcax", [IsStreamingCompatible]>;
+def SVBSL_N : SInst<"svbsl[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl", [IsStreamingCompatible]>;
+def SVBSL1N_N : SInst<"svbsl1n[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl1n", [IsStreamingCompatible]>;
+def SVBSL2N_N : SInst<"svbsl2n[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_bsl2n", [IsStreamingCompatible]>;
+def SVEOR3_N : SInst<"sveor3[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_eor3", [IsStreamingCompatible]>;
+def SVNBSL_N : SInst<"svnbsl[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_nbsl", [IsStreamingCompatible]>;
+def SVXAR_N : SInst<"svxar[_n_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_xar", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRight, 1>]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Large integer arithmetic
let TargetGuard = "sve2" in {
-def SVADCLB : SInst<"svadclb[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_adclb">;
-def SVADCLT : SInst<"svadclt[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_adclt">;
-def SVSBCLB : SInst<"svsbclb[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_sbclb">;
-def SVSBCLT : SInst<"svsbclt[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_sbclt">;
+def SVADCLB : SInst<"svadclb[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_adclb", [IsStreamingCompatible]>;
+def SVADCLT : SInst<"svadclt[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_adclt", [IsStreamingCompatible]>;
+def SVSBCLB : SInst<"svsbclb[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_sbclb", [IsStreamingCompatible]>;
+def SVSBCLT : SInst<"svsbclt[_{d}]", "dddd", "UiUl", MergeNone, "aarch64_sve_sbclt", [IsStreamingCompatible]>;
-def SVADCLB_N : SInst<"svadclb[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_adclb">;
-def SVADCLT_N : SInst<"svadclt[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_adclt">;
-def SVSBCLB_N : SInst<"svsbclb[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_sbclb">;
-def SVSBCLT_N : SInst<"svsbclt[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_sbclt">;
+def SVADCLB_N : SInst<"svadclb[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_adclb", [IsStreamingCompatible]>;
+def SVADCLT_N : SInst<"svadclt[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_adclt", [IsStreamingCompatible]>;
+def SVSBCLB_N : SInst<"svsbclb[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_sbclb", [IsStreamingCompatible]>;
+def SVSBCLT_N : SInst<"svsbclt[_n_{d}]", "ddda", "UiUl", MergeNone, "aarch64_sve_sbclt", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Multiplication by indexed elements
let TargetGuard = "sve2" in {
-def SVMLA_LANE_2 : SInst<"svmla_lane[_{d}]", "ddddi", "silUsUiUl", MergeNone, "aarch64_sve_mla_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLS_LANE_2 : SInst<"svmls_lane[_{d}]", "ddddi", "silUsUiUl", MergeNone, "aarch64_sve_mls_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMUL_LANE_2 : SInst<"svmul_lane[_{d}]", "dddi", "silUsUiUl", MergeNone, "aarch64_sve_mul_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVMLA_LANE_2 : SInst<"svmla_lane[_{d}]", "ddddi", "silUsUiUl", MergeNone, "aarch64_sve_mla_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLS_LANE_2 : SInst<"svmls_lane[_{d}]", "ddddi", "silUsUiUl", MergeNone, "aarch64_sve_mls_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMUL_LANE_2 : SInst<"svmul_lane[_{d}]", "dddi", "silUsUiUl", MergeNone, "aarch64_sve_mul_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Uniform complex integer arithmetic
let TargetGuard = "sve2" in {
-def SVCADD : SInst<"svcadd[_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_cadd_x", [], [ImmCheck<2, ImmCheckComplexRot90_270>]>;
-def SVSQCADD : SInst<"svqcadd[_{d}]", "dddi", "csil", MergeNone, "aarch64_sve_sqcadd_x", [], [ImmCheck<2, ImmCheckComplexRot90_270>]>;
-def SVCMLA : SInst<"svcmla[_{d}]", "ddddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmla_x", [], [ImmCheck<3, ImmCheckComplexRotAll90>]>;
-def SVCMLA_LANE_X : SInst<"svcmla_lane[_{d}]", "ddddii", "siUsUi", MergeNone, "aarch64_sve_cmla_lane_x", [], [ImmCheck<3, ImmCheckLaneIndexCompRotate, 2>,
+def SVCADD : SInst<"svcadd[_{d}]", "dddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_cadd_x", [IsStreamingCompatible], [ImmCheck<2, ImmCheckComplexRot90_270>]>;
+def SVSQCADD : SInst<"svqcadd[_{d}]", "dddi", "csil", MergeNone, "aarch64_sve_sqcadd_x", [IsStreamingCompatible], [ImmCheck<2, ImmCheckComplexRot90_270>]>;
+def SVCMLA : SInst<"svcmla[_{d}]", "ddddi", "csilUcUsUiUl", MergeNone, "aarch64_sve_cmla_x", [IsStreamingCompatible], [ImmCheck<3, ImmCheckComplexRotAll90>]>;
+def SVCMLA_LANE_X : SInst<"svcmla_lane[_{d}]", "ddddii", "siUsUi", MergeNone, "aarch64_sve_cmla_lane_x", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndexCompRotate, 2>,
ImmCheck<4, ImmCheckComplexRotAll90>]>;
-def SVSQRDCMLAH_X : SInst<"svqrdcmlah[_{d}]", "ddddi", "csil", MergeNone, "aarch64_sve_sqrdcmlah_x", [], [ImmCheck<3, ImmCheckComplexRotAll90>]>;
-def SVSQRDCMLAH_LANE_X : SInst<"svqrdcmlah_lane[_{d}]", "ddddii", "si", MergeNone, "aarch64_sve_sqrdcmlah_lane_x", [], [ImmCheck<3, ImmCheckLaneIndexCompRotate, 2>,
+def SVSQRDCMLAH_X : SInst<"svqrdcmlah[_{d}]", "ddddi", "csil", MergeNone, "aarch64_sve_sqrdcmlah_x", [IsStreamingCompatible], [ImmCheck<3, ImmCheckComplexRotAll90>]>;
+def SVSQRDCMLAH_LANE_X : SInst<"svqrdcmlah_lane[_{d}]", "ddddii", "si", MergeNone, "aarch64_sve_sqrdcmlah_lane_x", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndexCompRotate, 2>,
ImmCheck<4, ImmCheckComplexRotAll90>]>;
}
@@ -1521,18 +1533,18 @@ def SVSQRDCMLAH_LANE_X : SInst<"svqrdcmlah_lane[_{d}]", "ddddii", "si",
// SVE2 - Widening DSP operations
multiclass SInstWideDSPAcc<string name, string types, string intrinsic> {
- def : SInst<name # "[_{d}]", "ddhh", types, MergeNone, intrinsic>;
- def _N : SInst<name # "[_n_{d}]", "ddhR", types, MergeNone, intrinsic>;
+ def : SInst<name # "[_{d}]", "ddhh", types, MergeNone, intrinsic, [IsStreamingCompatible]>;
+ def _N : SInst<name # "[_n_{d}]", "ddhR", types, MergeNone, intrinsic, [IsStreamingCompatible]>;
}
multiclass SInstWideDSPLong<string name, string types, string intrinsic> {
- def : SInst<name # "[_{d}]", "dhh", types, MergeNone, intrinsic>;
- def _N : SInst<name # "[_n_{d}]", "dhR", types, MergeNone, intrinsic>;
+ def : SInst<name # "[_{d}]", "dhh", types, MergeNone, intrinsic, [IsStreamingCompatible]>;
+ def _N : SInst<name # "[_n_{d}]", "dhR", types, MergeNone, intrinsic, [IsStreamingCompatible]>;
}
multiclass SInstWideDSPWide<string name, string types, string intrinsic> {
- def : SInst<name # "[_{d}]", "ddh", types, MergeNone, intrinsic>;
- def _N : SInst<name # "[_n_{d}]", "ddR", types, MergeNone, intrinsic>;
+ def : SInst<name # "[_{d}]", "ddh", types, MergeNone, intrinsic, [IsStreamingCompatible]>;
+ def _N : SInst<name # "[_n_{d}]", "ddR", types, MergeNone, intrinsic, [IsStreamingCompatible]>;
}
let TargetGuard = "sve2" in {
@@ -1581,87 +1593,87 @@ defm SVSUBWB_U : SInstWideDSPWide<"svsubwb", "UsUiUl", "aarch64_sve_usubwb">;
defm SVSUBWT_S : SInstWideDSPWide<"svsubwt", "sil", "aarch64_sve_ssubwt">;
defm SVSUBWT_U : SInstWideDSPWide<"svsubwt", "UsUiUl", "aarch64_sve_usubwt">;
-def SVSHLLB_S_N : SInst<"svshllb[_n_{d}]", "dhi", "sil", MergeNone, "aarch64_sve_sshllb", [], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
-def SVSHLLB_U_N : SInst<"svshllb[_n_{d}]", "dhi", "UsUiUl", MergeNone, "aarch64_sve_ushllb", [], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
-def SVSHLLT_S_N : SInst<"svshllt[_n_{d}]", "dhi", "sil", MergeNone, "aarch64_sve_sshllt", [], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
-def SVSHLLT_U_N : SInst<"svshllt[_n_{d}]", "dhi", "UsUiUl", MergeNone, "aarch64_sve_ushllt", [], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
-
-def SVMOVLB_S_N : SInst<"svmovlb[_{d}]", "dh", "sil", MergeNone>;
-def SVMOVLB_U_N : SInst<"svmovlb[_{d}]", "dh", "UsUiUl", MergeNone>;
-def SVMOVLT_S_N : SInst<"svmovlt[_{d}]", "dh", "sil", MergeNone>;
-def SVMOVLT_U_N : SInst<"svmovlt[_{d}]", "dh", "UsUiUl", MergeNone>;
-
-def SVMLALB_S_LANE : SInst<"svmlalb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlalb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLALB_U_LANE : SInst<"svmlalb_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlalb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLALT_S_LANE : SInst<"svmlalt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlalt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLALT_U_LANE : SInst<"svmlalt_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlalt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLSLB_S_LANE : SInst<"svmlslb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlslb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLSLB_U_LANE : SInst<"svmlslb_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlslb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLSLT_S_LANE : SInst<"svmlslt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlslt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLSLT_U_LANE : SInst<"svmlslt_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlslt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMULLB_S_LANE : SInst<"svmullb_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_smullb_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVMULLB_U_LANE : SInst<"svmullb_lane[_{d}]", "dhhi", "UiUl", MergeNone, "aarch64_sve_umullb_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVMULLT_S_LANE : SInst<"svmullt_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_smullt_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVMULLT_U_LANE : SInst<"svmullt_lane[_{d}]", "dhhi", "UiUl", MergeNone, "aarch64_sve_umullt_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVQDMLALB_LANE : SInst<"svqdmlalb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlalb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVQDMLALT_LANE : SInst<"svqdmlalt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlalt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVQDMLSLB_LANE : SInst<"svqdmlslb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlslb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVQDMLSLT_LANE : SInst<"svqdmlslt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlslt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVQDMULLB_LANE : SInst<"svqdmullb_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_sqdmullb_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVQDMULLT_LANE : SInst<"svqdmullt_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_sqdmullt_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVSHLLB_S_N : SInst<"svshllb[_n_{d}]", "dhi", "sil", MergeNone, "aarch64_sve_sshllb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
+def SVSHLLB_U_N : SInst<"svshllb[_n_{d}]", "dhi", "UsUiUl", MergeNone, "aarch64_sve_ushllb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
+def SVSHLLT_S_N : SInst<"svshllt[_n_{d}]", "dhi", "sil", MergeNone, "aarch64_sve_sshllt", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
+def SVSHLLT_U_N : SInst<"svshllt[_n_{d}]", "dhi", "UsUiUl", MergeNone, "aarch64_sve_ushllt", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftLeft, 0>]>;
+
+def SVMOVLB_S_N : SInst<"svmovlb[_{d}]", "dh", "sil", MergeNone, "", [IsStreamingCompatible]>;
+def SVMOVLB_U_N : SInst<"svmovlb[_{d}]", "dh", "UsUiUl", MergeNone, "", [IsStreamingCompatible]>;
+def SVMOVLT_S_N : SInst<"svmovlt[_{d}]", "dh", "sil", MergeNone, "", [IsStreamingCompatible]>;
+def SVMOVLT_U_N : SInst<"svmovlt[_{d}]", "dh", "UsUiUl", MergeNone, "", [IsStreamingCompatible]>;
+
+def SVMLALB_S_LANE : SInst<"svmlalb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlalb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLALB_U_LANE : SInst<"svmlalb_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlalb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLALT_S_LANE : SInst<"svmlalt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlalt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLALT_U_LANE : SInst<"svmlalt_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlalt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLSLB_S_LANE : SInst<"svmlslb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlslb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLSLB_U_LANE : SInst<"svmlslb_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlslb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLSLT_S_LANE : SInst<"svmlslt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_smlslt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLSLT_U_LANE : SInst<"svmlslt_lane[_{d}]", "ddhhi", "UiUl", MergeNone, "aarch64_sve_umlslt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMULLB_S_LANE : SInst<"svmullb_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_smullb_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVMULLB_U_LANE : SInst<"svmullb_lane[_{d}]", "dhhi", "UiUl", MergeNone, "aarch64_sve_umullb_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVMULLT_S_LANE : SInst<"svmullt_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_smullt_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVMULLT_U_LANE : SInst<"svmullt_lane[_{d}]", "dhhi", "UiUl", MergeNone, "aarch64_sve_umullt_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVQDMLALB_LANE : SInst<"svqdmlalb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlalb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVQDMLALT_LANE : SInst<"svqdmlalt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlalt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVQDMLSLB_LANE : SInst<"svqdmlslb_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlslb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVQDMLSLT_LANE : SInst<"svqdmlslt_lane[_{d}]", "ddhhi", "il", MergeNone, "aarch64_sve_sqdmlslt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVQDMULLB_LANE : SInst<"svqdmullb_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_sqdmullb_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVQDMULLT_LANE : SInst<"svqdmullt_lane[_{d}]", "dhhi", "il", MergeNone, "aarch64_sve_sqdmullt_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Narrowing DSP operations
let TargetGuard = "sve2" in {
-def SVADDHNB : SInst<"svaddhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_addhnb">;
-def SVADDHNT : SInst<"svaddhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_addhnt">;
-def SVRADDHNB : SInst<"svraddhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_raddhnb">;
-def SVRADDHNT : SInst<"svraddhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_raddhnt">;
-def SVRSUBHNB : SInst<"svrsubhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnb">;
-def SVRSUBHNT : SInst<"svrsubhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnt">;
-def SVSUBHNB : SInst<"svsubhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_subhnb">;
-def SVSUBHNT : SInst<"svsubhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_subhnt">;
-
-def SVADDHNB_N : SInst<"svaddhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_addhnb">;
-def SVADDHNT_N : SInst<"svaddhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_addhnt">;
-def SVRADDHNB_N : SInst<"svraddhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_raddhnb">;
-def SVRADDHNT_N : SInst<"svraddhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_raddhnt">;
-def SVRSUBHNB_N : SInst<"svrsubhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnb">;
-def SVRSUBHNT_N : SInst<"svrsubhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnt">;
-def SVSUBHNB_N : SInst<"svsubhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_subhnb">;
-def SVSUBHNT_N : SInst<"svsubhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_subhnt">;
-
-def SVSHRNB : SInst<"svshrnb[_n_{d}]", "hdi", "silUsUiUl", MergeNone, "aarch64_sve_shrnb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-def SVRSHRNB : SInst<"svrshrnb[_n_{d}]", "hdi", "silUsUiUl", MergeNone, "aarch64_sve_rshrnb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-def SVQSHRUNB : SInst<"svqshrunb[_n_{d}]", "edi", "sil", MergeNone, "aarch64_sve_sqshrunb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-def SVQRSHRUNB : SInst<"svqrshrunb[_n_{d}]", "edi", "sil", MergeNone, "aarch64_sve_sqrshrunb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-def SVQSHRNB_S : SInst<"svqshrnb[_n_{d}]", "hdi", "sil", MergeNone, "aarch64_sve_sqshrnb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-def SVQSHRNB_U : SInst<"svqshrnb[_n_{d}]", "hdi", "UsUiUl", MergeNone, "aarch64_sve_uqshrnb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-def SVQRSHRNB_S : SInst<"svqrshrnb[_n_{d}]", "hdi", "sil", MergeNone, "aarch64_sve_sqrshrnb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-def SVQRSHRNB_U : SInst<"svqrshrnb[_n_{d}]", "hdi", "UsUiUl", MergeNone, "aarch64_sve_uqrshrnb", [], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
-
-def SVSHRNT : SInst<"svshrnt[_n_{d}]", "hhdi", "silUsUiUl", MergeNone, "aarch64_sve_shrnt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
-def SVRSHRNT : SInst<"svrshrnt[_n_{d}]", "hhdi", "silUsUiUl", MergeNone, "aarch64_sve_rshrnt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
-def SVQSHRUNT : SInst<"svqshrunt[_n_{d}]", "eedi", "sil", MergeNone, "aarch64_sve_sqshrunt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
-def SVQRSHRUNT : SInst<"svqrshrunt[_n_{d}]", "eedi", "sil", MergeNone, "aarch64_sve_sqrshrunt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
-def SVQSHRNT_S : SInst<"svqshrnt[_n_{d}]", "hhdi", "sil", MergeNone, "aarch64_sve_sqshrnt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
-def SVQSHRNT_U : SInst<"svqshrnt[_n_{d}]", "hhdi", "UsUiUl", MergeNone, "aarch64_sve_uqshrnt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
-def SVQRSHRNT_S : SInst<"svqrshrnt[_n_{d}]", "hhdi", "sil", MergeNone, "aarch64_sve_sqrshrnt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
-def SVQRSHRNT_U : SInst<"svqrshrnt[_n_{d}]", "hhdi", "UsUiUl", MergeNone, "aarch64_sve_uqrshrnt", [], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVADDHNB : SInst<"svaddhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_addhnb", [IsStreamingCompatible]>;
+def SVADDHNT : SInst<"svaddhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_addhnt", [IsStreamingCompatible]>;
+def SVRADDHNB : SInst<"svraddhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_raddhnb", [IsStreamingCompatible]>;
+def SVRADDHNT : SInst<"svraddhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_raddhnt", [IsStreamingCompatible]>;
+def SVRSUBHNB : SInst<"svrsubhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnb", [IsStreamingCompatible]>;
+def SVRSUBHNT : SInst<"svrsubhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnt", [IsStreamingCompatible]>;
+def SVSUBHNB : SInst<"svsubhnb[_{d}]", "hdd", "silUsUiUl", MergeNone, "aarch64_sve_subhnb", [IsStreamingCompatible]>;
+def SVSUBHNT : SInst<"svsubhnt[_{d}]", "hhdd", "silUsUiUl", MergeNone, "aarch64_sve_subhnt", [IsStreamingCompatible]>;
+
+def SVADDHNB_N : SInst<"svaddhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_addhnb", [IsStreamingCompatible]>;
+def SVADDHNT_N : SInst<"svaddhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_addhnt", [IsStreamingCompatible]>;
+def SVRADDHNB_N : SInst<"svraddhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_raddhnb", [IsStreamingCompatible]>;
+def SVRADDHNT_N : SInst<"svraddhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_raddhnt", [IsStreamingCompatible]>;
+def SVRSUBHNB_N : SInst<"svrsubhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnb", [IsStreamingCompatible]>;
+def SVRSUBHNT_N : SInst<"svrsubhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_rsubhnt", [IsStreamingCompatible]>;
+def SVSUBHNB_N : SInst<"svsubhnb[_n_{d}]", "hda", "silUsUiUl", MergeNone, "aarch64_sve_subhnb", [IsStreamingCompatible]>;
+def SVSUBHNT_N : SInst<"svsubhnt[_n_{d}]", "hhda", "silUsUiUl", MergeNone, "aarch64_sve_subhnt", [IsStreamingCompatible]>;
+
+def SVSHRNB : SInst<"svshrnb[_n_{d}]", "hdi", "silUsUiUl", MergeNone, "aarch64_sve_shrnb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+def SVRSHRNB : SInst<"svrshrnb[_n_{d}]", "hdi", "silUsUiUl", MergeNone, "aarch64_sve_rshrnb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+def SVQSHRUNB : SInst<"svqshrunb[_n_{d}]", "edi", "sil", MergeNone, "aarch64_sve_sqshrunb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+def SVQRSHRUNB : SInst<"svqrshrunb[_n_{d}]", "edi", "sil", MergeNone, "aarch64_sve_sqrshrunb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+def SVQSHRNB_S : SInst<"svqshrnb[_n_{d}]", "hdi", "sil", MergeNone, "aarch64_sve_sqshrnb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+def SVQSHRNB_U : SInst<"svqshrnb[_n_{d}]", "hdi", "UsUiUl", MergeNone, "aarch64_sve_uqshrnb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+def SVQRSHRNB_S : SInst<"svqrshrnb[_n_{d}]", "hdi", "sil", MergeNone, "aarch64_sve_sqrshrnb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+def SVQRSHRNB_U : SInst<"svqrshrnb[_n_{d}]", "hdi", "UsUiUl", MergeNone, "aarch64_sve_uqrshrnb", [IsStreamingCompatible], [ImmCheck<1, ImmCheckShiftRightNarrow, 0>]>;
+
+def SVSHRNT : SInst<"svshrnt[_n_{d}]", "hhdi", "silUsUiUl", MergeNone, "aarch64_sve_shrnt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVRSHRNT : SInst<"svrshrnt[_n_{d}]", "hhdi", "silUsUiUl", MergeNone, "aarch64_sve_rshrnt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVQSHRUNT : SInst<"svqshrunt[_n_{d}]", "eedi", "sil", MergeNone, "aarch64_sve_sqshrunt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVQRSHRUNT : SInst<"svqrshrunt[_n_{d}]", "eedi", "sil", MergeNone, "aarch64_sve_sqrshrunt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVQSHRNT_S : SInst<"svqshrnt[_n_{d}]", "hhdi", "sil", MergeNone, "aarch64_sve_sqshrnt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVQSHRNT_U : SInst<"svqshrnt[_n_{d}]", "hhdi", "UsUiUl", MergeNone, "aarch64_sve_uqshrnt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVQRSHRNT_S : SInst<"svqrshrnt[_n_{d}]", "hhdi", "sil", MergeNone, "aarch64_sve_sqrshrnt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
+def SVQRSHRNT_U : SInst<"svqrshrnt[_n_{d}]", "hhdi", "UsUiUl", MergeNone, "aarch64_sve_uqrshrnt", [IsStreamingCompatible], [ImmCheck<2, ImmCheckShiftRightNarrow, 1>]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Unary narrowing operations
let TargetGuard = "sve2" in {
-def SVQXTNB_S : SInst<"svqxtnb[_{d}]", "hd", "sil", MergeNone, "aarch64_sve_sqxtnb">;
-def SVQXTNB_U : SInst<"svqxtnb[_{d}]", "hd", "UsUiUl", MergeNone, "aarch64_sve_uqxtnb">;
-def SVQXTUNB_S : SInst<"svqxtunb[_{d}]", "ed", "sil", MergeNone, "aarch64_sve_sqxtunb">;
+def SVQXTNB_S : SInst<"svqxtnb[_{d}]", "hd", "sil", MergeNone, "aarch64_sve_sqxtnb", [IsStreamingCompatible]>;
+def SVQXTNB_U : SInst<"svqxtnb[_{d}]", "hd", "UsUiUl", MergeNone, "aarch64_sve_uqxtnb", [IsStreamingCompatible]>;
+def SVQXTUNB_S : SInst<"svqxtunb[_{d}]", "ed", "sil", MergeNone, "aarch64_sve_sqxtunb", [IsStreamingCompatible]>;
-def SVQXTNT_S : SInst<"svqxtnt[_{d}]", "hhd", "sil", MergeNone, "aarch64_sve_sqxtnt">;
-def SVQXTNT_U : SInst<"svqxtnt[_{d}]", "hhd", "UsUiUl", MergeNone, "aarch64_sve_uqxtnt">;
-def SVQXTUNT_S : SInst<"svqxtunt[_{d}]", "eed", "sil", MergeNone, "aarch64_sve_sqxtunt">;
+def SVQXTNT_S : SInst<"svqxtnt[_{d}]", "hhd", "sil", MergeNone, "aarch64_sve_sqxtnt", [IsStreamingCompatible]>;
+def SVQXTNT_U : SInst<"svqxtnt[_{d}]", "hhd", "UsUiUl", MergeNone, "aarch64_sve_uqxtnt", [IsStreamingCompatible]>;
+def SVQXTUNT_S : SInst<"svqxtunt[_{d}]", "eed", "sil", MergeNone, "aarch64_sve_sqxtunt", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1802,18 +1814,18 @@ def SVSTNT1W_SCATTER_INDEX_S : MInst<"svstnt1w_scatter[_{2}base]_index[_{d}]", "
// SVE2 - Polynomial arithmetic
let TargetGuard = "sve2" in {
-def SVEORBT : SInst<"sveorbt[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eorbt">;
-def SVEORBT_N : SInst<"sveorbt[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_eorbt">;
-def SVEORTB : SInst<"sveortb[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eortb">;
-def SVEORTB_N : SInst<"sveortb[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_eortb">;
-def SVPMUL : SInst<"svpmul[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_pmul">;
-def SVPMUL_N : SInst<"svpmul[_n_{d}]", "dda", "Uc", MergeNone, "aarch64_sve_pmul">;
-def SVPMULLB : SInst<"svpmullb[_{d}]", "dhh", "UsUl", MergeNone>;
-def SVPMULLB_N : SInst<"svpmullb[_n_{d}]", "dhR", "UsUl", MergeNone>;
-def SVPMULLB_PAIR : SInst<"svpmullb_pair[_{d}]", "ddd", "UcUi", MergeNone, "aarch64_sve_pmullb_pair">;
-def SVPMULLB_PAIR_N : SInst<"svpmullb_pair[_n_{d}]", "dda", "UcUi", MergeNone, "aarch64_sve_pmullb_pair">;
-def SVPMULLT : SInst<"svpmullt[_{d}]", "dhh", "UsUl", MergeNone>;
-def SVPMULLT_N : SInst<"svpmullt[_n_{d}]", "dhR", "UsUl", MergeNone>;
+def SVEORBT : SInst<"sveorbt[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eorbt", [IsStreamingCompatible]>;
+def SVEORBT_N : SInst<"sveorbt[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_eorbt", [IsStreamingCompatible]>;
+def SVEORTB : SInst<"sveortb[_{d}]", "dddd", "csilUcUsUiUl", MergeNone, "aarch64_sve_eortb", [IsStreamingCompatible]>;
+def SVEORTB_N : SInst<"sveortb[_n_{d}]", "ddda", "csilUcUsUiUl", MergeNone, "aarch64_sve_eortb", [IsStreamingCompatible]>;
+def SVPMUL : SInst<"svpmul[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_pmul", [IsStreamingCompatible]>;
+def SVPMUL_N : SInst<"svpmul[_n_{d}]", "dda", "Uc", MergeNone, "aarch64_sve_pmul", [IsStreamingCompatible]>;
+def SVPMULLB : SInst<"svpmullb[_{d}]", "dhh", "UsUl", MergeNone, "", [IsStreamingCompatible]>;
+def SVPMULLB_N : SInst<"svpmullb[_n_{d}]", "dhR", "UsUl", MergeNone, "", [IsStreamingCompatible]>;
+def SVPMULLB_PAIR : SInst<"svpmullb_pair[_{d}]", "ddd", "UcUi", MergeNone, "aarch64_sve_pmullb_pair", [IsStreamingCompatible]>;
+def SVPMULLB_PAIR_N : SInst<"svpmullb_pair[_n_{d}]", "dda", "UcUi", MergeNone, "aarch64_sve_pmullb_pair", [IsStreamingCompatible]>;
+def SVPMULLT : SInst<"svpmullt[_{d}]", "dhh", "UsUl", MergeNone, "", [IsStreamingCompatible]>;
+def SVPMULLT_N : SInst<"svpmullt[_n_{d}]", "dhR", "UsUl", MergeNone, "", [IsStreamingCompatible]>;
def SVPMULLT_PAIR : SInst<"svpmullt_pair[_{d}]", "ddd", "UcUi", MergeNone, "aarch64_sve_pmullt_pair">;
def SVPMULLT_PAIR_N : SInst<"svpmullt_pair[_n_{d}]", "dda", "UcUi", MergeNone, "aarch64_sve_pmullt_pair">;
}
@@ -1822,8 +1834,8 @@ def SVPMULLT_PAIR_N : SInst<"svpmullt_pair[_n_{d}]", "dda", "UcUi", Mer
// SVE2 - Complex integer dot product
let TargetGuard = "sve2" in {
-def SVCDOT : SInst<"svcdot[_{d}]", "ddqqi", "il", MergeNone, "aarch64_sve_cdot", [], [ImmCheck<3, ImmCheckComplexRotAll90>]>;
-def SVCDOT_LANE : SInst<"svcdot_lane[_{d}]", "ddqqii", "il", MergeNone, "aarch64_sve_cdot_lane", [], [ImmCheck<4, ImmCheckComplexRotAll90>,
+def SVCDOT : SInst<"svcdot[_{d}]", "ddqqi", "il", MergeNone, "aarch64_sve_cdot", [IsStreamingCompatible], [ImmCheck<3, ImmCheckComplexRotAll90>]>;
+def SVCDOT_LANE : SInst<"svcdot_lane[_{d}]", "ddqqii", "il", MergeNone, "aarch64_sve_cdot_lane", [IsStreamingCompatible], [ImmCheck<4, ImmCheckComplexRotAll90>,
ImmCheck<3, ImmCheckLaneIndexDot, 2>]>;
}
@@ -1831,27 +1843,27 @@ def SVCDOT_LANE : SInst<"svcdot_lane[_{d}]", "ddqqii", "il", MergeNone, "aarch
// SVE2 - Floating-point widening multiply-accumulate
let TargetGuard = "sve2" in {
-def SVMLALB_F : SInst<"svmlalb[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlalb">;
-def SVMLALB_F_N : SInst<"svmlalb[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlalb">;
-def SVMLALB_F_LANE : SInst<"svmlalb_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlalb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLALT_F : SInst<"svmlalt[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlalt">;
-def SVMLALT_F_N : SInst<"svmlalt[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlalt">;
-def SVMLALT_F_LANE : SInst<"svmlalt_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlalt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLSLB_F : SInst<"svmlslb[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlslb">;
-def SVMLSLB_F_N : SInst<"svmlslb[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlslb">;
-def SVMLSLB_F_LANE : SInst<"svmlslb_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlslb_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLSLT_F : SInst<"svmlslt[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlslt">;
-def SVMLSLT_F_N : SInst<"svmlslt[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlslt">;
-def SVMLSLT_F_LANE : SInst<"svmlslt_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlslt_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLALB_F : SInst<"svmlalb[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlalb", [IsStreamingCompatible]>;
+def SVMLALB_F_N : SInst<"svmlalb[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlalb", [IsStreamingCompatible]>;
+def SVMLALB_F_LANE : SInst<"svmlalb_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlalb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLALT_F : SInst<"svmlalt[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlalt", [IsStreamingCompatible]>;
+def SVMLALT_F_N : SInst<"svmlalt[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlalt", [IsStreamingCompatible]>;
+def SVMLALT_F_LANE : SInst<"svmlalt_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlalt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLSLB_F : SInst<"svmlslb[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlslb", [IsStreamingCompatible]>;
+def SVMLSLB_F_N : SInst<"svmlslb[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlslb", [IsStreamingCompatible]>;
+def SVMLSLB_F_LANE : SInst<"svmlslb_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlslb_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLSLT_F : SInst<"svmlslt[_{d}]", "ddhh", "f", MergeNone, "aarch64_sve_fmlslt", [IsStreamingCompatible]>;
+def SVMLSLT_F_N : SInst<"svmlslt[_n_{d}]", "ddhR", "f", MergeNone, "aarch64_sve_fmlslt", [IsStreamingCompatible]>;
+def SVMLSLT_F_LANE : SInst<"svmlslt_lane[_{d}]", "ddhhi", "f", MergeNone, "aarch64_sve_fmlslt_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Floating-point integer binary logarithm
let TargetGuard = "sve2" in {
-def SVLOGB_M : SInst<"svlogb[_{d}]", "xxPd", "hfd", MergeOp1, "aarch64_sve_flogb">;
-def SVLOGB_X : SInst<"svlogb[_{d}]", "xPd", "hfd", MergeAnyExp, "aarch64_sve_flogb">;
-def SVLOGB_Z : SInst<"svlogb[_{d}]", "xPd", "hfd", MergeZeroExp, "aarch64_sve_flogb">;
+def SVLOGB_M : SInst<"svlogb[_{d}]", "xxPd", "hfd", MergeOp1, "aarch64_sve_flogb", [IsStreamingCompatible]>;
+def SVLOGB_X : SInst<"svlogb[_{d}]", "xPd", "hfd", MergeAnyExp, "aarch64_sve_flogb", [IsStreamingCompatible]>;
+def SVLOGB_Z : SInst<"svlogb[_{d}]", "xPd", "hfd", MergeZeroExp, "aarch64_sve_flogb", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1873,32 +1885,32 @@ def SVNMATCH : SInst<"svnmatch[_{d}]", "PPdd", "csUcUs", MergeNone, "aarch64_sve
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Contiguous conflict detection
let TargetGuard = "sve2" in {
-def SVWHILERW_B : SInst<"svwhilerw[_{1}]", "Pcc", "cUc", MergeNone, "aarch64_sve_whilerw_b", [IsOverloadWhileRW]>;
-def SVWHILERW_H : SInst<"svwhilerw[_{1}]", "Pcc", "sUsh", MergeNone, "aarch64_sve_whilerw_h", [IsOverloadWhileRW]>;
-def SVWHILERW_S : SInst<"svwhilerw[_{1}]", "Pcc", "iUif", MergeNone, "aarch64_sve_whilerw_s", [IsOverloadWhileRW]>;
-def SVWHILERW_D : SInst<"svwhilerw[_{1}]", "Pcc", "lUld", MergeNone, "aarch64_sve_whilerw_d", [IsOverloadWhileRW]>;
+def SVWHILERW_B : SInst<"svwhilerw[_{1}]", "Pcc", "cUc", MergeNone, "aarch64_sve_whilerw_b", [IsOverloadWhileRW, IsStreamingCompatible]>;
+def SVWHILERW_H : SInst<"svwhilerw[_{1}]", "Pcc", "sUsh", MergeNone, "aarch64_sve_whilerw_h", [IsOverloadWhileRW, IsStreamingCompatible]>;
+def SVWHILERW_S : SInst<"svwhilerw[_{1}]", "Pcc", "iUif", MergeNone, "aarch64_sve_whilerw_s", [IsOverloadWhileRW, IsStreamingCompatible]>;
+def SVWHILERW_D : SInst<"svwhilerw[_{1}]", "Pcc", "lUld", MergeNone, "aarch64_sve_whilerw_d", [IsOverloadWhileRW, IsStreamingCompatible]>;
-def SVWHILEWR_B : SInst<"svwhilewr[_{1}]", "Pcc", "cUc", MergeNone, "aarch64_sve_whilewr_b", [IsOverloadWhileRW]>;
-def SVWHILEWR_H : SInst<"svwhilewr[_{1}]", "Pcc", "sUsh", MergeNone, "aarch64_sve_whilewr_h", [IsOverloadWhileRW]>;
-def SVWHILEWR_S : SInst<"svwhilewr[_{1}]", "Pcc", "iUif", MergeNone, "aarch64_sve_whilewr_s", [IsOverloadWhileRW]>;
-def SVWHILEWR_D : SInst<"svwhilewr[_{1}]", "Pcc", "lUld", MergeNone, "aarch64_sve_whilewr_d", [IsOverloadWhileRW]>;
+def SVWHILEWR_B : SInst<"svwhilewr[_{1}]", "Pcc", "cUc", MergeNone, "aarch64_sve_whilewr_b", [IsOverloadWhileRW, IsStreamingCompatible]>;
+def SVWHILEWR_H : SInst<"svwhilewr[_{1}]", "Pcc", "sUsh", MergeNone, "aarch64_sve_whilewr_h", [IsOverloadWhileRW, IsStreamingCompatible]>;
+def SVWHILEWR_S : SInst<"svwhilewr[_{1}]", "Pcc", "iUif", MergeNone, "aarch64_sve_whilewr_s", [IsOverloadWhileRW, IsStreamingCompatible]>;
+def SVWHILEWR_D : SInst<"svwhilewr[_{1}]", "Pcc", "lUld", MergeNone, "aarch64_sve_whilewr_d", [IsOverloadWhileRW, IsStreamingCompatible]>;
}
let TargetGuard = "sve2,bf16" in {
-def SVWHILERW_H_BF16 : SInst<"svwhilerw[_{1}]", "Pcc", "b", MergeNone, "aarch64_sve_whilerw_h", [IsOverloadWhileRW]>;
-def SVWHILEWR_H_BF16 : SInst<"svwhilewr[_{1}]", "Pcc", "b", MergeNone, "aarch64_sve_whilewr_h", [IsOverloadWhileRW]>;
+def SVWHILERW_H_BF16 : SInst<"svwhilerw[_{1}]", "Pcc", "b", MergeNone, "aarch64_sve_whilerw_h", [IsOverloadWhileRW, IsStreamingCompatible]>;
+def SVWHILEWR_H_BF16 : SInst<"svwhilewr[_{1}]", "Pcc", "b", MergeNone, "aarch64_sve_whilewr_h", [IsOverloadWhileRW, IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
// SVE2 - Extended table lookup/permute
let TargetGuard = "sve2" in {
-def SVTBL2 : SInst<"svtbl2[_{d}]", "d2u", "csilUcUsUiUlhfd", MergeNone>;
-def SVTBX : SInst<"svtbx[_{d}]", "dddu", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_tbx">;
+def SVTBL2 : SInst<"svtbl2[_{d}]", "d2u", "csilUcUsUiUlhfd", MergeNone, "", [IsStreamingCompatible]>;
+def SVTBX : SInst<"svtbx[_{d}]", "dddu", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_tbx", [IsStreamingCompatible]>;
}
let TargetGuard = "sve2,bf16" in {
-def SVTBL2_BF16 : SInst<"svtbl2[_{d}]", "d2u", "b", MergeNone>;
-def SVTBX_BF16 : SInst<"svtbx[_{d}]", "dddu", "b", MergeNone, "aarch64_sve_tbx">;
+def SVTBL2_BF16 : SInst<"svtbl2[_{d}]", "d2u", "b", MergeNone, "", [IsStreamingCompatible]>;
+def SVTBX_BF16 : SInst<"svtbx[_{d}]", "dddu", "b", MergeNone, "aarch64_sve_tbx", [IsStreamingCompatible]>;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1967,109 +1979,83 @@ let TargetGuard = "sve2p1|sme2" in {
//FIXME: Replace IsStreamingCompatible with IsStreamingOrHasSVE2p1 when available
def SVPEXT_SINGLE : SInst<"svpext_lane_{d}", "P}i", "QcQsQiQl", MergeNone, "aarch64_sve_pext", [IsStreamingCompatible], [ImmCheck<1, ImmCheck0_3>]>;
def SVPEXT_X2 : SInst<"svpext_lane_{d}_x2", "2.P}i", "QcQsQiQl", MergeNone, "aarch64_sve_pext_x2", [IsStreamingCompatible], [ImmCheck<1, ImmCheck0_1>]>;
+
+def SVWHILEGE_COUNT : SInst<"svwhilege_{d}[_{1}]", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilege_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+def SVWHILEGT_COUNT : SInst<"svwhilegt_{d}[_{1}]", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilegt_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+def SVWHILELE_COUNT : SInst<"svwhilele_{d}[_{1}]", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilele_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+def SVWHILELT_COUNT : SInst<"svwhilelt_{d}[_{1}]", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilelt_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+def SVWHILELO_COUNT : SInst<"svwhilelt_{d}[_{1}]", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilelo_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+def SVWHILELS_COUNT : SInst<"svwhilele_{d}[_{1}]", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilels_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+def SVWHILEHI_COUNT : SInst<"svwhilegt_{d}[_{1}]", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilehi_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+def SVWHILEHS_COUNT : SInst<"svwhilege_{d}[_{1}]", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilehs_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
+}
+
+multiclass MultiVecLoad<string i> {
+ // FIXME: Replace IsStreamingCompatible with IsStreamingOrHasSVE2p1 when available (SME2 requires __arm_streaming)
+ def SV # NAME # B_X2 : MInst<"sv" # i # "[_{2}]_x2", "2}c", "cUc", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # H_X2 : MInst<"sv" # i # "[_{2}]_x2", "2}c", "sUshb", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # W_X2 : MInst<"sv" # i # "[_{2}]_x2", "2}c", "iUif", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # D_X2 : MInst<"sv" # i # "[_{2}]_x2", "2}c", "lUld", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # B_X4 : MInst<"sv" # i # "[_{2}]_x4", "4}c", "cUc", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # H_X4 : MInst<"sv" # i # "[_{2}]_x4", "4}c", "sUshb", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # W_X4 : MInst<"sv" # i # "[_{2}]_x4", "4}c", "iUif", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # D_X4 : MInst<"sv" # i # "[_{2}]_x4", "4}c", "lUld", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+
+ def SV # NAME # B_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}]_x2", "2}cl", "cUc", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # H_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}]_x2", "2}cl", "sUshb", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # W_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}]_x2", "2}cl", "iUif", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # D_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}]_x2", "2}cl", "lUld", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # B_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}]_x4", "4}cl", "cUc", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # H_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}]_x4", "4}cl", "sUshb", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # W_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}]_x4", "4}cl", "iUif", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # D_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}]_x4", "4}cl", "lUld", [IsStructLoad, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
}
-let TargetGuard = "sve2p1" in {
-def SVWHILEGE_COUNT : SInst<"svwhilege_{d}", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilege_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-def SVWHILEGT_COUNT : SInst<"svwhilegt_{d}", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilegt_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-def SVWHILELE_COUNT : SInst<"svwhilele_{d}", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilele_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-def SVWHILELT_COUNT : SInst<"svwhilelt_{d}", "}lli", "QcQsQiQl", MergeNone, "aarch64_sve_whilelt_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-def SVWHILELO_COUNT : SInst<"svwhilelo_{d}", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilelo_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-def SVWHILELS_COUNT : SInst<"svwhilels_{d}", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilels_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-def SVWHILEHI_COUNT : SInst<"svwhilehi_{d}", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilehi_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-def SVWHILEHS_COUNT : SInst<"svwhilehs_{d}", "}nni", "QcQsQiQl", MergeNone, "aarch64_sve_whilehs_{d}", [IsOverloadNone], [ImmCheck<2, ImmCheck2_4_Mul2>]>;
-
-def SVLD1B_X2 : MInst<"svld1[_{2}]_x2", "2}c", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1H_X2 : MInst<"svld1[_{2}]_x2", "2}c", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1W_X2 : MInst<"svld1[_{2}]_x2", "2}c", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1D_X2 : MInst<"svld1[_{2}]_x2", "2}c", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1B_X4 : MInst<"svld1[_{2}]_x4", "4}c", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-def SVLD1H_X4 : MInst<"svld1[_{2}]_x4", "4}c", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-def SVLD1W_X4 : MInst<"svld1[_{2}]_x4", "4}c", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-def SVLD1D_X4 : MInst<"svld1[_{2}]_x4", "4}c", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-
-def SVLDNT1B_X2 : MInst<"svldnt1[_{2}]_x2", "2}c", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1H_X2 : MInst<"svldnt1[_{2}]_x2", "2}c", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1W_X2 : MInst<"svldnt1[_{2}]_x2", "2}c", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1D_X2 : MInst<"svldnt1[_{2}]_x2", "2}c", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1B_X4 : MInst<"svldnt1[_{2}]_x4", "4}c", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-def SVLDNT1H_X4 : MInst<"svldnt1[_{2}]_x4", "4}c", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-def SVLDNT1W_X4 : MInst<"svldnt1[_{2}]_x4", "4}c", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-def SVLDNT1D_X4 : MInst<"svldnt1[_{2}]_x4", "4}c", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-
-def SVLD1B_VNUM_X2 : MInst<"svld1_vnum[_{2}]_x2", "2}cl", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1H_VNUM_X2 : MInst<"svld1_vnum[_{2}]_x2", "2}cl", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1W_VNUM_X2 : MInst<"svld1_vnum[_{2}]_x2", "2}cl", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1D_VNUM_X2 : MInst<"svld1_vnum[_{2}]_x2", "2}cl", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x2">;
-def SVLD1B_VNUM_X4 : MInst<"svld1_vnum[_{2}]_x4", "4}cl", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-def SVLD1H_VNUM_X4 : MInst<"svld1_vnum[_{2}]_x4", "4}cl", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-def SVLD1W_VNUM_X4 : MInst<"svld1_vnum[_{2}]_x4", "4}cl", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-def SVLD1D_VNUM_X4 : MInst<"svld1_vnum[_{2}]_x4", "4}cl", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ld1_pn_x4">;
-
-def SVLDNT1B_VNUM_X2 : MInst<"svldnt1_vnum[_{2}]_x2", "2}cl", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1H_VNUM_X2 : MInst<"svldnt1_vnum[_{2}]_x2", "2}cl", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1W_VNUM_X2 : MInst<"svldnt1_vnum[_{2}]_x2", "2}cl", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1D_VNUM_X2 : MInst<"svldnt1_vnum[_{2}]_x2", "2}cl", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x2">;
-def SVLDNT1B_VNUM_X4 : MInst<"svldnt1_vnum[_{2}]_x4", "4}cl", "cUc", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-def SVLDNT1H_VNUM_X4 : MInst<"svldnt1_vnum[_{2}]_x4", "4}cl", "sUshb", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-def SVLDNT1W_VNUM_X4 : MInst<"svldnt1_vnum[_{2}]_x4", "4}cl", "iUif", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-def SVLDNT1D_VNUM_X4 : MInst<"svldnt1_vnum[_{2}]_x4", "4}cl", "lUld", [IsStructLoad], MemEltTyDefault, "aarch64_sve_ldnt1_pn_x4">;
-
-def SVST1B_X2 : MInst<"svst1[_{2}_x2]", "v}p2", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1H_X2 : MInst<"svst1[_{2}_x2]", "v}p2", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1W_X2 : MInst<"svst1[_{2}_x2]", "v}p2", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1D_X2 : MInst<"svst1[_{2}_x2]", "v}p2", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1B_X4 : MInst<"svst1[_{2}_x4]", "v}p4", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-def SVST1H_X4 : MInst<"svst1[_{2}_x4]", "v}p4", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-def SVST1W_X4 : MInst<"svst1[_{2}_x4]", "v}p4", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-def SVST1D_X4 : MInst<"svst1[_{2}_x4]", "v}p4", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-
-def SVST1B_VNUM_X2 : MInst<"svst1_vnum[_{2}_x2]", "v}pl2", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1H_VNUM_X2 : MInst<"svst1_vnum[_{2}_x2]", "v}pl2", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1W_VNUM_X2 : MInst<"svst1_vnum[_{2}_x2]", "v}pl2", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1D_VNUM_X2 : MInst<"svst1_vnum[_{2}_x2]", "v}pl2", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x2">;
-def SVST1B_VNUM_X4 : MInst<"svst1_vnum[_{2}_x4]", "v}pl4", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-def SVST1H_VNUM_X4 : MInst<"svst1_vnum[_{2}_x4]", "v}pl4", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-def SVST1W_VNUM_X4 : MInst<"svst1_vnum[_{2}_x4]", "v}pl4", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-def SVST1D_VNUM_X4 : MInst<"svst1_vnum[_{2}_x4]", "v}pl4", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_st1_pn_x4">;
-
-def SVSTNT1B_X2 : MInst<"svstnt1[_{2}_x2]", "v}p2", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1H_X2 : MInst<"svstnt1[_{2}_x2]", "v}p2", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1W_X2 : MInst<"svstnt1[_{2}_x2]", "v}p2", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1D_X2 : MInst<"svstnt1[_{2}_x2]", "v}p2", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1B_X4 : MInst<"svstnt1[_{2}_x4]", "v}p4", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
-def SVSTNT1H_X4 : MInst<"svstnt1[_{2}_x4]", "v}p4", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
-def SVSTNT1W_X4 : MInst<"svstnt1[_{2}_x4]", "v}p4", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
-def SVSTNT1D_X4 : MInst<"svstnt1[_{2}_x4]", "v}p4", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
-
-def SVSTNT1B_VNUM_X2 : MInst<"svstnt1_vnum[_{2}_x2]", "v}pl2", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1H_VNUM_X2 : MInst<"svstnt1_vnum[_{2}_x2]", "v}pl2", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1W_VNUM_X2 : MInst<"svstnt1_vnum[_{2}_x2]", "v}pl2", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1D_VNUM_X2 : MInst<"svstnt1_vnum[_{2}_x2]", "v}pl2", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x2">;
-def SVSTNT1B_VNUM_X4 : MInst<"svstnt1_vnum[_{2}_x4]", "v}pl4", "cUc", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
-def SVSTNT1H_VNUM_X4 : MInst<"svstnt1_vnum[_{2}_x4]", "v}pl4", "sUshb", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
-def SVSTNT1W_VNUM_X4 : MInst<"svstnt1_vnum[_{2}_x4]", "v}pl4", "iUif", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
-def SVSTNT1D_VNUM_X4 : MInst<"svstnt1_vnum[_{2}_x4]", "v}pl4", "lUld", [IsStructStore], MemEltTyDefault, "aarch64_sve_stnt1_pn_x4">;
+let TargetGuard = "sve2p1|sme2" in {
+ defm LD1 : MultiVecLoad<"ld1">;
+ defm LDNT1 : MultiVecLoad<"ldnt1">;
+}
+
+multiclass MultiVecStore<string i> {
+ // FIXME: Replace IsStreamingCompatible with IsStreamingOrHasSVE2p1 when available (SME2 requires __arm_streaming)
+ def SV # NAME # B_X2 : MInst<"sv" # i # "[_{2}_x2]", "v}p2", "cUc", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # H_X2 : MInst<"sv" # i # "[_{2}_x2]", "v}p2", "sUshb", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # W_X2 : MInst<"sv" # i # "[_{2}_x2]", "v}p2", "iUif", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # D_X2 : MInst<"sv" # i # "[_{2}_x2]", "v}p2", "lUld", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # B_X4 : MInst<"sv" # i # "[_{2}_x4]", "v}p4", "cUc", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # H_X4 : MInst<"sv" # i # "[_{2}_x4]", "v}p4", "sUshb", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # W_X4 : MInst<"sv" # i # "[_{2}_x4]", "v}p4", "iUif", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # D_X4 : MInst<"sv" # i # "[_{2}_x4]", "v}p4", "lUld", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+
+ def SV # NAME # B_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}_x2]", "v}pl2", "cUc", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # H_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}_x2]", "v}pl2", "sUshb", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # W_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}_x2]", "v}pl2", "iUif", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # D_VNUM_X2 : MInst<"sv" # i # "_vnum" # "[_{2}_x2]", "v}pl2", "lUld", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x2">;
+ def SV # NAME # B_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}_x4]", "v}pl4", "cUc", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # H_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}_x4]", "v}pl4", "sUshb", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # W_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}_x4]", "v}pl4", "iUif", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+ def SV # NAME # D_VNUM_X4 : MInst<"sv" # i # "_vnum" # "[_{2}_x4]", "v}pl4", "lUld", [IsStructStore, IsStreamingCompatible], MemEltTyDefault, "aarch64_sve_" # i # "_pn_x4">;
+}
+let TargetGuard = "sve2p1|sme2" in {
+ defm ST1 : MultiVecStore<"st1">;
+ defm STNT1 : MultiVecStore<"stnt1">;
+}
+
+let TargetGuard = "sve2p1" in {
def SVDOT_X2_S : SInst<"svdot[_{d}_{2}_{3}]", "ddhh", "i", MergeNone, "aarch64_sve_sdot_x2", [], []>;
def SVDOT_X2_U : SInst<"svdot[_{d}_{2}_{3}]", "ddhh", "Ui", MergeNone, "aarch64_sve_udot_x2", [], []>;
def SVDOT_X2_F : SInst<"svdot[_{d}_{2}_{3}]", "ddhh", "f", MergeNone, "aarch64_sve_fdot_x2", [], []>;
def SVDOT_LANE_X2_S : SInst<"svdot_lane[_{d}_{2}_{3}]", "ddhhi", "i", MergeNone, "aarch64_sve_sdot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
def SVDOT_LANE_X2_U : SInst<"svdot_lane[_{d}_{2}_{3}]", "ddhhi", "Ui", MergeNone, "aarch64_sve_udot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
def SVDOT_LANE_X2_F : SInst<"svdot_lane[_{d}_{2}_{3}]", "ddhhi", "f", MergeNone, "aarch64_sve_fdot_lane_x2", [], [ImmCheck<3, ImmCheck0_3>]>;
-
-def SVBFMLSLB : SInst<"svbfmlslb[_{d}]", "dd$$", "f", MergeNone, "aarch64_sve_bfmlslb", [IsOverloadNone], []>;
-def SVBFMLSLT : SInst<"svbfmlslt[_{d}]", "dd$$", "f", MergeNone, "aarch64_sve_bfmlslt", [IsOverloadNone], []>;
-
-def SVBFMLSLB_LANE : SInst<"svbfmlslb_lane[_{d}]", "dd$$i", "f", MergeNone, "aarch64_sve_bfmlslb_lane", [IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
-def SVBFMLSLT_LANE : SInst<"svbfmlslt_lane[_{d}]", "dd$$i", "f", MergeNone, "aarch64_sve_bfmlslt_lane", [IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
}
-let TargetGuard = "sve2p1" in {
+let TargetGuard = "sve2p1|sme" in {
def SVSCLAMP : SInst<"svclamp[_{d}]", "dddd", "csil", MergeNone, "aarch64_sve_sclamp", [], []>;
def SVUCLAMP : SInst<"svclamp[_{d}]", "dddd", "UcUsUiUl", MergeNone, "aarch64_sve_uclamp", [], []>;
-defm SVREVD : SInstZPZ<"svrevd", "csilUcUsUiUl", "aarch64_sve_revd">;
+defm SVREVD : SInstZPZ<"svrevd", "csilUcUsUiUlbhfd", "aarch64_sve_revd">;
}
let TargetGuard = "sve2p1|sme2" in {
@@ -2082,21 +2068,21 @@ let TargetGuard = "sve2p1|sme2" in {
def SVCNTP_COUNT : SInst<"svcntp_{d}", "n}i", "QcQsQiQl", MergeNone, "aarch64_sve_cntp_{d}", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<1, ImmCheck2_4_Mul2>]>;
}
-let TargetGuard = "sve2p1,b16b16" in {
-defm SVMUL_BF : SInstZPZZ<"svmul", "b", "aarch64_sve_fmul", "aarch64_sve_fmul_u">;
-defm SVADD_BF : SInstZPZZ<"svadd", "b", "aarch64_sve_fadd", "aarch64_sve_fadd_u">;
-defm SVSUB_BF : SInstZPZZ<"svsub", "b", "aarch64_sve_fsub", "aarch64_sve_fsub_u">;
-defm SVMAXNM_BF : SInstZPZZ<"svmaxnm","b", "aarch64_sve_fmaxnm", "aarch64_sve_fmaxnm_u">;
-defm SVMINNM_BF : SInstZPZZ<"svminnm","b", "aarch64_sve_fminnm", "aarch64_sve_fminnm_u">;
-defm SVMAX_BF : SInstZPZZ<"svmax", "b", "aarch64_sve_fmax", "aarch64_sve_fmax_u">;
-defm SVMIN_BF : SInstZPZZ<"svmin", "b", "aarch64_sve_fmin", "aarch64_sve_fmin_u">;
-defm SVMLA_BF : SInstZPZZZ<"svmla", "b", "aarch64_sve_fmla", "aarch64_sve_fmla_u", []>;
-defm SVMLS_BF : SInstZPZZZ<"svmls", "b", "aarch64_sve_fmls", "aarch64_sve_fmls_u", []>;
-def SVMLA_LANE_BF : SInst<"svmla_lane[_{d}]", "ddddi", "b", MergeNone, "aarch64_sve_fmla_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMLS_LANE_BF : SInst<"svmls_lane[_{d}]", "ddddi", "b", MergeNone, "aarch64_sve_fmls_lane", [], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
-def SVMUL_LANE_BF : SInst<"svmul_lane[_{d}]", "dddi", "b", MergeNone, "aarch64_sve_fmul_lane", [], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
-def SVFCLAMP_BF : SInst<"svclamp[_{d}]", "dddd", "b", MergeNone, "aarch64_sve_fclamp", [], []>;
-} //sve2p1,b16b16
+let TargetGuard = "(sve2|sme2),b16b16" in {
+defm SVMUL_BF : SInstZPZZ<"svmul", "b", "aarch64_sve_fmul", "aarch64_sve_fmul_u", [IsStreamingCompatible]>;
+defm SVADD_BF : SInstZPZZ<"svadd", "b", "aarch64_sve_fadd", "aarch64_sve_fadd_u", [IsStreamingCompatible]>;
+defm SVSUB_BF : SInstZPZZ<"svsub", "b", "aarch64_sve_fsub", "aarch64_sve_fsub_u", [IsStreamingCompatible]>;
+defm SVMAXNM_BF : SInstZPZZ<"svmaxnm","b", "aarch64_sve_fmaxnm", "aarch64_sve_fmaxnm_u", [IsStreamingCompatible]>;
+defm SVMINNM_BF : SInstZPZZ<"svminnm","b", "aarch64_sve_fminnm", "aarch64_sve_fminnm_u", [IsStreamingCompatible]>;
+defm SVMAX_BF : SInstZPZZ<"svmax", "b", "aarch64_sve_fmax", "aarch64_sve_fmax_u", [IsStreamingCompatible]>;
+defm SVMIN_BF : SInstZPZZ<"svmin", "b", "aarch64_sve_fmin", "aarch64_sve_fmin_u", [IsStreamingCompatible]>;
+defm SVMLA_BF : SInstZPZZZ<"svmla", "b", "aarch64_sve_fmla", "aarch64_sve_fmla_u", [IsStreamingCompatible]>;
+defm SVMLS_BF : SInstZPZZZ<"svmls", "b", "aarch64_sve_fmls", "aarch64_sve_fmls_u", [IsStreamingCompatible]>;
+def SVMLA_LANE_BF : SInst<"svmla_lane[_{d}]", "ddddi", "b", MergeNone, "aarch64_sve_fmla_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMLS_LANE_BF : SInst<"svmls_lane[_{d}]", "ddddi", "b", MergeNone, "aarch64_sve_fmls_lane", [IsStreamingCompatible], [ImmCheck<3, ImmCheckLaneIndex, 2>]>;
+def SVMUL_LANE_BF : SInst<"svmul_lane[_{d}]", "dddi", "b", MergeNone, "aarch64_sve_fmul_lane", [IsStreamingCompatible], [ImmCheck<2, ImmCheckLaneIndex, 1>]>;
+def SVFCLAMP_BF : SInst<"svclamp[_{d}]", "dddd", "b", MergeNone, "aarch64_sve_fclamp", [IsStreamingCompatible], []>;
+}
// SME2
@@ -2138,6 +2124,21 @@ let TargetGuard = "sme2" in {
}
let TargetGuard = "sme2" in {
+ // FRINTA / FRINTM / FRINTN / FRINTP
+ def SVRINTA_X2 : SInst<"svrinta[_{d}_x2]", "22", "f", MergeNone, "aarch64_sve_frinta_x2", [IsStreaming], []>;
+ def SVRINTA_X4 : SInst<"svrinta[_{d}_x4]", "44", "f", MergeNone, "aarch64_sve_frinta_x4", [IsStreaming], []>;
+
+ def SVRINTM_X2 : SInst<"svrintm[_{d}_x2]", "22", "f", MergeNone, "aarch64_sve_frintm_x2", [IsStreaming], []>;
+ def SVRINTM_X4 : SInst<"svrintm[_{d}_x4]", "44", "f", MergeNone, "aarch64_sve_frintm_x4", [IsStreaming], []>;
+
+ def SVRINTN_X2 : SInst<"svrintn[_{d}_x2]", "22", "f", MergeNone, "aarch64_sve_frintn_x2", [IsStreaming], []>;
+ def SVRINTN_X4 : SInst<"svrintn[_{d}_x4]", "44", "f", MergeNone, "aarch64_sve_frintn_x4", [IsStreaming], []>;
+
+ def SVRINTP_X2 : SInst<"svrintp[_{d}_x2]", "22", "f", MergeNone, "aarch64_sve_frintp_x2", [IsStreaming], []>;
+ def SVRINTP_X4 : SInst<"svrintp[_{d}_x4]", "44", "f", MergeNone, "aarch64_sve_frintp_x4", [IsStreaming], []>;
+}
+
+let TargetGuard = "sme2" in {
def SVSCLAMP_X2 : SInst<"svclamp[_single_{d}_x2]", "22dd", "csil", MergeNone, "aarch64_sve_sclamp_single_x2", [IsStreaming], []>;
def SVUCLAMP_X2 : SInst<"svclamp[_single_{d}_x2]", "22dd", "UcUsUiUl", MergeNone, "aarch64_sve_uclamp_single_x2", [IsStreaming], []>;
def SVFCLAMP_X2 : SInst<"svclamp[_single_{d}_x2]", "22dd", "hfd", MergeNone, "aarch64_sve_fclamp_single_x2", [IsStreaming], []>;
@@ -2297,6 +2298,22 @@ let TargetGuard = "sme2" in {
}
//
+// Multi-vector zip/unzip
+//
+
+let TargetGuard = "sme2" in {
+ def SVZIP_X2 : SInst<"svzip[_{d}_x2]", "22", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_zip_x2", [IsStreaming], []>;
+ def SVZIPQ_X2 : SInst<"svzipq[_{d}_x2]", "22", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_zipq_x2", [IsStreaming], []>;
+ def SVZIP_X4 : SInst<"svzip[_{d}_x4]", "44", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_zip_x4", [IsStreaming], []>;
+ def SVZIPQ_X4 : SInst<"svzipq[_{d}_x4]", "44", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_zipq_x4", [IsStreaming], []>;
+
+ def SVUZP_X2 : SInst<"svuzp[_{d}_x2]", "22", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_uzp_x2", [IsStreaming], []>;
+ def SVUZPQ_X2 : SInst<"svuzpq[_{d}_x2]", "22", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_uzpq_x2", [IsStreaming], []>;
+ def SVUZP_X4 : SInst<"svuzp[_{d}_x4]", "44", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_uzp_x4", [IsStreaming], []>;
+ def SVUZPQ_X4 : SInst<"svuzpq[_{d}_x4]", "44", "cUcsUsiUilUlbhfd", MergeNone, "aarch64_sve_uzpq_x4", [IsStreaming], []>;
+}
+
+//
// Multi-vector unpack
//
@@ -2306,3 +2323,13 @@ let TargetGuard = "sme2" in {
def SVSUNPK_X4 : SInst<"svunpk_{d}[_{3}_x4]", "42.h", "sil", MergeNone, "aarch64_sve_sunpk_x4", [IsStreaming], []>;
def SVUUNPK_X4 : SInst<"svunpk_{d}[_{3}_x4]", "42.h", "UsUiUl", MergeNone, "aarch64_sve_uunpk_x4", [IsStreaming], []>;
}
+
+let TargetGuard = "sve2p1|sme2" in {
+// == BFloat16 multiply-subtract ==
+// FIXME: Make all of these IsStreamingOrSVE2p1 once that is added
+ def SVBFMLSLB : SInst<"svbfmlslb[_{d}]", "dd$$", "f", MergeNone, "aarch64_sve_bfmlslb", [IsOverloadNone, IsStreamingCompatible], []>;
+ def SVBFMLSLT : SInst<"svbfmlslt[_{d}]", "dd$$", "f", MergeNone, "aarch64_sve_bfmlslt", [IsOverloadNone, IsStreamingCompatible], []>;
+
+ def SVBFMLSLB_LANE : SInst<"svbfmlslb_lane[_{d}]", "dd$$i", "f", MergeNone, "aarch64_sve_bfmlslb_lane", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<3, ImmCheck0_7>]>;
+ def SVBFMLSLT_LANE : SInst<"svbfmlslt_lane[_{d}]", "dd$$i", "f", MergeNone, "aarch64_sve_bfmlslt_lane", [IsOverloadNone, IsStreamingCompatible], [ImmCheck<3, ImmCheck0_7>]>;
+}
diff --git a/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td b/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td
index 682f1d5c8af6..f2dde7f540fb 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td
@@ -2540,7 +2540,7 @@ multiclass RVVSignedWidenBinBuiltinSetVwsll
let UnMaskedPolicyScheme = HasPassthruOperand in {
// zvkb
- let RequiredFeatures = ["Zvkb"] in {
+ let RequiredFeatures = ["Zvkb", "Experimental"] in {
defm vandn : RVVUnsignedBinBuiltinSet;
defm vbrev8 : RVVOutBuiltinSetZvbb;
defm vrev8 : RVVOutBuiltinSetZvbb;
@@ -2549,7 +2549,7 @@ let UnMaskedPolicyScheme = HasPassthruOperand in {
}
// zvbb
- let RequiredFeatures = ["Zvbb"] in {
+ let RequiredFeatures = ["Zvbb", "Experimental"] in {
defm vbrev : RVVOutBuiltinSetZvbb;
defm vclz : RVVOutBuiltinSetZvbb;
defm vctz : RVVOutBuiltinSetZvbb;
@@ -2559,7 +2559,7 @@ let UnMaskedPolicyScheme = HasPassthruOperand in {
}
// zvbc
- let RequiredFeatures = ["Zvbc"] in {
+ let RequiredFeatures = ["Zvbc", "Experimental"] in {
defm vclmul : RVVInt64BinBuiltinSet;
defm vclmulh : RVVInt64BinBuiltinSet;
}
@@ -2567,13 +2567,13 @@ let UnMaskedPolicyScheme = HasPassthruOperand in {
let UnMaskedPolicyScheme = HasPolicyOperand, HasMasked = false in {
// zvkg
- let RequiredFeatures = ["Zvkg"] in {
+ let RequiredFeatures = ["Zvkg", "Experimental"] in {
defm vghsh : RVVOutOp2BuiltinSetVVZvk;
defm vgmul : RVVOutBuiltinSetZvk<HasVV=1, HasVS=0>;
}
// zvkned
- let RequiredFeatures = ["Zvkned"] in {
+ let RequiredFeatures = ["Zvkned", "Experimental"] in {
defm vaesdf : RVVOutBuiltinSetZvk;
defm vaesdm : RVVOutBuiltinSetZvk;
defm vaesef : RVVOutBuiltinSetZvk;
@@ -2585,28 +2585,28 @@ let UnMaskedPolicyScheme = HasPolicyOperand, HasMasked = false in {
}
// zvknha
- let RequiredFeatures = ["Zvknha"] in {
+ let RequiredFeatures = ["Zvknha", "Experimental"] in {
defm vsha2ch : RVVOutOp2BuiltinSetVVZvk<"i">;
defm vsha2cl : RVVOutOp2BuiltinSetVVZvk<"i">;
defm vsha2ms : RVVOutOp2BuiltinSetVVZvk<"i">;
}
// zvknhb
- let RequiredFeatures = ["Zvknhb"] in {
+ let RequiredFeatures = ["Zvknhb", "Experimental"] in {
defm vsha2ch : RVVOutOp2BuiltinSetVVZvk<"il">;
defm vsha2cl : RVVOutOp2BuiltinSetVVZvk<"il">;
defm vsha2ms : RVVOutOp2BuiltinSetVVZvk<"il">;
}
// zvksed
- let RequiredFeatures = ["Zvksed"] in {
+ let RequiredFeatures = ["Zvksed", "Experimental"] in {
let UnMaskedPolicyScheme = HasPassthruOperand in
defm vsm4k : RVVOutOp1BuiltinSet<"vsm4k", "i", [["vi", "Uv", "UvUvKz"]]>;
defm vsm4r : RVVOutBuiltinSetZvk;
}
// zvksh
- let RequiredFeatures = ["Zvksh"] in {
+ let RequiredFeatures = ["Zvksh", "Experimental"] in {
defm vsm3c : RVVOutOp2BuiltinSetVIZvk;
let UnMaskedPolicyScheme = HasPassthruOperand in
defm vsm3me : RVVOutOp1BuiltinSet<"vsm3me", "i", [["vv", "Uv", "UvUvUv"]]>;
diff --git a/contrib/llvm-project/clang/include/clang/Driver/Options.td b/contrib/llvm-project/clang/include/clang/Driver/Options.td
index 1b02087425b7..2b93ddf03349 100644
--- a/contrib/llvm-project/clang/include/clang/Driver/Options.td
+++ b/contrib/llvm-project/clang/include/clang/Driver/Options.td
@@ -5308,7 +5308,8 @@ def rewrite_objc : Flag<["-"], "rewrite-objc">, Flags<[NoXarchOption]>,
def rewrite_legacy_objc : Flag<["-"], "rewrite-legacy-objc">,
Flags<[NoXarchOption]>,
HelpText<"Rewrite Legacy Objective-C source to C++">;
-def rdynamic : Flag<["-"], "rdynamic">, Group<Link_Group>;
+def rdynamic : Flag<["-"], "rdynamic">, Group<Link_Group>,
+ Visibility<[ClangOption, FlangOption]>;
def resource_dir : Separate<["-"], "resource-dir">,
Flags<[NoXarchOption, HelpHidden]>,
Visibility<[ClangOption, CC1Option, CLOption, DXCOption]>,
@@ -6999,6 +7000,8 @@ def msign_return_address_key_EQ : Joined<["-"], "msign-return-address-key=">,
Values<"a_key,b_key">;
def mbranch_target_enforce : Flag<["-"], "mbranch-target-enforce">,
MarshallingInfoFlag<LangOpts<"BranchTargetEnforcement">>;
+def mbranch_protection_pauth_lr : Flag<["-"], "mbranch-protection-pauth-lr">,
+ MarshallingInfoFlag<LangOpts<"BranchProtectionPAuthLR">>;
def fno_dllexport_inlines : Flag<["-"], "fno-dllexport-inlines">,
MarshallingInfoNegativeFlag<LangOpts<"DllExportInlines">>;
def cfguard_no_checks : Flag<["-"], "cfguard-no-checks">,
diff --git a/contrib/llvm-project/clang/include/clang/Interpreter/CodeCompletion.h b/contrib/llvm-project/clang/include/clang/Interpreter/CodeCompletion.h
index 9adcdf0dc3af..c64aa899759f 100644
--- a/contrib/llvm-project/clang/include/clang/Interpreter/CodeCompletion.h
+++ b/contrib/llvm-project/clang/include/clang/Interpreter/CodeCompletion.h
@@ -23,8 +23,27 @@ namespace clang {
class CodeCompletionResult;
class CompilerInstance;
-void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
- unsigned Line, unsigned Col, const CompilerInstance *ParentCI,
- std::vector<std::string> &CCResults);
+struct ReplCodeCompleter {
+ ReplCodeCompleter() = default;
+ std::string Prefix;
+
+ /// \param InterpCI [in] The compiler instance that is used to trigger code
+ /// completion
+
+ /// \param Content [in] The string where code completion is triggered.
+
+ /// \param Line [in] The line number of the code completion point.
+
+ /// \param Col [in] The column number of the code completion point.
+
+ /// \param ParentCI [in] The running interpreter compiler instance that
+ /// provides ASTContexts.
+
+ /// \param CCResults [out] The completion results.
+ void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
+ unsigned Line, unsigned Col,
+ const CompilerInstance *ParentCI,
+ std::vector<std::string> &CCResults);
+};
} // namespace clang
#endif
diff --git a/contrib/llvm-project/clang/include/clang/Interpreter/Interpreter.h b/contrib/llvm-project/clang/include/clang/Interpreter/Interpreter.h
index 43573fb1a4b8..01858dfcc90a 100644
--- a/contrib/llvm-project/clang/include/clang/Interpreter/Interpreter.h
+++ b/contrib/llvm-project/clang/include/clang/Interpreter/Interpreter.h
@@ -101,6 +101,7 @@ public:
const ASTContext &getASTContext() const;
ASTContext &getASTContext();
const CompilerInstance *getCompilerInstance() const;
+ CompilerInstance *getCompilerInstance();
llvm::Expected<llvm::orc::LLJIT &> getExecutionEngine();
llvm::Expected<PartialTranslationUnit &> Parse(llvm::StringRef Code);
diff --git a/contrib/llvm-project/clang/include/clang/Sema/Sema.h b/contrib/llvm-project/clang/include/clang/Sema/Sema.h
index 20228da15ade..5e3b57ea3322 100644
--- a/contrib/llvm-project/clang/include/clang/Sema/Sema.h
+++ b/contrib/llvm-project/clang/include/clang/Sema/Sema.h
@@ -4799,8 +4799,6 @@ public:
bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
const AttributeCommonInfo &A);
- bool CheckCountedByAttr(Scope *Scope, const FieldDecl *FD);
-
/// Adjust the calling convention of a method to be the ABI default if it
/// wasn't specified explicitly. This handles method types formed from
/// function type typedefs and typename template arguments.
@@ -5644,7 +5642,6 @@ public:
CorrectionCandidateCallback &CCC,
TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
ArrayRef<Expr *> Args = std::nullopt,
- DeclContext *LookupCtx = nullptr,
TypoExpr **Out = nullptr);
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S,
@@ -9357,8 +9354,7 @@ public:
QualType DeduceTemplateSpecializationFromInitializer(
TypeSourceInfo *TInfo, const InitializedEntity &Entity,
- const InitializationKind &Kind, MultiExprArg Init,
- ParenListExpr *PL = nullptr);
+ const InitializationKind &Kind, MultiExprArg Init);
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name,
QualType Type, TypeSourceInfo *TSI,
@@ -13851,6 +13847,7 @@ private:
bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
bool ParseSVEImmChecks(CallExpr *TheCall,
SmallVector<std::tuple<int, int, int>, 3> &ImmChecks);
+ bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
CallExpr *TheCall);
bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
diff --git a/contrib/llvm-project/clang/include/clang/Sema/TypoCorrection.h b/contrib/llvm-project/clang/include/clang/Sema/TypoCorrection.h
index 09de164297e7..e0f8d152dbe5 100644
--- a/contrib/llvm-project/clang/include/clang/Sema/TypoCorrection.h
+++ b/contrib/llvm-project/clang/include/clang/Sema/TypoCorrection.h
@@ -282,7 +282,7 @@ class CorrectionCandidateCallback {
public:
static const unsigned InvalidDistance = TypoCorrection::InvalidDistance;
- explicit CorrectionCandidateCallback(const IdentifierInfo *Typo = nullptr,
+ explicit CorrectionCandidateCallback(IdentifierInfo *Typo = nullptr,
NestedNameSpecifier *TypoNNS = nullptr)
: Typo(Typo), TypoNNS(TypoNNS) {}
@@ -319,7 +319,7 @@ public:
/// this method.
virtual std::unique_ptr<CorrectionCandidateCallback> clone() = 0;
- void setTypoName(const IdentifierInfo *II) { Typo = II; }
+ void setTypoName(IdentifierInfo *II) { Typo = II; }
void setTypoNNS(NestedNameSpecifier *NNS) { TypoNNS = NNS; }
// Flags for context-dependent keywords. WantFunctionLikeCasts is only
@@ -345,13 +345,13 @@ protected:
candidate.getCorrectionSpecifier() == TypoNNS;
}
- const IdentifierInfo *Typo;
+ IdentifierInfo *Typo;
NestedNameSpecifier *TypoNNS;
};
class DefaultFilterCCC final : public CorrectionCandidateCallback {
public:
- explicit DefaultFilterCCC(const IdentifierInfo *Typo = nullptr,
+ explicit DefaultFilterCCC(IdentifierInfo *Typo = nullptr,
NestedNameSpecifier *TypoNNS = nullptr)
: CorrectionCandidateCallback(Typo, TypoNNS) {}
@@ -365,10 +365,6 @@ public:
template <class C>
class DeclFilterCCC final : public CorrectionCandidateCallback {
public:
- explicit DeclFilterCCC(const IdentifierInfo *Typo = nullptr,
- NestedNameSpecifier *TypoNNS = nullptr)
- : CorrectionCandidateCallback(Typo, TypoNNS) {}
-
bool ValidateCandidate(const TypoCorrection &candidate) override {
return candidate.getCorrectionDeclAs<C>();
}
diff --git a/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h b/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h
index 59358e77edb0..21d791f5cd89 100644
--- a/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h
+++ b/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h
@@ -2422,6 +2422,8 @@ public:
CurrentBitsIndex = 0;
}
+ void advance(uint32_t BitsWidth) { CurrentBitsIndex += BitsWidth; }
+
bool getNextBit() {
assert(isValid());
return Value & (1 << CurrentBitsIndex++);
diff --git a/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h b/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h
index a56929ef0245..de69f99003d8 100644
--- a/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h
+++ b/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h
@@ -564,11 +564,25 @@ private:
unsigned DeclEnumAbbrev = 0;
unsigned DeclObjCIvarAbbrev = 0;
unsigned DeclCXXMethodAbbrev = 0;
+ unsigned DeclDependentNonTemplateCXXMethodAbbrev = 0;
+ unsigned DeclTemplateCXXMethodAbbrev = 0;
+ unsigned DeclMemberSpecializedCXXMethodAbbrev = 0;
+ unsigned DeclTemplateSpecializedCXXMethodAbbrev = 0;
+ unsigned DeclDependentSpecializationCXXMethodAbbrev = 0;
+ unsigned DeclTemplateTypeParmAbbrev = 0;
+ unsigned DeclUsingShadowAbbrev = 0;
unsigned DeclRefExprAbbrev = 0;
unsigned CharacterLiteralAbbrev = 0;
unsigned IntegerLiteralAbbrev = 0;
unsigned ExprImplicitCastAbbrev = 0;
+ unsigned BinaryOperatorAbbrev = 0;
+ unsigned CompoundAssignOperatorAbbrev = 0;
+ unsigned CallExprAbbrev = 0;
+ unsigned CXXOperatorCallExprAbbrev = 0;
+ unsigned CXXMemberCallExprAbbrev = 0;
+
+ unsigned CompoundStmtAbbrev = 0;
void WriteDeclAbbrevs();
void WriteDecl(ASTContext &Context, Decl *D);
@@ -735,12 +749,41 @@ public:
unsigned getDeclFieldAbbrev() const { return DeclFieldAbbrev; }
unsigned getDeclEnumAbbrev() const { return DeclEnumAbbrev; }
unsigned getDeclObjCIvarAbbrev() const { return DeclObjCIvarAbbrev; }
- unsigned getDeclCXXMethodAbbrev() const { return DeclCXXMethodAbbrev; }
+ unsigned getDeclCXXMethodAbbrev(FunctionDecl::TemplatedKind Kind) const {
+ switch (Kind) {
+ case FunctionDecl::TK_NonTemplate:
+ return DeclCXXMethodAbbrev;
+ case FunctionDecl::TK_FunctionTemplate:
+ return DeclTemplateCXXMethodAbbrev;
+ case FunctionDecl::TK_MemberSpecialization:
+ return DeclMemberSpecializedCXXMethodAbbrev;
+ case FunctionDecl::TK_FunctionTemplateSpecialization:
+ return DeclTemplateSpecializedCXXMethodAbbrev;
+ case FunctionDecl::TK_DependentNonTemplate:
+ return DeclDependentNonTemplateCXXMethodAbbrev;
+ case FunctionDecl::TK_DependentFunctionTemplateSpecialization:
+ return DeclDependentSpecializationCXXMethodAbbrev;
+ }
+ llvm_unreachable("Unknwon Template Kind!");
+ }
+ unsigned getDeclTemplateTypeParmAbbrev() const {
+ return DeclTemplateTypeParmAbbrev;
+ }
+ unsigned getDeclUsingShadowAbbrev() const { return DeclUsingShadowAbbrev; }
unsigned getDeclRefExprAbbrev() const { return DeclRefExprAbbrev; }
unsigned getCharacterLiteralAbbrev() const { return CharacterLiteralAbbrev; }
unsigned getIntegerLiteralAbbrev() const { return IntegerLiteralAbbrev; }
unsigned getExprImplicitCastAbbrev() const { return ExprImplicitCastAbbrev; }
+ unsigned getBinaryOperatorAbbrev() const { return BinaryOperatorAbbrev; }
+ unsigned getCompoundAssignOperatorAbbrev() const {
+ return CompoundAssignOperatorAbbrev;
+ }
+ unsigned getCallExprAbbrev() const { return CallExprAbbrev; }
+ unsigned getCXXOperatorCallExprAbbrev() { return CXXOperatorCallExprAbbrev; }
+ unsigned getCXXMemberCallExprAbbrev() { return CXXMemberCallExprAbbrev; }
+
+ unsigned getCompoundStmtAbbrev() const { return CompoundStmtAbbrev; }
bool hasChain() const { return Chain; }
ASTReader *getChain() const { return Chain; }
@@ -841,46 +884,33 @@ public:
BitsPacker(BitsPacker &&) = delete;
BitsPacker operator=(const BitsPacker &) = delete;
BitsPacker operator=(BitsPacker &&) = delete;
- ~BitsPacker() {
- assert(!hasUnconsumedValues() && "There are unprocessed bits!");
+ ~BitsPacker() = default;
+
+ bool canWriteNextNBits(uint32_t BitsWidth) const {
+ return CurrentBitIndex + BitsWidth < BitIndexUpbound;
+ }
+
+ void reset(uint32_t Value) {
+ UnderlyingValue = Value;
+ CurrentBitIndex = 0;
}
void addBit(bool Value) { addBits(Value, 1); }
void addBits(uint32_t Value, uint32_t BitsWidth) {
assert(BitsWidth < BitIndexUpbound);
assert((Value < (1u << BitsWidth)) && "Passing narrower bit width!");
+ assert(canWriteNextNBits(BitsWidth) &&
+ "Inserting too much bits into a value!");
- if (CurrentBitIndex + BitsWidth >= BitIndexUpbound) {
- Values.push_back(0);
- CurrentBitIndex = 0;
- }
-
- assert(CurrentBitIndex < BitIndexUpbound);
- Values.back() |= Value << CurrentBitIndex;
+ UnderlyingValue |= Value << CurrentBitIndex;
CurrentBitIndex += BitsWidth;
}
- bool hasUnconsumedValues() const {
- return ConsumingValueIndex < Values.size();
- }
- uint32_t getNextValue() {
- assert(hasUnconsumedValues());
- return Values[ConsumingValueIndex++];
- }
-
- // We can convert the packer to an uint32_t if there is only one values.
- operator uint32_t() {
- assert(Values.size() == 1);
- return getNextValue();
- }
+ operator uint32_t() { return UnderlyingValue; }
private:
- SmallVector<uint64_t, 4> Values;
- uint16_t ConsumingValueIndex = 0;
- // Initialize CurrentBitIndex with an invalid value
- // to make it easier to update Values. See the implementation
- // of `addBits` to see the details.
- uint16_t CurrentBitIndex = BitIndexUpbound;
+ uint32_t UnderlyingValue = 0;
+ uint32_t CurrentBitIndex = 0;
};
} // namespace clang
diff --git a/contrib/llvm-project/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/contrib/llvm-project/clang/include/clang/Support/RISCVVIntrinsicUtils.h
index 49ce32553da8..c525d3443331 100644
--- a/contrib/llvm-project/clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ b/contrib/llvm-project/clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -485,7 +485,7 @@ public:
// RVVRequire should be sync'ed with target features, but only
// required features used in riscv_vector.td.
-enum RVVRequire : uint16_t {
+enum RVVRequire : uint32_t {
RVV_REQ_None = 0,
RVV_REQ_RV64 = 1 << 0,
RVV_REQ_ZvfhminOrZvfh = 1 << 1,
@@ -503,8 +503,9 @@ enum RVVRequire : uint16_t {
RVV_REQ_Zvknhb = 1 << 13,
RVV_REQ_Zvksed = 1 << 14,
RVV_REQ_Zvksh = 1 << 15,
+ RVV_REQ_Experimental = 1 << 16,
- LLVM_MARK_AS_BITMASK_ENUM(RVV_REQ_Zvksh)
+ LLVM_MARK_AS_BITMASK_ENUM(RVV_REQ_Experimental)
};
// Raw RVV intrinsic info, used to expand later.
@@ -536,7 +537,7 @@ struct RVVIntrinsicRecord {
uint8_t OverloadedSuffixSize;
// Required target features for this intrinsic.
- uint16_t RequiredExtensions;
+ uint32_t RequiredExtensions;
// Supported type, mask of BasicType.
uint8_t TypeRangeMask;
diff --git a/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp b/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp
index a921c8b9fce3..d3aef09dac91 100644
--- a/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp
+++ b/contrib/llvm-project/clang/lib/APINotes/APINotesManager.cpp
@@ -125,7 +125,7 @@ APINotesManager::loadAPINotes(StringRef Buffer) {
bool APINotesManager::loadAPINotes(const DirectoryEntry *HeaderDir,
FileEntryRef APINotesFile) {
- assert(Readers.find(HeaderDir) == Readers.end());
+ assert(!Readers.contains(HeaderDir));
if (auto Reader = loadAPINotes(APINotesFile)) {
Readers[HeaderDir] = Reader.release();
return false;
diff --git a/contrib/llvm-project/clang/lib/AST/ASTImporter.cpp b/contrib/llvm-project/clang/lib/AST/ASTImporter.cpp
index f1f335118f37..b61180c4f349 100644
--- a/contrib/llvm-project/clang/lib/AST/ASTImporter.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ASTImporter.cpp
@@ -2771,9 +2771,11 @@ ASTNodeImporter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) {
for (auto *FoundDecl : FoundDecls) {
if (!FoundDecl->isInIdentifierNamespace(IDNS))
continue;
- if (auto *FoundAlias = dyn_cast<TypeAliasTemplateDecl>(FoundDecl))
- return Importer.MapImported(D, FoundAlias);
- ConflictingDecls.push_back(FoundDecl);
+ if (auto *FoundAlias = dyn_cast<TypeAliasTemplateDecl>(FoundDecl)) {
+ if (IsStructuralMatch(D, FoundAlias))
+ return Importer.MapImported(D, FoundAlias);
+ ConflictingDecls.push_back(FoundDecl);
+ }
}
if (!ConflictingDecls.empty()) {
@@ -3418,10 +3420,16 @@ static bool isAncestorDeclContextOf(const DeclContext *DC, const Stmt *S) {
while (!ToProcess.empty()) {
const Stmt *CurrentS = ToProcess.pop_back_val();
ToProcess.append(CurrentS->child_begin(), CurrentS->child_end());
- if (const auto *DeclRef = dyn_cast<DeclRefExpr>(CurrentS))
+ if (const auto *DeclRef = dyn_cast<DeclRefExpr>(CurrentS)) {
if (const Decl *D = DeclRef->getDecl())
if (isAncestorDeclContextOf(DC, D))
return true;
+ } else if (const auto *E =
+ dyn_cast_or_null<SubstNonTypeTemplateParmExpr>(CurrentS)) {
+ if (const Decl *D = E->getAssociatedDecl())
+ if (isAncestorDeclContextOf(DC, D))
+ return true;
+ }
}
return false;
}
@@ -7820,6 +7828,18 @@ ExpectedStmt ASTNodeImporter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
*ToLParenLocOrErr, OCE->getBridgeKind(), E->getCastKind(),
*ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr);
}
+ case Stmt::BuiltinBitCastExprClass: {
+ auto *BBC = cast<BuiltinBitCastExpr>(E);
+ ExpectedSLoc ToKWLocOrErr = import(BBC->getBeginLoc());
+ if (!ToKWLocOrErr)
+ return ToKWLocOrErr.takeError();
+ ExpectedSLoc ToRParenLocOrErr = import(BBC->getEndLoc());
+ if (!ToRParenLocOrErr)
+ return ToRParenLocOrErr.takeError();
+ return new (Importer.getToContext()) BuiltinBitCastExpr(
+ ToType, E->getValueKind(), E->getCastKind(), ToSubExpr,
+ ToTypeInfoAsWritten, *ToKWLocOrErr, *ToRParenLocOrErr);
+ }
default:
llvm_unreachable("Cast expression of unsupported type!");
return make_error<ASTImportError>(ASTImportError::UnsupportedConstruct);
@@ -9003,10 +9023,6 @@ class AttrImporter {
public:
AttrImporter(ASTImporter &I) : Importer(I), NImporter(I) {}
- // Useful for accessing the imported attribute.
- template <typename T> T *castAttrAs() { return cast<T>(ToAttr); }
- template <typename T> const T *castAttrAs() const { return cast<T>(ToAttr); }
-
// Create an "importer" for an attribute parameter.
// Result of the 'value()' of that object is to be passed to the function
// 'importAttr', in the order that is expected by the attribute class.
@@ -9101,6 +9117,12 @@ Expected<Attr *> ASTImporter::Import(const Attr *FromAttr) {
break;
}
+ case attr::AlignValue: {
+ auto *From = cast<AlignValueAttr>(FromAttr);
+ AI.importAttr(From, AI.importArg(From->getAlignment()).value());
+ break;
+ }
+
case attr::Format: {
const auto *From = cast<FormatAttr>(FromAttr);
AI.importAttr(From, Import(From->getType()), From->getFormatIdx(),
@@ -9214,15 +9236,6 @@ Expected<Attr *> ASTImporter::Import(const Attr *FromAttr) {
From->args_size());
break;
}
- case attr::CountedBy: {
- AI.cloneAttr(FromAttr);
- const auto *CBA = cast<CountedByAttr>(FromAttr);
- Expected<SourceRange> SR = Import(CBA->getCountedByFieldLoc()).get();
- if (!SR)
- return SR.takeError();
- AI.castAttrAs<CountedByAttr>()->setCountedByFieldLoc(SR.get());
- break;
- }
default: {
// The default branch works for attributes that have no arguments to import.
@@ -9391,7 +9404,6 @@ Expected<Decl *> ASTImporter::Import(Decl *FromD) {
setImportDeclError(FromD, *Error);
return make_error<ASTImportError>(*Error);
}
-
// Make sure that ImportImpl registered the imported decl.
assert(ImportedDecls.count(FromD) != 0 && "Missing call to MapImported?");
if (auto Error = ImportAttrs(ToD, FromD))
diff --git a/contrib/llvm-project/clang/lib/AST/ASTStructuralEquivalence.cpp b/contrib/llvm-project/clang/lib/AST/ASTStructuralEquivalence.cpp
index 6bb4bf14b873..1f492b051e03 100644
--- a/contrib/llvm-project/clang/lib/AST/ASTStructuralEquivalence.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ASTStructuralEquivalence.cpp
@@ -1978,6 +1978,18 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
}
static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
+ TypeAliasTemplateDecl *D1,
+ TypeAliasTemplateDecl *D2) {
+ // Check template parameters.
+ if (!IsTemplateDeclCommonStructurallyEquivalent(Context, D1, D2))
+ return false;
+
+ // Check the templated declaration.
+ return IsStructurallyEquivalent(Context, D1->getTemplatedDecl(),
+ D2->getTemplatedDecl());
+}
+
+static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
ConceptDecl *D1,
ConceptDecl *D2) {
// Check template parameters.
diff --git a/contrib/llvm-project/clang/lib/AST/Decl.cpp b/contrib/llvm-project/clang/lib/AST/Decl.cpp
index 527ea6042daa..12e0a6faa4c3 100644
--- a/contrib/llvm-project/clang/lib/AST/Decl.cpp
+++ b/contrib/llvm-project/clang/lib/AST/Decl.cpp
@@ -1088,11 +1088,11 @@ bool NamedDecl::isPlaceholderVar(const LangOptions &LangOpts) const {
return false;
if (isa<FieldDecl>(this))
return true;
- if (auto *IFD = dyn_cast<IndirectFieldDecl>(this)) {
+ if (const auto *IFD = dyn_cast<IndirectFieldDecl>(this)) {
if (!getDeclContext()->isFunctionOrMethod() &&
!getDeclContext()->isRecord())
return false;
- VarDecl *VD = IFD->getVarDecl();
+ const VarDecl *VD = IFD->getVarDecl();
return !VD || VD->getStorageDuration() == SD_Automatic;
}
// and it declares a variable with automatic storage duration
@@ -1105,7 +1105,7 @@ bool NamedDecl::isPlaceholderVar(const LangOptions &LangOpts) const {
}
if (const auto *BD = dyn_cast<BindingDecl>(this);
BD && getDeclContext()->isFunctionOrMethod()) {
- VarDecl *VD = BD->getHoldingVar();
+ const VarDecl *VD = BD->getHoldingVar();
return !VD || VD->getStorageDuration() == StorageDuration::SD_Automatic;
}
return false;
@@ -1843,7 +1843,8 @@ static bool isRedeclarable(Decl::Kind K) {
llvm_unreachable("unknown decl kind");
}
-bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
+bool NamedDecl::declarationReplaces(const NamedDecl *OldD,
+ bool IsKnownNewer) const {
assert(getDeclName() == OldD->getDeclName() && "Declaration name mismatch");
// Never replace one imported declaration with another; we need both results
@@ -1873,13 +1874,13 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
// Using declarations can be replaced if they import the same name from the
// same context.
- if (auto *UD = dyn_cast<UsingDecl>(this)) {
+ if (const auto *UD = dyn_cast<UsingDecl>(this)) {
ASTContext &Context = getASTContext();
return Context.getCanonicalNestedNameSpecifier(UD->getQualifier()) ==
Context.getCanonicalNestedNameSpecifier(
cast<UsingDecl>(OldD)->getQualifier());
}
- if (auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(this)) {
+ if (const auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(this)) {
ASTContext &Context = getASTContext();
return Context.getCanonicalNestedNameSpecifier(UUVD->getQualifier()) ==
Context.getCanonicalNestedNameSpecifier(
@@ -1896,7 +1897,7 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
// Check whether this is actually newer than OldD. We want to keep the
// newer declaration. This loop will usually only iterate once, because
// OldD is usually the previous declaration.
- for (auto *D : redecls()) {
+ for (const auto *D : redecls()) {
if (D == OldD)
break;
@@ -2199,8 +2200,7 @@ static LanguageLinkage getDeclLanguageLinkage(const T &D) {
// Language linkage is a C++ concept, but saying that everything else in C has
// C language linkage fits the implementation nicely.
- ASTContext &Context = D.getASTContext();
- if (!Context.getLangOpts().CPlusPlus)
+ if (!D.getASTContext().getLangOpts().CPlusPlus)
return CLanguageLinkage;
// C++ [dcl.link]p4: A C language linkage is ignored in determining the
@@ -2943,7 +2943,7 @@ bool ParmVarDecl::isDestroyedInCallee() const {
// FIXME: isParamDestroyedInCallee() should probably imply
// isDestructedType()
- auto *RT = getType()->getAs<RecordType>();
+ const auto *RT = getType()->getAs<RecordType>();
if (RT && RT->getDecl()->isParamDestroyedInCallee() &&
getType().isDestructedType())
return true;
@@ -3105,7 +3105,7 @@ FunctionDecl::getDefaultedFunctionInfo() const {
}
bool FunctionDecl::hasBody(const FunctionDecl *&Definition) const {
- for (auto *I : redecls()) {
+ for (const auto *I : redecls()) {
if (I->doesThisDeclarationHaveABody()) {
Definition = I;
return true;
@@ -3116,7 +3116,7 @@ bool FunctionDecl::hasBody(const FunctionDecl *&Definition) const {
}
bool FunctionDecl::hasTrivialBody() const {
- Stmt *S = getBody();
+ const Stmt *S = getBody();
if (!S) {
// Since we don't have a body for this function, we don't know if it's
// trivial or not.
@@ -3212,7 +3212,7 @@ void FunctionDecl::setPure(bool P) {
template<std::size_t Len>
static bool isNamed(const NamedDecl *ND, const char (&Str)[Len]) {
- IdentifierInfo *II = ND->getIdentifier();
+ const IdentifierInfo *II = ND->getIdentifier();
return II && II->isStr(Str);
}
@@ -3305,9 +3305,9 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const {
if (proto->getNumParams() != 2 || proto->isVariadic())
return false;
- ASTContext &Context =
- cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext())
- ->getASTContext();
+ const ASTContext &Context =
+ cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext())
+ ->getASTContext();
// The result type and first argument type are constant across all
// these operators. The second argument must be exactly void*.
@@ -3342,7 +3342,7 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction(
unsigned Params = 1;
QualType Ty = FPT->getParamType(Params);
- ASTContext &Ctx = getASTContext();
+ const ASTContext &Ctx = getASTContext();
auto Consume = [&] {
++Params;
@@ -3388,7 +3388,8 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction(
QualType T = Ty;
while (const auto *TD = T->getAs<TypedefType>())
T = TD->getDecl()->getUnderlyingType();
- IdentifierInfo *II = T->castAs<EnumType>()->getDecl()->getIdentifier();
+ const IdentifierInfo *II =
+ T->castAs<EnumType>()->getDecl()->getIdentifier();
if (II && II->isStr("__hot_cold_t"))
Consume();
}
@@ -3586,7 +3587,7 @@ unsigned FunctionDecl::getBuiltinID(bool ConsiderWrapperFunctions) const {
(!hasAttr<ArmBuiltinAliasAttr>() && !hasAttr<BuiltinAliasAttr>()))
return 0;
- ASTContext &Context = getASTContext();
+ const ASTContext &Context = getASTContext();
if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
return BuiltinID;
@@ -3745,7 +3746,7 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
assert(!doesThisDeclarationHaveABody() &&
"Must have a declaration without a body.");
- ASTContext &Context = getASTContext();
+ const ASTContext &Context = getASTContext();
if (Context.getLangOpts().MSVCCompat) {
const FunctionDecl *Definition;
diff --git a/contrib/llvm-project/clang/lib/AST/DeclBase.cpp b/contrib/llvm-project/clang/lib/AST/DeclBase.cpp
index e4d7169752bc..5e03f0223d31 100644
--- a/contrib/llvm-project/clang/lib/AST/DeclBase.cpp
+++ b/contrib/llvm-project/clang/lib/AST/DeclBase.cpp
@@ -29,6 +29,7 @@
#include "clang/AST/Type.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
+#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/PartialDiagnostic.h"
@@ -410,79 +411,6 @@ bool Decl::isFileContextDecl() const {
return DC && DC->isFileContext();
}
-bool Decl::isFlexibleArrayMemberLike(
- ASTContext &Ctx, const Decl *D, QualType Ty,
- LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel,
- bool IgnoreTemplateOrMacroSubstitution) {
- // For compatibility with existing code, we treat arrays of length 0 or
- // 1 as flexible array members.
- const auto *CAT = Ctx.getAsConstantArrayType(Ty);
- if (CAT) {
- using FAMKind = LangOptions::StrictFlexArraysLevelKind;
-
- llvm::APInt Size = CAT->getSize();
- if (StrictFlexArraysLevel == FAMKind::IncompleteOnly)
- return false;
-
- // GCC extension, only allowed to represent a FAM.
- if (Size.isZero())
- return true;
-
- if (StrictFlexArraysLevel == FAMKind::ZeroOrIncomplete && Size.uge(1))
- return false;
-
- if (StrictFlexArraysLevel == FAMKind::OneZeroOrIncomplete && Size.uge(2))
- return false;
- } else if (!Ctx.getAsIncompleteArrayType(Ty)) {
- return false;
- }
-
- if (const auto *OID = dyn_cast_if_present<ObjCIvarDecl>(D))
- return OID->getNextIvar() == nullptr;
-
- const auto *FD = dyn_cast_if_present<FieldDecl>(D);
- if (!FD)
- return false;
-
- if (CAT) {
- // GCC treats an array memeber of a union as an FAM if the size is one or
- // zero.
- llvm::APInt Size = CAT->getSize();
- if (FD->getParent()->isUnion() && (Size.isZero() || Size.isOne()))
- return true;
- }
-
- // Don't consider sizes resulting from macro expansions or template argument
- // substitution to form C89 tail-padded arrays.
- if (IgnoreTemplateOrMacroSubstitution) {
- TypeSourceInfo *TInfo = FD->getTypeSourceInfo();
- while (TInfo) {
- TypeLoc TL = TInfo->getTypeLoc();
-
- // Look through typedefs.
- if (TypedefTypeLoc TTL = TL.getAsAdjusted<TypedefTypeLoc>()) {
- const TypedefNameDecl *TDL = TTL.getTypedefNameDecl();
- TInfo = TDL->getTypeSourceInfo();
- continue;
- }
-
- if (auto CTL = TL.getAs<ConstantArrayTypeLoc>()) {
- if (const Expr *SizeExpr =
- dyn_cast_if_present<IntegerLiteral>(CTL.getSizeExpr());
- !SizeExpr || SizeExpr->getExprLoc().isMacroID())
- return false;
- }
-
- break;
- }
- }
-
- // Test that the field is the last in the structure.
- RecordDecl::field_iterator FI(
- DeclContext::decl_iterator(const_cast<FieldDecl *>(FD)));
- return ++FI == FD->getParent()->field_end();
-}
-
TranslationUnitDecl *Decl::getTranslationUnitDecl() {
if (auto *TUD = dyn_cast<TranslationUnitDecl>(this))
return TUD;
diff --git a/contrib/llvm-project/clang/lib/AST/Expr.cpp b/contrib/llvm-project/clang/lib/AST/Expr.cpp
index b125fc676da8..a90f92d07f86 100644
--- a/contrib/llvm-project/clang/lib/AST/Expr.cpp
+++ b/contrib/llvm-project/clang/lib/AST/Expr.cpp
@@ -205,22 +205,85 @@ bool Expr::isKnownToHaveBooleanValue(bool Semantic) const {
}
bool Expr::isFlexibleArrayMemberLike(
- ASTContext &Ctx,
+ ASTContext &Context,
LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel,
bool IgnoreTemplateOrMacroSubstitution) const {
+
+ // For compatibility with existing code, we treat arrays of length 0 or
+ // 1 as flexible array members.
+ const auto *CAT = Context.getAsConstantArrayType(getType());
+ if (CAT) {
+ llvm::APInt Size = CAT->getSize();
+
+ using FAMKind = LangOptions::StrictFlexArraysLevelKind;
+
+ if (StrictFlexArraysLevel == FAMKind::IncompleteOnly)
+ return false;
+
+ // GCC extension, only allowed to represent a FAM.
+ if (Size == 0)
+ return true;
+
+ if (StrictFlexArraysLevel == FAMKind::ZeroOrIncomplete && Size.uge(1))
+ return false;
+
+ if (StrictFlexArraysLevel == FAMKind::OneZeroOrIncomplete && Size.uge(2))
+ return false;
+ } else if (!Context.getAsIncompleteArrayType(getType()))
+ return false;
+
const Expr *E = IgnoreParens();
- const Decl *D = nullptr;
- if (const auto *ME = dyn_cast<MemberExpr>(E))
- D = ME->getMemberDecl();
- else if (const auto *DRE = dyn_cast<DeclRefExpr>(E))
- D = DRE->getDecl();
+ const NamedDecl *ND = nullptr;
+ if (const auto *DRE = dyn_cast<DeclRefExpr>(E))
+ ND = DRE->getDecl();
+ else if (const auto *ME = dyn_cast<MemberExpr>(E))
+ ND = ME->getMemberDecl();
else if (const auto *IRE = dyn_cast<ObjCIvarRefExpr>(E))
- D = IRE->getDecl();
+ return IRE->getDecl()->getNextIvar() == nullptr;
+
+ if (!ND)
+ return false;
- return Decl::isFlexibleArrayMemberLike(Ctx, D, E->getType(),
- StrictFlexArraysLevel,
- IgnoreTemplateOrMacroSubstitution);
+ // A flexible array member must be the last member in the class.
+ // FIXME: If the base type of the member expr is not FD->getParent(),
+ // this should not be treated as a flexible array member access.
+ if (const auto *FD = dyn_cast<FieldDecl>(ND)) {
+ // GCC treats an array memeber of a union as an FAM if the size is one or
+ // zero.
+ if (CAT) {
+ llvm::APInt Size = CAT->getSize();
+ if (FD->getParent()->isUnion() && (Size.isZero() || Size.isOne()))
+ return true;
+ }
+
+ // Don't consider sizes resulting from macro expansions or template argument
+ // substitution to form C89 tail-padded arrays.
+ if (IgnoreTemplateOrMacroSubstitution) {
+ TypeSourceInfo *TInfo = FD->getTypeSourceInfo();
+ while (TInfo) {
+ TypeLoc TL = TInfo->getTypeLoc();
+ // Look through typedefs.
+ if (TypedefTypeLoc TTL = TL.getAsAdjusted<TypedefTypeLoc>()) {
+ const TypedefNameDecl *TDL = TTL.getTypedefNameDecl();
+ TInfo = TDL->getTypeSourceInfo();
+ continue;
+ }
+ if (ConstantArrayTypeLoc CTL = TL.getAs<ConstantArrayTypeLoc>()) {
+ const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL.getSizeExpr());
+ if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
+ return false;
+ }
+ break;
+ }
+ }
+
+ RecordDecl::field_iterator FI(
+ DeclContext::decl_iterator(const_cast<FieldDecl *>(FD)));
+ return ++FI == FD->getParent()->field_end();
+ }
+
+ return false;
}
const ValueDecl *
diff --git a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index b98037b73645..96fe6df88dbb 100644
--- a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -726,27 +726,70 @@ void Environment::setStorageLocation(const Expr &E, StorageLocation &Loc) {
// so allow these as an exception.
assert(E.isGLValue() ||
E.getType()->isSpecificBuiltinType(BuiltinType::BuiltinFn));
- setStorageLocationInternal(E, Loc);
+ const Expr &CanonE = ignoreCFGOmittedNodes(E);
+ assert(!ExprToLoc.contains(&CanonE));
+ ExprToLoc[&CanonE] = &Loc;
}
StorageLocation *Environment::getStorageLocation(const Expr &E) const {
// See comment in `setStorageLocation()`.
assert(E.isGLValue() ||
E.getType()->isSpecificBuiltinType(BuiltinType::BuiltinFn));
- return getStorageLocationInternal(E);
+ auto It = ExprToLoc.find(&ignoreCFGOmittedNodes(E));
+ return It == ExprToLoc.end() ? nullptr : &*It->second;
+}
+
+// Returns whether a prvalue of record type is the one that originally
+// constructs the object (i.e. it doesn't propagate it from one of its
+// children).
+static bool isOriginalRecordConstructor(const Expr &RecordPRValue) {
+ if (auto *Init = dyn_cast<InitListExpr>(&RecordPRValue))
+ return !Init->isSemanticForm() || !Init->isTransparent();
+ return isa<CXXConstructExpr>(RecordPRValue) || isa<CallExpr>(RecordPRValue) ||
+ isa<LambdaExpr>(RecordPRValue) ||
+ // The framework currently does not propagate the objects created in
+ // the two branches of a `ConditionalOperator` because there is no way
+ // to reconcile their storage locations, which are different. We
+ // therefore claim that the `ConditionalOperator` is the expression
+ // that originally constructs the object.
+ // Ultimately, this will be fixed by propagating locations down from
+ // the result object, rather than up from the original constructor as
+ // we do now (see also the FIXME in the documentation for
+ // `getResultObjectLocation()`).
+ isa<ConditionalOperator>(RecordPRValue);
}
RecordStorageLocation &
-Environment::getResultObjectLocation(const Expr &RecordPRValue) {
+Environment::getResultObjectLocation(const Expr &RecordPRValue) const {
assert(RecordPRValue.getType()->isRecordType());
assert(RecordPRValue.isPRValue());
- if (StorageLocation *ExistingLoc = getStorageLocationInternal(RecordPRValue))
- return *cast<RecordStorageLocation>(ExistingLoc);
- auto &Loc = cast<RecordStorageLocation>(
- DACtx->getStableStorageLocation(RecordPRValue));
- setStorageLocationInternal(RecordPRValue, Loc);
- return Loc;
+ // Returns a storage location that we can use if assertions fail.
+ auto FallbackForAssertFailure =
+ [this, &RecordPRValue]() -> RecordStorageLocation & {
+ return cast<RecordStorageLocation>(
+ DACtx->getStableStorageLocation(RecordPRValue));
+ };
+
+ if (isOriginalRecordConstructor(RecordPRValue)) {
+ auto *Val = cast_or_null<RecordValue>(getValue(RecordPRValue));
+ // The builtin transfer function should have created a `RecordValue` for all
+ // original record constructors.
+ assert(Val);
+ if (!Val)
+ return FallbackForAssertFailure();
+ return Val->getLoc();
+ }
+
+ // Expression nodes that propagate a record prvalue should have exactly one
+ // child.
+ llvm::SmallVector<const Stmt *> children(RecordPRValue.child_begin(),
+ RecordPRValue.child_end());
+ assert(children.size() == 1);
+ if (children.empty())
+ return FallbackForAssertFailure();
+
+ return getResultObjectLocation(*cast<Expr>(children[0]));
}
PointerValue &Environment::getOrCreateNullPointerValue(QualType PointeeType) {
@@ -760,6 +803,11 @@ void Environment::setValue(const StorageLocation &Loc, Value &Val) {
}
void Environment::setValue(const Expr &E, Value &Val) {
+ if (auto *RecordVal = dyn_cast<RecordValue>(&Val)) {
+ assert(isOriginalRecordConstructor(E) ||
+ &RecordVal->getLoc() == &getResultObjectLocation(E));
+ }
+
assert(E.isPRValue());
ExprToVal[&E] = &Val;
}
@@ -799,18 +847,6 @@ Value *Environment::createValue(QualType Type) {
return Val;
}
-void Environment::setStorageLocationInternal(const Expr &E,
- StorageLocation &Loc) {
- const Expr &CanonE = ignoreCFGOmittedNodes(E);
- assert(!ExprToLoc.contains(&CanonE));
- ExprToLoc[&CanonE] = &Loc;
-}
-
-StorageLocation *Environment::getStorageLocationInternal(const Expr &E) const {
- auto It = ExprToLoc.find(&ignoreCFGOmittedNodes(E));
- return It == ExprToLoc.end() ? nullptr : &*It->second;
-}
-
Value *Environment::createValueUnlessSelfReferential(
QualType Type, llvm::DenseSet<QualType> &Visited, int Depth,
int &CreatedValuesCount) {
@@ -998,7 +1034,7 @@ RecordStorageLocation *getImplicitObjectLocation(const CXXMemberCallExpr &MCE,
if (ImplicitObject == nullptr)
return nullptr;
if (ImplicitObject->getType()->isPointerType()) {
- if (auto *Val = cast_or_null<PointerValue>(Env.getValue(*ImplicitObject)))
+ if (auto *Val = Env.get<PointerValue>(*ImplicitObject))
return &cast<RecordStorageLocation>(Val->getPointeeLoc());
return nullptr;
}
@@ -1012,11 +1048,11 @@ RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME,
if (Base == nullptr)
return nullptr;
if (ME.isArrow()) {
- if (auto *Val = cast_or_null<PointerValue>(Env.getValue(*Base)))
+ if (auto *Val = Env.get<PointerValue>(*Base))
return &cast<RecordStorageLocation>(Val->getPointeeLoc());
return nullptr;
}
- return cast_or_null<RecordStorageLocation>(Env.getStorageLocation(*Base));
+ return Env.get<RecordStorageLocation>(*Base);
}
std::vector<FieldDecl *> getFieldsForInitListExpr(const RecordDecl *RD) {
@@ -1041,9 +1077,10 @@ RecordValue &refreshRecordValue(const Expr &Expr, Environment &Env) {
assert(Expr.getType()->isRecordType());
if (Expr.isPRValue()) {
- if (auto *ExistingVal = cast_or_null<RecordValue>(Env.getValue(Expr))) {
+ if (auto *ExistingVal = Env.get<RecordValue>(Expr)) {
auto &NewVal = Env.create<RecordValue>(ExistingVal->getLoc());
Env.setValue(Expr, NewVal);
+ Env.setValue(NewVal.getLoc(), NewVal);
return NewVal;
}
@@ -1052,8 +1089,7 @@ RecordValue &refreshRecordValue(const Expr &Expr, Environment &Env) {
return NewVal;
}
- if (auto *Loc =
- cast_or_null<RecordStorageLocation>(Env.getStorageLocation(Expr))) {
+ if (auto *Loc = Env.get<RecordStorageLocation>(Expr)) {
auto &NewVal = Env.create<RecordValue>(*Loc);
Env.setValue(*Loc, NewVal);
return NewVal;
diff --git a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
index 69ac2c2b82cf..1d31b22b6d25 100644
--- a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -226,7 +226,7 @@ auto isComparisonOperatorCall(L lhs_arg_matcher, R rhs_arg_matcher) {
/// Ensures that `Expr` is mapped to a `BoolValue` and returns its formula.
const Formula &forceBoolValue(Environment &Env, const Expr &Expr) {
- auto *Value = cast_or_null<BoolValue>(Env.getValue(Expr));
+ auto *Value = Env.get<BoolValue>(Expr);
if (Value != nullptr)
return Value->formula();
@@ -267,7 +267,7 @@ BoolValue *getHasValue(Environment &Env, RecordStorageLocation *OptionalLoc) {
if (OptionalLoc == nullptr)
return nullptr;
StorageLocation &HasValueLoc = locForHasValue(*OptionalLoc);
- auto *HasValueVal = cast_or_null<BoolValue>(Env.getValue(HasValueLoc));
+ auto *HasValueVal = Env.get<BoolValue>(HasValueLoc);
if (HasValueVal == nullptr) {
HasValueVal = &Env.makeAtomicBoolValue();
Env.setValue(HasValueLoc, *HasValueVal);
@@ -406,7 +406,7 @@ void transferCallReturningOptional(const CallExpr *E,
if (E->isPRValue()) {
Loc = &State.Env.getResultObjectLocation(*E);
} else {
- Loc = cast_or_null<RecordStorageLocation>(State.Env.getStorageLocation(*E));
+ Loc = State.Env.get<RecordStorageLocation>(*E);
if (Loc == nullptr) {
Loc = &cast<RecordStorageLocation>(State.Env.createStorageLocation(*E));
State.Env.setStorageLocation(*E, *Loc);
@@ -449,8 +449,7 @@ BoolValue &valueOrConversionHasValue(const FunctionDecl &F, const Expr &E,
// This is a constructor/assignment call for `optional<T>` with argument of
// type `optional<U>` such that `T` is constructible from `U`.
- auto *Loc =
- cast_or_null<RecordStorageLocation>(State.Env.getStorageLocation(E));
+ auto *Loc = State.Env.get<RecordStorageLocation>(E);
if (auto *HasValueVal = getHasValue(State.Env, Loc))
return *HasValueVal;
return State.Env.makeAtomicBoolValue();
@@ -471,8 +470,7 @@ void transferAssignment(const CXXOperatorCallExpr *E, BoolValue &HasValueVal,
LatticeTransferState &State) {
assert(E->getNumArgs() > 0);
- if (auto *Loc = cast_or_null<RecordStorageLocation>(
- State.Env.getStorageLocation(*E->getArg(0)))) {
+ if (auto *Loc = State.Env.get<RecordStorageLocation>(*E->getArg(0))) {
createOptionalValue(*Loc, HasValueVal, State.Env);
// Assign a storage location for the whole expression.
@@ -534,18 +532,15 @@ void transferSwapCall(const CXXMemberCallExpr *E,
const MatchFinder::MatchResult &,
LatticeTransferState &State) {
assert(E->getNumArgs() == 1);
- auto *OtherLoc = cast_or_null<RecordStorageLocation>(
- State.Env.getStorageLocation(*E->getArg(0)));
+ auto *OtherLoc = State.Env.get<RecordStorageLocation>(*E->getArg(0));
transferSwap(getImplicitObjectLocation(*E, State.Env), OtherLoc, State.Env);
}
void transferStdSwapCall(const CallExpr *E, const MatchFinder::MatchResult &,
LatticeTransferState &State) {
assert(E->getNumArgs() == 2);
- auto *Arg0Loc = cast_or_null<RecordStorageLocation>(
- State.Env.getStorageLocation(*E->getArg(0)));
- auto *Arg1Loc = cast_or_null<RecordStorageLocation>(
- State.Env.getStorageLocation(*E->getArg(1)));
+ auto *Arg0Loc = State.Env.get<RecordStorageLocation>(*E->getArg(0));
+ auto *Arg1Loc = State.Env.get<RecordStorageLocation>(*E->getArg(1));
transferSwap(Arg0Loc, Arg1Loc, State.Env);
}
@@ -585,11 +580,9 @@ void transferOptionalAndOptionalCmp(const clang::CXXOperatorCallExpr *CmpExpr,
Environment &Env = State.Env;
auto &A = Env.arena();
auto *CmpValue = &forceBoolValue(Env, *CmpExpr);
- auto *Arg0Loc = cast_or_null<RecordStorageLocation>(
- Env.getStorageLocation(*CmpExpr->getArg(0)));
+ auto *Arg0Loc = Env.get<RecordStorageLocation>(*CmpExpr->getArg(0));
if (auto *LHasVal = getHasValue(Env, Arg0Loc)) {
- auto *Arg1Loc = cast_or_null<RecordStorageLocation>(
- Env.getStorageLocation(*CmpExpr->getArg(1)));
+ auto *Arg1Loc = Env.get<RecordStorageLocation>(*CmpExpr->getArg(1));
if (auto *RHasVal = getHasValue(Env, Arg1Loc)) {
if (CmpExpr->getOperator() == clang::OO_ExclaimEqual)
CmpValue = &A.makeNot(*CmpValue);
@@ -603,7 +596,7 @@ void transferOptionalAndValueCmp(const clang::CXXOperatorCallExpr *CmpExpr,
const clang::Expr *E, Environment &Env) {
auto &A = Env.arena();
auto *CmpValue = &forceBoolValue(Env, *CmpExpr);
- auto *Loc = cast_or_null<RecordStorageLocation>(Env.getStorageLocation(*E));
+ auto *Loc = Env.get<RecordStorageLocation>(*E);
if (auto *HasVal = getHasValue(Env, Loc)) {
if (CmpExpr->getOperator() == clang::OO_ExclaimEqual)
CmpValue = &A.makeNot(*CmpValue);
@@ -616,7 +609,7 @@ void transferOptionalAndNulloptCmp(const clang::CXXOperatorCallExpr *CmpExpr,
const clang::Expr *E, Environment &Env) {
auto &A = Env.arena();
auto *CmpValue = &forceBoolValue(Env, *CmpExpr);
- auto *Loc = cast_or_null<RecordStorageLocation>(Env.getStorageLocation(*E));
+ auto *Loc = Env.get<RecordStorageLocation>(*E);
if (auto *HasVal = getHasValue(Env, Loc)) {
if (CmpExpr->getOperator() == clang::OO_ExclaimEqual)
CmpValue = &A.makeNot(*CmpValue);
diff --git a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/RecordOps.cpp b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/RecordOps.cpp
index caaf443382b0..da4dd6dc0785 100644
--- a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/RecordOps.cpp
+++ b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/RecordOps.cpp
@@ -66,19 +66,8 @@ void clang::dataflow::copyRecord(RecordStorageLocation &Src,
}
}
- RecordValue *SrcVal = cast_or_null<RecordValue>(Env.getValue(Src));
- RecordValue *DstVal = cast_or_null<RecordValue>(Env.getValue(Dst));
-
- DstVal = &Env.create<RecordValue>(Dst);
+ RecordValue *DstVal = &Env.create<RecordValue>(Dst);
Env.setValue(Dst, *DstVal);
-
- if (SrcVal == nullptr)
- return;
-
- for (const auto &[Name, Value] : SrcVal->properties()) {
- if (Value != nullptr)
- DstVal->setProperty(Name, *Value);
- }
}
bool clang::dataflow::recordsEqual(const RecordStorageLocation &Loc1,
@@ -125,25 +114,5 @@ bool clang::dataflow::recordsEqual(const RecordStorageLocation &Loc1,
}
}
- llvm::StringMap<Value *> Props1, Props2;
-
- if (RecordValue *Val1 = cast_or_null<RecordValue>(Env1.getValue(Loc1)))
- for (const auto &[Name, Value] : Val1->properties())
- Props1[Name] = Value;
- if (RecordValue *Val2 = cast_or_null<RecordValue>(Env2.getValue(Loc2)))
- for (const auto &[Name, Value] : Val2->properties())
- Props2[Name] = Value;
-
- if (Props1.size() != Props2.size())
- return false;
-
- for (const auto &[Name, Value] : Props1) {
- auto It = Props2.find(Name);
- if (It == Props2.end())
- return false;
- if (Value != It->second)
- return false;
- }
-
return true;
}
diff --git a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Transfer.cpp
index bbf5f12359bc..55093c2e2cda 100644
--- a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Transfer.cpp
+++ b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/Transfer.cpp
@@ -339,8 +339,7 @@ public:
switch (S->getOpcode()) {
case UO_Deref: {
- const auto *SubExprVal =
- cast_or_null<PointerValue>(Env.getValue(*SubExpr));
+ const auto *SubExprVal = Env.get<PointerValue>(*SubExpr);
if (SubExprVal == nullptr)
break;
@@ -467,8 +466,7 @@ public:
const Expr *Arg = S->getArg(0);
assert(Arg != nullptr);
- auto *ArgLoc =
- cast_or_null<RecordStorageLocation>(Env.getStorageLocation(*Arg));
+ auto *ArgLoc = Env.get<RecordStorageLocation>(*Arg);
if (ArgLoc == nullptr)
return;
@@ -489,7 +487,6 @@ public:
if (S->getType()->isRecordType()) {
auto &InitialVal = *cast<RecordValue>(Env.createValue(S->getType()));
Env.setValue(*S, InitialVal);
- copyRecord(InitialVal.getLoc(), Env.getResultObjectLocation(*S), Env);
}
transferInlineCall(S, ConstructorDecl);
@@ -516,14 +513,12 @@ public:
RecordStorageLocation *LocSrc = nullptr;
if (Arg1->isPRValue()) {
- if (auto *Val = cast_or_null<RecordValue>(Env.getValue(*Arg1)))
+ if (auto *Val = Env.get<RecordValue>(*Arg1))
LocSrc = &Val->getLoc();
} else {
- LocSrc =
- cast_or_null<RecordStorageLocation>(Env.getStorageLocation(*Arg1));
+ LocSrc = Env.get<RecordStorageLocation>(*Arg1);
}
- auto *LocDst =
- cast_or_null<RecordStorageLocation>(Env.getStorageLocation(*Arg0));
+ auto *LocDst = Env.get<RecordStorageLocation>(*Arg0);
if (LocSrc == nullptr || LocDst == nullptr)
return;
@@ -582,6 +577,14 @@ public:
Env.setValue(*S, *ArgVal);
} else if (const FunctionDecl *F = S->getDirectCallee()) {
transferInlineCall(S, F);
+
+ // If this call produces a prvalue of record type, make sure that we have
+ // a `RecordValue` for it. This is required so that
+ // `Environment::getResultObjectLocation()` is able to return a location
+ // for this `CallExpr`.
+ if (S->getType()->isRecordType() && S->isPRValue())
+ if (Env.getValue(*S) == nullptr)
+ refreshRecordValue(*S, Env);
}
}
@@ -669,7 +672,7 @@ public:
auto Init = Inits[InitIdx++];
assert(Base.getType().getCanonicalType() ==
Init->getType().getCanonicalType());
- auto* BaseVal = cast_or_null<RecordValue>(Env.getValue(*Init));
+ auto *BaseVal = Env.get<RecordValue>(*Init);
if (!BaseVal)
BaseVal = cast<RecordValue>(Env.createValue(Init->getType()));
// Take ownership of the fields of the `RecordValue` for the base class
diff --git a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
index 8c9360235da7..faf83a8920d4 100644
--- a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
+++ b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
@@ -130,7 +130,7 @@ private:
if (Env.getValue(Cond) == nullptr)
transfer(StmtToEnv, Cond, Env);
- auto *Val = cast_or_null<BoolValue>(Env.getValue(Cond));
+ auto *Val = Env.get<BoolValue>(Cond);
// Value merging depends on flow conditions from different environments
// being mutually exclusive -- that is, they cannot both be true in their
// entirety (even if they may share some clauses). So, we need *some* value
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
index def16c032c86..3ee39133fcee 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
@@ -225,6 +225,7 @@ bool AArch64TargetInfo::validateBranchProtection(StringRef Spec, StringRef,
BPI.SignKey = LangOptions::SignReturnAddressKeyKind::BKey;
BPI.BranchTargetEnforcement = PBP.BranchTargetEnforcement;
+ BPI.BranchProtectionPAuthLR = PBP.BranchProtectionPAuthLR;
return true;
}
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp
index ce7e4d4639ce..6e1842fc64e5 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/ARM.cpp
@@ -419,6 +419,7 @@ bool ARMTargetInfo::validateBranchProtection(StringRef Spec, StringRef Arch,
BPI.SignKey = LangOptions::SignReturnAddressKeyKind::AKey;
BPI.BranchTargetEnforcement = PBP.BranchTargetEnforcement;
+ BPI.BranchProtectionPAuthLR = PBP.BranchProtectionPAuthLR;
return true;
}
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
index 60a4e0ed69c3..685462961ee3 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
@@ -350,6 +350,7 @@ bool RISCVTargetInfo::hasFeature(StringRef Feature) const {
.Case("riscv64", Is64Bit)
.Case("32bit", !Is64Bit)
.Case("64bit", Is64Bit)
+ .Case("experimental", HasExperimental)
.Default(std::nullopt);
if (Result)
return *Result;
@@ -382,6 +383,9 @@ bool RISCVTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
FastUnalignedAccess = llvm::is_contained(Features, "+fast-unaligned-access");
+ if (llvm::is_contained(Features, "+experimental"))
+ HasExperimental = true;
+
return true;
}
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.h b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.h
index a893cae914ce..f98c88cd45f8 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.h
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.h
@@ -31,6 +31,7 @@ protected:
private:
bool FastUnalignedAccess;
+ bool HasExperimental = false;
public:
RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
diff --git a/contrib/llvm-project/clang/lib/Basic/Version.cpp b/contrib/llvm-project/clang/lib/Basic/Version.cpp
index e205da7adec1..4823f566bd77 100644
--- a/contrib/llvm-project/clang/lib/Basic/Version.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Version.cpp
@@ -57,6 +57,14 @@ std::string getLLVMRevision() {
#endif
}
+std::string getClangVendor() {
+#ifdef CLANG_VENDOR
+ return CLANG_VENDOR;
+#else
+ return "";
+#endif
+}
+
std::string getClangFullRepositoryVersion() {
std::string buf;
llvm::raw_string_ostream OS(buf);
@@ -92,10 +100,7 @@ std::string getClangFullVersion() {
std::string getClangToolFullVersion(StringRef ToolName) {
std::string buf;
llvm::raw_string_ostream OS(buf);
-#ifdef CLANG_VENDOR
- OS << CLANG_VENDOR;
-#endif
- OS << ToolName << " version " CLANG_VERSION_STRING;
+ OS << getClangVendor() << ToolName << " version " CLANG_VERSION_STRING;
std::string repo = getClangFullRepositoryVersion();
if (!repo.empty()) {
@@ -110,10 +115,7 @@ std::string getClangFullCPPVersion() {
// the one we report on the command line.
std::string buf;
llvm::raw_string_ostream OS(buf);
-#ifdef CLANG_VENDOR
- OS << CLANG_VENDOR;
-#endif
- OS << "Clang " CLANG_VERSION_STRING;
+ OS << getClangVendor() << "Clang " CLANG_VERSION_STRING;
std::string repo = getClangFullRepositoryVersion();
if (!repo.empty()) {
diff --git a/contrib/llvm-project/clang/lib/Basic/Warnings.cpp b/contrib/llvm-project/clang/lib/Basic/Warnings.cpp
index cb23d844ef8f..bab1af4f03b6 100644
--- a/contrib/llvm-project/clang/lib/Basic/Warnings.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Warnings.cpp
@@ -198,8 +198,7 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
}
}
- for (unsigned i = 0, e = Opts.Remarks.size(); i != e; ++i) {
- StringRef Opt = Opts.Remarks[i];
+ for (StringRef Opt : Opts.Remarks) {
const auto Flavor = diag::Flavor::Remark;
// Check to see if this warning starts with "no-", if so, this is a
diff --git a/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp b/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp
index 7d16de33763a..a6142d99f3b6 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp
@@ -881,7 +881,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
<< PluginFN << toString(PassPlugin.takeError());
}
}
- for (auto PassCallback : CodeGenOpts.PassBuilderCallbacks)
+ for (const auto &PassCallback : CodeGenOpts.PassBuilderCallbacks)
PassCallback(PB);
#define HANDLE_EXTENSION(Ext) \
get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);
@@ -1068,11 +1068,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
}
}
if (CodeGenOpts.FatLTO) {
- // Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
+ // Set the EnableSplitLTOUnit and UnifiedLTO module flags, since FatLTO
// uses a different action than Backend_EmitBC or Backend_EmitLL.
- if (!TheModule->getModuleFlag("ThinLTO"))
- TheModule->addModuleFlag(llvm::Module::Error, "ThinLTO",
- uint32_t(CodeGenOpts.PrepareForThinLTO));
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
TheModule->addModuleFlag(llvm::Module::Error, "EnableSplitLTOUnit",
uint32_t(CodeGenOpts.EnableSplitLTOUnit));
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp
index 3327866d2b96..5081062da286 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp
@@ -25,7 +25,6 @@
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/OSLog.h"
-#include "clang/AST/OperationKinds.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TargetOptions.h"
@@ -232,19 +231,19 @@ static Value *MakeBinaryAtomicValue(
static Value *EmitNontemporalStore(CodeGenFunction &CGF, const CallExpr *E) {
Value *Val = CGF.EmitScalarExpr(E->getArg(0));
- Value *Address = CGF.EmitScalarExpr(E->getArg(1));
+ Address Addr = CGF.EmitPointerWithAlignment(E->getArg(1));
Val = CGF.EmitToMemory(Val, E->getArg(0)->getType());
- LValue LV = CGF.MakeNaturalAlignAddrLValue(Address, E->getArg(0)->getType());
+ LValue LV = CGF.MakeAddrLValue(Addr, E->getArg(0)->getType());
LV.setNontemporal(true);
CGF.EmitStoreOfScalar(Val, LV, false);
return nullptr;
}
static Value *EmitNontemporalLoad(CodeGenFunction &CGF, const CallExpr *E) {
- Value *Address = CGF.EmitScalarExpr(E->getArg(0));
+ Address Addr = CGF.EmitPointerWithAlignment(E->getArg(0));
- LValue LV = CGF.MakeNaturalAlignAddrLValue(Address, E->getType());
+ LValue LV = CGF.MakeAddrLValue(Addr, E->getType());
LV.setNontemporal(true);
return CGF.EmitLoadOfScalar(LV, E->getExprLoc());
}
@@ -819,165 +818,6 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-llvm::Value *
-CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
- llvm::IntegerType *ResType) {
- // The code generated here calculates the size of a struct with a flexible
- // array member that uses the counted_by attribute. There are two instances
- // we handle:
- //
- // struct s {
- // unsigned long flags;
- // int count;
- // int array[] __attribute__((counted_by(count)));
- // }
- //
- // 1) bdos of the flexible array itself:
- //
- // __builtin_dynamic_object_size(p->array, 1) ==
- // p->count * sizeof(*p->array)
- //
- // 2) bdos of a pointer into the flexible array:
- //
- // __builtin_dynamic_object_size(&p->array[42], 1) ==
- // (p->count - 42) * sizeof(*p->array)
- //
- // 2) bdos of the whole struct, including the flexible array:
- //
- // __builtin_dynamic_object_size(p, 1) ==
- // max(sizeof(struct s),
- // offsetof(struct s, array) + p->count * sizeof(*p->array))
- //
- ASTContext &Ctx = getContext();
- const Expr *Base = E->IgnoreParenImpCasts();
- const Expr *Idx = nullptr;
-
- if (const auto *UO = dyn_cast<UnaryOperator>(Base);
- UO && UO->getOpcode() == UO_AddrOf) {
- Expr *SubExpr = UO->getSubExpr()->IgnoreParenImpCasts();
- if (const auto *ASE = dyn_cast<ArraySubscriptExpr>(SubExpr)) {
- Base = ASE->getBase()->IgnoreParenImpCasts();
- Idx = ASE->getIdx()->IgnoreParenImpCasts();
-
- if (const auto *IL = dyn_cast<IntegerLiteral>(Idx)) {
- int64_t Val = IL->getValue().getSExtValue();
- if (Val < 0)
- // __bdos returns 0 for negative indexes into an array in a struct.
- return getDefaultBuiltinObjectSizeResult(Type, ResType);
-
- if (Val == 0)
- // The index is 0, so we don't need to take it into account.
- Idx = nullptr;
- }
- } else {
- // Potential pointer to another element in the struct.
- Base = SubExpr;
- }
- }
-
- // Get the flexible array member Decl.
- const ValueDecl *FAMDecl = nullptr;
- if (const auto *ME = dyn_cast<MemberExpr>(Base)) {
- // Check if \p Base is referencing the FAM itself.
- if (const ValueDecl *MD = ME->getMemberDecl()) {
- const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
- getLangOpts().getStrictFlexArraysLevel();
- if (!Decl::isFlexibleArrayMemberLike(
- Ctx, MD, MD->getType(), StrictFlexArraysLevel,
- /*IgnoreTemplateOrMacroSubstitution=*/true))
- return nullptr;
-
- FAMDecl = MD;
- }
- } else if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
- // Check if we're pointing to the whole struct.
- QualType Ty = DRE->getDecl()->getType();
- if (Ty->isPointerType())
- Ty = Ty->getPointeeType();
-
- if (const auto *RD = Ty->getAsRecordDecl())
- // Don't use the outer lexical record because the FAM might be in a
- // different RecordDecl.
- FAMDecl = FindFlexibleArrayMemberField(Ctx, RD);
- }
-
- if (!FAMDecl || !FAMDecl->hasAttr<CountedByAttr>())
- // No flexible array member found or it doesn't have the "counted_by"
- // attribute.
- return nullptr;
-
- const ValueDecl *CountedByFD = FindCountedByField(Base);
- if (!CountedByFD)
- // Can't find the field referenced by the "counted_by" attribute.
- return nullptr;
-
- // Build a load of the counted_by field.
- bool IsSigned = CountedByFD->getType()->isSignedIntegerType();
- const Expr *CountedByExpr = BuildCountedByFieldExpr(Base, CountedByFD);
- Value *CountedByInst = EmitAnyExprToTemp(CountedByExpr).getScalarVal();
- llvm::Type *CountedByTy = CountedByInst->getType();
-
- // Build a load of the index and subtract it from the count.
- Value *IdxInst = nullptr;
- if (Idx) {
- bool IdxSigned = Idx->getType()->isSignedIntegerType();
- IdxInst = EmitAnyExprToTemp(Idx).getScalarVal();
- IdxInst = IdxSigned ? Builder.CreateSExtOrTrunc(IdxInst, CountedByTy)
- : Builder.CreateZExtOrTrunc(IdxInst, CountedByTy);
-
- // We go ahead with the calculation here. If the index turns out to be
- // negative, we'll catch it at the end.
- CountedByInst =
- Builder.CreateSub(CountedByInst, IdxInst, "", !IsSigned, IsSigned);
- }
-
- // Calculate how large the flexible array member is in bytes.
- const ArrayType *ArrayTy = Ctx.getAsArrayType(FAMDecl->getType());
- CharUnits Size = Ctx.getTypeSizeInChars(ArrayTy->getElementType());
- llvm::Constant *ElemSize =
- llvm::ConstantInt::get(CountedByTy, Size.getQuantity(), IsSigned);
- Value *FAMSize =
- Builder.CreateMul(CountedByInst, ElemSize, "", !IsSigned, IsSigned);
- FAMSize = IsSigned ? Builder.CreateSExtOrTrunc(FAMSize, ResType)
- : Builder.CreateZExtOrTrunc(FAMSize, ResType);
- Value *Res = FAMSize;
-
- if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
- // The whole struct is specificed in the __bdos.
- const RecordDecl *OuterRD =
- CountedByFD->getDeclContext()->getOuterLexicalRecordContext();
- const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(OuterRD);
-
- // Get the offset of the FAM.
- CharUnits Offset = Ctx.toCharUnitsFromBits(Ctx.getFieldOffset(FAMDecl));
- llvm::Constant *FAMOffset =
- ConstantInt::get(ResType, Offset.getQuantity(), IsSigned);
- Value *OffsetAndFAMSize =
- Builder.CreateAdd(FAMOffset, Res, "", !IsSigned, IsSigned);
-
- // Get the full size of the struct.
- llvm::Constant *SizeofStruct =
- ConstantInt::get(ResType, Layout.getSize().getQuantity(), IsSigned);
-
- // max(sizeof(struct s),
- // offsetof(struct s, array) + p->count * sizeof(*p->array))
- Res = IsSigned
- ? Builder.CreateBinaryIntrinsic(llvm::Intrinsic::smax,
- OffsetAndFAMSize, SizeofStruct)
- : Builder.CreateBinaryIntrinsic(llvm::Intrinsic::umax,
- OffsetAndFAMSize, SizeofStruct);
- }
-
- // A negative \p IdxInst or \p CountedByInst means that the index lands
- // outside of the flexible array member. If that's the case, we want to
- // return 0.
- Value *Cmp = Builder.CreateIsNotNeg(CountedByInst);
- if (IdxInst)
- Cmp = Builder.CreateAnd(Builder.CreateIsNotNeg(IdxInst), Cmp);
-
- return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned));
-}
-
/// Returns a Value corresponding to the size of the given expression.
/// This Value may be either of the following:
/// - A llvm::Argument (if E is a param with the pass_object_size attribute on
@@ -1010,13 +850,6 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type,
}
}
- if (IsDynamic) {
- // Emit special code for a flexible array member with the "counted_by"
- // attribute.
- if (Value *V = emitFlexibleArrayMemberSize(E, Type, ResType))
- return V;
- }
-
// LLVM can't handle Type=3 appropriately, and __builtin_object_size shouldn't
// evaluate E for side-effects. In either case, we shouldn't lower to
// @llvm.objectsize.
@@ -3214,7 +3047,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Value *AlignmentValue = EmitScalarExpr(E->getArg(1));
ConstantInt *AlignmentCI = cast<ConstantInt>(AlignmentValue);
if (AlignmentCI->getValue().ugt(llvm::Value::MaximumAlignment))
- AlignmentCI = ConstantInt::get(AlignmentCI->getType(),
+ AlignmentCI = ConstantInt::get(AlignmentCI->getIntegerType(),
llvm::Value::MaximumAlignment);
emitAlignmentAssumption(PtrValue, Ptr,
@@ -10485,6 +10318,30 @@ Value *CodeGenFunction::EmitAArch64SVEBuiltinExpr(unsigned BuiltinID,
return nullptr;
}
+static void swapCommutativeSMEOperands(unsigned BuiltinID,
+ SmallVectorImpl<Value *> &Ops) {
+ unsigned MultiVec;
+ switch (BuiltinID) {
+ default:
+ return;
+ case SME::BI__builtin_sme_svsumla_za32_s8_vg4x1:
+ MultiVec = 1;
+ break;
+ case SME::BI__builtin_sme_svsumla_za32_s8_vg4x2:
+ case SME::BI__builtin_sme_svsudot_za32_s8_vg1x2:
+ MultiVec = 2;
+ break;
+ case SME::BI__builtin_sme_svsudot_za32_s8_vg1x4:
+ case SME::BI__builtin_sme_svsumla_za32_s8_vg4x4:
+ MultiVec = 4;
+ break;
+ }
+
+ if (MultiVec > 0)
+ for (unsigned I = 0; I < MultiVec; ++I)
+ std::swap(Ops[I + 1], Ops[I + 1 + MultiVec]);
+}
+
Value *CodeGenFunction::EmitAArch64SMEBuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
auto *Builtin = findARMVectorIntrinsicInMap(AArch64SMEIntrinsicMap, BuiltinID,
@@ -10507,6 +10364,9 @@ Value *CodeGenFunction::EmitAArch64SMEBuiltinExpr(unsigned BuiltinID,
BuiltinID == SME::BI__builtin_sme_svstr_za)
return EmitSMELdrStr(TypeFlags, Ops, Builtin->LLVMIntrinsic);
+ // Handle builtins which require their multi-vector operands to be swapped
+ swapCommutativeSMEOperands(BuiltinID, Ops);
+
// Should not happen!
if (Builtin->LLVMIntrinsic == 0)
return nullptr;
@@ -17034,7 +16894,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
Value *Op1 = EmitScalarExpr(E->getArg(1));
ConstantInt *AlignmentCI = cast<ConstantInt>(Op0);
if (AlignmentCI->getValue().ugt(llvm::Value::MaximumAlignment))
- AlignmentCI = ConstantInt::get(AlignmentCI->getType(),
+ AlignmentCI = ConstantInt::get(AlignmentCI->getIntegerType(),
llvm::Value::MaximumAlignment);
emitAlignmentAssumption(Op1, E->getArg(1),
@@ -17272,7 +17132,8 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
Op0, llvm::FixedVectorType::get(ConvertType(E->getType()), 2));
if (getTarget().isLittleEndian())
- Index = ConstantInt::get(Index->getType(), 1 - Index->getZExtValue());
+ Index =
+ ConstantInt::get(Index->getIntegerType(), 1 - Index->getZExtValue());
return Builder.CreateExtractElement(Unpacked, Index);
}
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp
index ed9aaa28c257..3f277725d9e7 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp
@@ -30,7 +30,6 @@
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/Hashing.h"
-#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.h"
@@ -926,27 +925,16 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF,
if (CE->getCastKind() == CK_ArrayToPointerDecay &&
!CE->getSubExpr()->isFlexibleArrayMemberLike(CGF.getContext(),
StrictFlexArraysLevel)) {
- CodeGenFunction::SanitizerScope SanScope(&CGF);
-
IndexedType = CE->getSubExpr()->getType();
const ArrayType *AT = IndexedType->castAsArrayTypeUnsafe();
if (const auto *CAT = dyn_cast<ConstantArrayType>(AT))
return CGF.Builder.getInt(CAT->getSize());
-
- if (const auto *VAT = dyn_cast<VariableArrayType>(AT))
+ else if (const auto *VAT = dyn_cast<VariableArrayType>(AT))
return CGF.getVLASize(VAT).NumElts;
// Ignore pass_object_size here. It's not applicable on decayed pointers.
}
-
- if (const ValueDecl *VD = CGF.FindCountedByField(Base)) {
- IndexedType = Base->getType();
- const Expr *E = CGF.BuildCountedByFieldExpr(Base, VD);
- return CGF.EmitAnyExprToTemp(E).getScalarVal();
- }
}
- CodeGenFunction::SanitizerScope SanScope(&CGF);
-
QualType EltTy{Base->getType()->getPointeeOrArrayElementType(), 0};
if (llvm::Value *POS = CGF.LoadPassedObjectSize(Base, EltTy)) {
IndexedType = Base->getType();
@@ -956,122 +944,13 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF,
return nullptr;
}
-const Expr *
-CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base,
- const ValueDecl *CountedByVD) {
- // Find the outer struct expr (i.e. p in p->a.b.c.d).
- Expr *CountedByExpr = const_cast<Expr *>(Base)->IgnoreParenImpCasts();
-
- // Work our way up the expression until we reach the DeclRefExpr.
- while (!isa<DeclRefExpr>(CountedByExpr))
- if (const auto *ME = dyn_cast<MemberExpr>(CountedByExpr))
- CountedByExpr = ME->getBase()->IgnoreParenImpCasts();
-
- // Add back an implicit cast to create the required pr-value.
- CountedByExpr = ImplicitCastExpr::Create(
- getContext(), CountedByExpr->getType(), CK_LValueToRValue, CountedByExpr,
- nullptr, VK_PRValue, FPOptionsOverride());
-
- if (const auto *IFD = dyn_cast<IndirectFieldDecl>(CountedByVD)) {
- // The counted_by field is inside an anonymous struct / union. The
- // IndirectFieldDecl has the correct order of FieldDecls to build this
- // easily. (Yay!)
- for (NamedDecl *ND : IFD->chain()) {
- auto *VD = cast<ValueDecl>(ND);
- CountedByExpr =
- MemberExpr::CreateImplicit(getContext(), CountedByExpr,
- CountedByExpr->getType()->isPointerType(),
- VD, VD->getType(), VK_LValue, OK_Ordinary);
- }
- } else {
- CountedByExpr = MemberExpr::CreateImplicit(
- getContext(), const_cast<Expr *>(CountedByExpr),
- CountedByExpr->getType()->isPointerType(),
- const_cast<ValueDecl *>(CountedByVD), CountedByVD->getType(), VK_LValue,
- OK_Ordinary);
- }
-
- return CountedByExpr;
-}
-
-const ValueDecl *
-CodeGenFunction::FindFlexibleArrayMemberField(ASTContext &Ctx,
- const RecordDecl *RD) {
- const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
- getLangOpts().getStrictFlexArraysLevel();
-
- for (const Decl *D : RD->decls()) {
- if (const auto *VD = dyn_cast<ValueDecl>(D);
- VD && Decl::isFlexibleArrayMemberLike(
- Ctx, VD, VD->getType(), StrictFlexArraysLevel,
- /*IgnoreTemplateOrMacroSubstitution=*/true))
- return VD;
-
- if (const auto *Record = dyn_cast<RecordDecl>(D))
- if (const ValueDecl *VD = FindFlexibleArrayMemberField(Ctx, Record))
- return VD;
- }
-
- return nullptr;
-}
-
-const ValueDecl *CodeGenFunction::FindCountedByField(const Expr *Base) {
- ASTContext &Ctx = getContext();
- const RecordDecl *OuterRD = nullptr;
- const FieldDecl *FD = nullptr;
-
- Base = Base->IgnoreParenImpCasts();
-
- // Get the outer-most lexical RecordDecl.
- if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
- QualType Ty = DRE->getDecl()->getType();
- if (Ty->isPointerType())
- Ty = Ty->getPointeeType();
-
- if (const auto *RD = Ty->getAsRecordDecl())
- OuterRD = RD->getOuterLexicalRecordContext();
- } else if (const auto *ME = dyn_cast<MemberExpr>(Base)) {
- if (const ValueDecl *MD = ME->getMemberDecl()) {
- OuterRD = MD->getDeclContext()->getOuterLexicalRecordContext();
-
- const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
- getLangOpts().getStrictFlexArraysLevel();
- if (Decl::isFlexibleArrayMemberLike(
- Ctx, MD, MD->getType(), StrictFlexArraysLevel,
- /*IgnoreTemplateOrMacroSubstitution=*/true))
- // Base is referencing the FAM itself.
- FD = dyn_cast<FieldDecl>(MD);
- }
- }
-
- if (!OuterRD)
- return nullptr;
-
- if (!FD) {
- const ValueDecl *VD = FindFlexibleArrayMemberField(Ctx, OuterRD);
- FD = dyn_cast_if_present<FieldDecl>(VD);
- if (!FD)
- return nullptr;
- }
-
- const auto *CBA = FD->getAttr<CountedByAttr>();
- if (!CBA)
- return nullptr;
-
- DeclarationName DName(CBA->getCountedByField());
- DeclContext::lookup_result Lookup = OuterRD->lookup(DName);
-
- if (Lookup.empty())
- return nullptr;
-
- return dyn_cast<ValueDecl>(Lookup.front());
-}
-
void CodeGenFunction::EmitBoundsCheck(const Expr *E, const Expr *Base,
llvm::Value *Index, QualType IndexType,
bool Accessed) {
assert(SanOpts.has(SanitizerKind::ArrayBounds) &&
"should not be called unless adding bounds checks");
+ SanitizerScope SanScope(this);
+
const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
getLangOpts().getStrictFlexArraysLevel();
@@ -1081,8 +960,6 @@ void CodeGenFunction::EmitBoundsCheck(const Expr *E, const Expr *Base,
if (!Bound)
return;
- SanitizerScope SanScope(this);
-
bool IndexSigned = IndexType->isSignedIntegerOrEnumerationType();
llvm::Value *IndexVal = Builder.CreateIntCast(Index, SizeTy, IndexSigned);
llvm::Value *BoundVal = Builder.CreateIntCast(Bound, SizeTy, false);
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp
index 41ad2ddac30d..6adf99531e30 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp
@@ -1894,8 +1894,8 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
// initializer, since LLVM optimizers generally do not want to touch
// shuffles.
unsigned CurIdx = 0;
- bool VIsUndefShuffle = false;
- llvm::Value *V = llvm::UndefValue::get(VType);
+ bool VIsPoisonShuffle = false;
+ llvm::Value *V = llvm::PoisonValue::get(VType);
for (unsigned i = 0; i != NumInitElements; ++i) {
Expr *IE = E->getInit(i);
Value *Init = Visit(IE);
@@ -1915,16 +1915,16 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
llvm::ConstantInt *C = cast<llvm::ConstantInt>(EI->getIndexOperand());
Value *LHS = nullptr, *RHS = nullptr;
if (CurIdx == 0) {
- // insert into undef -> shuffle (src, undef)
+ // insert into poison -> shuffle (src, poison)
// shufflemask must use an i32
Args.push_back(getAsInt32(C, CGF.Int32Ty));
Args.resize(ResElts, -1);
LHS = EI->getVectorOperand();
RHS = V;
- VIsUndefShuffle = true;
- } else if (VIsUndefShuffle) {
- // insert into undefshuffle && size match -> shuffle (v, src)
+ VIsPoisonShuffle = true;
+ } else if (VIsPoisonShuffle) {
+ // insert into poison shuffle && size match -> shuffle (v, src)
llvm::ShuffleVectorInst *SVV = cast<llvm::ShuffleVectorInst>(V);
for (unsigned j = 0; j != CurIdx; ++j)
Args.push_back(getMaskElt(SVV, j, 0));
@@ -1933,7 +1933,7 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
LHS = cast<llvm::ShuffleVectorInst>(V)->getOperand(0);
RHS = EI->getVectorOperand();
- VIsUndefShuffle = false;
+ VIsPoisonShuffle = false;
}
if (!Args.empty()) {
V = Builder.CreateShuffleVector(LHS, RHS, Args);
@@ -1944,7 +1944,7 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
}
V = Builder.CreateInsertElement(V, Init, Builder.getInt32(CurIdx),
"vecinit");
- VIsUndefShuffle = false;
+ VIsPoisonShuffle = false;
++CurIdx;
continue;
}
@@ -1962,9 +1962,9 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
if (OpTy->getNumElements() == ResElts) {
for (unsigned j = 0; j != CurIdx; ++j) {
- // If the current vector initializer is a shuffle with undef, merge
+ // If the current vector initializer is a shuffle with poison, merge
// this shuffle directly into it.
- if (VIsUndefShuffle) {
+ if (VIsPoisonShuffle) {
Args.push_back(getMaskElt(cast<llvm::ShuffleVectorInst>(V), j, 0));
} else {
Args.push_back(j);
@@ -1974,7 +1974,7 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
Args.push_back(getMaskElt(SVI, j, Offset));
Args.resize(ResElts, -1);
- if (VIsUndefShuffle)
+ if (VIsPoisonShuffle)
V = cast<llvm::ShuffleVectorInst>(V)->getOperand(0);
Init = SVOp;
@@ -1997,12 +1997,12 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
Args.resize(ResElts, -1);
}
- // If V is undef, make sure it ends up on the RHS of the shuffle to aid
+ // If V is poison, make sure it ends up on the RHS of the shuffle to aid
// merging subsequent shuffles into this one.
if (CurIdx == 0)
std::swap(V, Init);
V = Builder.CreateShuffleVector(V, Init, Args, "vecinit");
- VIsUndefShuffle = isa<llvm::UndefValue>(Init);
+ VIsPoisonShuffle = isa<llvm::PoisonValue>(Init);
CurIdx += InitElts;
}
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 3e8a40e7540b..e887d35198b3 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -182,10 +182,8 @@ void CGHLSLRuntime::finishCodeGen() {
llvm::hlsl::ResourceKind RK = Buf.IsCBuffer
? llvm::hlsl::ResourceKind::CBuffer
: llvm::hlsl::ResourceKind::TBuffer;
- std::string TyName =
- Buf.Name.str() + (Buf.IsCBuffer ? ".cb." : ".tb.") + "ty";
- addBufferResourceAnnotation(GV, TyName, RC, RK, /*IsROV=*/false,
- Buf.Binding);
+ addBufferResourceAnnotation(GV, RC, RK, /*IsROV=*/false,
+ llvm::hlsl::ElementType::Invalid, Buf.Binding);
}
}
@@ -194,10 +192,10 @@ CGHLSLRuntime::Buffer::Buffer(const HLSLBufferDecl *D)
Binding(D->getAttr<HLSLResourceBindingAttr>()) {}
void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV,
- llvm::StringRef TyName,
llvm::hlsl::ResourceClass RC,
llvm::hlsl::ResourceKind RK,
bool IsROV,
+ llvm::hlsl::ElementType ET,
BufferResBinding &Binding) {
llvm::Module &M = CGM.getModule();
@@ -216,15 +214,62 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV,
assert(false && "Unsupported buffer type!");
return;
}
-
assert(ResourceMD != nullptr &&
"ResourceMD must have been set by the switch above.");
llvm::hlsl::FrontendResource Res(
- GV, TyName, RK, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space);
+ GV, RK, ET, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space);
ResourceMD->addOperand(Res.getMetadata());
}
+static llvm::hlsl::ElementType
+calculateElementType(const ASTContext &Context, const clang::Type *ResourceTy) {
+ using llvm::hlsl::ElementType;
+
+ // TODO: We may need to update this when we add things like ByteAddressBuffer
+ // that don't have a template parameter (or, indeed, an element type).
+ const auto *TST = ResourceTy->getAs<TemplateSpecializationType>();
+ assert(TST && "Resource types must be template specializations");
+ ArrayRef<TemplateArgument> Args = TST->template_arguments();
+ assert(!Args.empty() && "Resource has no element type");
+
+ // At this point we have a resource with an element type, so we can assume
+ // that it's valid or we would have diagnosed the error earlier.
+ QualType ElTy = Args[0].getAsType();
+
+ // We should either have a basic type or a vector of a basic type.
+ if (const auto *VecTy = ElTy->getAs<clang::VectorType>())
+ ElTy = VecTy->getElementType();
+
+ if (ElTy->isSignedIntegerType()) {
+ switch (Context.getTypeSize(ElTy)) {
+ case 16:
+ return ElementType::I16;
+ case 32:
+ return ElementType::I32;
+ case 64:
+ return ElementType::I64;
+ }
+ } else if (ElTy->isUnsignedIntegerType()) {
+ switch (Context.getTypeSize(ElTy)) {
+ case 16:
+ return ElementType::U16;
+ case 32:
+ return ElementType::U32;
+ case 64:
+ return ElementType::U64;
+ }
+ } else if (ElTy->isSpecificBuiltinType(BuiltinType::Half))
+ return ElementType::F16;
+ else if (ElTy->isSpecificBuiltinType(BuiltinType::Float))
+ return ElementType::F32;
+ else if (ElTy->isSpecificBuiltinType(BuiltinType::Double))
+ return ElementType::F64;
+
+ // TODO: We need to handle unorm/snorm float types here once we support them
+ llvm_unreachable("Invalid element type for resource");
+}
+
void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
const Type *Ty = D->getType()->getPointeeOrArrayElementType();
if (!Ty)
@@ -239,10 +284,10 @@ void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
llvm::hlsl::ResourceClass RC = Attr->getResourceClass();
llvm::hlsl::ResourceKind RK = Attr->getResourceKind();
bool IsROV = Attr->getIsROV();
+ llvm::hlsl::ElementType ET = calculateElementType(CGM.getContext(), Ty);
- QualType QT(Ty, 0);
BufferResBinding Binding(D->getAttr<HLSLResourceBindingAttr>());
- addBufferResourceAnnotation(GV, QT.getAsString(), RC, RK, IsROV, Binding);
+ addBufferResourceAnnotation(GV, RC, RK, IsROV, ET, Binding);
}
CGHLSLRuntime::BufferResBinding::BufferResBinding(
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.h b/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.h
index bb500cb5c979..bffefb66740a 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -90,9 +90,9 @@ public:
private:
void addBufferResourceAnnotation(llvm::GlobalVariable *GV,
- llvm::StringRef TyName,
llvm::hlsl::ResourceClass RC,
llvm::hlsl::ResourceKind RK, bool IsROV,
+ llvm::hlsl::ElementType ET,
BufferResBinding &Binding);
void addConstant(VarDecl *D, Buffer &CB);
void addBufferDecls(const DeclContext *DC, Buffer &CB);
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 7f7e6f530666..ea6645a39e83 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6811,8 +6811,10 @@ private:
OpenMPMapClauseKind MapType, ArrayRef<OpenMPMapModifierKind> MapModifiers,
ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
OMPClauseMappableExprCommon::MappableExprComponentListRef Components,
- MapCombinedInfoTy &CombinedInfo, StructRangeInfoTy &PartialStruct,
- bool IsFirstComponentList, bool IsImplicit,
+ MapCombinedInfoTy &CombinedInfo,
+ MapCombinedInfoTy &StructBaseCombinedInfo,
+ StructRangeInfoTy &PartialStruct, bool IsFirstComponentList,
+ bool IsImplicit, bool GenerateAllInfoForClauses,
const ValueDecl *Mapper = nullptr, bool ForDeviceAddr = false,
const ValueDecl *BaseDecl = nullptr, const Expr *MapExpr = nullptr,
ArrayRef<OMPClauseMappableExprCommon::MappableExprComponentListRef>
@@ -7098,6 +7100,25 @@ private:
bool IsNonContiguous = CombinedInfo.NonContigInfo.IsNonContiguous;
bool IsPrevMemberReference = false;
+ // We need to check if we will be encountering any MEs. If we do not
+ // encounter any ME expression it means we will be mapping the whole struct.
+ // In that case we need to skip adding an entry for the struct to the
+ // CombinedInfo list and instead add an entry to the StructBaseCombinedInfo
+ // list only when generating all info for clauses.
+ bool IsMappingWholeStruct = true;
+ if (!GenerateAllInfoForClauses) {
+ IsMappingWholeStruct = false;
+ } else {
+ for (auto TempI = I; TempI != CE; ++TempI) {
+ const MemberExpr *PossibleME =
+ dyn_cast<MemberExpr>(TempI->getAssociatedExpression());
+ if (PossibleME) {
+ IsMappingWholeStruct = false;
+ break;
+ }
+ }
+ }
+
for (; I != CE; ++I) {
// If the current component is member of a struct (parent struct) mark it.
if (!EncounteredME) {
@@ -7317,21 +7338,41 @@ private:
break;
}
llvm::Value *Size = getExprTypeSize(I->getAssociatedExpression());
+ // Skip adding an entry in the CurInfo of this combined entry if the
+ // whole struct is currently being mapped. The struct needs to be added
+ // in the first position before any data internal to the struct is being
+ // mapped.
if (!IsMemberPointerOrAddr ||
(Next == CE && MapType != OMPC_MAP_unknown)) {
- CombinedInfo.Exprs.emplace_back(MapDecl, MapExpr);
- CombinedInfo.BasePointers.push_back(BP.getPointer());
- CombinedInfo.DevicePtrDecls.push_back(nullptr);
- CombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
- CombinedInfo.Pointers.push_back(LB.getPointer());
- CombinedInfo.Sizes.push_back(
- CGF.Builder.CreateIntCast(Size, CGF.Int64Ty, /*isSigned=*/true));
- CombinedInfo.NonContigInfo.Dims.push_back(IsNonContiguous ? DimSize
- : 1);
+ if (!IsMappingWholeStruct) {
+ CombinedInfo.Exprs.emplace_back(MapDecl, MapExpr);
+ CombinedInfo.BasePointers.push_back(BP.getPointer());
+ CombinedInfo.DevicePtrDecls.push_back(nullptr);
+ CombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
+ CombinedInfo.Pointers.push_back(LB.getPointer());
+ CombinedInfo.Sizes.push_back(CGF.Builder.CreateIntCast(
+ Size, CGF.Int64Ty, /*isSigned=*/true));
+ CombinedInfo.NonContigInfo.Dims.push_back(IsNonContiguous ? DimSize
+ : 1);
+ } else {
+ StructBaseCombinedInfo.Exprs.emplace_back(MapDecl, MapExpr);
+ StructBaseCombinedInfo.BasePointers.push_back(BP.getPointer());
+ StructBaseCombinedInfo.DevicePtrDecls.push_back(nullptr);
+ StructBaseCombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
+ StructBaseCombinedInfo.Pointers.push_back(LB.getPointer());
+ StructBaseCombinedInfo.Sizes.push_back(CGF.Builder.CreateIntCast(
+ Size, CGF.Int64Ty, /*isSigned=*/true));
+ StructBaseCombinedInfo.NonContigInfo.Dims.push_back(
+ IsNonContiguous ? DimSize : 1);
+ }
// If Mapper is valid, the last component inherits the mapper.
bool HasMapper = Mapper && Next == CE;
- CombinedInfo.Mappers.push_back(HasMapper ? Mapper : nullptr);
+ if (!IsMappingWholeStruct)
+ CombinedInfo.Mappers.push_back(HasMapper ? Mapper : nullptr);
+ else
+ StructBaseCombinedInfo.Mappers.push_back(HasMapper ? Mapper
+ : nullptr);
// We need to add a pointer flag for each map that comes from the
// same expression except for the first one. We also need to signal
@@ -7363,7 +7404,10 @@ private:
}
}
- CombinedInfo.Types.push_back(Flags);
+ if (!IsMappingWholeStruct)
+ CombinedInfo.Types.push_back(Flags);
+ else
+ StructBaseCombinedInfo.Types.push_back(Flags);
}
// If we have encountered a member expression so far, keep track of the
@@ -7954,8 +7998,10 @@ private:
for (const auto &Data : Info) {
StructRangeInfoTy PartialStruct;
- // Temporary generated information.
+ // Current struct information:
MapCombinedInfoTy CurInfo;
+ // Current struct base information:
+ MapCombinedInfoTy StructBaseCurInfo;
const Decl *D = Data.first;
const ValueDecl *VD = cast_or_null<ValueDecl>(D);
for (const auto &M : Data.second) {
@@ -7965,29 +8011,55 @@ private:
// Remember the current base pointer index.
unsigned CurrentBasePointersIdx = CurInfo.BasePointers.size();
+ unsigned StructBasePointersIdx =
+ StructBaseCurInfo.BasePointers.size();
CurInfo.NonContigInfo.IsNonContiguous =
L.Components.back().isNonContiguous();
generateInfoForComponentList(
L.MapType, L.MapModifiers, L.MotionModifiers, L.Components,
- CurInfo, PartialStruct, /*IsFirstComponentList=*/false,
- L.IsImplicit, L.Mapper, L.ForDeviceAddr, VD, L.VarRef);
+ CurInfo, StructBaseCurInfo, PartialStruct,
+ /*IsFirstComponentList=*/false, L.IsImplicit,
+ /*GenerateAllInfoForClauses*/ true, L.Mapper, L.ForDeviceAddr, VD,
+ L.VarRef);
- // If this entry relates with a device pointer, set the relevant
+ // If this entry relates to a device pointer, set the relevant
// declaration and add the 'return pointer' flag.
if (L.ReturnDevicePointer) {
- assert(CurInfo.BasePointers.size() > CurrentBasePointersIdx &&
+ // Check whether a value was added to either CurInfo or
+ // StructBaseCurInfo and error if no value was added to either of
+ // them:
+ assert((CurrentBasePointersIdx < CurInfo.BasePointers.size() ||
+ StructBasePointersIdx <
+ StructBaseCurInfo.BasePointers.size()) &&
"Unexpected number of mapped base pointers.");
+ // Choose a base pointer index which is always valid:
const ValueDecl *RelevantVD =
L.Components.back().getAssociatedDeclaration();
assert(RelevantVD &&
"No relevant declaration related with device pointer??");
- CurInfo.DevicePtrDecls[CurrentBasePointersIdx] = RelevantVD;
- CurInfo.DevicePointers[CurrentBasePointersIdx] =
- L.ForDeviceAddr ? DeviceInfoTy::Address : DeviceInfoTy::Pointer;
- CurInfo.Types[CurrentBasePointersIdx] |=
- OpenMPOffloadMappingFlags::OMP_MAP_RETURN_PARAM;
+ // If StructBaseCurInfo has been updated this iteration then work on
+ // the first new entry added to it i.e. make sure that when multiple
+ // values are added to any of the lists, the first value added is
+ // being modified by the assignments below (not the last value
+ // added).
+ if (StructBasePointersIdx < StructBaseCurInfo.BasePointers.size()) {
+ StructBaseCurInfo.DevicePtrDecls[StructBasePointersIdx] =
+ RelevantVD;
+ StructBaseCurInfo.DevicePointers[StructBasePointersIdx] =
+ L.ForDeviceAddr ? DeviceInfoTy::Address
+ : DeviceInfoTy::Pointer;
+ StructBaseCurInfo.Types[StructBasePointersIdx] |=
+ OpenMPOffloadMappingFlags::OMP_MAP_RETURN_PARAM;
+ } else {
+ CurInfo.DevicePtrDecls[CurrentBasePointersIdx] = RelevantVD;
+ CurInfo.DevicePointers[CurrentBasePointersIdx] =
+ L.ForDeviceAddr ? DeviceInfoTy::Address
+ : DeviceInfoTy::Pointer;
+ CurInfo.Types[CurrentBasePointersIdx] |=
+ OpenMPOffloadMappingFlags::OMP_MAP_RETURN_PARAM;
+ }
}
}
}
@@ -8034,17 +8106,24 @@ private:
CurInfo.Mappers.push_back(nullptr);
}
}
+
+ // Unify entries in one list making sure the struct mapping precedes the
+ // individual fields:
+ MapCombinedInfoTy UnionCurInfo;
+ UnionCurInfo.append(StructBaseCurInfo);
+ UnionCurInfo.append(CurInfo);
+
// If there is an entry in PartialStruct it means we have a struct with
// individual members mapped. Emit an extra combined entry.
if (PartialStruct.Base.isValid()) {
- CurInfo.NonContigInfo.Dims.push_back(0);
- emitCombinedEntry(CombinedInfo, CurInfo.Types, PartialStruct,
+ UnionCurInfo.NonContigInfo.Dims.push_back(0);
+ // Emit a combined entry:
+ emitCombinedEntry(CombinedInfo, UnionCurInfo.Types, PartialStruct,
/*IsMapThis*/ !VD, OMPBuilder, VD);
}
- // We need to append the results of this capture to what we already
- // have.
- CombinedInfo.append(CurInfo);
+ // We need to append the results of this capture to what we already have.
+ CombinedInfo.append(UnionCurInfo);
}
// Append data for use_device_ptr clauses.
CombinedInfo.append(UseDeviceDataCombinedInfo);
@@ -8554,6 +8633,7 @@ public:
// Associated with a capture, because the mapping flags depend on it.
// Go through all of the elements with the overlapped elements.
bool IsFirstComponentList = true;
+ MapCombinedInfoTy StructBaseCombinedInfo;
for (const auto &Pair : OverlappedData) {
const MapData &L = *Pair.getFirst();
OMPClauseMappableExprCommon::MappableExprComponentListRef Components;
@@ -8568,7 +8648,8 @@ public:
OverlappedComponents = Pair.getSecond();
generateInfoForComponentList(
MapType, MapModifiers, std::nullopt, Components, CombinedInfo,
- PartialStruct, IsFirstComponentList, IsImplicit, Mapper,
+ StructBaseCombinedInfo, PartialStruct, IsFirstComponentList,
+ IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper,
/*ForDeviceAddr=*/false, VD, VarRef, OverlappedComponents);
IsFirstComponentList = false;
}
@@ -8584,10 +8665,11 @@ public:
L;
auto It = OverlappedData.find(&L);
if (It == OverlappedData.end())
- generateInfoForComponentList(MapType, MapModifiers, std::nullopt,
- Components, CombinedInfo, PartialStruct,
- IsFirstComponentList, IsImplicit, Mapper,
- /*ForDeviceAddr=*/false, VD, VarRef);
+ generateInfoForComponentList(
+ MapType, MapModifiers, std::nullopt, Components, CombinedInfo,
+ StructBaseCombinedInfo, PartialStruct, IsFirstComponentList,
+ IsImplicit, /*GenerateAllInfoForClauses*/ false, Mapper,
+ /*ForDeviceAddr=*/false, VD, VarRef);
IsFirstComponentList = false;
}
}
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h b/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h
index 618e78809db4..751d8110b13d 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h
+++ b/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h
@@ -3022,19 +3022,6 @@ public:
void EmitBoundsCheck(const Expr *E, const Expr *Base, llvm::Value *Index,
QualType IndexType, bool Accessed);
- // Find a struct's flexible array member. It may be embedded inside multiple
- // sub-structs, but must still be the last field.
- const ValueDecl *FindFlexibleArrayMemberField(ASTContext &Ctx,
- const RecordDecl *RD);
-
- /// Find the FieldDecl specified in a FAM's "counted_by" attribute. Returns
- /// \p nullptr if either the attribute or the field doesn't exist.
- const ValueDecl *FindCountedByField(const Expr *Base);
-
- /// Build an expression accessing the "counted_by" field.
- const Expr *BuildCountedByFieldExpr(const Expr *Base,
- const ValueDecl *CountedByVD);
-
llvm::Value *EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
bool isInc, bool isPre);
ComplexPairTy EmitComplexPrePostIncDec(const UnaryOperator *E, LValue LV,
@@ -4830,9 +4817,6 @@ private:
llvm::Value *EmittedE,
bool IsDynamic);
- llvm::Value *emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
- llvm::IntegerType *ResType);
-
void emitZeroOrPatternForAutoVarInit(QualType type, const VarDecl &D,
Address Loc);
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp b/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
index 7ad26ace328a..d78f2594a237 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
@@ -995,12 +995,7 @@ void CodeGenModule::Release() {
uint32_t(CLANG_VERSION_MINOR));
getModule().addModuleFlag(llvm::Module::Warning, "zos_product_patchlevel",
uint32_t(CLANG_VERSION_PATCHLEVEL));
- std::string ProductId;
-#ifdef CLANG_VENDOR
- ProductId = #CLANG_VENDOR;
-#else
- ProductId = "clang";
-#endif
+ std::string ProductId = getClangVendor() + "clang";
getModule().addModuleFlag(llvm::Module::Error, "zos_product_id",
llvm::MDString::get(VMContext, ProductId));
@@ -1111,6 +1106,9 @@ void CodeGenModule::Release() {
if (LangOpts.BranchTargetEnforcement)
getModule().addModuleFlag(llvm::Module::Min, "branch-target-enforcement",
1);
+ if (LangOpts.BranchProtectionPAuthLR)
+ getModule().addModuleFlag(llvm::Module::Min, "branch-protection-pauth-lr",
+ 1);
if (LangOpts.hasSignReturnAddress())
getModule().addModuleFlag(llvm::Module::Min, "sign-return-address", 1);
if (LangOpts.isSignReturnAddressScopeAll())
diff --git a/contrib/llvm-project/clang/lib/CodeGen/Targets/AArch64.cpp b/contrib/llvm-project/clang/lib/CodeGen/Targets/AArch64.cpp
index be5145daa00b..7102d190fe00 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/Targets/AArch64.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/Targets/AArch64.cpp
@@ -136,6 +136,8 @@ public:
Fn->addFnAttr("branch-target-enforcement",
BPI.BranchTargetEnforcement ? "true" : "false");
+ Fn->addFnAttr("branch-protection-pauth-lr",
+ BPI.BranchProtectionPAuthLR ? "true" : "false");
}
bool isScalarizableAsmOperand(CodeGen::CodeGenFunction &CGF,
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/AIX.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/AIX.cpp
index f9670ea6f251..e6126ff62db3 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/AIX.cpp
@@ -328,6 +328,12 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
}
}
+ if (D.IsFlangMode()) {
+ addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
+ addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
+ CmdArgs.push_back("-lm");
+ CmdArgs.push_back("-lpthread");
+ }
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
Exec, CmdArgs, Inputs, Output));
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
index 2e39fc29a931..80c0f88105d1 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -45,6 +45,10 @@ static bool getArchFeatures(const Driver &D, StringRef Arch,
(*ISAInfo)->toFeatures(
Features, [&Args](const Twine &Str) { return Args.MakeArgString(Str); },
/*AddAllExtensions=*/true);
+
+ if (EnableExperimentalExtensions)
+ Features.push_back(Args.MakeArgString("+experimental"));
+
return true;
}
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
index de9fd5eaa1e0..70dc7e54aca1 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1497,7 +1497,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
<< Triple.getArchName();
StringRef Scope, Key;
- bool IndirectBranches;
+ bool IndirectBranches, BranchProtectionPAuthLR;
if (A->getOption().matches(options::OPT_msign_return_address_EQ)) {
Scope = A->getValue();
@@ -1506,6 +1506,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
<< A->getSpelling() << Scope;
Key = "a_key";
IndirectBranches = false;
+ BranchProtectionPAuthLR = false;
} else {
StringRef DiagMsg;
llvm::ARM::ParsedBranchProtection PBP;
@@ -1517,6 +1518,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
<< "b-key" << A->getAsString(Args);
Scope = PBP.Scope;
Key = PBP.Key;
+ BranchProtectionPAuthLR = PBP.BranchProtectionPAuthLR;
IndirectBranches = PBP.BranchTargetEnforcement;
}
@@ -1525,6 +1527,9 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
if (!Scope.equals("none"))
CmdArgs.push_back(
Args.MakeArgString(Twine("-msign-return-address-key=") + Key));
+ if (BranchProtectionPAuthLR)
+ CmdArgs.push_back(
+ Args.MakeArgString(Twine("-mbranch-protection-pauth-lr")));
if (IndirectBranches)
CmdArgs.push_back("-mbranch-target-enforce");
}
@@ -3198,13 +3203,13 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
options::OPT_fstrict_float_cast_overflow, false))
CmdArgs.push_back("-fno-strict-float-cast-overflow");
- if (const Arg *A = Args.getLastArg(options::OPT_fcx_limited_range))
+ if (Args.hasArg(options::OPT_fcx_limited_range))
CmdArgs.push_back("-fcx-limited-range");
- if (const Arg *A = Args.getLastArg(options::OPT_fcx_fortran_rules))
+ if (Args.hasArg(options::OPT_fcx_fortran_rules))
CmdArgs.push_back("-fcx-fortran-rules");
- if (const Arg *A = Args.getLastArg(options::OPT_fno_cx_limited_range))
+ if (Args.hasArg(options::OPT_fno_cx_limited_range))
CmdArgs.push_back("-fno-cx-limited-range");
- if (const Arg *A = Args.getLastArg(options::OPT_fno_cx_fortran_rules))
+ if (Args.hasArg(options::OPT_fno_cx_fortran_rules))
CmdArgs.push_back("-fno-cx-fortran-rules");
}
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 45901ee7157f..6eb0ed8f3fed 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1174,8 +1174,9 @@ static void addFortranMain(const ToolChain &TC, const ArgList &Args,
// The --whole-archive option needs to be part of the link line to make
// sure that the main() function from Fortran_main.a is pulled in by the
// linker. However, it shouldn't be used if it's already active.
- // TODO: Find an equivalent of `--whole-archive` for Darwin.
- if (!isWholeArchivePresent(Args) && !TC.getTriple().isMacOSX()) {
+ // TODO: Find an equivalent of `--whole-archive` for Darwin and AIX.
+ if (!isWholeArchivePresent(Args) && !TC.getTriple().isMacOSX() &&
+ !TC.getTriple().isOSAIX()) {
CmdArgs.push_back("--whole-archive");
CmdArgs.push_back("-lFortran_main");
CmdArgs.push_back("--no-whole-archive");
@@ -1317,28 +1318,28 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
const SanitizerArgs &SanArgs = TC.getSanitizerArgs(Args);
// Collect shared runtimes.
if (SanArgs.needsSharedRt()) {
- if (SanArgs.needsAsanRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsAsanRt()) {
SharedRuntimes.push_back("asan");
if (!Args.hasArg(options::OPT_shared) && !TC.getTriple().isAndroid())
HelperStaticRuntimes.push_back("asan-preinit");
}
- if (SanArgs.needsMemProfRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsMemProfRt()) {
SharedRuntimes.push_back("memprof");
if (!Args.hasArg(options::OPT_shared) && !TC.getTriple().isAndroid())
HelperStaticRuntimes.push_back("memprof-preinit");
}
- if (SanArgs.needsUbsanRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsUbsanRt()) {
if (SanArgs.requiresMinimalRuntime())
SharedRuntimes.push_back("ubsan_minimal");
else
SharedRuntimes.push_back("ubsan_standalone");
}
- if (SanArgs.needsScudoRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsScudoRt()) {
SharedRuntimes.push_back("scudo_standalone");
}
- if (SanArgs.needsTsanRt() && SanArgs.linkRuntimes())
+ if (SanArgs.needsTsanRt())
SharedRuntimes.push_back("tsan");
- if (SanArgs.needsHwasanRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsHwasanRt()) {
if (SanArgs.needsHwasanAliasesRt())
SharedRuntimes.push_back("hwasan_aliases");
else
@@ -1349,7 +1350,7 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
}
// The stats_client library is also statically linked into DSOs.
- if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes())
+ if (SanArgs.needsStatsRt())
StaticRuntimes.push_back("stats_client");
// Always link the static runtime regardless of DSO or executable.
@@ -1365,20 +1366,19 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
// Each static runtime that has a DSO counterpart above is excluded below,
// but runtimes that exist only as static are not affected by needsSharedRt.
- if (!SanArgs.needsSharedRt() && SanArgs.needsAsanRt() && SanArgs.linkRuntimes()) {
+ if (!SanArgs.needsSharedRt() && SanArgs.needsAsanRt()) {
StaticRuntimes.push_back("asan");
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("asan_cxx");
}
- if (!SanArgs.needsSharedRt() && SanArgs.needsMemProfRt() &&
- SanArgs.linkRuntimes()) {
+ if (!SanArgs.needsSharedRt() && SanArgs.needsMemProfRt()) {
StaticRuntimes.push_back("memprof");
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("memprof_cxx");
}
- if (!SanArgs.needsSharedRt() && SanArgs.needsHwasanRt() && SanArgs.linkRuntimes()) {
+ if (!SanArgs.needsSharedRt() && SanArgs.needsHwasanRt()) {
if (SanArgs.needsHwasanAliasesRt()) {
StaticRuntimes.push_back("hwasan_aliases");
if (SanArgs.linkCXXRuntimes())
@@ -1389,22 +1389,21 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
StaticRuntimes.push_back("hwasan_cxx");
}
}
- if (SanArgs.needsDfsanRt() && SanArgs.linkRuntimes())
+ if (SanArgs.needsDfsanRt())
StaticRuntimes.push_back("dfsan");
- if (SanArgs.needsLsanRt() && SanArgs.linkRuntimes())
+ if (SanArgs.needsLsanRt())
StaticRuntimes.push_back("lsan");
- if (SanArgs.needsMsanRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsMsanRt()) {
StaticRuntimes.push_back("msan");
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("msan_cxx");
}
- if (!SanArgs.needsSharedRt() && SanArgs.needsTsanRt() &&
- SanArgs.linkRuntimes()) {
+ if (!SanArgs.needsSharedRt() && SanArgs.needsTsanRt()) {
StaticRuntimes.push_back("tsan");
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("tsan_cxx");
}
- if (!SanArgs.needsSharedRt() && SanArgs.needsUbsanRt() && SanArgs.linkRuntimes()) {
+ if (!SanArgs.needsSharedRt() && SanArgs.needsUbsanRt()) {
if (SanArgs.requiresMinimalRuntime()) {
StaticRuntimes.push_back("ubsan_minimal");
} else {
@@ -1413,24 +1412,24 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
StaticRuntimes.push_back("ubsan_standalone_cxx");
}
}
- if (SanArgs.needsSafeStackRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsSafeStackRt()) {
NonWholeStaticRuntimes.push_back("safestack");
RequiredSymbols.push_back("__safestack_init");
}
- if (!(SanArgs.needsSharedRt() && SanArgs.needsUbsanRt() && SanArgs.linkRuntimes())) {
- if (SanArgs.needsCfiRt() && SanArgs.linkRuntimes())
+ if (!(SanArgs.needsSharedRt() && SanArgs.needsUbsanRt())) {
+ if (SanArgs.needsCfiRt())
StaticRuntimes.push_back("cfi");
- if (SanArgs.needsCfiDiagRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsCfiDiagRt()) {
StaticRuntimes.push_back("cfi_diag");
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("ubsan_standalone_cxx");
}
}
- if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) {
+ if (SanArgs.needsStatsRt()) {
NonWholeStaticRuntimes.push_back("stats");
RequiredSymbols.push_back("__sanitizer_stats_register");
}
- if (!SanArgs.needsSharedRt() && SanArgs.needsScudoRt() && SanArgs.linkRuntimes()) {
+ if (!SanArgs.needsSharedRt() && SanArgs.needsScudoRt()) {
StaticRuntimes.push_back("scudo_standalone");
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("scudo_standalone_cxx");
@@ -1441,13 +1440,15 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
// C runtime, etc). Returns true if sanitizer system deps need to be linked in.
bool tools::addSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs) {
+ const SanitizerArgs &SanArgs = TC.getSanitizerArgs(Args);
SmallVector<StringRef, 4> SharedRuntimes, StaticRuntimes,
NonWholeStaticRuntimes, HelperStaticRuntimes, RequiredSymbols;
- collectSanitizerRuntimes(TC, Args, SharedRuntimes, StaticRuntimes,
- NonWholeStaticRuntimes, HelperStaticRuntimes,
- RequiredSymbols);
+ if (SanArgs.linkRuntimes()) {
+ collectSanitizerRuntimes(TC, Args, SharedRuntimes, StaticRuntimes,
+ NonWholeStaticRuntimes, HelperStaticRuntimes,
+ RequiredSymbols);
+ }
- const SanitizerArgs &SanArgs = TC.getSanitizerArgs(Args);
// Inject libfuzzer dependencies.
if (SanArgs.needsFuzzer() && SanArgs.linkRuntimes() &&
!Args.hasArg(options::OPT_shared)) {
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp
index 835215a83c40..38361d6889a1 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -30,6 +30,7 @@
#include "llvm/Option/ArgList.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/RISCVISAInfo.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/TargetParser/TargetParser.h"
#include <system_error>
@@ -1715,6 +1716,129 @@ static void findCSKYMultilibs(const Driver &D, const llvm::Triple &TargetTriple,
Result.Multilibs = CSKYMultilibs;
}
+/// Extend the multi-lib re-use selection mechanism for RISC-V.
+/// This function will try to re-use multi-lib if they are compatible.
+/// Definition of compatible:
+/// - ABI must be the same.
+/// - multi-lib is a subset of current arch, e.g. multi-lib=march=rv32im
+/// is a subset of march=rv32imc.
+/// - march that contains atomic extension can't reuse multi-lib that
+/// doesn't have atomic, vice versa. e.g. multi-lib=march=rv32im and
+/// march=rv32ima are not compatible, because software and hardware
+/// atomic operation can't work together correctly.
+static bool
+selectRISCVMultilib(const MultilibSet &RISCVMultilibSet, StringRef Arch,
+ const Multilib::flags_list &Flags,
+ llvm::SmallVectorImpl<Multilib> &SelectedMultilibs) {
+ // Try to find the perfect matching multi-lib first.
+ if (RISCVMultilibSet.select(Flags, SelectedMultilibs))
+ return true;
+
+ Multilib::flags_list NewFlags;
+ std::vector<MultilibBuilder> NewMultilibs;
+
+ llvm::Expected<std::unique_ptr<llvm::RISCVISAInfo>> ParseResult =
+ llvm::RISCVISAInfo::parseArchString(
+ Arch, /*EnableExperimentalExtension=*/true,
+ /*ExperimentalExtensionVersionCheck=*/false);
+ if (!ParseResult) {
+ // Ignore any error here, we assume it will be handled in another place.
+ consumeError(ParseResult.takeError());
+ return false;
+ }
+
+ auto &ISAInfo = *ParseResult;
+
+ addMultilibFlag(ISAInfo->getXLen() == 32, "-m32", NewFlags);
+ addMultilibFlag(ISAInfo->getXLen() == 64, "-m64", NewFlags);
+
+ // Collect all flags except march=*
+ for (StringRef Flag : Flags) {
+ if (Flag.starts_with("!march=") || Flag.starts_with("-march="))
+ continue;
+
+ NewFlags.push_back(Flag.str());
+ }
+
+ llvm::StringSet<> AllArchExts;
+ // Reconstruct multi-lib list, and break march option into separated
+ // extension. e.g. march=rv32im -> +i +m
+ for (const auto &M : RISCVMultilibSet) {
+ bool Skip = false;
+
+ MultilibBuilder NewMultilib =
+ MultilibBuilder(M.gccSuffix(), M.osSuffix(), M.includeSuffix());
+ for (StringRef Flag : M.flags()) {
+ // Add back all flags except -march.
+ if (!Flag.consume_front("-march=")) {
+ NewMultilib.flag(Flag);
+ continue;
+ }
+
+ // Break down -march into individual extension.
+ llvm::Expected<std::unique_ptr<llvm::RISCVISAInfo>> MLConfigParseResult =
+ llvm::RISCVISAInfo::parseArchString(
+ Flag, /*EnableExperimentalExtension=*/true,
+ /*ExperimentalExtensionVersionCheck=*/false);
+ if (!MLConfigParseResult) {
+ // Ignore any error here, we assume it will handled in another place.
+ llvm::consumeError(MLConfigParseResult.takeError());
+
+ // We might get a parsing error if rv32e in the list, we could just skip
+ // that and process the rest of multi-lib configs.
+ Skip = true;
+ continue;
+ }
+ auto &MLConfigISAInfo = *MLConfigParseResult;
+
+ const llvm::RISCVISAInfo::OrderedExtensionMap &MLConfigArchExts =
+ MLConfigISAInfo->getExtensions();
+ for (auto MLConfigArchExt : MLConfigArchExts) {
+ auto ExtName = MLConfigArchExt.first;
+ NewMultilib.flag(Twine("-", ExtName).str());
+
+ if (AllArchExts.insert(ExtName).second) {
+ addMultilibFlag(ISAInfo->hasExtension(ExtName),
+ Twine("-", ExtName).str(), NewFlags);
+ }
+ }
+
+ // Check the XLEN explicitly.
+ if (MLConfigISAInfo->getXLen() == 32) {
+ NewMultilib.flag("-m32");
+ NewMultilib.flag("-m64", /*Disallow*/ true);
+ } else {
+ NewMultilib.flag("-m32", /*Disallow*/ true);
+ NewMultilib.flag("-m64");
+ }
+
+ // Atomic extension must be explicitly checked, soft and hard atomic
+ // operation never co-work correctly.
+ if (!MLConfigISAInfo->hasExtension("a"))
+ NewMultilib.flag("-a", /*Disallow*/ true);
+ }
+
+ if (Skip)
+ continue;
+
+ NewMultilibs.emplace_back(NewMultilib);
+ }
+
+ // Build an internal used only multi-lib list, used for checking any
+ // compatible multi-lib.
+ MultilibSet NewRISCVMultilibs =
+ MultilibSetBuilder().Either(NewMultilibs).makeMultilibSet();
+
+ if (NewRISCVMultilibs.select(NewFlags, SelectedMultilibs))
+ for (const Multilib &NewSelectedM : SelectedMultilibs)
+ for (const auto &M : RISCVMultilibSet)
+ // Look up the corresponding multi-lib entry in original multi-lib set.
+ if (M.gccSuffix() == NewSelectedM.gccSuffix())
+ return true;
+
+ return false;
+}
+
static void findRISCVBareMetalMultilibs(const Driver &D,
const llvm::Triple &TargetTriple,
StringRef Path, const ArgList &Args,
@@ -1766,7 +1890,8 @@ static void findRISCVBareMetalMultilibs(const Driver &D,
}
}
- if (RISCVMultilibs.select(Flags, Result.SelectedMultilibs))
+ if (selectRISCVMultilib(RISCVMultilibs, MArch, Flags,
+ Result.SelectedMultilibs))
Result.Multilibs = RISCVMultilibs;
}
diff --git a/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp b/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp
index bd319f21b05f..8489a30dd34a 100644
--- a/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp
+++ b/contrib/llvm-project/clang/lib/Format/ContinuationIndenter.cpp
@@ -583,17 +583,15 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
return true;
}
- // If the return type spans multiple lines, wrap before the function name.
- if (((Current.is(TT_FunctionDeclarationName) &&
- !State.Line->ReturnTypeWrapped &&
- // Don't break before a C# function when no break after return type.
- (!Style.isCSharp() ||
- Style.AlwaysBreakAfterReturnType != FormatStyle::RTBS_None) &&
- // Don't always break between a JavaScript `function` and the function
- // name.
- !Style.isJavaScript()) ||
- (Current.is(tok::kw_operator) && Previous.isNot(tok::coloncolon))) &&
- Previous.isNot(tok::kw_template) && CurrentState.BreakBeforeParameter) {
+ if (Current.is(TT_FunctionDeclarationName) &&
+ !State.Line->ReturnTypeWrapped &&
+ // Don't break before a C# function when no break after return type.
+ (!Style.isCSharp() ||
+ Style.AlwaysBreakAfterReturnType != FormatStyle::RTBS_None) &&
+ // Don't always break between a JavaScript `function` and the function
+ // name.
+ !Style.isJavaScript() && Previous.isNot(tok::kw_template) &&
+ CurrentState.BreakBeforeParameter) {
return true;
}
diff --git a/contrib/llvm-project/clang/lib/Format/Format.cpp b/contrib/llvm-project/clang/lib/Format/Format.cpp
index 668e959a9416..f798d555bf99 100644
--- a/contrib/llvm-project/clang/lib/Format/Format.cpp
+++ b/contrib/llvm-project/clang/lib/Format/Format.cpp
@@ -1315,7 +1315,6 @@ static void expandPresetsBraceWrapping(FormatStyle &Expanded) {
Expanded.BraceWrapping.AfterStruct = true;
Expanded.BraceWrapping.AfterUnion = true;
Expanded.BraceWrapping.AfterExternBlock = true;
- Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock;
Expanded.BraceWrapping.SplitEmptyFunction = true;
Expanded.BraceWrapping.SplitEmptyRecord = false;
break;
@@ -1335,7 +1334,6 @@ static void expandPresetsBraceWrapping(FormatStyle &Expanded) {
Expanded.BraceWrapping.AfterStruct = true;
Expanded.BraceWrapping.AfterUnion = true;
Expanded.BraceWrapping.AfterExternBlock = true;
- Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock;
Expanded.BraceWrapping.BeforeCatch = true;
Expanded.BraceWrapping.BeforeElse = true;
Expanded.BraceWrapping.BeforeLambdaBody = true;
@@ -1350,7 +1348,6 @@ static void expandPresetsBraceWrapping(FormatStyle &Expanded) {
Expanded.BraceWrapping.AfterObjCDeclaration = true;
Expanded.BraceWrapping.AfterStruct = true;
Expanded.BraceWrapping.AfterExternBlock = true;
- Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock;
Expanded.BraceWrapping.BeforeCatch = true;
Expanded.BraceWrapping.BeforeElse = true;
Expanded.BraceWrapping.BeforeLambdaBody = true;
@@ -1375,7 +1372,6 @@ static void expandPresetsBraceWrapping(FormatStyle &Expanded) {
/*SplitEmptyFunction=*/true,
/*SplitEmptyRecord=*/true,
/*SplitEmptyNamespace=*/true};
- Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock;
break;
case FormatStyle::BS_WebKit:
Expanded.BraceWrapping.AfterFunction = true;
@@ -1702,6 +1698,9 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
/*BasedOnStyle=*/"google",
},
};
+ GoogleStyle.AttributeMacros.push_back("GUARDED_BY");
+ GoogleStyle.AttributeMacros.push_back("ABSL_GUARDED_BY");
+
GoogleStyle.SpacesBeforeTrailingComments = 2;
GoogleStyle.Standard = FormatStyle::LS_Auto;
@@ -1909,7 +1908,6 @@ FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language) {
Style.BraceWrapping.AfterObjCDeclaration = true;
Style.BraceWrapping.AfterStruct = true;
Style.BraceWrapping.AfterExternBlock = true;
- Style.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock;
Style.BraceWrapping.BeforeCatch = true;
Style.BraceWrapping.BeforeElse = true;
Style.BraceWrapping.BeforeWhile = false;
diff --git a/contrib/llvm-project/clang/lib/Format/MatchFilePath.cpp b/contrib/llvm-project/clang/lib/Format/MatchFilePath.cpp
new file mode 100644
index 000000000000..412ee4954587
--- /dev/null
+++ b/contrib/llvm-project/clang/lib/Format/MatchFilePath.cpp
@@ -0,0 +1,122 @@
+//===--- MatchFilePath.cpp - Match file path with pattern -------*- 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file implements the functionality of matching a file path name to
+/// a pattern, similar to the POSIX fnmatch() function.
+///
+//===----------------------------------------------------------------------===//
+
+#include "MatchFilePath.h"
+
+using namespace llvm;
+
+namespace clang {
+namespace format {
+
+// Check whether `FilePath` matches `Pattern` based on POSIX (1003.1-2008)
+// 2.13.1, 2.13.2, and Rule 1 of 2.13.3.
+bool matchFilePath(StringRef Pattern, StringRef FilePath) {
+ assert(!Pattern.empty());
+ assert(!FilePath.empty());
+
+ // No match if `Pattern` ends with a non-meta character not equal to the last
+ // character of `FilePath`.
+ if (const auto C = Pattern.back(); !strchr("?*]", C) && C != FilePath.back())
+ return false;
+
+ constexpr auto Separator = '/';
+ const auto EOP = Pattern.size(); // End of `Pattern`.
+ const auto End = FilePath.size(); // End of `FilePath`.
+ unsigned I = 0; // Index to `Pattern`.
+
+ for (unsigned J = 0; J < End; ++J) {
+ if (I == EOP)
+ return false;
+
+ switch (const auto F = FilePath[J]; Pattern[I]) {
+ case '\\':
+ if (++I == EOP || F != Pattern[I])
+ return false;
+ break;
+ case '?':
+ if (F == Separator)
+ return false;
+ break;
+ case '*': {
+ while (++I < EOP && Pattern[I] == '*') { // Skip consecutive stars.
+ }
+ const auto K = FilePath.find(Separator, J); // Index of next `Separator`.
+ const bool NoMoreSeparatorsInFilePath = K == StringRef::npos;
+ if (I == EOP) // `Pattern` ends with a star.
+ return NoMoreSeparatorsInFilePath;
+ // `Pattern` ends with a lone backslash.
+ if (Pattern[I] == '\\' && ++I == EOP)
+ return false;
+ // The star is followed by a (possibly escaped) `Separator`.
+ if (Pattern[I] == Separator) {
+ if (NoMoreSeparatorsInFilePath)
+ return false;
+ J = K; // Skip to next `Separator` in `FilePath`.
+ break;
+ }
+ // Recurse.
+ for (auto Pat = Pattern.substr(I); J < End && FilePath[J] != Separator;
+ ++J) {
+ if (matchFilePath(Pat, FilePath.substr(J)))
+ return true;
+ }
+ return false;
+ }
+ case '[':
+ // Skip e.g. `[!]`.
+ if (I + 3 < EOP || (I + 3 == EOP && Pattern[I + 1] != '!')) {
+ // Skip unpaired `[`, brackets containing slashes, and `[]`.
+ if (const auto K = Pattern.find_first_of("]/", I + 1);
+ K != StringRef::npos && Pattern[K] == ']' && K > I + 1) {
+ if (F == Separator)
+ return false;
+ ++I; // After the `[`.
+ bool Negated = false;
+ if (Pattern[I] == '!') {
+ Negated = true;
+ ++I; // After the `!`.
+ }
+ bool Match = false;
+ do {
+ if (I + 2 < K && Pattern[I + 1] == '-') {
+ Match = Pattern[I] <= F && F <= Pattern[I + 2];
+ I += 3; // After the range, e.g. `A-Z`.
+ } else {
+ Match = F == Pattern[I++];
+ }
+ } while (!Match && I < K);
+ if (Negated ? Match : !Match)
+ return false;
+ I = K + 1; // After the `]`.
+ continue;
+ }
+ }
+ [[fallthrough]]; // Match `[` literally.
+ default:
+ if (F != Pattern[I])
+ return false;
+ }
+
+ ++I;
+ }
+
+ // Match trailing stars with null strings.
+ while (I < EOP && Pattern[I] == '*')
+ ++I;
+
+ return I == EOP;
+}
+
+} // namespace format
+} // namespace clang
diff --git a/contrib/llvm-project/clang/lib/Format/MatchFilePath.h b/contrib/llvm-project/clang/lib/Format/MatchFilePath.h
new file mode 100644
index 000000000000..482dab7c748e
--- /dev/null
+++ b/contrib/llvm-project/clang/lib/Format/MatchFilePath.h
@@ -0,0 +1,22 @@
+//===--- MatchFilePath.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_LIB_FORMAT_MATCHFILEPATH_H
+#define LLVM_CLANG_LIB_FORMAT_MATCHFILEPATH_H
+
+#include "llvm/ADT/StringRef.h"
+
+namespace clang {
+namespace format {
+
+bool matchFilePath(llvm::StringRef Pattern, llvm::StringRef FilePath);
+
+} // end namespace format
+} // end namespace clang
+
+#endif
diff --git a/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp b/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
index f3551af34243..3ac3aa3c5e3a 100644
--- a/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
+++ b/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
@@ -3403,7 +3403,8 @@ static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current,
continue;
}
if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() ||
- Tok->isOneOf(TT_PointerOrReference, TT_StartOfName, tok::ellipsis)) {
+ Tok->isOneOf(TT_PointerOrReference, TT_StartOfName, tok::ellipsis,
+ TT_TypeName)) {
return true;
}
if (Tok->isOneOf(tok::l_brace, TT_ObjCMethodExpr) || Tok->Tok.isLiteral())
diff --git a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp
index c38b4c884070..684609747a55 100644
--- a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1650,8 +1650,10 @@ void UnwrappedLineParser::parseStructuralElement(
return;
}
// In Verilog labels can be any expression, so we don't do them here.
- if (!Style.isVerilog() && Tokens->peekNextToken()->is(tok::colon) &&
- !Line->MustBeDeclaration) {
+ // JS doesn't have macros, and within classes colons indicate fields, not
+ // labels.
+ if (!Style.isJavaScript() && !Style.isVerilog() &&
+ Tokens->peekNextToken()->is(tok::colon) && !Line->MustBeDeclaration) {
nextToken();
Line->Tokens.begin()->Tok->MustBreakBefore = true;
FormatTok->setFinalizedType(TT_GotoLabelColon);
diff --git a/contrib/llvm-project/clang/lib/Headers/adcintrin.h b/contrib/llvm-project/clang/lib/Headers/adcintrin.h
new file mode 100644
index 000000000000..0065a1b543f8
--- /dev/null
+++ b/contrib/llvm-project/clang/lib/Headers/adcintrin.h
@@ -0,0 +1,160 @@
+/*===---- adcintrin.h - ADC intrinsics -------------------------------------===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __ADCINTRIN_H
+#define __ADCINTRIN_H
+
+#if !defined(__i386__) && !defined(__x86_64__)
+#error "This header is only meant to be used on x86 and x64 architecture"
+#endif
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
+
+/* Use C++ inline semantics in C++, GNU inline for C mode. */
+#if defined(__cplusplus)
+#define __INLINE __inline
+#else
+#define __INLINE static __inline
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/// Adds unsigned 32-bit integers \a __x and \a __y, plus 0 or 1 as indicated
+/// by the carry flag \a __cf. Stores the unsigned 32-bit sum in the memory
+/// at \a __p, and returns the 8-bit carry-out (carry flag).
+///
+/// \code{.operation}
+/// temp := (__cf == 0) ? 0 : 1
+/// Store32(__p, __x + __y + temp)
+/// result := CF
+/// \endcode
+///
+/// \headerfile <immintrin.h>
+///
+/// This intrinsic corresponds to the \c ADC instruction.
+///
+/// \param __cf
+/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
+/// \param __x
+/// A 32-bit unsigned addend.
+/// \param __y
+/// A 32-bit unsigned addend.
+/// \param __p
+/// Pointer to memory for storing the sum.
+/// \returns The 8-bit unsigned carry-out value.
+__INLINE unsigned char __DEFAULT_FN_ATTRS _addcarry_u32(unsigned char __cf,
+ unsigned int __x,
+ unsigned int __y,
+ unsigned int *__p) {
+ return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
+}
+
+/// Adds unsigned 32-bit integer \a __y to 0 or 1 as indicated by the carry
+/// flag \a __cf, and subtracts the result from unsigned 32-bit integer
+/// \a __x. Stores the unsigned 32-bit difference in the memory at \a __p,
+/// and returns the 8-bit carry-out (carry or overflow flag).
+///
+/// \code{.operation}
+/// temp := (__cf == 0) ? 0 : 1
+/// Store32(__p, __x - (__y + temp))
+/// result := CF
+/// \endcode
+///
+/// \headerfile <immintrin.h>
+///
+/// This intrinsic corresponds to the \c SBB instruction.
+///
+/// \param __cf
+/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
+/// \param __x
+/// The 32-bit unsigned minuend.
+/// \param __y
+/// The 32-bit unsigned subtrahend.
+/// \param __p
+/// Pointer to memory for storing the difference.
+/// \returns The 8-bit unsigned carry-out value.
+__INLINE unsigned char __DEFAULT_FN_ATTRS _subborrow_u32(unsigned char __cf,
+ unsigned int __x,
+ unsigned int __y,
+ unsigned int *__p) {
+ return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
+}
+
+#ifdef __x86_64__
+/// Adds unsigned 64-bit integers \a __x and \a __y, plus 0 or 1 as indicated
+/// by the carry flag \a __cf. Stores the unsigned 64-bit sum in the memory
+/// at \a __p, and returns the 8-bit carry-out (carry flag).
+///
+/// \code{.operation}
+/// temp := (__cf == 0) ? 0 : 1
+/// Store64(__p, __x + __y + temp)
+/// result := CF
+/// \endcode
+///
+/// \headerfile <immintrin.h>
+///
+/// This intrinsic corresponds to the \c ADC instruction.
+///
+/// \param __cf
+/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
+/// \param __x
+/// A 64-bit unsigned addend.
+/// \param __y
+/// A 64-bit unsigned addend.
+/// \param __p
+/// Pointer to memory for storing the sum.
+/// \returns The 8-bit unsigned carry-out value.
+__INLINE unsigned char __DEFAULT_FN_ATTRS
+_addcarry_u64(unsigned char __cf, unsigned long long __x,
+ unsigned long long __y, unsigned long long *__p) {
+ return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
+}
+
+/// Adds unsigned 64-bit integer \a __y to 0 or 1 as indicated by the carry
+/// flag \a __cf, and subtracts the result from unsigned 64-bit integer
+/// \a __x. Stores the unsigned 64-bit difference in the memory at \a __p,
+/// and returns the 8-bit carry-out (carry or overflow flag).
+///
+/// \code{.operation}
+/// temp := (__cf == 0) ? 0 : 1
+/// Store64(__p, __x - (__y + temp))
+/// result := CF
+/// \endcode
+///
+/// \headerfile <immintrin.h>
+///
+/// This intrinsic corresponds to the \c ADC instruction.
+///
+/// \param __cf
+/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
+/// \param __x
+/// The 64-bit unsigned minuend.
+/// \param __y
+/// The 64-bit unsigned subtrahend.
+/// \param __p
+/// Pointer to memory for storing the difference.
+/// \returns The 8-bit unsigned carry-out value.
+__INLINE unsigned char __DEFAULT_FN_ATTRS
+_subborrow_u64(unsigned char __cf, unsigned long long __x,
+ unsigned long long __y, unsigned long long *__p) {
+ return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
+}
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+
+#undef __INLINE
+#undef __DEFAULT_FN_ATTRS
+
+#endif /* __ADCINTRIN_H */
diff --git a/contrib/llvm-project/clang/lib/Headers/adxintrin.h b/contrib/llvm-project/clang/lib/Headers/adxintrin.h
index 20f6211e567b..bc6a4caf3533 100644
--- a/contrib/llvm-project/clang/lib/Headers/adxintrin.h
+++ b/contrib/llvm-project/clang/lib/Headers/adxintrin.h
@@ -15,7 +15,8 @@
#define __ADXINTRIN_H
/* Define the default attributes for the functions in this file. */
-#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
+#define __DEFAULT_FN_ATTRS \
+ __attribute__((__always_inline__, __nodebug__, __target__("adx")))
/* Use C++ inline semantics in C++, GNU inline for C mode. */
#if defined(__cplusplus)
@@ -53,10 +54,10 @@ extern "C" {
/// \param __p
/// Pointer to memory for storing the sum.
/// \returns The 8-bit unsigned carry-out value.
-__INLINE unsigned char
- __attribute__((__always_inline__, __nodebug__, __target__("adx")))
- _addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
- unsigned int *__p) {
+__INLINE unsigned char __DEFAULT_FN_ATTRS _addcarryx_u32(unsigned char __cf,
+ unsigned int __x,
+ unsigned int __y,
+ unsigned int *__p) {
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
}
@@ -84,137 +85,10 @@ __INLINE unsigned char
/// \param __p
/// Pointer to memory for storing the sum.
/// \returns The 8-bit unsigned carry-out value.
-__INLINE unsigned char
- __attribute__((__always_inline__, __nodebug__, __target__("adx")))
- _addcarryx_u64(unsigned char __cf, unsigned long long __x,
- unsigned long long __y, unsigned long long *__p) {
- return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
-}
-#endif
-
-/* Intrinsics that are also available if __ADX__ is undefined. */
-
-/// Adds unsigned 32-bit integers \a __x and \a __y, plus 0 or 1 as indicated
-/// by the carry flag \a __cf. Stores the unsigned 32-bit sum in the memory
-/// at \a __p, and returns the 8-bit carry-out (carry flag).
-///
-/// \code{.operation}
-/// temp := (__cf == 0) ? 0 : 1
-/// Store32(__p, __x + __y + temp)
-/// result := CF
-/// \endcode
-///
-/// \headerfile <immintrin.h>
-///
-/// This intrinsic corresponds to the \c ADC instruction.
-///
-/// \param __cf
-/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
-/// \param __x
-/// A 32-bit unsigned addend.
-/// \param __y
-/// A 32-bit unsigned addend.
-/// \param __p
-/// Pointer to memory for storing the sum.
-/// \returns The 8-bit unsigned carry-out value.
-__INLINE unsigned char __DEFAULT_FN_ATTRS _addcarry_u32(unsigned char __cf,
- unsigned int __x,
- unsigned int __y,
- unsigned int *__p) {
- return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
-}
-
-#ifdef __x86_64__
-/// Adds unsigned 64-bit integers \a __x and \a __y, plus 0 or 1 as indicated
-/// by the carry flag \a __cf. Stores the unsigned 64-bit sum in the memory
-/// at \a __p, and returns the 8-bit carry-out (carry flag).
-///
-/// \code{.operation}
-/// temp := (__cf == 0) ? 0 : 1
-/// Store64(__p, __x + __y + temp)
-/// result := CF
-/// \endcode
-///
-/// \headerfile <immintrin.h>
-///
-/// This intrinsic corresponds to the \c ADC instruction.
-///
-/// \param __cf
-/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
-/// \param __x
-/// A 64-bit unsigned addend.
-/// \param __y
-/// A 64-bit unsigned addend.
-/// \param __p
-/// Pointer to memory for storing the sum.
-/// \returns The 8-bit unsigned carry-out value.
__INLINE unsigned char __DEFAULT_FN_ATTRS
-_addcarry_u64(unsigned char __cf, unsigned long long __x,
- unsigned long long __y, unsigned long long *__p) {
- return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
-}
-#endif
-
-/// Adds unsigned 32-bit integer \a __y to 0 or 1 as indicated by the carry
-/// flag \a __cf, and subtracts the result from unsigned 32-bit integer
-/// \a __x. Stores the unsigned 32-bit difference in the memory at \a __p,
-/// and returns the 8-bit carry-out (carry or overflow flag).
-///
-/// \code{.operation}
-/// temp := (__cf == 0) ? 0 : 1
-/// Store32(__p, __x - (__y + temp))
-/// result := CF
-/// \endcode
-///
-/// \headerfile <immintrin.h>
-///
-/// This intrinsic corresponds to the \c SBB instruction.
-///
-/// \param __cf
-/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
-/// \param __x
-/// The 32-bit unsigned minuend.
-/// \param __y
-/// The 32-bit unsigned subtrahend.
-/// \param __p
-/// Pointer to memory for storing the difference.
-/// \returns The 8-bit unsigned carry-out value.
-__INLINE unsigned char __DEFAULT_FN_ATTRS _subborrow_u32(unsigned char __cf,
- unsigned int __x,
- unsigned int __y,
- unsigned int *__p) {
- return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
-}
-
-#ifdef __x86_64__
-/// Adds unsigned 64-bit integer \a __y to 0 or 1 as indicated by the carry
-/// flag \a __cf, and subtracts the result from unsigned 64-bit integer
-/// \a __x. Stores the unsigned 64-bit difference in the memory at \a __p,
-/// and returns the 8-bit carry-out (carry or overflow flag).
-///
-/// \code{.operation}
-/// temp := (__cf == 0) ? 0 : 1
-/// Store64(__p, __x - (__y + temp))
-/// result := CF
-/// \endcode
-///
-/// \headerfile <immintrin.h>
-///
-/// This intrinsic corresponds to the \c ADC instruction.
-///
-/// \param __cf
-/// The 8-bit unsigned carry flag; any non-zero value indicates carry.
-/// \param __x
-/// The 64-bit unsigned minuend.
-/// \param __y
-/// The 64-bit unsigned subtrahend.
-/// \param __p
-/// Pointer to memory for storing the difference.
-/// \returns The 8-bit unsigned carry-out value.
-__INLINE unsigned char __DEFAULT_FN_ATTRS
-_subborrow_u64(unsigned char __cf, unsigned long long __x,
+_addcarryx_u64(unsigned char __cf, unsigned long long __x,
unsigned long long __y, unsigned long long *__p) {
- return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
+ return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
}
#endif
@@ -222,6 +96,7 @@ _subborrow_u64(unsigned char __cf, unsigned long long __x,
}
#endif
+#undef __INLINE
#undef __DEFAULT_FN_ATTRS
#endif /* __ADXINTRIN_H */
diff --git a/contrib/llvm-project/clang/lib/Headers/immintrin.h b/contrib/llvm-project/clang/lib/Headers/immintrin.h
index 9bfe2fcdabdb..0149a1cdea63 100644
--- a/contrib/llvm-project/clang/lib/Headers/immintrin.h
+++ b/contrib/llvm-project/clang/lib/Headers/immintrin.h
@@ -580,9 +580,13 @@ _storebe_i64(void * __P, long long __D) {
#include <cetintrin.h>
#endif
-/* Some intrinsics inside adxintrin.h are available only on processors with ADX,
- * whereas others are also available at all times. */
+/* Intrinsics inside adcintrin.h are available at all times. */
+#include <adcintrin.h>
+
+#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
+ defined(__ADX__)
#include <adxintrin.h>
+#endif
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
defined(__RDSEED__)
diff --git a/contrib/llvm-project/clang/lib/Headers/riscv_bitmanip.h b/contrib/llvm-project/clang/lib/Headers/riscv_bitmanip.h
index 1a81cc8618c9..2bc7ee022a96 100644
--- a/contrib/llvm-project/clang/lib/Headers/riscv_bitmanip.h
+++ b/contrib/llvm-project/clang/lib/Headers/riscv_bitmanip.h
@@ -34,7 +34,7 @@ __riscv_ctz_32(uint32_t __x) {
static __inline__ unsigned __attribute__((__always_inline__, __nodebug__))
__riscv_cpop_32(uint32_t __x) {
- return __builtin_riscv_cpop_32(__x);
+ return __builtin_popcount(__x);
}
#if __riscv_xlen == 64
@@ -55,7 +55,7 @@ __riscv_ctz_64(uint64_t __x) {
static __inline__ unsigned __attribute__((__always_inline__, __nodebug__))
__riscv_cpop_64(uint64_t __x) {
- return __builtin_riscv_cpop_64(__x);
+ return __builtin_popcountll(__x);
}
#endif
#endif // defined(__riscv_zbb)
@@ -120,7 +120,23 @@ __riscv_zip_32(uint32_t __x) {
#endif
#endif // defined(__riscv_zbkb)
-#if defined(__riscv_zbkc)
+#if defined(__riscv_zbc)
+#if __riscv_xlen == 32
+static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
+__riscv_clmulr_32(uint32_t __x, uint32_t __y) {
+ return __builtin_riscv_clmulr_32(__x, __y);
+}
+#endif
+
+#if __riscv_xlen == 64
+static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
+__riscv_clmulr_64(uint64_t __x, uint64_t __y) {
+ return __builtin_riscv_clmulr_64(__x, __y);
+}
+#endif
+#endif // defined(__riscv_zbc)
+
+#if defined(__riscv_zbkc) || defined(__riscv_zbc)
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__riscv_clmul_32(uint32_t __x, uint32_t __y) {
return __builtin_riscv_clmul_32(__x, __y);
@@ -144,7 +160,7 @@ __riscv_clmulh_64(uint64_t __x, uint64_t __y) {
return __builtin_riscv_clmulh_64(__x, __y);
}
#endif
-#endif // defined(__riscv_zbkc)
+#endif // defined(__riscv_zbkc) || defined(__riscv_zbc)
#if defined(__riscv_zbkx)
#if __riscv_xlen == 32
diff --git a/contrib/llvm-project/clang/lib/Interpreter/CodeCompletion.cpp b/contrib/llvm-project/clang/lib/Interpreter/CodeCompletion.cpp
index c40e11b9d1ec..25183ae9eeb9 100644
--- a/contrib/llvm-project/clang/lib/Interpreter/CodeCompletion.cpp
+++ b/contrib/llvm-project/clang/lib/Interpreter/CodeCompletion.cpp
@@ -12,6 +12,7 @@
#include "clang/Interpreter/CodeCompletion.h"
#include "clang/AST/ASTImporter.h"
+#include "clang/AST/DeclLookups.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/Basic/IdentifierTable.h"
@@ -23,6 +24,8 @@
#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Sema/CodeCompleteOptions.h"
#include "clang/Sema/Sema.h"
+#include "llvm/Support/Debug.h"
+#define DEBUG_TYPE "REPLCC"
namespace clang {
@@ -39,11 +42,15 @@ clang::CodeCompleteOptions getClangCompleteOpts() {
class ReplCompletionConsumer : public CodeCompleteConsumer {
public:
- ReplCompletionConsumer(std::vector<std::string> &Results)
+ ReplCompletionConsumer(std::vector<std::string> &Results,
+ ReplCodeCompleter &CC)
: CodeCompleteConsumer(getClangCompleteOpts()),
CCAllocator(std::make_shared<GlobalCodeCompletionAllocator>()),
- CCTUInfo(CCAllocator), Results(Results){};
+ CCTUInfo(CCAllocator), Results(Results), CC(CC) {}
+ // The entry of handling code completion. When the function is called, we
+ // create a `Context`-based handler (see classes defined below) to handle each
+ // completion result.
void ProcessCodeCompleteResults(class Sema &S, CodeCompletionContext Context,
CodeCompletionResult *InResults,
unsigned NumResults) final;
@@ -56,26 +63,147 @@ private:
std::shared_ptr<GlobalCodeCompletionAllocator> CCAllocator;
CodeCompletionTUInfo CCTUInfo;
std::vector<std::string> &Results;
+ ReplCodeCompleter &CC;
+};
+
+/// The class CompletionContextHandler contains four interfaces, each of
+/// which handles one type of completion result.
+/// Its derived classes are used to create concrete handlers based on
+/// \c CodeCompletionContext.
+class CompletionContextHandler {
+protected:
+ CodeCompletionContext CCC;
+ std::vector<std::string> &Results;
+
+private:
+ Sema &S;
+
+public:
+ CompletionContextHandler(Sema &S, CodeCompletionContext CCC,
+ std::vector<std::string> &Results)
+ : CCC(CCC), Results(Results), S(S) {}
+
+ virtual ~CompletionContextHandler() = default;
+ /// Converts a Declaration completion result to a completion string, and then
+ /// stores it in Results.
+ virtual void handleDeclaration(const CodeCompletionResult &Result) {
+ auto PreferredType = CCC.getPreferredType();
+ if (PreferredType.isNull()) {
+ Results.push_back(Result.Declaration->getName().str());
+ return;
+ }
+
+ if (auto *VD = dyn_cast<VarDecl>(Result.Declaration)) {
+ auto ArgumentType = VD->getType();
+ if (PreferredType->isReferenceType()) {
+ QualType RT = PreferredType->castAs<ReferenceType>()->getPointeeType();
+ Sema::ReferenceConversions RefConv;
+ Sema::ReferenceCompareResult RefRelationship =
+ S.CompareReferenceRelationship(SourceLocation(), RT, ArgumentType,
+ &RefConv);
+ switch (RefRelationship) {
+ case Sema::Ref_Compatible:
+ case Sema::Ref_Related:
+ Results.push_back(VD->getName().str());
+ break;
+ case Sema::Ref_Incompatible:
+ break;
+ }
+ } else if (S.Context.hasSameType(ArgumentType, PreferredType)) {
+ Results.push_back(VD->getName().str());
+ }
+ }
+ }
+
+ /// Converts a Keyword completion result to a completion string, and then
+ /// stores it in Results.
+ virtual void handleKeyword(const CodeCompletionResult &Result) {
+ auto Prefix = S.getPreprocessor().getCodeCompletionFilter();
+ // Add keyword to the completion results only if we are in a type-aware
+ // situation.
+ if (!CCC.getBaseType().isNull() || !CCC.getPreferredType().isNull())
+ return;
+ if (StringRef(Result.Keyword).starts_with(Prefix))
+ Results.push_back(Result.Keyword);
+ }
+
+ /// Converts a Pattern completion result to a completion string, and then
+ /// stores it in Results.
+ virtual void handlePattern(const CodeCompletionResult &Result) {}
+
+ /// Converts a Macro completion result to a completion string, and then stores
+ /// it in Results.
+ virtual void handleMacro(const CodeCompletionResult &Result) {}
+};
+
+class DotMemberAccessHandler : public CompletionContextHandler {
+public:
+ DotMemberAccessHandler(Sema &S, CodeCompletionContext CCC,
+ std::vector<std::string> &Results)
+ : CompletionContextHandler(S, CCC, Results) {}
+ void handleDeclaration(const CodeCompletionResult &Result) override {
+ auto *ID = Result.Declaration->getIdentifier();
+ if (!ID)
+ return;
+ if (!isa<CXXMethodDecl>(Result.Declaration))
+ return;
+ const auto *Fun = cast<CXXMethodDecl>(Result.Declaration);
+ if (Fun->getParent()->getCanonicalDecl() ==
+ CCC.getBaseType()->getAsCXXRecordDecl()->getCanonicalDecl()) {
+ LLVM_DEBUG(llvm::dbgs() << "[In HandleCodeCompleteDOT] Name : "
+ << ID->getName() << "\n");
+ Results.push_back(ID->getName().str());
+ }
+ }
+
+ void handleKeyword(const CodeCompletionResult &Result) override {}
};
void ReplCompletionConsumer::ProcessCodeCompleteResults(
class Sema &S, CodeCompletionContext Context,
CodeCompletionResult *InResults, unsigned NumResults) {
- for (unsigned I = 0; I < NumResults; ++I) {
+
+ auto Prefix = S.getPreprocessor().getCodeCompletionFilter();
+ CC.Prefix = Prefix;
+
+ std::unique_ptr<CompletionContextHandler> CCH;
+
+ // initialize fine-grained code completion handler based on the code
+ // completion context.
+ switch (Context.getKind()) {
+ case CodeCompletionContext::CCC_DotMemberAccess:
+ CCH.reset(new DotMemberAccessHandler(S, Context, this->Results));
+ break;
+ default:
+ CCH.reset(new CompletionContextHandler(S, Context, this->Results));
+ };
+
+ for (unsigned I = 0; I < NumResults; I++) {
auto &Result = InResults[I];
switch (Result.Kind) {
case CodeCompletionResult::RK_Declaration:
- if (auto *ID = Result.Declaration->getIdentifier()) {
- Results.push_back(ID->getName().str());
+ if (Result.Hidden) {
+ break;
+ }
+ if (!Result.Declaration->getDeclName().isIdentifier() ||
+ !Result.Declaration->getName().starts_with(Prefix)) {
+ break;
}
+ CCH->handleDeclaration(Result);
break;
case CodeCompletionResult::RK_Keyword:
- Results.push_back(Result.Keyword);
+ CCH->handleKeyword(Result);
break;
- default:
+ case CodeCompletionResult::RK_Macro:
+ CCH->handleMacro(Result);
+ break;
+ case CodeCompletionResult::RK_Pattern:
+ CCH->handlePattern(Result);
break;
}
}
+
+ std::sort(Results.begin(), Results.end());
}
class IncrementalSyntaxOnlyAction : public SyntaxOnlyAction {
@@ -118,6 +246,16 @@ void IncrementalSyntaxOnlyAction::ExecuteAction() {
CI.getASTContext().getTranslationUnitDecl()->setHasExternalVisibleStorage(
true);
+ // Load all external decls into current context. Under the hood, it calls
+ // ExternalSource::completeVisibleDeclsMap, which make all decls on the redecl
+ // chain visible.
+ //
+ // This is crucial to code completion on dot members, since a bound variable
+ // before "." would be otherwise treated out-of-scope.
+ //
+ // clang-repl> Foo f1;
+ // clang-repl> f1.<tab>
+ CI.getASTContext().getTranslationUnitDecl()->lookups();
SyntaxOnlyAction::ExecuteAction();
}
@@ -134,6 +272,7 @@ ExternalSource::ExternalSource(ASTContext &ChildASTCtxt, FileManager &ChildFM,
bool ExternalSource::FindExternalVisibleDeclsByName(const DeclContext *DC,
DeclarationName Name) {
+
IdentifierTable &ParentIdTable = ParentASTCtxt.Idents;
auto ParentDeclName =
@@ -159,29 +298,67 @@ void ExternalSource::completeVisibleDeclsMap(
for (auto *DeclCtxt = ParentTUDeclCtxt; DeclCtxt != nullptr;
DeclCtxt = DeclCtxt->getPreviousDecl()) {
for (auto &IDeclContext : DeclCtxt->decls()) {
- if (NamedDecl *Decl = llvm::dyn_cast<NamedDecl>(IDeclContext)) {
- if (auto DeclOrErr = Importer->Import(Decl)) {
- if (NamedDecl *importedNamedDecl =
- llvm::dyn_cast<NamedDecl>(*DeclOrErr)) {
- SetExternalVisibleDeclsForName(ChildDeclContext,
- importedNamedDecl->getDeclName(),
- importedNamedDecl);
- }
-
- } else {
- llvm::consumeError(DeclOrErr.takeError());
- }
+ if (!llvm::isa<NamedDecl>(IDeclContext))
+ continue;
+
+ NamedDecl *Decl = llvm::cast<NamedDecl>(IDeclContext);
+
+ auto DeclOrErr = Importer->Import(Decl);
+ if (!DeclOrErr) {
+ // if an error happens, it usually means the decl has already been
+ // imported or the decl is a result of a failed import. But in our
+ // case, every import is fresh each time code completion is
+ // triggered. So Import usually doesn't fail. If it does, it just means
+ // the related decl can't be used in code completion and we can safely
+ // drop it.
+ llvm::consumeError(DeclOrErr.takeError());
+ continue;
}
+
+ if (!llvm::isa<NamedDecl>(*DeclOrErr))
+ continue;
+
+ NamedDecl *importedNamedDecl = llvm::cast<NamedDecl>(*DeclOrErr);
+
+ SetExternalVisibleDeclsForName(ChildDeclContext,
+ importedNamedDecl->getDeclName(),
+ importedNamedDecl);
+
+ if (!llvm::isa<CXXRecordDecl>(importedNamedDecl))
+ continue;
+
+ auto *Record = llvm::cast<CXXRecordDecl>(importedNamedDecl);
+
+ if (auto Err = Importer->ImportDefinition(Decl)) {
+ // the same as above
+ consumeError(std::move(Err));
+ continue;
+ }
+
+ Record->setHasLoadedFieldsFromExternalStorage(true);
+ LLVM_DEBUG(llvm::dbgs()
+ << "\nCXXRecrod : " << Record->getName() << " size(methods): "
+ << std::distance(Record->method_begin(), Record->method_end())
+ << " has def?: " << Record->hasDefinition()
+ << " # (methods): "
+ << std::distance(Record->getDefinition()->method_begin(),
+ Record->getDefinition()->method_end())
+ << "\n");
+ for (auto *Meth : Record->methods())
+ SetExternalVisibleDeclsForName(ChildDeclContext, Meth->getDeclName(),
+ Meth);
}
ChildDeclContext->setHasExternalLexicalStorage(false);
}
}
-void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
- unsigned Line, unsigned Col, const CompilerInstance *ParentCI,
- std::vector<std::string> &CCResults) {
+void ReplCodeCompleter::codeComplete(CompilerInstance *InterpCI,
+ llvm::StringRef Content, unsigned Line,
+ unsigned Col,
+ const CompilerInstance *ParentCI,
+ std::vector<std::string> &CCResults) {
auto DiagOpts = DiagnosticOptions();
- auto consumer = ReplCompletionConsumer(CCResults);
+ auto consumer = ReplCompletionConsumer(CCResults, *this);
auto diag = InterpCI->getDiagnosticsPtr();
std::unique_ptr<ASTUnit> AU(ASTUnit::LoadFromCompilerInvocationAction(
diff --git a/contrib/llvm-project/clang/lib/Interpreter/Interpreter.cpp b/contrib/llvm-project/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e..c9fcef5b5b5a 100644
--- a/contrib/llvm-project/clang/lib/Interpreter/Interpreter.cpp
+++ b/contrib/llvm-project/clang/lib/Interpreter/Interpreter.cpp
@@ -319,6 +319,10 @@ const CompilerInstance *Interpreter::getCompilerInstance() const {
return IncrParser->getCI();
}
+CompilerInstance *Interpreter::getCompilerInstance() {
+ return IncrParser->getCI();
+}
+
llvm::Expected<llvm::orc::LLJIT &> Interpreter::getExecutionEngine() {
if (!IncrExecutor) {
if (auto Err = CreateExecutor())
diff --git a/contrib/llvm-project/clang/lib/Lex/PPDirectives.cpp b/contrib/llvm-project/clang/lib/Lex/PPDirectives.cpp
index 112bc8dc572c..9f82a6d073e3 100644
--- a/contrib/llvm-project/clang/lib/Lex/PPDirectives.cpp
+++ b/contrib/llvm-project/clang/lib/Lex/PPDirectives.cpp
@@ -1858,11 +1858,18 @@ static void diagnoseAutoModuleImport(
// path to the file, build a properly-cased replacement in the vector,
// and return true if the replacement should be suggested.
static bool trySimplifyPath(SmallVectorImpl<StringRef> &Components,
- StringRef RealPathName) {
+ StringRef RealPathName,
+ llvm::sys::path::Style Separator) {
auto RealPathComponentIter = llvm::sys::path::rbegin(RealPathName);
auto RealPathComponentEnd = llvm::sys::path::rend(RealPathName);
int Cnt = 0;
bool SuggestReplacement = false;
+
+ auto IsSep = [Separator](StringRef Component) {
+ return Component.size() == 1 &&
+ llvm::sys::path::is_separator(Component[0], Separator);
+ };
+
// Below is a best-effort to handle ".." in paths. It is admittedly
// not 100% correct in the presence of symlinks.
for (auto &Component : llvm::reverse(Components)) {
@@ -1872,10 +1879,11 @@ static bool trySimplifyPath(SmallVectorImpl<StringRef> &Components,
} else if (Cnt) {
--Cnt;
} else if (RealPathComponentIter != RealPathComponentEnd) {
- if (Component != *RealPathComponentIter) {
- // If these path components differ by more than just case, then we
- // may be looking at symlinked paths. Bail on this diagnostic to avoid
- // noisy false positives.
+ if (!IsSep(Component) && !IsSep(*RealPathComponentIter) &&
+ Component != *RealPathComponentIter) {
+ // If these non-separator path components differ by more than just case,
+ // then we may be looking at symlinked paths. Bail on this diagnostic to
+ // avoid noisy false positives.
SuggestReplacement =
RealPathComponentIter->equals_insensitive(Component);
if (!SuggestReplacement)
@@ -2451,7 +2459,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
}
#endif
- if (trySimplifyPath(Components, RealPathName)) {
+ if (trySimplifyPath(Components, RealPathName, BackslashStyle)) {
SmallString<128> Path;
Path.reserve(Name.size()+2);
Path.push_back(isAngled ? '<' : '"');
@@ -2474,7 +2482,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
// got copied when the C: was processed and we want to skip that entry.
if (!(Component.size() == 1 && IsSep(Component[0])))
Path.append(Component);
- else if (!Path.empty())
+ else if (Path.size() != 1)
continue;
// Append the separator(s) the user used, or the close quote
diff --git a/contrib/llvm-project/clang/lib/Parse/ParseOpenACC.cpp b/contrib/llvm-project/clang/lib/Parse/ParseOpenACC.cpp
index f7f096762e91..67325f0a286a 100644
--- a/contrib/llvm-project/clang/lib/Parse/ParseOpenACC.cpp
+++ b/contrib/llvm-project/clang/lib/Parse/ParseOpenACC.cpp
@@ -69,6 +69,29 @@ OpenACCDirectiveKindEx getOpenACCDirectiveKind(Token Tok) {
.Default(OpenACCDirectiveKindEx::Invalid);
}
+// Translate single-token string representations to the OpenCC Clause Kind.
+OpenACCClauseKind getOpenACCClauseKind(Token Tok) {
+ // auto is a keyword in some language modes, so make sure we parse it
+ // correctly.
+ if (Tok.is(tok::kw_auto))
+ return OpenACCClauseKind::Auto;
+
+ if (!Tok.is(tok::identifier))
+ return OpenACCClauseKind::Invalid;
+
+ return llvm::StringSwitch<OpenACCClauseKind>(
+ Tok.getIdentifierInfo()->getName())
+ .Case("auto", OpenACCClauseKind::Auto)
+ .Case("finalize", OpenACCClauseKind::Finalize)
+ .Case("if_present", OpenACCClauseKind::IfPresent)
+ .Case("independent", OpenACCClauseKind::Independent)
+ .Case("nohost", OpenACCClauseKind::NoHost)
+ .Case("seq", OpenACCClauseKind::Seq)
+ .Case("vector", OpenACCClauseKind::Vector)
+ .Case("worker", OpenACCClauseKind::Worker)
+ .Default(OpenACCClauseKind::Invalid);
+}
+
// Since 'atomic' is effectively a compound directive, this will decode the
// second part of the directive.
OpenACCAtomicKind getOpenACCAtomicKind(Token Tok) {
@@ -164,6 +187,10 @@ ParseOpenACCEnterExitDataDirective(Parser &P, Token FirstTok,
return OpenACCDirectiveKind::Invalid;
}
+ // Consume the second name anyway, this way we can continue on without making
+ // this oddly look like a clause.
+ P.ConsumeAnyToken();
+
if (!isOpenACCDirectiveKind(OpenACCDirectiveKind::Data, SecondTok)) {
if (!SecondTok.is(tok::identifier))
P.Diag(SecondTok, diag::err_expected) << tok::identifier;
@@ -174,8 +201,6 @@ ParseOpenACCEnterExitDataDirective(Parser &P, Token FirstTok,
return OpenACCDirectiveKind::Invalid;
}
- P.ConsumeToken();
-
return ExtDirKind == OpenACCDirectiveKindEx::Enter
? OpenACCDirectiveKind::EnterData
: OpenACCDirectiveKind::ExitData;
@@ -208,6 +233,10 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
// introspect on the spelling before then.
if (FirstTok.isNot(tok::identifier)) {
P.Diag(FirstTok, diag::err_acc_missing_directive);
+
+ if (P.getCurToken().isNot(tok::annot_pragma_openacc_end))
+ P.ConsumeAnyToken();
+
return OpenACCDirectiveKind::Invalid;
}
@@ -262,12 +291,57 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
return DirKind;
}
+// The OpenACC Clause List is a comma or space-delimited list of clauses (see
+// the comment on ParseOpenACCClauseList). The concept of a 'clause' doesn't
+// really have its owner grammar and each individual one has its own definition.
+// However, they all are named with a single-identifier (or auto!) token,
+// followed in some cases by either braces or parens.
+bool ParseOpenACCClause(Parser &P) {
+ if (!P.getCurToken().isOneOf(tok::identifier, tok::kw_auto))
+ return P.Diag(P.getCurToken(), diag::err_expected) << tok::identifier;
+
+ OpenACCClauseKind Kind = getOpenACCClauseKind(P.getCurToken());
+
+ if (Kind == OpenACCClauseKind::Invalid)
+ return P.Diag(P.getCurToken(), diag::err_acc_invalid_clause)
+ << P.getCurToken().getIdentifierInfo();
+
+ // Consume the clause name.
+ P.ConsumeToken();
+
+ // FIXME: For future clauses, we need to handle parens/etc below.
+ return false;
+}
+
+// Skip until we see the end of pragma token, but don't consume it. This is us
+// just giving up on the rest of the pragma so we can continue executing. We
+// have to do this because 'SkipUntil' considers paren balancing, which isn't
+// what we want.
+void SkipUntilEndOfDirective(Parser &P) {
+ while (P.getCurToken().isNot(tok::annot_pragma_openacc_end))
+ P.ConsumeAnyToken();
+}
+
+// OpenACC 3.3, section 1.7:
+// To simplify the specification and convey appropriate constraint information,
+// a pqr-list is a comma-separated list of pdr items. The one exception is a
+// clause-list, which is a list of one or more clauses optionally separated by
+// commas.
void ParseOpenACCClauseList(Parser &P) {
- // FIXME: In the future, we'll start parsing the clauses here, but for now we
- // haven't implemented that, so just emit the unimplemented diagnostic and
- // fail reasonably.
- if (P.getCurToken().isNot(tok::annot_pragma_openacc_end))
- P.Diag(P.getCurToken(), diag::warn_pragma_acc_unimplemented_clause_parsing);
+ bool FirstClause = true;
+ while (P.getCurToken().isNot(tok::annot_pragma_openacc_end)) {
+ // Comma is optional in a clause-list.
+ if (!FirstClause && P.getCurToken().is(tok::comma))
+ P.ConsumeToken();
+ FirstClause = false;
+
+ // Recovering from a bad clause is really difficult, so we just give up on
+ // error.
+ if (ParseOpenACCClause(P)) {
+ SkipUntilEndOfDirective(P);
+ return;
+ }
+ }
}
} // namespace
@@ -499,7 +573,9 @@ void Parser::ParseOpenACCDirective() {
ParseOpenACCClauseList(*this);
Diag(getCurToken(), diag::warn_pragma_acc_unimplemented);
- SkipUntil(tok::annot_pragma_openacc_end);
+ assert(Tok.is(tok::annot_pragma_openacc_end) &&
+ "Didn't parse all OpenACC Clauses");
+ ConsumeAnnotationToken();
}
// Parse OpenACC directive on a declaration.
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp b/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp
index d4a40b850cea..2a69325f0295 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp
@@ -3156,7 +3156,6 @@ static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
const FunctionDecl *FD,
ArmStreamingType BuiltinType) {
ArmStreamingType FnType = getArmStreamingFnType(FD);
-
if (FnType == ArmStreaming && BuiltinType == ArmNonStreaming) {
S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
<< TheCall->getSourceRange() << "streaming";
@@ -3168,9 +3167,77 @@ static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
<< TheCall->getSourceRange() << "streaming compatible";
return;
}
+
+ if (FnType == ArmNonStreaming && BuiltinType == ArmStreaming) {
+ S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
+ << TheCall->getSourceRange() << "non-streaming";
+ }
+}
+
+static bool hasSMEZAState(const FunctionDecl *FD) {
+ if (FD->hasAttr<ArmNewZAAttr>())
+ return true;
+ if (const auto *T = FD->getType()->getAs<FunctionProtoType>())
+ if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateZASharedMask)
+ return true;
+ return false;
+}
+
+static bool hasSMEZAState(unsigned BuiltinID) {
+ switch (BuiltinID) {
+ default:
+ return false;
+#define GET_SME_BUILTIN_HAS_ZA_STATE
+#include "clang/Basic/arm_sme_builtins_za_state.inc"
+#undef GET_SME_BUILTIN_HAS_ZA_STATE
+ }
+}
+
+bool Sema::CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
+ if (const FunctionDecl *FD = getCurFunctionDecl()) {
+ std::optional<ArmStreamingType> BuiltinType;
+
+ switch (BuiltinID) {
+#define GET_SME_STREAMING_ATTRS
+#include "clang/Basic/arm_sme_streaming_attrs.inc"
+#undef GET_SME_STREAMING_ATTRS
+ }
+
+ if (BuiltinType)
+ checkArmStreamingBuiltin(*this, TheCall, FD, *BuiltinType);
+
+ if (hasSMEZAState(BuiltinID) && !hasSMEZAState(FD))
+ Diag(TheCall->getBeginLoc(),
+ diag::warn_attribute_arm_za_builtin_no_za_state)
+ << TheCall->getSourceRange();
+ }
+
+ // Range check SME intrinsics that take immediate values.
+ SmallVector<std::tuple<int, int, int>, 3> ImmChecks;
+
+ switch (BuiltinID) {
+ default:
+ return false;
+#define GET_SME_IMMEDIATE_CHECK
+#include "clang/Basic/arm_sme_sema_rangechecks.inc"
+#undef GET_SME_IMMEDIATE_CHECK
+ }
+
+ return ParseSVEImmChecks(TheCall, ImmChecks);
}
bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
+ if (const FunctionDecl *FD = getCurFunctionDecl()) {
+ std::optional<ArmStreamingType> BuiltinType;
+
+ switch (BuiltinID) {
+#define GET_SVE_STREAMING_ATTRS
+#include "clang/Basic/arm_sve_streaming_attrs.inc"
+#undef GET_SVE_STREAMING_ATTRS
+ }
+ if (BuiltinType)
+ checkArmStreamingBuiltin(*this, TheCall, FD, *BuiltinType);
+ }
// Range check SVE intrinsics that take immediate values.
SmallVector<std::tuple<int, int, int>, 3> ImmChecks;
@@ -3180,9 +3247,6 @@ bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
#define GET_SVE_IMMEDIATE_CHECK
#include "clang/Basic/arm_sve_sema_rangechecks.inc"
#undef GET_SVE_IMMEDIATE_CHECK
-#define GET_SME_IMMEDIATE_CHECK
-#include "clang/Basic/arm_sme_sema_rangechecks.inc"
-#undef GET_SME_IMMEDIATE_CHECK
}
return ParseSVEImmChecks(TheCall, ImmChecks);
@@ -3569,6 +3633,9 @@ bool Sema::CheckAArch64BuiltinFunctionCall(const TargetInfo &TI,
if (CheckSVEBuiltinFunctionCall(BuiltinID, TheCall))
return true;
+ if (CheckSMEBuiltinFunctionCall(BuiltinID, TheCall))
+ return true;
+
// For intrinsics which take an immediate value as part of the instruction,
// range check them here.
unsigned i = 0, l = 0, u = 0;
@@ -5322,7 +5389,7 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
QualType Op2Type = TheCall->getArg(1)->getType();
QualType Op3Type = TheCall->getArg(2)->getType();
uint64_t ElemSize = Op1Type->isRVVType(32, false) ? 32 : 64;
- if (ElemSize == 64 && !TI.hasFeature("experimental-zvknhb"))
+ if (ElemSize == 64 && !TI.hasFeature("zvknhb"))
return Diag(TheCall->getBeginLoc(),
diag::err_riscv_type_requires_extension)
<< Op1Type << "zvknhb";
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp b/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp
index be6a136ef37b..ffbe317d5599 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp
@@ -2005,12 +2005,12 @@ static bool ShouldDiagnoseUnusedDecl(const LangOptions &LangOpts,
if (D->isInvalidDecl())
return false;
- if (auto *DD = dyn_cast<DecompositionDecl>(D)) {
+ if (const auto *DD = dyn_cast<DecompositionDecl>(D)) {
// For a decomposition declaration, warn if none of the bindings are
// referenced, instead of if the variable itself is referenced (which
// it is, by the bindings' expressions).
bool IsAllPlaceholders = true;
- for (auto *BD : DD->bindings()) {
+ for (const auto *BD : DD->bindings()) {
if (BD->isReferenced())
return false;
IsAllPlaceholders = IsAllPlaceholders && BD->isPlaceholderVar(LangOpts);
@@ -2054,7 +2054,7 @@ static bool ShouldDiagnoseUnusedDecl(const LangOptions &LangOpts,
if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
const Expr *Init = VD->getInit();
- if (const auto *Cleanups = dyn_cast_or_null<ExprWithCleanups>(Init))
+ if (const auto *Cleanups = dyn_cast_if_present<ExprWithCleanups>(Init))
Init = Cleanups->getSubExpr();
const auto *Ty = VD->getType().getTypePtr();
@@ -2068,11 +2068,10 @@ static bool ShouldDiagnoseUnusedDecl(const LangOptions &LangOpts,
// Warn for reference variables whose initializtion performs lifetime
// extension.
- if (const auto *MTE = dyn_cast_or_null<MaterializeTemporaryExpr>(Init)) {
- if (MTE->getExtendingDecl()) {
- Ty = VD->getType().getNonReferenceType().getTypePtr();
- Init = MTE->getSubExpr()->IgnoreImplicitAsWritten();
- }
+ if (const auto *MTE = dyn_cast_if_present<MaterializeTemporaryExpr>(Init);
+ MTE && MTE->getExtendingDecl()) {
+ Ty = VD->getType().getNonReferenceType().getTypePtr();
+ Init = MTE->getSubExpr()->IgnoreImplicitAsWritten();
}
// If we failed to complete the type for some reason, or if the type is
@@ -2089,15 +2088,14 @@ static bool ShouldDiagnoseUnusedDecl(const LangOptions &LangOpts,
if (Tag->hasAttr<UnusedAttr>())
return false;
- if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Tag)) {
+ if (const auto *RD = dyn_cast<CXXRecordDecl>(Tag)) {
if (!RD->hasTrivialDestructor() && !RD->hasAttr<WarnUnusedAttr>())
return false;
if (Init) {
- const CXXConstructExpr *Construct =
- dyn_cast<CXXConstructExpr>(Init);
+ const auto *Construct = dyn_cast<CXXConstructExpr>(Init);
if (Construct && !Construct->isElidable()) {
- CXXConstructorDecl *CD = Construct->getConstructor();
+ const CXXConstructorDecl *CD = Construct->getConstructor();
if (!CD->isTrivial() && !RD->hasAttr<WarnUnusedAttr>() &&
(VD->getInit()->isValueDependent() || !VD->evaluateValue()))
return false;
@@ -2211,10 +2209,9 @@ void Sema::DiagnoseUnusedButSetDecl(const VarDecl *VD,
return;
// In C++, don't warn for record types that don't have WarnUnusedAttr, to
// mimic gcc's behavior.
- if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Tag)) {
- if (!RD->hasAttr<WarnUnusedAttr>())
- return;
- }
+ if (const auto *RD = dyn_cast<CXXRecordDecl>(Tag);
+ RD && !RD->hasAttr<WarnUnusedAttr>())
+ return;
}
// Don't warn about __block Objective-C pointer variables, as they might
@@ -12957,7 +12954,7 @@ QualType Sema::deduceVarTypeFromInitializer(VarDecl *VDecl,
// FIXME: Initialization should not be taking a mutable list of inits.
SmallVector<Expr*, 8> InitsCopy(DeduceInits.begin(), DeduceInits.end());
return DeduceTemplateSpecializationFromInitializer(TSI, Entity, Kind,
- InitsCopy, PL);
+ InitsCopy);
}
if (DirectInit) {
@@ -19518,20 +19515,6 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
CDecl->setIvarRBraceLoc(RBrac);
}
}
-
- // Check the "counted_by" attribute to ensure that the count field exists in
- // the struct. Make sure we're performing this check on the outer-most
- // record. This is a C-only feature.
- if (!getLangOpts().CPlusPlus && Record &&
- !isa<RecordDecl>(Record->getParent())) {
- auto Pred = [](const Decl *D) {
- if (const auto *FD = dyn_cast_if_present<FieldDecl>(D))
- return FD->hasAttr<CountedByAttr>();
- return false;
- };
- if (const FieldDecl *FD = Record->findFieldIf(Pred))
- CheckCountedByAttr(S, FD);
- }
}
/// Determine whether the given integral value is representable within
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp b/contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
index 5b29b05dee54..af8b90ecfed9 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
@@ -8445,92 +8445,6 @@ static void handleZeroCallUsedRegsAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
D->addAttr(ZeroCallUsedRegsAttr::Create(S.Context, Kind, AL));
}
-static void handleCountedByAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
- if (!AL.isArgIdent(0)) {
- S.Diag(AL.getLoc(), diag::err_attribute_argument_type)
- << AL << AANT_ArgumentIdentifier;
- return;
- }
-
- IdentifierLoc *IL = AL.getArgAsIdent(0);
- CountedByAttr *CBA =
- ::new (S.Context) CountedByAttr(S.Context, AL, IL->Ident);
- CBA->setCountedByFieldLoc(IL->Loc);
- D->addAttr(CBA);
-}
-
-bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl *FD) {
- const auto *CBA = FD->getAttr<CountedByAttr>();
- const IdentifierInfo *FieldName = CBA->getCountedByField();
- DeclarationNameInfo NameInfo(FieldName,
- CBA->getCountedByFieldLoc().getBegin());
-
- LookupResult MemResult(*this, NameInfo, Sema::LookupMemberName);
- LookupName(MemResult, S);
-
- if (MemResult.empty()) {
- // The "counted_by" field needs to exist within the struct.
- LookupResult OrdResult(*this, NameInfo, Sema::LookupOrdinaryName);
- LookupName(OrdResult, S);
-
- if (!OrdResult.empty()) {
- SourceRange SR = FD->getLocation();
- Diag(SR.getBegin(), diag::err_counted_by_must_be_in_structure)
- << FieldName << SR;
-
- if (auto *ND = OrdResult.getAsSingle<NamedDecl>()) {
- SR = ND->getLocation();
- Diag(SR.getBegin(), diag::note_flexible_array_counted_by_attr_field)
- << ND << SR;
- }
- return true;
- }
-
- CXXScopeSpec SS;
- DeclFilterCCC<FieldDecl> Filter(FieldName);
- return DiagnoseEmptyLookup(S, SS, MemResult, Filter, nullptr, std::nullopt,
- const_cast<DeclContext *>(FD->getDeclContext()));
- }
-
- LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
- LangOptions::StrictFlexArraysLevelKind::IncompleteOnly;
-
- if (!Decl::isFlexibleArrayMemberLike(Context, FD, FD->getType(),
- StrictFlexArraysLevel, true)) {
- // The "counted_by" attribute must be on a flexible array member.
- SourceRange SR = FD->getLocation();
- Diag(SR.getBegin(), diag::err_counted_by_attr_not_on_flexible_array_member)
- << SR;
- return true;
- }
-
- if (const FieldDecl *Field = MemResult.getAsSingle<FieldDecl>()) {
- if (Field->hasAttr<CountedByAttr>()) {
- // The "counted_by" field can't point to the flexible array member.
- SourceRange SR = CBA->getCountedByFieldLoc();
- Diag(SR.getBegin(), diag::err_counted_by_attr_refers_to_flexible_array)
- << CBA->getCountedByField() << SR;
- return true;
- }
-
- if (!Field->getType()->isIntegerType() ||
- Field->getType()->isBooleanType()) {
- // The "counted_by" field must have an integer type.
- SourceRange SR = CBA->getCountedByFieldLoc();
- Diag(SR.getBegin(),
- diag::err_flexible_array_counted_by_attr_field_not_integer)
- << CBA->getCountedByField() << SR;
-
- SR = Field->getLocation();
- Diag(SR.getBegin(), diag::note_flexible_array_counted_by_attr_field)
- << Field << SR;
- return true;
- }
- }
-
- return false;
-}
-
static void handleFunctionReturnThunksAttr(Sema &S, Decl *D,
const ParsedAttr &AL) {
StringRef KindStr;
@@ -9488,10 +9402,6 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
handleAvailableOnlyInDefaultEvalMethod(S, D, AL);
break;
- case ParsedAttr::AT_CountedBy:
- handleCountedByAttr(S, D, AL);
- break;
-
// Microsoft attributes:
case ParsedAttr::AT_LayoutVersion:
handleLayoutVersion(S, D, AL);
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp b/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp
index c7185d56cc99..960f513d1111 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp
@@ -2469,8 +2469,7 @@ bool Sema::DiagnoseDependentMemberLookup(const LookupResult &R) {
bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
CorrectionCandidateCallback &CCC,
TemplateArgumentListInfo *ExplicitTemplateArgs,
- ArrayRef<Expr *> Args, DeclContext *LookupCtx,
- TypoExpr **Out) {
+ ArrayRef<Expr *> Args, TypoExpr **Out) {
DeclarationName Name = R.getLookupName();
unsigned diagnostic = diag::err_undeclared_var_use;
@@ -2486,8 +2485,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
// unqualified lookup. This is useful when (for example) the
// original lookup would not have found something because it was a
// dependent name.
- DeclContext *DC =
- LookupCtx ? LookupCtx : (SS.isEmpty() ? CurContext : nullptr);
+ DeclContext *DC = SS.isEmpty() ? CurContext : nullptr;
while (DC) {
if (isa<CXXRecordDecl>(DC)) {
LookupQualifiedName(R, DC);
@@ -2530,12 +2528,12 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
emitEmptyLookupTypoDiagnostic(TC, *this, SS, Name, TypoLoc, Args,
diagnostic, diagnostic_suggest);
},
- nullptr, CTK_ErrorRecovery, LookupCtx);
+ nullptr, CTK_ErrorRecovery);
if (*Out)
return true;
- } else if (S && (Corrected =
- CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S,
- &SS, CCC, CTK_ErrorRecovery, LookupCtx))) {
+ } else if (S &&
+ (Corrected = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(),
+ S, &SS, CCC, CTK_ErrorRecovery))) {
std::string CorrectedStr(Corrected.getAsString(getLangOpts()));
bool DroppedSpecifier =
Corrected.WillReplaceSpecifier() && Name.getAsString() == CorrectedStr;
@@ -2825,7 +2823,7 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
// a template name, but we happen to have always already looked up the name
// before we get here if it must be a template name.
if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator, nullptr,
- std::nullopt, nullptr, &TE)) {
+ std::nullopt, &TE)) {
if (TE && KeywordReplacement) {
auto &State = getTypoExprState(TE);
auto BestTC = State.Consumer->getNextCorrection();
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp b/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
index 081b568762ae..4ae04358d5df 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
@@ -843,21 +843,21 @@ Sema::ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *Ex) {
// operation from the operand to the exception object (15.1) can be
// omitted by constructing the automatic object directly into the
// exception object
- if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Ex->IgnoreParens()))
- if (VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
- if (Var->hasLocalStorage() && !Var->getType().isVolatileQualified()) {
- for( ; S; S = S->getParent()) {
- if (S->isDeclScope(Var)) {
- IsThrownVarInScope = true;
- break;
- }
-
- // FIXME: Many of the scope checks here seem incorrect.
- if (S->getFlags() &
- (Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
- Scope::ObjCMethodScope | Scope::TryScope))
- break;
+ if (const auto *DRE = dyn_cast<DeclRefExpr>(Ex->IgnoreParens()))
+ if (const auto *Var = dyn_cast<VarDecl>(DRE->getDecl());
+ Var && Var->hasLocalStorage() &&
+ !Var->getType().isVolatileQualified()) {
+ for (; S; S = S->getParent()) {
+ if (S->isDeclScope(Var)) {
+ IsThrownVarInScope = true;
+ break;
}
+
+ // FIXME: Many of the scope checks here seem incorrect.
+ if (S->getFlags() &
+ (Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
+ Scope::ObjCMethodScope | Scope::TryScope))
+ break;
}
}
}
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaExprMember.cpp b/contrib/llvm-project/clang/lib/Sema/SemaExprMember.cpp
index 473eea55bb6b..2abec3d86a27 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaExprMember.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaExprMember.cpp
@@ -253,7 +253,9 @@ static void diagnoseInstanceReference(Sema &SemaRef,
SemaRef.Diag(Loc, diag::err_member_call_without_object)
<< Range << /*static*/ 0;
else {
- const auto *Callee = dyn_cast<CXXMethodDecl>(Rep);
+ if (const auto *Tpl = dyn_cast<FunctionTemplateDecl>(Rep))
+ Rep = Tpl->getTemplatedDecl();
+ const auto *Callee = cast<CXXMethodDecl>(Rep);
auto Diag = SemaRef.Diag(Loc, diag::err_member_call_without_object)
<< Range << Callee->isExplicitObjectMemberFunction();
if (!Replacement.empty())
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp b/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp
index 035eaae58965..61d244f3bb97 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp
@@ -25,6 +25,7 @@
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
+#include "clang/Sema/Ownership.h"
#include "clang/Sema/SemaInternal.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/FoldingSet.h"
@@ -465,8 +466,7 @@ class InitListChecker {
void FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
const InitializedEntity &ParentEntity,
InitListExpr *ILE, bool &RequiresSecondPass,
- bool FillWithNoInit = false,
- bool WarnIfMissing = false);
+ bool FillWithNoInit = false);
void FillInEmptyInitializations(const InitializedEntity &Entity,
InitListExpr *ILE, bool &RequiresSecondPass,
InitListExpr *OuterILE, unsigned OuterIndex,
@@ -655,16 +655,11 @@ void InitListChecker::FillInEmptyInitForBase(
}
}
-static bool hasAnyDesignatedInits(const InitListExpr *IL) {
- return llvm::any_of(*IL, [=](const Stmt *Init) {
- return isa_and_nonnull<DesignatedInitExpr>(Init);
- });
-}
-
-void InitListChecker::FillInEmptyInitForField(
- unsigned Init, FieldDecl *Field, const InitializedEntity &ParentEntity,
- InitListExpr *ILE, bool &RequiresSecondPass, bool FillWithNoInit,
- bool WarnIfMissing) {
+void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
+ const InitializedEntity &ParentEntity,
+ InitListExpr *ILE,
+ bool &RequiresSecondPass,
+ bool FillWithNoInit) {
SourceLocation Loc = ILE->getEndLoc();
unsigned NumInits = ILE->getNumInits();
InitializedEntity MemberEntity
@@ -732,52 +727,15 @@ void InitListChecker::FillInEmptyInitForField(
if (hadError || VerifyOnly) {
// Do nothing
- } else {
- if (WarnIfMissing) {
- auto CheckAnonMember = [&](const FieldDecl *FD,
- auto &&CheckAnonMember) -> FieldDecl * {
- FieldDecl *Uninitialized = nullptr;
- RecordDecl *RD = FD->getType()->getAsRecordDecl();
- assert(RD && "Not anonymous member checked?");
- for (auto *F : RD->fields()) {
- FieldDecl *UninitializedFieldInF = nullptr;
- if (F->isAnonymousStructOrUnion())
- UninitializedFieldInF = CheckAnonMember(F, CheckAnonMember);
- else if (!F->isUnnamedBitfield() &&
- !F->getType()->isIncompleteArrayType() &&
- !F->hasInClassInitializer())
- UninitializedFieldInF = F;
-
- if (RD->isUnion() && !UninitializedFieldInF)
- return nullptr;
- if (!Uninitialized)
- Uninitialized = UninitializedFieldInF;
- }
- return Uninitialized;
- };
-
- FieldDecl *FieldToDiagnose = nullptr;
- if (Field->isAnonymousStructOrUnion())
- FieldToDiagnose = CheckAnonMember(Field, CheckAnonMember);
- else if (!Field->isUnnamedBitfield() &&
- !Field->getType()->isIncompleteArrayType())
- FieldToDiagnose = Field;
-
- if (FieldToDiagnose)
- SemaRef.Diag(Loc, diag::warn_missing_field_initializers)
- << FieldToDiagnose;
- }
-
- if (Init < NumInits) {
- ILE->setInit(Init, MemberInit.getAs<Expr>());
- } else if (!isa<ImplicitValueInitExpr>(MemberInit.get())) {
- // Empty initialization requires a constructor call, so
- // extend the initializer list to include the constructor
- // call and make a note that we'll need to take another pass
- // through the initializer list.
- ILE->updateInit(SemaRef.Context, Init, MemberInit.getAs<Expr>());
- RequiresSecondPass = true;
- }
+ } else if (Init < NumInits) {
+ ILE->setInit(Init, MemberInit.getAs<Expr>());
+ } else if (!isa<ImplicitValueInitExpr>(MemberInit.get())) {
+ // Empty initialization requires a constructor call, so
+ // extend the initializer list to include the constructor
+ // call and make a note that we'll need to take another pass
+ // through the initializer list.
+ ILE->updateInit(SemaRef.Context, Init, MemberInit.getAs<Expr>());
+ RequiresSecondPass = true;
}
} else if (InitListExpr *InnerILE
= dyn_cast<InitListExpr>(ILE->getInit(Init))) {
@@ -845,36 +803,9 @@ InitListChecker::FillInEmptyInitializations(const InitializedEntity &Entity,
}
}
} else {
- InitListExpr *SForm =
- ILE->isSyntacticForm() ? ILE : ILE->getSyntacticForm();
// The fields beyond ILE->getNumInits() are default initialized, so in
// order to leave them uninitialized, the ILE is expanded and the extra
// fields are then filled with NoInitExpr.
-
- // Some checks that are required for missing fields warning are bound to
- // how many elements the initializer list originally was provided; perform
- // them before the list is expanded.
- bool WarnIfMissingField =
- !SForm->isIdiomaticZeroInitializer(SemaRef.getLangOpts()) &&
- ILE->getNumInits();
-
- // Disable check for missing fields when designators are used in C to
- // match gcc behaviour.
- // FIXME: Should we emulate possible gcc warning bug?
- WarnIfMissingField &=
- SemaRef.getLangOpts().CPlusPlus || !hasAnyDesignatedInits(SForm);
-
- if (OuterILE) {
- // When nested designators are present, there might be two nested init
- // lists created and only outer will contain designated initializer
- // expression, so check outer list as well.
- InitListExpr *OuterSForm = OuterILE->isSyntacticForm()
- ? OuterILE
- : OuterILE->getSyntacticForm();
- WarnIfMissingField &= SemaRef.getLangOpts().CPlusPlus ||
- !hasAnyDesignatedInits(OuterSForm);
- }
-
unsigned NumElems = numStructUnionElements(ILE->getType());
if (!RDecl->isUnion() && RDecl->hasFlexibleArrayMember())
++NumElems;
@@ -902,7 +833,7 @@ InitListChecker::FillInEmptyInitializations(const InitializedEntity &Entity,
return;
FillInEmptyInitForField(Init, Field, Entity, ILE, RequiresSecondPass,
- FillWithNoInit, WarnIfMissingField);
+ FillWithNoInit);
if (hadError)
return;
@@ -1017,6 +948,13 @@ InitListChecker::FillInEmptyInitializations(const InitializedEntity &Entity,
}
}
+static bool hasAnyDesignatedInits(const InitListExpr *IL) {
+ for (const Stmt *Init : *IL)
+ if (isa_and_nonnull<DesignatedInitExpr>(Init))
+ return true;
+ return false;
+}
+
InitListChecker::InitListChecker(
Sema &S, const InitializedEntity &Entity, InitListExpr *IL, QualType &T,
bool VerifyOnly, bool TreatUnavailableAsInvalid, bool InOverloadResolution,
@@ -2288,8 +2226,12 @@ void InitListChecker::CheckStructUnionTypes(
size_t NumRecordDecls = llvm::count_if(RD->decls(), [&](const Decl *D) {
return isa<FieldDecl>(D) || isa<RecordDecl>(D);
});
+ bool CheckForMissingFields =
+ !IList->isIdiomaticZeroInitializer(SemaRef.getLangOpts());
bool HasDesignatedInit = false;
+ llvm::SmallPtrSet<FieldDecl *, 4> InitializedFields;
+
while (Index < IList->getNumInits()) {
Expr *Init = IList->getInit(Index);
SourceLocation InitLoc = Init->getBeginLoc();
@@ -2313,17 +2255,24 @@ void InitListChecker::CheckStructUnionTypes(
// Find the field named by the designated initializer.
DesignatedInitExpr::Designator *D = DIE->getDesignator(0);
- if (!VerifyOnly && D->isFieldDesignator() && !DesignatedInitFailed) {
+ if (!VerifyOnly && D->isFieldDesignator()) {
FieldDecl *F = D->getFieldDecl();
- QualType ET = SemaRef.Context.getBaseElementType(F->getType());
- if (checkDestructorReference(ET, InitLoc, SemaRef)) {
- hadError = true;
- return;
+ InitializedFields.insert(F);
+ if (!DesignatedInitFailed) {
+ QualType ET = SemaRef.Context.getBaseElementType(F->getType());
+ if (checkDestructorReference(ET, InitLoc, SemaRef)) {
+ hadError = true;
+ return;
+ }
}
}
InitializedSomething = true;
+ // Disable check for missing fields when designators are used.
+ // This matches gcc behaviour.
+ if (!SemaRef.getLangOpts().CPlusPlus)
+ CheckForMissingFields = false;
continue;
}
@@ -2402,6 +2351,7 @@ void InitListChecker::CheckStructUnionTypes(
CheckSubElementType(MemberEntity, IList, Field->getType(), Index,
StructuredList, StructuredIndex);
InitializedSomething = true;
+ InitializedFields.insert(*Field);
if (RD->isUnion() && StructuredList) {
// Initialize the first field within the union.
@@ -2411,6 +2361,28 @@ void InitListChecker::CheckStructUnionTypes(
++Field;
}
+ // Emit warnings for missing struct field initializers.
+ if (!VerifyOnly && InitializedSomething && CheckForMissingFields &&
+ !RD->isUnion()) {
+ // It is possible we have one or more unnamed bitfields remaining.
+ // Find first (if any) named field and emit warning.
+ for (RecordDecl::field_iterator it = HasDesignatedInit ? RD->field_begin()
+ : Field,
+ end = RD->field_end();
+ it != end; ++it) {
+ if (HasDesignatedInit && InitializedFields.count(*it))
+ continue;
+
+ if (!it->isUnnamedBitfield() && !it->hasInClassInitializer() &&
+ !it->getType()->isIncompleteArrayType()) {
+ SemaRef.Diag(IList->getSourceRange().getEnd(),
+ diag::warn_missing_field_initializers)
+ << *it;
+ break;
+ }
+ }
+ }
+
// Check that any remaining fields can be value-initialized if we're not
// building a structured list. (If we are, we'll check this later.)
if (!StructuredList && Field != FieldEnd && !RD->isUnion() &&
@@ -5458,18 +5430,12 @@ static void TryOrBuildParenListInitialization(
auto HandleInitializedEntity = [&](const InitializedEntity &SubEntity,
const InitializationKind &SubKind,
Expr *Arg, Expr **InitExpr = nullptr) {
- InitializationSequence IS = [&]() {
- if (Arg)
- return InitializationSequence(S, SubEntity, SubKind, Arg);
- return InitializationSequence(S, SubEntity, SubKind, std::nullopt);
- }();
+ InitializationSequence IS = InitializationSequence(
+ S, SubEntity, SubKind, Arg ? MultiExprArg(Arg) : std::nullopt);
if (IS.Failed()) {
if (!VerifyOnly) {
- if (Arg)
- IS.Diagnose(S, SubEntity, SubKind, Arg);
- else
- IS.Diagnose(S, SubEntity, SubKind, std::nullopt);
+ IS.Diagnose(S, SubEntity, SubKind, Arg ? ArrayRef(Arg) : std::nullopt);
} else {
Sequence.SetFailed(
InitializationSequence::FK_ParenthesizedListInitFailed);
@@ -5479,10 +5445,8 @@ static void TryOrBuildParenListInitialization(
}
if (!VerifyOnly) {
ExprResult ER;
- if (Arg)
- ER = IS.Perform(S, SubEntity, SubKind, Arg);
- else
- ER = IS.Perform(S, SubEntity, SubKind, std::nullopt);
+ ER = IS.Perform(S, SubEntity, SubKind,
+ Arg ? MultiExprArg(Arg) : std::nullopt);
if (InitExpr)
*InitExpr = ER.get();
else
@@ -10439,40 +10403,53 @@ static void DiagnoseNarrowingInInitList(Sema &S,
// No narrowing occurred.
return;
- case NK_Type_Narrowing:
+ case NK_Type_Narrowing: {
// This was a floating-to-integer conversion, which is always considered a
// narrowing conversion even if the value is a constant and can be
// represented exactly as an integer.
- S.Diag(PostInit->getBeginLoc(), NarrowingErrs(S.getLangOpts())
- ? diag::ext_init_list_type_narrowing
- : diag::warn_init_list_type_narrowing)
+ QualType T = EntityType.getNonReferenceType();
+ S.Diag(PostInit->getBeginLoc(),
+ NarrowingErrs(S.getLangOpts())
+ ? (T == EntityType
+ ? diag::ext_init_list_type_narrowing
+ : diag::ext_init_list_type_narrowing_const_reference)
+ : diag::warn_init_list_type_narrowing)
<< PostInit->getSourceRange()
<< PreNarrowingType.getLocalUnqualifiedType()
- << EntityType.getNonReferenceType().getLocalUnqualifiedType();
+ << T.getLocalUnqualifiedType();
break;
+ }
- case NK_Constant_Narrowing:
+ case NK_Constant_Narrowing: {
// A constant value was narrowed.
+ QualType T = EntityType.getNonReferenceType();
S.Diag(PostInit->getBeginLoc(),
NarrowingErrs(S.getLangOpts())
- ? diag::ext_init_list_constant_narrowing
+ ? (T == EntityType
+ ? diag::ext_init_list_constant_narrowing
+ : diag::ext_init_list_constant_narrowing_const_reference)
: diag::warn_init_list_constant_narrowing)
<< PostInit->getSourceRange()
<< ConstantValue.getAsString(S.getASTContext(), ConstantType)
<< EntityType.getNonReferenceType().getLocalUnqualifiedType();
break;
+ }
- case NK_Variable_Narrowing:
+ case NK_Variable_Narrowing: {
// A variable's value may have been narrowed.
+ QualType T = EntityType.getNonReferenceType();
S.Diag(PostInit->getBeginLoc(),
NarrowingErrs(S.getLangOpts())
- ? diag::ext_init_list_variable_narrowing
+ ? (T == EntityType
+ ? diag::ext_init_list_variable_narrowing
+ : diag::ext_init_list_variable_narrowing_const_reference)
: diag::warn_init_list_variable_narrowing)
<< PostInit->getSourceRange()
<< PreNarrowingType.getLocalUnqualifiedType()
<< EntityType.getNonReferenceType().getLocalUnqualifiedType();
break;
}
+ }
SmallString<128> StaticCast;
llvm::raw_svector_ostream OS(StaticCast);
@@ -10590,7 +10567,7 @@ static bool isOrIsDerivedFromSpecializationOf(CXXRecordDecl *RD,
QualType Sema::DeduceTemplateSpecializationFromInitializer(
TypeSourceInfo *TSInfo, const InitializedEntity &Entity,
- const InitializationKind &Kind, MultiExprArg Inits, ParenListExpr *PL) {
+ const InitializationKind &Kind, MultiExprArg Inits) {
auto *DeducedTST = dyn_cast<DeducedTemplateSpecializationType>(
TSInfo->getType()->getContainedDeducedType());
assert(DeducedTST && "not a deduced template specialization type");
@@ -10821,9 +10798,12 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer(
if (getLangOpts().CPlusPlus20 && !HasAnyDeductionGuide) {
if (ListInit && ListInit->getNumInits()) {
SynthesizeAggrGuide(ListInit);
- } else if (PL && PL->getNumExprs()) {
- InitListExpr TempListInit(getASTContext(), PL->getLParenLoc(),
- PL->exprs(), PL->getRParenLoc());
+ } else if (Inits.size()) { // parenthesized expression-list
+ // Inits are expressions inside the parentheses. We don't have
+ // the parentheses source locations, use the begin/end of Inits as the
+ // best heuristic.
+ InitListExpr TempListInit(getASTContext(), Inits.front()->getBeginLoc(),
+ Inits, Inits.back()->getEndLoc());
SynthesizeAggrGuide(&TempListInit);
}
}
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp b/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp
index e400f248d15a..3826994ef212 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp
@@ -14658,6 +14658,19 @@ StmtResult Sema::ActOnOpenMPTargetTeamsDirective(ArrayRef<OMPClause *> Clauses,
}
setFunctionHasBranchProtectedScope();
+ const OMPClause *BareClause = nullptr;
+ bool HasThreadLimitAndNumTeamsClause = hasClauses(Clauses, OMPC_num_teams) &&
+ hasClauses(Clauses, OMPC_thread_limit);
+ bool HasBareClause = llvm::any_of(Clauses, [&](const OMPClause *C) {
+ BareClause = C;
+ return C->getClauseKind() == OMPC_ompx_bare;
+ });
+
+ if (HasBareClause && !HasThreadLimitAndNumTeamsClause) {
+ Diag(BareClause->getBeginLoc(), diag::err_ompx_bare_no_grid);
+ return StmtError();
+ }
+
return OMPTargetTeamsDirective::Create(Context, StartLoc, EndLoc, Clauses,
AStmt);
}
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/contrib/llvm-project/clang/lib/Sema/SemaRISCVVectorLookup.cpp
index e4642e4da016..3ed3e6195441 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaRISCVVectorLookup.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaRISCVVectorLookup.cpp
@@ -206,15 +206,16 @@ void RISCVIntrinsicManagerImpl::ConstructRVVIntrinsics(
{"xsfvfwmaccqqq", RVV_REQ_Xsfvfwmaccqqq},
{"xsfvqmaccdod", RVV_REQ_Xsfvqmaccdod},
{"xsfvqmaccqoq", RVV_REQ_Xsfvqmaccqoq},
- {"experimental-zvbb", RVV_REQ_Zvbb},
- {"experimental-zvbc", RVV_REQ_Zvbc},
- {"experimental-zvkb", RVV_REQ_Zvkb},
- {"experimental-zvkg", RVV_REQ_Zvkg},
- {"experimental-zvkned", RVV_REQ_Zvkned},
- {"experimental-zvknha", RVV_REQ_Zvknha},
- {"experimental-zvknhb", RVV_REQ_Zvknhb},
- {"experimental-zvksed", RVV_REQ_Zvksed},
- {"experimental-zvksh", RVV_REQ_Zvksh}};
+ {"zvbb", RVV_REQ_Zvbb},
+ {"zvbc", RVV_REQ_Zvbc},
+ {"zvkb", RVV_REQ_Zvkb},
+ {"zvkg", RVV_REQ_Zvkg},
+ {"zvkned", RVV_REQ_Zvkned},
+ {"zvknha", RVV_REQ_Zvknha},
+ {"zvknhb", RVV_REQ_Zvknhb},
+ {"zvksed", RVV_REQ_Zvksed},
+ {"zvksh", RVV_REQ_Zvksh},
+ {"experimental", RVV_REQ_Experimental}};
// Construction of RVVIntrinsicRecords need to sync with createRVVIntrinsics
// in RISCVVEmitter.cpp.
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaStmt.cpp b/contrib/llvm-project/clang/lib/Sema/SemaStmt.cpp
index 63348d27a8c9..f0b03db69084 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaStmt.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaStmt.cpp
@@ -1271,6 +1271,9 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
bool CaseListIsErroneous = false;
+ // FIXME: We'd better diagnose missing or duplicate default labels even
+ // in the dependent case. Because default labels themselves are never
+ // dependent.
for (SwitchCase *SC = SS->getSwitchCaseList(); SC && !HasDependentValue;
SC = SC->getNextSwitchCase()) {
@@ -1327,9 +1330,6 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
}
}
- if (!TheDefaultStmt)
- Diag(SwitchLoc, diag::warn_switch_default);
-
if (!HasDependentValue) {
// If we don't have a default statement, check whether the
// condition is constant.
@@ -1344,6 +1344,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
assert(!HasConstantCond ||
(ConstantCondValue.getBitWidth() == CondWidth &&
ConstantCondValue.isSigned() == CondIsSigned));
+ Diag(SwitchLoc, diag::warn_switch_default);
}
bool ShouldCheckConstantCond = HasConstantCond;
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaTemplate.cpp b/contrib/llvm-project/clang/lib/Sema/SemaTemplate.cpp
index f10abeaba0d4..5fcc39ec7005 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaTemplate.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaTemplate.cpp
@@ -1824,6 +1824,15 @@ static void SetNestedNameSpecifier(Sema &S, TagDecl *T,
T->setQualifierInfo(SS.getWithLocInContext(S.Context));
}
+// Returns the template parameter list with all default template argument
+// information.
+static TemplateParameterList *GetTemplateParameterList(TemplateDecl *TD) {
+ // Make sure we get the template parameter list from the most
+ // recent declaration, since that is the only one that is guaranteed to
+ // have all the default template argument information.
+ return cast<TemplateDecl>(TD->getMostRecentDecl())->getTemplateParameters();
+}
+
DeclResult Sema::CheckClassTemplate(
Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
@@ -2061,13 +2070,13 @@ DeclResult Sema::CheckClassTemplate(
if (!(TUK == TUK_Friend && CurContext->isDependentContext()) &&
CheckTemplateParameterList(
TemplateParams,
- PrevClassTemplate
- ? PrevClassTemplate->getMostRecentDecl()->getTemplateParameters()
- : nullptr,
+ PrevClassTemplate ? GetTemplateParameterList(PrevClassTemplate)
+ : nullptr,
(SS.isSet() && SemanticContext && SemanticContext->isRecord() &&
SemanticContext->isDependentContext())
? TPC_ClassTemplateMember
- : TUK == TUK_Friend ? TPC_FriendClassTemplate : TPC_ClassTemplate,
+ : TUK == TUK_Friend ? TPC_FriendClassTemplate
+ : TPC_ClassTemplate,
SkipBody))
Invalid = true;
@@ -2298,7 +2307,7 @@ struct ConvertConstructorToDeductionGuideTransform {
// -- The template parameters are the template parameters of the class
// template followed by the template parameters (including default
// template arguments) of the constructor, if any.
- TemplateParameterList *TemplateParams = Template->getTemplateParameters();
+ TemplateParameterList *TemplateParams = GetTemplateParameterList(Template);
if (FTD) {
TemplateParameterList *InnerParams = FTD->getTemplateParameters();
SmallVector<NamedDecl *, 16> AllParams;
@@ -2424,7 +2433,7 @@ struct ConvertConstructorToDeductionGuideTransform {
Params.push_back(NewParam);
}
- return buildDeductionGuide(Template->getTemplateParameters(), nullptr,
+ return buildDeductionGuide(GetTemplateParameterList(Template), nullptr,
ExplicitSpecifier(), TSI, Loc, Loc, Loc);
}
@@ -5956,12 +5965,7 @@ bool Sema::CheckTemplateArgumentList(
// template.
TemplateArgumentListInfo NewArgs = TemplateArgs;
- // Make sure we get the template parameter list from the most
- // recent declaration, since that is the only one that is guaranteed to
- // have all the default template argument information.
- TemplateParameterList *Params =
- cast<TemplateDecl>(Template->getMostRecentDecl())
- ->getTemplateParameters();
+ TemplateParameterList *Params = GetTemplateParameterList(Template);
SourceLocation RAngleLoc = NewArgs.getRAngleLoc();
diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp
index 7140a14aefbf..d989707d5575 100644
--- a/contrib/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/contrib/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -584,7 +584,18 @@ void ASTDeclReader::Visit(Decl *D) {
void ASTDeclReader::VisitDecl(Decl *D) {
BitsUnpacker DeclBits(Record.readInt());
+ auto ModuleOwnership =
+ (Decl::ModuleOwnershipKind)DeclBits.getNextBits(/*Width=*/3);
+ D->setReferenced(DeclBits.getNextBit());
+ D->Used = DeclBits.getNextBit();
+ IsDeclMarkedUsed |= D->Used;
+ D->setAccess((AccessSpecifier)DeclBits.getNextBits(/*Width=*/2));
+ D->setImplicit(DeclBits.getNextBit());
bool HasStandaloneLexicalDC = DeclBits.getNextBit();
+ bool HasAttrs = DeclBits.getNextBit();
+ D->setTopLevelDeclInObjCContainer(DeclBits.getNextBit());
+ D->InvalidDecl = DeclBits.getNextBit();
+ D->FromASTFile = true;
if (D->isTemplateParameter() || D->isTemplateParameterPack() ||
isa<ParmVarDecl, ObjCTypeParamDecl>(D)) {
@@ -623,20 +634,6 @@ void ASTDeclReader::VisitDecl(Decl *D) {
}
D->setLocation(ThisDeclLoc);
- D->InvalidDecl = DeclBits.getNextBit();
- bool HasAttrs = DeclBits.getNextBit();
- D->setImplicit(DeclBits.getNextBit());
- D->Used = DeclBits.getNextBit();
- IsDeclMarkedUsed |= D->Used;
- D->setReferenced(DeclBits.getNextBit());
- D->setTopLevelDeclInObjCContainer(DeclBits.getNextBit());
- D->setAccess((AccessSpecifier)DeclBits.getNextBits(/*Width=*/2));
- D->FromASTFile = true;
- auto ModuleOwnership =
- (Decl::ModuleOwnershipKind)DeclBits.getNextBits(/*Width=*/3);
- bool ModulePrivate =
- (ModuleOwnership == Decl::ModuleOwnershipKind::ModulePrivate);
-
if (HasAttrs) {
AttrVec Attrs;
Record.readAttributes(Attrs);
@@ -647,8 +644,9 @@ void ASTDeclReader::VisitDecl(Decl *D) {
// Determine whether this declaration is part of a (sub)module. If so, it
// may not yet be visible.
+ bool ModulePrivate =
+ (ModuleOwnership == Decl::ModuleOwnershipKind::ModulePrivate);
if (unsigned SubmoduleID = readSubmoduleID()) {
-
switch (ModuleOwnership) {
case Decl::ModuleOwnershipKind::Visible:
ModuleOwnership = Decl::ModuleOwnershipKind::VisibleWhenImported;
@@ -1065,9 +1063,11 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
// after everything else is read.
BitsUnpacker FunctionDeclBits(Record.readInt());
+ FD->setCachedLinkage((Linkage)FunctionDeclBits.getNextBits(/*Width=*/3));
FD->setStorageClass((StorageClass)FunctionDeclBits.getNextBits(/*Width=*/3));
FD->setInlineSpecified(FunctionDeclBits.getNextBit());
FD->setImplicitlyInline(FunctionDeclBits.getNextBit());
+ FD->setHasSkippedBody(FunctionDeclBits.getNextBit());
FD->setVirtualAsWritten(FunctionDeclBits.getNextBit());
// We defer calling `FunctionDecl::setPure()` here as for methods of
// `CXXTemplateSpecializationDecl`s, we may not have connected up the
@@ -1081,16 +1081,14 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
FD->setDefaulted(FunctionDeclBits.getNextBit());
FD->setExplicitlyDefaulted(FunctionDeclBits.getNextBit());
FD->setIneligibleOrNotSelected(FunctionDeclBits.getNextBit());
- FD->setHasImplicitReturnZero(FunctionDeclBits.getNextBit());
FD->setConstexprKind(
(ConstexprSpecKind)FunctionDeclBits.getNextBits(/*Width=*/2));
- FD->setUsesSEHTry(FunctionDeclBits.getNextBit());
- FD->setHasSkippedBody(FunctionDeclBits.getNextBit());
+ FD->setHasImplicitReturnZero(FunctionDeclBits.getNextBit());
FD->setIsMultiVersion(FunctionDeclBits.getNextBit());
FD->setLateTemplateParsed(FunctionDeclBits.getNextBit());
FD->setFriendConstraintRefersToEnclosingTemplate(
FunctionDeclBits.getNextBit());
- FD->setCachedLinkage((Linkage)FunctionDeclBits.getNextBits(/*Width=*/3));
+ FD->setUsesSEHTry(FunctionDeclBits.getNextBit());
FD->EndRangeLoc = readSourceLocation();
if (FD->isExplicitlyDefaulted())
@@ -1597,6 +1595,8 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
VisitDeclaratorDecl(VD);
BitsUnpacker VarDeclBits(Record.readInt());
+ auto VarLinkage = Linkage(VarDeclBits.getNextBits(/*Width=*/3));
+ bool DefGeneratedInModule = VarDeclBits.getNextBit();
VD->VarDeclBits.SClass = (StorageClass)VarDeclBits.getNextBits(/*Width=*/3);
VD->VarDeclBits.TSCSpec = VarDeclBits.getNextBits(/*Width=*/2);
VD->VarDeclBits.InitStyle = VarDeclBits.getNextBits(/*Width=*/2);
@@ -1608,17 +1608,20 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
VD->NonParmVarDeclBits.ExceptionVar = VarDeclBits.getNextBit();
VD->NonParmVarDeclBits.NRVOVariable = VarDeclBits.getNextBit();
VD->NonParmVarDeclBits.CXXForRangeDecl = VarDeclBits.getNextBit();
- VD->NonParmVarDeclBits.ObjCForDecl = VarDeclBits.getNextBit();
+
VD->NonParmVarDeclBits.IsInline = VarDeclBits.getNextBit();
VD->NonParmVarDeclBits.IsInlineSpecified = VarDeclBits.getNextBit();
VD->NonParmVarDeclBits.IsConstexpr = VarDeclBits.getNextBit();
VD->NonParmVarDeclBits.IsInitCapture = VarDeclBits.getNextBit();
VD->NonParmVarDeclBits.PreviousDeclInSameBlockScope =
VarDeclBits.getNextBit();
- VD->NonParmVarDeclBits.ImplicitParamKind =
- VarDeclBits.getNextBits(/*Width*/ 3);
+
VD->NonParmVarDeclBits.EscapingByref = VarDeclBits.getNextBit();
HasDeducedType = VarDeclBits.getNextBit();
+ VD->NonParmVarDeclBits.ImplicitParamKind =
+ VarDeclBits.getNextBits(/*Width*/ 3);
+
+ VD->NonParmVarDeclBits.ObjCForDecl = VarDeclBits.getNextBit();
}
// If this variable has a deduced type, defer reading that type until we are
@@ -1630,7 +1633,6 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
VD->setType(Reader.GetType(DeferredTypeID));
DeferredTypeID = 0;
- auto VarLinkage = Linkage(VarDeclBits.getNextBits(/*Width=*/3));
VD->setCachedLinkage(VarLinkage);
// Reconstruct the one piece of the IdentifierNamespace that we need.
@@ -1638,7 +1640,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
VD->getLexicalDeclContext()->isFunctionOrMethod())
VD->setLocalExternDecl();
- if (VarDeclBits.getNextBit()) {
+ if (DefGeneratedInModule) {
Reader.DefinitionSource[VD] =
Loc.F->Kind == ModuleKind::MK_MainFile ||
Reader.getContext().getLangOpts().BuildingPCHWithObjectFile;
@@ -2660,7 +2662,7 @@ void ASTDeclReader::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
D->setDeclaredWithTypename(Record.readInt());
- if (Record.readBool()) {
+ if (D->hasTypeConstraint()) {
ConceptReference *CR = nullptr;
if (Record.readBool())
CR = Record.readConceptReference();
diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
index b3a6f619372b..21aed570ba26 100644
--- a/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -73,6 +73,8 @@ namespace clang {
ASTRecordReader &Record;
llvm::BitstreamCursor &DeclsCursor;
+ std::optional<BitsUnpacker> CurrentUnpackingBits;
+
SourceLocation readSourceLocation() {
return Record.readSourceLocation();
}
@@ -110,6 +112,9 @@ namespace clang {
/// itself.
static const unsigned NumExprFields = NumStmtFields + 2;
+ /// The number of bits required for the packing bits for the Expr class.
+ static const unsigned NumExprBits = 10;
+
/// Read and initialize a ExplicitTemplateArgumentList structure.
void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
TemplateArgumentLoc *ArgsLocArray,
@@ -214,9 +219,11 @@ void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) {
void ASTStmtReader::VisitIfStmt(IfStmt *S) {
VisitStmt(S);
- bool HasElse = Record.readInt();
- bool HasVar = Record.readInt();
- bool HasInit = Record.readInt();
+ CurrentUnpackingBits.emplace(Record.readInt());
+
+ bool HasElse = CurrentUnpackingBits->getNextBit();
+ bool HasVar = CurrentUnpackingBits->getNextBit();
+ bool HasInit = CurrentUnpackingBits->getNextBit();
S->setStatementKind(static_cast<IfStatementKind>(Record.readInt()));
S->setCond(Record.readSubExpr());
@@ -523,14 +530,15 @@ void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
void ASTStmtReader::VisitExpr(Expr *E) {
VisitStmt(E);
+ CurrentUnpackingBits.emplace(Record.readInt());
+ E->setDependence(static_cast<ExprDependence>(
+ CurrentUnpackingBits->getNextBits(/*Width=*/5)));
+ E->setValueKind(static_cast<ExprValueKind>(
+ CurrentUnpackingBits->getNextBits(/*Width=*/2)));
+ E->setObjectKind(static_cast<ExprObjectKind>(
+ CurrentUnpackingBits->getNextBits(/*Width=*/3)));
+
E->setType(Record.readType());
- BitsUnpacker ExprBits(Record.readInt());
- E->setDependence(
- static_cast<ExprDependence>(ExprBits.getNextBits(/*Width=*/5)));
- E->setValueKind(
- static_cast<ExprValueKind>(ExprBits.getNextBits(/*Width=*/2)));
- E->setObjectKind(
- static_cast<ExprObjectKind>(ExprBits.getNextBits(/*Width=*/3)));
assert(Record.getIdx() == NumExprFields &&
"Incorrect expression field count");
}
@@ -591,13 +599,17 @@ void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
VisitExpr(E);
- E->DeclRefExprBits.HasQualifier = Record.readInt();
- E->DeclRefExprBits.HasFoundDecl = Record.readInt();
- E->DeclRefExprBits.HasTemplateKWAndArgsInfo = Record.readInt();
- E->DeclRefExprBits.HadMultipleCandidates = Record.readInt();
- E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt();
- E->DeclRefExprBits.NonOdrUseReason = Record.readInt();
- E->DeclRefExprBits.IsImmediateEscalating = Record.readInt();
+ CurrentUnpackingBits.emplace(Record.readInt());
+ E->DeclRefExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
+ E->DeclRefExprBits.RefersToEnclosingVariableOrCapture =
+ CurrentUnpackingBits->getNextBit();
+ E->DeclRefExprBits.NonOdrUseReason =
+ CurrentUnpackingBits->getNextBits(/*Width=*/2);
+ E->DeclRefExprBits.IsImmediateEscalating = CurrentUnpackingBits->getNextBit();
+ E->DeclRefExprBits.HasFoundDecl = CurrentUnpackingBits->getNextBit();
+ E->DeclRefExprBits.HasQualifier = CurrentUnpackingBits->getNextBit();
+ E->DeclRefExprBits.HasTemplateKWAndArgsInfo =
+ CurrentUnpackingBits->getNextBit();
E->DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter = false;
unsigned NumTemplateArgs = 0;
if (E->hasTemplateKWAndArgsInfo())
@@ -706,12 +718,13 @@ void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
VisitExpr(E);
- bool hasFP_Features = Record.readInt();
+ bool hasFP_Features = CurrentUnpackingBits->getNextBit();
assert(hasFP_Features == E->hasStoredFPFeatures());
E->setSubExpr(Record.readSubExpr());
- E->setOpcode((UnaryOperator::Opcode)Record.readInt());
+ E->setOpcode(
+ (UnaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/5));
E->setOperatorLoc(readSourceLocation());
- E->setCanOverflow(Record.readInt());
+ E->setCanOverflow(CurrentUnpackingBits->getNextBit());
if (hasFP_Features)
E->setStoredFPFeatures(
FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
@@ -1000,12 +1013,11 @@ void ASTStmtReader::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
void ASTStmtReader::VisitCallExpr(CallExpr *E) {
VisitExpr(E);
- BitsUnpacker CallExprBits = Record.readInt();
-
- unsigned NumArgs = CallExprBits.getNextBits(/*Width=*/16);
- bool HasFPFeatures = CallExprBits.getNextBit();
+ unsigned NumArgs = Record.readInt();
+ CurrentUnpackingBits.emplace(Record.readInt());
E->setADLCallKind(
- static_cast<CallExpr::ADLCallKind>(CallExprBits.getNextBit()));
+ static_cast<CallExpr::ADLCallKind>(CurrentUnpackingBits->getNextBit()));
+ bool HasFPFeatures = CurrentUnpackingBits->getNextBit();
assert((NumArgs == E->getNumArgs()) && "Wrong NumArgs!");
E->setRParenLoc(readSourceLocation());
E->setCallee(Record.readSubExpr());
@@ -1024,27 +1036,29 @@ void ASTStmtReader::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
VisitExpr(E);
- bool HasQualifier = Record.readInt();
- bool HasFoundDecl = Record.readInt();
- bool HasTemplateInfo = Record.readInt();
+ CurrentUnpackingBits.emplace(Record.readInt());
+ bool HasQualifier = CurrentUnpackingBits->getNextBit();
+ bool HasFoundDecl = CurrentUnpackingBits->getNextBit();
+ bool HasTemplateInfo = CurrentUnpackingBits->getNextBit();
unsigned NumTemplateArgs = Record.readInt();
E->Base = Record.readSubExpr();
E->MemberDecl = Record.readDeclAs<ValueDecl>();
E->MemberDNLoc = Record.readDeclarationNameLoc(E->MemberDecl->getDeclName());
E->MemberLoc = Record.readSourceLocation();
- E->MemberExprBits.IsArrow = Record.readInt();
+ E->MemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
E->MemberExprBits.HasQualifierOrFoundDecl = HasQualifier || HasFoundDecl;
E->MemberExprBits.HasTemplateKWAndArgsInfo = HasTemplateInfo;
- E->MemberExprBits.HadMultipleCandidates = Record.readInt();
- E->MemberExprBits.NonOdrUseReason = Record.readInt();
+ E->MemberExprBits.HadMultipleCandidates = CurrentUnpackingBits->getNextBit();
+ E->MemberExprBits.NonOdrUseReason =
+ CurrentUnpackingBits->getNextBits(/*Width=*/2);
E->MemberExprBits.OperatorLoc = Record.readSourceLocation();
if (HasQualifier || HasFoundDecl) {
DeclAccessPair FoundDecl;
if (HasFoundDecl) {
auto *FoundD = Record.readDeclAs<NamedDecl>();
- auto AS = (AccessSpecifier)Record.readInt();
+ auto AS = (AccessSpecifier)CurrentUnpackingBits->getNextBits(/*Width=*/2);
FoundDecl = DeclAccessPair::make(FoundD, AS);
} else {
FoundDecl = DeclAccessPair::make(E->MemberDecl,
@@ -1091,10 +1105,14 @@ void ASTStmtReader::VisitCastExpr(CastExpr *E) {
VisitExpr(E);
unsigned NumBaseSpecs = Record.readInt();
assert(NumBaseSpecs == E->path_size());
- unsigned HasFPFeatures = Record.readInt();
+
+ CurrentUnpackingBits.emplace(Record.readInt());
+ E->setCastKind((CastKind)CurrentUnpackingBits->getNextBits(/*Width=*/7));
+ unsigned HasFPFeatures = CurrentUnpackingBits->getNextBit();
assert(E->hasStoredFPFeatures() == HasFPFeatures);
+
E->setSubExpr(Record.readSubExpr());
- E->setCastKind((CastKind)Record.readInt());
+
CastExpr::path_iterator BaseI = E->path_begin();
while (NumBaseSpecs--) {
auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
@@ -1107,10 +1125,12 @@ void ASTStmtReader::VisitCastExpr(CastExpr *E) {
}
void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
- bool hasFP_Features;
VisitExpr(E);
- E->setHasStoredFPFeatures(hasFP_Features = Record.readInt());
- E->setOpcode((BinaryOperator::Opcode)Record.readInt());
+ CurrentUnpackingBits.emplace(Record.readInt());
+ E->setOpcode(
+ (BinaryOperator::Opcode)CurrentUnpackingBits->getNextBits(/*Width=*/6));
+ bool hasFP_Features = CurrentUnpackingBits->getNextBit();
+ E->setHasStoredFPFeatures(hasFP_Features);
E->setLHS(Record.readSubExpr());
E->setRHS(Record.readSubExpr());
E->setOperatorLoc(readSourceLocation());
@@ -1148,7 +1168,7 @@ ASTStmtReader::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
VisitCastExpr(E);
- E->setIsPartOfExplicitCast(Record.readInt());
+ E->setIsPartOfExplicitCast(CurrentUnpackingBits->getNextBit());
}
void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
@@ -1764,8 +1784,8 @@ void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
SourceRange R = readSourceRange();
E->Loc = R.getBegin();
E->RParenLoc = R.getEnd();
- R = readSourceRange();
- E->AngleBrackets = R;
+ if (CurrentUnpackingBits->getNextBit())
+ E->AngleBrackets = readSourceRange();
}
void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
@@ -1961,9 +1981,10 @@ void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
CXXDependentScopeMemberExpr *E) {
VisitExpr(E);
- bool HasTemplateKWAndArgsInfo = Record.readInt();
unsigned NumTemplateArgs = Record.readInt();
- bool HasFirstQualifierFoundInScope = Record.readInt();
+ CurrentUnpackingBits.emplace(Record.readInt());
+ bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
+ bool HasFirstQualifierFoundInScope = CurrentUnpackingBits->getNextBit();
assert((HasTemplateKWAndArgsInfo == E->hasTemplateKWAndArgsInfo()) &&
"Wrong HasTemplateKWAndArgsInfo!");
@@ -1979,11 +2000,18 @@ void ASTStmtReader::VisitCXXDependentScopeMemberExpr(
assert((NumTemplateArgs == E->getNumTemplateArgs()) &&
"Wrong NumTemplateArgs!");
- E->CXXDependentScopeMemberExprBits.IsArrow = Record.readInt();
- E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
+ E->CXXDependentScopeMemberExprBits.IsArrow =
+ CurrentUnpackingBits->getNextBit();
+
E->BaseType = Record.readType();
E->QualifierLoc = Record.readNestedNameSpecifierLoc();
- E->Base = Record.readSubExpr();
+ // not ImplicitAccess
+ if (CurrentUnpackingBits->getNextBit())
+ E->Base = Record.readSubExpr();
+ else
+ E->Base = nullptr;
+
+ E->CXXDependentScopeMemberExprBits.OperatorLoc = readSourceLocation();
if (HasFirstQualifierFoundInScope)
*E->getTrailingObjects<NamedDecl *>() = readDeclAs<NamedDecl>();
@@ -1995,11 +2023,11 @@ void
ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
VisitExpr(E);
- if (Record.readInt()) // HasTemplateKWAndArgsInfo
+ if (CurrentUnpackingBits->getNextBit()) // HasTemplateKWAndArgsInfo
ReadTemplateKWAndArgsInfo(
*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>(),
E->getTrailingObjects<TemplateArgumentLoc>(),
- /*NumTemplateArgs=*/Record.readInt());
+ /*NumTemplateArgs=*/CurrentUnpackingBits->getNextBits(/*Width=*/16));
E->QualifierLoc = Record.readNestedNameSpecifierLoc();
E->NameInfo = Record.readDeclarationNameInfo();
@@ -2022,15 +2050,15 @@ ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
VisitExpr(E);
- BitsUnpacker OverloadExprBits = Record.readInt();
- unsigned NumResults = OverloadExprBits.getNextBits(/*Width=*/14);
- bool HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
+ unsigned NumResults = Record.readInt();
+ CurrentUnpackingBits.emplace(Record.readInt());
+ bool HasTemplateKWAndArgsInfo = CurrentUnpackingBits->getNextBit();
assert((E->getNumDecls() == NumResults) && "Wrong NumResults!");
assert((E->hasTemplateKWAndArgsInfo() == HasTemplateKWAndArgsInfo) &&
"Wrong HasTemplateKWAndArgsInfo!");
if (HasTemplateKWAndArgsInfo) {
- unsigned NumTemplateArgs = OverloadExprBits.getNextBits(/*Width=*/14);
+ unsigned NumTemplateArgs = Record.readInt();
ReadTemplateKWAndArgsInfo(*E->getTrailingASTTemplateKWAndArgsInfo(),
E->getTrailingTemplateArgumentLoc(),
NumTemplateArgs);
@@ -2057,17 +2085,24 @@ void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
VisitOverloadExpr(E);
- E->UnresolvedMemberExprBits.IsArrow = Record.readInt();
- E->UnresolvedMemberExprBits.HasUnresolvedUsing = Record.readInt();
- E->Base = Record.readSubExpr();
- E->BaseType = Record.readType();
+ E->UnresolvedMemberExprBits.IsArrow = CurrentUnpackingBits->getNextBit();
+ E->UnresolvedMemberExprBits.HasUnresolvedUsing =
+ CurrentUnpackingBits->getNextBit();
+
+ if (/*!isImplicitAccess=*/CurrentUnpackingBits->getNextBit())
+ E->Base = Record.readSubExpr();
+ else
+ E->Base = nullptr;
+
E->OperatorLoc = readSourceLocation();
+
+ E->BaseType = Record.readType();
}
void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
VisitOverloadExpr(E);
- E->UnresolvedLookupExprBits.RequiresADL = Record.readInt();
- E->UnresolvedLookupExprBits.Overloaded = Record.readInt();
+ E->UnresolvedLookupExprBits.RequiresADL = CurrentUnpackingBits->getNextBit();
+ E->UnresolvedLookupExprBits.Overloaded = CurrentUnpackingBits->getNextBit();
E->NamingClass = readDeclAs<CXXRecordDecl>();
}
@@ -2142,9 +2177,12 @@ void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
SubstNonTypeTemplateParmExpr *E) {
VisitExpr(E);
E->AssociatedDeclAndRef.setPointer(readDeclAs<Decl>());
- E->AssociatedDeclAndRef.setInt(Record.readInt());
- E->Index = Record.readInt();
- E->PackIndex = Record.readInt();
+ E->AssociatedDeclAndRef.setInt(CurrentUnpackingBits->getNextBit());
+ E->Index = CurrentUnpackingBits->getNextBits(/*Width=*/12);
+ if (CurrentUnpackingBits->getNextBit())
+ E->PackIndex = Record.readInt();
+ else
+ E->PackIndex = 0;
E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
E->Replacement = Record.readSubExpr();
}
@@ -2836,11 +2874,12 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
S = new (Context) NullStmt(Empty);
break;
- case STMT_COMPOUND:
- S = CompoundStmt::CreateEmpty(
- Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields],
- /*HasFPFeatures=*/Record[ASTStmtReader::NumStmtFields + 1]);
+ case STMT_COMPOUND: {
+ unsigned NumStmts = Record[ASTStmtReader::NumStmtFields];
+ bool HasFPFeatures = Record[ASTStmtReader::NumStmtFields + 1];
+ S = CompoundStmt::CreateEmpty(Context, NumStmts, HasFPFeatures);
break;
+ }
case STMT_CASE:
S = CaseStmt::CreateEmpty(
@@ -2862,13 +2901,14 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
/*NumAttrs*/Record[ASTStmtReader::NumStmtFields]);
break;
- case STMT_IF:
- S = IfStmt::CreateEmpty(
- Context,
- /* HasElse=*/Record[ASTStmtReader::NumStmtFields],
- /* HasVar=*/Record[ASTStmtReader::NumStmtFields + 1],
- /* HasInit=*/Record[ASTStmtReader::NumStmtFields + 2]);
+ case STMT_IF: {
+ BitsUnpacker IfStmtBits(Record[ASTStmtReader::NumStmtFields]);
+ bool HasElse = IfStmtBits.getNextBit();
+ bool HasVar = IfStmtBits.getNextBit();
+ bool HasInit = IfStmtBits.getNextBit();
+ S = IfStmt::CreateEmpty(Context, HasElse, HasVar, HasInit);
break;
+ }
case STMT_SWITCH:
S = SwitchStmt::CreateEmpty(
@@ -2945,17 +2985,19 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
/*HasFunctionName*/ Record[ASTStmtReader::NumExprFields]);
break;
- case EXPR_DECL_REF:
- S = DeclRefExpr::CreateEmpty(
- Context,
- /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
- /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
- /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
- /*NumTemplateArgs=*/
- Record[ASTStmtReader::NumExprFields + 2]
- ? Record[ASTStmtReader::NumExprFields + 7]
- : 0);
+ case EXPR_DECL_REF: {
+ BitsUnpacker DeclRefExprBits(Record[ASTStmtReader::NumExprFields]);
+ DeclRefExprBits.advance(5);
+ bool HasFoundDecl = DeclRefExprBits.getNextBit();
+ bool HasQualifier = DeclRefExprBits.getNextBit();
+ bool HasTemplateKWAndArgsInfo = DeclRefExprBits.getNextBit();
+ unsigned NumTemplateArgs = HasTemplateKWAndArgsInfo
+ ? Record[ASTStmtReader::NumExprFields + 1]
+ : 0;
+ S = DeclRefExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
+ HasTemplateKWAndArgsInfo, NumTemplateArgs);
break;
+ }
case EXPR_INTEGER_LITERAL:
S = IntegerLiteral::Create(Context, Empty);
@@ -2995,10 +3037,13 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
/* NumExprs=*/Record[ASTStmtReader::NumExprFields]);
break;
- case EXPR_UNARY_OPERATOR:
- S = UnaryOperator::CreateEmpty(Context,
- Record[ASTStmtReader::NumExprFields]);
+ case EXPR_UNARY_OPERATOR: {
+ BitsUnpacker UnaryOperatorBits(Record[ASTStmtReader::NumStmtFields]);
+ UnaryOperatorBits.advance(ASTStmtReader::NumExprBits);
+ bool HasFPFeatures = UnaryOperatorBits.getNextBit();
+ S = UnaryOperator::CreateEmpty(Context, HasFPFeatures);
break;
+ }
case EXPR_OFFSETOF:
S = OffsetOfExpr::CreateEmpty(Context,
@@ -3033,8 +3078,9 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
break;
case EXPR_CALL: {
- BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields]);
- auto NumArgs = CallExprBits.getNextBits(/*Width=*/16);
+ auto NumArgs = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CallExprBits.advance(1);
auto HasFPFeatures = CallExprBits.getNextBit();
S = CallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures, Empty);
break;
@@ -3045,22 +3091,32 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
Context, /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
- case EXPR_MEMBER:
- S = MemberExpr::CreateEmpty(Context, Record[ASTStmtReader::NumExprFields],
- Record[ASTStmtReader::NumExprFields + 1],
- Record[ASTStmtReader::NumExprFields + 2],
- Record[ASTStmtReader::NumExprFields + 3]);
+ case EXPR_MEMBER: {
+ BitsUnpacker ExprMemberBits(Record[ASTStmtReader::NumExprFields]);
+ bool HasQualifier = ExprMemberBits.getNextBit();
+ bool HasFoundDecl = ExprMemberBits.getNextBit();
+ bool HasTemplateInfo = ExprMemberBits.getNextBit();
+ unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields + 1];
+ S = MemberExpr::CreateEmpty(Context, HasQualifier, HasFoundDecl,
+ HasTemplateInfo, NumTemplateArgs);
break;
+ }
- case EXPR_BINARY_OPERATOR:
- S = BinaryOperator::CreateEmpty(Context,
- Record[ASTStmtReader::NumExprFields]);
+ case EXPR_BINARY_OPERATOR: {
+ BitsUnpacker BinaryOperatorBits(Record[ASTStmtReader::NumExprFields]);
+ BinaryOperatorBits.advance(/*Size of opcode*/ 6);
+ bool HasFPFeatures = BinaryOperatorBits.getNextBit();
+ S = BinaryOperator::CreateEmpty(Context, HasFPFeatures);
break;
+ }
- case EXPR_COMPOUND_ASSIGN_OPERATOR:
- S = CompoundAssignOperator::CreateEmpty(
- Context, Record[ASTStmtReader::NumExprFields]);
+ case EXPR_COMPOUND_ASSIGN_OPERATOR: {
+ BitsUnpacker BinaryOperatorBits(Record[ASTStmtReader::NumExprFields]);
+ BinaryOperatorBits.advance(/*Size of opcode*/ 6);
+ bool HasFPFeatures = BinaryOperatorBits.getNextBit();
+ S = CompoundAssignOperator::CreateEmpty(Context, HasFPFeatures);
break;
+ }
case EXPR_CONDITIONAL_OPERATOR:
S = new (Context) ConditionalOperator(Empty);
@@ -3070,19 +3126,23 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
S = new (Context) BinaryConditionalOperator(Empty);
break;
- case EXPR_IMPLICIT_CAST:
- S = ImplicitCastExpr::CreateEmpty(
- Context,
- /*PathSize*/ Record[ASTStmtReader::NumExprFields],
- /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
+ case EXPR_IMPLICIT_CAST: {
+ unsigned PathSize = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CastExprBits.advance(7);
+ bool HasFPFeatures = CastExprBits.getNextBit();
+ S = ImplicitCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
break;
+ }
- case EXPR_CSTYLE_CAST:
- S = CStyleCastExpr::CreateEmpty(
- Context,
- /*PathSize*/ Record[ASTStmtReader::NumExprFields],
- /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
+ case EXPR_CSTYLE_CAST: {
+ unsigned PathSize = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CastExprBits.advance(7);
+ bool HasFPFeatures = CastExprBits.getNextBit();
+ S = CStyleCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
break;
+ }
case EXPR_COMPOUND_LITERAL:
S = new (Context) CompoundLiteralExpr(Empty);
@@ -3777,8 +3837,9 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
}
case EXPR_CXX_OPERATOR_CALL: {
- BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields]);
- auto NumArgs = CallExprBits.getNextBits(/*Width=*/16);
+ auto NumArgs = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CallExprBits.advance(1);
auto HasFPFeatures = CallExprBits.getNextBit();
S = CXXOperatorCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
Empty);
@@ -3786,8 +3847,9 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
}
case EXPR_CXX_MEMBER_CALL: {
- BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields]);
- auto NumArgs = CallExprBits.getNextBits(/*Width=*/16);
+ auto NumArgs = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CallExprBits.advance(1);
auto HasFPFeatures = CallExprBits.getNextBit();
S = CXXMemberCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
Empty);
@@ -3814,22 +3876,26 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
/* NumArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
- case EXPR_CXX_STATIC_CAST:
- S = CXXStaticCastExpr::CreateEmpty(
- Context,
- /*PathSize*/ Record[ASTStmtReader::NumExprFields],
- /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
+ case EXPR_CXX_STATIC_CAST: {
+ unsigned PathSize = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CastExprBits.advance(7);
+ bool HasFPFeatures = CastExprBits.getNextBit();
+ S = CXXStaticCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
break;
+ }
- case EXPR_CXX_DYNAMIC_CAST:
- S = CXXDynamicCastExpr::CreateEmpty(Context,
- /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
+ case EXPR_CXX_DYNAMIC_CAST: {
+ unsigned PathSize = Record[ASTStmtReader::NumExprFields];
+ S = CXXDynamicCastExpr::CreateEmpty(Context, PathSize);
break;
+ }
- case EXPR_CXX_REINTERPRET_CAST:
- S = CXXReinterpretCastExpr::CreateEmpty(Context,
- /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
+ case EXPR_CXX_REINTERPRET_CAST: {
+ unsigned PathSize = Record[ASTStmtReader::NumExprFields];
+ S = CXXReinterpretCastExpr::CreateEmpty(Context, PathSize);
break;
+ }
case EXPR_CXX_CONST_CAST:
S = CXXConstCastExpr::CreateEmpty(Context);
@@ -3839,21 +3905,28 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
S = CXXAddrspaceCastExpr::CreateEmpty(Context);
break;
- case EXPR_CXX_FUNCTIONAL_CAST:
- S = CXXFunctionalCastExpr::CreateEmpty(
- Context,
- /*PathSize*/ Record[ASTStmtReader::NumExprFields],
- /*HasFPFeatures*/ Record[ASTStmtReader::NumExprFields + 1]);
+ case EXPR_CXX_FUNCTIONAL_CAST: {
+ unsigned PathSize = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CastExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CastExprBits.advance(7);
+ bool HasFPFeatures = CastExprBits.getNextBit();
+ S = CXXFunctionalCastExpr::CreateEmpty(Context, PathSize, HasFPFeatures);
break;
+ }
- case EXPR_BUILTIN_BIT_CAST:
- assert(Record[ASTStmtReader::NumExprFields] == 0 && "Wrong PathSize!");
+ case EXPR_BUILTIN_BIT_CAST: {
+#ifndef NDEBUG
+ unsigned PathSize = Record[ASTStmtReader::NumExprFields];
+ assert(PathSize == 0 && "Wrong PathSize!");
+#endif
S = new (Context) BuiltinBitCastExpr(Empty);
break;
+ }
case EXPR_USER_DEFINED_LITERAL: {
- BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields]);
- auto NumArgs = CallExprBits.getNextBits(/*Width=*/16);
+ auto NumArgs = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CallExprBits.advance(1);
auto HasFPFeatures = CallExprBits.getNextBit();
S = UserDefinedLiteral::CreateEmpty(Context, NumArgs, HasFPFeatures,
Empty);
@@ -3944,47 +4017,62 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
Record[ASTStmtReader::NumExprFields]);
break;
- case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
+ case EXPR_CXX_DEPENDENT_SCOPE_MEMBER: {
+ unsigned NumTemplateArgs = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker DependentScopeMemberBits(
+ Record[ASTStmtReader::NumExprFields + 1]);
+ bool HasTemplateKWAndArgsInfo = DependentScopeMemberBits.getNextBit();
+
+ bool HasFirstQualifierFoundInScope =
+ DependentScopeMemberBits.getNextBit();
S = CXXDependentScopeMemberExpr::CreateEmpty(
- Context,
- /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
- /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 1],
- /*HasFirstQualifierFoundInScope=*/
- Record[ASTStmtReader::NumExprFields + 2]);
+ Context, HasTemplateKWAndArgsInfo, NumTemplateArgs,
+ HasFirstQualifierFoundInScope);
break;
+ }
- case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
- S = DependentScopeDeclRefExpr::CreateEmpty(Context,
- /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields],
- /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
- ? Record[ASTStmtReader::NumExprFields + 1]
- : 0);
+ case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF: {
+ BitsUnpacker DependentScopeDeclRefBits(
+ Record[ASTStmtReader::NumStmtFields]);
+ DependentScopeDeclRefBits.advance(ASTStmtReader::NumExprBits);
+ bool HasTemplateKWAndArgsInfo = DependentScopeDeclRefBits.getNextBit();
+ unsigned NumTemplateArgs =
+ HasTemplateKWAndArgsInfo
+ ? DependentScopeDeclRefBits.getNextBits(/*Width=*/16)
+ : 0;
+ S = DependentScopeDeclRefExpr::CreateEmpty(
+ Context, HasTemplateKWAndArgsInfo, NumTemplateArgs);
break;
+ }
case EXPR_CXX_UNRESOLVED_CONSTRUCT:
S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
/*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
- case EXPR_CXX_UNRESOLVED_MEMBER:
+ case EXPR_CXX_UNRESOLVED_MEMBER: {
+ auto NumResults = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
+ auto NumTemplateArgs = HasTemplateKWAndArgsInfo
+ ? Record[ASTStmtReader::NumExprFields + 2]
+ : 0;
S = UnresolvedMemberExpr::CreateEmpty(
- Context,
- /*NumResults=*/Record[ASTStmtReader::NumExprFields] & ((1 << 14) - 1),
- /*HasTemplateKWAndArgsInfo=*/
- (Record[ASTStmtReader::NumExprFields] >> 14) & (0x1),
- /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] >> 14 &
- ((1 << 14) - 1));
+ Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
break;
+ }
- case EXPR_CXX_UNRESOLVED_LOOKUP:
+ case EXPR_CXX_UNRESOLVED_LOOKUP: {
+ auto NumResults = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker OverloadExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ auto HasTemplateKWAndArgsInfo = OverloadExprBits.getNextBit();
+ auto NumTemplateArgs = HasTemplateKWAndArgsInfo
+ ? Record[ASTStmtReader::NumExprFields + 2]
+ : 0;
S = UnresolvedLookupExpr::CreateEmpty(
- Context,
- /*NumResults=*/Record[ASTStmtReader::NumExprFields] & ((1 << 14) - 1),
- /*HasTemplateKWAndArgsInfo=*/
- (Record[ASTStmtReader::NumExprFields] >> 14) & (0x1),
- /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields] >> 14 &
- ((1 << 14) - 1));
+ Context, NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs);
break;
+ }
case EXPR_TYPE_TRAIT:
S = TypeTraitExpr::CreateDeserialized(Context,
@@ -4044,8 +4132,9 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
break;
case EXPR_CUDA_KERNEL_CALL: {
- BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields]);
- auto NumArgs = CallExprBits.getNextBits(/*Width=*/16);
+ auto NumArgs = Record[ASTStmtReader::NumExprFields];
+ BitsUnpacker CallExprBits(Record[ASTStmtReader::NumExprFields + 1]);
+ CallExprBits.advance(1);
auto HasFPFeatures = CallExprBits.getNextBit();
S = CUDAKernelCallExpr::CreateEmpty(Context, NumArgs, HasFPFeatures,
Empty);
diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp
index 91eb2af8f8ad..78939bfd533f 100644
--- a/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp
+++ b/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp
@@ -6003,12 +6003,17 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
BitsPacker DefinitionBits;
-#define FIELD(Name, Width, Merge) DefinitionBits.addBits(Data.Name, Width);
+#define FIELD(Name, Width, Merge) \
+ if (!DefinitionBits.canWriteNextNBits(Width)) { \
+ Record->push_back(DefinitionBits); \
+ DefinitionBits.reset(0); \
+ } \
+ DefinitionBits.addBits(Data.Name, Width);
+
#include "clang/AST/CXXRecordDeclDefinitionBits.def"
#undef FIELD
- while (DefinitionBits.hasUnconsumedValues())
- Record->push_back(DefinitionBits.getNextValue());
+ Record->push_back(DefinitionBits);
// getODRHash will compute the ODRHash if it has not been previously computed.
Record->push_back(D->getODRHash());
@@ -6047,7 +6052,7 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
LambdaBits.addBits(Lambda.CaptureDefault, /*Width=*/2);
LambdaBits.addBits(Lambda.NumCaptures, /*Width=*/15);
LambdaBits.addBit(Lambda.HasKnownInternalLinkage);
- Record->push_back(LambdaBits.getNextValue());
+ Record->push_back(LambdaBits);
Record->push_back(Lambda.NumExplicitCaptures);
Record->push_back(Lambda.ManglingNumber);
@@ -6058,10 +6063,12 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
const LambdaCapture &Capture = Lambda.Captures.front()[I];
AddSourceLocation(Capture.getLocation());
+
BitsPacker CaptureBits;
CaptureBits.addBit(Capture.isImplicit());
CaptureBits.addBits(Capture.getCaptureKind(), /*Width=*/3);
Record->push_back(CaptureBits);
+
switch (Capture.getCaptureKind()) {
case LCK_StarThis:
case LCK_This:
diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTWriterDecl.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTWriterDecl.cpp
index 43169b2befc6..2554abc682a1 100644
--- a/contrib/llvm-project/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/contrib/llvm-project/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -321,15 +321,25 @@ void ASTDeclWriter::Visit(Decl *D) {
void ASTDeclWriter::VisitDecl(Decl *D) {
BitsPacker DeclBits;
+
+ // The order matters here. It will be better to put the bit with higher
+ // probability to be 0 in the end of the bits.
+ //
+ // Since we're using VBR6 format to store it.
+ // It will be pretty effient if all the higher bits are 0.
+ // For example, if we need to pack 8 bits into a value and the stored value
+ // is 0xf0, the actual stored value will be 0b000111'110000, which takes 12
+ // bits actually. However, if we changed the order to be 0x0f, then we can
+ // store it as 0b001111, which takes 6 bits only now.
+ DeclBits.addBits((uint64_t)D->getModuleOwnershipKind(), /*BitWidth=*/3);
+ DeclBits.addBit(D->isReferenced());
+ DeclBits.addBit(D->isUsed(false));
+ DeclBits.addBits(D->getAccess(), /*BitWidth=*/2);
+ DeclBits.addBit(D->isImplicit());
DeclBits.addBit(D->getDeclContext() != D->getLexicalDeclContext());
- DeclBits.addBit(D->isInvalidDecl());
DeclBits.addBit(D->hasAttrs());
- DeclBits.addBit(D->isImplicit());
- DeclBits.addBit(D->isUsed(false));
- DeclBits.addBit(D->isReferenced());
DeclBits.addBit(D->isTopLevelDeclInObjCContainer());
- DeclBits.addBits(D->getAccess(), /*BitWidth=*/2);
- DeclBits.addBits((uint64_t)D->getModuleOwnershipKind(), /*BitWidth=*/3);
+ DeclBits.addBit(D->isInvalidDecl());
Record.push_back(DeclBits);
Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
@@ -493,21 +503,13 @@ void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {
Record.AddDeclRef(nullptr);
}
- if (D->getDeclContext() == D->getLexicalDeclContext() &&
- !D->hasAttrs() &&
- !D->isImplicit() &&
- !D->isUsed(false) &&
- !D->hasExtInfo() &&
+ if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
+ !D->isInvalidDecl() && !D->isImplicit() && !D->hasExtInfo() &&
!D->getTypedefNameForAnonDecl() &&
D->getFirstDecl() == D->getMostRecentDecl() &&
- !D->isInvalidDecl() &&
- !D->isReferenced() &&
!D->isTopLevelDeclInObjCContainer() &&
- D->getAccess() == AS_none &&
- !D->isModulePrivate() &&
!CXXRecordDecl::classofKind(D->getKind()) &&
- !D->getIntegerTypeSourceInfo() &&
- !D->getMemberSpecializationInfo() &&
+ !D->getIntegerTypeSourceInfo() && !D->getMemberSpecializationInfo() &&
!needsAnonymousDeclarationNumber(D) &&
D->getDeclName().getNameKind() == DeclarationName::Identifier)
AbbrevToUse = Writer.getDeclEnumAbbrev();
@@ -542,18 +544,11 @@ void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {
if (!isa<CXXRecordDecl>(D))
Record.push_back(D->getODRHash());
- if (D->getDeclContext() == D->getLexicalDeclContext() &&
- !D->hasAttrs() &&
- !D->isImplicit() &&
- !D->isUsed(false) &&
- !D->hasExtInfo() &&
+ if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
+ !D->isImplicit() && !D->isInvalidDecl() && !D->hasExtInfo() &&
!D->getTypedefNameForAnonDecl() &&
D->getFirstDecl() == D->getMostRecentDecl() &&
- !D->isInvalidDecl() &&
- !D->isReferenced() &&
!D->isTopLevelDeclInObjCContainer() &&
- D->getAccess() == AS_none &&
- !D->isModulePrivate() &&
!CXXRecordDecl::classofKind(D->getKind()) &&
!needsAnonymousDeclarationNumber(D) &&
D->getDeclName().getNameKind() == DeclarationName::Identifier)
@@ -674,11 +669,16 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
Record.push_back(D->getIdentifierNamespace());
+ // The order matters here. It will be better to put the bit with higher
+ // probability to be 0 in the end of the bits. See the comments in VisitDecl
+ // for details.
BitsPacker FunctionDeclBits;
// FIXME: stable encoding
+ FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);
FunctionDeclBits.addBits((uint32_t)D->getStorageClass(), /*BitWidth=*/3);
FunctionDeclBits.addBit(D->isInlineSpecified());
FunctionDeclBits.addBit(D->isInlined());
+ FunctionDeclBits.addBit(D->hasSkippedBody());
FunctionDeclBits.addBit(D->isVirtualAsWritten());
FunctionDeclBits.addBit(D->isPure());
FunctionDeclBits.addBit(D->hasInheritedPrototype());
@@ -689,14 +689,12 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
FunctionDeclBits.addBit(D->isDefaulted());
FunctionDeclBits.addBit(D->isExplicitlyDefaulted());
FunctionDeclBits.addBit(D->isIneligibleOrNotSelected());
- FunctionDeclBits.addBit(D->hasImplicitReturnZero());
FunctionDeclBits.addBits((uint64_t)(D->getConstexprKind()), /*BitWidth=*/2);
- FunctionDeclBits.addBit(D->usesSEHTry());
- FunctionDeclBits.addBit(D->hasSkippedBody());
+ FunctionDeclBits.addBit(D->hasImplicitReturnZero());
FunctionDeclBits.addBit(D->isMultiVersion());
FunctionDeclBits.addBit(D->isLateTemplateParsed());
FunctionDeclBits.addBit(D->FriendConstraintRefersToEnclosingTemplate());
- FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);
+ FunctionDeclBits.addBit(D->usesSEHTry());
Record.push_back(FunctionDeclBits);
Record.AddSourceLocation(D->getEndLoc());
@@ -1060,7 +1058,28 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
VisitRedeclarable(D);
VisitDeclaratorDecl(D);
+ // The order matters here. It will be better to put the bit with higher
+ // probability to be 0 in the end of the bits. See the comments in VisitDecl
+ // for details.
BitsPacker VarDeclBits;
+ VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()),
+ /*BitWidth=*/3);
+
+ bool ModulesCodegen = false;
+ if (Writer.WritingModule && D->getStorageDuration() == SD_Static &&
+ !D->getDescribedVarTemplate()) {
+ // When building a C++20 module interface unit or a partition unit, a
+ // strong definition in the module interface is provided by the
+ // compilation of that unit, not by its users. (Inline variables are still
+ // emitted in module users.)
+ ModulesCodegen =
+ (Writer.WritingModule->isInterfaceOrPartition() ||
+ (D->hasAttr<DLLExportAttr>() &&
+ Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
+ Writer.Context->GetGVALinkageForVariable(D) >= GVA_StrongExternal;
+ }
+ VarDeclBits.addBit(ModulesCodegen);
+
VarDeclBits.addBits(D->getStorageClass(), /*BitWidth=*/3);
VarDeclBits.addBits(D->getTSCSpec(), /*BitWidth=*/2);
VarDeclBits.addBits(D->getInitStyle(), /*BitWidth=*/2);
@@ -1072,41 +1091,26 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
VarDeclBits.addBit(D->isExceptionVariable());
VarDeclBits.addBit(D->isNRVOVariable());
VarDeclBits.addBit(D->isCXXForRangeDecl());
- VarDeclBits.addBit(D->isObjCForDecl());
+
VarDeclBits.addBit(D->isInline());
VarDeclBits.addBit(D->isInlineSpecified());
VarDeclBits.addBit(D->isConstexpr());
VarDeclBits.addBit(D->isInitCapture());
VarDeclBits.addBit(D->isPreviousDeclInSameBlockScope());
+ VarDeclBits.addBit(D->isEscapingByref());
+ HasDeducedType = D->getType()->getContainedDeducedType();
+ VarDeclBits.addBit(HasDeducedType);
+
if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
VarDeclBits.addBits(llvm::to_underlying(IPD->getParameterKind()),
/*Width=*/3);
else
VarDeclBits.addBits(0, /*Width=*/3);
- VarDeclBits.addBit(D->isEscapingByref());
- HasDeducedType = D->getType()->getContainedDeducedType();
- VarDeclBits.addBit(HasDeducedType);
- }
-
- VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), /*BitWidth=*/3);
-
- bool ModulesCodegen = false;
- if (Writer.WritingModule && D->getStorageDuration() == SD_Static &&
- !D->getDescribedVarTemplate()) {
- // When building a C++20 module interface unit or a partition unit, a
- // strong definition in the module interface is provided by the
- // compilation of that unit, not by its users. (Inline variables are still
- // emitted in module users.)
- ModulesCodegen =
- (Writer.WritingModule->isInterfaceOrPartition() ||
- (D->hasAttr<DLLExportAttr>() &&
- Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
- Writer.Context->GetGVALinkageForVariable(D) >= GVA_StrongExternal;
+ VarDeclBits.addBit(D->isObjCForDecl());
}
- VarDeclBits.addBit(ModulesCodegen);
Record.push_back(VarDeclBits);
if (ModulesCodegen)
@@ -1135,29 +1139,17 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
Record.push_back(VarNotTemplate);
}
- if (D->getDeclContext() == D->getLexicalDeclContext() &&
- !D->hasAttrs() &&
- !D->isImplicit() &&
- !D->isUsed(false) &&
- !D->isInvalidDecl() &&
- !D->isReferenced() &&
+ if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
!D->isTopLevelDeclInObjCContainer() &&
- D->getAccess() == AS_none &&
- !D->isModulePrivate() &&
!needsAnonymousDeclarationNumber(D) &&
D->getDeclName().getNameKind() == DeclarationName::Identifier &&
- !D->hasExtInfo() &&
- D->getFirstDecl() == D->getMostRecentDecl() &&
- D->getKind() == Decl::Var &&
- !D->isInline() &&
- !D->isConstexpr() &&
- !D->isInitCapture() &&
- !D->isPreviousDeclInSameBlockScope() &&
- !D->isEscapingByref() &&
- !HasDeducedType &&
- D->getStorageDuration() != SD_Static &&
- !D->getDescribedVarTemplate() &&
- !D->getMemberSpecializationInfo())
+ !D->hasExtInfo() && D->getFirstDecl() == D->getMostRecentDecl() &&
+ D->getKind() == Decl::Var && !D->isInline() && !D->isConstexpr() &&
+ !D->isInitCapture() && !D->isPreviousDeclInSameBlockScope() &&
+ !D->isEscapingByref() && !HasDeducedType &&
+ D->getStorageDuration() != SD_Static && !D->getDescribedVarTemplate() &&
+ !D->getMemberSpecializationInfo() && !D->isObjCForDecl() &&
+ !isa<ImplicitParamDecl>(D) && !D->isEscapingByref())
AbbrevToUse = Writer.getDeclVarAbbrev();
Code = serialization::DECL_VAR;
@@ -1193,14 +1185,10 @@ void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
// we dynamically check for the properties that we optimize for, but don't
// know are true of all PARM_VAR_DECLs.
if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
- !D->hasExtInfo() && !D->isImplicit() && !D->isUsed(false) &&
- !D->isInvalidDecl() && !D->isReferenced() && D->getAccess() == AS_none &&
- !D->isModulePrivate() && D->getStorageClass() == 0 &&
+ !D->hasExtInfo() && D->getStorageClass() == 0 && !D->isInvalidDecl() &&
+ !D->isTopLevelDeclInObjCContainer() &&
D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
- D->getFunctionScopeDepth() == 0 && D->getObjCDeclQualifier() == 0 &&
- !D->isKNRPromoted() && !D->isExplicitObjectParameter() &&
- !D->hasInheritedDefaultArg() && D->getInit() == nullptr &&
- !D->hasUninstantiatedDefaultArg()) // No default expr.
+ D->getInit() == nullptr) // No default expr.
AbbrevToUse = Writer.getDeclParmVarAbbrev();
// Check things we know are true of *every* PARM_VAR_DECL, which is more than
@@ -1403,6 +1391,13 @@ void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
Record.push_back(D->getIdentifierNamespace());
Record.AddDeclRef(D->UsingOrNextShadow);
Record.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D));
+
+ if (D->getDeclContext() == D->getLexicalDeclContext() &&
+ D->getFirstDecl() == D->getMostRecentDecl() && !D->hasAttrs() &&
+ !needsAnonymousDeclarationNumber(D) &&
+ D->getDeclName().getNameKind() == DeclarationName::Identifier)
+ AbbrevToUse = Writer.getDeclUsingShadowAbbrev();
+
Code = serialization::DECL_USING_SHADOW;
}
@@ -1507,10 +1502,32 @@ void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
D->getFirstDecl() == D->getMostRecentDecl() && !D->isInvalidDecl() &&
!D->hasAttrs() && !D->isTopLevelDeclInObjCContainer() &&
D->getDeclName().getNameKind() == DeclarationName::Identifier &&
- !D->hasExtInfo() && !D->hasInheritedPrototype() &&
- D->hasWrittenPrototype() &&
- D->getTemplatedKind() == FunctionDecl::TK_NonTemplate)
- AbbrevToUse = Writer.getDeclCXXMethodAbbrev();
+ !D->hasExtInfo() && !D->isExplicitlyDefaulted()) {
+ if (D->getTemplatedKind() == FunctionDecl::TK_NonTemplate ||
+ D->getTemplatedKind() == FunctionDecl::TK_FunctionTemplate ||
+ D->getTemplatedKind() == FunctionDecl::TK_MemberSpecialization ||
+ D->getTemplatedKind() == FunctionDecl::TK_DependentNonTemplate)
+ AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
+ else if (D->getTemplatedKind() ==
+ FunctionDecl::TK_FunctionTemplateSpecialization) {
+ FunctionTemplateSpecializationInfo *FTSInfo =
+ D->getTemplateSpecializationInfo();
+
+ if (FTSInfo->TemplateArguments->size() == 1) {
+ const TemplateArgument &TA = FTSInfo->TemplateArguments->get(0);
+ if (TA.getKind() == TemplateArgument::Type &&
+ !FTSInfo->TemplateArgumentsAsWritten &&
+ !FTSInfo->getMemberSpecializationInfo())
+ AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
+ }
+ } else if (D->getTemplatedKind() ==
+ FunctionDecl::TK_DependentFunctionTemplateSpecialization) {
+ DependentFunctionTemplateSpecializationInfo *DFTSInfo =
+ D->getDependentSpecializationInfo();
+ if (!DFTSInfo->TemplateArgumentsAsWritten)
+ AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
+ }
+ }
Code = serialization::DECL_CXX_METHOD;
}
@@ -1782,7 +1799,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
Record.push_back(D->wasDeclaredWithTypename());
const TypeConstraint *TC = D->getTypeConstraint();
- Record.push_back(TC != nullptr);
+ assert((bool)TC == D->hasTypeConstraint());
if (TC) {
auto *CR = TC->getConceptReference();
Record.push_back(CR != nullptr);
@@ -1800,6 +1817,13 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
if (OwnsDefaultArg)
Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
+ if (!TC && !OwnsDefaultArg &&
+ D->getDeclContext() == D->getLexicalDeclContext() &&
+ !D->isInvalidDecl() && !D->hasAttrs() &&
+ !D->isTopLevelDeclInObjCContainer() && !D->isImplicit() &&
+ D->getDeclName().getNameKind() == DeclarationName::Identifier)
+ AbbrevToUse = Writer.getDeclTemplateTypeParmAbbrev();
+
Code = serialization::DECL_TEMPLATE_TYPE_PARM;
}
@@ -2031,6 +2055,106 @@ void ASTDeclWriter::VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D) {
// ASTWriter Implementation
//===----------------------------------------------------------------------===//
+namespace {
+template <FunctionDecl::TemplatedKind Kind>
+std::shared_ptr<llvm::BitCodeAbbrev>
+getFunctionDeclAbbrev(serialization::DeclCode Code) {
+ using namespace llvm;
+
+ auto Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(Code));
+ // RedeclarableDecl
+ Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
+ Abv->Add(BitCodeAbbrevOp(Kind));
+ if constexpr (Kind == FunctionDecl::TK_NonTemplate) {
+
+ } else if constexpr (Kind == FunctionDecl::TK_FunctionTemplate) {
+ // DescribedFunctionTemplate
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
+ } else if constexpr (Kind == FunctionDecl::TK_DependentNonTemplate) {
+ // Instantiated From Decl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
+ } else if constexpr (Kind == FunctionDecl::TK_MemberSpecialization) {
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedFrom
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
+ 3)); // TemplateSpecializationKind
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Specialized Location
+ } else if constexpr (Kind ==
+ FunctionDecl::TK_FunctionTemplateSpecialization) {
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
+ 3)); // TemplateSpecializationKind
+ Abv->Add(BitCodeAbbrevOp(1)); // Template Argument Size
+ Abv->Add(BitCodeAbbrevOp(TemplateArgument::Type)); // Template Argument Kind
+ Abv->Add(
+ BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template Argument Type
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Is Defaulted
+ Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
+ Abv->Add(BitCodeAbbrevOp(0));
+ Abv->Add(
+ BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Canonical Decl of template
+ } else if constexpr (Kind == FunctionDecl::
+ TK_DependentFunctionTemplateSpecialization) {
+ // Candidates of specialization
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+ Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
+ } else {
+ llvm_unreachable("Unknown templated kind?");
+ }
+ // Decl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
+ 8)); // Packed DeclBits: ModuleOwnershipKind,
+ // isUsed, isReferenced, AccessSpecifier,
+ // isImplicit
+ //
+ // The following bits should be 0:
+ // HasStandaloneLexicalDC, HasAttrs,
+ // TopLevelDeclInObjCContainer,
+ // isInvalidDecl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
+ // NamedDecl
+ Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
+ Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
+ // ValueDecl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // DeclaratorDecl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
+ Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
+ // FunctionDecl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
+ Abv->Add(BitCodeAbbrevOp(
+ BitCodeAbbrevOp::Fixed,
+ 27)); // Packed Function Bits: StorageClass, Inline, InlineSpecified,
+ // VirtualAsWritten, Pure, HasInheritedProto, HasWrittenProto,
+ // Deleted, Trivial, TrivialForCall, Defaulted, ExplicitlyDefaulted,
+ // IsIneligibleOrNotSelected, ImplicitReturnZero, Constexpr,
+ // UsesSEHTry, SkippedBody, MultiVersion, LateParsed,
+ // FriendConstraintRefersToEnclosingTemplate, Linkage
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
+ // This Array slurps the rest of the record. Fortunately we want to encode
+ // (nearly) all the remaining (variable number of) fields in the same way.
+ //
+ // This is:
+ // NumParams and Params[] from FunctionDecl, and
+ // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
+ //
+ // Add an AbbrevOp for 'size then elements' and use it here.
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
+ return Abv;
+}
+
+template <FunctionDecl::TemplatedKind Kind>
+std::shared_ptr<llvm::BitCodeAbbrev> getCXXMethodAbbrev() {
+ return getFunctionDeclAbbrev<Kind>(serialization::DECL_CXX_METHOD);
+}
+} // namespace
+
void ASTWriter::WriteDeclAbbrevs() {
using namespace llvm;
@@ -2041,10 +2165,13 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
// Decl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
- 12)); // Packed DeclBits: HasStandaloneLexicalDC,
- // isInvalidDecl, HasAttrs, isImplicit, isUsed,
- // isReferenced, TopLevelDeclInObjCContainer,
- // AccessSpecifier, ModuleOwnershipKind
+ 7)); // Packed DeclBits: ModuleOwnershipKind,
+ // isUsed, isReferenced, AccessSpecifier,
+ //
+ // The following bits should be 0:
+ // isImplicit, HasStandaloneLexicalDC, HasAttrs,
+ // TopLevelDeclInObjCContainer,
+ // isInvalidDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
// NamedDecl
@@ -2104,10 +2231,13 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
// Decl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
- 12)); // Packed DeclBits: HasStandaloneLexicalDC,
- // isInvalidDecl, HasAttrs, isImplicit, isUsed,
- // isReferenced, TopLevelDeclInObjCContainer,
- // AccessSpecifier, ModuleOwnershipKind
+ 7)); // Packed DeclBits: ModuleOwnershipKind,
+ // isUsed, isReferenced, AccessSpecifier,
+ //
+ // The following bits should be 0:
+ // isImplicit, HasStandaloneLexicalDC, HasAttrs,
+ // TopLevelDeclInObjCContainer,
+ // isInvalidDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
// NamedDecl
@@ -2145,10 +2275,13 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
// Decl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
- 12)); // Packed DeclBits: HasStandaloneLexicalDC,
- // isInvalidDecl, HasAttrs, isImplicit, isUsed,
- // isReferenced, TopLevelDeclInObjCContainer,
- // AccessSpecifier, ModuleOwnershipKind
+ 7)); // Packed DeclBits: ModuleOwnershipKind,
+ // isUsed, isReferenced, AccessSpecifier,
+ //
+ // The following bits should be 0:
+ // isImplicit, HasStandaloneLexicalDC, HasAttrs,
+ // TopLevelDeclInObjCContainer,
+ // isInvalidDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
// NamedDecl
@@ -2193,10 +2326,11 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
// Decl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
- 12)); // Packed DeclBits: HasStandaloneLexicalDC,
- // isInvalidDecl, HasAttrs, isImplicit, isUsed,
- // isReferenced, TopLevelDeclInObjCContainer,
- // AccessSpecifier, ModuleOwnershipKind
+ 8)); // Packed DeclBits: ModuleOwnershipKind, isUsed,
+ // isReferenced, AccessSpecifier,
+ // HasStandaloneLexicalDC, HasAttrs, isImplicit,
+ // TopLevelDeclInObjCContainer,
+ // isInvalidDecl,
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
// NamedDecl
@@ -2233,10 +2367,11 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
// Decl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
- 12)); // Packed DeclBits: HasStandaloneLexicalDC,
- // isInvalidDecl, HasAttrs, isImplicit, isUsed,
- // isReferenced, TopLevelDeclInObjCContainer,
- // AccessSpecifier, ModuleOwnershipKind
+ 7)); // Packed DeclBits: ModuleOwnershipKind,
+ // isReferenced, isUsed, AccessSpecifier. Other
+ // higher bits should be 0: isImplicit,
+ // HasStandaloneLexicalDC, HasAttrs,
+ // TopLevelDeclInObjCContainer, isInvalidDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
// NamedDecl
@@ -2277,12 +2412,13 @@ void ASTWriter::WriteDeclAbbrevs() {
// VarDecl
Abv->Add(BitCodeAbbrevOp(
BitCodeAbbrevOp::Fixed,
- 27)); // Packed Var Decl bits: SClass, TSCSpec, InitStyle,
+ 21)); // Packed Var Decl bits: Linkage, ModulesCodegen,
+ // SClass, TSCSpec, InitStyle,
// isARCPseudoStrong, IsThisDeclarationADemotedDefinition,
// isExceptionVariable, isNRVOVariable, isCXXForRangeDecl,
- // isObjCForDecl, isInline, isInlineSpecified, isConstexpr,
- // isInitCapture, isPrevDeclInSameScope, ImplicitParamKind,
- // EscapingByref, HasDeducedType, Linkage, ModulesCodegen
+ // isInline, isInlineSpecified, isConstexpr,
+ // isInitCapture, isPrevDeclInSameScope,
+ // EscapingByref, HasDeducedType, ImplicitParamKind, isObjCForDecl
Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
// Type Source Info
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
@@ -2290,71 +2426,84 @@ void ASTWriter::WriteDeclAbbrevs() {
DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
// Abbreviation for DECL_CXX_METHOD
+ DeclCXXMethodAbbrev =
+ Stream.EmitAbbrev(getCXXMethodAbbrev<FunctionDecl::TK_NonTemplate>());
+ DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
+ getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplate>());
+ DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
+ getCXXMethodAbbrev<FunctionDecl::TK_DependentNonTemplate>());
+ DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
+ getCXXMethodAbbrev<FunctionDecl::TK_MemberSpecialization>());
+ DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
+ getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplateSpecialization>());
+ DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(
+ getCXXMethodAbbrev<
+ FunctionDecl::TK_DependentFunctionTemplateSpecialization>());
+
+ // Abbreviation for DECL_TEMPLATE_TYPE_PARM
Abv = std::make_shared<BitCodeAbbrev>();
- Abv->Add(BitCodeAbbrevOp(serialization::DECL_CXX_METHOD));
- // RedeclarableDecl
- Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
- // FIXME: Implement abbreviation for other template kinds.
- Abv->Add(BitCodeAbbrevOp(FunctionDecl::TK_NonTemplate)); // TemplateKind
+ Abv->Add(BitCodeAbbrevOp(serialization::DECL_TEMPLATE_TYPE_PARM));
+ Abv->Add(BitCodeAbbrevOp(0)); // hasTypeConstraint
+ // Decl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
+ 7)); // Packed DeclBits: ModuleOwnershipKind,
+ // isReferenced, isUsed, AccessSpecifier. Other
+ // higher bits should be 0: isImplicit,
+ // HasStandaloneLexicalDC, HasAttrs,
+ // TopLevelDeclInObjCContainer, isInvalidDecl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
+ // NamedDecl
+ Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
+ Abv->Add(BitCodeAbbrevOp(0));
+ // TypeDecl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
+ // TemplateTypeParmDecl
+ Abv->Add(
+ BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // wasDeclaredWithTypename
+ Abv->Add(BitCodeAbbrevOp(0)); // OwnsDefaultArg
+ DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));
+
+ // Abbreviation for DECL_USING_SHADOW
+ Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(serialization::DECL_USING_SHADOW));
+ // Redeclarable
+ Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
// Decl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
12)); // Packed DeclBits: HasStandaloneLexicalDC,
// isInvalidDecl, HasAttrs, isImplicit, isUsed,
// isReferenced, TopLevelDeclInObjCContainer,
// AccessSpecifier, ModuleOwnershipKind
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
// NamedDecl
- Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
- Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
- // ValueDecl
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
- // DeclaratorDecl
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
- Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
- // FunctionDecl
+ Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
+ Abv->Add(BitCodeAbbrevOp(0));
+ // UsingShadowDecl
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TargetDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
- Abv->Add(BitCodeAbbrevOp(
- BitCodeAbbrevOp::Fixed,
- 27)); // Packed Function Bits: StorageClass, Inline, InlineSpecified,
- // VirtualAsWritten, Pure, HasInheritedProto, HasWrittenProto,
- // Deleted, Trivial, TrivialForCall, Defaulted, ExplicitlyDefaulted,
- // IsIneligibleOrNotSelected, ImplicitReturnZero, Constexpr,
- // UsesSEHTry, SkippedBody, MultiVersion, LateParsed,
- // FriendConstraintRefersToEnclosingTemplate, Linkage
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Default
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
- // This Array slurps the rest of the record. Fortunately we want to encode
- // (nearly) all the remaining (variable number of) fields in the same way.
- //
- // This is:
- // NumParams and Params[] from FunctionDecl, and
- // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
- //
- // Add an AbbrevOp for 'size then elements' and use it here.
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
- DeclCXXMethodAbbrev = Stream.EmitAbbrev(std::move(Abv));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // UsingOrNextShadow
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,
+ 6)); // InstantiatedFromUsingShadowDecl
+ DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));
// Abbreviation for EXPR_DECL_REF
Abv = std::make_shared<BitCodeAbbrev>();
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
- //Stmt
- // Expr
+ // Stmt
+ // Expr
+ // PackingBits: DependenceKind, ValueKind. ObjectKind should be 0.
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
- // DependenceKind, ValueKind, ObjectKind
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
- //DeclRefExpr
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HasQualifier
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //GetDeclFound
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ExplicitTemplateArgs
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HadMultipleCandidates
- Abv->Add(BitCodeAbbrevOp(0)); // RefersToEnclosingVariableOrCapture
- Abv->Add(BitCodeAbbrevOp(0)); // NonOdrUseReason
- Abv->Add(BitCodeAbbrevOp(0)); // IsImmediateEscalating
+ // DeclRefExpr
+ // Packing Bits: , HadMultipleCandidates, RefersToEnclosingVariableOrCapture,
+ // IsImmediateEscalating, NonOdrUseReason.
+ // GetDeclFound, HasQualifier and ExplicitTemplateArgs should be 0.
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
@@ -2364,10 +2513,10 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
//Stmt
// Expr
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
// DependenceKind, ValueKind, ObjectKind
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
- //Integer Literal
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // Integer Literal
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
@@ -2378,10 +2527,10 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
//Stmt
// Expr
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
// DependenceKind, ValueKind, ObjectKind
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
- //Character Literal
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // Character Literal
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
@@ -2392,17 +2541,108 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
// Stmt
// Expr
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
- // DependenceKind, ValueKind, ObjectKind
+ // Packing Bits: DependenceKind, ValueKind, ObjectKind,
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
// CastExpr
Abv->Add(BitCodeAbbrevOp(0)); // PathSize
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // HasFPFeatures
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 6)); // CastKind
- Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // PartOfExplicitCast
+ // Packing Bits: CastKind, StoredFPFeatures, isPartOfExplicitCast
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));
// ImplicitCastExpr
ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
+ // Abbreviation for EXPR_BINARY_OPERATOR
+ Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(serialization::EXPR_BINARY_OPERATOR));
+ // Stmt
+ // Expr
+ // Packing Bits: DependenceKind. ValueKind and ObjectKind should
+ // be 0 in this case.
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // BinaryOperator
+ Abv->Add(
+ BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
+
+ // Abbreviation for EXPR_COMPOUND_ASSIGN_OPERATOR
+ Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(serialization::EXPR_COMPOUND_ASSIGN_OPERATOR));
+ // Stmt
+ // Expr
+ // Packing Bits: DependenceKind. ValueKind and ObjectKind should
+ // be 0 in this case.
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // BinaryOperator
+ // Packing Bits: OpCode. The HasFPFeatures bit should be 0
+ Abv->Add(
+ BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ // CompoundAssignOperator
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHSType
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Result Type
+ CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
+
+ // Abbreviation for EXPR_CALL
+ Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CALL));
+ // Stmt
+ // Expr
+ // Packing Bits: DependenceKind, ValueKind, ObjectKind,
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // CallExpr
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
+ Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
+
+ // Abbreviation for EXPR_CXX_OPERATOR_CALL
+ Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_OPERATOR_CALL));
+ // Stmt
+ // Expr
+ // Packing Bits: DependenceKind, ValueKind, ObjectKind,
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // CallExpr
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
+ Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ // CXXOperatorCallExpr
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Operator Kind
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
+
+ // Abbreviation for EXPR_CXX_MEMBER_CALL
+ Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_MEMBER_CALL));
+ // Stmt
+ // Expr
+ // Packing Bits: DependenceKind, ValueKind, ObjectKind,
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
+ // CallExpr
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
+ Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ // CXXMemberCallExpr
+ CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
+
+ // Abbreviation for STMT_COMPOUND
+ Abv = std::make_shared<BitCodeAbbrev>();
+ Abv->Add(BitCodeAbbrevOp(serialization::STMT_COMPOUND));
+ // Stmt
+ // CompoundStmt
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Num Stmts
+ Abv->Add(BitCodeAbbrevOp(0)); // hasStoredFPFeatures
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
+ CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));
+
Abv = std::make_shared<BitCodeAbbrev>();
Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTWriterStmt.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTWriterStmt.cpp
index 8524484ea8a0..7f888e44dde1 100644
--- a/contrib/llvm-project/clang/lib/Serialization/ASTWriterStmt.cpp
+++ b/contrib/llvm-project/clang/lib/Serialization/ASTWriterStmt.cpp
@@ -37,15 +37,70 @@ namespace clang {
serialization::StmtCode Code;
unsigned AbbrevToUse;
+ /// A helper that can help us to write a packed bit across function
+ /// calls. For example, we may write seperate bits in seperate functions:
+ ///
+ /// void VisitA(A* a) {
+ /// Record.push_back(a->isSomething());
+ /// }
+ ///
+ /// void Visitb(B *b) {
+ /// VisitA(b);
+ /// Record.push_back(b->isAnother());
+ /// }
+ ///
+ /// In such cases, it'll be better if we can pack these 2 bits. We achieve
+ /// this by writing a zero value in `VisitA` and recorded that first and add
+ /// the new bit to the recorded value.
+ class PakedBitsWriter {
+ public:
+ PakedBitsWriter(ASTRecordWriter &Record) : RecordRef(Record) {}
+ ~PakedBitsWriter() { assert(!CurrentIndex); }
+
+ void addBit(bool Value) {
+ assert(CurrentIndex && "Writing Bits without recording first!");
+ PackingBits.addBit(Value);
+ }
+ void addBits(uint32_t Value, uint32_t BitsWidth) {
+ assert(CurrentIndex && "Writing Bits without recording first!");
+ PackingBits.addBits(Value, BitsWidth);
+ }
+
+ void writeBits() {
+ if (!CurrentIndex)
+ return;
+
+ RecordRef[*CurrentIndex] = (uint32_t)PackingBits;
+ CurrentIndex = std::nullopt;
+ PackingBits.reset(0);
+ }
+
+ void updateBits() {
+ writeBits();
+
+ CurrentIndex = RecordRef.size();
+ RecordRef.push_back(0);
+ }
+
+ private:
+ BitsPacker PackingBits;
+ ASTRecordWriter &RecordRef;
+ std::optional<unsigned> CurrentIndex;
+ };
+
+ PakedBitsWriter CurrentPackingBits;
+
public:
ASTStmtWriter(ASTWriter &Writer, ASTWriter::RecordData &Record)
: Writer(Writer), Record(Writer, Record),
- Code(serialization::STMT_NULL_PTR), AbbrevToUse(0) {}
+ Code(serialization::STMT_NULL_PTR), AbbrevToUse(0),
+ CurrentPackingBits(this->Record) {}
ASTStmtWriter(const ASTStmtWriter&) = delete;
ASTStmtWriter &operator=(const ASTStmtWriter &) = delete;
uint64_t Emit() {
+ CurrentPackingBits.writeBits();
assert(Code != serialization::STMT_NULL_PTR &&
"unhandled sub-statement writing AST file");
return Record.EmitStmt(Code, AbbrevToUse);
@@ -82,14 +137,20 @@ void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
VisitStmt(S);
+
Record.push_back(S->size());
Record.push_back(S->hasStoredFPFeatures());
+
for (auto *CS : S->body())
Record.AddStmt(CS);
if (S->hasStoredFPFeatures())
Record.push_back(S->getStoredFPFeatures().getAsOpaqueInt());
Record.AddSourceLocation(S->getLBracLoc());
Record.AddSourceLocation(S->getRBracLoc());
+
+ if (!S->hasStoredFPFeatures())
+ AbbrevToUse = Writer.getCompoundStmtAbbrev();
+
Code = serialization::STMT_COMPOUND;
}
@@ -143,9 +204,11 @@ void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
bool HasVar = S->getConditionVariableDeclStmt() != nullptr;
bool HasInit = S->getInit() != nullptr;
- Record.push_back(HasElse);
- Record.push_back(HasVar);
- Record.push_back(HasInit);
+ CurrentPackingBits.updateBits();
+
+ CurrentPackingBits.addBit(HasElse);
+ CurrentPackingBits.addBit(HasVar);
+ CurrentPackingBits.addBit(HasInit);
Record.push_back(static_cast<uint64_t>(S->getStatementKind()));
Record.AddStmt(S->getCond());
Record.AddStmt(S->getThen());
@@ -548,15 +611,13 @@ void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
void ASTStmtWriter::VisitExpr(Expr *E) {
VisitStmt(E);
- Record.AddTypeRef(E->getType());
- BitsPacker ExprBits;
+ CurrentPackingBits.updateBits();
+ CurrentPackingBits.addBits(E->getDependence(), /*BitsWidth=*/5);
+ CurrentPackingBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
+ CurrentPackingBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
- ExprBits.addBits(E->getDependence(), /*BitsWidth=*/5);
- ExprBits.addBits(E->getValueKind(), /*BitsWidth=*/2);
- ExprBits.addBits(E->getObjectKind(), /*BitsWidth=*/3);
-
- Record.push_back(ExprBits);
+ Record.AddTypeRef(E->getType());
}
void ASTStmtWriter::VisitConstantExpr(ConstantExpr *E) {
@@ -612,13 +673,15 @@ void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
VisitExpr(E);
- Record.push_back(E->hasQualifier());
- Record.push_back(E->getDecl() != E->getFoundDecl());
- Record.push_back(E->hasTemplateKWAndArgsInfo());
- Record.push_back(E->hadMultipleCandidates());
- Record.push_back(E->refersToEnclosingVariableOrCapture());
- Record.push_back(E->isNonOdrUse());
- Record.push_back(E->isImmediateEscalating());
+ CurrentPackingBits.updateBits();
+
+ CurrentPackingBits.addBit(E->hadMultipleCandidates());
+ CurrentPackingBits.addBit(E->refersToEnclosingVariableOrCapture());
+ CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
+ CurrentPackingBits.addBit(E->isImmediateEscalating());
+ CurrentPackingBits.addBit(E->getDecl() != E->getFoundDecl());
+ CurrentPackingBits.addBit(E->hasQualifier());
+ CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
if (E->hasTemplateKWAndArgsInfo()) {
unsigned NumTemplateArgs = E->getNumTemplateArgs();
@@ -629,9 +692,7 @@ void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
if ((!E->hasTemplateKWAndArgsInfo()) && (!E->hasQualifier()) &&
(E->getDecl() == E->getFoundDecl()) &&
- nk == DeclarationName::Identifier &&
- !E->refersToEnclosingVariableOrCapture() && !E->isNonOdrUse() &&
- !E->isImmediateEscalating()) {
+ nk == DeclarationName::Identifier && E->getObjectKind() == OK_Ordinary) {
AbbrevToUse = Writer.getDeclRefExprAbbrev();
}
@@ -742,11 +803,13 @@ void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
bool HasFPFeatures = E->hasStoredFPFeatures();
// Write this first for easy access when deserializing, as they affect the
// size of the UnaryOperator.
- Record.push_back(HasFPFeatures);
+ CurrentPackingBits.addBit(HasFPFeatures);
Record.AddStmt(E->getSubExpr());
- Record.push_back(E->getOpcode()); // FIXME: stable encoding
+ CurrentPackingBits.addBits(E->getOpcode(),
+ /*Width=*/5); // FIXME: stable encoding
Record.AddSourceLocation(E->getOperatorLoc());
- Record.push_back(E->canOverflow());
+ CurrentPackingBits.addBit(E->canOverflow());
+
if (HasFPFeatures)
Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
Code = serialization::EXPR_UNARY_OPERATOR;
@@ -872,12 +935,10 @@ void ASTStmtWriter::VisitOMPIteratorExpr(OMPIteratorExpr *E) {
void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
VisitExpr(E);
- BitsPacker CallExprBits;
- // 16 bits should be sufficient to store the number args;
- CallExprBits.addBits(E->getNumArgs(), /*BitsWidth=*/16);
- CallExprBits.addBit(E->hasStoredFPFeatures());
- CallExprBits.addBit(static_cast<bool>(E->getADLCallKind()));
- Record.push_back(CallExprBits);
+ Record.push_back(E->getNumArgs());
+ CurrentPackingBits.updateBits();
+ CurrentPackingBits.addBit(static_cast<bool>(E->getADLCallKind()));
+ CurrentPackingBits.addBit(E->hasStoredFPFeatures());
Record.AddSourceLocation(E->getRParenLoc());
Record.AddStmt(E->getCallee());
@@ -887,6 +948,11 @@ void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
if (E->hasStoredFPFeatures())
Record.push_back(E->getFPFeatures().getAsOpaqueInt());
+
+ if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) &&
+ E->getStmtClass() == Stmt::CallExprClass)
+ AbbrevToUse = Writer.getCallExprAbbrev();
+
Code = serialization::EXPR_CALL;
}
@@ -913,9 +979,10 @@ void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
// Write these first for easy access when deserializing, as they affect the
// size of the MemberExpr.
- Record.push_back(HasQualifier);
- Record.push_back(HasFoundDecl);
- Record.push_back(HasTemplateInfo);
+ CurrentPackingBits.updateBits();
+ CurrentPackingBits.addBit(HasQualifier);
+ CurrentPackingBits.addBit(HasFoundDecl);
+ CurrentPackingBits.addBit(HasTemplateInfo);
Record.push_back(NumTemplateArgs);
Record.AddStmt(E->getBase());
@@ -923,15 +990,15 @@ void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
Record.AddDeclarationNameLoc(E->MemberDNLoc,
E->getMemberDecl()->getDeclName());
Record.AddSourceLocation(E->getMemberLoc());
- Record.push_back(E->isArrow());
- Record.push_back(E->hadMultipleCandidates());
- Record.push_back(E->isNonOdrUse());
+ CurrentPackingBits.addBit(E->isArrow());
+ CurrentPackingBits.addBit(E->hadMultipleCandidates());
+ CurrentPackingBits.addBits(E->isNonOdrUse(), /*Width=*/2);
Record.AddSourceLocation(E->getOperatorLoc());
if (HasFoundDecl) {
DeclAccessPair FoundDecl = E->getFoundDecl();
Record.AddDeclRef(FoundDecl.getDecl());
- Record.push_back(FoundDecl.getAccess());
+ CurrentPackingBits.addBits(FoundDecl.getAccess(), /*BitWidth=*/2);
}
if (HasQualifier)
@@ -971,10 +1038,13 @@ void ASTStmtWriter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
VisitExpr(E);
+
Record.push_back(E->path_size());
- Record.push_back(E->hasStoredFPFeatures());
+ CurrentPackingBits.updateBits();
+ // 7 bits should be enough to store the casting kinds.
+ CurrentPackingBits.addBits(E->getCastKind(), /*Width=*/7);
+ CurrentPackingBits.addBit(E->hasStoredFPFeatures());
Record.AddStmt(E->getSubExpr());
- Record.push_back(E->getCastKind()); // FIXME: stable encoding
for (CastExpr::path_iterator
PI = E->path_begin(), PE = E->path_end(); PI != PE; ++PI)
@@ -986,16 +1056,23 @@ void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
VisitExpr(E);
- bool HasFPFeatures = E->hasStoredFPFeatures();
+
// Write this first for easy access when deserializing, as they affect the
// size of the UnaryOperator.
- Record.push_back(HasFPFeatures);
- Record.push_back(E->getOpcode()); // FIXME: stable encoding
+ CurrentPackingBits.updateBits();
+ CurrentPackingBits.addBits(E->getOpcode(), /*Width=*/6);
+ bool HasFPFeatures = E->hasStoredFPFeatures();
+ CurrentPackingBits.addBit(HasFPFeatures);
Record.AddStmt(E->getLHS());
Record.AddStmt(E->getRHS());
Record.AddSourceLocation(E->getOperatorLoc());
if (HasFPFeatures)
Record.push_back(E->getStoredFPFeatures().getAsOpaqueInt());
+
+ if (!HasFPFeatures && E->getValueKind() == VK_PRValue &&
+ E->getObjectKind() == OK_Ordinary)
+ AbbrevToUse = Writer.getBinaryOperatorAbbrev();
+
Code = serialization::EXPR_BINARY_OPERATOR;
}
@@ -1003,6 +1080,11 @@ void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
VisitBinaryOperator(E);
Record.AddTypeRef(E->getComputationLHSType());
Record.AddTypeRef(E->getComputationResultType());
+
+ if (!E->hasStoredFPFeatures() && E->getValueKind() == VK_PRValue &&
+ E->getObjectKind() == OK_Ordinary)
+ AbbrevToUse = Writer.getCompoundAssignOperatorAbbrev();
+
Code = serialization::EXPR_COMPOUND_ASSIGN_OPERATOR;
}
@@ -1031,7 +1113,7 @@ ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
VisitCastExpr(E);
- Record.push_back(E->isPartOfExplicitCast());
+ CurrentPackingBits.addBit(E->isPartOfExplicitCast());
if (E->path_size() == 0 && !E->hasStoredFPFeatures())
AbbrevToUse = Writer.getExprImplicitCastAbbrev();
@@ -1588,11 +1670,19 @@ void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
VisitCallExpr(E);
Record.push_back(E->getOperator());
Record.AddSourceRange(E->Range);
+
+ if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
+ AbbrevToUse = Writer.getCXXOperatorCallExprAbbrev();
+
Code = serialization::EXPR_CXX_OPERATOR_CALL;
}
void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
VisitCallExpr(E);
+
+ if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()))
+ AbbrevToUse = Writer.getCXXMemberCallExprAbbrev();
+
Code = serialization::EXPR_CXX_MEMBER_CALL;
}
@@ -1673,7 +1763,9 @@ void ASTStmtWriter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E)
void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
VisitExplicitCastExpr(E);
Record.AddSourceRange(SourceRange(E->getOperatorLoc(), E->getRParenLoc()));
- Record.AddSourceRange(E->getAngleBrackets());
+ CurrentPackingBits.addBit(E->getAngleBrackets().isValid());
+ if (E->getAngleBrackets().isValid())
+ Record.AddSourceRange(E->getAngleBrackets());
}
void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
@@ -1750,6 +1842,7 @@ void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
VisitExpr(E);
Record.AddSourceLocation(E->getLocation());
Record.push_back(E->isImplicit());
+
Code = serialization::EXPR_CXX_THIS;
}
@@ -1883,10 +1976,10 @@ void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
// Don't emit anything here (or if you do you will have to update
// the corresponding deserialization function).
-
- Record.push_back(E->hasTemplateKWAndArgsInfo());
Record.push_back(E->getNumTemplateArgs());
- Record.push_back(E->hasFirstQualifierFoundInScope());
+ CurrentPackingBits.updateBits();
+ CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
+ CurrentPackingBits.addBit(E->hasFirstQualifierFoundInScope());
if (E->hasTemplateKWAndArgsInfo()) {
const ASTTemplateKWAndArgsInfo &ArgInfo =
@@ -1895,14 +1988,15 @@ void ASTStmtWriter::VisitCXXDependentScopeMemberExpr(
E->getTrailingObjects<TemplateArgumentLoc>());
}
- Record.push_back(E->isArrow());
- Record.AddSourceLocation(E->getOperatorLoc());
+ CurrentPackingBits.addBit(E->isArrow());
+
Record.AddTypeRef(E->getBaseType());
Record.AddNestedNameSpecifierLoc(E->getQualifierLoc());
+ CurrentPackingBits.addBit(!E->isImplicitAccess());
if (!E->isImplicitAccess())
Record.AddStmt(E->getBase());
- else
- Record.AddStmt(nullptr);
+
+ Record.AddSourceLocation(E->getOperatorLoc());
if (E->hasFirstQualifierFoundInScope())
Record.AddDeclRef(E->getFirstQualifierFoundInScope());
@@ -1917,12 +2011,14 @@ ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
// Don't emit anything here, HasTemplateKWAndArgsInfo must be
// emitted first.
+ CurrentPackingBits.addBit(
+ E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
- Record.push_back(E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo);
if (E->DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo) {
const ASTTemplateKWAndArgsInfo &ArgInfo =
*E->getTrailingObjects<ASTTemplateKWAndArgsInfo>();
- Record.push_back(ArgInfo.NumTemplateArgs);
+ // 16 bits should be enought to store the number of args
+ CurrentPackingBits.addBits(ArgInfo.NumTemplateArgs, /*Width=*/16);
AddTemplateKWAndArgsInfo(ArgInfo,
E->getTrailingObjects<TemplateArgumentLoc>());
}
@@ -1949,19 +2045,16 @@ ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
VisitExpr(E);
- BitsPacker OverloadExprBits;
- // 14 Bits should enough to store the number of decls.
- OverloadExprBits.addBits(E->getNumDecls(), /*BitWidth=*/14);
- OverloadExprBits.addBit(E->hasTemplateKWAndArgsInfo());
+ Record.push_back(E->getNumDecls());
+
+ CurrentPackingBits.updateBits();
+ CurrentPackingBits.addBit(E->hasTemplateKWAndArgsInfo());
if (E->hasTemplateKWAndArgsInfo()) {
const ASTTemplateKWAndArgsInfo &ArgInfo =
*E->getTrailingASTTemplateKWAndArgsInfo();
- // 14 Bits should enough to store the number of template args.
- OverloadExprBits.addBits(ArgInfo.NumTemplateArgs, /*BitWidth=*/14);
- Record.push_back(OverloadExprBits);
+ Record.push_back(ArgInfo.NumTemplateArgs);
AddTemplateKWAndArgsInfo(ArgInfo, E->getTrailingTemplateArgumentLoc());
- } else
- Record.push_back(OverloadExprBits);
+ }
for (OverloadExpr::decls_iterator OvI = E->decls_begin(),
OvE = E->decls_end();
@@ -1976,18 +2069,22 @@ void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
VisitOverloadExpr(E);
- Record.push_back(E->isArrow());
- Record.push_back(E->hasUnresolvedUsing());
- Record.AddStmt(!E->isImplicitAccess() ? E->getBase() : nullptr);
- Record.AddTypeRef(E->getBaseType());
+ CurrentPackingBits.addBit(E->isArrow());
+ CurrentPackingBits.addBit(E->hasUnresolvedUsing());
+ CurrentPackingBits.addBit(!E->isImplicitAccess());
+ if (!E->isImplicitAccess())
+ Record.AddStmt(E->getBase());
+
Record.AddSourceLocation(E->getOperatorLoc());
+
+ Record.AddTypeRef(E->getBaseType());
Code = serialization::EXPR_CXX_UNRESOLVED_MEMBER;
}
void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
VisitOverloadExpr(E);
- Record.push_back(E->requiresADL());
- Record.push_back(E->isOverloaded());
+ CurrentPackingBits.addBit(E->requiresADL());
+ CurrentPackingBits.addBit(E->isOverloaded());
Record.AddDeclRef(E->getNamingClass());
Code = serialization::EXPR_CXX_UNRESOLVED_LOOKUP;
}
@@ -2059,12 +2156,12 @@ void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
SubstNonTypeTemplateParmExpr *E) {
VisitExpr(E);
Record.AddDeclRef(E->getAssociatedDecl());
- Record.push_back(E->isReferenceParameter());
- Record.push_back(E->getIndex());
+ CurrentPackingBits.addBit(E->isReferenceParameter());
+ CurrentPackingBits.addBits(E->getIndex(), /*Width=*/12);
+ CurrentPackingBits.addBit((bool)E->getPackIndex());
if (auto PackIndex = E->getPackIndex())
Record.push_back(*PackIndex + 1);
- else
- Record.push_back(0);
+
Record.AddSourceLocation(E->getNameLoc());
Record.AddStmt(E->getReplacement());
Code = serialization::EXPR_SUBST_NON_TYPE_TEMPLATE_PARM;
diff --git a/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index 925fc90e3554..254b36ed0396 100644
--- a/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -266,6 +266,8 @@ private:
{&StreamChecker::preFseek, &StreamChecker::evalFseek, 0}},
{{{"ftell"}, 1},
{&StreamChecker::preDefault, &StreamChecker::evalFtell, 0}},
+ {{{"fflush"}, 1},
+ {&StreamChecker::preFflush, &StreamChecker::evalFflush, 0}},
{{{"rewind"}, 1},
{&StreamChecker::preDefault, &StreamChecker::evalRewind, 0}},
{{{"fgetpos"}, 2},
@@ -360,6 +362,12 @@ private:
CheckerContext &C,
const StreamErrorState &ErrorKind) const;
+ void preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const;
+
+ void evalFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const;
+
/// Check that the stream (in StreamVal) is not NULL.
/// If it can only be NULL a fatal error is emitted and nullptr returned.
/// Otherwise the return value is a new state where the stream is constrained
@@ -1191,6 +1199,84 @@ void StreamChecker::evalSetFeofFerror(const FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef State = C.getState();
+ SVal StreamVal = getStreamArg(Desc, Call);
+ std::optional<DefinedSVal> Stream = StreamVal.getAs<DefinedSVal>();
+ if (!Stream)
+ return;
+
+ ProgramStateRef StateNotNull, StateNull;
+ std::tie(StateNotNull, StateNull) =
+ C.getConstraintManager().assumeDual(State, *Stream);
+ if (StateNotNull && !StateNull)
+ ensureStreamOpened(StreamVal, C, StateNotNull);
+}
+
+void StreamChecker::evalFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef State = C.getState();
+ SVal StreamVal = getStreamArg(Desc, Call);
+ std::optional<DefinedSVal> Stream = StreamVal.getAs<DefinedSVal>();
+ if (!Stream)
+ return;
+
+ // Skip if the stream can be both NULL and non-NULL.
+ ProgramStateRef StateNotNull, StateNull;
+ std::tie(StateNotNull, StateNull) =
+ C.getConstraintManager().assumeDual(State, *Stream);
+ if (StateNotNull && StateNull)
+ return;
+ if (StateNotNull && !StateNull)
+ State = StateNotNull;
+ else
+ State = StateNull;
+
+ const CallExpr *CE = dyn_cast_or_null<CallExpr>(Call.getOriginExpr());
+ if (!CE)
+ return;
+
+ // `fflush` returns EOF on failure, otherwise returns 0.
+ ProgramStateRef StateFailed = bindInt(*EofVal, State, C, CE);
+ ProgramStateRef StateNotFailed = bindInt(0, State, C, CE);
+
+ // Clear error states if `fflush` returns 0, but retain their EOF flags.
+ auto ClearErrorInNotFailed = [&StateNotFailed, Desc](SymbolRef Sym,
+ const StreamState *SS) {
+ if (SS->ErrorState & ErrorFError) {
+ StreamErrorState NewES =
+ (SS->ErrorState & ErrorFEof) ? ErrorFEof : ErrorNone;
+ StreamState NewSS = StreamState::getOpened(Desc, NewES, false);
+ StateNotFailed = StateNotFailed->set<StreamMap>(Sym, NewSS);
+ }
+ };
+
+ if (StateNotNull && !StateNull) {
+ // Skip if the input stream's state is unknown, open-failed or closed.
+ if (SymbolRef StreamSym = StreamVal.getAsSymbol()) {
+ const StreamState *SS = State->get<StreamMap>(StreamSym);
+ if (SS) {
+ assert(SS->isOpened() && "Stream is expected to be opened");
+ ClearErrorInNotFailed(StreamSym, SS);
+ } else
+ return;
+ }
+ } else {
+ // Clear error states for all streams.
+ const StreamMapTy &Map = StateNotFailed->get<StreamMap>();
+ for (const auto &I : Map) {
+ SymbolRef Sym = I.first;
+ const StreamState &SS = I.second;
+ if (SS.isOpened())
+ ClearErrorInNotFailed(Sym, &SS);
+ }
+ }
+
+ C.addTransition(StateNotFailed);
+ C.addTransition(StateFailed);
+}
+
ProgramStateRef
StreamChecker::ensureStreamNonNull(SVal StreamVal, const Expr *StreamE,
CheckerContext &C,
diff --git a/contrib/llvm-project/clang/lib/Support/RISCVVIntrinsicUtils.cpp b/contrib/llvm-project/clang/lib/Support/RISCVVIntrinsicUtils.cpp
index bb9f7dc7e7e3..bf47461b59e0 100644
--- a/contrib/llvm-project/clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ b/contrib/llvm-project/clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -1217,7 +1217,7 @@ raw_ostream &operator<<(raw_ostream &OS, const RVVIntrinsicRecord &Record) {
OS << (int)Record.PrototypeLength << ",";
OS << (int)Record.SuffixLength << ",";
OS << (int)Record.OverloadedSuffixSize << ",";
- OS << (int)Record.RequiredExtensions << ",";
+ OS << Record.RequiredExtensions << ",";
OS << (int)Record.TypeRangeMask << ",";
OS << (int)Record.Log2LMULMask << ",";
OS << (int)Record.NF << ",";
diff --git a/contrib/llvm-project/clang/tools/clang-repl/ClangRepl.cpp b/contrib/llvm-project/clang/tools/clang-repl/ClangRepl.cpp
index b9b287127015..5bad8145324d 100644
--- a/contrib/llvm-project/clang/tools/clang-repl/ClangRepl.cpp
+++ b/contrib/llvm-project/clang/tools/clang-repl/ClangRepl.cpp
@@ -15,6 +15,8 @@
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Interpreter/CodeCompletion.h"
#include "clang/Interpreter/Interpreter.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Sema/Sema.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/LineEditor/LineEditor.h"
@@ -123,22 +125,14 @@ ReplListCompleter::operator()(llvm::StringRef Buffer, size_t Pos,
return {};
}
-
- codeComplete(
- const_cast<clang::CompilerInstance *>((*Interp)->getCompilerInstance()),
- Buffer, Lines, Pos + 1, MainInterp.getCompilerInstance(), Results);
-
- size_t space_pos = Buffer.rfind(" ");
- llvm::StringRef Prefix;
- if (space_pos == llvm::StringRef::npos) {
- Prefix = Buffer;
- } else {
- Prefix = Buffer.substr(space_pos + 1);
- }
-
+ auto *MainCI = (*Interp)->getCompilerInstance();
+ auto CC = clang::ReplCodeCompleter();
+ CC.codeComplete(MainCI, Buffer, Lines, Pos + 1,
+ MainInterp.getCompilerInstance(), Results);
for (auto c : Results) {
- if (c.find(Prefix) == 0)
- Comps.push_back(llvm::LineEditor::Completion(c.substr(Prefix.size()), c));
+ if (c.find(CC.Prefix) == 0)
+ Comps.push_back(
+ llvm::LineEditor::Completion(c.substr(CC.Prefix.size()), c));
}
return Comps;
}
diff --git a/contrib/llvm-project/clang/utils/TableGen/NeonEmitter.cpp b/contrib/llvm-project/clang/utils/TableGen/NeonEmitter.cpp
index e5f79ba99c5c..53334016c180 100644
--- a/contrib/llvm-project/clang/utils/TableGen/NeonEmitter.cpp
+++ b/contrib/llvm-project/clang/utils/TableGen/NeonEmitter.cpp
@@ -550,6 +550,8 @@ class NeonEmitter {
void createIntrinsic(Record *R, SmallVectorImpl<Intrinsic *> &Out);
void genBuiltinsDef(raw_ostream &OS, SmallVectorImpl<Intrinsic *> &Defs);
+ void genStreamingSVECompatibleList(raw_ostream &OS,
+ SmallVectorImpl<Intrinsic *> &Defs);
void genOverloadTypeCheckCode(raw_ostream &OS,
SmallVectorImpl<Intrinsic *> &Defs);
void genIntrinsicRangeCheckCode(raw_ostream &OS,
@@ -2041,6 +2043,30 @@ void NeonEmitter::genBuiltinsDef(raw_ostream &OS,
OS << "#endif\n\n";
}
+void NeonEmitter::genStreamingSVECompatibleList(
+ raw_ostream &OS, SmallVectorImpl<Intrinsic *> &Defs) {
+ OS << "#ifdef GET_NEON_STREAMING_COMPAT_FLAG\n";
+
+ std::set<std::string> Emitted;
+ for (auto *Def : Defs) {
+ // If the def has a body (that is, it has Operation DAGs), it won't call
+ // __builtin_neon_* so we don't need to generate a definition for it.
+ if (Def->hasBody())
+ continue;
+
+ std::string Name = Def->getMangledName();
+ if (Emitted.find(Name) != Emitted.end())
+ continue;
+
+ // FIXME: We should make exceptions here for some NEON builtins that are
+ // permitted in streaming mode.
+ OS << "case NEON::BI__builtin_neon_" << Name
+ << ": BuiltinType = ArmNonStreaming; break;\n";
+ Emitted.insert(Name);
+ }
+ OS << "#endif\n\n";
+}
+
/// Generate the ARM and AArch64 overloaded type checking code for
/// SemaChecking.cpp, checking for unique builtin declarations.
void NeonEmitter::genOverloadTypeCheckCode(raw_ostream &OS,
@@ -2224,6 +2250,8 @@ void NeonEmitter::runHeader(raw_ostream &OS) {
// Generate ARM overloaded type checking code for SemaChecking.cpp
genOverloadTypeCheckCode(OS, Defs);
+ genStreamingSVECompatibleList(OS, Defs);
+
// Generate ARM range checking code for shift/lane immediates.
genIntrinsicRangeCheckCode(OS, Defs);
}
diff --git a/contrib/llvm-project/clang/utils/TableGen/RISCVVEmitter.cpp b/contrib/llvm-project/clang/utils/TableGen/RISCVVEmitter.cpp
index 1fb41805a047..da2a885ce851 100644
--- a/contrib/llvm-project/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/contrib/llvm-project/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -46,7 +46,7 @@ struct SemaRecord {
unsigned Log2LMULMask;
// Required extensions for this intrinsic.
- unsigned RequiredExtensions;
+ uint32_t RequiredExtensions;
// Prototype for this intrinsic.
SmallVector<PrototypeDescriptor> Prototype;
@@ -653,24 +653,26 @@ void RVVEmitter::createRVVIntrinsics(
SR.RequiredExtensions = 0;
for (auto RequiredFeature : RequiredFeatures) {
- RVVRequire RequireExt = StringSwitch<RVVRequire>(RequiredFeature)
- .Case("RV64", RVV_REQ_RV64)
- .Case("ZvfhminOrZvfh", RVV_REQ_ZvfhminOrZvfh)
- .Case("Xsfvcp", RVV_REQ_Xsfvcp)
- .Case("Xsfvfnrclipxfqf", RVV_REQ_Xsfvfnrclipxfqf)
- .Case("Xsfvfwmaccqqq", RVV_REQ_Xsfvfwmaccqqq)
- .Case("Xsfvqmaccdod", RVV_REQ_Xsfvqmaccdod)
- .Case("Xsfvqmaccqoq", RVV_REQ_Xsfvqmaccqoq)
- .Case("Zvbb", RVV_REQ_Zvbb)
- .Case("Zvbc", RVV_REQ_Zvbc)
- .Case("Zvkb", RVV_REQ_Zvkb)
- .Case("Zvkg", RVV_REQ_Zvkg)
- .Case("Zvkned", RVV_REQ_Zvkned)
- .Case("Zvknha", RVV_REQ_Zvknha)
- .Case("Zvknhb", RVV_REQ_Zvknhb)
- .Case("Zvksed", RVV_REQ_Zvksed)
- .Case("Zvksh", RVV_REQ_Zvksh)
- .Default(RVV_REQ_None);
+ RVVRequire RequireExt =
+ StringSwitch<RVVRequire>(RequiredFeature)
+ .Case("RV64", RVV_REQ_RV64)
+ .Case("ZvfhminOrZvfh", RVV_REQ_ZvfhminOrZvfh)
+ .Case("Xsfvcp", RVV_REQ_Xsfvcp)
+ .Case("Xsfvfnrclipxfqf", RVV_REQ_Xsfvfnrclipxfqf)
+ .Case("Xsfvfwmaccqqq", RVV_REQ_Xsfvfwmaccqqq)
+ .Case("Xsfvqmaccdod", RVV_REQ_Xsfvqmaccdod)
+ .Case("Xsfvqmaccqoq", RVV_REQ_Xsfvqmaccqoq)
+ .Case("Zvbb", RVV_REQ_Zvbb)
+ .Case("Zvbc", RVV_REQ_Zvbc)
+ .Case("Zvkb", RVV_REQ_Zvkb)
+ .Case("Zvkg", RVV_REQ_Zvkg)
+ .Case("Zvkned", RVV_REQ_Zvkned)
+ .Case("Zvknha", RVV_REQ_Zvknha)
+ .Case("Zvknhb", RVV_REQ_Zvknhb)
+ .Case("Zvksed", RVV_REQ_Zvksed)
+ .Case("Zvksh", RVV_REQ_Zvksh)
+ .Case("Experimental", RVV_REQ_Experimental)
+ .Default(RVV_REQ_None);
assert(RequireExt != RVV_REQ_None && "Unrecognized required feature?");
SR.RequiredExtensions |= RequireExt;
}
diff --git a/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp b/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp
index 9361b9950637..311c6b09dc79 100644
--- a/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp
+++ b/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp
@@ -379,9 +379,15 @@ public:
/// Emit all the information needed to map builtin -> LLVM IR intrinsic.
void createSMECodeGenMap(raw_ostream &o);
+ /// Create a table for a builtin's requirement for PSTATE.SM.
+ void createStreamingAttrs(raw_ostream &o, ACLEKind Kind);
+
/// Emit all the range checks for the immediates.
void createSMERangeChecks(raw_ostream &o);
+ /// Create a table for a builtin's requirement for PSTATE.ZA.
+ void createBuiltinZAState(raw_ostream &OS);
+
/// Create intrinsic and add it to \p Out
void createIntrinsic(Record *R,
SmallVectorImpl<std::unique_ptr<Intrinsic>> &Out);
@@ -1702,6 +1708,76 @@ void SVEEmitter::createSMERangeChecks(raw_ostream &OS) {
OS << "#endif\n\n";
}
+void SVEEmitter::createBuiltinZAState(raw_ostream &OS) {
+ std::vector<Record *> RV = Records.getAllDerivedDefinitions("Inst");
+ SmallVector<std::unique_ptr<Intrinsic>, 128> Defs;
+ for (auto *R : RV)
+ createIntrinsic(R, Defs);
+
+ std::map<bool, std::set<std::string>> DefsZAState;
+
+ uint64_t IsSharedZAFlag = getEnumValueForFlag("IsSharedZA");
+ for (auto &Def : Defs) {
+ bool HasZAState = Def->isFlagSet(IsSharedZAFlag);
+ DefsZAState[HasZAState].insert(Def->getMangledName());
+ }
+
+ OS << "#ifdef GET_SME_BUILTIN_HAS_ZA_STATE\n";
+
+ for (auto HasZA : {true, false}) {
+ auto Names = DefsZAState[HasZA];
+ for (auto Name : Names)
+ OS << "case SME::BI__builtin_sme_" << Name << ":\n";
+ OS << " return " << (HasZA ? "true" : "false") << ";\n";
+ }
+ OS << "#endif\n\n";
+}
+
+void SVEEmitter::createStreamingAttrs(raw_ostream &OS, ACLEKind Kind) {
+ std::vector<Record *> RV = Records.getAllDerivedDefinitions("Inst");
+ SmallVector<std::unique_ptr<Intrinsic>, 128> Defs;
+ for (auto *R : RV)
+ createIntrinsic(R, Defs);
+
+ StringRef ExtensionKind;
+ switch (Kind) {
+ case ACLEKind::SME:
+ ExtensionKind = "SME";
+ break;
+ case ACLEKind::SVE:
+ ExtensionKind = "SVE";
+ break;
+ }
+
+ OS << "#ifdef GET_" << ExtensionKind << "_STREAMING_ATTRS\n";
+
+ llvm::StringMap<std::set<std::string>> StreamingMap;
+
+ uint64_t IsStreamingFlag = getEnumValueForFlag("IsStreaming");
+ uint64_t IsStreamingCompatibleFlag =
+ getEnumValueForFlag("IsStreamingCompatible");
+ for (auto &Def : Defs) {
+ if (Def->isFlagSet(IsStreamingFlag))
+ StreamingMap["ArmStreaming"].insert(Def->getMangledName());
+ else if (Def->isFlagSet(IsStreamingCompatibleFlag))
+ StreamingMap["ArmStreamingCompatible"].insert(Def->getMangledName());
+ else
+ StreamingMap["ArmNonStreaming"].insert(Def->getMangledName());
+ }
+
+ for (auto BuiltinType : StreamingMap.keys()) {
+ for (auto Name : StreamingMap[BuiltinType]) {
+ OS << "case " << ExtensionKind << "::BI__builtin_"
+ << ExtensionKind.lower() << "_";
+ OS << Name << ":\n";
+ }
+ OS << " BuiltinType = " << BuiltinType << ";\n";
+ OS << " break;\n";
+ }
+
+ OS << "#endif\n\n";
+}
+
namespace clang {
void EmitSveHeader(RecordKeeper &Records, raw_ostream &OS) {
SVEEmitter(Records).createHeader(OS);
@@ -1723,6 +1799,10 @@ void EmitSveTypeFlags(RecordKeeper &Records, raw_ostream &OS) {
SVEEmitter(Records).createTypeFlags(OS);
}
+void EmitSveStreamingAttrs(RecordKeeper &Records, raw_ostream &OS) {
+ SVEEmitter(Records).createStreamingAttrs(OS, ACLEKind::SVE);
+}
+
void EmitSmeHeader(RecordKeeper &Records, raw_ostream &OS) {
SVEEmitter(Records).createSMEHeader(OS);
}
@@ -1739,4 +1819,11 @@ void EmitSmeRangeChecks(RecordKeeper &Records, raw_ostream &OS) {
SVEEmitter(Records).createSMERangeChecks(OS);
}
+void EmitSmeStreamingAttrs(RecordKeeper &Records, raw_ostream &OS) {
+ SVEEmitter(Records).createStreamingAttrs(OS, ACLEKind::SME);
+}
+
+void EmitSmeBuiltinZAState(RecordKeeper &Records, raw_ostream &OS) {
+ SVEEmitter(Records).createBuiltinZAState(OS);
+}
} // End namespace clang
diff --git a/contrib/llvm-project/clang/utils/TableGen/TableGen.cpp b/contrib/llvm-project/clang/utils/TableGen/TableGen.cpp
index 3ad46b95984e..c1f2ca15b595 100644
--- a/contrib/llvm-project/clang/utils/TableGen/TableGen.cpp
+++ b/contrib/llvm-project/clang/utils/TableGen/TableGen.cpp
@@ -86,10 +86,13 @@ enum ActionType {
GenArmSveBuiltinCG,
GenArmSveTypeFlags,
GenArmSveRangeChecks,
+ GenArmSveStreamingAttrs,
GenArmSmeHeader,
GenArmSmeBuiltins,
GenArmSmeBuiltinCG,
GenArmSmeRangeChecks,
+ GenArmSmeStreamingAttrs,
+ GenArmSmeBuiltinZAState,
GenArmCdeHeader,
GenArmCdeBuiltinDef,
GenArmCdeBuiltinSema,
@@ -246,6 +249,8 @@ cl::opt<ActionType> Action(
"Generate arm_sve_typeflags.inc for clang"),
clEnumValN(GenArmSveRangeChecks, "gen-arm-sve-sema-rangechecks",
"Generate arm_sve_sema_rangechecks.inc for clang"),
+ clEnumValN(GenArmSveStreamingAttrs, "gen-arm-sve-streaming-attrs",
+ "Generate arm_sve_streaming_attrs.inc for clang"),
clEnumValN(GenArmSmeHeader, "gen-arm-sme-header",
"Generate arm_sme.h for clang"),
clEnumValN(GenArmSmeBuiltins, "gen-arm-sme-builtins",
@@ -254,6 +259,10 @@ cl::opt<ActionType> Action(
"Generate arm_sme_builtin_cg_map.inc for clang"),
clEnumValN(GenArmSmeRangeChecks, "gen-arm-sme-sema-rangechecks",
"Generate arm_sme_sema_rangechecks.inc for clang"),
+ clEnumValN(GenArmSmeStreamingAttrs, "gen-arm-sme-streaming-attrs",
+ "Generate arm_sme_streaming_attrs.inc for clang"),
+ clEnumValN(GenArmSmeBuiltinZAState, "gen-arm-sme-builtin-za-state",
+ "Generate arm_sme_builtins_za_state.inc for clang"),
clEnumValN(GenArmMveHeader, "gen-arm-mve-header",
"Generate arm_mve.h for clang"),
clEnumValN(GenArmMveBuiltinDef, "gen-arm-mve-builtin-def",
@@ -494,6 +503,9 @@ bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
case GenArmSveRangeChecks:
EmitSveRangeChecks(Records, OS);
break;
+ case GenArmSveStreamingAttrs:
+ EmitSveStreamingAttrs(Records, OS);
+ break;
case GenArmSmeHeader:
EmitSmeHeader(Records, OS);
break;
@@ -506,6 +518,12 @@ bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
case GenArmSmeRangeChecks:
EmitSmeRangeChecks(Records, OS);
break;
+ case GenArmSmeStreamingAttrs:
+ EmitSmeStreamingAttrs(Records, OS);
+ break;
+ case GenArmSmeBuiltinZAState:
+ EmitSmeBuiltinZAState(Records, OS);
+ break;
case GenArmCdeHeader:
EmitCdeHeader(Records, OS);
break;
diff --git a/contrib/llvm-project/clang/utils/TableGen/TableGenBackends.h b/contrib/llvm-project/clang/utils/TableGen/TableGenBackends.h
index ef255612f4b8..35f2f04c1e81 100644
--- a/contrib/llvm-project/clang/utils/TableGen/TableGenBackends.h
+++ b/contrib/llvm-project/clang/utils/TableGen/TableGenBackends.h
@@ -105,11 +105,14 @@ void EmitSveBuiltins(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitSveBuiltinCG(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitSveTypeFlags(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitSveRangeChecks(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitSveStreamingAttrs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitSmeHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitSmeBuiltins(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitSmeBuiltinCG(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitSmeRangeChecks(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitSmeStreamingAttrs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitSmeBuiltinZAState(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitMveHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitMveBuiltinDef(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
diff --git a/contrib/llvm-project/compiler-rt/lib/asan/asan_posix.cpp b/contrib/llvm-project/compiler-rt/lib/asan/asan_posix.cpp
index 206551b6ef91..76564538bd5d 100644
--- a/contrib/llvm-project/compiler-rt/lib/asan/asan_posix.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/asan/asan_posix.cpp
@@ -146,30 +146,37 @@ void PlatformTSDDtor(void *tsd) {
# endif
AsanThread::TSDDtor(tsd);
}
-#endif
+# endif
+
+static void BeforeFork() {
+ if (CAN_SANITIZE_LEAKS) {
+ __lsan::LockGlobal();
+ }
+ // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and lock the
+ // stuff we need.
+ __lsan::LockThreads();
+ __lsan::LockAllocator();
+ StackDepotLockBeforeFork();
+}
+
+static void AfterFork(bool fork_child) {
+ StackDepotUnlockAfterFork(fork_child);
+ // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and unlock
+ // the stuff we need.
+ __lsan::UnlockAllocator();
+ __lsan::UnlockThreads();
+ if (CAN_SANITIZE_LEAKS) {
+ __lsan::UnlockGlobal();
+ }
+}
void InstallAtForkHandler() {
- auto before = []() {
- if (CAN_SANITIZE_LEAKS) {
- __lsan::LockGlobal();
- }
- // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and lock the
- // stuff we need.
- __lsan::LockThreads();
- __lsan::LockAllocator();
- StackDepotLockAll();
- };
- auto after = []() {
- StackDepotUnlockAll();
- // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and unlock
- // the stuff we need.
- __lsan::UnlockAllocator();
- __lsan::UnlockThreads();
- if (CAN_SANITIZE_LEAKS) {
- __lsan::UnlockGlobal();
- }
- };
- pthread_atfork(before, after, after);
+# if SANITIZER_SOLARIS || SANITIZER_NETBSD || SANITIZER_APPLE
+ return; // FIXME: Implement FutexWait.
+# endif
+ pthread_atfork(
+ &BeforeFork, []() { AfterFork(/* fork_child= */ false); },
+ []() { AfterFork(/* fork_child= */ true); });
}
void InstallAtExitCheckLeaks() {
diff --git a/contrib/llvm-project/compiler-rt/lib/asan/asan_rtl_x86_64.S b/contrib/llvm-project/compiler-rt/lib/asan/asan_rtl_x86_64.S
index 0b7363018f42..9c5289856d8a 100644
--- a/contrib/llvm-project/compiler-rt/lib/asan/asan_rtl_x86_64.S
+++ b/contrib/llvm-project/compiler-rt/lib/asan/asan_rtl_x86_64.S
@@ -27,7 +27,12 @@ FNAME(reg, op, s, i): ;\
#define ASAN_MEMORY_ACCESS_INITIAL_CHECK_ADD(reg, op, s) \
mov %##reg,%r10 ;\
shr $0x3,%r10 ;\
+ .if ASAN_SHADOW_OFFSET_CONST < 0x80000000 ;\
movsbl ASAN_SHADOW_OFFSET_CONST(%r10),%r10d ;\
+ .else ;\
+ movabsq $ASAN_SHADOW_OFFSET_CONST,%r11 ;\
+ movsbl (%r10,%r11),%r10d ;\
+ .endif ;\
test %r10d,%r10d ;\
jne CLABEL(reg, op, s, add) ;\
RLABEL(reg, op, s, add): ;\
@@ -84,7 +89,12 @@ ENDF
#define ASAN_MEMORY_ACCESS_CHECK_ADD(reg, op, s, c) \
mov %##reg,%r10 ;\
shr $0x3,%r10 ;\
+ .if ASAN_SHADOW_OFFSET_CONST < 0x80000000 ;\
##c $0x0,ASAN_SHADOW_OFFSET_CONST(%r10) ;\
+ .else ;\
+ movabsq $ASAN_SHADOW_OFFSET_CONST,%r11 ;\
+ ##c $0x0,(%r10,%r11) ;\
+ .endif ;\
jne FLABEL(reg, op, s, add) ;\
retq ;\
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c
new file mode 100644
index 000000000000..44e1cf49d1e9
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c
@@ -0,0 +1,151 @@
+//===-- cpu_model/aarch64.c - Support for __cpu_model builtin ----*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is based on LLVM's lib/Support/Host.cpp.
+// It implements __aarch64_have_lse_atomics, __aarch64_cpu_features for
+// AArch64.
+//
+//===----------------------------------------------------------------------===//
+
+#include "cpu_model.h"
+
+#if !defined(__aarch64__)
+#error This file is intended only for aarch64-based targets
+#endif
+
+#if __has_include(<sys/ifunc.h>)
+#include <sys/ifunc.h>
+#else
+typedef struct __ifunc_arg_t {
+ unsigned long _size;
+ unsigned long _hwcap;
+ unsigned long _hwcap2;
+} __ifunc_arg_t;
+#endif // __has_include(<sys/ifunc.h>)
+
+// LSE support detection for out-of-line atomics
+// using HWCAP and Auxiliary vector
+_Bool __aarch64_have_lse_atomics
+ __attribute__((visibility("hidden"), nocommon)) = false;
+
+#if defined(__FreeBSD__)
+// clang-format off: should not reorder sys/auxv.h alphabetically
+#include <sys/auxv.h>
+// clang-format on
+#include "aarch64/hwcap.inc"
+#include "aarch64/lse_atomics/freebsd.inc"
+#elif defined(__Fuchsia__)
+#include "aarch64/hwcap.inc"
+#include "aarch64/lse_atomics/fuchsia.inc"
+#elif defined(__ANDROID__)
+#include "aarch64/hwcap.inc"
+#include "aarch64/lse_atomics/android.inc"
+#elif __has_include(<sys/auxv.h>)
+#include "aarch64/hwcap.inc"
+#include "aarch64/lse_atomics/sysauxv.inc"
+#else
+// When unimplemented, we leave __aarch64_have_lse_atomics initialized to false.
+#endif
+
+#if !defined(DISABLE_AARCH64_FMV)
+// CPUFeatures must correspond to the same AArch64 features in
+// AArch64TargetParser.h
+enum CPUFeatures {
+ FEAT_RNG,
+ FEAT_FLAGM,
+ FEAT_FLAGM2,
+ FEAT_FP16FML,
+ FEAT_DOTPROD,
+ FEAT_SM4,
+ FEAT_RDM,
+ FEAT_LSE,
+ FEAT_FP,
+ FEAT_SIMD,
+ FEAT_CRC,
+ FEAT_SHA1,
+ FEAT_SHA2,
+ FEAT_SHA3,
+ FEAT_AES,
+ FEAT_PMULL,
+ FEAT_FP16,
+ FEAT_DIT,
+ FEAT_DPB,
+ FEAT_DPB2,
+ FEAT_JSCVT,
+ FEAT_FCMA,
+ FEAT_RCPC,
+ FEAT_RCPC2,
+ FEAT_FRINTTS,
+ FEAT_DGH,
+ FEAT_I8MM,
+ FEAT_BF16,
+ FEAT_EBF16,
+ FEAT_RPRES,
+ FEAT_SVE,
+ FEAT_SVE_BF16,
+ FEAT_SVE_EBF16,
+ FEAT_SVE_I8MM,
+ FEAT_SVE_F32MM,
+ FEAT_SVE_F64MM,
+ FEAT_SVE2,
+ FEAT_SVE_AES,
+ FEAT_SVE_PMULL128,
+ FEAT_SVE_BITPERM,
+ FEAT_SVE_SHA3,
+ FEAT_SVE_SM4,
+ FEAT_SME,
+ FEAT_MEMTAG,
+ FEAT_MEMTAG2,
+ FEAT_MEMTAG3,
+ FEAT_SB,
+ FEAT_PREDRES,
+ FEAT_SSBS,
+ FEAT_SSBS2,
+ FEAT_BTI,
+ FEAT_LS64,
+ FEAT_LS64_V,
+ FEAT_LS64_ACCDATA,
+ FEAT_WFXT,
+ FEAT_SME_F64,
+ FEAT_SME_I64,
+ FEAT_SME2,
+ FEAT_RCPC3,
+ FEAT_MAX,
+ FEAT_EXT = 62, // Reserved to indicate presence of additional features field
+ // in __aarch64_cpu_features
+ FEAT_INIT // Used as flag of features initialization completion
+};
+
+// Architecture features used
+// in Function Multi Versioning
+struct {
+ unsigned long long features;
+ // As features grows new fields could be added
+} __aarch64_cpu_features __attribute__((visibility("hidden"), nocommon));
+
+// The formatter wants to re-order these includes, but doing so is incorrect:
+// clang-format off
+#if defined(__APPLE__)
+#include "aarch64/fmv/apple.inc"
+#elif defined(__FreeBSD__)
+#include "aarch64/fmv/mrs.inc"
+#include "aarch64/fmv/freebsd.inc"
+#elif defined(__Fuchsia__)
+#include "aarch64/fmv/fuchsia.inc"
+#elif defined(__ANDROID__)
+#include "aarch64/fmv/mrs.inc"
+#include "aarch64/fmv/android.inc"
+#elif __has_include(<sys/auxv.h>)
+#include "aarch64/fmv/mrs.inc"
+#include "aarch64/fmv/sysauxv.inc"
+#else
+#include "aarch64/fmv/unimplemented.inc"
+#endif
+// clang-format on
+
+#endif // !defined(DISABLE_AARCH64_FMV)
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc
new file mode 100644
index 000000000000..f711431489cc
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc
@@ -0,0 +1,36 @@
+void __init_cpu_features_resolver(unsigned long hwcap,
+ const __ifunc_arg_t *arg) {
+ if (__aarch64_cpu_features.features)
+ return;
+
+ // ifunc resolvers don't have hwcaps in arguments on Android API lower
+ // than 30. If so, set feature detection done and keep all CPU features
+ // unsupported (zeros). To detect this case in runtime we check existence
+ // of memfd_create function from Standard C library which was introduced in
+ // Android API 30.
+ int memfd_create(const char *, unsigned int) __attribute__((weak));
+ if (!memfd_create)
+ return;
+
+ __init_cpu_features_constructor(hwcap, arg);
+}
+
+void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
+ // CPU features already initialized.
+ if (__aarch64_cpu_features.features)
+ return;
+
+ // Don't set any CPU features,
+ // detection could be wrong on Exynos 9810.
+ if (__isExynos9810())
+ return;
+
+ unsigned long hwcap = getauxval(AT_HWCAP);
+ unsigned long hwcap2 = getauxval(AT_HWCAP2);
+
+ __ifunc_arg_t arg;
+ arg._size = sizeof(__ifunc_arg_t);
+ arg._hwcap = hwcap;
+ arg._hwcap2 = hwcap2;
+ __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/apple.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/apple.inc
new file mode 100644
index 000000000000..79d4ac70bd1b
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/apple.inc
@@ -0,0 +1,69 @@
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX || TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#include <sys/sysctl.h>
+
+static bool isKnownAndSupported(const char *name) {
+ int32_t val = 0;
+ size_t size = sizeof(val);
+ if (sysctlbyname(name, &val, &size, NULL, 0))
+ return false;
+ return val;
+}
+
+void __init_cpu_features_resolver(void) {
+ // On Darwin platforms, this may be called concurrently by multiple threads
+ // because the resolvers that use it are called lazily at runtime (unlike on
+ // ELF platforms, where IFuncs are resolved serially at load time). This
+ // function's effect on __aarch64_cpu_features should be idempotent, but even
+ // so we need dispatch_once to resolve the race condition. Dispatch is
+ // available through libSystem, which we need anyway for the sysctl, so this
+ // does not add a new dependency.
+
+ static dispatch_once_t onceToken = 0;
+ dispatch_once(&onceToken, ^{
+ // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics
+ static struct {
+ const char *sysctl_name;
+ enum CPUFeatures feature;
+ } features[] = {
+ {"hw.optional.arm.FEAT_FlagM", FEAT_FLAGM},
+ {"hw.optional.arm.FEAT_FlagM2", FEAT_FLAGM2},
+ {"hw.optional.arm.FEAT_FHM", FEAT_FP16FML},
+ {"hw.optional.arm.FEAT_DotProd", FEAT_DOTPROD},
+ {"hw.optional.arm.FEAT_RDM", FEAT_RDM},
+ {"hw.optional.arm.FEAT_LSE", FEAT_LSE},
+ {"hw.optional.floatingpoint", FEAT_FP},
+ {"hw.optional.AdvSIMD", FEAT_SIMD},
+ {"hw.optional.armv8_crc32", FEAT_CRC},
+ {"hw.optional.arm.FEAT_SHA1", FEAT_SHA1},
+ {"hw.optional.arm.FEAT_SHA256", FEAT_SHA2},
+ {"hw.optional.arm.FEAT_SHA3", FEAT_SHA3},
+ {"hw.optional.arm.FEAT_AES", FEAT_AES},
+ {"hw.optional.arm.FEAT_PMULL", FEAT_PMULL},
+ {"hw.optional.arm.FEAT_FP16", FEAT_FP16},
+ {"hw.optional.arm.FEAT_DIT", FEAT_DIT},
+ {"hw.optional.arm.FEAT_DPB", FEAT_DPB},
+ {"hw.optional.arm.FEAT_DPB2", FEAT_DPB2},
+ {"hw.optional.arm.FEAT_JSCVT", FEAT_JSCVT},
+ {"hw.optional.arm.FEAT_FCMA", FEAT_FCMA},
+ {"hw.optional.arm.FEAT_LRCPC", FEAT_RCPC},
+ {"hw.optional.arm.FEAT_LRCPC2", FEAT_RCPC2},
+ {"hw.optional.arm.FEAT_FRINTTS", FEAT_FRINTTS},
+ {"hw.optional.arm.FEAT_I8MM", FEAT_I8MM},
+ {"hw.optional.arm.FEAT_BF16", FEAT_BF16},
+ {"hw.optional.arm.FEAT_SB", FEAT_SB},
+ {"hw.optional.arm.FEAT_SPECRES", FEAT_PREDRES},
+ {"hw.optional.arm.FEAT_SSBS", FEAT_SSBS2},
+ {"hw.optional.arm.FEAT_BTI", FEAT_BTI},
+ };
+
+ for (size_t I = 0, E = sizeof(features) / sizeof(features[0]); I != E; ++I)
+ if (isKnownAndSupported(features[I].sysctl_name))
+ __aarch64_cpu_features.features |= (1ULL << features[I].feature);
+
+ __aarch64_cpu_features.features |= (1ULL << FEAT_INIT);
+ });
+}
+
+#endif // TARGET_OS_OSX || TARGET_OS_IPHONE
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/freebsd.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/freebsd.inc
new file mode 100644
index 000000000000..793adef44b93
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/freebsd.inc
@@ -0,0 +1,27 @@
+void __init_cpu_features_resolver(unsigned long hwcap,
+ const __ifunc_arg_t *arg) {
+ if (__aarch64_cpu_features.features)
+ return;
+
+ __init_cpu_features_constructor(hwcap, arg);
+}
+
+void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
+ unsigned long hwcap = 0;
+ unsigned long hwcap2 = 0;
+ // CPU features already initialized.
+ if (__aarch64_cpu_features.features)
+ return;
+
+ int res = 0;
+ res = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
+ res |= elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
+ if (res)
+ return;
+
+ __ifunc_arg_t arg;
+ arg._size = sizeof(__ifunc_arg_t);
+ arg._hwcap = hwcap;
+ arg._hwcap2 = hwcap2;
+ __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fuchsia.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fuchsia.inc
new file mode 100644
index 000000000000..d8e0280f4041
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fuchsia.inc
@@ -0,0 +1,51 @@
+#include <zircon/features.h>
+#include <zircon/syscalls.h>
+
+void __init_cpu_features_resolver() {
+ if (__aarch64_cpu_features.features)
+ return;
+
+ // This ensures the vDSO is a direct link-time dependency of anything that
+ // needs this initializer code.
+#pragma comment(lib, "zircon")
+ uint32_t features;
+ zx_status_t status = _zx_system_get_features(ZX_FEATURE_KIND_CPU, &features);
+ if (status != ZX_OK)
+ return;
+
+#define setCPUFeature(cpu_feature) \
+ __aarch64_cpu_features.features |= 1ULL << cpu_feature
+
+ if (features & ZX_ARM64_FEATURE_ISA_FP)
+ setCPUFeature(FEAT_FP);
+ if (features & ZX_ARM64_FEATURE_ISA_ASIMD)
+ setCPUFeature(FEAT_SIMD);
+ if (features & ZX_ARM64_FEATURE_ISA_AES)
+ setCPUFeature(FEAT_AES);
+ if (features & ZX_ARM64_FEATURE_ISA_PMULL)
+ setCPUFeature(FEAT_PMULL);
+ if (features & ZX_ARM64_FEATURE_ISA_SHA1)
+ setCPUFeature(FEAT_SHA1);
+ if (features & ZX_ARM64_FEATURE_ISA_SHA256)
+ setCPUFeature(FEAT_SHA2);
+ if (features & ZX_ARM64_FEATURE_ISA_CRC32)
+ setCPUFeature(FEAT_CRC);
+ if (features & ZX_ARM64_FEATURE_ISA_RDM)
+ setCPUFeature(FEAT_RDM);
+ if (features & ZX_ARM64_FEATURE_ISA_SHA3)
+ setCPUFeature(FEAT_SHA3);
+ if (features & ZX_ARM64_FEATURE_ISA_SM4)
+ setCPUFeature(FEAT_SM4);
+ if (features & ZX_ARM64_FEATURE_ISA_DP)
+ setCPUFeature(FEAT_DOTPROD);
+ if (features & ZX_ARM64_FEATURE_ISA_FHM)
+ setCPUFeature(FEAT_FP16FML);
+ if (features & ZX_ARM64_FEATURE_ISA_SHA512)
+ setCPUFeature(FEAT_SHA3);
+ if (features & ZX_ARM64_FEATURE_ISA_I8MM)
+ setCPUFeature(FEAT_I8MM);
+ if (features & ZX_ARM64_FEATURE_ISA_SVE)
+ setCPUFeature(FEAT_SVE);
+
+ setCPUFeature(FEAT_INIT);
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc
new file mode 100644
index 000000000000..2f712f41f497
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc
@@ -0,0 +1,196 @@
+#if __has_include(<sys/auxv.h>)
+#include <sys/auxv.h>
+#define HAVE_SYS_AUXV_H
+#endif
+
+
+
+static void __init_cpu_features_constructor(unsigned long hwcap,
+ const __ifunc_arg_t *arg) {
+#define setCPUFeature(F) __aarch64_cpu_features.features |= 1ULL << F
+#define getCPUFeature(id, ftr) __asm__("mrs %0, " #id : "=r"(ftr))
+#define extractBits(val, start, number) \
+ (val & ((1ULL << number) - 1ULL) << start) >> start
+ unsigned long hwcap2 = 0;
+ if (hwcap & _IFUNC_ARG_HWCAP)
+ hwcap2 = arg->_hwcap2;
+ if (hwcap & HWCAP_CRC32)
+ setCPUFeature(FEAT_CRC);
+ if (hwcap & HWCAP_PMULL)
+ setCPUFeature(FEAT_PMULL);
+ if (hwcap & HWCAP_FLAGM)
+ setCPUFeature(FEAT_FLAGM);
+ if (hwcap2 & HWCAP2_FLAGM2) {
+ setCPUFeature(FEAT_FLAGM);
+ setCPUFeature(FEAT_FLAGM2);
+ }
+ if (hwcap & HWCAP_SM3 && hwcap & HWCAP_SM4)
+ setCPUFeature(FEAT_SM4);
+ if (hwcap & HWCAP_ASIMDDP)
+ setCPUFeature(FEAT_DOTPROD);
+ if (hwcap & HWCAP_ASIMDFHM)
+ setCPUFeature(FEAT_FP16FML);
+ if (hwcap & HWCAP_FPHP) {
+ setCPUFeature(FEAT_FP16);
+ setCPUFeature(FEAT_FP);
+ }
+ if (hwcap & HWCAP_DIT)
+ setCPUFeature(FEAT_DIT);
+ if (hwcap & HWCAP_ASIMDRDM)
+ setCPUFeature(FEAT_RDM);
+ if (hwcap & HWCAP_ILRCPC)
+ setCPUFeature(FEAT_RCPC2);
+ if (hwcap & HWCAP_AES)
+ setCPUFeature(FEAT_AES);
+ if (hwcap & HWCAP_SHA1)
+ setCPUFeature(FEAT_SHA1);
+ if (hwcap & HWCAP_SHA2)
+ setCPUFeature(FEAT_SHA2);
+ if (hwcap & HWCAP_JSCVT)
+ setCPUFeature(FEAT_JSCVT);
+ if (hwcap & HWCAP_FCMA)
+ setCPUFeature(FEAT_FCMA);
+ if (hwcap & HWCAP_SB)
+ setCPUFeature(FEAT_SB);
+ if (hwcap & HWCAP_SSBS)
+ setCPUFeature(FEAT_SSBS2);
+ if (hwcap2 & HWCAP2_MTE) {
+ setCPUFeature(FEAT_MEMTAG);
+ setCPUFeature(FEAT_MEMTAG2);
+ }
+ if (hwcap2 & HWCAP2_MTE3) {
+ setCPUFeature(FEAT_MEMTAG);
+ setCPUFeature(FEAT_MEMTAG2);
+ setCPUFeature(FEAT_MEMTAG3);
+ }
+ if (hwcap2 & HWCAP2_SVEAES)
+ setCPUFeature(FEAT_SVE_AES);
+ if (hwcap2 & HWCAP2_SVEPMULL) {
+ setCPUFeature(FEAT_SVE_AES);
+ setCPUFeature(FEAT_SVE_PMULL128);
+ }
+ if (hwcap2 & HWCAP2_SVEBITPERM)
+ setCPUFeature(FEAT_SVE_BITPERM);
+ if (hwcap2 & HWCAP2_SVESHA3)
+ setCPUFeature(FEAT_SVE_SHA3);
+ if (hwcap2 & HWCAP2_SVESM4)
+ setCPUFeature(FEAT_SVE_SM4);
+ if (hwcap2 & HWCAP2_DCPODP)
+ setCPUFeature(FEAT_DPB2);
+ if (hwcap & HWCAP_ATOMICS)
+ setCPUFeature(FEAT_LSE);
+ if (hwcap2 & HWCAP2_RNG)
+ setCPUFeature(FEAT_RNG);
+ if (hwcap2 & HWCAP2_I8MM)
+ setCPUFeature(FEAT_I8MM);
+ if (hwcap2 & HWCAP2_EBF16)
+ setCPUFeature(FEAT_EBF16);
+ if (hwcap2 & HWCAP2_SVE_EBF16)
+ setCPUFeature(FEAT_SVE_EBF16);
+ if (hwcap2 & HWCAP2_DGH)
+ setCPUFeature(FEAT_DGH);
+ if (hwcap2 & HWCAP2_FRINT)
+ setCPUFeature(FEAT_FRINTTS);
+ if (hwcap2 & HWCAP2_SVEI8MM)
+ setCPUFeature(FEAT_SVE_I8MM);
+ if (hwcap2 & HWCAP2_SVEF32MM)
+ setCPUFeature(FEAT_SVE_F32MM);
+ if (hwcap2 & HWCAP2_SVEF64MM)
+ setCPUFeature(FEAT_SVE_F64MM);
+ if (hwcap2 & HWCAP2_BTI)
+ setCPUFeature(FEAT_BTI);
+ if (hwcap2 & HWCAP2_RPRES)
+ setCPUFeature(FEAT_RPRES);
+ if (hwcap2 & HWCAP2_WFXT)
+ setCPUFeature(FEAT_WFXT);
+ if (hwcap2 & HWCAP2_SME)
+ setCPUFeature(FEAT_SME);
+ if (hwcap2 & HWCAP2_SME_I16I64)
+ setCPUFeature(FEAT_SME_I64);
+ if (hwcap2 & HWCAP2_SME_F64F64)
+ setCPUFeature(FEAT_SME_F64);
+ if (hwcap & HWCAP_CPUID) {
+ unsigned long ftr;
+ getCPUFeature(ID_AA64PFR1_EL1, ftr);
+ // ID_AA64PFR1_EL1.MTE >= 0b0001
+ if (extractBits(ftr, 8, 4) >= 0x1)
+ setCPUFeature(FEAT_MEMTAG);
+ // ID_AA64PFR1_EL1.SSBS == 0b0001
+ if (extractBits(ftr, 4, 4) == 0x1)
+ setCPUFeature(FEAT_SSBS);
+ // ID_AA64PFR1_EL1.SME == 0b0010
+ if (extractBits(ftr, 24, 4) == 0x2)
+ setCPUFeature(FEAT_SME2);
+ getCPUFeature(ID_AA64PFR0_EL1, ftr);
+ // ID_AA64PFR0_EL1.FP != 0b1111
+ if (extractBits(ftr, 16, 4) != 0xF) {
+ setCPUFeature(FEAT_FP);
+ // ID_AA64PFR0_EL1.AdvSIMD has the same value as ID_AA64PFR0_EL1.FP
+ setCPUFeature(FEAT_SIMD);
+ }
+ // ID_AA64PFR0_EL1.SVE != 0b0000
+ if (extractBits(ftr, 32, 4) != 0x0) {
+ // get ID_AA64ZFR0_EL1, that name supported
+ // if sve enabled only
+ getCPUFeature(S3_0_C0_C4_4, ftr);
+ // ID_AA64ZFR0_EL1.SVEver == 0b0000
+ if (extractBits(ftr, 0, 4) == 0x0)
+ setCPUFeature(FEAT_SVE);
+ // ID_AA64ZFR0_EL1.SVEver == 0b0001
+ if (extractBits(ftr, 0, 4) == 0x1)
+ setCPUFeature(FEAT_SVE2);
+ // ID_AA64ZFR0_EL1.BF16 != 0b0000
+ if (extractBits(ftr, 20, 4) != 0x0)
+ setCPUFeature(FEAT_SVE_BF16);
+ }
+ getCPUFeature(ID_AA64ISAR0_EL1, ftr);
+ // ID_AA64ISAR0_EL1.SHA3 != 0b0000
+ if (extractBits(ftr, 32, 4) != 0x0)
+ setCPUFeature(FEAT_SHA3);
+ getCPUFeature(ID_AA64ISAR1_EL1, ftr);
+ // ID_AA64ISAR1_EL1.DPB >= 0b0001
+ if (extractBits(ftr, 0, 4) >= 0x1)
+ setCPUFeature(FEAT_DPB);
+ // ID_AA64ISAR1_EL1.LRCPC != 0b0000
+ if (extractBits(ftr, 20, 4) != 0x0)
+ setCPUFeature(FEAT_RCPC);
+ // ID_AA64ISAR1_EL1.LRCPC == 0b0011
+ if (extractBits(ftr, 20, 4) == 0x3)
+ setCPUFeature(FEAT_RCPC3);
+ // ID_AA64ISAR1_EL1.SPECRES == 0b0001
+ if (extractBits(ftr, 40, 4) == 0x2)
+ setCPUFeature(FEAT_PREDRES);
+ // ID_AA64ISAR1_EL1.BF16 != 0b0000
+ if (extractBits(ftr, 44, 4) != 0x0)
+ setCPUFeature(FEAT_BF16);
+ // ID_AA64ISAR1_EL1.LS64 >= 0b0001
+ if (extractBits(ftr, 60, 4) >= 0x1)
+ setCPUFeature(FEAT_LS64);
+ // ID_AA64ISAR1_EL1.LS64 >= 0b0010
+ if (extractBits(ftr, 60, 4) >= 0x2)
+ setCPUFeature(FEAT_LS64_V);
+ // ID_AA64ISAR1_EL1.LS64 >= 0b0011
+ if (extractBits(ftr, 60, 4) >= 0x3)
+ setCPUFeature(FEAT_LS64_ACCDATA);
+ } else {
+ // Set some features in case of no CPUID support
+ if (hwcap & (HWCAP_FP | HWCAP_FPHP)) {
+ setCPUFeature(FEAT_FP);
+ // FP and AdvSIMD fields have the same value
+ setCPUFeature(FEAT_SIMD);
+ }
+ if (hwcap & HWCAP_DCPOP || hwcap2 & HWCAP2_DCPODP)
+ setCPUFeature(FEAT_DPB);
+ if (hwcap & HWCAP_LRCPC || hwcap & HWCAP_ILRCPC)
+ setCPUFeature(FEAT_RCPC);
+ if (hwcap2 & HWCAP2_BF16 || hwcap2 & HWCAP2_EBF16)
+ setCPUFeature(FEAT_BF16);
+ if (hwcap2 & HWCAP2_SVEBF16)
+ setCPUFeature(FEAT_SVE_BF16);
+ if (hwcap2 & HWCAP2_SVE2 && hwcap & HWCAP_SVE)
+ setCPUFeature(FEAT_SVE2);
+ if (hwcap & HWCAP_SHA3)
+ setCPUFeature(FEAT_SHA3);
+ }
+ setCPUFeature(FEAT_INIT);
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/sysauxv.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/sysauxv.inc
new file mode 100644
index 000000000000..fb5722c4306f
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/sysauxv.inc
@@ -0,0 +1,21 @@
+void __init_cpu_features_resolver(unsigned long hwcap,
+ const __ifunc_arg_t *arg) {
+ if (__aarch64_cpu_features.features)
+ return;
+ __init_cpu_features_constructor(hwcap, arg);
+}
+
+void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
+ // CPU features already initialized.
+ if (__aarch64_cpu_features.features)
+ return;
+
+ unsigned long hwcap = getauxval(AT_HWCAP);
+ unsigned long hwcap2 = getauxval(AT_HWCAP2);
+
+ __ifunc_arg_t arg;
+ arg._size = sizeof(__ifunc_arg_t);
+ arg._hwcap = hwcap;
+ arg._hwcap2 = hwcap2;
+ __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/unimplemented.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/unimplemented.inc
new file mode 100644
index 000000000000..dc34624807b7
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/unimplemented.inc
@@ -0,0 +1,8 @@
+// On platforms that have not implemented this yet, we provide an implementation
+// that does not claim support for any features by leaving
+// __aarch64_cpu_features.features initialized to 0.
+
+void __init_cpu_features_resolver(unsigned long hwcap,
+ const __ifunc_arg_t *arg) {}
+
+void __init_cpu_features(void) {}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/hwcap.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/hwcap.inc
new file mode 100644
index 000000000000..328d9c4140b9
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/hwcap.inc
@@ -0,0 +1,180 @@
+#if __has_include(<sys/hwcap.h>)
+#include <sys/hwcap.h>
+#define HAVE_SYS_HWCAP_H
+#endif
+
+#ifndef _IFUNC_ARG_HWCAP
+#define _IFUNC_ARG_HWCAP (1ULL << 62)
+#endif
+#ifndef AT_HWCAP
+#define AT_HWCAP 16
+#endif
+#ifndef HWCAP_CPUID
+#define HWCAP_CPUID (1 << 11)
+#endif
+#ifndef HWCAP_FP
+#define HWCAP_FP (1 << 0)
+#endif
+#ifndef HWCAP_ASIMD
+#define HWCAP_ASIMD (1 << 1)
+#endif
+#ifndef HWCAP_AES
+#define HWCAP_AES (1 << 3)
+#endif
+#ifndef HWCAP_PMULL
+#define HWCAP_PMULL (1 << 4)
+#endif
+#ifndef HWCAP_SHA1
+#define HWCAP_SHA1 (1 << 5)
+#endif
+#ifndef HWCAP_SHA2
+#define HWCAP_SHA2 (1 << 6)
+#endif
+#ifndef HWCAP_CRC32
+#define HWCAP_CRC32 (1 << 7)
+#endif
+#ifndef HWCAP_ATOMICS
+#define HWCAP_ATOMICS (1 << 8)
+#endif
+#ifndef HWCAP_FPHP
+#define HWCAP_FPHP (1 << 9)
+#endif
+#ifndef HWCAP_ASIMDHP
+#define HWCAP_ASIMDHP (1 << 10)
+#endif
+#ifndef HWCAP_ASIMDRDM
+#define HWCAP_ASIMDRDM (1 << 12)
+#endif
+#ifndef HWCAP_JSCVT
+#define HWCAP_JSCVT (1 << 13)
+#endif
+#ifndef HWCAP_FCMA
+#define HWCAP_FCMA (1 << 14)
+#endif
+#ifndef HWCAP_LRCPC
+#define HWCAP_LRCPC (1 << 15)
+#endif
+#ifndef HWCAP_DCPOP
+#define HWCAP_DCPOP (1 << 16)
+#endif
+#ifndef HWCAP_SHA3
+#define HWCAP_SHA3 (1 << 17)
+#endif
+#ifndef HWCAP_SM3
+#define HWCAP_SM3 (1 << 18)
+#endif
+#ifndef HWCAP_SM4
+#define HWCAP_SM4 (1 << 19)
+#endif
+#ifndef HWCAP_ASIMDDP
+#define HWCAP_ASIMDDP (1 << 20)
+#endif
+#ifndef HWCAP_SHA512
+#define HWCAP_SHA512 (1 << 21)
+#endif
+#ifndef HWCAP_SVE
+#define HWCAP_SVE (1 << 22)
+#endif
+#ifndef HWCAP_ASIMDFHM
+#define HWCAP_ASIMDFHM (1 << 23)
+#endif
+#ifndef HWCAP_DIT
+#define HWCAP_DIT (1 << 24)
+#endif
+#ifndef HWCAP_ILRCPC
+#define HWCAP_ILRCPC (1 << 26)
+#endif
+#ifndef HWCAP_FLAGM
+#define HWCAP_FLAGM (1 << 27)
+#endif
+#ifndef HWCAP_SSBS
+#define HWCAP_SSBS (1 << 28)
+#endif
+#ifndef HWCAP_SB
+#define HWCAP_SB (1 << 29)
+#endif
+
+#ifndef AT_HWCAP2
+#define AT_HWCAP2 26
+#endif
+#ifndef HWCAP2_DCPODP
+#define HWCAP2_DCPODP (1 << 0)
+#endif
+#ifndef HWCAP2_SVE2
+#define HWCAP2_SVE2 (1 << 1)
+#endif
+#ifndef HWCAP2_SVEAES
+#define HWCAP2_SVEAES (1 << 2)
+#endif
+#ifndef HWCAP2_SVEPMULL
+#define HWCAP2_SVEPMULL (1 << 3)
+#endif
+#ifndef HWCAP2_SVEBITPERM
+#define HWCAP2_SVEBITPERM (1 << 4)
+#endif
+#ifndef HWCAP2_SVESHA3
+#define HWCAP2_SVESHA3 (1 << 5)
+#endif
+#ifndef HWCAP2_SVESM4
+#define HWCAP2_SVESM4 (1 << 6)
+#endif
+#ifndef HWCAP2_FLAGM2
+#define HWCAP2_FLAGM2 (1 << 7)
+#endif
+#ifndef HWCAP2_FRINT
+#define HWCAP2_FRINT (1 << 8)
+#endif
+#ifndef HWCAP2_SVEI8MM
+#define HWCAP2_SVEI8MM (1 << 9)
+#endif
+#ifndef HWCAP2_SVEF32MM
+#define HWCAP2_SVEF32MM (1 << 10)
+#endif
+#ifndef HWCAP2_SVEF64MM
+#define HWCAP2_SVEF64MM (1 << 11)
+#endif
+#ifndef HWCAP2_SVEBF16
+#define HWCAP2_SVEBF16 (1 << 12)
+#endif
+#ifndef HWCAP2_I8MM
+#define HWCAP2_I8MM (1 << 13)
+#endif
+#ifndef HWCAP2_BF16
+#define HWCAP2_BF16 (1 << 14)
+#endif
+#ifndef HWCAP2_DGH
+#define HWCAP2_DGH (1 << 15)
+#endif
+#ifndef HWCAP2_RNG
+#define HWCAP2_RNG (1 << 16)
+#endif
+#ifndef HWCAP2_BTI
+#define HWCAP2_BTI (1 << 17)
+#endif
+#ifndef HWCAP2_MTE
+#define HWCAP2_MTE (1 << 18)
+#endif
+#ifndef HWCAP2_RPRES
+#define HWCAP2_RPRES (1 << 21)
+#endif
+#ifndef HWCAP2_MTE3
+#define HWCAP2_MTE3 (1 << 22)
+#endif
+#ifndef HWCAP2_SME
+#define HWCAP2_SME (1 << 23)
+#endif
+#ifndef HWCAP2_SME_I16I64
+#define HWCAP2_SME_I16I64 (1 << 24)
+#endif
+#ifndef HWCAP2_SME_F64F64
+#define HWCAP2_SME_F64F64 (1 << 25)
+#endif
+#ifndef HWCAP2_WFXT
+#define HWCAP2_WFXT (1UL << 31)
+#endif
+#ifndef HWCAP2_EBF16
+#define HWCAP2_EBF16 (1ULL << 32)
+#endif
+#ifndef HWCAP2_SVE_EBF16
+#define HWCAP2_SVE_EBF16 (1ULL << 33)
+#endif
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc
new file mode 100644
index 000000000000..94bf64a5b0b0
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/android.inc
@@ -0,0 +1,28 @@
+#include <string.h>
+#include <sys/auxv.h>
+#include <sys/system_properties.h>
+
+static bool __isExynos9810(void) {
+ char arch[PROP_VALUE_MAX];
+ return __system_property_get("ro.arch", arch) > 0 &&
+ strncmp(arch, "exynos9810", sizeof("exynos9810") - 1) == 0;
+}
+
+static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
+ unsigned long hwcap = getauxval(AT_HWCAP);
+ _Bool result = (hwcap & HWCAP_ATOMICS) != 0;
+ if (result) {
+ // Some cores in the Exynos 9810 CPU are ARMv8.2 and others are ARMv8.0;
+ // only the former support LSE atomics. However, the kernel in the
+ // initial Android 8.0 release of Galaxy S9/S9+ devices incorrectly
+ // reported the feature as being supported.
+ //
+ // The kernel appears to have been corrected to mark it unsupported as of
+ // the Android 9.0 release on those devices, and this issue has not been
+ // observed anywhere else. Thus, this workaround may be removed if
+ // compiler-rt ever drops support for Android 8.0.
+ if (__isExynos9810())
+ result = false;
+ }
+ __aarch64_have_lse_atomics = result;
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc
new file mode 100644
index 000000000000..4a1f9c2c27c8
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc
@@ -0,0 +1,5 @@
+static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
+ unsigned long hwcap;
+ int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
+ __aarch64_have_lse_atomics = result == 0 && (hwcap & HWCAP_ATOMICS) != 0;
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/fuchsia.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/fuchsia.inc
new file mode 100644
index 000000000000..91eac70ae6c5
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/fuchsia.inc
@@ -0,0 +1,12 @@
+#include <zircon/features.h>
+#include <zircon/syscalls.h>
+
+static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
+ // This ensures the vDSO is a direct link-time dependency of anything that
+ // needs this initializer code.
+#pragma comment(lib, "zircon")
+ uint32_t features;
+ zx_status_t status = _zx_system_get_features(ZX_FEATURE_KIND_CPU, &features);
+ __aarch64_have_lse_atomics =
+ status == ZX_OK && (features & ZX_ARM64_FEATURE_ISA_ATOMICS) != 0;
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/sysauxv.inc b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/sysauxv.inc
new file mode 100644
index 000000000000..6642c1f5b60b
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/sysauxv.inc
@@ -0,0 +1,6 @@
+#include <sys/auxv.h>
+
+static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
+ unsigned long hwcap = getauxval(AT_HWCAP);
+ __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0;
+}
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/cpu_model.h b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/cpu_model.h
new file mode 100644
index 000000000000..924ca89cf60f
--- /dev/null
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/cpu_model.h
@@ -0,0 +1,41 @@
+//===-- cpu_model_common.c - Utilities for cpu model detection ----*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements common utilities for runtime cpu model detection.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef COMPILER_RT_LIB_BUILTINS_CPU_MODEL_COMMON_H
+#define COMPILER_RT_LIB_BUILTINS_CPU_MODEL_COMMON_H
+
+#define bool int
+#define true 1
+#define false 0
+
+#ifndef __has_attribute
+#define __has_attribute(attr) 0
+#endif
+
+#if __has_attribute(constructor)
+#if __GNUC__ >= 9
+// Ordinarily init priorities below 101 are disallowed as they are reserved for
+// the implementation. However, we are the implementation, so silence the
+// diagnostic, since it doesn't apply to us.
+#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
+#endif
+// We're choosing init priority 90 to force our constructors to run before any
+// constructors in the end user application (starting at priority 101). This
+// value matches the libgcc choice for the same functions.
+#define CONSTRUCTOR_ATTRIBUTE __attribute__((constructor(90)))
+#else
+// FIXME: For MSVC, we should make a function pointer global in .CRT$X?? so that
+// this runs during initialization.
+#define CONSTRUCTOR_ATTRIBUTE
+#endif
+
+#endif
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/x86.c
index b0ec5e51e96d..c6a917715e12 100644
--- a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model/x86.c
@@ -1,4 +1,4 @@
-//===-- cpu_model.c - Support for __cpu_model builtin ------------*- C -*-===//
+//===-- cpu_model/x86.c - Support for __cpu_model builtin --------*- C -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,42 +8,21 @@
//
// This file is based on LLVM's lib/Support/Host.cpp.
// It implements the operating system Host concept and builtin
-// __cpu_model for the compiler_rt library for x86 and
-// __aarch64_have_lse_atomics, __aarch64_cpu_features for AArch64.
+// __cpu_model for the compiler_rt library for x86.
//
//===----------------------------------------------------------------------===//
-#ifndef __has_attribute
-#define __has_attribute(attr) 0
-#endif
+#include "cpu_model.h"
-#if __has_attribute(constructor)
-#if __GNUC__ >= 9
-// Ordinarily init priorities below 101 are disallowed as they are reserved for the
-// implementation. However, we are the implementation, so silence the diagnostic,
-// since it doesn't apply to us.
-#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
-#endif
-// We're choosing init priority 90 to force our constructors to run before any
-// constructors in the end user application (starting at priority 101). This value
-// matches the libgcc choice for the same functions.
-#define CONSTRUCTOR_ATTRIBUTE __attribute__((constructor(90)))
-#else
-// FIXME: For MSVC, we should make a function pointer global in .CRT$X?? so that
-// this runs during initialization.
-#define CONSTRUCTOR_ATTRIBUTE
+#if !(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || \
+ defined(_M_X64))
+#error This file is intended only for x86-based targets
#endif
-#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || \
- defined(_M_X64)) && \
- (defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER))
+#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
#include <assert.h>
-#define bool int
-#define true 1
-#define false 0
-
#ifdef _MSC_VER
#include <intrin.h>
#endif
@@ -319,12 +298,12 @@ static void detectX86FamilyModel(unsigned EAX, unsigned *Family,
}
}
-static const char *
-getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
- const unsigned *Features,
- unsigned *Type, unsigned *Subtype) {
-#define testFeature(F) \
- (Features[F / 32] & (1 << (F % 32))) != 0
+static const char *getIntelProcessorTypeAndSubtype(unsigned Family,
+ unsigned Model,
+ const unsigned *Features,
+ unsigned *Type,
+ unsigned *Subtype) {
+#define testFeature(F) (Features[F / 32] & (1 << (F % 32))) != 0
// We select CPU strings to match the code in Host.cpp, but we don't use them
// in compiler-rt.
@@ -357,7 +336,7 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
case 0x1e: // Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz.
// As found in a Summer 2010 model iMac.
case 0x1f:
- case 0x2e: // Nehalem EX
+ case 0x2e: // Nehalem EX
CPU = "nehalem";
*Type = INTEL_COREI7;
*Subtype = INTEL_COREI7_NEHALEM;
@@ -378,7 +357,7 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
*Subtype = INTEL_COREI7_SANDYBRIDGE;
break;
case 0x3a:
- case 0x3e: // Ivy Bridge EP
+ case 0x3e: // Ivy Bridge EP
CPU = "ivybridge";
*Type = INTEL_COREI7;
*Subtype = INTEL_COREI7_IVYBRIDGE;
@@ -405,12 +384,12 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
break;
// Skylake:
- case 0x4e: // Skylake mobile
- case 0x5e: // Skylake desktop
- case 0x8e: // Kaby Lake mobile
- case 0x9e: // Kaby Lake desktop
- case 0xa5: // Comet Lake-H/S
- case 0xa6: // Comet Lake-U
+ case 0x4e: // Skylake mobile
+ case 0x5e: // Skylake desktop
+ case 0x8e: // Kaby Lake mobile
+ case 0x9e: // Kaby Lake desktop
+ case 0xa5: // Comet Lake-H/S
+ case 0xa6: // Comet Lake-U
CPU = "skylake";
*Type = INTEL_COREI7;
*Subtype = INTEL_COREI7_SKYLAKE;
@@ -609,10 +588,11 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
return CPU;
}
-static const char *
-getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
- const unsigned *Features,
- unsigned *Type, unsigned *Subtype) {
+static const char *getAMDProcessorTypeAndSubtype(unsigned Family,
+ unsigned Model,
+ const unsigned *Features,
+ unsigned *Type,
+ unsigned *Subtype) {
// We select CPU strings to match the code in Host.cpp, but we don't use them
// in compiler-rt.
const char *CPU = 0;
@@ -667,37 +647,59 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
case 23:
CPU = "znver1";
*Type = AMDFAM17H;
- if ((Model >= 0x30 && Model <= 0x3f) || Model == 0x71) {
+ if ((Model >= 0x30 && Model <= 0x3f) || (Model == 0x47) ||
+ (Model >= 0x60 && Model <= 0x67) || (Model >= 0x68 && Model <= 0x6f) ||
+ (Model >= 0x70 && Model <= 0x7f) || (Model >= 0x84 && Model <= 0x87) ||
+ (Model >= 0x90 && Model <= 0x97) || (Model >= 0x98 && Model <= 0x9f) ||
+ (Model >= 0xa0 && Model <= 0xaf)) {
+ // Family 17h Models 30h-3Fh (Starship) Zen 2
+ // Family 17h Models 47h (Cardinal) Zen 2
+ // Family 17h Models 60h-67h (Renoir) Zen 2
+ // Family 17h Models 68h-6Fh (Lucienne) Zen 2
+ // Family 17h Models 70h-7Fh (Matisse) Zen 2
+ // Family 17h Models 84h-87h (ProjectX) Zen 2
+ // Family 17h Models 90h-97h (VanGogh) Zen 2
+ // Family 17h Models 98h-9Fh (Mero) Zen 2
+ // Family 17h Models A0h-AFh (Mendocino) Zen 2
CPU = "znver2";
*Subtype = AMDFAM17H_ZNVER2;
- break; // 30h-3fh, 71h: Zen2
+ break;
}
- if (Model <= 0x0f) {
+ if ((Model >= 0x10 && Model <= 0x1f) || (Model >= 0x20 && Model <= 0x2f)) {
+ // Family 17h Models 10h-1Fh (Raven1) Zen
+ // Family 17h Models 10h-1Fh (Picasso) Zen+
+ // Family 17h Models 20h-2Fh (Raven2 x86) Zen
*Subtype = AMDFAM17H_ZNVER1;
- break; // 00h-0Fh: Zen1
+ break;
}
break;
case 25:
CPU = "znver3";
*Type = AMDFAM19H;
- if (Model <= 0x0f || (Model >= 0x20 && Model <= 0x5f)) {
- // Family 19h Models 00h-0Fh - Zen3
- // Family 19h Models 20h-2Fh - Zen3
- // Family 19h Models 30h-3Fh - Zen3
- // Family 19h Models 40h-4Fh - Zen3+
- // Family 19h Models 50h-5Fh - Zen3+
+ if ((Model >= 0x00 && Model <= 0x0f) || (Model >= 0x20 && Model <= 0x2f) ||
+ (Model >= 0x30 && Model <= 0x3f) || (Model >= 0x40 && Model <= 0x4f) ||
+ (Model >= 0x50 && Model <= 0x5f)) {
+ // Family 19h Models 00h-0Fh (Genesis, Chagall) Zen 3
+ // Family 19h Models 20h-2Fh (Vermeer) Zen 3
+ // Family 19h Models 30h-3Fh (Badami) Zen 3
+ // Family 19h Models 40h-4Fh (Rembrandt) Zen 3+
+ // Family 19h Models 50h-5Fh (Cezanne) Zen 3
*Subtype = AMDFAM19H_ZNVER3;
break;
}
- if ((Model >= 0x10 && Model <= 0x1f) ||
- (Model >= 0x60 && Model <= 0x74) ||
- (Model >= 0x78 && Model <= 0x7b) ||
- (Model >= 0xA0 && Model <= 0xAf)) {
+ if ((Model >= 0x10 && Model <= 0x1f) || (Model >= 0x60 && Model <= 0x6f) ||
+ (Model >= 0x70 && Model <= 0x77) || (Model >= 0x78 && Model <= 0x7f) ||
+ (Model >= 0xa0 && Model <= 0xaf)) {
+ // Family 19h Models 10h-1Fh (Stones; Storm Peak) Zen 4
+ // Family 19h Models 60h-6Fh (Raphael) Zen 4
+ // Family 19h Models 70h-77h (Phoenix, Hawkpoint1) Zen 4
+ // Family 19h Models 78h-7Fh (Phoenix 2, Hawkpoint2) Zen 4
+ // Family 19h Models A0h-AFh (Stones-Dense) Zen 4
CPU = "znver4";
*Subtype = AMDFAM19H_ZNVER4;
break; // "znver4"
}
- break;
+ break; // family 19h
default:
break; // Unknown AMD CPU.
}
@@ -710,8 +712,7 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
unsigned EAX = 0, EBX = 0;
#define hasFeature(F) ((Features[F / 32] >> (F % 32)) & 1)
-#define setFeature(F) \
- Features[F / 32] |= 1U << (F % 32)
+#define setFeature(F) Features[F / 32] |= 1U << (F % 32)
if ((EDX >> 15) & 1)
setFeature(FEATURE_CMOV);
@@ -938,567 +939,4 @@ int CONSTRUCTOR_ATTRIBUTE __cpu_indicator_init(void) {
return 0;
}
-#elif defined(__aarch64__)
-
-// LSE support detection for out-of-line atomics
-// using HWCAP and Auxiliary vector
-_Bool __aarch64_have_lse_atomics
- __attribute__((visibility("hidden"), nocommon));
-
-#if defined(__has_include)
-#if __has_include(<sys/auxv.h>)
-#include <sys/auxv.h>
-
-#if __has_include(<sys/ifunc.h>)
-#include <sys/ifunc.h>
-#else
-typedef struct __ifunc_arg_t {
- unsigned long _size;
- unsigned long _hwcap;
- unsigned long _hwcap2;
-} __ifunc_arg_t;
-#endif // __has_include(<sys/ifunc.h>)
-
-#if __has_include(<asm/hwcap.h>)
-#include <asm/hwcap.h>
-
-#if defined(__ANDROID__)
-#include <string.h>
-#include <sys/system_properties.h>
-#elif defined(__Fuchsia__)
-#include <zircon/features.h>
-#include <zircon/syscalls.h>
-#endif
-
-#ifndef _IFUNC_ARG_HWCAP
-#define _IFUNC_ARG_HWCAP (1ULL << 62)
-#endif
-#ifndef AT_HWCAP
-#define AT_HWCAP 16
-#endif
-#ifndef HWCAP_CPUID
-#define HWCAP_CPUID (1 << 11)
-#endif
-#ifndef HWCAP_FP
-#define HWCAP_FP (1 << 0)
-#endif
-#ifndef HWCAP_ASIMD
-#define HWCAP_ASIMD (1 << 1)
-#endif
-#ifndef HWCAP_AES
-#define HWCAP_AES (1 << 3)
-#endif
-#ifndef HWCAP_PMULL
-#define HWCAP_PMULL (1 << 4)
-#endif
-#ifndef HWCAP_SHA1
-#define HWCAP_SHA1 (1 << 5)
-#endif
-#ifndef HWCAP_SHA2
-#define HWCAP_SHA2 (1 << 6)
-#endif
-#ifndef HWCAP_ATOMICS
-#define HWCAP_ATOMICS (1 << 8)
-#endif
-#ifndef HWCAP_FPHP
-#define HWCAP_FPHP (1 << 9)
-#endif
-#ifndef HWCAP_ASIMDHP
-#define HWCAP_ASIMDHP (1 << 10)
-#endif
-#ifndef HWCAP_ASIMDRDM
-#define HWCAP_ASIMDRDM (1 << 12)
-#endif
-#ifndef HWCAP_JSCVT
-#define HWCAP_JSCVT (1 << 13)
-#endif
-#ifndef HWCAP_FCMA
-#define HWCAP_FCMA (1 << 14)
-#endif
-#ifndef HWCAP_LRCPC
-#define HWCAP_LRCPC (1 << 15)
-#endif
-#ifndef HWCAP_DCPOP
-#define HWCAP_DCPOP (1 << 16)
-#endif
-#ifndef HWCAP_SHA3
-#define HWCAP_SHA3 (1 << 17)
-#endif
-#ifndef HWCAP_SM3
-#define HWCAP_SM3 (1 << 18)
-#endif
-#ifndef HWCAP_SM4
-#define HWCAP_SM4 (1 << 19)
-#endif
-#ifndef HWCAP_ASIMDDP
-#define HWCAP_ASIMDDP (1 << 20)
-#endif
-#ifndef HWCAP_SHA512
-#define HWCAP_SHA512 (1 << 21)
-#endif
-#ifndef HWCAP_SVE
-#define HWCAP_SVE (1 << 22)
-#endif
-#ifndef HWCAP_ASIMDFHM
-#define HWCAP_ASIMDFHM (1 << 23)
-#endif
-#ifndef HWCAP_DIT
-#define HWCAP_DIT (1 << 24)
-#endif
-#ifndef HWCAP_ILRCPC
-#define HWCAP_ILRCPC (1 << 26)
-#endif
-#ifndef HWCAP_FLAGM
-#define HWCAP_FLAGM (1 << 27)
-#endif
-#ifndef HWCAP_SSBS
-#define HWCAP_SSBS (1 << 28)
-#endif
-#ifndef HWCAP_SB
-#define HWCAP_SB (1 << 29)
-#endif
-
-#ifndef AT_HWCAP2
-#define AT_HWCAP2 26
-#endif
-#ifndef HWCAP2_DCPODP
-#define HWCAP2_DCPODP (1 << 0)
-#endif
-#ifndef HWCAP2_SVE2
-#define HWCAP2_SVE2 (1 << 1)
-#endif
-#ifndef HWCAP2_SVEAES
-#define HWCAP2_SVEAES (1 << 2)
-#endif
-#ifndef HWCAP2_SVEPMULL
-#define HWCAP2_SVEPMULL (1 << 3)
-#endif
-#ifndef HWCAP2_SVEBITPERM
-#define HWCAP2_SVEBITPERM (1 << 4)
-#endif
-#ifndef HWCAP2_SVESHA3
-#define HWCAP2_SVESHA3 (1 << 5)
-#endif
-#ifndef HWCAP2_SVESM4
-#define HWCAP2_SVESM4 (1 << 6)
-#endif
-#ifndef HWCAP2_FLAGM2
-#define HWCAP2_FLAGM2 (1 << 7)
-#endif
-#ifndef HWCAP2_FRINT
-#define HWCAP2_FRINT (1 << 8)
-#endif
-#ifndef HWCAP2_SVEI8MM
-#define HWCAP2_SVEI8MM (1 << 9)
-#endif
-#ifndef HWCAP2_SVEF32MM
-#define HWCAP2_SVEF32MM (1 << 10)
-#endif
-#ifndef HWCAP2_SVEF64MM
-#define HWCAP2_SVEF64MM (1 << 11)
-#endif
-#ifndef HWCAP2_SVEBF16
-#define HWCAP2_SVEBF16 (1 << 12)
-#endif
-#ifndef HWCAP2_I8MM
-#define HWCAP2_I8MM (1 << 13)
-#endif
-#ifndef HWCAP2_BF16
-#define HWCAP2_BF16 (1 << 14)
-#endif
-#ifndef HWCAP2_DGH
-#define HWCAP2_DGH (1 << 15)
-#endif
-#ifndef HWCAP2_RNG
-#define HWCAP2_RNG (1 << 16)
-#endif
-#ifndef HWCAP2_BTI
-#define HWCAP2_BTI (1 << 17)
-#endif
-#ifndef HWCAP2_MTE
-#define HWCAP2_MTE (1 << 18)
-#endif
-#ifndef HWCAP2_RPRES
-#define HWCAP2_RPRES (1 << 21)
-#endif
-#ifndef HWCAP2_MTE3
-#define HWCAP2_MTE3 (1 << 22)
-#endif
-#ifndef HWCAP2_SME
-#define HWCAP2_SME (1 << 23)
-#endif
-#ifndef HWCAP2_SME_I16I64
-#define HWCAP2_SME_I16I64 (1 << 24)
-#endif
-#ifndef HWCAP2_SME_F64F64
-#define HWCAP2_SME_F64F64 (1 << 25)
-#endif
-#ifndef HWCAP2_WFXT
-#define HWCAP2_WFXT (1UL << 31)
-#endif
-#ifndef HWCAP2_EBF16
-#define HWCAP2_EBF16 (1ULL << 32)
-#endif
-#ifndef HWCAP2_SVE_EBF16
-#define HWCAP2_SVE_EBF16 (1ULL << 33)
-#endif
-
-// Detect Exynos 9810 CPU
-#define IF_EXYNOS9810 \
- char arch[PROP_VALUE_MAX]; \
- if (__system_property_get("ro.arch", arch) > 0 && \
- strncmp(arch, "exynos9810", sizeof("exynos9810") - 1) == 0)
-
-static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
-#if defined(__FreeBSD__)
- unsigned long hwcap;
- int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
- __aarch64_have_lse_atomics = result == 0 && (hwcap & HWCAP_ATOMICS) != 0;
-#elif defined(__Fuchsia__)
- // This ensures the vDSO is a direct link-time dependency of anything that
- // needs this initializer code.
-#pragma comment(lib, "zircon")
- uint32_t features;
- zx_status_t status = _zx_system_get_features(ZX_FEATURE_KIND_CPU, &features);
- __aarch64_have_lse_atomics =
- status == ZX_OK && (features & ZX_ARM64_FEATURE_ISA_ATOMICS) != 0;
-#else
- unsigned long hwcap = getauxval(AT_HWCAP);
- _Bool result = (hwcap & HWCAP_ATOMICS) != 0;
-#if defined(__ANDROID__)
- if (result) {
- // Some cores in the Exynos 9810 CPU are ARMv8.2 and others are ARMv8.0;
- // only the former support LSE atomics. However, the kernel in the
- // initial Android 8.0 release of Galaxy S9/S9+ devices incorrectly
- // reported the feature as being supported.
- //
- // The kernel appears to have been corrected to mark it unsupported as of
- // the Android 9.0 release on those devices, and this issue has not been
- // observed anywhere else. Thus, this workaround may be removed if
- // compiler-rt ever drops support for Android 8.0.
- IF_EXYNOS9810 result = false;
- }
-#endif // defined(__ANDROID__)
- __aarch64_have_lse_atomics = result;
-#endif // defined(__FreeBSD__)
-}
-
-#if !defined(DISABLE_AARCH64_FMV)
-// CPUFeatures must correspond to the same AArch64 features in
-// AArch64TargetParser.h
-enum CPUFeatures {
- FEAT_RNG,
- FEAT_FLAGM,
- FEAT_FLAGM2,
- FEAT_FP16FML,
- FEAT_DOTPROD,
- FEAT_SM4,
- FEAT_RDM,
- FEAT_LSE,
- FEAT_FP,
- FEAT_SIMD,
- FEAT_CRC,
- FEAT_SHA1,
- FEAT_SHA2,
- FEAT_SHA3,
- FEAT_AES,
- FEAT_PMULL,
- FEAT_FP16,
- FEAT_DIT,
- FEAT_DPB,
- FEAT_DPB2,
- FEAT_JSCVT,
- FEAT_FCMA,
- FEAT_RCPC,
- FEAT_RCPC2,
- FEAT_FRINTTS,
- FEAT_DGH,
- FEAT_I8MM,
- FEAT_BF16,
- FEAT_EBF16,
- FEAT_RPRES,
- FEAT_SVE,
- FEAT_SVE_BF16,
- FEAT_SVE_EBF16,
- FEAT_SVE_I8MM,
- FEAT_SVE_F32MM,
- FEAT_SVE_F64MM,
- FEAT_SVE2,
- FEAT_SVE_AES,
- FEAT_SVE_PMULL128,
- FEAT_SVE_BITPERM,
- FEAT_SVE_SHA3,
- FEAT_SVE_SM4,
- FEAT_SME,
- FEAT_MEMTAG,
- FEAT_MEMTAG2,
- FEAT_MEMTAG3,
- FEAT_SB,
- FEAT_PREDRES,
- FEAT_SSBS,
- FEAT_SSBS2,
- FEAT_BTI,
- FEAT_LS64,
- FEAT_LS64_V,
- FEAT_LS64_ACCDATA,
- FEAT_WFXT,
- FEAT_SME_F64,
- FEAT_SME_I64,
- FEAT_SME2,
- FEAT_RCPC3,
- FEAT_MAX,
- FEAT_EXT = 62, // Reserved to indicate presence of additional features field
- // in __aarch64_cpu_features
- FEAT_INIT // Used as flag of features initialization completion
-};
-
-// Architecture features used
-// in Function Multi Versioning
-struct {
- unsigned long long features;
- // As features grows new fields could be added
-} __aarch64_cpu_features __attribute__((visibility("hidden"), nocommon));
-
-static void __init_cpu_features_constructor(unsigned long hwcap,
- const __ifunc_arg_t *arg) {
-#define setCPUFeature(F) __aarch64_cpu_features.features |= 1ULL << F
-#define getCPUFeature(id, ftr) __asm__("mrs %0, " #id : "=r"(ftr))
-#define extractBits(val, start, number) \
- (val & ((1ULL << number) - 1ULL) << start) >> start
- unsigned long hwcap2 = 0;
- if (hwcap & _IFUNC_ARG_HWCAP)
- hwcap2 = arg->_hwcap2;
- if (hwcap & HWCAP_CRC32)
- setCPUFeature(FEAT_CRC);
- if (hwcap & HWCAP_PMULL)
- setCPUFeature(FEAT_PMULL);
- if (hwcap & HWCAP_FLAGM)
- setCPUFeature(FEAT_FLAGM);
- if (hwcap2 & HWCAP2_FLAGM2) {
- setCPUFeature(FEAT_FLAGM);
- setCPUFeature(FEAT_FLAGM2);
- }
- if (hwcap & HWCAP_SM3 && hwcap & HWCAP_SM4)
- setCPUFeature(FEAT_SM4);
- if (hwcap & HWCAP_ASIMDDP)
- setCPUFeature(FEAT_DOTPROD);
- if (hwcap & HWCAP_ASIMDFHM)
- setCPUFeature(FEAT_FP16FML);
- if (hwcap & HWCAP_FPHP) {
- setCPUFeature(FEAT_FP16);
- setCPUFeature(FEAT_FP);
- }
- if (hwcap & HWCAP_DIT)
- setCPUFeature(FEAT_DIT);
- if (hwcap & HWCAP_ASIMDRDM)
- setCPUFeature(FEAT_RDM);
- if (hwcap & HWCAP_ILRCPC)
- setCPUFeature(FEAT_RCPC2);
- if (hwcap & HWCAP_AES)
- setCPUFeature(FEAT_AES);
- if (hwcap & HWCAP_SHA1)
- setCPUFeature(FEAT_SHA1);
- if (hwcap & HWCAP_SHA2)
- setCPUFeature(FEAT_SHA2);
- if (hwcap & HWCAP_JSCVT)
- setCPUFeature(FEAT_JSCVT);
- if (hwcap & HWCAP_FCMA)
- setCPUFeature(FEAT_FCMA);
- if (hwcap & HWCAP_SB)
- setCPUFeature(FEAT_SB);
- if (hwcap & HWCAP_SSBS)
- setCPUFeature(FEAT_SSBS2);
- if (hwcap2 & HWCAP2_MTE) {
- setCPUFeature(FEAT_MEMTAG);
- setCPUFeature(FEAT_MEMTAG2);
- }
- if (hwcap2 & HWCAP2_MTE3) {
- setCPUFeature(FEAT_MEMTAG);
- setCPUFeature(FEAT_MEMTAG2);
- setCPUFeature(FEAT_MEMTAG3);
- }
- if (hwcap2 & HWCAP2_SVEAES)
- setCPUFeature(FEAT_SVE_AES);
- if (hwcap2 & HWCAP2_SVEPMULL) {
- setCPUFeature(FEAT_SVE_AES);
- setCPUFeature(FEAT_SVE_PMULL128);
- }
- if (hwcap2 & HWCAP2_SVEBITPERM)
- setCPUFeature(FEAT_SVE_BITPERM);
- if (hwcap2 & HWCAP2_SVESHA3)
- setCPUFeature(FEAT_SVE_SHA3);
- if (hwcap2 & HWCAP2_SVESM4)
- setCPUFeature(FEAT_SVE_SM4);
- if (hwcap2 & HWCAP2_DCPODP)
- setCPUFeature(FEAT_DPB2);
- if (hwcap & HWCAP_ATOMICS)
- setCPUFeature(FEAT_LSE);
- if (hwcap2 & HWCAP2_RNG)
- setCPUFeature(FEAT_RNG);
- if (hwcap2 & HWCAP2_I8MM)
- setCPUFeature(FEAT_I8MM);
- if (hwcap2 & HWCAP2_EBF16)
- setCPUFeature(FEAT_EBF16);
- if (hwcap2 & HWCAP2_SVE_EBF16)
- setCPUFeature(FEAT_SVE_EBF16);
- if (hwcap2 & HWCAP2_DGH)
- setCPUFeature(FEAT_DGH);
- if (hwcap2 & HWCAP2_FRINT)
- setCPUFeature(FEAT_FRINTTS);
- if (hwcap2 & HWCAP2_SVEI8MM)
- setCPUFeature(FEAT_SVE_I8MM);
- if (hwcap2 & HWCAP2_SVEF32MM)
- setCPUFeature(FEAT_SVE_F32MM);
- if (hwcap2 & HWCAP2_SVEF64MM)
- setCPUFeature(FEAT_SVE_F64MM);
- if (hwcap2 & HWCAP2_BTI)
- setCPUFeature(FEAT_BTI);
- if (hwcap2 & HWCAP2_RPRES)
- setCPUFeature(FEAT_RPRES);
- if (hwcap2 & HWCAP2_WFXT)
- setCPUFeature(FEAT_WFXT);
- if (hwcap2 & HWCAP2_SME)
- setCPUFeature(FEAT_SME);
- if (hwcap2 & HWCAP2_SME_I16I64)
- setCPUFeature(FEAT_SME_I64);
- if (hwcap2 & HWCAP2_SME_F64F64)
- setCPUFeature(FEAT_SME_F64);
- if (hwcap & HWCAP_CPUID) {
- unsigned long ftr;
- getCPUFeature(ID_AA64PFR1_EL1, ftr);
- // ID_AA64PFR1_EL1.MTE >= 0b0001
- if (extractBits(ftr, 8, 4) >= 0x1)
- setCPUFeature(FEAT_MEMTAG);
- // ID_AA64PFR1_EL1.SSBS == 0b0001
- if (extractBits(ftr, 4, 4) == 0x1)
- setCPUFeature(FEAT_SSBS);
- // ID_AA64PFR1_EL1.SME == 0b0010
- if (extractBits(ftr, 24, 4) == 0x2)
- setCPUFeature(FEAT_SME2);
- getCPUFeature(ID_AA64PFR0_EL1, ftr);
- // ID_AA64PFR0_EL1.FP != 0b1111
- if (extractBits(ftr, 16, 4) != 0xF) {
- setCPUFeature(FEAT_FP);
- // ID_AA64PFR0_EL1.AdvSIMD has the same value as ID_AA64PFR0_EL1.FP
- setCPUFeature(FEAT_SIMD);
- }
- // ID_AA64PFR0_EL1.SVE != 0b0000
- if (extractBits(ftr, 32, 4) != 0x0) {
- // get ID_AA64ZFR0_EL1, that name supported
- // if sve enabled only
- getCPUFeature(S3_0_C0_C4_4, ftr);
- // ID_AA64ZFR0_EL1.SVEver == 0b0000
- if (extractBits(ftr, 0, 4) == 0x0)
- setCPUFeature(FEAT_SVE);
- // ID_AA64ZFR0_EL1.SVEver == 0b0001
- if (extractBits(ftr, 0, 4) == 0x1)
- setCPUFeature(FEAT_SVE2);
- // ID_AA64ZFR0_EL1.BF16 != 0b0000
- if (extractBits(ftr, 20, 4) != 0x0)
- setCPUFeature(FEAT_SVE_BF16);
- }
- getCPUFeature(ID_AA64ISAR0_EL1, ftr);
- // ID_AA64ISAR0_EL1.SHA3 != 0b0000
- if (extractBits(ftr, 32, 4) != 0x0)
- setCPUFeature(FEAT_SHA3);
- getCPUFeature(ID_AA64ISAR1_EL1, ftr);
- // ID_AA64ISAR1_EL1.DPB >= 0b0001
- if (extractBits(ftr, 0, 4) >= 0x1)
- setCPUFeature(FEAT_DPB);
- // ID_AA64ISAR1_EL1.LRCPC != 0b0000
- if (extractBits(ftr, 20, 4) != 0x0)
- setCPUFeature(FEAT_RCPC);
- // ID_AA64ISAR1_EL1.LRCPC == 0b0011
- if (extractBits(ftr, 20, 4) == 0x3)
- setCPUFeature(FEAT_RCPC3);
- // ID_AA64ISAR1_EL1.SPECRES == 0b0001
- if (extractBits(ftr, 40, 4) == 0x2)
- setCPUFeature(FEAT_PREDRES);
- // ID_AA64ISAR1_EL1.BF16 != 0b0000
- if (extractBits(ftr, 44, 4) != 0x0)
- setCPUFeature(FEAT_BF16);
- // ID_AA64ISAR1_EL1.LS64 >= 0b0001
- if (extractBits(ftr, 60, 4) >= 0x1)
- setCPUFeature(FEAT_LS64);
- // ID_AA64ISAR1_EL1.LS64 >= 0b0010
- if (extractBits(ftr, 60, 4) >= 0x2)
- setCPUFeature(FEAT_LS64_V);
- // ID_AA64ISAR1_EL1.LS64 >= 0b0011
- if (extractBits(ftr, 60, 4) >= 0x3)
- setCPUFeature(FEAT_LS64_ACCDATA);
- } else {
- // Set some features in case of no CPUID support
- if (hwcap & (HWCAP_FP | HWCAP_FPHP)) {
- setCPUFeature(FEAT_FP);
- // FP and AdvSIMD fields have the same value
- setCPUFeature(FEAT_SIMD);
- }
- if (hwcap & HWCAP_DCPOP || hwcap2 & HWCAP2_DCPODP)
- setCPUFeature(FEAT_DPB);
- if (hwcap & HWCAP_LRCPC || hwcap & HWCAP_ILRCPC)
- setCPUFeature(FEAT_RCPC);
- if (hwcap2 & HWCAP2_BF16 || hwcap2 & HWCAP2_EBF16)
- setCPUFeature(FEAT_BF16);
- if (hwcap2 & HWCAP2_SVEBF16)
- setCPUFeature(FEAT_SVE_BF16);
- if (hwcap2 & HWCAP2_SVE2 && hwcap & HWCAP_SVE)
- setCPUFeature(FEAT_SVE2);
- if (hwcap & HWCAP_SHA3)
- setCPUFeature(FEAT_SHA3);
- }
- setCPUFeature(FEAT_INIT);
-}
-
-void __init_cpu_features_resolver(unsigned long hwcap,
- const __ifunc_arg_t *arg) {
- if (__aarch64_cpu_features.features)
- return;
-#if defined(__ANDROID__)
- // ifunc resolvers don't have hwcaps in arguments on Android API lower
- // than 30. If so, set feature detection done and keep all CPU features
- // unsupported (zeros). To detect this case in runtime we check existence
- // of memfd_create function from Standard C library which was introduced in
- // Android API 30.
- int memfd_create(const char *, unsigned int) __attribute__((weak));
- if (!memfd_create)
- return;
-#endif // defined(__ANDROID__)
- __init_cpu_features_constructor(hwcap, arg);
-}
-
-void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
- unsigned long hwcap;
- unsigned long hwcap2;
- // CPU features already initialized.
- if (__aarch64_cpu_features.features)
- return;
-#if defined(__FreeBSD__)
- int res = 0;
- res = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
- res |= elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
- if (res)
- return;
-#else
-#if defined(__ANDROID__)
- // Don't set any CPU features,
- // detection could be wrong on Exynos 9810.
- IF_EXYNOS9810 return;
-#endif // defined(__ANDROID__)
- hwcap = getauxval(AT_HWCAP);
- hwcap2 = getauxval(AT_HWCAP2);
-#endif // defined(__FreeBSD__)
- __ifunc_arg_t arg;
- arg._size = sizeof(__ifunc_arg_t);
- arg._hwcap = hwcap;
- arg._hwcap2 = hwcap2;
- __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
-#undef extractBits
-#undef getCPUFeature
-#undef setCPUFeature
-#undef IF_EXYNOS9810
-}
-#endif // !defined(DISABLE_AARCH64_FMV)
-#endif // defined(__has_include)
-#endif // __has_include(<sys/auxv.h>)
-#endif // __has_include(<asm/hwcap.h>)
-#endif // defined(__aarch64__)
+#endif // defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
diff --git a/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.cpp b/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.cpp
index 9ec598bf2ce9..f95194d19f03 100644
--- a/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.cpp
@@ -19,4 +19,10 @@ static ChainedOriginDepot chainedOriginDepot;
ChainedOriginDepot* GetChainedOriginDepot() { return &chainedOriginDepot; }
+void ChainedOriginDepotLockBeforeFork() { chainedOriginDepot.LockBeforeFork(); }
+
+void ChainedOriginDepotUnlockAfterFork(bool fork_child) {
+ chainedOriginDepot.UnlockAfterFork(fork_child);
+}
+
} // namespace __dfsan
diff --git a/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.h b/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.h
index d715ef707f41..83b9e29e1b71 100644
--- a/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.h
+++ b/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_chained_origin_depot.h
@@ -21,6 +21,9 @@ namespace __dfsan {
ChainedOriginDepot* GetChainedOriginDepot();
+void ChainedOriginDepotLockBeforeFork();
+void ChainedOriginDepotUnlockAfterFork(bool fork_child);
+
} // namespace __dfsan
#endif // DFSAN_CHAINED_ORIGIN_DEPOT_H
diff --git a/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_custom.cpp b/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_custom.cpp
index 38371d353368..05b48fd0525e 100644
--- a/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_custom.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/dfsan/dfsan_custom.cpp
@@ -2893,13 +2893,13 @@ int __dfso___isoc99_sscanf(char *str, const char *format, dfsan_label str_label,
}
static void BeforeFork() {
- StackDepotLockAll();
- GetChainedOriginDepot()->LockAll();
+ StackDepotLockBeforeFork();
+ ChainedOriginDepotLockBeforeFork();
}
-static void AfterFork() {
- GetChainedOriginDepot()->UnlockAll();
- StackDepotUnlockAll();
+static void AfterFork(bool fork_child) {
+ ChainedOriginDepotUnlockAfterFork(fork_child);
+ StackDepotUnlockAfterFork(fork_child);
}
SANITIZER_INTERFACE_ATTRIBUTE
@@ -2913,7 +2913,7 @@ SANITIZER_INTERFACE_ATTRIBUTE
pid_t __dfso_fork(dfsan_label *ret_label, dfsan_origin *ret_origin) {
BeforeFork();
pid_t pid = __dfsw_fork(ret_label);
- AfterFork();
+ AfterFork(/* fork_child= */ pid == 0);
return pid;
}
diff --git a/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp b/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp
index 3271a955e7ed..e6aa60b324fa 100644
--- a/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_linux.cpp
@@ -521,28 +521,32 @@ uptr TagMemoryAligned(uptr p, uptr size, tag_t tag) {
return AddTagToPointer(p, tag);
}
+static void BeforeFork() {
+ if (CAN_SANITIZE_LEAKS) {
+ __lsan::LockGlobal();
+ }
+ // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and lock the
+ // stuff we need.
+ __lsan::LockThreads();
+ __lsan::LockAllocator();
+ StackDepotLockBeforeFork();
+}
+
+static void AfterFork(bool fork_child) {
+ StackDepotUnlockAfterFork(fork_child);
+ // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and unlock
+ // the stuff we need.
+ __lsan::UnlockAllocator();
+ __lsan::UnlockThreads();
+ if (CAN_SANITIZE_LEAKS) {
+ __lsan::UnlockGlobal();
+ }
+}
+
void HwasanInstallAtForkHandler() {
- auto before = []() {
- if (CAN_SANITIZE_LEAKS) {
- __lsan::LockGlobal();
- }
- // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and lock the
- // stuff we need.
- __lsan::LockThreads();
- __lsan::LockAllocator();
- StackDepotLockAll();
- };
- auto after = []() {
- StackDepotUnlockAll();
- // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and unlock
- // the stuff we need.
- __lsan::UnlockAllocator();
- __lsan::UnlockThreads();
- if (CAN_SANITIZE_LEAKS) {
- __lsan::UnlockGlobal();
- }
- };
- pthread_atfork(before, after, after);
+ pthread_atfork(
+ &BeforeFork, []() { AfterFork(/* fork_child= */ false); },
+ []() { AfterFork(/* fork_child= */ true); });
}
void InstallAtExitCheckLeaks() {
diff --git a/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp b/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp
index 5e8aa315801b..5b3a99adfea7 100644
--- a/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -205,6 +205,7 @@ static void PrintStackAllocations(const StackAllocationsRingBuffer *sa,
tag_t addr_tag, uptr untagged_addr) {
uptr frames = Min((uptr)flags()->stack_history_size, sa->size());
bool found_local = false;
+ InternalScopedString location;
for (uptr i = 0; i < frames; i++) {
const uptr *record_addr = &(*sa)[i];
uptr record = *record_addr;
@@ -220,24 +221,57 @@ static void PrintStackAllocations(const StackAllocationsRingBuffer *sa,
for (LocalInfo &local : frame.locals) {
if (!local.has_frame_offset || !local.has_size || !local.has_tag_offset)
continue;
+ if (!(local.name && internal_strlen(local.name)) &&
+ !(local.function_name && internal_strlen(local.name)) &&
+ !(local.decl_file && internal_strlen(local.decl_file)))
+ continue;
tag_t obj_tag = base_tag ^ local.tag_offset;
if (obj_tag != addr_tag)
continue;
- // Calculate the offset from the object address to the faulting
- // address. Because we only store bits 4-19 of FP (bits 0-3 are
- // guaranteed to be zero), the calculation is performed mod 2^20 and may
- // harmlessly underflow if the address mod 2^20 is below the object
- // address.
- uptr obj_offset =
- (untagged_addr - fp - local.frame_offset) & (kRecordFPModulus - 1);
- if (obj_offset >= local.size)
- continue;
+ // Guess top bits of local variable from the faulting address, because
+ // we only store bits 4-19 of FP (bits 0-3 are guaranteed to be zero).
+ uptr local_beg = (fp + local.frame_offset) |
+ (untagged_addr & ~(uptr(kRecordFPModulus) - 1));
+ uptr local_end = local_beg + local.size;
+
if (!found_local) {
- Printf("Potentially referenced stack objects:\n");
+ Printf("\nPotentially referenced stack objects:\n");
found_local = true;
}
- Printf(" %s in %s %s:%d\n", local.name, local.function_name,
- local.decl_file, local.decl_line);
+
+ uptr offset;
+ const char *whence;
+ const char *cause;
+ if (local_beg <= untagged_addr && untagged_addr < local_end) {
+ offset = untagged_addr - local_beg;
+ whence = "inside";
+ cause = "use-after-scope";
+ } else if (untagged_addr >= local_end) {
+ offset = untagged_addr - local_end;
+ whence = "after";
+ cause = "stack-buffer-overflow";
+ } else {
+ offset = local_beg - untagged_addr;
+ whence = "before";
+ cause = "stack-buffer-overflow";
+ }
+ Decorator d;
+ Printf("%s", d.Error());
+ Printf("Cause: %s\n", cause);
+ Printf("%s", d.Default());
+ Printf("%s", d.Location());
+ Printf("%p is located %zd bytes %s a %zd-byte region [%p,%p)\n",
+ untagged_addr, offset, whence, local_end - local_beg, local_beg,
+ local_end);
+ Printf("%s", d.Allocation());
+ StackTracePrinter::GetOrInit()->RenderSourceLocation(
+ &location, local.decl_file, local.decl_line, /* column= */ 0,
+ common_flags()->symbolize_vs_style,
+ common_flags()->strip_path_prefix);
+ Printf(" %s in %s %s\n", local.name, local.function_name,
+ location.data());
+ location.clear();
+ Printf("%s\n", d.Default());
}
frame.Clear();
}
@@ -363,7 +397,7 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag,
InternalScopedString s;
addr = MemToShadow(addr);
s.AppendF(
- "Memory tags around the buggy address (one tag corresponds to %zd "
+ "\nMemory tags around the buggy address (one tag corresponds to %zd "
"bytes):\n",
kShadowAlignment);
PrintTagInfoAroundAddr(addr, kShadowLines, s,
@@ -745,8 +779,6 @@ void BaseReport::PrintAddressDescription() const {
// Check stack first. If the address is on the stack of a live thread, we
// know it cannot be a heap / global overflow.
for (const auto &sa : allocations.stack) {
- // TODO(fmayer): figure out how to distinguish use-after-return and
- // stack-buffer-overflow.
Printf("%s", d.Error());
Printf("\nCause: stack tag-mismatch\n");
Printf("%s", d.Location());
@@ -803,8 +835,10 @@ void BaseReport::PrintAddressDescription() const {
}
// Print the remaining threads, as an extra information, 1 line per thread.
- if (flags()->print_live_threads_info)
+ if (flags()->print_live_threads_info) {
+ Printf("\n");
hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
+ }
if (!num_descriptions_printed)
// We exhausted our possibilities. Bail out.
@@ -1020,7 +1054,7 @@ void ReportTagMismatch(StackTrace *stack, uptr tagged_addr, uptr access_size,
// See the frame breakdown defined in __hwasan_tag_mismatch (from
// hwasan_tag_mismatch_{aarch64,riscv64}.S).
void ReportRegisters(const uptr *frame, uptr pc) {
- Printf("Registers where the failure occurred (pc %p):\n", pc);
+ Printf("\nRegisters where the failure occurred (pc %p):\n", pc);
// We explicitly print a single line (4 registers/line) each iteration to
// reduce the amount of logcat error messages printed. Each Printf() will
diff --git a/contrib/llvm-project/compiler-rt/lib/lsan/lsan_posix.cpp b/contrib/llvm-project/compiler-rt/lib/lsan/lsan_posix.cpp
index 3677f0141a2f..422c29acca69 100644
--- a/contrib/llvm-project/compiler-rt/lib/lsan/lsan_posix.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/lsan/lsan_posix.cpp
@@ -100,20 +100,27 @@ void InstallAtExitCheckLeaks() {
Atexit(DoLeakCheck);
}
+static void BeforeFork() {
+ LockGlobal();
+ LockThreads();
+ LockAllocator();
+ StackDepotLockBeforeFork();
+}
+
+static void AfterFork(bool fork_child) {
+ StackDepotUnlockAfterFork(fork_child);
+ UnlockAllocator();
+ UnlockThreads();
+ UnlockGlobal();
+}
+
void InstallAtForkHandler() {
- auto before = []() {
- LockGlobal();
- LockThreads();
- LockAllocator();
- StackDepotLockAll();
- };
- auto after = []() {
- StackDepotUnlockAll();
- UnlockAllocator();
- UnlockThreads();
- UnlockGlobal();
- };
- pthread_atfork(before, after, after);
+# if SANITIZER_SOLARIS || SANITIZER_NETBSD || SANITIZER_APPLE
+ return; // FIXME: Implement FutexWait.
+# endif
+ pthread_atfork(
+ &BeforeFork, []() { AfterFork(/* fork_child= */ false); },
+ []() { AfterFork(/* fork_child= */ true); });
}
} // namespace __lsan
diff --git a/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.cpp b/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.cpp
index 49b14131a89b..b98b0e6b14b5 100644
--- a/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.cpp
@@ -31,12 +31,10 @@ u32 ChainedOriginDepotGet(u32 id, u32 *other) {
return chainedOriginDepot.Get(id, other);
}
-void ChainedOriginDepotLockAll() {
- chainedOriginDepot.LockAll();
-}
+void ChainedOriginDepotBeforeFork() { chainedOriginDepot.LockBeforeFork(); }
-void ChainedOriginDepotUnlockAll() {
- chainedOriginDepot.UnlockAll();
+void ChainedOriginDepotAfterFork(bool fork_child) {
+ chainedOriginDepot.UnlockAfterFork(fork_child);
}
} // namespace __msan
diff --git a/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.h b/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.h
index ea51c77a905b..7518745dc852 100644
--- a/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.h
+++ b/contrib/llvm-project/compiler-rt/lib/msan/msan_chained_origin_depot.h
@@ -30,8 +30,8 @@ bool ChainedOriginDepotPut(u32 here_id, u32 prev_id, u32 *new_id);
// Retrieves the stored StackDepot ID for the given origin ID.
u32 ChainedOriginDepotGet(u32 id, u32 *other);
-void ChainedOriginDepotLockAll();
-void ChainedOriginDepotUnlockAll();
+void ChainedOriginDepotBeforeFork();
+void ChainedOriginDepotAfterFork(bool fork_child);
} // namespace __msan
diff --git a/contrib/llvm-project/compiler-rt/lib/msan/msan_linux.cpp b/contrib/llvm-project/compiler-rt/lib/msan/msan_linux.cpp
index 04af6f4b27ac..c7ecb7cad566 100644
--- a/contrib/llvm-project/compiler-rt/lib/msan/msan_linux.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/msan/msan_linux.cpp
@@ -256,22 +256,26 @@ void MsanTSDDtor(void *tsd) {
atomic_signal_fence(memory_order_seq_cst);
MsanThread::TSDDtor(tsd);
}
-#endif
+# endif
+
+static void BeforeFork() {
+ // Usually we lock ThreadRegistry, but msan does not have one.
+ LockAllocator();
+ StackDepotLockBeforeFork();
+ ChainedOriginDepotBeforeFork();
+}
+
+static void AfterFork(bool fork_child) {
+ ChainedOriginDepotAfterFork(fork_child);
+ StackDepotUnlockAfterFork(fork_child);
+ UnlockAllocator();
+ // Usually we unlock ThreadRegistry, but msan does not have one.
+}
void InstallAtForkHandler() {
- auto before = []() {
- // Usually we lock ThreadRegistry, but msan does not have one.
- LockAllocator();
- StackDepotLockAll();
- ChainedOriginDepotLockAll();
- };
- auto after = []() {
- ChainedOriginDepotUnlockAll();
- StackDepotUnlockAll();
- UnlockAllocator();
- // Usually we unlock ThreadRegistry, but msan does not have one.
- };
- pthread_atfork(before, after, after);
+ pthread_atfork(
+ &BeforeFork, []() { AfterFork(/* fork_child= */ false); },
+ []() { AfterFork(/* fork_child= */ true); });
}
} // namespace __msan
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp b/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
index e3a1cdf3c4fc..340846f5f900 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
@@ -825,6 +825,10 @@ void *MachOPlatformRuntimeState::dlsym(void *DSOHandle, const char *Symbol) {
return nullptr;
}
+ // Sign callable symbols as functions, to match dyld.
+ if ((Result.second & MachOExecutorSymbolFlags::Callable) ==
+ MachOExecutorSymbolFlags::Callable)
+ return reinterpret_cast<void *>(Result.first.toPtr<void(void)>());
return Result.first.toPtr<void *>();
}
diff --git a/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c b/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
index 9070b8a606eb..c976776ae59e 100644
--- a/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
+++ b/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
@@ -74,7 +74,17 @@ ValueProfNode *__llvm_profile_end_vnodes(void) { return &VNodesEnd; }
ValueProfNode *CurrentVNode = &VNodesStart + 1;
ValueProfNode *EndVNode = &VNodesEnd;
+/* lld-link provides __buildid symbol which ponits to the 16 bytes build id when
+ * using /build-id flag. https://lld.llvm.org/windows_support.html#lld-flags */
+#define BUILD_ID_LEN 16
+COMPILER_RT_WEAK extern uint8_t __buildid[BUILD_ID_LEN];
COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) {
+ if (*__buildid) {
+ if (Writer &&
+ lprofWriteOneBinaryId(Writer, BUILD_ID_LEN, __buildid, 0) == -1)
+ return -1;
+ return sizeof(uint64_t) + BUILD_ID_LEN;
+ }
return 0;
}
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp
index e0e2bd01069f..df2b2eb23df2 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp
@@ -139,9 +139,11 @@ u32 ChainedOriginDepot::Get(u32 id, u32 *other) {
return desc.here_id;
}
-void ChainedOriginDepot::LockAll() { depot.LockAll(); }
+void ChainedOriginDepot::LockBeforeFork() { depot.LockBeforeFork(); }
-void ChainedOriginDepot::UnlockAll() { depot.UnlockAll(); }
+void ChainedOriginDepot::UnlockAfterFork(bool fork_child) {
+ depot.UnlockAfterFork(fork_child);
+}
void ChainedOriginDepot::TestOnlyUnmap() { depot.TestOnlyUnmap(); }
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h
index f9f192b68571..f3da28129e6b 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h
@@ -32,8 +32,8 @@ class ChainedOriginDepot {
// Retrieves the stored StackDepot ID for the given origin ID.
u32 Get(u32 id, u32 *other);
- void LockAll();
- void UnlockAll();
+ void LockBeforeFork();
+ void UnlockAfterFork(bool fork_child);
void TestOnlyUnmap();
private:
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp
index 148470943b47..c11df0ddfde4 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp
@@ -44,6 +44,9 @@ StackStore::Id StackStore::Store(const StackTrace &trace, uptr *pack) {
uptr idx = 0;
*pack = 0;
uptr *stack_trace = Alloc(h.size + 1, &idx, pack);
+ // No more space.
+ if (stack_trace == nullptr)
+ return 0;
*stack_trace = h.ToUptr();
internal_memcpy(stack_trace + 1, trace.trace, h.size * sizeof(uptr));
*pack += blocks_[GetBlockIdx(idx)].Stored(h.size + 1);
@@ -76,8 +79,10 @@ uptr *StackStore::Alloc(uptr count, uptr *idx, uptr *pack) {
uptr block_idx = GetBlockIdx(start);
uptr last_idx = GetBlockIdx(start + count - 1);
if (LIKELY(block_idx == last_idx)) {
- // Fits into the a single block.
- CHECK_LT(block_idx, ARRAY_SIZE(blocks_));
+ // Fits into a single block.
+ // No more available blocks. Indicate inability to allocate more memory.
+ if (block_idx >= ARRAY_SIZE(blocks_))
+ return nullptr;
*idx = start;
return blocks_[block_idx].GetOrCreate(this) + GetInBlockIdx(start);
}
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
index a746d4621936..3776e8c97057 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
@@ -215,16 +215,16 @@ StackTrace StackDepotGet(u32 id) {
return theDepot.Get(id);
}
-void StackDepotLockAll() {
- theDepot.LockAll();
+void StackDepotLockBeforeFork() {
+ theDepot.LockBeforeFork();
compress_thread.LockAndStop();
stackStore.LockAll();
}
-void StackDepotUnlockAll() {
+void StackDepotUnlockAfterFork(bool fork_child) {
stackStore.UnlockAll();
compress_thread.Unlock();
- theDepot.UnlockAll();
+ theDepot.UnlockAfterFork(fork_child);
}
void StackDepotPrintAll() {
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h
index cca6fd534688..82cf7578d0fb 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h
@@ -39,8 +39,8 @@ StackDepotHandle StackDepotPut_WithHandle(StackTrace stack);
// Retrieves a stored stack trace by the id.
StackTrace StackDepotGet(u32 id);
-void StackDepotLockAll();
-void StackDepotUnlockAll();
+void StackDepotLockBeforeFork();
+void StackDepotUnlockAfterFork(bool fork_child);
void StackDepotPrintAll();
void StackDepotStopBackgroundThread();
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
index 96d1ddc87fd0..21d57d9ab2a9 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
@@ -52,8 +52,8 @@ class StackDepotBase {
};
}
- void LockAll();
- void UnlockAll();
+ void LockBeforeFork();
+ void UnlockAfterFork(bool fork_child);
void PrintAll();
void TestOnlyUnmap() {
@@ -160,14 +160,15 @@ StackDepotBase<Node, kReservedBits, kTabSizeLog>::Get(u32 id) {
}
template <class Node, int kReservedBits, int kTabSizeLog>
-void StackDepotBase<Node, kReservedBits, kTabSizeLog>::LockAll() {
+void StackDepotBase<Node, kReservedBits, kTabSizeLog>::LockBeforeFork() {
for (int i = 0; i < kTabSize; ++i) {
lock(&tab[i]);
}
}
template <class Node, int kReservedBits, int kTabSizeLog>
-void StackDepotBase<Node, kReservedBits, kTabSizeLog>::UnlockAll() {
+void StackDepotBase<Node, kReservedBits, kTabSizeLog>::UnlockAfterFork(
+ bool fork_child) {
for (int i = 0; i < kTabSize; ++i) {
atomic_uint32_t *p = &tab[i];
uptr s = atomic_load(p, memory_order_relaxed);
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp
index f3818526baab..9c8c4bf9d1a4 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp
@@ -138,7 +138,10 @@ void SuppressionContext::Parse(const char *str) {
}
}
if (type == suppression_types_num_) {
- Printf("%s: failed to parse suppressions\n", SanitizerToolName);
+ Printf("%s: failed to parse suppressions.\n", SanitizerToolName);
+ Printf("Supported suppression types are:\n");
+ for (type = 0; type < suppression_types_num_; type++)
+ Printf("- %s\n", suppression_types_[type]);
Die();
}
Suppression s;
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
index 28f11352a6b5..0ddc24802d21 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
@@ -341,15 +341,14 @@ __sanitizer_symbolize_set_inline_frames(bool InlineFrames);
class InternalSymbolizer final : public SymbolizerTool {
public:
static InternalSymbolizer *get(LowLevelAllocator *alloc) {
- if (&__sanitizer_symbolize_set_demangle)
- CHECK(__sanitizer_symbolize_set_demangle(common_flags()->demangle));
- if (&__sanitizer_symbolize_set_inline_frames)
- CHECK(__sanitizer_symbolize_set_inline_frames(
- common_flags()->symbolize_inline_frames));
- // These are essential, we don't have InternalSymbolizer without them.
- if (&__sanitizer_symbolize_code && &__sanitizer_symbolize_data)
- return new (*alloc) InternalSymbolizer();
- return 0;
+ // These one is the most used one, so we will use it to detect a presence of
+ // internal symbolizer.
+ if (&__sanitizer_symbolize_code == nullptr)
+ return nullptr;
+ CHECK(__sanitizer_symbolize_set_demangle(common_flags()->demangle));
+ CHECK(__sanitizer_symbolize_set_inline_frames(
+ common_flags()->symbolize_inline_frames));
+ return new (*alloc) InternalSymbolizer();
}
bool SymbolizePC(uptr addr, SymbolizedStack *stack) override {
@@ -371,8 +370,6 @@ class InternalSymbolizer final : public SymbolizerTool {
}
bool SymbolizeFrame(uptr addr, FrameInfo *info) override {
- if (&__sanitizer_symbolize_frame == nullptr)
- return false;
bool result = __sanitizer_symbolize_frame(info->module, info->module_offset,
buffer_, sizeof(buffer_));
if (result)
@@ -380,14 +377,10 @@ class InternalSymbolizer final : public SymbolizerTool {
return result;
}
- void Flush() override {
- if (&__sanitizer_symbolize_flush)
- __sanitizer_symbolize_flush();
- }
+ void Flush() override { __sanitizer_symbolize_flush(); }
const char *Demangle(const char *name) override {
- if (&__sanitizer_symbolize_demangle &&
- __sanitizer_symbolize_demangle(name, buffer_, sizeof(buffer_))) {
+ if (__sanitizer_symbolize_demangle(name, buffer_, sizeof(buffer_))) {
char *res_buff = nullptr;
ExtractToken(buffer_, "", &res_buff);
return res_buff;
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
index 4bdf75332bf3..c851dbbf2eb2 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
@@ -71,7 +71,7 @@ bool __sanitizer_symbolize_code(const char *ModuleName, uint64_t ModuleOffset,
auto Printer = std::make_unique<llvm::symbolize::LLVMPrinter>(
OS, symbolize_error_handler(OS), Config);
- // TODO: it is neccessary to set proper SectionIndex here.
+ // TODO: it is necessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
if (InlineFrames) {
auto ResOrErr = getDefaultSymbolizer()->symbolizeInlinedCode(
@@ -103,7 +103,7 @@ bool __sanitizer_symbolize_data(const char *ModuleName, uint64_t ModuleOffset,
auto Printer = std::make_unique<llvm::symbolize::LLVMPrinter>(
OS, symbolize_error_handler(OS), Config);
- // TODO: it is neccessary to set proper SectionIndex here.
+ // TODO: it is necessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
auto ResOrErr = getDefaultSymbolizer()->symbolizeData(
ModuleName,
@@ -126,7 +126,7 @@ bool __sanitizer_symbolize_frame(const char *ModuleName, uint64_t ModuleOffset,
auto Printer = std::make_unique<llvm::symbolize::LLVMPrinter>(
OS, symbolize_error_handler(OS), Config);
- // TODO: it is neccessary to set proper SectionIndex here.
+ // TODO: it is necessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
auto ResOrErr = getDefaultSymbolizer()->symbolizeFrame(
ModuleName,
diff --git a/contrib/llvm-project/compiler-rt/lib/scudo/standalone/combined.h b/contrib/llvm-project/compiler-rt/lib/scudo/standalone/combined.h
index 65ddc488370a..4624f83d142a 100644
--- a/contrib/llvm-project/compiler-rt/lib/scudo/standalone/combined.h
+++ b/contrib/llvm-project/compiler-rt/lib/scudo/standalone/combined.h
@@ -939,19 +939,6 @@ public:
return RingBufferElements ? ringBufferSizeInBytes(RingBufferElements) : 0;
}
- static bool setRingBufferSizeForBuffer(char *Buffer, size_t Size) {
- // Need at least one entry.
- if (Size < sizeof(AllocationRingBuffer) +
- sizeof(typename AllocationRingBuffer::Entry)) {
- return false;
- }
- AllocationRingBuffer *RingBuffer =
- reinterpret_cast<AllocationRingBuffer *>(Buffer);
- RingBuffer->Size = (Size - sizeof(AllocationRingBuffer)) /
- sizeof(typename AllocationRingBuffer::Entry);
- return true;
- }
-
static const uptr MaxTraceSize = 64;
static void collectTraceMaybe(const StackDepot *Depot,
diff --git a/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 80f86ca98ed9..a9f6673ac44e 100644
--- a/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -1380,6 +1380,22 @@ TSAN_INTERCEPTOR(int, pthread_mutex_unlock, void *m) {
return res;
}
+#if SANITIZER_LINUX
+TSAN_INTERCEPTOR(int, pthread_mutex_clocklock, void *m,
+ __sanitizer_clockid_t clock, void *abstime) {
+ SCOPED_TSAN_INTERCEPTOR(pthread_mutex_clocklock, m, clock, abstime);
+ MutexPreLock(thr, pc, (uptr)m);
+ int res = REAL(pthread_mutex_clocklock)(m, clock, abstime);
+ if (res == errno_EOWNERDEAD)
+ MutexRepair(thr, pc, (uptr)m);
+ if (res == 0 || res == errno_EOWNERDEAD)
+ MutexPostLock(thr, pc, (uptr)m);
+ if (res == errno_EINVAL)
+ MutexInvalidAccess(thr, pc, (uptr)m);
+ return res;
+}
+#endif
+
#if SANITIZER_GLIBC
# if !__GLIBC_PREREQ(2, 34)
// glibc 2.34 applies a non-default version for the two functions. They are no
@@ -2902,6 +2918,9 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(pthread_mutex_trylock);
TSAN_INTERCEPT(pthread_mutex_timedlock);
TSAN_INTERCEPT(pthread_mutex_unlock);
+#if SANITIZER_LINUX
+ TSAN_INTERCEPT(pthread_mutex_clocklock);
+#endif
#if SANITIZER_GLIBC
# if !__GLIBC_PREREQ(2, 34)
TSAN_INTERCEPT(__pthread_mutex_lock);
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h b/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h
index 5a1d49f5f43e..7a77d7b5447b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/binary_search.h
@@ -22,22 +22,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
-{
- __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
- return __first != __last && !__comp(__value, *__first);
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
+ __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
+ return __first != __last && !__comp(__value, *__first);
}
template <class _ForwardIterator, class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
-{
- return std::binary_search(__first, __last, __value, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+ return std::binary_search(__first, __last, __value, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h b/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
index 2797e9da6658..15f4a535a30b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
@@ -20,52 +20,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare>
-struct __debug_less
-{
- _Compare &__comp_;
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
+struct __debug_less {
+ _Compare& __comp_;
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
- template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Up& __y)
- {
- bool __r = __comp_(__x, __y);
- if (__r)
- __do_compare_assert(0, __y, __x);
- return __r;
- }
+ template <class _Tp, class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Up& __y) {
+ bool __r = __comp_(__x, __y);
+ if (__r)
+ __do_compare_assert(0, __y, __x);
+ return __r;
+ }
- template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(_Tp& __x, _Up& __y)
- {
- bool __r = __comp_(__x, __y);
- if (__r)
- __do_compare_assert(0, __y, __x);
- return __r;
- }
+ template <class _Tp, class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(_Tp& __x, _Up& __y) {
+ bool __r = __comp_(__x, __y);
+ if (__r)
+ __do_compare_assert(0, __y, __x);
+ return __r;
+ }
- template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- inline _LIBCPP_HIDE_FROM_ABI
- decltype((void)std::declval<_Compare&>()(
- std::declval<_LHS &>(), std::declval<_RHS &>()))
- __do_compare_assert(int, _LHS & __l, _RHS & __r) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r),
- "Comparator does not induce a strict weak ordering");
- (void)__l;
- (void)__r;
- }
+ template <class _LHS, class _RHS>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(
+ std::declval<_LHS&>(), std::declval<_RHS&>()))
+ __do_compare_assert(int, _LHS& __l, _RHS& __r) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
+ (void)__l;
+ (void)__r;
+ }
- template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- inline _LIBCPP_HIDE_FROM_ABI
- void __do_compare_assert(long, _LHS &, _RHS &) {}
+ template <class _LHS, class _RHS>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {}
};
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
-# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
+#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __comp_ref_type = __debug_less<_Comp>;
#else
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h
index d85d297b3226..3ec88d8bd5cc 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_backward.h
@@ -108,8 +108,7 @@ struct __copy_backward_loop {
struct __copy_backward_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
- template <class _In, class _Out,
- __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
+ template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_backward_trivial_impl(__first, __last, __result);
@@ -124,16 +123,13 @@ __copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _Bidirectiona
}
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_BidirectionalIterator2
-copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
- _BidirectionalIterator2 __result)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2
+copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
- std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
+ std::is_copy_constructible<_BidirectionalIterator1>::value,
+ "Iterators must be copy constructible.");
- return std::__copy_backward<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), std::move(__result)).second;
+ return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h
index d68d1dbbadf8..228e4d22323e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_if.h
@@ -17,21 +17,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _InputIterator, class _OutputIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-copy_if(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- {
- if (__pred(*__first))
- {
- *__result = *__first;
- ++__result;
- }
+template <class _InputIterator, class _OutputIterator, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
+ for (; __first != __last; ++__first) {
+ if (__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h
index c06892e9e3c7..b350507e32ba 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h
@@ -38,22 +38,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _From, class _To>
struct __can_lower_copy_assignment_to_memmove {
static const bool value =
- // If the types are always bitcastable, it's valid to do a bitwise copy between them.
- __is_always_bitcastable<_From, _To>::value &&
- // Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
- is_trivially_assignable<_To&, const _From&>::value &&
- // `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
- !is_volatile<_From>::value &&
- !is_volatile<_To>::value;
+ // If the types are always bitcastable, it's valid to do a bitwise copy between them.
+ __is_always_bitcastable<_From, _To>::value &&
+ // Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
+ is_trivially_assignable<_To&, const _From&>::value &&
+ // `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
+ !is_volatile<_From>::value && !is_volatile<_To>::value;
};
template <class _From, class _To>
struct __can_lower_move_assignment_to_memmove {
static const bool value =
- __is_always_bitcastable<_From, _To>::value &&
- is_trivially_assignable<_To&, _From&&>::value &&
- !is_volatile<_From>::value &&
- !is_volatile<_To>::value;
+ __is_always_bitcastable<_From, _To>::value && is_trivially_assignable<_To&, _From&&>::value &&
+ !is_volatile<_From>::value && !is_volatile<_To>::value;
};
// `memmove` algorithms implementation.
@@ -95,8 +92,8 @@ struct __can_rewrap<_InIter,
_Sent,
_OutIter,
// Note that sentinels are always copy-constructible.
- __enable_if_t< is_copy_constructible<_InIter>::value &&
- is_copy_constructible<_OutIter>::value > > : true_type {};
+ __enable_if_t< is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value > >
+ : true_type {};
template <class _Algorithm,
class _InIter,
@@ -108,7 +105,7 @@ __unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
auto __range = std::__unwrap_range(__first, std::move(__last));
auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)),
- std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
+ std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
}
template <class _Algorithm,
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h
index 1707e26688c6..f93f39203a7e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_n.h
@@ -21,39 +21,38 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _InputIterator, class _Size, class _OutputIterator,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value &&
- !__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
-{
- typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
- _IntegralSize __n = __orig_n;
- if (__n > 0)
- {
- *__result = *__first;
- ++__result;
- for (--__n; __n > 0; --__n)
- {
- ++__first;
- *__result = *__first;
- ++__result;
- }
+template <class _InputIterator,
+ class _Size,
+ class _OutputIterator,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value &&
+ !__has_random_access_iterator_category<_InputIterator>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
+ typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
+ _IntegralSize __n = __orig_n;
+ if (__n > 0) {
+ *__result = *__first;
+ ++__result;
+ for (--__n; __n > 0; --__n) {
+ ++__first;
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
-template<class _InputIterator, class _Size, class _OutputIterator,
- __enable_if_t<__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
-{
- typedef typename iterator_traits<_InputIterator>::difference_type difference_type;
- typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
- _IntegralSize __n = __orig_n;
- return std::copy(__first, __first + difference_type(__n), __result);
+template <class _InputIterator,
+ class _Size,
+ class _OutputIterator,
+ __enable_if_t<__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
+ typedef typename iterator_traits<_InputIterator>::difference_type difference_type;
+ typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
+ _IntegralSize __n = __orig_n;
+ return std::copy(__first, __first + difference_type(__n), __result);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/equal.h b/contrib/llvm-project/libcxx/include/__algorithm/equal.h
index fb358613e210..f03f010aa51a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/equal.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/equal.h
@@ -68,8 +68,13 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
#if _LIBCPP_STD_VER >= 14
template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
- _BinaryPredicate __pred, input_iterator_tag, input_iterator_tag) {
+__equal(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _BinaryPredicate __pred,
+ input_iterator_tag,
+ input_iterator_tag) {
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2)
if (!__pred(*__first1, *__first2))
return false;
@@ -104,8 +109,12 @@ __equal_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&,
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
- _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag,
+__equal(_RandomAccessIterator1 __first1,
+ _RandomAccessIterator1 __last1,
+ _RandomAccessIterator2 __first2,
+ _RandomAccessIterator2 __last2,
+ _BinaryPredicate __pred,
+ random_access_iterator_tag,
random_access_iterator_tag) {
if (std::distance(__first1, __last1) != std::distance(__first2, __last2))
return false;
@@ -122,10 +131,18 @@ __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _Random
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
+equal(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
_BinaryPredicate __pred) {
return std::__equal<_BinaryPredicate&>(
- __first1, __last1, __first2, __last2, __pred, typename iterator_traits<_InputIterator1>::iterator_category(),
+ __first1,
+ __last1,
+ __first2,
+ __last2,
+ __pred,
+ typename iterator_traits<_InputIterator1>::iterator_category(),
typename iterator_traits<_InputIterator2>::iterator_category());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h b/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h
index dc1268a6ff11..7ce54965fff0 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/equal_range.h
@@ -49,9 +49,8 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp
__len = __half_len;
} else {
_Iter __mp1 = __mid;
- return pair<_Iter, _Iter>(
- std::__lower_bound<_AlgPolicy>(__first, __mid, __value, __comp, __proj),
- std::__upper_bound<_AlgPolicy>(++__mp1, __end, __value, __comp, __proj));
+ return pair<_Iter, _Iter>(std::__lower_bound<_AlgPolicy>(__first, __mid, __value, __comp, __proj),
+ std::__upper_bound<_AlgPolicy>(++__mp1, __end, __value, __comp, __proj));
}
}
return pair<_Iter, _Iter>(__first, __first);
@@ -60,10 +59,8 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp
template <class _ForwardIterator, class _Tp, class _Compare>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
- static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
- "The comparator has to be callable");
- static_assert(is_copy_constructible<_ForwardIterator>::value,
- "Iterator has to be copy constructible");
+ static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, "The comparator has to be callable");
+ static_assert(is_copy_constructible<_ForwardIterator>::value, "Iterator has to be copy constructible");
return std::__equal_range<_ClassicAlgPolicy>(
std::move(__first),
std::move(__last),
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/fill.h b/contrib/llvm-project/libcxx/include/__algorithm/fill.h
index 360e2c3c3c85..1ce3eadb013d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/fill.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/fill.h
@@ -22,28 +22,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag)
-{
- for (; __first != __last; ++__first)
- *__first = __value;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag) {
+ for (; __first != __last; ++__first)
+ *__first = __value;
}
template <class _RandomAccessIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag)
-{
- std::fill_n(__first, __last - __first, __value);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag) {
+ std::fill_n(__first, __last - __first, __value);
}
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
-{
- std::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+ std::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h b/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h
index 89681a342ea7..36f3349d9e7a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/fill_n.h
@@ -22,21 +22,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fill_n isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
template <class _OutputIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
-{
- for (; __n > 0; ++__first, (void) --__n)
- *__first = __value;
- return __first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
+ for (; __n > 0; ++__first, (void)--__n)
+ *__first = __value;
+ return __first;
}
template <class _OutputIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
-{
- return std::__fill_n(__first, std::__convert_to_integral(__n), __value);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
+ return std::__fill_n(__first, std::__convert_to_integral(__n), __value);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/find.h b/contrib/llvm-project/libcxx/include/__algorithm/find.h
index 754e597130c5..7d7631b6e98a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/find.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/find.h
@@ -21,8 +21,11 @@
#include <__fwd/bit_reference.h>
#include <__iterator/segmented_iterator.h>
#include <__string/constexpr_c_functions.h>
+#include <__type_traits/is_integral.h>
#include <__type_traits/is_same.h>
+#include <__type_traits/is_signed.h>
#include <__utility/move.h>
+#include <limits>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
@@ -76,6 +79,22 @@ __find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj&) {
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+// TODO: This should also be possible to get right with different signedness
+// cast integral types to allow vectorization
+template <class _Tp,
+ class _Up,
+ class _Proj,
+ __enable_if_t<__is_identity<_Proj>::value && !__libcpp_is_trivially_equality_comparable<_Tp, _Up>::value &&
+ is_integral<_Tp>::value && is_integral<_Up>::value &&
+ is_signed<_Tp>::value == is_signed<_Up>::value,
+ int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp*
+__find_impl(_Tp* __first, _Tp* __last, const _Up& __value, _Proj& __proj) {
+ if (__value < numeric_limits<_Tp>::min() || __value > numeric_limits<_Tp>::max())
+ return __last;
+ return std::__find_impl(__first, __last, _Tp(__value), __proj);
+}
+
// __bit_iterator implementation
template <bool _ToFind, class _Cp, bool _IsConst>
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst>
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/find_end.h b/contrib/llvm-project/libcxx/include/__algorithm/find_end.h
index edb9891c66f7..4c26891666b2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/find_end.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/find_end.h
@@ -28,15 +28,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <
- class _AlgPolicy,
- class _Iter1,
- class _Sent1,
- class _Iter2,
- class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2>
+template < class _AlgPolicy,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Pred,
+ class _Proj1,
+ class _Proj2>
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __find_end_impl(
_Iter1 __first1,
_Sent1 __last1,
@@ -49,7 +48,7 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1>
forward_iterator_tag) {
// modeled after search algorithm
_Iter1 __match_first = _IterOps<_AlgPolicy>::next(__first1, __last1); // __last1 is the "default" answer
- _Iter1 __match_last = __match_first;
+ _Iter1 __match_last = __match_first;
if (__first2 == __last2)
return pair<_Iter1, _Iter1>(__match_last, __match_last);
while (true) {
@@ -66,15 +65,14 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1>
while (true) {
if (++__m2 == __last2) { // Pattern exhaused, record answer and search for another one
__match_first = __first1;
- __match_last = ++__m1;
+ __match_last = ++__m1;
++__first1;
break;
}
if (++__m1 == __last1) // Source exhausted, return last answer
return pair<_Iter1, _Iter1>(__match_first, __match_last);
- // mismatch, restart with a new __first
- if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2)))
- {
+ // mismatch, restart with a new __first
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2))) {
++__first1;
break;
} // else there is a match, check next elements
@@ -82,15 +80,14 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1>
}
}
-template <
- class _IterOps,
- class _Pred,
- class _Iter1,
- class _Sent1,
- class _Iter2,
- class _Sent2,
- class _Proj1,
- class _Proj2>
+template < class _IterOps,
+ class _Pred,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter1 __find_end(
_Iter1 __first1,
_Sent1 __sent1,
@@ -127,23 +124,21 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter1 __find_end(
return __last1;
// if there is a mismatch, restart with a new __l1
- if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2)))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2))) {
break;
} // else there is a match, check next elements
}
}
}
-template <
- class _AlgPolicy,
- class _Pred,
- class _Iter1,
- class _Sent1,
- class _Iter2,
- class _Sent2,
- class _Proj1,
- class _Proj2>
+template < class _AlgPolicy,
+ class _Pred,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
_Iter1 __first1,
_Sent1 __sent1,
@@ -165,8 +160,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
if (__len1 < __len2)
return __last1;
const _Iter1 __s = __first1 + _D1(__len2 - 1); // End of pattern match can't go before here
- _Iter1 __l1 = __last1;
- _Iter2 __l2 = __last2;
+ _Iter1 __l1 = __last1;
+ _Iter2 __l2 = __last2;
--__l2;
while (true) {
while (true) {
@@ -189,10 +184,12 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate& __pred) {
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_end_classic(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate& __pred) {
auto __proj = __identity();
return std::__find_end_impl<_ClassicAlgPolicy>(
__first1,
@@ -208,17 +205,18 @@ _ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterato
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
return std::__find_end_classic(__first1, __last1, __first2, __last2, __pred);
}
template <class _ForwardIterator1, class _ForwardIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
+find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
return std::find_end(__first1, __last1, __first2, __last2, __equal_to());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h b/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h
index 15a147242b0e..14271cccc42b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/find_first_of.h
@@ -21,12 +21,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _BinaryPredicate&& __pred) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate&& __pred) {
for (; __first1 != __last1; ++__first1)
for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j)
if (__pred(*__first1, *__j))
@@ -35,9 +35,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(_ForwardItera
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
-find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
- _ForwardIterator2 __last2, _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred);
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/fold.h b/contrib/llvm-project/libcxx/include/__algorithm/fold.h
new file mode 100644
index 000000000000..88e6814d5cf9
--- /dev/null
+++ b/contrib/llvm-project/libcxx/include/__algorithm/fold.h
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_FOLD_H
+#define _LIBCPP___ALGORITHM_FOLD_H
+
+#include <__concepts/assignable.h>
+#include <__concepts/convertible_to.h>
+#include <__concepts/invocable.h>
+#include <__concepts/movable.h>
+#include <__config>
+#include <__functional/invoke.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/invoke.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+template <class _Ip, class _Tp>
+struct in_value_result {
+ _LIBCPP_NO_UNIQUE_ADDRESS _Ip in;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Tp value;
+
+ template <class _I2, class _T2>
+ requires convertible_to<const _Ip&, _I2> && convertible_to<const _Tp&, _T2>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() const& {
+ return {in, value};
+ }
+
+ template <class _I2, class _T2>
+ requires convertible_to<_Ip, _I2> && convertible_to<_Tp, _T2>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() && {
+ return {std::move(in), std::move(value)};
+ }
+};
+
+template <class _Ip, class _Tp>
+using fold_left_with_iter_result = in_value_result<_Ip, _Tp>;
+
+template <class _Fp, class _Tp, class _Ip, class _Rp, class _Up = decay_t<_Rp>>
+concept __indirectly_binary_left_foldable_impl =
+ convertible_to<_Rp, _Up> && //
+ movable<_Tp> && //
+ movable<_Up> && //
+ convertible_to<_Tp, _Up> && //
+ invocable<_Fp&, _Up, iter_reference_t<_Ip>> && //
+ assignable_from<_Up&, invoke_result_t<_Fp&, _Up, iter_reference_t<_Ip>>>;
+
+template <class _Fp, class _Tp, class _Ip>
+concept __indirectly_binary_left_foldable =
+ copy_constructible<_Fp> && //
+ invocable<_Fp&, _Tp, iter_reference_t<_Ip>> && //
+ __indirectly_binary_left_foldable_impl<_Fp, _Tp, _Ip, invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
+
+struct __fold_left_with_iter {
+ template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
+ using _Up = decay_t<invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
+
+ if (__first == __last) {
+ return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), _Up(std::move(__init))};
+ }
+
+ _Up __result = std::invoke(__f, std::move(__init), *__first);
+ for (++__first; __first != __last; ++__first) {
+ __result = std::invoke(__f, std::move(__result), *__first);
+ }
+
+ return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), std::move(__result)};
+ }
+
+ template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
+ auto __result = operator()(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f));
+
+ using _Up = decay_t<invoke_result_t<_Fp&, _Tp, range_reference_t<_Rp>>>;
+ return fold_left_with_iter_result<borrowed_iterator_t<_Rp>, _Up>{std::move(__result.in), std::move(__result.value)};
+ }
+};
+
+inline constexpr auto fold_left_with_iter = __fold_left_with_iter();
+
+struct __fold_left {
+ template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
+ return fold_left_with_iter(std::move(__first), std::move(__last), std::move(__init), std::ref(__f)).value;
+ }
+
+ template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
+ return fold_left_with_iter(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f)).value;
+ }
+};
+
+inline constexpr auto fold_left = __fold_left();
+} // namespace ranges
+
+#endif // _LIBCPP_STD_VER >= 23
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___ALGORITHM_FOLD_H
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h b/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h
index a72a0912cfa5..fce380b49df3 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/for_each_n.h
@@ -22,9 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _Size, class _Function>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator for_each_n(_InputIterator __first,
- _Size __orig_n,
- _Function __f) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
+for_each_n(_InputIterator __first, _Size __orig_n, _Function __f) {
typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
_IntegralSize __n = __orig_n;
while (__n > 0) {
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/generate.h b/contrib/llvm-project/libcxx/include/__algorithm/generate.h
index e2051dc16dc0..c95b527402f5 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/generate.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/generate.h
@@ -18,12 +18,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Generator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
-{
- for (; __first != __last; ++__first)
- *__first = __gen();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen) {
+ for (; __first != __last; ++__first)
+ *__first = __gen();
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h b/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h
index 5719826e93ed..f36403fd0f94 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/generate_n.h
@@ -19,15 +19,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _OutputIterator, class _Size, class _Generator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
-{
- typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
- _IntegralSize __n = __orig_n;
- for (; __n > 0; ++__first, (void) --__n)
- *__first = __gen();
- return __first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen) {
+ typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
+ _IntegralSize __n = __orig_n;
+ for (; __n > 0; ++__first, (void)--__n)
+ *__first = __gen();
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h b/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h
index 2315e154fb2e..ebda0da37236 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/half_positive.h
@@ -23,19 +23,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Perform division by two quickly for positive integers (llvm.org/PR39129)
template <typename _Integral, __enable_if_t<is_integral<_Integral>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Integral
-__half_positive(_Integral __value)
-{
- return static_cast<_Integral>(static_cast<__make_unsigned_t<_Integral> >(__value) / 2);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Integral __half_positive(_Integral __value) {
+ return static_cast<_Integral>(static_cast<__make_unsigned_t<_Integral> >(__value) / 2);
}
template <typename _Tp, __enable_if_t<!is_integral<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Tp
-__half_positive(_Tp __value)
-{
- return __value / 2;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp __half_positive(_Tp __value) {
+ return __value / 2;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h
index d9ca287f017b..88a0255d1698 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_found_result.h
@@ -30,7 +30,7 @@ struct in_found_result {
template <class _InIter2>
requires convertible_to<const _InIter1&, _InIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_found_result<_InIter2>() const & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_found_result<_InIter2>() const& {
return {in, found};
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h
index 33374eddc30d..6110c1cf86cd 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h
@@ -30,7 +30,7 @@ struct in_fun_result {
template <class _InIter2, class _Func2>
requires convertible_to<const _InIter1&, _InIter2> && convertible_to<const _Func1&, _Func2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_InIter2, _Func2>() const & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_InIter2, _Func2>() const& {
return {in, fun};
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
index 6b50e0e24564..95ce4f4fd5bd 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
@@ -31,18 +31,16 @@ struct in_in_out_result {
_LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out;
template <class _InIter3, class _InIter4, class _OutIter2>
- requires convertible_to<const _InIter1&, _InIter3>
- && convertible_to<const _InIter2&, _InIter4> && convertible_to<const _OutIter1&, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- operator in_in_out_result<_InIter3, _InIter4, _OutIter2>() const& {
+ requires convertible_to<const _InIter1&, _InIter3> && convertible_to<const _InIter2&, _InIter4> &&
+ convertible_to<const _OutIter1&, _OutIter2>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_out_result<_InIter3, _InIter4, _OutIter2>() const& {
return {in1, in2, out};
}
template <class _InIter3, class _InIter4, class _OutIter2>
- requires convertible_to<_InIter1, _InIter3>
- && convertible_to<_InIter2, _InIter4> && convertible_to<_OutIter1, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- operator in_in_out_result<_InIter3, _InIter4, _OutIter2>() && {
+ requires convertible_to<_InIter1, _InIter3> && convertible_to<_InIter2, _InIter4> &&
+ convertible_to<_OutIter1, _OutIter2>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_out_result<_InIter3, _InIter4, _OutIter2>() && {
return {std::move(in1), std::move(in2), std::move(out)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h
index 1eceb9de0233..d1d62dae7f67 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_in_result.h
@@ -31,15 +31,13 @@ struct in_in_result {
template <class _InIter3, class _InIter4>
requires convertible_to<const _InIter1&, _InIter3> && convertible_to<const _InIter2&, _InIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr
- operator in_in_result<_InIter3, _InIter4>() const & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_result<_InIter3, _InIter4>() const& {
return {in1, in2};
}
template <class _InIter3, class _InIter4>
requires convertible_to<_InIter1, _InIter3> && convertible_to<_InIter2, _InIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr
- operator in_in_result<_InIter3, _InIter4>() && {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_result<_InIter3, _InIter4>() && {
return {std::move(in1), std::move(in2)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
index 2f7a09b5c301..143642368750 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
@@ -30,18 +30,16 @@ struct in_out_out_result {
_LIBCPP_NO_UNIQUE_ADDRESS _OutIter2 out2;
template <class _InIter2, class _OutIter3, class _OutIter4>
- requires convertible_to<const _InIter1&, _InIter2>
- && convertible_to<const _OutIter1&, _OutIter3> && convertible_to<const _OutIter2&, _OutIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr
- operator in_out_out_result<_InIter2, _OutIter3, _OutIter4>() const& {
+ requires convertible_to<const _InIter1&, _InIter2> && convertible_to<const _OutIter1&, _OutIter3> &&
+ convertible_to<const _OutIter2&, _OutIter4>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_out_result<_InIter2, _OutIter3, _OutIter4>() const& {
return {in, out1, out2};
}
template <class _InIter2, class _OutIter3, class _OutIter4>
- requires convertible_to<_InIter1, _InIter2>
- && convertible_to<_OutIter1, _OutIter3> && convertible_to<_OutIter2, _OutIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr
- operator in_out_out_result<_InIter2, _OutIter3, _OutIter4>() && {
+ requires convertible_to<_InIter1, _InIter2> && convertible_to<_OutIter1, _OutIter3> &&
+ convertible_to<_OutIter2, _OutIter4>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_out_result<_InIter2, _OutIter3, _OutIter4>() && {
return {std::move(in), std::move(out1), std::move(out2)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h b/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h
index e4741cb71f66..a7a986cf8e6c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/in_out_result.h
@@ -27,22 +27,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _InIter1, class _OutIter1>
+template <class _InIter1, class _OutIter1>
struct in_out_result {
_LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in;
_LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out;
template <class _InIter2, class _OutIter2>
requires convertible_to<const _InIter1&, _InIter2> && convertible_to<const _OutIter1&, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator in_out_result<_InIter2, _OutIter2>() const & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_result<_InIter2, _OutIter2>() const& {
return {in, out};
}
template <class _InIter2, class _OutIter2>
requires convertible_to<_InIter1, _InIter2> && convertible_to<_OutIter1, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator in_out_result<_InIter2, _OutIter2>() && {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_result<_InIter2, _OutIter2>() && {
return {std::move(in), std::move(out)};
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/includes.h b/contrib/llvm-project/libcxx/include/__algorithm/includes.h
index 88253e2653d2..531752e93175 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/includes.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/includes.h
@@ -25,12 +25,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Comp, class _Proj1, class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Comp&& __comp, _Proj1&& __proj1, _Proj2&& __proj2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __includes(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Comp&& __comp,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
for (; __first2 != __last2; ++__first1) {
- if (__first1 == __last1 || std::__invoke(
- __comp, std::__invoke(__proj2, *__first2), std::__invoke(__proj1, *__first1)))
+ if (__first1 == __last1 ||
+ std::__invoke(__comp, std::__invoke(__proj2, *__first2), std::__invoke(__proj1, *__first1)))
return false;
if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
++__first2;
@@ -39,14 +44,14 @@ __includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
}
template <class _InputIterator1, class _InputIterator2, class _Compare>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool includes(
- _InputIterator1 __first1,
- _InputIterator1 __last1,
- _InputIterator2 __first2,
- _InputIterator2 __last2,
- _Compare __comp) {
- static_assert(__is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value,
- "Comparator has to be callable");
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+includes(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _Compare __comp) {
+ static_assert(
+ __is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value, "Comparator has to be callable");
return std::__includes(
std::move(__first1),
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h b/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h
index d49c2e5cedda..eb3c0bdbc2db 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/inplace_merge.h
@@ -42,54 +42,57 @@ template <class _Predicate>
class __invert // invert the sense of a comparison
{
private:
- _Predicate __p_;
+ _Predicate __p_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __invert() {}
+ _LIBCPP_HIDE_FROM_ABI __invert() {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __invert(_Predicate __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __invert(_Predicate __p) : __p_(__p) {}
- template <class _T1>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _T1& __x) {return !__p_(__x);}
+ template <class _T1>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _T1& __x) {
+ return !__p_(__x);
+ }
- template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _T1& __x, const _T2& __y) {return __p_(__y, __x);}
+ template <class _T1, class _T2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _T1& __x, const _T2& __y) {
+ return __p_(__y, __x);
+ }
};
-template <class _AlgPolicy, class _Compare, class _InputIterator1, class _Sent1,
- class _InputIterator2, class _Sent2, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1,
- _InputIterator2 __first2, _Sent2 __last2,
- _OutputIterator __result, _Compare&& __comp)
-{
- for (; __first1 != __last1; ++__result)
- {
- if (__first2 == __last2)
- {
- std::__move<_AlgPolicy>(__first1, __last1, __result);
- return;
- }
+template <class _AlgPolicy,
+ class _Compare,
+ class _InputIterator1,
+ class _Sent1,
+ class _InputIterator2,
+ class _Sent2,
+ class _OutputIterator>
+_LIBCPP_HIDE_FROM_ABI void __half_inplace_merge(
+ _InputIterator1 __first1,
+ _Sent1 __last1,
+ _InputIterator2 __first2,
+ _Sent2 __last2,
+ _OutputIterator __result,
+ _Compare&& __comp) {
+ for (; __first1 != __last1; ++__result) {
+ if (__first2 == __last2) {
+ std::__move<_AlgPolicy>(__first1, __last1, __result);
+ return;
+ }
- if (__comp(*__first2, *__first1))
- {
- *__result = _IterOps<_AlgPolicy>::__iter_move(__first2);
- ++__first2;
- }
- else
- {
- *__result = _IterOps<_AlgPolicy>::__iter_move(__first1);
- ++__first1;
- }
+ if (__comp(*__first2, *__first1)) {
+ *__result = _IterOps<_AlgPolicy>::__iter_move(__first2);
+ ++__first2;
+ } else {
+ *__result = _IterOps<_AlgPolicy>::__iter_move(__first1);
+ ++__first1;
}
- // __first2 through __last2 are already in the right spot.
+ }
+ // __first2 through __last2 are already in the right spot.
}
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __buffered_inplace_merge(
+_LIBCPP_HIDE_FROM_ABI void __buffered_inplace_merge(
_BidirectionalIterator __first,
_BidirectionalIterator __middle,
_BidirectionalIterator __last,
@@ -98,27 +101,25 @@ void __buffered_inplace_merge(
typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
typename iterator_traits<_BidirectionalIterator>::value_type* __buff) {
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
- if (__len1 <= __len2)
- {
- value_type* __p = __buff;
- for (_BidirectionalIterator __i = __first; __i != __middle; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
- ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
- std::__half_inplace_merge<_AlgPolicy>(__buff, __p, __middle, __last, __first, __comp);
- }
- else
- {
- value_type* __p = __buff;
- for (_BidirectionalIterator __i = __middle; __i != __last; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p)
- ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
- typedef __unconstrained_reverse_iterator<_BidirectionalIterator> _RBi;
- typedef __unconstrained_reverse_iterator<value_type*> _Rv;
- typedef __invert<_Compare> _Inverted;
- std::__half_inplace_merge<_AlgPolicy>(_Rv(__p), _Rv(__buff),
- _RBi(__middle), _RBi(__first),
- _RBi(__last), _Inverted(__comp));
- }
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
+ if (__len1 <= __len2) {
+ value_type* __p = __buff;
+ for (_BidirectionalIterator __i = __first; __i != __middle;
+ __d.template __incr<value_type>(), (void)++__i, (void)++__p)
+ ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
+ std::__half_inplace_merge<_AlgPolicy>(__buff, __p, __middle, __last, __first, __comp);
+ } else {
+ value_type* __p = __buff;
+ for (_BidirectionalIterator __i = __middle; __i != __last;
+ __d.template __incr<value_type>(), (void)++__i, (void)++__p)
+ ::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
+ typedef __unconstrained_reverse_iterator<_BidirectionalIterator> _RBi;
+ typedef __unconstrained_reverse_iterator<value_type*> _Rv;
+ typedef __invert<_Compare> _Inverted;
+ std::__half_inplace_merge<_AlgPolicy>(
+ _Rv(__p), _Rv(__buff), _RBi(__middle), _RBi(__first), _RBi(__last), _Inverted(__comp));
+ }
}
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
@@ -131,107 +132,92 @@ void __inplace_merge(
typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
typename iterator_traits<_BidirectionalIterator>::value_type* __buff,
ptrdiff_t __buff_size) {
- using _Ops = _IterOps<_AlgPolicy>;
-
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- while (true)
- {
- // if __middle == __last, we're done
- if (__len2 == 0)
- return;
- if (__len1 <= __buff_size || __len2 <= __buff_size)
- return std::__buffered_inplace_merge<_AlgPolicy>
- (__first, __middle, __last, __comp, __len1, __len2, __buff);
- // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
- for (; true; ++__first, (void) --__len1)
- {
- if (__len1 == 0)
- return;
- if (__comp(*__middle, *__first))
- break;
- }
- // __first < __middle < __last
- // *__first > *__middle
- // partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that
- // all elements in:
- // [__first, __m1) <= [__middle, __m2)
- // [__middle, __m2) < [__m1, __middle)
- // [__m1, __middle) <= [__m2, __last)
- // and __m1 or __m2 is in the middle of its range
- _BidirectionalIterator __m1; // "median" of [__first, __middle)
- _BidirectionalIterator __m2; // "median" of [__middle, __last)
- difference_type __len11; // distance(__first, __m1)
- difference_type __len21; // distance(__middle, __m2)
- // binary search smaller range
- if (__len1 < __len2)
- { // __len >= 1, __len2 >= 2
- __len21 = __len2 / 2;
- __m2 = __middle;
- _Ops::advance(__m2, __len21);
- __m1 = std::__upper_bound<_AlgPolicy>(__first, __middle, *__m2, __comp, std::__identity());
- __len11 = _Ops::distance(__first, __m1);
- }
- else
- {
- if (__len1 == 1)
- { // __len1 >= __len2 && __len2 > 0, therefore __len2 == 1
- // It is known *__first > *__middle
- _Ops::iter_swap(__first, __middle);
- return;
- }
- // __len1 >= 2, __len2 >= 1
- __len11 = __len1 / 2;
- __m1 = __first;
- _Ops::advance(__m1, __len11);
- __m2 = std::lower_bound(__middle, __last, *__m1, __comp);
- __len21 = _Ops::distance(__middle, __m2);
- }
- difference_type __len12 = __len1 - __len11; // distance(__m1, __middle)
- difference_type __len22 = __len2 - __len21; // distance(__m2, __last)
- // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
- // swap middle two partitions
- __middle = std::__rotate<_AlgPolicy>(__m1, __middle, __m2).first;
- // __len12 and __len21 now have swapped meanings
- // merge smaller range with recursive call and larger with tail recursion elimination
- if (__len11 + __len21 < __len12 + __len22)
- {
- std::__inplace_merge<_AlgPolicy>(
- __first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
- __first = __middle;
- __middle = __m2;
- __len1 = __len12;
- __len2 = __len22;
- }
- else
- {
- std::__inplace_merge<_AlgPolicy>(
- __middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
- __last = __middle;
- __middle = __m1;
- __len1 = __len11;
- __len2 = __len21;
- }
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ while (true) {
+ // if __middle == __last, we're done
+ if (__len2 == 0)
+ return;
+ if (__len1 <= __buff_size || __len2 <= __buff_size)
+ return std::__buffered_inplace_merge<_AlgPolicy>(__first, __middle, __last, __comp, __len1, __len2, __buff);
+ // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
+ for (; true; ++__first, (void)--__len1) {
+ if (__len1 == 0)
+ return;
+ if (__comp(*__middle, *__first))
+ break;
}
+ // __first < __middle < __last
+ // *__first > *__middle
+ // partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that
+ // all elements in:
+ // [__first, __m1) <= [__middle, __m2)
+ // [__middle, __m2) < [__m1, __middle)
+ // [__m1, __middle) <= [__m2, __last)
+ // and __m1 or __m2 is in the middle of its range
+ _BidirectionalIterator __m1; // "median" of [__first, __middle)
+ _BidirectionalIterator __m2; // "median" of [__middle, __last)
+ difference_type __len11; // distance(__first, __m1)
+ difference_type __len21; // distance(__middle, __m2)
+ // binary search smaller range
+ if (__len1 < __len2) { // __len >= 1, __len2 >= 2
+ __len21 = __len2 / 2;
+ __m2 = __middle;
+ _Ops::advance(__m2, __len21);
+ __m1 = std::__upper_bound<_AlgPolicy>(__first, __middle, *__m2, __comp, std::__identity());
+ __len11 = _Ops::distance(__first, __m1);
+ } else {
+ if (__len1 == 1) { // __len1 >= __len2 && __len2 > 0, therefore __len2 == 1
+ // It is known *__first > *__middle
+ _Ops::iter_swap(__first, __middle);
+ return;
+ }
+ // __len1 >= 2, __len2 >= 1
+ __len11 = __len1 / 2;
+ __m1 = __first;
+ _Ops::advance(__m1, __len11);
+ __m2 = std::lower_bound(__middle, __last, *__m1, __comp);
+ __len21 = _Ops::distance(__middle, __m2);
+ }
+ difference_type __len12 = __len1 - __len11; // distance(__m1, __middle)
+ difference_type __len22 = __len2 - __len21; // distance(__m2, __last)
+ // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
+ // swap middle two partitions
+ __middle = std::__rotate<_AlgPolicy>(__m1, __middle, __m2).first;
+ // __len12 and __len21 now have swapped meanings
+ // merge smaller range with recursive call and larger with tail recursion elimination
+ if (__len11 + __len21 < __len12 + __len22) {
+ std::__inplace_merge<_AlgPolicy>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
+ __first = __middle;
+ __middle = __m2;
+ __len1 = __len12;
+ __len2 = __len22;
+ } else {
+ std::__inplace_merge<_AlgPolicy>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size);
+ __last = __middle;
+ __middle = __m1;
+ __len1 = __len11;
+ __len2 = __len21;
+ }
+ }
}
template <class _AlgPolicy, class _BidirectionalIterator, class _Compare>
-_LIBCPP_HIDE_FROM_ABI
-void
-__inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
- _Compare&& __comp)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle);
- difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last);
- difference_type __buf_size = std::min(__len1, __len2);
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- pair<value_type*, ptrdiff_t> __buf = std::get_temporary_buffer<value_type>(__buf_size);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
- return std::__inplace_merge<_AlgPolicy>(
- std::move(__first), std::move(__middle), std::move(__last), __comp, __len1, __len2, __buf.first, __buf.second);
+_LIBCPP_HIDE_FROM_ABI void __inplace_merge(
+ _BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare&& __comp) {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle);
+ difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last);
+ difference_type __buf_size = std::min(__len1, __len2);
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ pair<value_type*, ptrdiff_t> __buf = std::get_temporary_buffer<value_type>(__buf_size);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
+ return std::__inplace_merge<_AlgPolicy>(
+ std::move(__first), std::move(__middle), std::move(__last), __comp, __len1, __len2, __buf.first, __buf.second);
}
template <class _BidirectionalIterator, class _Compare>
@@ -242,11 +228,9 @@ inline _LIBCPP_HIDE_FROM_ABI void inplace_merge(
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last)
-{
- std::inplace_merge(std::move(__first), std::move(__middle), std::move(__last), __less<>());
+inline _LIBCPP_HIDE_FROM_ABI void
+inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last) {
+ std::inplace_merge(std::move(__first), std::move(__middle), std::move(__last), __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h
index dd78031579ec..0d2d43c2c3ab 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_heap.h
@@ -22,21 +22,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _RandomAccessIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
-{
- return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+ return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last;
}
-template<class _RandomAccessIterator>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- return std::is_heap(__first, __last, __less<>());
+template <class _RandomAccessIterator>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ return std::is_heap(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h b/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h
index 85f70e649f56..1eae3b86b90d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_heap_until.h
@@ -22,43 +22,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
-__is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- difference_type __len = __last - __first;
- difference_type __p = 0;
- difference_type __c = 1;
- _RandomAccessIterator __pp = __first;
- while (__c < __len)
- {
- _RandomAccessIterator __cp = __first + __c;
- if (__comp(*__pp, *__cp))
- return __cp;
- ++__c;
- ++__cp;
- if (__c == __len)
- return __last;
- if (__comp(*__pp, *__cp))
- return __cp;
- ++__p;
- ++__pp;
- __c = 2 * __p + 1;
- }
- return __last;
+__is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ difference_type __len = __last - __first;
+ difference_type __p = 0;
+ difference_type __c = 1;
+ _RandomAccessIterator __pp = __first;
+ while (__c < __len) {
+ _RandomAccessIterator __cp = __first + __c;
+ if (__comp(*__pp, *__cp))
+ return __cp;
+ ++__c;
+ ++__cp;
+ if (__c == __len)
+ return __last;
+ if (__comp(*__pp, *__cp))
+ return __cp;
+ ++__p;
+ ++__pp;
+ __c = 2 * __p + 1;
+ }
+ return __last;
}
template <class _RandomAccessIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
-is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
-{
- return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
+is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+ return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
}
-template<class _RandomAccessIterator>
+template <class _RandomAccessIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
-is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- return std::__is_heap_until(__first, __last, __less<>());
+is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ return std::__is_heap_until(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h b/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h
index ab59d3cce582..71feed332060 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_partitioned.h
@@ -19,18 +19,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Predicate>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- if (!__pred(*__first))
- break;
- if ( __first == __last )
- return true;
- ++__first;
- for (; __first != __last; ++__first)
- if (__pred(*__first))
- return false;
+is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
+ for (; __first != __last; ++__first)
+ if (!__pred(*__first))
+ break;
+ if (__first == __last)
return true;
+ ++__first;
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ return false;
+ return true;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h b/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h
index 105a0732283c..4226151222bb 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_permutation.h
@@ -37,18 +37,24 @@ struct _ConstTimeDistance : false_type {};
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2>
-struct _ConstTimeDistance<_Iter1, _Sent1, _Iter2, _Sent2, __enable_if_t<
- sized_sentinel_for<_Sent1, _Iter1> &&
- sized_sentinel_for<_Sent2, _Iter2>
->> : true_type {};
+struct _ConstTimeDistance<_Iter1,
+ _Sent1,
+ _Iter2,
+ _Sent2,
+ __enable_if_t< sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2> >>
+ : true_type {};
#else
template <class _Iter1, class _Iter2>
-struct _ConstTimeDistance<_Iter1, _Iter1, _Iter2, _Iter2, __enable_if_t<
- is_same<typename iterator_traits<_Iter1>::iterator_category, random_access_iterator_tag>::value &&
- is_same<typename iterator_traits<_Iter2>::iterator_category, random_access_iterator_tag>::value
-> > : true_type {};
+struct _ConstTimeDistance<
+ _Iter1,
+ _Iter1,
+ _Iter2,
+ _Iter2,
+ __enable_if_t< is_same<typename iterator_traits<_Iter1>::iterator_category, random_access_iterator_tag>::value &&
+ is_same<typename iterator_traits<_Iter2>::iterator_category, random_access_iterator_tag>::value > >
+ : true_type {};
#endif // _LIBCPP_STD_VER >= 20
@@ -56,11 +62,21 @@ struct _ConstTimeDistance<_Iter1, _Iter1, _Iter2, _Iter2, __enable_if_t<
// For each element in [f1, l1) see if there are the same number of equal elements in [f2, l2)
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
using _D1 = __iter_diff_t<_Iter1>;
for (auto __i = __first1; __i != __last1; ++__i) {
@@ -97,9 +113,8 @@ __is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 _
// 2+1 iterators, predicate. Not used by range algorithms.
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2,
- _BinaryPredicate&& __pred) {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _BinaryPredicate&& __pred) {
// Shorten sequences as much as possible by lopping of any equal prefix.
for (; __first1 != __last1; ++__first1, (void)++__first2) {
if (!__pred(*__first1, *__first2))
@@ -111,24 +126,39 @@ __is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterato
// __first1 != __last1 && *__first1 != *__first2
using _D1 = __iter_diff_t<_ForwardIterator1>;
- _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
+ _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
if (__l1 == _D1(1))
return false;
auto __last2 = _IterOps<_AlgPolicy>::next(__first2, __l1);
return std::__is_permutation_impl<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __identity(), __identity());
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __identity(),
+ __identity());
}
// 2+2 iterators, predicate, non-constant time `distance`.
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2,
- /*_ConstTimeDistance=*/false_type) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2,
+ /*_ConstTimeDistance=*/false_type) {
// Shorten sequences as much as possible by lopping of any equal prefix.
while (__first1 != __last1 && __first2 != __last2) {
if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
@@ -143,44 +173,73 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last
return false;
using _D1 = __iter_diff_t<_Iter1>;
- _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
+ _D1 __l1 = _IterOps<_AlgPolicy>::distance(__first1, __last1);
using _D2 = __iter_diff_t<_Iter2>;
- _D2 __l2 = _IterOps<_AlgPolicy>::distance(__first2, __last2);
+ _D2 __l2 = _IterOps<_AlgPolicy>::distance(__first2, __last2);
if (__l1 != __l2)
return false;
return std::__is_permutation_impl<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2);
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
}
// 2+2 iterators, predicate, specialization for constant-time `distance` call.
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2,
- /*_ConstTimeDistance=*/true_type) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2,
+ /*_ConstTimeDistance=*/true_type) {
if (std::distance(__first1, __last1) != std::distance(__first2, __last2))
return false;
return std::__is_permutation<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2,
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __proj1,
+ __proj2,
/*_ConstTimeDistance=*/false_type());
}
// 2+2 iterators, predicate
template <class _AlgPolicy,
- class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) {
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
+ class _Proj1,
+ class _Proj2,
+ class _Pred>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred&& __pred,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
return std::__is_permutation<_AlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2,
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __proj1,
+ __proj2,
_ConstTimeDistance<_Iter1, _Sent1, _Iter2, _Sent2>());
}
@@ -188,14 +247,12 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last
// 2+1 iterators, predicate
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation(
+ _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _BinaryPredicate __pred) {
static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
- "The predicate has to be callable");
+ "The predicate has to be callable");
- return std::__is_permutation<_ClassicAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), __pred);
+ return std::__is_permutation<_ClassicAlgPolicy>(std::move(__first1), std::move(__last1), std::move(__first2), __pred);
}
// 2+1 iterators
@@ -223,15 +280,23 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
// 2+2 iterators, predicate
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
- _ForwardIterator2 __last2, _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation(
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
- "The predicate has to be callable");
+ "The predicate has to be callable");
return std::__is_permutation<_ClassicAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __identity(), __identity());
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ __pred,
+ __identity(),
+ __identity());
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h
index 0003097b362c..1874cace882c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted.h
@@ -22,21 +22,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last;
}
-template<class _ForwardIterator>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-is_sorted(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::is_sorted(__first, __last, __less<>());
+template <class _ForwardIterator>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+is_sorted(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::is_sorted(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h
index aeb3f1c8be98..7450440df2d8 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/is_sorted_until.h
@@ -22,33 +22,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-__is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (__comp(*__i, *__first))
- return __i;
- __first = __i;
- }
+__is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (__comp(*__i, *__first))
+ return __i;
+ __first = __i;
}
- return __last;
+ }
+ return __last;
}
template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp);
+is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp);
}
-template<class _ForwardIterator>
+template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::is_sorted_until(__first, __last, __less<>());
+is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::is_sorted_until(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h b/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h
index f647e7432467..a1412e5d8720 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/iter_swap.h
@@ -20,8 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator1, class _ForwardIterator2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void iter_swap(_ForwardIterator1 __a,
- _ForwardIterator2 __b)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
// _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
_NOEXCEPT_(_NOEXCEPT_(swap(*std::declval<_ForwardIterator1>(), *std::declval<_ForwardIterator2>()))) {
swap(*__a, *__b);
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h b/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h
index e6176da4f560..5cf13f0a3f29 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/iterator_operations.h
@@ -38,14 +38,14 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _AlgPolicy> struct _IterOps;
+template <class _AlgPolicy>
+struct _IterOps;
#if _LIBCPP_STD_VER >= 20
struct _RangeAlgPolicy {};
template <>
struct _IterOps<_RangeAlgPolicy> {
-
template <class _Iter>
using __value_type = iter_value_t<_Iter>;
@@ -55,12 +55,12 @@ struct _IterOps<_RangeAlgPolicy> {
template <class _Iter>
using __difference_type = iter_difference_t<_Iter>;
- static constexpr auto advance = ranges::advance;
- static constexpr auto distance = ranges::distance;
- static constexpr auto __iter_move = ranges::iter_move;
- static constexpr auto iter_swap = ranges::iter_swap;
- static constexpr auto next = ranges::next;
- static constexpr auto prev = ranges::prev;
+ static constexpr auto advance = ranges::advance;
+ static constexpr auto distance = ranges::distance;
+ static constexpr auto __iter_move = ranges::iter_move;
+ static constexpr auto iter_swap = ranges::iter_swap;
+ static constexpr auto next = ranges::next;
+ static constexpr auto prev = ranges::prev;
static constexpr auto __advance_to = ranges::advance;
};
@@ -70,7 +70,6 @@ struct _ClassicAlgPolicy {};
template <>
struct _IterOps<_ClassicAlgPolicy> {
-
template <class _Iter>
using __value_type = typename iterator_traits<_Iter>::value_type;
@@ -82,15 +81,14 @@ struct _IterOps<_ClassicAlgPolicy> {
// advance
template <class _Iter, class _Distance>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static void advance(_Iter& __iter, _Distance __count) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void advance(_Iter& __iter, _Distance __count) {
std::advance(__iter, __count);
}
// distance
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static typename iterator_traits<_Iter>::difference_type distance(_Iter __first, _Iter __last) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static typename iterator_traits<_Iter>::difference_type
+ distance(_Iter __first, _Iter __last) {
return std::distance(__first, __last);
}
@@ -101,9 +99,9 @@ struct _IterOps<_ClassicAlgPolicy> {
using __move_t = decltype(std::move(*std::declval<_Iter&>()));
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static void __validate_iter_reference() {
- static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value,
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void __validate_iter_reference() {
+ static_assert(
+ is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value,
"It looks like your iterator's `iterator_traits<It>::reference` does not match the return type of "
"dereferencing the iterator, i.e., calling `*it`. This is undefined behavior according to [input.iterators] "
"and can lead to dangling reference issues at runtime, so we are flagging this.");
@@ -112,10 +110,10 @@ struct _IterOps<_ClassicAlgPolicy> {
// iter_move
template <class _Iter, __enable_if_t<is_reference<__deref_t<_Iter> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static
- // If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `std::move` on it. Note
- // that the C++03 mode doesn't support `decltype(auto)` as the return type.
- __move_t<_Iter>
- __iter_move(_Iter&& __i) {
+ // If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `std::move` on it.
+ // Note that the C++03 mode doesn't support `decltype(auto)` as the return type.
+ __move_t<_Iter>
+ __iter_move(_Iter&& __i) {
__validate_iter_reference<_Iter>();
return std::move(*std::forward<_Iter>(__i));
@@ -123,11 +121,11 @@ struct _IterOps<_ClassicAlgPolicy> {
template <class _Iter, __enable_if_t<!is_reference<__deref_t<_Iter> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static
- // If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a
- // value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to that
- // temporary. Note that the C++03 mode doesn't support `auto` as the return type.
- __deref_t<_Iter>
- __iter_move(_Iter&& __i) {
+ // If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a
+ // value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to
+ // that temporary. Note that the C++03 mode doesn't support `auto` as the return type.
+ __deref_t<_Iter>
+ __iter_move(_Iter&& __i) {
__validate_iter_reference<_Iter>();
return *std::forward<_Iter>(__i);
@@ -135,36 +133,31 @@ struct _IterOps<_ClassicAlgPolicy> {
// iter_swap
template <class _Iter1, class _Iter2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- static void iter_swap(_Iter1&& __a, _Iter2&& __b) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void iter_swap(_Iter1&& __a, _Iter2&& __b) {
std::iter_swap(std::forward<_Iter1>(__a), std::forward<_Iter2>(__b));
}
// next
template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- _Iterator next(_Iterator, _Iterator __last) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iterator next(_Iterator, _Iterator __last) {
return __last;
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- __remove_cvref_t<_Iter> next(_Iter&& __it,
- typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 __remove_cvref_t<_Iter>
+ next(_Iter&& __it, typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
return std::next(std::forward<_Iter>(__it), __n);
}
// prev
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- __remove_cvref_t<_Iter> prev(_Iter&& __iter,
- typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 __remove_cvref_t<_Iter>
+ prev(_Iter&& __iter, typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
return std::prev(std::forward<_Iter>(__iter), __n);
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
- void __advance_to(_Iter& __first, _Iter __last) {
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 void __advance_to(_Iter& __first, _Iter __last) {
__first = __last;
}
};
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h b/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h
index 1ee189a25902..3efd8e24bf6c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/lexicographical_compare.h
@@ -21,38 +21,35 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _InputIterator1, class _InputIterator2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-__lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
-{
- for (; __first2 != __last2; ++__first1, (void) ++__first2)
- {
- if (__first1 == __last1 || __comp(*__first1, *__first2))
- return true;
- if (__comp(*__first2, *__first1))
- return false;
- }
- return false;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __lexicographical_compare(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _Compare __comp) {
+ for (; __first2 != __last2; ++__first1, (void)++__first2) {
+ if (__first1 == __last1 || __comp(*__first1, *__first2))
+ return true;
+ if (__comp(*__first2, *__first1))
+ return false;
+ }
+ return false;
}
template <class _InputIterator1, class _InputIterator2, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
-{
- return std::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp);
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _Compare __comp) {
+ return std::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp);
}
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2)
-{
- return std::lexicographical_compare(__first1, __last1, __first2, __last2, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare(
+ _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
+ return std::lexicographical_compare(__first1, __last1, __first2, __last2, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h b/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h
index 91c3bdaafd0c..8f57f3592c4b 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/lower_bound.h
@@ -28,8 +28,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Iter, class _Sent, class _Type, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Iter __lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
+__lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) {
auto __len = _IterOps<_AlgPolicy>::distance(__first, __last);
while (__len != 0) {
@@ -47,17 +47,16 @@ _Iter __lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __
}
template <class _ForwardIterator, class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
- static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
- "The comparator has to be callable");
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
+ static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, "The comparator has to be callable");
auto __proj = std::__identity();
return std::__lower_bound<_ClassicAlgPolicy>(__first, __last, __value, __comp, __proj);
}
template <class _ForwardIterator, class _Tp>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
return std::lower_bound(__first, __last, __value, __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h
index eaf9259c0b31..e8f0cdb27333 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/make_heap.h
@@ -27,29 +27,29 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
__comp_ref_type<_Compare> __comp_ref = __comp;
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
- difference_type __n = __last - __first;
+ difference_type __n = __last - __first;
if (__n > 1) {
// start from the first parent, there is no need to consider children
for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) {
- std::__sift_down<_AlgPolicy>(__first, __comp_ref, __n, __first + __start);
+ std::__sift_down<_AlgPolicy>(__first, __comp_ref, __n, __first + __start);
}
}
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
std::__make_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::make_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h b/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h
index 3a8670111814..bb7bc7e8c0b5 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/make_projected.h
@@ -36,44 +36,38 @@ struct _ProjectedPred {
: __pred(__pred_arg), __proj(__proj_arg) {}
template <class _Tp>
- typename __invoke_of<_Pred&,
- decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>()))
- >::type
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI operator()(_Tp&& __v) const {
+ typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>())) >::
+ type _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
+ operator()(_Tp&& __v) const {
return std::__invoke(__pred, std::__invoke(__proj, std::forward<_Tp>(__v)));
}
template <class _T1, class _T2>
typename __invoke_of<_Pred&,
decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T1>())),
- decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T2>()))
- >::type
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI operator()(_T1&& __lhs, _T2&& __rhs) const {
- return std::__invoke(__pred,
- std::__invoke(__proj, std::forward<_T1>(__lhs)),
- std::__invoke(__proj, std::forward<_T2>(__rhs)));
+ decltype(std::__invoke(std::declval<_Proj&>(),
+ std::declval<_T2>())) >::type _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
+ operator()(_T1&& __lhs, _T2&& __rhs) const {
+ return std::__invoke(
+ __pred, std::__invoke(__proj, std::forward<_T1>(__lhs)), std::__invoke(__proj, std::forward<_T2>(__rhs)));
}
-
};
-template <class _Pred,
- class _Proj,
- __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::value &&
- __is_identity<__decay_t<_Proj> >::value),
- int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj>
-__make_projected(_Pred& __pred, _Proj& __proj) {
+template <
+ class _Pred,
+ class _Proj,
+ __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::value && __is_identity<__decay_t<_Proj> >::value), int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj> __make_projected(_Pred& __pred, _Proj& __proj) {
return _ProjectedPred<_Pred, _Proj>(__pred, __proj);
}
// Avoid creating the functor and just use the pristine comparator -- for certain algorithms, this would enable
// optimizations that rely on the type of the comparator. Additionally, this results in less layers of indirection in
// the call stack when the comparator is invoked, even in an unoptimized build.
-template <class _Pred,
- class _Proj,
- __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value &&
- __is_identity<__decay_t<_Proj> >::value,
- int> = 0>
+template <
+ class _Pred,
+ class _Proj,
+ __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value && __is_identity<__decay_t<_Proj> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Pred& __make_projected(_Pred& __pred, _Proj&) {
return __pred;
}
@@ -87,8 +81,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Comp, class _Proj1, class _Proj2>
-_LIBCPP_HIDE_FROM_ABI constexpr
-decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) {
+_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) {
if constexpr (__is_identity<decay_t<_Proj1>>::value && __is_identity<decay_t<_Proj2>>::value &&
!is_member_pointer_v<decay_t<_Comp>>) {
// Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable
@@ -98,8 +91,8 @@ decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __p
} else {
return [&](auto&& __lhs, auto&& __rhs) -> bool {
return std::invoke(__comp,
- std::invoke(__proj1, std::forward<decltype(__lhs)>(__lhs)),
- std::invoke(__proj2, std::forward<decltype(__rhs)>(__rhs)));
+ std::invoke(__proj1, std::forward<decltype(__lhs)>(__lhs)),
+ std::invoke(__proj2, std::forward<decltype(__rhs)>(__rhs)));
};
}
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/max.h b/contrib/llvm-project/libcxx/include/__algorithm/max.h
index 183a4e9cac06..8171677f155c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/max.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/max.h
@@ -25,41 +25,28 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
-{
- return __comp(__a, __b) ? __b : __a;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
+ return __comp(__a, __b) ? __b : __a;
}
template <class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
-{
- return std::max(__a, __b, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
+ return std::max(__a, __b, __less<>());
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-max(initializer_list<_Tp> __t, _Compare __comp)
-{
- return *std::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp
+max(initializer_list<_Tp> __t, _Compare __comp) {
+ return *std::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-max(initializer_list<_Tp> __t)
-{
- return *std::max_element(__t.begin(), __t.end(), __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) {
+ return *std::max_element(__t.begin(), __t.end(), __less<>());
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/max_element.h b/contrib/llvm-project/libcxx/include/__algorithm/max_element.h
index a2dc9707c00b..f1d4f1cd0938 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/max_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/max_element.h
@@ -22,33 +22,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _ForwardIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "std::max_element requires a ForwardIterator");
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- if (__comp(*__first, *__i))
- __first = __i;
- }
- return __first;
+__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "std::max_element requires a ForwardIterator");
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last)
+ if (__comp(*__first, *__i))
+ __first = __i;
+ }
+ return __first;
}
template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- return std::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp);
+max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ return std::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp);
}
-
template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-max_element(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::max_element(__first, __last, __less<>());
+max_element(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::max_element(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/merge.h b/contrib/llvm-project/libcxx/include/__algorithm/merge.h
index 8a6021f1880b..bad663c4b9f1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/merge.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/merge.h
@@ -22,45 +22,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-__merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- for (; __first1 != __last1; ++__result)
- {
- if (__first2 == __last2)
- return std::copy(__first1, __last1, __result);
- if (__comp(*__first2, *__first1))
- {
- *__result = *__first2;
- ++__first2;
- }
- else
- {
- *__result = *__first1;
- ++__first1;
- }
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator __merge(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ for (; __first1 != __last1; ++__result) {
+ if (__first2 == __last2)
+ return std::copy(__first1, __last1, __result);
+ if (__comp(*__first2, *__first1)) {
+ *__result = *__first2;
+ ++__first2;
+ } else {
+ *__result = *__first1;
+ ++__first1;
}
- return std::copy(__first2, __last2, __result);
+ }
+ return std::copy(__first2, __last2, __result);
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
-{
- return std::__merge<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+merge(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ return std::__merge<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp);
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
-{
- return std::merge(__first1, __last1, __first2, __last2, __result, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+merge(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result) {
+ return std::merge(__first1, __last1, __first2, __last2, __result, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/min.h b/contrib/llvm-project/libcxx/include/__algorithm/min.h
index 58574517132f..919508486fd5 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/min.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/min.h
@@ -25,41 +25,28 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
-{
- return __comp(__b, __a) ? __b : __a;
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
+ return __comp(__b, __a) ? __b : __a;
}
template <class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
-{
- return std::min(__a, __b, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
+min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
+ return std::min(__a, __b, __less<>());
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-min(initializer_list<_Tp> __t, _Compare __comp)
-{
- return *std::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp
+min(initializer_list<_Tp> __t, _Compare __comp) {
+ return *std::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-min(initializer_list<_Tp> __t)
-{
- return *std::min_element(__t.begin(), __t.end(), __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) {
+ return *std::min_element(__t.begin(), __t.end(), __less<>());
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/min_element.h b/contrib/llvm-project/libcxx/include/__algorithm/min_element.h
index 0ce7af69333f..c576d665601d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/min_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/min_element.h
@@ -28,8 +28,8 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Comp, class _Iter, class _Sent, class _Proj>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter
+__min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
if (__first == __last)
return __first;
@@ -42,29 +42,26 @@ _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
}
template <class _Comp, class _Iter, class _Sent>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp) {
auto __proj = __identity();
return std::__min_element<_Comp>(std::move(__first), std::move(__last), __comp, __proj);
}
template <class _ForwardIterator, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
-{
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "std::min_element requires a ForwardIterator");
- static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
- "The comparator has to be callable");
+min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "std::min_element requires a ForwardIterator");
+ static_assert(
+ __is_callable<_Compare, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable");
return std::__min_element<__comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp);
}
template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-min_element(_ForwardIterator __first, _ForwardIterator __last)
-{
- return std::min_element(__first, __last, __less<>());
+min_element(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::min_element(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h b/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h
index ef2d99038087..e988df7c114e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/min_max_result.h
@@ -34,7 +34,7 @@ struct min_max_result {
template <class _T2>
requires convertible_to<const _T1&, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() const & {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() const& {
return {min, max};
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/minmax.h b/contrib/llvm-project/libcxx/include/__algorithm/minmax.h
index 115bf93f90ba..5227b8857175 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/minmax.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/minmax.h
@@ -23,43 +23,33 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<const _Tp&, const _Tp&>
-minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp)
-{
- return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) :
- pair<const _Tp&, const _Tp&>(__a, __b);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&>
+minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
+ return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) : pair<const _Tp&, const _Tp&>(__a, __b);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<const _Tp&, const _Tp&>
-minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
-{
- return std::minmax(__a, __b, __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&>
+minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
+ return std::minmax(__a, __b, __less<>());
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) {
- static_assert(__is_callable<_Compare, _Tp, _Tp>::value, "The comparator has to be callable");
- __identity __proj;
- auto __ret = std::__minmax_element_impl(__t.begin(), __t.end(), __comp, __proj);
- return pair<_Tp, _Tp>(*__ret.first, *__ret.second);
+template <class _Tp, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp>
+minmax(initializer_list<_Tp> __t, _Compare __comp) {
+ static_assert(__is_callable<_Compare, _Tp, _Tp>::value, "The comparator has to be callable");
+ __identity __proj;
+ auto __ret = std::__minmax_element_impl(__t.begin(), __t.end(), __comp, __proj);
+ return pair<_Tp, _Tp>(*__ret.first, *__ret.second);
}
-template<class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Tp, _Tp>
-minmax(initializer_list<_Tp> __t)
-{
- return std::minmax(__t, __less<>());
+template <class _Tp>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp>
+minmax(initializer_list<_Tp> __t) {
+ return std::minmax(__t, __less<>());
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h b/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h
index 5bcaf8354d9f..ff8cda321cef 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/minmax_element.h
@@ -29,19 +29,18 @@ class _MinmaxElementLessFunc {
_Proj& __proj_;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _MinmaxElementLessFunc(_Comp& __comp, _Proj& __proj) : __comp_(__comp), __proj_(__proj) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _MinmaxElementLessFunc(_Comp& __comp, _Proj& __proj)
+ : __comp_(__comp), __proj_(__proj) {}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(_Iter& __it1, _Iter& __it2) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(_Iter& __it1, _Iter& __it2) {
return std::__invoke(__comp_, std::__invoke(__proj_, *__it1), std::__invoke(__proj_, *__it2));
}
};
template <class _Iter, class _Sent, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter>
+__minmax_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __less = _MinmaxElementLessFunc<_Comp, _Proj>(__comp, __proj);
pair<_Iter, _Iter> __result(__first, __first);
@@ -66,8 +65,8 @@ pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __c
if (__less(__first, __i)) {
if (__less(__first, __result.first))
__result.first = __first;
- if (!__less(__i, __result.second))
- __result.second = __i;
+ if (!__less(__i, __result.second))
+ __result.second = __i;
} else {
if (__less(__i, __result.first))
__result.first = __i;
@@ -80,21 +79,21 @@ pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __c
}
template <class _ForwardIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_ForwardIterator, _ForwardIterator>
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_ForwardIterator, _ForwardIterator>
minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "std::minmax_element requires a ForwardIterator");
- static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
- "The comparator has to be callable");
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "std::minmax_element requires a ForwardIterator");
+ static_assert(
+ __is_callable<_Compare, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable");
auto __proj = __identity();
return std::__minmax_element_impl(__first, __last, __comp, __proj);
}
template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
- return std::minmax_element(__first, __last, __less<>());
+ pair<_ForwardIterator, _ForwardIterator>
+ minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
+ return std::minmax_element(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h b/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h
index 8330d21d56f3..d345b6048a7e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/mismatch.h
@@ -22,9 +22,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!__pred(*__first1, *__first2))
break;
@@ -32,18 +31,19 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
}
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
return std::mismatch(__first1, __last1, __first2, __equal_to());
}
#if _LIBCPP_STD_VER >= 14
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _BinaryPredicate __pred) {
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2)
if (!__pred(*__first1, *__first2))
break;
@@ -51,9 +51,8 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
}
template <class _InputIterator1, class _InputIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
- mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
+mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
return std::mismatch(__first1, __last1, __first2, __last2, __equal_to());
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/move.h b/contrib/llvm-project/libcxx/include/__algorithm/move.h
index e0da07117e66..dba6d487fff7 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/move.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/move.h
@@ -99,8 +99,7 @@ struct __move_loop {
struct __move_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
- template <class _In, class _Out,
- __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
+ template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_trivial_impl(__first, __last, __result);
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h b/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h
index 8151e4ef3243..aeedf4241dce 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/move_backward.h
@@ -108,8 +108,7 @@ struct __move_backward_loop {
struct __move_backward_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
- template <class _In, class _Out,
- __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
+ template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_backward_trivial_impl(__first, __last, __result);
@@ -120,7 +119,8 @@ template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, clas
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
__move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) {
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
- std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
+ std::is_copy_constructible<_BidirectionalIterator1>::value,
+ "Iterators must be copy constructible.");
return std::__dispatch_copy_or_move<_AlgPolicy, __move_backward_loop<_AlgPolicy>, __move_backward_trivial>(
std::move(__first), std::move(__last), std::move(__result));
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h b/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h
index ebaed15ae2ad..d66ea9b97345 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/next_permutation.h
@@ -26,50 +26,43 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, bool>
-__next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
-{
- using _Result = pair<_BidirectionalIterator, bool>;
+__next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp) {
+ using _Result = pair<_BidirectionalIterator, bool>;
- _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
- _BidirectionalIterator __i = __last_iter;
- if (__first == __last || __first == --__i)
- return _Result(std::move(__last_iter), false);
+ _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
+ _BidirectionalIterator __i = __last_iter;
+ if (__first == __last || __first == --__i)
+ return _Result(std::move(__last_iter), false);
- while (true)
- {
- _BidirectionalIterator __ip1 = __i;
- if (__comp(*--__i, *__ip1))
- {
- _BidirectionalIterator __j = __last_iter;
- while (!__comp(*__i, *--__j))
- ;
- _IterOps<_AlgPolicy>::iter_swap(__i, __j);
- std::__reverse<_AlgPolicy>(__ip1, __last_iter);
- return _Result(std::move(__last_iter), true);
- }
- if (__i == __first)
- {
- std::__reverse<_AlgPolicy>(__first, __last_iter);
- return _Result(std::move(__last_iter), false);
- }
+ while (true) {
+ _BidirectionalIterator __ip1 = __i;
+ if (__comp(*--__i, *__ip1)) {
+ _BidirectionalIterator __j = __last_iter;
+ while (!__comp(*__i, *--__j))
+ ;
+ _IterOps<_AlgPolicy>::iter_swap(__i, __j);
+ std::__reverse<_AlgPolicy>(__ip1, __last_iter);
+ return _Result(std::move(__last_iter), true);
}
+ if (__i == __first) {
+ std::__reverse<_AlgPolicy>(__first, __last_iter);
+ return _Result(std::move(__last_iter), false);
+ }
+ }
}
template <class _BidirectionalIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
return std::__next_permutation<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
+ std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp))
+ .second;
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
- return std::next_permutation(__first, __last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ return std::next_permutation(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h b/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
index 6b3b2bb434d5..a05970512595 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
@@ -25,224 +25,207 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Compare, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-__nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
- _RandomAccessIterator __m, _Compare __comp)
-{
- // manually guard downward moving __j against __i
- while (true) {
- if (__i == --__j) {
- return false;
- }
- if (__comp(*__j, *__m)) {
- return true; // found guard for downward moving __j, now use unguarded partition
- }
+template <class _Compare, class _RandomAccessIterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __nth_element_find_guard(
+ _RandomAccessIterator& __i, _RandomAccessIterator& __j, _RandomAccessIterator __m, _Compare __comp) {
+ // manually guard downward moving __j against __i
+ while (true) {
+ if (__i == --__j) {
+ return false;
}
+ if (__comp(*__j, *__m)) {
+ return true; // found guard for downward moving __j, now use unguarded partition
+ }
+ }
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
-__nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+__nth_element(
+ _RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
- // _Compare is known to be a reference type
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- const difference_type __limit = 7;
- while (true)
+ // _Compare is known to be a reference type
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ const difference_type __limit = 7;
+ while (true) {
+ if (__nth == __last)
+ return;
+ difference_type __len = __last - __first;
+ switch (__len) {
+ case 0:
+ case 1:
+ return;
+ case 2:
+ if (__comp(*--__last, *__first))
+ _Ops::iter_swap(__first, __last);
+ return;
+ case 3: {
+ _RandomAccessIterator __m = __first;
+ std::__sort3<_AlgPolicy, _Compare>(__first, ++__m, --__last, __comp);
+ return;
+ }
+ }
+ if (__len <= __limit) {
+ std::__selection_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
+ return;
+ }
+ // __len > __limit >= 3
+ _RandomAccessIterator __m = __first + __len / 2;
+ _RandomAccessIterator __lm1 = __last;
+ unsigned __n_swaps = std::__sort3<_AlgPolicy, _Compare>(__first, __m, --__lm1, __comp);
+ // *__m is median
+ // partition [__first, __m) < *__m and *__m <= [__m, __last)
+ // (this inhibits tossing elements equivalent to __m around unnecessarily)
+ _RandomAccessIterator __i = __first;
+ _RandomAccessIterator __j = __lm1;
+ // j points beyond range to be tested, *__lm1 is known to be <= *__m
+ // The search going up is known to be guarded but the search coming down isn't.
+ // Prime the downward search with a guard.
+ if (!__comp(*__i, *__m)) // if *__first == *__m
{
- if (__nth == __last)
- return;
- difference_type __len = __last - __first;
- switch (__len)
- {
- case 0:
- case 1:
- return;
- case 2:
- if (__comp(*--__last, *__first))
- _Ops::iter_swap(__first, __last);
- return;
- case 3:
- {
- _RandomAccessIterator __m = __first;
- std::__sort3<_AlgPolicy, _Compare>(__first, ++__m, --__last, __comp);
- return;
+ // *__first == *__m, *__first doesn't go in first part
+ if (std::__nth_element_find_guard<_Compare>(__i, __j, __m, __comp)) {
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ } else {
+ // *__first == *__m, *__m <= all other elements
+ // Partition instead into [__first, __i) == *__first and *__first < [__i, __last)
+ ++__i; // __first + 1
+ __j = __last;
+ if (!__comp(*__first, *--__j)) { // we need a guard if *__first == *(__last-1)
+ while (true) {
+ if (__i == __j) {
+ return; // [__first, __last) all equivalent elements
+ } else if (__comp(*__first, *__i)) {
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ ++__i;
+ break;
}
+ ++__i;
+ }
}
- if (__len <= __limit)
- {
- std::__selection_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
- return;
+ // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
+ if (__i == __j) {
+ return;
}
- // __len > __limit >= 3
- _RandomAccessIterator __m = __first + __len/2;
- _RandomAccessIterator __lm1 = __last;
- unsigned __n_swaps = std::__sort3<_AlgPolicy, _Compare>(__first, __m, --__lm1, __comp);
- // *__m is median
- // partition [__first, __m) < *__m and *__m <= [__m, __last)
- // (this inhibits tossing elements equivalent to __m around unnecessarily)
- _RandomAccessIterator __i = __first;
- _RandomAccessIterator __j = __lm1;
- // j points beyond range to be tested, *__lm1 is known to be <= *__m
- // The search going up is known to be guarded but the search coming down isn't.
- // Prime the downward search with a guard.
- if (!__comp(*__i, *__m)) // if *__first == *__m
- {
- // *__first == *__m, *__first doesn't go in first part
- if (std::__nth_element_find_guard<_Compare>(__i, __j, __m, __comp)) {
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- } else {
- // *__first == *__m, *__m <= all other elements
- // Partition instead into [__first, __i) == *__first and *__first < [__i, __last)
- ++__i; // __first + 1
- __j = __last;
- if (!__comp(*__first, *--__j)) { // we need a guard if *__first == *(__last-1)
- while (true) {
- if (__i == __j) {
- return; // [__first, __last) all equivalent elements
- } else if (__comp(*__first, *__i)) {
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- ++__i;
- break;
- }
- ++__i;
- }
- }
- // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
- if (__i == __j) {
- return;
- }
- while (true) {
- while (!__comp(*__first, *__i)) {
- ++__i;
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __i != __last,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- }
- do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __j != __first,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- --__j;
- } while (__comp(*__first, *__j));
- if (__i >= __j)
- break;
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- ++__i;
- }
- // [__first, __i) == *__first and *__first < [__i, __last)
- // The first part is sorted,
- if (__nth < __i) {
- return;
- }
- // __nth_element the second part
- // std::__nth_element<_Compare>(__i, __nth, __last, __comp);
- __first = __i;
- continue;
- }
+ while (true) {
+ while (!__comp(*__first, *__i)) {
+ ++__i;
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __i != __last,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
+ }
+ do {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __j != __first,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
+ --__j;
+ } while (__comp(*__first, *__j));
+ if (__i >= __j)
+ break;
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ ++__i;
}
- ++__i;
- // j points beyond range to be tested, *__lm1 is known to be <= *__m
- // if not yet partitioned...
- if (__i < __j)
- {
- // known that *(__i - 1) < *__m
- while (true)
- {
- // __m still guards upward moving __i
- while (__comp(*__i, *__m)) {
- ++__i;
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __i != __last,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- }
- // It is now known that a guard exists for downward moving __j
- do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __j != __first,
- "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
- --__j;
- } while (!__comp(*__j, *__m));
- if (__i >= __j)
- break;
- _Ops::iter_swap(__i, __j);
- ++__n_swaps;
- // It is known that __m != __j
- // If __m just moved, follow it
- if (__m == __i)
- __m = __j;
- ++__i;
- }
+ // [__first, __i) == *__first and *__first < [__i, __last)
+ // The first part is sorted,
+ if (__nth < __i) {
+ return;
}
- // [__first, __i) < *__m and *__m <= [__i, __last)
- if (__i != __m && __comp(*__m, *__i))
- {
- _Ops::iter_swap(__i, __m);
- ++__n_swaps;
+ // __nth_element the second part
+ // std::__nth_element<_Compare>(__i, __nth, __last, __comp);
+ __first = __i;
+ continue;
+ }
+ }
+ ++__i;
+ // j points beyond range to be tested, *__lm1 is known to be <= *__m
+ // if not yet partitioned...
+ if (__i < __j) {
+ // known that *(__i - 1) < *__m
+ while (true) {
+ // __m still guards upward moving __i
+ while (__comp(*__i, *__m)) {
+ ++__i;
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __i != __last,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
}
- // [__first, __i) < *__i and *__i <= [__i+1, __last)
- if (__nth == __i)
+ // It is now known that a guard exists for downward moving __j
+ do {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __j != __first,
+ "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
+ --__j;
+ } while (!__comp(*__j, *__m));
+ if (__i >= __j)
+ break;
+ _Ops::iter_swap(__i, __j);
+ ++__n_swaps;
+ // It is known that __m != __j
+ // If __m just moved, follow it
+ if (__m == __i)
+ __m = __j;
+ ++__i;
+ }
+ }
+ // [__first, __i) < *__m and *__m <= [__i, __last)
+ if (__i != __m && __comp(*__m, *__i)) {
+ _Ops::iter_swap(__i, __m);
+ ++__n_swaps;
+ }
+ // [__first, __i) < *__i and *__i <= [__i+1, __last)
+ if (__nth == __i)
+ return;
+ if (__n_swaps == 0) {
+ // We were given a perfectly partitioned sequence. Coincidence?
+ if (__nth < __i) {
+ // Check for [__first, __i) already sorted
+ __j = __m = __first;
+ while (true) {
+ if (++__j == __i) {
+ // [__first, __i) sorted
return;
- if (__n_swaps == 0)
- {
- // We were given a perfectly partitioned sequence. Coincidence?
- if (__nth < __i)
- {
- // Check for [__first, __i) already sorted
- __j = __m = __first;
- while (true) {
- if (++__j == __i) {
- // [__first, __i) sorted
- return;
- }
- if (__comp(*__j, *__m)) {
- // not yet sorted, so sort
- break;
- }
- __m = __j;
- }
- }
- else
- {
- // Check for [__i, __last) already sorted
- __j = __m = __i;
- while (true) {
- if (++__j == __last) {
- // [__i, __last) sorted
- return;
- }
- if (__comp(*__j, *__m)) {
- // not yet sorted, so sort
- break;
- }
- __m = __j;
- }
- }
- }
- // __nth_element on range containing __nth
- if (__nth < __i)
- {
- // std::__nth_element<_Compare>(__first, __nth, __i, __comp);
- __last = __i;
+ }
+ if (__comp(*__j, *__m)) {
+ // not yet sorted, so sort
+ break;
+ }
+ __m = __j;
}
- else
- {
- // std::__nth_element<_Compare>(__i+1, __nth, __last, __comp);
- __first = ++__i;
+ } else {
+ // Check for [__i, __last) already sorted
+ __j = __m = __i;
+ while (true) {
+ if (++__j == __last) {
+ // [__i, __last) sorted
+ return;
+ }
+ if (__comp(*__j, *__m)) {
+ // not yet sorted, so sort
+ break;
+ }
+ __m = __j;
}
+ }
+ }
+ // __nth_element on range containing __nth
+ if (__nth < __i) {
+ // std::__nth_element<_Compare>(__first, __nth, __i, __comp);
+ __last = __i;
+ } else {
+ // std::__nth_element<_Compare>(__i+1, __nth, __last, __comp);
+ __first = ++__i;
}
+ }
}
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
- _Compare& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __nth_element_impl(
+ _RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare& __comp) {
if (__nth == __last)
return;
@@ -257,15 +240,14 @@ void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __n
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
- _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) {
std::__nth_element_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__nth), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) {
std::nth_element(std::move(__first), std::move(__nth), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h
index de4ebfcbd858..27511a124229 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort.h
@@ -29,8 +29,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator __partial_sort_impl(
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator __partial_sort_impl(
_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare&& __comp) {
if (__first == __middle) {
return _IterOps<_AlgPolicy>::next(__middle, __last);
@@ -39,14 +38,12 @@ _RandomAccessIterator __partial_sort_impl(
std::__make_heap<_AlgPolicy>(__first, __middle, __comp);
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
- _RandomAccessIterator __i = __middle;
- for (; __i != __last; ++__i)
- {
- if (__comp(*__i, *__first))
- {
- _IterOps<_AlgPolicy>::iter_swap(__i, __first);
- std::__sift_down<_AlgPolicy>(__first, __comp, __len, __first);
- }
+ _RandomAccessIterator __i = __middle;
+ for (; __i != __last; ++__i) {
+ if (__comp(*__i, *__first)) {
+ _IterOps<_AlgPolicy>::iter_swap(__i, __first);
+ std::__sift_down<_AlgPolicy>(__first, __comp, __len, __first);
+ }
}
std::__sort_heap<_AlgPolicy>(std::move(__first), std::move(__middle), __comp);
@@ -54,11 +51,10 @@ _RandomAccessIterator __partial_sort_impl(
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last,
- _Compare& __comp) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
+__partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare& __comp) {
if (__first == __middle)
- return _IterOps<_AlgPolicy>::next(__middle, __last);
+ return _IterOps<_AlgPolicy>::next(__middle, __last);
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
@@ -71,11 +67,8 @@ _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAcces
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
- _Compare __comp)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void partial_sort(
+ _RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -83,11 +76,9 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
-{
- std::partial_sort(__first, __middle, __last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) {
+ std::partial_sort(__first, __middle, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h
index 2c1e786d030e..e7d8df4de89f 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partial_sort_copy.h
@@ -30,56 +30,70 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _AlgPolicy, class _Compare,
- class _InputIterator, class _Sentinel1, class _RandomAccessIterator, class _Sentinel2,
- class _Proj1, class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator>
-__partial_sort_copy(_InputIterator __first, _Sentinel1 __last,
- _RandomAccessIterator __result_first, _Sentinel2 __result_last,
- _Compare&& __comp, _Proj1&& __proj1, _Proj2&& __proj2)
-{
- _RandomAccessIterator __r = __result_first;
- auto&& __projected_comp = std::__make_projected(__comp, __proj2);
+template <class _AlgPolicy,
+ class _Compare,
+ class _InputIterator,
+ class _Sentinel1,
+ class _RandomAccessIterator,
+ class _Sentinel2,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator> __partial_sort_copy(
+ _InputIterator __first,
+ _Sentinel1 __last,
+ _RandomAccessIterator __result_first,
+ _Sentinel2 __result_last,
+ _Compare&& __comp,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
+ _RandomAccessIterator __r = __result_first;
+ auto&& __projected_comp = std::__make_projected(__comp, __proj2);
- if (__r != __result_last)
- {
- for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
- *__r = *__first;
- std::__make_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
- typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
- for (; __first != __last; ++__first)
- if (std::__invoke(__comp, std::__invoke(__proj1, *__first), std::__invoke(__proj2, *__result_first))) {
- *__result_first = *__first;
- std::__sift_down<_AlgPolicy>(__result_first, __projected_comp, __len, __result_first);
- }
- std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
- }
+ if (__r != __result_last) {
+ for (; __first != __last && __r != __result_last; ++__first, (void)++__r)
+ *__r = *__first;
+ std::__make_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
+ for (; __first != __last; ++__first)
+ if (std::__invoke(__comp, std::__invoke(__proj1, *__first), std::__invoke(__proj2, *__result_first))) {
+ *__result_first = *__first;
+ std::__sift_down<_AlgPolicy>(__result_first, __projected_comp, __len, __result_first);
+ }
+ std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
+ }
- return pair<_InputIterator, _RandomAccessIterator>(
- _IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r));
+ return pair<_InputIterator, _RandomAccessIterator>(
+ _IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r));
}
template <class _InputIterator, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator
-partial_sort_copy(_InputIterator __first, _InputIterator __last,
- _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
-{
- static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value,
- "Comparator has to be callable");
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator partial_sort_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _RandomAccessIterator __result_first,
+ _RandomAccessIterator __result_last,
+ _Compare __comp) {
+ static_assert(
+ __is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value, "Comparator has to be callable");
- auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>(__first, __last, __result_first, __result_last,
- static_cast<__comp_ref_type<_Compare> >(__comp), __identity(), __identity());
+ auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>(
+ __first,
+ __last,
+ __result_first,
+ __result_last,
+ static_cast<__comp_ref_type<_Compare> >(__comp),
+ __identity(),
+ __identity());
return __result.second;
}
template <class _InputIterator, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_RandomAccessIterator
-partial_sort_copy(_InputIterator __first, _InputIterator __last,
- _RandomAccessIterator __result_first, _RandomAccessIterator __result_last)
-{
- return std::partial_sort_copy(__first, __last, __result_first, __result_last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator partial_sort_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _RandomAccessIterator __result_first,
+ _RandomAccessIterator __result_last) {
+ return std::partial_sort_copy(__first, __last, __result_first, __result_last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partition.h b/contrib/llvm-project/libcxx/include/__algorithm/partition.h
index a6aaf634aaa5..e2ceb07bf195 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partition.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partition.h
@@ -23,70 +23,58 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Predicate, class _AlgPolicy, class _ForwardIterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
-__partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag)
-{
- while (true)
- {
- if (__first == __last)
- return std::make_pair(std::move(__first), std::move(__first));
- if (!__pred(*__first))
- break;
- ++__first;
- }
+__partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag) {
+ while (true) {
+ if (__first == __last)
+ return std::make_pair(std::move(__first), std::move(__first));
+ if (!__pred(*__first))
+ break;
+ ++__first;
+ }
- _ForwardIterator __p = __first;
- while (++__p != __last)
- {
- if (__pred(*__p))
- {
- _IterOps<_AlgPolicy>::iter_swap(__first, __p);
- ++__first;
- }
+ _ForwardIterator __p = __first;
+ while (++__p != __last) {
+ if (__pred(*__p)) {
+ _IterOps<_AlgPolicy>::iter_swap(__first, __p);
+ ++__first;
}
- return std::make_pair(std::move(__first), std::move(__p));
+ }
+ return std::make_pair(std::move(__first), std::move(__p));
}
template <class _Predicate, class _AlgPolicy, class _BidirectionalIterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, _BidirectionalIterator>
-__partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred,
- bidirectional_iterator_tag)
-{
- _BidirectionalIterator __original_last = _IterOps<_AlgPolicy>::next(__first, __sentinel);
- _BidirectionalIterator __last = __original_last;
+__partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred, bidirectional_iterator_tag) {
+ _BidirectionalIterator __original_last = _IterOps<_AlgPolicy>::next(__first, __sentinel);
+ _BidirectionalIterator __last = __original_last;
- while (true)
- {
- while (true)
- {
- if (__first == __last)
- return std::make_pair(std::move(__first), std::move(__original_last));
- if (!__pred(*__first))
- break;
- ++__first;
- }
- do
- {
- if (__first == --__last)
- return std::make_pair(std::move(__first), std::move(__original_last));
- } while (!__pred(*__last));
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
- ++__first;
+ while (true) {
+ while (true) {
+ if (__first == __last)
+ return std::make_pair(std::move(__first), std::move(__original_last));
+ if (!__pred(*__first))
+ break;
+ ++__first;
}
+ do {
+ if (__first == --__last)
+ return std::make_pair(std::move(__first), std::move(__original_last));
+ } while (!__pred(*__last));
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+ ++__first;
+ }
}
template <class _AlgPolicy, class _ForwardIterator, class _Sentinel, class _Predicate, class _IterCategory>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_ForwardIterator, _ForwardIterator> __partition(
- _ForwardIterator __first, _Sentinel __last, _Predicate&& __pred, _IterCategory __iter_category) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
+__partition(_ForwardIterator __first, _Sentinel __last, _Predicate&& __pred, _IterCategory __iter_category) {
return std::__partition_impl<__remove_cvref_t<_Predicate>&, _AlgPolicy>(
std::move(__first), std::move(__last), __pred, __iter_category);
}
template <class _ForwardIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator
-partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
auto __result = std::__partition<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __pred, _IterCategory());
return __result.first;
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h
index ff8826a93712..147b45c7882a 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partition_copy.h
@@ -19,27 +19,23 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _InputIterator, class _OutputIterator1,
- class _OutputIterator2, class _Predicate>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_OutputIterator1, _OutputIterator2>
-partition_copy(_InputIterator __first, _InputIterator __last,
- _OutputIterator1 __out_true, _OutputIterator2 __out_false,
- _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- {
- if (__pred(*__first))
- {
- *__out_true = *__first;
- ++__out_true;
- }
- else
- {
- *__out_false = *__first;
- ++__out_false;
- }
+template <class _InputIterator, class _OutputIterator1, class _OutputIterator2, class _Predicate>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_OutputIterator1, _OutputIterator2> partition_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _OutputIterator1 __out_true,
+ _OutputIterator2 __out_false,
+ _Predicate __pred) {
+ for (; __first != __last; ++__first) {
+ if (__pred(*__first)) {
+ *__out_true = *__first;
+ ++__out_true;
+ } else {
+ *__out_false = *__first;
+ ++__out_false;
}
- return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false);
+ }
+ return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h b/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h
index a61ed5ec5b41..504dbf1d1a05 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/partition_point.h
@@ -21,26 +21,22 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _ForwardIterator, class _Predicate>
+template <class _ForwardIterator, class _Predicate>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
- typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
- difference_type __len = std::distance(__first, __last);
- while (__len != 0)
- {
- difference_type __l2 = std::__half_positive(__len);
- _ForwardIterator __m = __first;
- std::advance(__m, __l2);
- if (__pred(*__m))
- {
- __first = ++__m;
- __len -= __l2 + 1;
- }
- else
- __len = __l2;
- }
- return __first;
+partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
+ typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+ difference_type __len = std::distance(__first, __last);
+ while (__len != 0) {
+ difference_type __l2 = std::__half_positive(__len);
+ _ForwardIterator __m = __first;
+ std::advance(__m, __l2);
+ if (__pred(*__m)) {
+ __first = ++__m;
+ __len -= __l2 + 1;
+ } else
+ __len = __l2;
+ }
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h
index 033af6f2f80f..a93a9875f705 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/pop_heap.h
@@ -31,16 +31,18 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare& __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
_LIBCPP_ASSERT_UNCATEGORIZED(__len > 0, "The heap given to pop_heap must be non-empty");
__comp_ref_type<_Compare> __comp_ref = __comp;
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
if (__len > 1) {
- value_type __top = _IterOps<_AlgPolicy>::__iter_move(__first); // create a hole at __first
+ value_type __top = _IterOps<_AlgPolicy>::__iter_move(__first); // create a hole at __first
_RandomAccessIterator __hole = std::__floyd_sift_down<_AlgPolicy>(__first, __comp_ref, __len);
--__last;
@@ -56,8 +58,8 @@ void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -66,8 +68,8 @@ void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::pop_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h b/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h
index 4a6bf4a66439..3e4bbb3fbb16 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/prev_permutation.h
@@ -25,52 +25,44 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_BidirectionalIterator, bool>
-__prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
-{
- using _Result = pair<_BidirectionalIterator, bool>;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, bool>
+__prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp) {
+ using _Result = pair<_BidirectionalIterator, bool>;
- _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
- _BidirectionalIterator __i = __last_iter;
- if (__first == __last || __first == --__i)
- return _Result(std::move(__last_iter), false);
+ _BidirectionalIterator __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
+ _BidirectionalIterator __i = __last_iter;
+ if (__first == __last || __first == --__i)
+ return _Result(std::move(__last_iter), false);
- while (true)
- {
- _BidirectionalIterator __ip1 = __i;
- if (__comp(*__ip1, *--__i))
- {
- _BidirectionalIterator __j = __last_iter;
- while (!__comp(*--__j, *__i))
- ;
- _IterOps<_AlgPolicy>::iter_swap(__i, __j);
- std::__reverse<_AlgPolicy>(__ip1, __last_iter);
- return _Result(std::move(__last_iter), true);
- }
- if (__i == __first)
- {
- std::__reverse<_AlgPolicy>(__first, __last_iter);
- return _Result(std::move(__last_iter), false);
- }
+ while (true) {
+ _BidirectionalIterator __ip1 = __i;
+ if (__comp(*__ip1, *--__i)) {
+ _BidirectionalIterator __j = __last_iter;
+ while (!__comp(*--__j, *__i))
+ ;
+ _IterOps<_AlgPolicy>::iter_swap(__i, __j);
+ std::__reverse<_AlgPolicy>(__ip1, __last_iter);
+ return _Result(std::move(__last_iter), true);
}
+ if (__i == __first) {
+ std::__reverse<_AlgPolicy>(__first, __last_iter);
+ return _Result(std::move(__last_iter), false);
+ }
+ }
}
template <class _BidirectionalIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
return std::__prev_permutation<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
+ std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp))
+ .second;
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
- return std::prev_permutation(__first, __last, __less<>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ return std::prev_permutation(__first, __last, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h
index 82b571e44bd4..7d8720e3a93d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/push_heap.h
@@ -28,20 +28,22 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__sift_up(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare&& __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
if (__len > 1) {
- __len = (__len - 2) / 2;
+ __len = (__len - 2) / 2;
_RandomAccessIterator __ptr = __first + __len;
if (__comp(*__ptr, *--__last)) {
value_type __t(_IterOps<_AlgPolicy>::__iter_move(__last));
do {
*__last = _IterOps<_AlgPolicy>::__iter_move(__ptr);
- __last = __ptr;
+ __last = __ptr;
if (__len == 0)
break;
__len = (__len - 1) / 2;
@@ -54,15 +56,15 @@ void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
}
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __last - __first;
std::__sift_up<_AlgPolicy, __comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp, __len);
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -70,8 +72,8 @@ void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::push_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 000000000000..f92fcec587d8
--- /dev/null
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+ template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
+ requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool static
+ operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) {
+ return ranges::find(std::move(__first), __last, __value, std::ref(__proj)) != __last;
+ }
+
+ template <input_range _Range, class _Type, class _Proj = identity>
+ requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool static
+ operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) {
+ return ranges::find(ranges::begin(__range), ranges::end(__range), __value, std::ref(__proj)) !=
+ ranges::end(__range);
+ }
+};
+} // namespace __contains
+
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h
index 782ce2670f05..0f89cb2ff5bf 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h
@@ -54,7 +54,8 @@ struct __fn {
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp
operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __il.begin() != __il.end(), "initializer_list must contain at least one element");
auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { return std::invoke(__comp, __rhs, __lhs); };
return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp_lhs_rhs_swapped, __proj);
@@ -69,7 +70,7 @@ struct __fn {
auto __first = ranges::begin(__r);
auto __last = ranges::end(__r);
- _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range must contain at least one element");
if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) {
auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool {
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h
index be15b4536734..8757358cdf37 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_min.h
@@ -53,7 +53,8 @@ struct __fn {
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp
operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __il.begin() != __il.end(), "initializer_list must contain at least one element");
return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp, __proj);
}
@@ -65,7 +66,7 @@ struct __fn {
operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
auto __first = ranges::begin(__r);
auto __last = ranges::end(__r);
- _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range must contain at least one element");
if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) {
return *ranges::__min_element_impl(__first, __last, __comp, __proj);
} else {
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
index a5b5cf9bd0ab..22a62b620c93 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
@@ -65,7 +65,8 @@ struct __fn {
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<_Type>
operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list has to contain at least one element");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __il.begin() != __il.end(), "initializer_list has to contain at least one element");
auto __iters = std::__minmax_element_impl(__il.begin(), __il.end(), __comp, __proj);
return ranges::minmax_result<_Type>{*__iters.first, *__iters.second};
}
@@ -80,7 +81,7 @@ struct __fn {
auto __last = ranges::end(__r);
using _ValueT = range_value_t<_Range>;
- _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range has to contain at least one element");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range has to contain at least one element");
if constexpr (forward_range<_Range>) {
// Special-case the one element case. Avoid repeatedly initializing objects from the result of an iterator
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove.h b/contrib/llvm-project/libcxx/include/__algorithm/remove.h
index eff22757186e..2b9d4ff26ed2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove.h
@@ -22,22 +22,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
-{
- __first = std::find(__first, __last, __value);
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (!(*__i == __value))
- {
- *__first = std::move(*__i);
- ++__first;
- }
- }
+remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+ __first = std::find(__first, __last, __value);
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (!(*__i == __value)) {
+ *__first = std::move(*__i);
+ ++__first;
+ }
}
- return __first;
+ }
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h
index 060833813d21..7be4c166ce3d 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy.h
@@ -18,19 +18,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value)
-{
- for (; __first != __last; ++__first)
- {
- if (!(*__first == __value))
- {
- *__result = *__first;
- ++__result;
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value) {
+ for (; __first != __last; ++__first) {
+ if (!(*__first == __value)) {
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h
index 9858d43c043f..dcafed169157 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove_copy_if.h
@@ -18,19 +18,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- {
- if (!__pred(*__first))
- {
- *__result = *__first;
- ++__result;
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
+ for (; __first != __last; ++__first) {
+ if (!__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h b/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h
index 8197e4fc2f8e..6eceddce8d56 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/remove_if.h
@@ -21,22 +21,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Predicate>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
- __first = std::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred);
- if (__first != __last)
- {
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (!__pred(*__i))
- {
- *__first = std::move(*__i);
- ++__first;
- }
- }
+remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
+ __first = std::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred);
+ if (__first != __last) {
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (!__pred(*__i)) {
+ *__first = std::move(*__i);
+ ++__first;
+ }
}
- return __first;
+ }
+ return __first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace.h b/contrib/llvm-project/libcxx/include/__algorithm/replace.h
index 09b1dac79b70..8057c78686e1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace.h
@@ -18,13 +18,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first)
- if (*__first == __old_value)
- *__first = __new_value;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value) {
+ for (; __first != __last; ++__first)
+ if (*__first == __old_value)
+ *__first = __new_value;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h
index 107e92968944..9a2258d9f58e 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy.h
@@ -18,17 +18,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- const _Tp& __old_value, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first, (void) ++__result)
- if (*__first == __old_value)
- *__result = __new_value;
- else
- *__result = *__first;
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator replace_copy(
+ _InputIterator __first,
+ _InputIterator __last,
+ _OutputIterator __result,
+ const _Tp& __old_value,
+ const _Tp& __new_value) {
+ for (; __first != __last; ++__first, (void)++__result)
+ if (*__first == __old_value)
+ *__result = __new_value;
+ else
+ *__result = *__first;
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h
index a77b1caa805a..c2ed30f08d59 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace_copy_if.h
@@ -18,17 +18,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _Predicate, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- _Predicate __pred, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first, (void) ++__result)
- if (__pred(*__first))
- *__result = __new_value;
- else
- *__result = *__first;
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator replace_copy_if(
+ _InputIterator __first,
+ _InputIterator __last,
+ _OutputIterator __result,
+ _Predicate __pred,
+ const _Tp& __new_value) {
+ for (; __first != __last; ++__first, (void)++__result)
+ if (__pred(*__first))
+ *__result = __new_value;
+ else
+ *__result = *__first;
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h b/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h
index 05269065f025..78487e3deed7 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/replace_if.h
@@ -18,13 +18,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Predicate, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value)
-{
- for (; __first != __last; ++__first)
- if (__pred(*__first))
- *__first = __new_value;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value) {
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ *__first = __new_value;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/reverse.h b/contrib/llvm-project/libcxx/include/__algorithm/reverse.h
index 86634520aa26..6bd0aa393280 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/reverse.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/reverse.h
@@ -22,41 +22,33 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__reverse_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag)
-{
- while (__first != __last)
- {
- if (__first == --__last)
- break;
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
- ++__first;
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__reverse_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag) {
+ while (__first != __last) {
+ if (__first == --__last)
+ break;
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+ ++__first;
+ }
}
template <class _AlgPolicy, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__reverse_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag)
-{
- if (__first != __last)
- for (; __first < --__last; ++__first)
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__reverse_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) {
+ if (__first != __last)
+ for (; __first < --__last; ++__first)
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
}
template <class _AlgPolicy, class _BidirectionalIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __reverse(_BidirectionalIterator __first, _Sentinel __last) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __reverse(_BidirectionalIterator __first, _Sentinel __last) {
using _IterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_BidirectionalIterator>;
std::__reverse_impl<_AlgPolicy>(std::move(__first), std::move(__last), _IterCategory());
}
template <class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) {
std::__reverse<_ClassicAlgPolicy>(std::move(__first), std::move(__last));
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h
index 7672fc86686b..0fcecc392326 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/reverse_copy.h
@@ -18,13 +18,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _BidirectionalIterator, class _OutputIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
-{
- for (; __first != __last; ++__result)
- *__result = *--__last;
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) {
+ for (; __first != __last; ++__result)
+ *__result = *--__last;
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/rotate.h b/contrib/llvm-project/libcxx/include/__algorithm/rotate.h
index f9236fcaafb2..d8162b1a94b2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/rotate.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/rotate.h
@@ -27,193 +27,165 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-__rotate_left(_ForwardIterator __first, _ForwardIterator __last)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- using _Ops = _IterOps<_AlgPolicy>;
-
- value_type __tmp = _Ops::__iter_move(__first);
- _ForwardIterator __lm1 = std::__move<_AlgPolicy>(
- _Ops::next(__first), __last, __first).second;
- *__lm1 = std::move(__tmp);
- return __lm1;
+__rotate_left(_ForwardIterator __first, _ForwardIterator __last) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ value_type __tmp = _Ops::__iter_move(__first);
+ _ForwardIterator __lm1 = std::__move<_AlgPolicy>(_Ops::next(__first), __last, __first).second;
+ *__lm1 = std::move(__tmp);
+ return __lm1;
}
template <class _AlgPolicy, class _BidirectionalIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator
-__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- using _Ops = _IterOps<_AlgPolicy>;
-
- _BidirectionalIterator __lm1 = _Ops::prev(__last);
- value_type __tmp = _Ops::__iter_move(__lm1);
- _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).second;
- *__first = std::move(__tmp);
- return __fp1;
+__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ _BidirectionalIterator __lm1 = _Ops::prev(__last);
+ value_type __tmp = _Ops::__iter_move(__lm1);
+ _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).second;
+ *__first = std::move(__tmp);
+ return __fp1;
}
template <class _AlgPolicy, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _ForwardIterator
-__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
-{
- _ForwardIterator __i = __middle;
- while (true)
- {
- _IterOps<_AlgPolicy>::iter_swap(__first, __i);
- ++__first;
- if (++__i == __last)
- break;
+__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) {
+ _ForwardIterator __i = __middle;
+ while (true) {
+ _IterOps<_AlgPolicy>::iter_swap(__first, __i);
+ ++__first;
+ if (++__i == __last)
+ break;
+ if (__first == __middle)
+ __middle = __i;
+ }
+ _ForwardIterator __r = __first;
+ if (__first != __middle) {
+ __i = __middle;
+ while (true) {
+ _IterOps<_AlgPolicy>::iter_swap(__first, __i);
+ ++__first;
+ if (++__i == __last) {
if (__first == __middle)
- __middle = __i;
- }
- _ForwardIterator __r = __first;
- if (__first != __middle)
- {
+ break;
__i = __middle;
- while (true)
- {
- _IterOps<_AlgPolicy>::iter_swap(__first, __i);
- ++__first;
- if (++__i == __last)
- {
- if (__first == __middle)
- break;
- __i = __middle;
- }
- else if (__first == __middle)
- __middle = __i;
- }
+ } else if (__first == __middle)
+ __middle = __i;
}
- return __r;
+ }
+ return __r;
}
-template<typename _Integral>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX17 _Integral
-__algo_gcd(_Integral __x, _Integral __y)
-{
- do
- {
- _Integral __t = __x % __y;
- __x = __y;
- __y = __t;
- } while (__y);
- return __x;
+template <typename _Integral>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Integral __algo_gcd(_Integral __x, _Integral __y) {
+ do {
+ _Integral __t = __x % __y;
+ __x = __y;
+ __y = __t;
+ } while (__y);
+ return __x;
}
template <class _AlgPolicy, typename _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _RandomAccessIterator
-__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- using _Ops = _IterOps<_AlgPolicy>;
-
- const difference_type __m1 = __middle - __first;
- const difference_type __m2 = _Ops::distance(__middle, __last);
- if (__m1 == __m2)
- {
- std::__swap_ranges<_AlgPolicy>(__first, __middle, __middle, __last);
- return __middle;
- }
- const difference_type __g = std::__algo_gcd(__m1, __m2);
- for (_RandomAccessIterator __p = __first + __g; __p != __first;)
- {
- value_type __t(_Ops::__iter_move(--__p));
- _RandomAccessIterator __p1 = __p;
- _RandomAccessIterator __p2 = __p1 + __m1;
- do
- {
- *__p1 = _Ops::__iter_move(__p2);
- __p1 = __p2;
- const difference_type __d = _Ops::distance(__p2, __last);
- if (__m1 < __d)
- __p2 += __m1;
- else
- __p2 = __first + (__m1 - __d);
- } while (__p2 != __p);
- *__p1 = std::move(__t);
- }
- return __first + __m2;
+__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ using _Ops = _IterOps<_AlgPolicy>;
+
+ const difference_type __m1 = __middle - __first;
+ const difference_type __m2 = _Ops::distance(__middle, __last);
+ if (__m1 == __m2) {
+ std::__swap_ranges<_AlgPolicy>(__first, __middle, __middle, __last);
+ return __middle;
+ }
+ const difference_type __g = std::__algo_gcd(__m1, __m2);
+ for (_RandomAccessIterator __p = __first + __g; __p != __first;) {
+ value_type __t(_Ops::__iter_move(--__p));
+ _RandomAccessIterator __p1 = __p;
+ _RandomAccessIterator __p2 = __p1 + __m1;
+ do {
+ *__p1 = _Ops::__iter_move(__p2);
+ __p1 = __p2;
+ const difference_type __d = _Ops::distance(__p2, __last);
+ if (__m1 < __d)
+ __p2 += __m1;
+ else
+ __p2 = __first + (__m1 - __d);
+ } while (__p2 != __p);
+ *__p1 = std::move(__t);
+ }
+ return __first + __m2;
}
template <class _AlgPolicy, class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
-__rotate_impl(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
- std::forward_iterator_tag)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- if (is_trivially_move_assignable<value_type>::value)
- {
- if (_IterOps<_AlgPolicy>::next(__first) == __middle)
- return std::__rotate_left<_AlgPolicy>(__first, __last);
- }
- return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
+__rotate_impl(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, std::forward_iterator_tag) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+ if (is_trivially_move_assignable<value_type>::value) {
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ }
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
template <class _AlgPolicy, class _BidirectionalIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator
-__rotate_impl(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
- bidirectional_iterator_tag)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- if (is_trivially_move_assignable<value_type>::value)
- {
- if (_IterOps<_AlgPolicy>::next(__first) == __middle)
- return std::__rotate_left<_AlgPolicy>(__first, __last);
- if (_IterOps<_AlgPolicy>::next(__middle) == __last)
- return std::__rotate_right<_AlgPolicy>(__first, __last);
- }
- return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _BidirectionalIterator __rotate_impl(
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ bidirectional_iterator_tag) {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ if (is_trivially_move_assignable<value_type>::value) {
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__middle) == __last)
+ return std::__rotate_right<_AlgPolicy>(__first, __last);
+ }
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
template <class _AlgPolicy, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator
-__rotate_impl(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
- random_access_iterator_tag)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- if (is_trivially_move_assignable<value_type>::value)
- {
- if (_IterOps<_AlgPolicy>::next(__first) == __middle)
- return std::__rotate_left<_AlgPolicy>(__first, __last);
- if (_IterOps<_AlgPolicy>::next(__middle) == __last)
- return std::__rotate_right<_AlgPolicy>(__first, __last);
- return std::__rotate_gcd<_AlgPolicy>(__first, __middle, __last);
- }
- return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator __rotate_impl(
+ _RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last,
+ random_access_iterator_tag) {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ if (is_trivially_move_assignable<value_type>::value) {
+ if (_IterOps<_AlgPolicy>::next(__first) == __middle)
+ return std::__rotate_left<_AlgPolicy>(__first, __last);
+ if (_IterOps<_AlgPolicy>::next(__middle) == __last)
+ return std::__rotate_right<_AlgPolicy>(__first, __last);
+ return std::__rotate_gcd<_AlgPolicy>(__first, __middle, __last);
+ }
+ return std::__rotate_forward<_AlgPolicy>(__first, __middle, __last);
}
template <class _AlgPolicy, class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iterator, _Iterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iterator, _Iterator>
__rotate(_Iterator __first, _Iterator __middle, _Sentinel __last) {
- using _Ret = pair<_Iterator, _Iterator>;
+ using _Ret = pair<_Iterator, _Iterator>;
_Iterator __last_iter = _IterOps<_AlgPolicy>::next(__middle, __last);
if (__first == __middle)
- return _Ret(__last_iter, __last_iter);
+ return _Ret(__last_iter, __last_iter);
if (__middle == __last)
- return _Ret(std::move(__first), std::move(__last_iter));
+ return _Ret(std::move(__first), std::move(__last_iter));
using _IterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_Iterator>;
- auto __result = std::__rotate_impl<_AlgPolicy>(
- std::move(__first), std::move(__middle), __last_iter, _IterCategory());
+ auto __result = std::__rotate_impl<_AlgPolicy>(std::move(__first), std::move(__middle), __last_iter, _IterCategory());
return _Ret(std::move(__result), std::move(__last_iter));
}
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
-rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
-{
- return std::__rotate<_ClassicAlgPolicy>(
- std::move(__first), std::move(__middle), std::move(__last)).first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) {
+ return std::__rotate<_ClassicAlgPolicy>(std::move(__first), std::move(__middle), std::move(__last)).first;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h b/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h
index 6e886cb73cfc..cddcadd237d9 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/rotate_copy.h
@@ -19,11 +19,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _OutputIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result)
-{
- return std::copy(__first, __middle, std::copy(__middle, __last, __result));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) {
+ return std::copy(__first, __middle, std::copy(__middle, __last, __result));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sample.h b/contrib/llvm-project/libcxx/include/__algorithm/sample.h
index 100b0a466863..ebe5180b7eec 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sample.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sample.h
@@ -29,20 +29,23 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy,
- class _PopulationIterator, class _PopulationSentinel, class _SampleIterator, class _Distance,
+ class _PopulationIterator,
+ class _PopulationSentinel,
+ class _SampleIterator,
+ class _Distance,
class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI
-_SampleIterator __sample(_PopulationIterator __first,
- _PopulationSentinel __last, _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator& __g,
- input_iterator_tag) {
-
+_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
+ _PopulationIterator __first,
+ _PopulationSentinel __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator& __g,
+ input_iterator_tag) {
_Distance __k = 0;
- for (; __first != __last && __k < __n; ++__first, (void) ++__k)
+ for (; __first != __last && __k < __n; ++__first, (void)++__k)
__output_iter[__k] = *__first;
_Distance __sz = __k;
- for (; __first != __last; ++__first, (void) ++__k) {
+ for (; __first != __last; ++__first, (void)++__k) {
_Distance __r = uniform_int_distribution<_Distance>(0, __k)(__g);
if (__r < __sz)
__output_iter[__r] = *__first;
@@ -51,14 +54,18 @@ _SampleIterator __sample(_PopulationIterator __first,
}
template <class _AlgPolicy,
- class _PopulationIterator, class _PopulationSentinel, class _SampleIterator, class _Distance,
+ class _PopulationIterator,
+ class _PopulationSentinel,
+ class _SampleIterator,
+ class _Distance,
class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI
-_SampleIterator __sample(_PopulationIterator __first,
- _PopulationSentinel __last, _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator& __g,
- forward_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
+ _PopulationIterator __first,
+ _PopulationSentinel __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator& __g,
+ forward_iterator_tag) {
_Distance __unsampled_sz = _IterOps<_AlgPolicy>::distance(__first, __last);
for (__n = std::min(__n, __unsampled_sz); __n != 0; ++__first) {
_Distance __r = uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
@@ -71,36 +78,40 @@ _SampleIterator __sample(_PopulationIterator __first,
}
template <class _AlgPolicy,
- class _PopulationIterator, class _PopulationSentinel, class _SampleIterator, class _Distance,
+ class _PopulationIterator,
+ class _PopulationSentinel,
+ class _SampleIterator,
+ class _Distance,
class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI
-_SampleIterator __sample(_PopulationIterator __first,
- _PopulationSentinel __last, _SampleIterator __output_iter,
- _Distance __n, _UniformRandomNumberGenerator& __g) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "N must be a positive number.");
+_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
+ _PopulationIterator __first,
+ _PopulationSentinel __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator& __g) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "N must be a positive number.");
using _PopIterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_PopulationIterator>;
- using _Difference = typename _IterOps<_AlgPolicy>::template __difference_type<_PopulationIterator>;
- using _CommonType = typename common_type<_Distance, _Difference>::type;
+ using _Difference = typename _IterOps<_AlgPolicy>::template __difference_type<_PopulationIterator>;
+ using _CommonType = typename common_type<_Distance, _Difference>::type;
return std::__sample<_AlgPolicy>(
- std::move(__first), std::move(__last), std::move(__output_iter), _CommonType(__n),
- __g, _PopIterCategory());
+ std::move(__first), std::move(__last), std::move(__output_iter), _CommonType(__n), __g, _PopIterCategory());
}
#if _LIBCPP_STD_VER >= 17
-template <class _PopulationIterator, class _SampleIterator, class _Distance,
- class _UniformRandomNumberGenerator>
-inline _LIBCPP_HIDE_FROM_ABI
-_SampleIterator sample(_PopulationIterator __first,
- _PopulationIterator __last, _SampleIterator __output_iter,
- _Distance __n, _UniformRandomNumberGenerator&& __g) {
+template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator>
+inline _LIBCPP_HIDE_FROM_ABI _SampleIterator
+sample(_PopulationIterator __first,
+ _PopulationIterator __last,
+ _SampleIterator __output_iter,
+ _Distance __n,
+ _UniformRandomNumberGenerator&& __g) {
static_assert(__has_forward_iterator_category<_PopulationIterator>::value ||
- __has_random_access_iterator_category<_SampleIterator>::value,
+ __has_random_access_iterator_category<_SampleIterator>::value,
"SampleIterator must meet the requirements of RandomAccessIterator");
- return std::__sample<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), std::move(__output_iter), __n, __g);
+ return std::__sample<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__output_iter), __n, __g);
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/search.h b/contrib/llvm-project/libcxx/include/__algorithm/search.h
index 544e127f7d4c..75f936d0f217 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/search.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/search.h
@@ -29,17 +29,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy,
- class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
class _Pred,
class _Proj1,
class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_forward_impl(
+ _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
if (__first2 == __last2)
return std::make_pair(__first1, __first1); // Everything matches an empty sequence
while (true) {
@@ -64,8 +62,7 @@ pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1,
}
// if there is a mismatch, restart with a new __first1
- if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2)))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj1, *__m1), std::__invoke(__proj2, *__m2))) {
++__first1;
break;
} // else there is a match, check next elements
@@ -74,21 +71,25 @@ pair<_Iter1, _Iter1> __search_forward_impl(_Iter1 __first1, _Sent1 __last1,
}
template <class _AlgPolicy,
- class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
+ class _Iter1,
+ class _Sent1,
+ class _Iter2,
+ class _Sent2,
class _Pred,
class _Proj1,
class _Proj2,
class _DiffT1,
class _DiffT2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_random_access_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2,
- _DiffT1 __size1,
- _DiffT2 __size2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_random_access_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ _DiffT1 __size1,
+ _DiffT2 __size2) {
const _Iter1 __s = __first1 + __size1 - _DiffT1(__size2 - 1); // Start of pattern match can't go beyond here
while (true) {
@@ -116,20 +117,17 @@ pair<_Iter1, _Iter1> __search_random_access_impl(_Iter1 __first1, _Sent1 __last1
}
}
-template <class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2,
- __enable_if_t<__has_random_access_iterator_category<_Iter1>::value
- && __has_random_access_iterator_category<_Iter2>::value>* = nullptr) {
-
+template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ __enable_if_t<__has_random_access_iterator_category<_Iter1>::value &&
+ __has_random_access_iterator_category<_Iter2>::value>* = nullptr) {
auto __size2 = __last2 - __first2;
if (__size2 == 0)
return std::make_pair(__first1, __first1);
@@ -139,42 +137,32 @@ pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
return std::make_pair(__last1, __last1);
}
- return std::__search_random_access_impl<_ClassicAlgPolicy>(__first1, __last1,
- __first2, __last2,
- __pred,
- __proj1,
- __proj2,
- __size1,
- __size2);
+ return std::__search_random_access_impl<_ClassicAlgPolicy>(
+ __first1, __last1, __first2, __last2, __pred, __proj1, __proj2, __size1, __size2);
}
-template <class _Iter1, class _Sent1,
- class _Iter2, class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2,
- __enable_if_t<__has_forward_iterator_category<_Iter1>::value
- && __has_forward_iterator_category<_Iter2>::value
- && !(__has_random_access_iterator_category<_Iter1>::value
- && __has_random_access_iterator_category<_Iter2>::value)>* = nullptr) {
- return std::__search_forward_impl<_ClassicAlgPolicy>(__first1, __last1,
- __first2, __last2,
- __pred,
- __proj1,
- __proj2);
+template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2,
+ __enable_if_t<__has_forward_iterator_category<_Iter1>::value && __has_forward_iterator_category<_Iter2>::value &&
+ !(__has_random_access_iterator_category<_Iter1>::value &&
+ __has_random_access_iterator_category<_Iter2>::value)>* = nullptr) {
+ return std::__search_forward_impl<_ClassicAlgPolicy>(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _BinaryPredicate __pred) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
+search(_ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _BinaryPredicate __pred) {
static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
"BinaryPredicate has to be callable");
auto __proj = __identity();
@@ -182,9 +170,8 @@ _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
}
template <class _ForwardIterator1, class _ForwardIterator2>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
+search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
return std::search(__first1, __last1, __first2, __last2, __equal_to());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/search_n.h b/contrib/llvm-project/libcxx/include/__algorithm/search_n.h
index 7e3ddf48a2b6..c3c01e700bf6 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/search_n.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/search_n.h
@@ -31,12 +31,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last,
- _SizeT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter> __search_n_forward_impl(
+ _Iter __first, _Sent __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) {
if (__count <= 0)
return std::make_pair(__first, __first);
while (true) {
@@ -62,8 +58,7 @@ pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last,
}
// if there is a mismatch, restart with a new __first
- if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value)) {
__first = __m;
++__first;
break;
@@ -73,13 +68,8 @@ pair<_Iter, _Iter> __search_n_forward_impl(_Iter __first, _Sent __last,
}
template <class _AlgPolicy, class _Pred, class _Iter, class _Sent, class _SizeT, class _Type, class _Proj, class _DiffT>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __last,
- _SizeT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj,
- _DiffT __size1) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 std::pair<_Iter, _Iter> __search_n_random_access_impl(
+ _Iter __first, _Sent __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj, _DiffT __size1) {
using difference_type = typename iterator_traits<_Iter>::difference_type;
if (__count == 0)
return std::make_pair(__first, __first);
@@ -109,8 +99,7 @@ std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __las
++__m; // no need to check range on __m because __s guarantees we have enough source
// if there is a mismatch, restart with a new __first
- if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value))
- {
+ if (!std::__invoke(__pred, std::__invoke(__proj, *__m), __value)) {
__first = __m;
++__first;
break;
@@ -119,61 +108,44 @@ std::pair<_Iter, _Iter> __search_n_random_access_impl(_Iter __first, _Sent __las
}
}
-template <class _Iter, class _Sent,
- class _DiffT,
- class _Type,
- class _Pred,
- class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter, _Iter> __search_n_impl(_Iter __first, _Sent __last,
- _DiffT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj,
- __enable_if_t<__has_random_access_iterator_category<_Iter>::value>* = nullptr) {
- return std::__search_n_random_access_impl<_ClassicAlgPolicy>(__first, __last,
- __count,
- __value,
- __pred,
- __proj,
- __last - __first);
+template <class _Iter, class _Sent, class _DiffT, class _Type, class _Pred, class _Proj>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter, _Iter> __search_n_impl(
+ _Iter __first,
+ _Sent __last,
+ _DiffT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj,
+ __enable_if_t<__has_random_access_iterator_category<_Iter>::value>* = nullptr) {
+ return std::__search_n_random_access_impl<_ClassicAlgPolicy>(
+ __first, __last, __count, __value, __pred, __proj, __last - __first);
}
-template <class _Iter1, class _Sent1,
- class _DiffT,
- class _Type,
- class _Pred,
- class _Proj>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<_Iter1, _Iter1> __search_n_impl(_Iter1 __first, _Sent1 __last,
- _DiffT __count,
- const _Type& __value,
- _Pred& __pred,
- _Proj& __proj,
- __enable_if_t<__has_forward_iterator_category<_Iter1>::value
- && !__has_random_access_iterator_category<_Iter1>::value>* = nullptr) {
- return std::__search_n_forward_impl<_ClassicAlgPolicy>(__first, __last,
- __count,
- __value,
- __pred,
- __proj);
+template <class _Iter1, class _Sent1, class _DiffT, class _Type, class _Pred, class _Proj>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __search_n_impl(
+ _Iter1 __first,
+ _Sent1 __last,
+ _DiffT __count,
+ const _Type& __value,
+ _Pred& __pred,
+ _Proj& __proj,
+ __enable_if_t<__has_forward_iterator_category<_Iter1>::value &&
+ !__has_random_access_iterator_category<_Iter1>::value>* = nullptr) {
+ return std::__search_n_forward_impl<_ClassicAlgPolicy>(__first, __last, __count, __value, __pred, __proj);
}
template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last,
- _Size __count,
- const _Tp& __value,
- _BinaryPredicate __pred) {
- static_assert(__is_callable<_BinaryPredicate, decltype(*__first), const _Tp&>::value,
- "BinaryPredicate has to be callable");
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator search_n(
+ _ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value, _BinaryPredicate __pred) {
+ static_assert(
+ __is_callable<_BinaryPredicate, decltype(*__first), const _Tp&>::value, "BinaryPredicate has to be callable");
auto __proj = __identity();
return std::__search_n_impl(__first, __last, std::__convert_to_integral(__count), __value, __pred, __proj).first;
}
template <class _ForwardIterator, class _Size, class _Tp>
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) {
return std::search_n(__first, __last, std::__convert_to_integral(__count), __value, __equal_to());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h b/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h
index 26a300092c91..a924702ce5f2 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/set_difference.h
@@ -55,7 +55,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d
_OutputIterator __result,
_Compare __comp) {
return std::__set_difference<_ClassicAlgPolicy, __comp_ref_type<_Compare> >(
- __first1, __last1, __first2, __last2, __result, __comp)
+ __first1, __last1, __first2, __last2, __result, __comp)
.second;
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h b/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h
index c9f2cbb9f7b6..645c58c29119 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/shift_left.h
@@ -22,30 +22,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-_ForwardIterator
-shift_left(_ForwardIterator __first, _ForwardIterator __last,
- typename iterator_traits<_ForwardIterator>::difference_type __n)
-{
- if (__n == 0) {
- return __last;
+inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
+shift_left(_ForwardIterator __first,
+ _ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::difference_type __n) {
+ if (__n == 0) {
+ return __last;
+ }
+
+ _ForwardIterator __m = __first;
+ if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
+ if (__n >= __last - __first) {
+ return __first;
}
-
- _ForwardIterator __m = __first;
- if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
- if (__n >= __last - __first) {
- return __first;
- }
- __m += __n;
- } else {
- for (; __n > 0; --__n) {
- if (__m == __last) {
- return __first;
- }
- ++__m;
- }
+ __m += __n;
+ } else {
+ for (; __n > 0; --__n) {
+ if (__m == __last) {
+ return __first;
+ }
+ ++__m;
}
- return std::move(__m, __last, __first);
+ }
+ return std::move(__m, __last, __first);
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h b/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h
index 70983e327bcb..73ef98bd39de 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/shift_right.h
@@ -25,73 +25,72 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-_ForwardIterator
-shift_right(_ForwardIterator __first, _ForwardIterator __last,
- typename iterator_traits<_ForwardIterator>::difference_type __n)
-{
- if (__n == 0) {
- return __first;
- }
+inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
+shift_right(_ForwardIterator __first,
+ _ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::difference_type __n) {
+ if (__n == 0) {
+ return __first;
+ }
- if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
- decltype(__n) __d = __last - __first;
- if (__n >= __d) {
- return __last;
- }
- _ForwardIterator __m = __first + (__d - __n);
- return std::move_backward(__first, __m, __last);
- } else if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) {
- _ForwardIterator __m = __last;
- for (; __n > 0; --__n) {
- if (__m == __first) {
- return __last;
- }
- --__m;
- }
- return std::move_backward(__first, __m, __last);
- } else {
- _ForwardIterator __ret = __first;
- for (; __n > 0; --__n) {
- if (__ret == __last) {
- return __last;
- }
- ++__ret;
- }
+ if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
+ decltype(__n) __d = __last - __first;
+ if (__n >= __d) {
+ return __last;
+ }
+ _ForwardIterator __m = __first + (__d - __n);
+ return std::move_backward(__first, __m, __last);
+ } else if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) {
+ _ForwardIterator __m = __last;
+ for (; __n > 0; --__n) {
+ if (__m == __first) {
+ return __last;
+ }
+ --__m;
+ }
+ return std::move_backward(__first, __m, __last);
+ } else {
+ _ForwardIterator __ret = __first;
+ for (; __n > 0; --__n) {
+ if (__ret == __last) {
+ return __last;
+ }
+ ++__ret;
+ }
- // We have an __n-element scratch space from __first to __ret.
- // Slide an __n-element window [__trail, __lead) from left to right.
- // We're essentially doing swap_ranges(__first, __ret, __trail, __lead)
- // over and over; but once __lead reaches __last we needn't bother
- // to save the values of elements [__trail, __last).
+ // We have an __n-element scratch space from __first to __ret.
+ // Slide an __n-element window [__trail, __lead) from left to right.
+ // We're essentially doing swap_ranges(__first, __ret, __trail, __lead)
+ // over and over; but once __lead reaches __last we needn't bother
+ // to save the values of elements [__trail, __last).
- auto __trail = __first;
- auto __lead = __ret;
- while (__trail != __ret) {
- if (__lead == __last) {
- std::move(__first, __trail, __ret);
- return __ret;
- }
- ++__trail;
- ++__lead;
- }
+ auto __trail = __first;
+ auto __lead = __ret;
+ while (__trail != __ret) {
+ if (__lead == __last) {
+ std::move(__first, __trail, __ret);
+ return __ret;
+ }
+ ++__trail;
+ ++__lead;
+ }
- _ForwardIterator __mid = __first;
- while (true) {
- if (__lead == __last) {
- __trail = std::move(__mid, __ret, __trail);
- std::move(__first, __mid, __trail);
- return __ret;
- }
- swap(*__mid, *__trail);
- ++__mid;
- ++__trail;
- ++__lead;
- if (__mid == __ret) {
- __mid = __first;
- }
- }
+ _ForwardIterator __mid = __first;
+ while (true) {
+ if (__lead == __last) {
+ __trail = std::move(__mid, __ret, __trail);
+ std::move(__first, __mid, __trail);
+ return __ret;
+ }
+ swap(*__mid, *__trail);
+ ++__mid;
+ ++__trail;
+ ++__lead;
+ if (__mid == __ret) {
+ __mid = __first;
+ }
}
+ }
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h b/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h
index 6fee88ca6ff2..c9c56ce8c2c0 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/shuffle.h
@@ -32,8 +32,8 @@ class _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_randomizer {
public:
_LIBCPP_HIDE_FROM_ABI __libcpp_debug_randomizer() {
__state_ = __seed();
- __inc_ = __state_ + 0xda3e39cb94b95bdbULL;
- __inc_ = (__inc_ << 1) | 1;
+ __inc_ = __state_ + 0xda3e39cb94b95bdbULL;
+ __inc_ = (__inc_ << 1) | 1;
}
typedef uint_fast32_t result_type;
@@ -42,7 +42,7 @@ public:
_LIBCPP_HIDE_FROM_ABI result_type operator()() {
uint_fast64_t __oldstate = __state_;
- __state_ = __oldstate * 6364136223846793005ULL + __inc_;
+ __state_ = __oldstate * 6364136223846793005ULL + __inc_;
return __oldstate >> 32;
}
@@ -62,102 +62,95 @@ private:
}
};
-#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \
- || defined(_LIBCPP_BUILDING_LIBRARY)
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) || defined(_LIBCPP_BUILDING_LIBRARY)
class _LIBCPP_EXPORTED_FROM_ABI __rs_default;
_LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
-class _LIBCPP_EXPORTED_FROM_ABI __rs_default
-{
- static unsigned __c_;
+class _LIBCPP_EXPORTED_FROM_ABI __rs_default {
+ static unsigned __c_;
+
+ __rs_default();
- __rs_default();
public:
- typedef uint_fast32_t result_type;
+ typedef uint_fast32_t result_type;
- static const result_type _Min = 0;
- static const result_type _Max = 0xFFFFFFFF;
+ static const result_type _Min = 0;
+ static const result_type _Max = 0xFFFFFFFF;
- __rs_default(const __rs_default&);
- ~__rs_default();
+ __rs_default(const __rs_default&);
+ ~__rs_default();
- result_type operator()();
+ result_type operator()();
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type min() {return _Min;}
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type max() {return _Max;}
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR result_type max() { return _Max; }
- friend _LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
+ friend _LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
};
_LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get();
template <class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
-random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef uniform_int_distribution<ptrdiff_t> _Dp;
- typedef typename _Dp::param_type _Pp;
- difference_type __d = __last - __first;
- if (__d > 1)
- {
- _Dp __uid;
- __rs_default __g = __rs_get();
- for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
- {
- difference_type __i = __uid(__g, _Pp(0, __d));
- if (__i != difference_type(0))
- swap(*__first, *(__first + __i));
- }
+random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef uniform_int_distribution<ptrdiff_t> _Dp;
+ typedef typename _Dp::param_type _Pp;
+ difference_type __d = __last - __first;
+ if (__d > 1) {
+ _Dp __uid;
+ __rs_default __g = __rs_get();
+ for (--__last, (void)--__d; __first < __last; ++__first, (void)--__d) {
+ difference_type __i = __uid(__g, _Pp(0, __d));
+ if (__i != difference_type(0))
+ swap(*__first, *(__first + __i));
}
+ }
}
template <class _RandomAccessIterator, class _RandomNumberGenerator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
-random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
-#ifndef _LIBCPP_CXX03_LANG
+random_shuffle(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+# ifndef _LIBCPP_CXX03_LANG
_RandomNumberGenerator&& __rand)
-#else
+# else
_RandomNumberGenerator& __rand)
-#endif
+# endif
{
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- difference_type __d = __last - __first;
- if (__d > 1)
- {
- for (--__last; __first < __last; ++__first, (void) --__d)
- {
- difference_type __i = __rand(__d);
- if (__i != difference_type(0))
- swap(*__first, *(__first + __i));
- }
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ difference_type __d = __last - __first;
+ if (__d > 1) {
+ for (--__last; __first < __last; ++__first, (void)--__d) {
+ difference_type __i = __rand(__d);
+ if (__i != difference_type(0))
+ swap(*__first, *(__first + __i));
}
+ }
}
#endif
template <class _AlgPolicy, class _RandomAccessIterator, class _Sentinel, class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI _RandomAccessIterator __shuffle(
- _RandomAccessIterator __first, _Sentinel __last_sentinel, _UniformRandomNumberGenerator&& __g) {
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef uniform_int_distribution<ptrdiff_t> _Dp;
- typedef typename _Dp::param_type _Pp;
-
- auto __original_last = _IterOps<_AlgPolicy>::next(__first, __last_sentinel);
- auto __last = __original_last;
- difference_type __d = __last - __first;
- if (__d > 1)
- {
- _Dp __uid;
- for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
- {
- difference_type __i = __uid(__g, _Pp(0, __d));
- if (__i != difference_type(0))
- _IterOps<_AlgPolicy>::iter_swap(__first, __first + __i);
- }
+_LIBCPP_HIDE_FROM_ABI _RandomAccessIterator
+__shuffle(_RandomAccessIterator __first, _Sentinel __last_sentinel, _UniformRandomNumberGenerator&& __g) {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef uniform_int_distribution<ptrdiff_t> _Dp;
+ typedef typename _Dp::param_type _Pp;
+
+ auto __original_last = _IterOps<_AlgPolicy>::next(__first, __last_sentinel);
+ auto __last = __original_last;
+ difference_type __d = __last - __first;
+ if (__d > 1) {
+ _Dp __uid;
+ for (--__last, (void)--__d; __first < __last; ++__first, (void)--__d) {
+ difference_type __i = __uid(__g, _Pp(0, __d));
+ if (__i != difference_type(0))
+ _IterOps<_AlgPolicy>::iter_swap(__first, __first + __i);
}
+ }
- return __original_last;
+ return __original_last;
}
template <class _RandomAccessIterator, class _UniformRandomNumberGenerator>
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h b/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h
index 3a222f7c7f1b..7f152e4dbd7f 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sift_down.h
@@ -26,90 +26,89 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-__sift_down(_RandomAccessIterator __first, _Compare&& __comp,
+__sift_down(_RandomAccessIterator __first,
+ _Compare&& __comp,
typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- _RandomAccessIterator __start)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+ _RandomAccessIterator __start) {
+ using _Ops = _IterOps<_AlgPolicy>;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- // left-child of __start is at 2 * __start + 1
- // right-child of __start is at 2 * __start + 2
- difference_type __child = __start - __first;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ // left-child of __start is at 2 * __start + 1
+ // right-child of __start is at 2 * __start + 2
+ difference_type __child = __start - __first;
- if (__len < 2 || (__len - 2) / 2 < __child)
- return;
+ if (__len < 2 || (__len - 2) / 2 < __child)
+ return;
- __child = 2 * __child + 1;
- _RandomAccessIterator __child_i = __first + __child;
+ __child = 2 * __child + 1;
+ _RandomAccessIterator __child_i = __first + __child;
+
+ if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
+ // right-child exists and is greater than left-child
+ ++__child_i;
+ ++__child;
+ }
+
+ // check if we are in heap-order
+ if (__comp(*__child_i, *__start))
+ // we are, __start is larger than its largest child
+ return;
+
+ value_type __top(_Ops::__iter_move(__start));
+ do {
+ // we are not in heap-order, swap the parent with its largest child
+ *__start = _Ops::__iter_move(__child_i);
+ __start = __child_i;
+
+ if ((__len - 2) / 2 < __child)
+ break;
+
+ // recompute the child based off of the updated parent
+ __child = 2 * __child + 1;
+ __child_i = __first + __child;
if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
- // right-child exists and is greater than left-child
- ++__child_i;
- ++__child;
+ // right-child exists and is greater than left-child
+ ++__child_i;
+ ++__child;
}
// check if we are in heap-order
- if (__comp(*__child_i, *__start))
- // we are, __start is larger than its largest child
- return;
-
- value_type __top(_Ops::__iter_move(__start));
- do
- {
- // we are not in heap-order, swap the parent with its largest child
- *__start = _Ops::__iter_move(__child_i);
- __start = __child_i;
-
- if ((__len - 2) / 2 < __child)
- break;
-
- // recompute the child based off of the updated parent
- __child = 2 * __child + 1;
- __child_i = __first + __child;
-
- if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
- // right-child exists and is greater than left-child
- ++__child_i;
- ++__child;
- }
-
- // check if we are in heap-order
- } while (!__comp(*__child_i, __top));
- *__start = std::move(__top);
+ } while (!__comp(*__child_i, __top));
+ *__start = std::move(__top);
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator
-__floyd_sift_down(_RandomAccessIterator __first, _Compare&& __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len)
-{
- using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
- _LIBCPP_ASSERT_UNCATEGORIZED(__len >= 2, "shouldn't be called unless __len >= 2");
-
- _RandomAccessIterator __hole = __first;
- _RandomAccessIterator __child_i = __first;
- difference_type __child = 0;
-
- while (true) {
- __child_i += difference_type(__child + 1);
- __child = 2 * __child + 1;
-
- if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
- // right-child exists and is greater than left-child
- ++__child_i;
- ++__child;
- }
-
- // swap __hole with its largest child
- *__hole = _IterOps<_AlgPolicy>::__iter_move(__child_i);
- __hole = __child_i;
-
- // if __hole is now a leaf, we're done
- if (__child > (__len - 2) / 2)
- return __hole;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _RandomAccessIterator __floyd_sift_down(
+ _RandomAccessIterator __first,
+ _Compare&& __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
+ using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
+ _LIBCPP_ASSERT_UNCATEGORIZED(__len >= 2, "shouldn't be called unless __len >= 2");
+
+ _RandomAccessIterator __hole = __first;
+ _RandomAccessIterator __child_i = __first;
+ difference_type __child = 0;
+
+ while (true) {
+ __child_i += difference_type(__child + 1);
+ __child = 2 * __child + 1;
+
+ if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
+ // right-child exists and is greater than left-child
+ ++__child_i;
+ ++__child;
}
+
+ // swap __hole with its largest child
+ *__hole = _IterOps<_AlgPolicy>::__iter_move(__child_i);
+ __hole = __child_i;
+
+ // if __hole is now a leaf, we're done
+ if (__child > (__len - 2) / 2)
+ return __hole;
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sort.h b/contrib/llvm-project/libcxx/include/__algorithm/sort.h
index 567c988ff0d3..1b878c33c7a1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sort.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sort.h
@@ -44,49 +44,47 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// stable, 2-3 compares, 0-2 swaps
template <class _AlgPolicy, class _Compare, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z,
- _Compare __c) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 unsigned
+__sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, _Compare __c) {
using _Ops = _IterOps<_AlgPolicy>;
unsigned __r = 0;
- if (!__c(*__y, *__x)) // if x <= y
+ if (!__c(*__y, *__x)) // if x <= y
{
- if (!__c(*__z, *__y)) // if y <= z
- return __r; // x <= y && y <= z
- // x <= y && y > z
- _Ops::iter_swap(__y, __z); // x <= z && y < z
+ if (!__c(*__z, *__y)) // if y <= z
+ return __r; // x <= y && y <= z
+ // x <= y && y > z
+ _Ops::iter_swap(__y, __z); // x <= z && y < z
__r = 1;
- if (__c(*__y, *__x)) // if x > y
+ if (__c(*__y, *__x)) // if x > y
{
- _Ops::iter_swap(__x, __y); // x < y && y <= z
+ _Ops::iter_swap(__x, __y); // x < y && y <= z
__r = 2;
}
- return __r; // x <= y && y < z
+ return __r; // x <= y && y < z
}
- if (__c(*__z, *__y)) // x > y, if y > z
+ if (__c(*__z, *__y)) // x > y, if y > z
{
- _Ops::iter_swap(__x, __z); // x < y && y < z
+ _Ops::iter_swap(__x, __z); // x < y && y < z
__r = 1;
return __r;
}
- _Ops::iter_swap(__x, __y); // x > y && y <= z
- __r = 1; // x < y && x <= z
- if (__c(*__z, *__y)) // if y > z
+ _Ops::iter_swap(__x, __y); // x > y && y <= z
+ __r = 1; // x < y && x <= z
+ if (__c(*__z, *__y)) // if y > z
{
- _Ops::iter_swap(__y, __z); // x <= y && y < z
+ _Ops::iter_swap(__y, __z); // x <= y && y < z
__r = 2;
}
return __r;
-} // x <= y && y <= z
+} // x <= y && y <= z
// stable, 3-6 compares, 0-5 swaps
template <class _AlgPolicy, class _Compare, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4,
- _Compare __c) {
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI void
+__sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _Compare __c) {
+ using _Ops = _IterOps<_AlgPolicy>;
std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
if (__c(*__x4, *__x3)) {
_Ops::iter_swap(__x3, __x4);
@@ -102,8 +100,13 @@ void __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3
// stable, 4-10 compares, 0-9 swaps
template <class _AlgPolicy, class _Comp, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI void __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
- _ForwardIterator __x4, _ForwardIterator __x5, _Comp __comp) {
+_LIBCPP_HIDE_FROM_ABI void
+__sort5(_ForwardIterator __x1,
+ _ForwardIterator __x2,
+ _ForwardIterator __x3,
+ _ForwardIterator __x4,
+ _ForwardIterator __x5,
+ _Comp __comp) {
using _Ops = _IterOps<_AlgPolicy>;
std::__sort4<_AlgPolicy, _Comp>(__x1, __x2, __x3, __x4, __comp);
@@ -139,8 +142,9 @@ struct __is_simple_comparator<ranges::greater&> : true_type {};
template <class _Compare, class _Iter, class _Tp = typename iterator_traits<_Iter>::value_type>
using __use_branchless_sort =
- integral_constant<bool, __libcpp_is_contiguous_iterator<_Iter>::value && sizeof(_Tp) <= sizeof(void*) &&
- is_arithmetic<_Tp>::value && __is_simple_comparator<_Compare>::value>;
+ integral_constant<bool,
+ __libcpp_is_contiguous_iterator<_Iter>::value && sizeof(_Tp) <= sizeof(void*) &&
+ is_arithmetic<_Tp>::value && __is_simple_comparator<_Compare>::value>;
namespace __detail {
@@ -154,49 +158,56 @@ template <class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI void __cond_swap(_RandomAccessIterator __x, _RandomAccessIterator __y, _Compare __c) {
// Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
- bool __r = __c(*__x, *__y);
+ bool __r = __c(*__x, *__y);
value_type __tmp = __r ? *__x : *__y;
- *__y = __r ? *__y : *__x;
- *__x = __tmp;
+ *__y = __r ? *__y : *__x;
+ *__x = __tmp;
}
// Ensures that *__x, *__y and *__z are ordered according to the comparator __c,
// under the assumption that *__y and *__z are already ordered.
template <class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI void __partially_sorted_swap(_RandomAccessIterator __x, _RandomAccessIterator __y,
- _RandomAccessIterator __z, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void
+__partially_sorted_swap(_RandomAccessIterator __x, _RandomAccessIterator __y, _RandomAccessIterator __z, _Compare __c) {
// Note: this function behaves correctly even with proxy iterators (because it relies on `value_type`).
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
- bool __r = __c(*__z, *__x);
+ bool __r = __c(*__z, *__x);
value_type __tmp = __r ? *__z : *__x;
- *__z = __r ? *__x : *__z;
- __r = __c(__tmp, *__y);
- *__x = __r ? *__x : *__y;
- *__y = __r ? *__y : __tmp;
+ *__z = __r ? *__x : *__z;
+ __r = __c(__tmp, *__y);
+ *__x = __r ? *__x : *__y;
+ *__y = __r ? *__y : __tmp;
}
-template <class, class _Compare, class _RandomAccessIterator,
+template <class,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort3_maybe_branchless(
+ _RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _Compare __c) {
std::__cond_swap<_Compare>(__x2, __x3, __c);
std::__partially_sorted_swap<_Compare>(__x1, __x2, __x3, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort3_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort3_maybe_branchless(
+ _RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _Compare __c) {
std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c);
}
-template <class, class _Compare, class _RandomAccessIterator,
+template <class,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _RandomAccessIterator __x4, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort4_maybe_branchless(
+ _RandomAccessIterator __x1,
+ _RandomAccessIterator __x2,
+ _RandomAccessIterator __x3,
+ _RandomAccessIterator __x4,
+ _Compare __c) {
std::__cond_swap<_Compare>(__x1, __x3, __c);
std::__cond_swap<_Compare>(__x2, __x4, __c);
std::__cond_swap<_Compare>(__x1, __x2, __c);
@@ -204,18 +215,24 @@ __sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2,
std::__cond_swap<_Compare>(__x2, __x3, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort4_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _RandomAccessIterator __x4, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort4_maybe_branchless(
+ _RandomAccessIterator __x1,
+ _RandomAccessIterator __x2,
+ _RandomAccessIterator __x3,
+ _RandomAccessIterator __x4,
+ _Compare __c) {
std::__sort4<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort5_maybe_branchless(
+inline _LIBCPP_HIDE_FROM_ABI void __sort5_maybe_branchless(
_RandomAccessIterator __x1,
_RandomAccessIterator __x2,
_RandomAccessIterator __x3,
@@ -230,20 +247,25 @@ __sort5_maybe_branchless(
std::__partially_sorted_swap<_Compare>(__x2, __x3, __x4, __c);
}
-template <class _AlgPolicy, class _Compare, class _RandomAccessIterator,
+template <class _AlgPolicy,
+ class _Compare,
+ class _RandomAccessIterator,
__enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
-__sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3,
- _RandomAccessIterator __x4, _RandomAccessIterator __x5, _Compare __c) {
+inline _LIBCPP_HIDE_FROM_ABI void __sort5_maybe_branchless(
+ _RandomAccessIterator __x1,
+ _RandomAccessIterator __x2,
+ _RandomAccessIterator __x3,
+ _RandomAccessIterator __x4,
+ _RandomAccessIterator __x5,
+ _Compare __c) {
std::__sort5<_AlgPolicy, _Compare, _RandomAccessIterator>(
std::move(__x1), std::move(__x2), std::move(__x3), std::move(__x4), std::move(__x5), __c);
}
// Assumes size > 0
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14 void __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last,
- _Compare __comp) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
_BidirectionalIterator __lm1 = __last;
for (--__lm1; __first != __lm1; ++__first) {
_BidirectionalIterator __i = std::__min_element<_Compare>(__first, __last, __comp);
@@ -255,8 +277,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 void __selection_sort(_BidirectionalIterator __fir
// Sort the iterator range [__first, __last) using the comparator __comp using
// the insertion sort algorithm.
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
+_LIBCPP_HIDE_FROM_ABI void
+__insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
@@ -292,16 +314,17 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
if (__first == __last)
return;
- const _RandomAccessIterator __leftmost = __first - difference_type(1); (void)__leftmost; // can be unused when assertions are disabled
+ const _RandomAccessIterator __leftmost = __first - difference_type(1);
+ (void)__leftmost; // can be unused when assertions are disabled
for (_RandomAccessIterator __i = __first + difference_type(1); __i != __last; ++__i) {
_RandomAccessIterator __j = __i - difference_type(1);
if (__comp(*__i, *__j)) {
value_type __t(_Ops::__iter_move(__i));
_RandomAccessIterator __k = __j;
- __j = __i;
+ __j = __i;
do {
*__j = _Ops::__iter_move(__k);
- __j = __k;
+ __j = __k;
_LIBCPP_ASSERT_UNCATEGORIZED(
__k != __leftmost,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
@@ -312,8 +335,8 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte
}
template <class _AlgPolicy, class _Comp, class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI bool __insertion_sort_incomplete(
- _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
+_LIBCPP_HIDE_FROM_ABI bool
+__insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -334,23 +357,27 @@ _LIBCPP_HIDE_FROM_ABI bool __insertion_sort_incomplete(
return true;
case 5:
std::__sort5_maybe_branchless<_AlgPolicy, _Comp>(
- __first, __first + difference_type(1), __first + difference_type(2), __first + difference_type(3),
- --__last, __comp);
+ __first,
+ __first + difference_type(1),
+ __first + difference_type(2),
+ __first + difference_type(3),
+ --__last,
+ __comp);
return true;
}
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
_RandomAccessIterator __j = __first + difference_type(2);
std::__sort3_maybe_branchless<_AlgPolicy, _Comp>(__first, __first + difference_type(1), __j, __comp);
const unsigned __limit = 8;
- unsigned __count = 0;
+ unsigned __count = 0;
for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) {
if (__comp(*__i, *__j)) {
value_type __t(_Ops::__iter_move(__i));
_RandomAccessIterator __k = __j;
- __j = __i;
+ __j = __i;
do {
*__j = _Ops::__iter_move(__k);
- __j = __k;
+ __j = __k;
} while (__j != __first && __comp(__t, *--__k));
*__j = std::move(__t);
if (++__count == __limit)
@@ -507,8 +534,9 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
_LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), "");
- const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
- const _RandomAccessIterator __end = __last; (void)__end; //
+ const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
+ const _RandomAccessIterator __end = __last;
+ (void)__end; //
value_type __pivot(_Ops::__iter_move(__first));
// Find the first element greater than the pivot.
@@ -598,8 +626,9 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
_LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), "");
- const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
- const _RandomAccessIterator __end = __last; (void)__end; //
+ const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
+ const _RandomAccessIterator __end = __last;
+ (void)__end; //
value_type __pivot(_Ops::__iter_move(__first));
// Find the first element greater or equal to the pivot. It will be always
// guarded because __introsort will do the median-of-three before calling
@@ -665,8 +694,9 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
// TODO(LLVM18): Make __begin const, see https://reviews.llvm.org/D147089#4349748
- _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
- const _RandomAccessIterator __end = __last; (void)__end; //
+ _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around
+ const _RandomAccessIterator __end = __last;
+ (void)__end; //
value_type __pivot(_Ops::__iter_move(__first));
if (__comp(__pivot, *(__last - difference_type(1)))) {
// Guarded.
@@ -753,8 +783,12 @@ void __introsort(_RandomAccessIterator __first,
return;
case 5:
std::__sort5_maybe_branchless<_AlgPolicy, _Compare>(
- __first, __first + difference_type(1), __first + difference_type(2), __first + difference_type(3),
- --__last, __comp);
+ __first,
+ __first + difference_type(1),
+ __first + difference_type(2),
+ __first + difference_type(3),
+ --__last,
+ __comp);
return;
}
// Use insertion sort if the length of the range is below the specified limit.
@@ -803,10 +837,10 @@ void __introsort(_RandomAccessIterator __first,
continue;
}
// Use bitset partition only if asked for.
- auto __ret =
- _UseBitSetPartition
- ? std::__bitset_partition<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp)
- : std::__partition_with_equals_on_right<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp);
+ auto __ret = _UseBitSetPartition
+ ? std::__bitset_partition<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp)
+ : std::__partition_with_equals_on_right<_AlgPolicy, _RandomAccessIterator, _Compare>(
+ __first, __last, __comp);
_RandomAccessIterator __i = __ret.first;
// [__first, __i) < *__i and *__i <= [__i+1, __last)
// If we were given a perfect partition, see if insertion sort is quick...
@@ -858,19 +892,27 @@ extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<char>&, char*>(char
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
#endif
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<unsigned long long>&, unsigned long long*>(
+ unsigned long long*, unsigned long long*, __less<unsigned long long>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
-extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
+extern template _LIBCPP_EXPORTED_FROM_ABI void
+__sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
@@ -884,8 +926,7 @@ __sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
std::__introsort<_AlgPolicy,
_Comp&,
_RandomAccessIterator,
- __use_branchless_sort<_Comp, _RandomAccessIterator>::value>(
- __first, __last, __comp, __depth_limit);
+ __use_branchless_sort<_Comp, _RandomAccessIterator>::value>(__first, __last, __comp, __depth_limit);
}
template <class _Type, class... _Options>
@@ -941,8 +982,8 @@ _LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, ranges
#endif
template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
if (__libcpp_is_constant_evaluated()) {
@@ -955,14 +996,14 @@ void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
}
template <class _RandomAccessIterator, class _Comp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
std::__sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::sort(__first, __last, __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h b/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h
index a82926ed1cca..0a6d992d0090 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sort_heap.h
@@ -27,20 +27,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
- _RandomAccessIterator __saved_last = __last;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
+ _RandomAccessIterator __saved_last = __last;
__comp_ref_type<_Compare> __comp_ref = __comp;
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
- for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n)
+ for (difference_type __n = __last - __first; __n > 1; --__last, (void)--__n)
std::__pop_heap<_AlgPolicy>(__first, __last, __comp_ref, __n);
std::__check_strict_weak_ordering_sorted(__first, __saved_last, __comp_ref);
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
@@ -48,8 +48,8 @@ void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::sort_heap(std::move(__first), std::move(__last), __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h b/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h
index 0e92a0a5f73d..8762abcf18e1 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/stable_partition.h
@@ -29,296 +29,269 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Distance, class _Pair>
-_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
- _Distance __len, _Pair __p, forward_iterator_tag __fit)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _Predicate __pred,
+ _Distance __len,
+ _Pair __p,
+ forward_iterator_tag __fit) {
+ using _Ops = _IterOps<_AlgPolicy>;
- // *__first is known to be false
- // __len >= 1
- if (__len == 1)
- return __first;
- if (__len == 2)
- {
- _ForwardIterator __m = __first;
- if (__pred(*++__m))
- {
- _Ops::iter_swap(__first, __m);
- return __m;
- }
- return __first;
+ // *__first is known to be false
+ // __len >= 1
+ if (__len == 1)
+ return __first;
+ if (__len == 2) {
+ _ForwardIterator __m = __first;
+ if (__pred(*++__m)) {
+ _Ops::iter_swap(__first, __m);
+ return __m;
}
- if (__len <= __p.second)
- { // The buffer is big enough to use
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
- // Move the falses into the temporary buffer, and the trues to the front of the line
- // Update __first to always point to the end of the trues
- value_type* __t = __p.first;
- ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ return __first;
+ }
+ if (__len <= __p.second) { // The buffer is big enough to use
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
+ // Move the falses into the temporary buffer, and the trues to the front of the line
+ // Update __first to always point to the end of the trues
+ value_type* __t = __p.first;
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ __d.template __incr<value_type>();
+ ++__t;
+ _ForwardIterator __i = __first;
+ while (++__i != __last) {
+ if (__pred(*__i)) {
+ *__first = _Ops::__iter_move(__i);
+ ++__first;
+ } else {
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
__d.template __incr<value_type>();
++__t;
- _ForwardIterator __i = __first;
- while (++__i != __last)
- {
- if (__pred(*__i))
- {
- *__first = _Ops::__iter_move(__i);
- ++__first;
- }
- else
- {
- ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
- __d.template __incr<value_type>();
- ++__t;
- }
- }
- // All trues now at start of range, all falses in buffer
- // Move falses back into range, but don't mess up __first which points to first false
- __i = __first;
- for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
- *__i = _Ops::__iter_move(__t2);
- // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
- return __first;
- }
- // Else not enough buffer, do in place
- // __len >= 3
- _ForwardIterator __m = __first;
- _Distance __len2 = __len / 2; // __len2 >= 2
- _Ops::advance(__m, __len2);
- // recurse on [__first, __m), *__first know to be false
- // F?????????????????
- // f m l
- _ForwardIterator __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __first, __m, __pred, __len2, __p, __fit);
- // TTTFFFFF??????????
- // f ff m l
- // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
- _ForwardIterator __m1 = __m;
- _ForwardIterator __second_false = __last;
- _Distance __len_half = __len - __len2;
- while (__pred(*__m1))
- {
- if (++__m1 == __last)
- goto __second_half_done;
- --__len_half;
+ }
}
- // TTTFFFFFTTTF??????
- // f ff m m1 l
- __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __m1, __last, __pred, __len_half, __p, __fit);
+ // All trues now at start of range, all falses in buffer
+ // Move falses back into range, but don't mess up __first which points to first false
+ __i = __first;
+ for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void)++__i)
+ *__i = _Ops::__iter_move(__t2);
+ // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
+ return __first;
+ }
+ // Else not enough buffer, do in place
+ // __len >= 3
+ _ForwardIterator __m = __first;
+ _Distance __len2 = __len / 2; // __len2 >= 2
+ _Ops::advance(__m, __len2);
+ // recurse on [__first, __m), *__first know to be false
+ // F?????????????????
+ // f m l
+ _ForwardIterator __first_false =
+ std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__first, __m, __pred, __len2, __p, __fit);
+ // TTTFFFFF??????????
+ // f ff m l
+ // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
+ _ForwardIterator __m1 = __m;
+ _ForwardIterator __second_false = __last;
+ _Distance __len_half = __len - __len2;
+ while (__pred(*__m1)) {
+ if (++__m1 == __last)
+ goto __second_half_done;
+ --__len_half;
+ }
+ // TTTFFFFFTTTF??????
+ // f ff m m1 l
+ __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__m1, __last, __pred, __len_half, __p, __fit);
__second_half_done:
- // TTTFFFFFTTTTTFFFFF
- // f ff m sf l
- return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
- // TTTTTTTTFFFFFFFFFF
- // |
+ // TTTFFFFFTTTTTFFFFF
+ // f ff m sf l
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
+ // TTTTTTTTFFFFFFFFFF
+ // |
}
template <class _AlgPolicy, class _Predicate, class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
- forward_iterator_tag)
-{
- typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
- typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) {
+ typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- const difference_type __alloc_limit = 3; // might want to make this a function of trivial assignment
- // Either prove all true and return __first or point to first false
- while (true)
- {
- if (__first == __last)
- return __first;
- if (!__pred(*__first))
- break;
- ++__first;
- }
- // We now have a reduced range [__first, __last)
- // *__first is known to be false
- difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last);
- pair<value_type*, ptrdiff_t> __p(0, 0);
- unique_ptr<value_type, __return_temporary_buffer> __h;
- if (__len >= __alloc_limit)
- {
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __p = std::get_temporary_buffer<value_type>(__len);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __h.reset(__p.first);
- }
- return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- std::move(__first), std::move(__last), __pred, __len, __p, forward_iterator_tag());
+ const difference_type __alloc_limit = 3; // might want to make this a function of trivial assignment
+ // Either prove all true and return __first or point to first false
+ while (true) {
+ if (__first == __last)
+ return __first;
+ if (!__pred(*__first))
+ break;
+ ++__first;
+ }
+ // We now have a reduced range [__first, __last)
+ // *__first is known to be false
+ difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last);
+ pair<value_type*, ptrdiff_t> __p(0, 0);
+ unique_ptr<value_type, __return_temporary_buffer> __h;
+ if (__len >= __alloc_limit) {
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __p = std::get_temporary_buffer<value_type>(__len);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __h.reset(__p.first);
+ }
+ return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ std::move(__first), std::move(__last), __pred, __len, __p, forward_iterator_tag());
}
template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator, class _Distance, class _Pair>
-_BidirectionalIterator
-__stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
- _Distance __len, _Pair __p, bidirectional_iterator_tag __bit)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_BidirectionalIterator __stable_partition_impl(
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __last,
+ _Predicate __pred,
+ _Distance __len,
+ _Pair __p,
+ bidirectional_iterator_tag __bit) {
+ using _Ops = _IterOps<_AlgPolicy>;
- // *__first is known to be false
- // *__last is known to be true
- // __len >= 2
- if (__len == 2)
- {
- _Ops::iter_swap(__first, __last);
- return __last;
- }
- if (__len == 3)
- {
- _BidirectionalIterator __m = __first;
- if (__pred(*++__m))
- {
- _Ops::iter_swap(__first, __m);
- _Ops::iter_swap(__m, __last);
- return __last;
- }
- _Ops::iter_swap(__m, __last);
- _Ops::iter_swap(__first, __m);
- return __m;
+ // *__first is known to be false
+ // *__last is known to be true
+ // __len >= 2
+ if (__len == 2) {
+ _Ops::iter_swap(__first, __last);
+ return __last;
+ }
+ if (__len == 3) {
+ _BidirectionalIterator __m = __first;
+ if (__pred(*++__m)) {
+ _Ops::iter_swap(__first, __m);
+ _Ops::iter_swap(__m, __last);
+ return __last;
}
- if (__len <= __p.second)
- { // The buffer is big enough to use
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
- // Move the falses into the temporary buffer, and the trues to the front of the line
- // Update __first to always point to the end of the trues
- value_type* __t = __p.first;
- ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ _Ops::iter_swap(__m, __last);
+ _Ops::iter_swap(__first, __m);
+ return __m;
+ }
+ if (__len <= __p.second) { // The buffer is big enough to use
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h(__p.first, __d);
+ // Move the falses into the temporary buffer, and the trues to the front of the line
+ // Update __first to always point to the end of the trues
+ value_type* __t = __p.first;
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__first));
+ __d.template __incr<value_type>();
+ ++__t;
+ _BidirectionalIterator __i = __first;
+ while (++__i != __last) {
+ if (__pred(*__i)) {
+ *__first = _Ops::__iter_move(__i);
+ ++__first;
+ } else {
+ ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
__d.template __incr<value_type>();
++__t;
- _BidirectionalIterator __i = __first;
- while (++__i != __last)
- {
- if (__pred(*__i))
- {
- *__first = _Ops::__iter_move(__i);
- ++__first;
- }
- else
- {
- ::new ((void*)__t) value_type(_Ops::__iter_move(__i));
- __d.template __incr<value_type>();
- ++__t;
- }
- }
- // move *__last, known to be true
- *__first = _Ops::__iter_move(__i);
- __i = ++__first;
- // All trues now at start of range, all falses in buffer
- // Move falses back into range, but don't mess up __first which points to first false
- for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
- *__i = _Ops::__iter_move(__t2);
- // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
- return __first;
- }
- // Else not enough buffer, do in place
- // __len >= 4
- _BidirectionalIterator __m = __first;
- _Distance __len2 = __len / 2; // __len2 >= 2
- _Ops::advance(__m, __len2);
- // recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be false
- // F????????????????T
- // f m l
- _BidirectionalIterator __m1 = __m;
- _BidirectionalIterator __first_false = __first;
- _Distance __len_half = __len2;
- while (!__pred(*--__m1))
- {
- if (__m1 == __first)
- goto __first_half_done;
- --__len_half;
+ }
}
- // F???TFFF?????????T
- // f m1 m l
- __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __first, __m1, __pred, __len_half, __p, __bit);
+ // move *__last, known to be true
+ *__first = _Ops::__iter_move(__i);
+ __i = ++__first;
+ // All trues now at start of range, all falses in buffer
+ // Move falses back into range, but don't mess up __first which points to first false
+ for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void)++__i)
+ *__i = _Ops::__iter_move(__t2);
+ // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
+ return __first;
+ }
+ // Else not enough buffer, do in place
+ // __len >= 4
+ _BidirectionalIterator __m = __first;
+ _Distance __len2 = __len / 2; // __len2 >= 2
+ _Ops::advance(__m, __len2);
+ // recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be false
+ // F????????????????T
+ // f m l
+ _BidirectionalIterator __m1 = __m;
+ _BidirectionalIterator __first_false = __first;
+ _Distance __len_half = __len2;
+ while (!__pred(*--__m1)) {
+ if (__m1 == __first)
+ goto __first_half_done;
+ --__len_half;
+ }
+ // F???TFFF?????????T
+ // f m1 m l
+ __first_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__first, __m1, __pred, __len_half, __p, __bit);
__first_half_done:
- // TTTFFFFF?????????T
- // f ff m l
- // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
- __m1 = __m;
- _BidirectionalIterator __second_false = __last;
- ++__second_false;
- __len_half = __len - __len2;
- while (__pred(*__m1))
- {
- if (++__m1 == __last)
- goto __second_half_done;
- --__len_half;
- }
- // TTTFFFFFTTTF?????T
- // f ff m m1 l
- __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- __m1, __last, __pred, __len_half, __p, __bit);
+ // TTTFFFFF?????????T
+ // f ff m l
+ // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true
+ __m1 = __m;
+ _BidirectionalIterator __second_false = __last;
+ ++__second_false;
+ __len_half = __len - __len2;
+ while (__pred(*__m1)) {
+ if (++__m1 == __last)
+ goto __second_half_done;
+ --__len_half;
+ }
+ // TTTFFFFFTTTF?????T
+ // f ff m m1 l
+ __second_false = std::__stable_partition_impl<_AlgPolicy, _Predicate&>(__m1, __last, __pred, __len_half, __p, __bit);
__second_half_done:
- // TTTFFFFFTTTTTFFFFF
- // f ff m sf l
- return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
- // TTTTTTTTFFFFFFFFFF
- // |
+ // TTTFFFFFTTTTTFFFFF
+ // f ff m sf l
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
+ // TTTTTTTTFFFFFFFFFF
+ // |
}
template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI _BidirectionalIterator
-__stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
- bidirectional_iterator_tag)
-{
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
- const difference_type __alloc_limit = 4; // might want to make this a function of trivial assignment
- // Either prove all true and return __first or point to first false
- while (true)
- {
- if (__first == __last)
- return __first;
- if (!__pred(*__first))
- break;
- ++__first;
- }
- // __first points to first false, everything prior to __first is already set.
- // Either prove [__first, __last) is all false and return __first, or point __last to last true
- do
- {
- if (__first == --__last)
- return __first;
- } while (!__pred(*__last));
- // We now have a reduced range [__first, __last]
- // *__first is known to be false
- // *__last is known to be true
- // __len >= 2
- difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last) + 1;
- pair<value_type*, ptrdiff_t> __p(0, 0);
- unique_ptr<value_type, __return_temporary_buffer> __h;
- if (__len >= __alloc_limit)
- {
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __p = std::get_temporary_buffer<value_type>(__len);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __h.reset(__p.first);
- }
- return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
- std::move(__first), std::move(__last), __pred, __len, __p, bidirectional_iterator_tag());
+_LIBCPP_HIDE_FROM_ABI _BidirectionalIterator __stable_partition_impl(
+ _BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, bidirectional_iterator_tag) {
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ const difference_type __alloc_limit = 4; // might want to make this a function of trivial assignment
+ // Either prove all true and return __first or point to first false
+ while (true) {
+ if (__first == __last)
+ return __first;
+ if (!__pred(*__first))
+ break;
+ ++__first;
+ }
+ // __first points to first false, everything prior to __first is already set.
+ // Either prove [__first, __last) is all false and return __first, or point __last to last true
+ do {
+ if (__first == --__last)
+ return __first;
+ } while (!__pred(*__last));
+ // We now have a reduced range [__first, __last]
+ // *__first is known to be false
+ // *__last is known to be true
+ // __len >= 2
+ difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last) + 1;
+ pair<value_type*, ptrdiff_t> __p(0, 0);
+ unique_ptr<value_type, __return_temporary_buffer> __h;
+ if (__len >= __alloc_limit) {
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __p = std::get_temporary_buffer<value_type>(__len);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __h.reset(__p.first);
+ }
+ return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
+ std::move(__first), std::move(__last), __pred, __len, __p, bidirectional_iterator_tag());
}
template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _IterCategory>
-_LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __stable_partition(
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition(
_ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred, _IterCategory __iter_category) {
return std::__stable_partition_impl<_AlgPolicy, __remove_cvref_t<_Predicate>&>(
std::move(__first), std::move(__last), __pred, __iter_category);
}
template <class _ForwardIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator
-stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
-{
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
return std::__stable_partition<_ClassicAlgPolicy, _Predicate&>(
std::move(__first), std::move(__last), __pred, _IterCategory());
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h b/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h
index 175393fc4777..ffc6e4ce2818 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/stable_sort.h
@@ -32,9 +32,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI
-void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1,
- typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) {
+_LIBCPP_HIDE_FROM_ABI void __insertion_sort_move(
+ _BidirectionalIterator __first1,
+ _BidirectionalIterator __last1,
+ typename iterator_traits<_BidirectionalIterator>::value_type* __first2,
+ _Compare __comp) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
@@ -63,200 +65,187 @@ void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterat
}
template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2>
-_LIBCPP_HIDE_FROM_ABI void
-__merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2,
- typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI void __merge_move_construct(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ typename iterator_traits<_InputIterator1>::value_type* __result,
+ _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
- typedef typename iterator_traits<_InputIterator1>::value_type value_type;
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h(__result, __d);
- for (; true; ++__result)
- {
- if (__first1 == __last1)
- {
- for (; __first2 != __last2; ++__first2, (void) ++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
- __h.release();
- return;
- }
- if (__first2 == __last2)
- {
- for (; __first1 != __last1; ++__first1, (void) ++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
- __h.release();
- return;
- }
- if (__comp(*__first2, *__first1))
- {
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
- __d.template __incr<value_type>();
- ++__first2;
- }
- else
- {
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
- __d.template __incr<value_type>();
- ++__first1;
- }
+ typedef typename iterator_traits<_InputIterator1>::value_type value_type;
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h(__result, __d);
+ for (; true; ++__result) {
+ if (__first1 == __last1) {
+ for (; __first2 != __last2; ++__first2, (void)++__result, __d.template __incr<value_type>())
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
+ __h.release();
+ return;
+ }
+ if (__first2 == __last2) {
+ for (; __first1 != __last1; ++__first1, (void)++__result, __d.template __incr<value_type>())
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
+ __h.release();
+ return;
}
+ if (__comp(*__first2, *__first1)) {
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
+ __d.template __incr<value_type>();
+ ++__first2;
+ } else {
+ ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
+ __d.template __incr<value_type>();
+ ++__first1;
+ }
+ }
}
template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI void
-__merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2,
- _OutputIterator __result, _Compare __comp)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+_LIBCPP_HIDE_FROM_ABI void __merge_move_assign(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp) {
+ using _Ops = _IterOps<_AlgPolicy>;
- for (; __first1 != __last1; ++__result)
- {
- if (__first2 == __last2)
- {
- for (; __first1 != __last1; ++__first1, (void) ++__result)
- *__result = _Ops::__iter_move(__first1);
- return;
- }
- if (__comp(*__first2, *__first1))
- {
- *__result = _Ops::__iter_move(__first2);
- ++__first2;
- }
- else
- {
- *__result = _Ops::__iter_move(__first1);
- ++__first1;
- }
+ for (; __first1 != __last1; ++__result) {
+ if (__first2 == __last2) {
+ for (; __first1 != __last1; ++__first1, (void)++__result)
+ *__result = _Ops::__iter_move(__first1);
+ return;
}
- for (; __first2 != __last2; ++__first2, (void) ++__result)
- *__result = _Ops::__iter_move(__first2);
+ if (__comp(*__first2, *__first1)) {
+ *__result = _Ops::__iter_move(__first2);
+ ++__first2;
+ } else {
+ *__result = _Ops::__iter_move(__first1);
+ ++__first1;
+ }
+ }
+ for (; __first2 != __last2; ++__first2, (void)++__result)
+ *__result = _Ops::__iter_move(__first2);
}
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-void
-__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size);
+void __stable_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+ typename iterator_traits<_RandomAccessIterator>::value_type* __buff,
+ ptrdiff_t __buff_size);
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-void
-__stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1, _Compare __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- typename iterator_traits<_RandomAccessIterator>::value_type* __first2)
-{
- using _Ops = _IterOps<_AlgPolicy>;
+void __stable_sort_move(_RandomAccessIterator __first1,
+ _RandomAccessIterator __last1,
+ _Compare __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+ typename iterator_traits<_RandomAccessIterator>::value_type* __first2) {
+ using _Ops = _IterOps<_AlgPolicy>;
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- switch (__len)
- {
- case 0:
- return;
- case 1:
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
- return;
- case 2:
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h2(__first2, __d);
- if (__comp(*--__last1, *__first1))
- {
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
- __d.template __incr<value_type>();
- ++__first2;
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
- }
- else
- {
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
- __d.template __incr<value_type>();
- ++__first2;
- ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
- }
- __h2.release();
- return;
- }
- if (__len <= 8)
- {
- std::__insertion_sort_move<_AlgPolicy, _Compare>(__first1, __last1, __first2, __comp);
- return;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ switch (__len) {
+ case 0:
+ return;
+ case 1:
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
+ return;
+ case 2:
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h2(__first2, __d);
+ if (__comp(*--__last1, *__first1)) {
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
+ __d.template __incr<value_type>();
+ ++__first2;
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
+ } else {
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__first1));
+ __d.template __incr<value_type>();
+ ++__first2;
+ ::new ((void*)__first2) value_type(_Ops::__iter_move(__last1));
}
- typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
- _RandomAccessIterator __m = __first1 + __l2;
- std::__stable_sort<_AlgPolicy, _Compare>(__first1, __m, __comp, __l2, __first2, __l2);
- std::__stable_sort<_AlgPolicy, _Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2);
- std::__merge_move_construct<_AlgPolicy, _Compare>(__first1, __m, __m, __last1, __first2, __comp);
+ __h2.release();
+ return;
+ }
+ if (__len <= 8) {
+ std::__insertion_sort_move<_AlgPolicy, _Compare>(__first1, __last1, __first2, __comp);
+ return;
+ }
+ typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
+ _RandomAccessIterator __m = __first1 + __l2;
+ std::__stable_sort<_AlgPolicy, _Compare>(__first1, __m, __comp, __l2, __first2, __l2);
+ std::__stable_sort<_AlgPolicy, _Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2);
+ std::__merge_move_construct<_AlgPolicy, _Compare>(__first1, __m, __m, __last1, __first2, __comp);
}
template <class _Tp>
-struct __stable_sort_switch
-{
- static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
+struct __stable_sort_switch {
+ static const unsigned value = 128 * is_trivially_copy_assignable<_Tp>::value;
};
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-void
-__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
- typename iterator_traits<_RandomAccessIterator>::difference_type __len,
- typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size)
-{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- switch (__len)
- {
- case 0:
- case 1:
- return;
- case 2:
- if (__comp(*--__last, *__first))
- _IterOps<_AlgPolicy>::iter_swap(__first, __last);
- return;
- }
- if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value))
- {
- std::__insertion_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
- return;
- }
- typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
- _RandomAccessIterator __m = __first + __l2;
- if (__len <= __buff_size)
- {
- __destruct_n __d(0);
- unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
- std::__stable_sort_move<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff);
- __d.__set(__l2, (value_type*)nullptr);
- std::__stable_sort_move<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
- __d.__set(__len, (value_type*)nullptr);
- std::__merge_move_assign<_AlgPolicy, _Compare>(
- __buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
-// std::__merge<_Compare>(move_iterator<value_type*>(__buff),
-// move_iterator<value_type*>(__buff + __l2),
-// move_iterator<_RandomAccessIterator>(__buff + __l2),
-// move_iterator<_RandomAccessIterator>(__buff + __len),
-// __first, __comp);
- return;
- }
- std::__stable_sort<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
- std::__stable_sort<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size);
- std::__inplace_merge<_AlgPolicy>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
+void __stable_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp,
+ typename iterator_traits<_RandomAccessIterator>::difference_type __len,
+ typename iterator_traits<_RandomAccessIterator>::value_type* __buff,
+ ptrdiff_t __buff_size) {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
+ switch (__len) {
+ case 0:
+ case 1:
+ return;
+ case 2:
+ if (__comp(*--__last, *__first))
+ _IterOps<_AlgPolicy>::iter_swap(__first, __last);
+ return;
+ }
+ if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value)) {
+ std::__insertion_sort<_AlgPolicy, _Compare>(__first, __last, __comp);
+ return;
+ }
+ typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
+ _RandomAccessIterator __m = __first + __l2;
+ if (__len <= __buff_size) {
+ __destruct_n __d(0);
+ unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
+ std::__stable_sort_move<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff);
+ __d.__set(__l2, (value_type*)nullptr);
+ std::__stable_sort_move<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff + __l2);
+ __d.__set(__len, (value_type*)nullptr);
+ std::__merge_move_assign<_AlgPolicy, _Compare>(
+ __buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp);
+ // std::__merge<_Compare>(move_iterator<value_type*>(__buff),
+ // move_iterator<value_type*>(__buff + __l2),
+ // move_iterator<_RandomAccessIterator>(__buff + __l2),
+ // move_iterator<_RandomAccessIterator>(__buff + __len),
+ // __first, __comp);
+ return;
+ }
+ std::__stable_sort<_AlgPolicy, _Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
+ std::__stable_sort<_AlgPolicy, _Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size);
+ std::__inplace_merge<_AlgPolicy>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
}
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI
-void __stable_sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
- using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
+inline _LIBCPP_HIDE_FROM_ABI void
+__stable_sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
+ using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
difference_type __len = __last - __first;
pair<value_type*, ptrdiff_t> __buf(0, 0);
unique_ptr<value_type, __return_temporary_buffer> __h;
if (__len > static_cast<difference_type>(__stable_sort_switch<value_type>::value)) {
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __buf = std::get_temporary_buffer<value_type>(__len);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __h.reset(__buf.first);
+ // TODO: Remove the use of std::get_temporary_buffer
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __buf = std::get_temporary_buffer<value_type>(__len);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __h.reset(__buf.first);
}
std::__stable_sort<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __last, __comp, __len, __buf.first, __buf.second);
@@ -264,14 +253,13 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
template <class _RandomAccessIterator, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI
-void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+inline _LIBCPP_HIDE_FROM_ABI void
+stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
std::__stable_sort_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
}
template <class _RandomAccessIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+inline _LIBCPP_HIDE_FROM_ABI void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) {
std::stable_sort(__first, __last, __less<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h b/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h
index 96eba7484bf4..7fab5c49a656 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/swap_ranges.h
@@ -22,8 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// 2+2 iterators: the shorter size will be used.
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _Sentinel2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_ForwardIterator1, _ForwardIterator2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2>
__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _Sentinel2 __last2) {
while (__first1 != __last1 && __first2 != __last2) {
_IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
@@ -36,8 +35,7 @@ __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2
// 2+1 iterators: size2 >= size1.
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_ForwardIterator1, _ForwardIterator2>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2>
__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2) {
while (__first1 != __last1) {
_IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
@@ -51,8 +49,7 @@ __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2
template <class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator2
swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) {
- return std::__swap_ranges<_ClassicAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2)).second;
+ return std::__swap_ranges<_ClassicAlgPolicy>(std::move(__first1), std::move(__last1), std::move(__first2)).second;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/transform.h b/contrib/llvm-project/libcxx/include/__algorithm/transform.h
index 76b9bb780cf9..1b424409591c 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/transform.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/transform.h
@@ -18,24 +18,23 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator, class _UnaryOperation>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op)
-{
- for (; __first != __last; ++__first, (void) ++__result)
- *__result = __op(*__first);
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op) {
+ for (; __first != __last; ++__first, (void)++__result)
+ *__result = __op(*__first);
+ return __result;
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _BinaryOperation>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
- _OutputIterator __result, _BinaryOperation __binary_op)
-{
- for (; __first1 != __last1; ++__first1, (void) ++__first2, ++__result)
- *__result = __binary_op(*__first1, *__first2);
- return __result;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _OutputIterator __result,
+ _BinaryOperation __binary_op) {
+ for (; __first1 != __last1; ++__first1, (void)++__first2, ++__result)
+ *__result = __binary_op(*__first1, *__first2);
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h b/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
index 1f2039949d74..aef0fbfb7c28 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
@@ -20,7 +20,7 @@
#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -41,16 +41,12 @@ private:
public:
using result_type = invoke_result_t<_Gen&>;
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto min() { return __remove_cvref_t<_Gen>::min(); }
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto max() { return __remove_cvref_t<_Gen>::max(); }
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto min() { return __remove_cvref_t<_Gen>::min(); }
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto max() { return __remove_cvref_t<_Gen>::max(); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit _ClassicGenAdaptor(_Gen& __g) : __gen_(__g) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit _ClassicGenAdaptor(_Gen& __g) : __gen_(__g) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()() const { return __gen_(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()() const { return __gen_(); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h b/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
index 91346e3c1bd2..a298a2b27105 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
@@ -57,11 +57,11 @@ struct __unwrap_iter_impl<_Iter, true> {
}
};
-template<class _Iter,
- class _Impl = __unwrap_iter_impl<_Iter>,
- __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-decltype(_Impl::__unwrap(std::declval<_Iter>())) __unwrap_iter(_Iter __i) _NOEXCEPT {
+template <class _Iter,
+ class _Impl = __unwrap_iter_impl<_Iter>,
+ __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 decltype(_Impl::__unwrap(std::declval<_Iter>()))
+__unwrap_iter(_Iter __i) _NOEXCEPT {
return _Impl::__unwrap(__i);
}
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic.h b/contrib/llvm-project/libcxx/include/__atomic/atomic.h
index 449802a2e304..3dfb6937d032 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic.h
@@ -33,241 +33,220 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct atomic
- : public __atomic_base<_Tp>
-{
+struct atomic : public __atomic_base<_Tp> {
using __base = __atomic_base<_Tp>;
using value_type = _Tp;
using difference_type = value_type;
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- atomic() = default;
+ _LIBCPP_HIDE_FROM_ABI atomic() = default;
#else
- _LIBCPP_HIDE_FROM_ABI
- atomic() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default;
#endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __d) volatile _NOEXCEPT
- {__base::store(__d); return __d;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator=(_Tp __d) _NOEXCEPT
- {__base::store(__d); return __d;}
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
- atomic& operator=(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
+ atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
};
// atomic<T*>
template <class _Tp>
-struct atomic<_Tp*>
- : public __atomic_base<_Tp*>
-{
- using __base = __atomic_base<_Tp*>;
- using value_type = _Tp*;
- using difference_type = ptrdiff_t;
-
- _LIBCPP_HIDE_FROM_ABI
- atomic() _NOEXCEPT = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {}
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator=(_Tp* __d) volatile _NOEXCEPT
- {__base::store(__d); return __d;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator=(_Tp* __d) _NOEXCEPT
- {__base::store(__d); return __d;}
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- // __atomic_fetch_add accepts function pointers, guard against them.
- static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++(int) _NOEXCEPT {return fetch_add(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--(int) volatile _NOEXCEPT {return fetch_sub(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--(int) _NOEXCEPT {return fetch_sub(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++() volatile _NOEXCEPT {return fetch_add(1) + 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator++() _NOEXCEPT {return fetch_add(1) + 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--() volatile _NOEXCEPT {return fetch_sub(1) - 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator--() _NOEXCEPT {return fetch_sub(1) - 1;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT {return fetch_sub(__op) - __op;}
-
- atomic& operator=(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
+struct atomic<_Tp*> : public __atomic_base<_Tp*> {
+ using __base = __atomic_base<_Tp*>;
+ using value_type = _Tp*;
+ using difference_type = ptrdiff_t;
+
+ _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __d) volatile _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __d) _NOEXCEPT {
+ __base::store(__d);
+ return __d;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ // __atomic_fetch_add accepts function pointers, guard against them.
+ static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++(int) volatile _NOEXCEPT { return fetch_add(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++(int) _NOEXCEPT { return fetch_add(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--(int) volatile _NOEXCEPT { return fetch_sub(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--(int) _NOEXCEPT { return fetch_sub(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++() volatile _NOEXCEPT { return fetch_add(1) + 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator++() _NOEXCEPT { return fetch_add(1) + 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--() volatile _NOEXCEPT { return fetch_sub(1) - 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator--() _NOEXCEPT { return fetch_sub(1) - 1; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT { return fetch_sub(__op) - __op; }
+
+ atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
};
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
requires is_floating_point_v<_Tp>
struct atomic<_Tp> : __atomic_base<_Tp> {
- private:
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __is_fp80_long_double() {
- // Only x87-fp80 long double has 64-bit mantissa
- return __LDBL_MANT_DIG__ == 64 && std::is_same_v<_Tp, long double>;
- }
+private:
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __is_fp80_long_double() {
+ // Only x87-fp80 long double has 64-bit mantissa
+ return __LDBL_MANT_DIG__ == 64 && std::is_same_v<_Tp, long double>;
+ }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __has_rmw_builtin() {
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __has_rmw_builtin() {
# ifndef _LIBCPP_COMPILER_CLANG_BASED
- return false;
+ return false;
# else
- // The builtin __cxx_atomic_fetch_add errors during compilation for
- // long double on platforms with fp80 format.
- // For more details, see
- // lib/Sema/SemaChecking.cpp function IsAllowedValueType
- // LLVM Parser does not allow atomicrmw with x86_fp80 type.
- // if (ValType->isSpecificBuiltinType(BuiltinType::LongDouble) &&
- // &Context.getTargetInfo().getLongDoubleFormat() ==
- // &llvm::APFloat::x87DoubleExtended())
- // For more info
- // https://github.com/llvm/llvm-project/issues/68602
- // https://reviews.llvm.org/D53965
- return !__is_fp80_long_double();
+ // The builtin __cxx_atomic_fetch_add errors during compilation for
+ // long double on platforms with fp80 format.
+ // For more details, see
+ // lib/Sema/SemaChecking.cpp function IsAllowedValueType
+ // LLVM Parser does not allow atomicrmw with x86_fp80 type.
+ // if (ValType->isSpecificBuiltinType(BuiltinType::LongDouble) &&
+ // &Context.getTargetInfo().getLongDoubleFormat() ==
+ // &llvm::APFloat::x87DoubleExtended())
+ // For more info
+ // https://github.com/llvm/llvm-project/issues/68602
+ // https://reviews.llvm.org/D53965
+ return !__is_fp80_long_double();
# endif
- }
-
- template <class _This, class _Operation, class _BuiltinOp>
- _LIBCPP_HIDE_FROM_ABI static _Tp
- __rmw_op(_This&& __self, _Tp __operand, memory_order __m, _Operation __operation, _BuiltinOp __builtin_op) {
- if constexpr (__has_rmw_builtin()) {
- return __builtin_op(std::addressof(std::forward<_This>(__self).__a_), __operand, __m);
- } else {
- _Tp __old = __self.load(memory_order_relaxed);
- _Tp __new = __operation(__old, __operand);
- while (!__self.compare_exchange_weak(__old, __new, __m, memory_order_relaxed)) {
+ }
+
+ template <class _This, class _Operation, class _BuiltinOp>
+ _LIBCPP_HIDE_FROM_ABI static _Tp
+ __rmw_op(_This&& __self, _Tp __operand, memory_order __m, _Operation __operation, _BuiltinOp __builtin_op) {
+ if constexpr (__has_rmw_builtin()) {
+ return __builtin_op(std::addressof(std::forward<_This>(__self).__a_), __operand, __m);
+ } else {
+ _Tp __old = __self.load(memory_order_relaxed);
+ _Tp __new = __operation(__old, __operand);
+ while (!__self.compare_exchange_weak(__old, __new, __m, memory_order_relaxed)) {
# ifdef _LIBCPP_COMPILER_CLANG_BASED
- if constexpr (__is_fp80_long_double()) {
- // https://github.com/llvm/llvm-project/issues/47978
- // clang bug: __old is not updated on failure for atomic<long double>::compare_exchange_weak
- // Note __old = __self.load(memory_order_relaxed) will not work
- std::__cxx_atomic_load_inplace(std::addressof(__self.__a_), &__old, memory_order_relaxed);
- }
-# endif
- __new = __operation(__old, __operand);
- }
- return __old;
+ if constexpr (__is_fp80_long_double()) {
+ // https://github.com/llvm/llvm-project/issues/47978
+ // clang bug: __old is not updated on failure for atomic<long double>::compare_exchange_weak
+ // Note __old = __self.load(memory_order_relaxed) will not work
+ std::__cxx_atomic_load_inplace(std::addressof(__self.__a_), &__old, memory_order_relaxed);
}
+# endif
+ __new = __operation(__old, __operand);
+ }
+ return __old;
}
+ }
+
+ template <class _This>
+ _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_add(_This&& __self, _Tp __operand, memory_order __m) {
+ auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
+ return std::__cxx_atomic_fetch_add(__a, __builtin_operand, __order);
+ };
+ return __rmw_op(std::forward<_This>(__self), __operand, __m, std::plus<>{}, __builtin_op);
+ }
+
+ template <class _This>
+ _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_sub(_This&& __self, _Tp __operand, memory_order __m) {
+ auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
+ return std::__cxx_atomic_fetch_sub(__a, __builtin_operand, __order);
+ };
+ return __rmw_op(std::forward<_This>(__self), __operand, __m, std::minus<>{}, __builtin_op);
+ }
+
+public:
+ using __base = __atomic_base<_Tp>;
+ using value_type = _Tp;
+ using difference_type = value_type;
- template <class _This>
- _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_add(_This&& __self, _Tp __operand, memory_order __m) {
- auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
- return std::__cxx_atomic_fetch_add(__a, __builtin_operand, __order);
- };
- return __rmw_op(std::forward<_This>(__self), __operand, __m, std::plus<>{}, __builtin_op);
- }
-
- template <class _This>
- _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_sub(_This&& __self, _Tp __operand, memory_order __m) {
- auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) {
- return std::__cxx_atomic_fetch_sub(__a, __builtin_operand, __order);
- };
- return __rmw_op(std::forward<_This>(__self), __operand, __m, std::minus<>{}, __builtin_op);
- }
-
- public:
- using __base = __atomic_base<_Tp>;
- using value_type = _Tp;
- using difference_type = value_type;
-
- _LIBCPP_HIDE_FROM_ABI constexpr atomic() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr atomic(_Tp __d) noexcept : __base(__d) {}
-
- atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile noexcept
- requires __base::is_always_lock_free
- {
- __base::store(__d);
- return __d;
- }
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) noexcept {
- __base::store(__d);
- return __d;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
- requires __base::is_always_lock_free
- {
- return __fetch_add(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
- return __fetch_add(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
- requires __base::is_always_lock_free
- {
- return __fetch_sub(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
- return __fetch_sub(*this, __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) volatile noexcept
- requires __base::is_always_lock_free
- {
- return fetch_add(__op) + __op;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) noexcept { return fetch_add(__op) + __op; }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) volatile noexcept
- requires __base::is_always_lock_free
- {
- return fetch_sub(__op) - __op;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) noexcept { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI constexpr atomic() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr atomic(_Tp __d) noexcept : __base(__d) {}
+
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ __base::store(__d);
+ return __d;
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) noexcept {
+ __base::store(__d);
+ return __d;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return __fetch_add(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
+ return __fetch_add(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return __fetch_sub(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {
+ return __fetch_sub(*this, __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return fetch_add(__op) + __op;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) noexcept { return fetch_add(__op) + __op; }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) volatile noexcept
+ requires __base::is_always_lock_free
+ {
+ return fetch_sub(__op) - __op;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) noexcept { return fetch_sub(__op) - __op; }
};
#endif // _LIBCPP_STD_VER >= 20
@@ -275,476 +254,363 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
// atomic_is_lock_free
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->is_lock_free();
+_LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->is_lock_free();
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->is_lock_free();
+_LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->is_lock_free();
}
// atomic_init
template <class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI
-void
-atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
+_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void
+atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
}
template <class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI
-void
-atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
+_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void
+atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ std::__cxx_atomic_init(std::addressof(__o->__a_), __d);
}
// atomic_store
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
-atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- __o->store(__d);
+_LIBCPP_HIDE_FROM_ABI void atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ __o->store(__d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
-atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- __o->store(__d);
+_LIBCPP_HIDE_FROM_ABI void atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ __o->store(__d);
}
// atomic_store_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
+_LIBCPP_HIDE_FROM_ABI void
atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
-{
- __o->store(__d, __m);
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ __o->store(__d, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
+_LIBCPP_HIDE_FROM_ABI void
atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
-{
- __o->store(__d, __m);
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ __o->store(__d, __m);
}
// atomic_load
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->load();
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->load();
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
-{
- return __o->load();
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load(const atomic<_Tp>* __o) _NOEXCEPT {
+ return __o->load();
}
// atomic_load_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->load(__m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->load(__m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->load(__m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->load(__m);
}
// atomic_exchange
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->exchange(__d);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->exchange(__d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->exchange(__d);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->exchange(__d);
}
// atomic_exchange_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
-{
- return __o->exchange(__d, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT {
+ return __o->exchange(__d, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
-{
- return __o->exchange(__d, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT {
+ return __o->exchange(__d, __m);
}
// atomic_compare_exchange_weak
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_weak(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_weak(*__e, __d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_weak(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak(
+ atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_weak(*__e, __d);
}
// atomic_compare_exchange_strong
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_strong(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_strong(*__e, __d);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
-{
- return __o->compare_exchange_strong(*__e, __d);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong(
+ atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT {
+ return __o->compare_exchange_strong(*__e, __d);
}
// atomic_compare_exchange_weak_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
- typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_weak(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
+ volatile atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_weak(*__e, __d, __s, __f);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_weak(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
+ atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_weak(*__e, __d, __s, __f);
}
// atomic_compare_exchange_strong_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_strong(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(
+ volatile atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_strong(*__e, __d, __s, __f);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
- typename atomic<_Tp>::value_type __d,
- memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
-{
- return __o->compare_exchange_strong(*__e, __d, __s, __f);
+_LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(
+ atomic<_Tp>* __o,
+ typename atomic<_Tp>::value_type* __e,
+ typename atomic<_Tp>::value_type __d,
+ memory_order __s,
+ memory_order __f) _NOEXCEPT _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return __o->compare_exchange_strong(*__e, __d, __s, __f);
}
// atomic_wait
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait(const volatile atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v) _NOEXCEPT
-{
- return __o->wait(__v);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait(const volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v) _NOEXCEPT {
+ return __o->wait(__v);
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait(const atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v) _NOEXCEPT
-{
- return __o->wait(__v);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v) _NOEXCEPT {
+ return __o->wait(__v);
}
// atomic_wait_explicit
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait_explicit(const volatile atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v,
- memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->wait(__v, __m);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait_explicit(const volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->wait(__v, __m);
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_wait_explicit(const atomic<_Tp>* __o,
- typename atomic<_Tp>::value_type __v,
- memory_order __m) _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
-{
- return __o->wait(__v, __m);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+atomic_wait_explicit(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __v, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return __o->wait(__v, __m);
}
// atomic_notify_one
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_one();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_one();
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_one();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_one();
}
// atomic_notify_all
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_all();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_all();
}
template <class _Tp>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT
-{
- __o->notify_all();
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT {
+ __o->notify_all();
}
// atomic_fetch_add
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_add(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_add(__op);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_add(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_add(__op);
}
// atomic_fetch_add_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_add(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_add_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_add(__op, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_add(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_add(__op, __m);
}
// atomic_fetch_sub
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_sub(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_sub(__op);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
-{
- return __o->fetch_sub(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT {
+ return __o->fetch_sub(__op);
}
// atomic_fetch_sub_explicit
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_sub(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_sub_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_sub(__op, __m);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_sub(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_sub(__op, __m);
}
// atomic_fetch_and
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_and(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_and(__op);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_and(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_and(__op);
}
// atomic_fetch_and_explicit
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_and(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_and_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_and(__op, __m);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_and(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_and(__op, __m);
}
// atomic_fetch_or
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_or(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_or(__op);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_or(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_or(__op);
}
// atomic_fetch_or_explicit
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_or(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_or(__op, __m);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_or(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_or(__op, __m);
}
// atomic_fetch_xor
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_xor(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_xor(__op);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
-{
- return __o->fetch_xor(__op);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT {
+ return __o->fetch_xor(__op);
}
// atomic_fetch_xor_explicit
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_xor(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp atomic_fetch_xor_explicit(
+ volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_xor(__op, __m);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value && !is_same<_Tp, bool>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
-{
- return __o->fetch_xor(__op, __m);
+_LIBCPP_HIDE_FROM_ABI _Tp
+atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT {
+ return __o->fetch_xor(__op, __m);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h
index 775d06d75701..3ad3b562c598 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_base.h
@@ -29,114 +29,109 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
-struct __atomic_base // false
+struct __atomic_base // false
{
- mutable __cxx_atomic_impl<_Tp> __a_;
+ mutable __cxx_atomic_impl<_Tp> __a_;
#if _LIBCPP_STD_VER >= 17
static _LIBCPP_CONSTEXPR bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value;
#endif
- _LIBCPP_HIDE_FROM_ABI
- bool is_lock_free() const volatile _NOEXCEPT
- {return __cxx_atomic_is_lock_free(sizeof(__cxx_atomic_impl<_Tp>));}
- _LIBCPP_HIDE_FROM_ABI
- bool is_lock_free() const _NOEXCEPT
- {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
- _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
- std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
- std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
- return std::__cxx_atomic_load(std::addressof(__a_), __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
- return std::__cxx_atomic_load(std::addressof(__a_), __m);
- }
- _LIBCPP_HIDE_FROM_ABI
- operator _Tp() const volatile _NOEXCEPT {return load();}
- _LIBCPP_HIDE_FROM_ABI
- operator _Tp() const _NOEXCEPT {return load();}
- _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const
- volatile _NOEXCEPT {
- std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
- wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
- std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
- std::__cxx_atomic_notify_one(std::addressof(__a_));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT {
- std::__cxx_atomic_notify_one(std::addressof(__a_));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
- std::__cxx_atomic_notify_all(std::addressof(__a_));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT {
- std::__cxx_atomic_notify_all(std::addressof(__a_));
- }
+ _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const volatile _NOEXCEPT {
+ return __cxx_atomic_is_lock_free(sizeof(__cxx_atomic_impl<_Tp>));
+ }
+ _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const _NOEXCEPT {
+ return static_cast<__atomic_base const volatile*>(this)->is_lock_free();
+ }
+ _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) {
+ std::__cxx_atomic_store(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return std::__cxx_atomic_load(std::addressof(__a_), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) {
+ return std::__cxx_atomic_load(std::addressof(__a_), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI operator _Tp() const volatile _NOEXCEPT { return load(); }
+ _LIBCPP_HIDE_FROM_ABI operator _Tp() const _NOEXCEPT { return load(); }
+ _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m);
+ }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const
+ volatile _NOEXCEPT {
+ std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+ wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
+ std::__cxx_atomic_wait(std::addressof(__a_), __v, __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
+ std::__cxx_atomic_notify_one(std::addressof(__a_));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT {
+ std::__cxx_atomic_notify_one(std::addressof(__a_));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
+ std::__cxx_atomic_notify_all(std::addressof(__a_));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT {
+ std::__cxx_atomic_notify_all(std::addressof(__a_));
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- __atomic_base() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI __atomic_base() _NOEXCEPT = default;
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
- __atomic_base(const __atomic_base&) = delete;
+ __atomic_base(const __atomic_base&) = delete;
};
#if _LIBCPP_STD_VER >= 17
@@ -147,84 +142,62 @@ _LIBCPP_CONSTEXPR bool __atomic_base<_Tp, __b>::is_always_lock_free;
// atomic<Integral>
template <class _Tp>
-struct __atomic_base<_Tp, true>
- : public __atomic_base<_Tp, false>
-{
- using __base = __atomic_base<_Tp, false>;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __atomic_base() _NOEXCEPT = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {}
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
- return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
- return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++(int) _NOEXCEPT {return fetch_add(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--(int) volatile _NOEXCEPT {return fetch_sub(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--(int) _NOEXCEPT {return fetch_sub(_Tp(1));}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++() volatile _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator++() _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--() volatile _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator--() _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator+=(_Tp __op) _NOEXCEPT {return fetch_add(__op) + __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator-=(_Tp __op) _NOEXCEPT {return fetch_sub(__op) - __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator&=(_Tp __op) _NOEXCEPT {return fetch_and(__op) & __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator|=(_Tp __op) _NOEXCEPT {return fetch_or(__op) | __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator^=(_Tp __op) _NOEXCEPT {return fetch_xor(__op) ^ __op;}
+struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> {
+ using __base = __atomic_base<_Tp, false>;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __atomic_base() _NOEXCEPT = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++(int) volatile _NOEXCEPT { return fetch_add(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++(int) _NOEXCEPT { return fetch_add(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--(int) volatile _NOEXCEPT { return fetch_sub(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--(int) _NOEXCEPT { return fetch_sub(_Tp(1)); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++() volatile _NOEXCEPT { return fetch_add(_Tp(1)) + _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator++() _NOEXCEPT { return fetch_add(_Tp(1)) + _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--() volatile _NOEXCEPT { return fetch_sub(_Tp(1)) - _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator--() _NOEXCEPT { return fetch_sub(_Tp(1)) - _Tp(1); }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) volatile _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) _NOEXCEPT { return fetch_add(__op) + __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) volatile _NOEXCEPT { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) _NOEXCEPT { return fetch_sub(__op) - __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator&=(_Tp __op) volatile _NOEXCEPT { return fetch_and(__op) & __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator&=(_Tp __op) _NOEXCEPT { return fetch_and(__op) & __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator|=(_Tp __op) volatile _NOEXCEPT { return fetch_or(__op) | __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator|=(_Tp __op) _NOEXCEPT { return fetch_or(__op) | __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __op) volatile _NOEXCEPT { return fetch_xor(__op) ^ __op; }
+ _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __op) _NOEXCEPT { return fetch_xor(__op) ^ __op; }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h
index edfa978f9935..d76e5e45c01a 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_flag.h
@@ -24,205 +24,135 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct atomic_flag
-{
- __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
-
- _LIBCPP_HIDE_FROM_ABI
- bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
- {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);}
- _LIBCPP_HIDE_FROM_ABI
- bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
- {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);}
-
- _LIBCPP_HIDE_FROM_ABI
- bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
- _LIBCPP_HIDE_FROM_ABI
- bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
- _LIBCPP_HIDE_FROM_ABI
- void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
- _LIBCPP_HIDE_FROM_ABI
- void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
- {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT
- {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_one() volatile _NOEXCEPT
- {__cxx_atomic_notify_one(&__a_);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_one() _NOEXCEPT
- {__cxx_atomic_notify_one(&__a_);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_all() volatile _NOEXCEPT
- {__cxx_atomic_notify_all(&__a_);}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void notify_all() _NOEXCEPT
- {__cxx_atomic_notify_all(&__a_);}
+struct atomic_flag {
+ __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
+
+ _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT {
+ return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
+ return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
+ __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT {
+ __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);
+ }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const
+ volatile _NOEXCEPT {
+ __cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void
+ wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
+ __cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT {
+ __cxx_atomic_notify_one(&__a_);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { __cxx_atomic_notify_one(&__a_); }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT {
+ __cxx_atomic_notify_all(&__a_);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { __cxx_atomic_notify_all(&__a_); }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- atomic_flag() _NOEXCEPT : __a_(false) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr atomic_flag() _NOEXCEPT : __a_(false) {}
#else
- atomic_flag() _NOEXCEPT = default;
+ atomic_flag() _NOEXCEPT = default;
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
-
- atomic_flag(const atomic_flag&) = delete;
- atomic_flag& operator=(const atomic_flag&) = delete;
- atomic_flag& operator=(const atomic_flag&) volatile = delete;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
+ atomic_flag(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) volatile = delete;
};
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT
-{
- return __o->test();
-}
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT { return __o->test(); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test(const atomic_flag* __o) _NOEXCEPT
-{
- return __o->test();
-}
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test(const atomic_flag* __o) _NOEXCEPT { return __o->test(); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_explicit(const volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool
+atomic_flag_test_explicit(const volatile atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_explicit(const atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_explicit(const atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT
-{
- return __o->test_and_set();
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT {
+ return __o->test_and_set();
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT
-{
- return __o->test_and_set();
-}
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT { return __o->test_and_set(); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test_and_set(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool
+atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test_and_set(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- return __o->test_and_set(__m);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ return __o->test_and_set(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT
-{
- __o->clear();
-}
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT { __o->clear(); }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear(atomic_flag* __o) _NOEXCEPT
-{
- __o->clear();
-}
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear(atomic_flag* __o) _NOEXCEPT { __o->clear(); }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- __o->clear(__m);
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ __o->clear(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT
-{
- __o->clear(__m);
+inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT {
+ __o->clear(__m);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT
-{
- __o->wait(__v);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT {
+ __o->wait(__v);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT
-{
- __o->wait(__v);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT {
+ __o->wait(__v);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait_explicit(const volatile atomic_flag* __o,
- bool __v, memory_order __m) _NOEXCEPT
-{
- __o->wait(__v, __m);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait_explicit(const volatile atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT {
+ __o->wait(__v, __m);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_wait_explicit(const atomic_flag* __o,
- bool __v, memory_order __m) _NOEXCEPT
-{
- __o->wait(__v, __m);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_wait_explicit(const atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT {
+ __o->wait(__v, __m);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_one();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT {
+ __o->notify_one();
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_one();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT {
+ __o->notify_one();
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_all();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void
+atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT {
+ __o->notify_all();
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC
-void
-atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT
-{
- __o->notify_all();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT {
+ __o->notify_all();
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h
index d607569ed07d..0715439db450 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_lock_free.h
@@ -16,33 +16,33 @@
#endif
#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
-# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
-# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
-# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
-#endif
-# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
-# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
-# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
-# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
-# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
-# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
-# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
-# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
+# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
+# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
+# endif
+# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
+# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
+# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
+# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
+# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
+# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
+# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
+# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
-# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
-# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
-# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
-#endif
-# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
-# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
-# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
-# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
-# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
-# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
-# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
-# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
+# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
+# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
+# endif
+# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
+# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
+# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
+# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
+# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
#endif
#endif // _LIBCPP___ATOMIC_ATOMIC_LOCK_FREE_H
diff --git a/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h b/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h
index d55450bb5f9c..3d20d6a8ce25 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/atomic_sync.h
@@ -34,77 +34,73 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile*);
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile*, __cxx_contention_t);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
+__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
template <class _Atp, class _Fn>
struct __libcpp_atomic_wait_backoff_impl {
- _Atp* __a;
- _Fn __test_fn;
- _LIBCPP_AVAILABILITY_SYNC
- _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const
- {
- if(__elapsed > chrono::microseconds(64))
- {
- auto const __monitor = std::__libcpp_atomic_monitor(__a);
- if(__test_fn())
- return true;
- std::__libcpp_atomic_wait(__a, __monitor);
- }
- else if(__elapsed > chrono::microseconds(4))
- __libcpp_thread_yield();
- else
- {} // poll
- return false;
- }
+ _Atp* __a;
+ _Fn __test_fn;
+ _LIBCPP_AVAILABILITY_SYNC
+ _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const {
+ if (__elapsed > chrono::microseconds(64)) {
+ auto const __monitor = std::__libcpp_atomic_monitor(__a);
+ if (__test_fn())
+ return true;
+ std::__libcpp_atomic_wait(__a, __monitor);
+ } else if (__elapsed > chrono::microseconds(4))
+ __libcpp_thread_yield();
+ else {
+ } // poll
+ return false;
+ }
};
template <class _Atp, class _Fn>
-_LIBCPP_AVAILABILITY_SYNC
-_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn)
-{
- __libcpp_atomic_wait_backoff_impl<_Atp, __decay_t<_Fn> > __backoff_fn = {__a, __test_fn};
- return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Fn&& __test_fn) {
+ __libcpp_atomic_wait_backoff_impl<_Atp, __decay_t<_Fn> > __backoff_fn = {__a, __test_fn};
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
}
#else // _LIBCPP_HAS_NO_THREADS
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) { }
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) {}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const volatile*) { }
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const volatile*) {}
template <class _Atp, class _Fn>
-_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn)
-{
- return std::__libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy());
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp*, _Fn&& __test_fn) {
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy());
}
#endif // _LIBCPP_HAS_NO_THREADS
-template <typename _Tp> _LIBCPP_HIDE_FROM_ABI
-bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {
- return std::memcmp(std::addressof(__lhs), std::addressof(__rhs), sizeof(_Tp)) == 0;
+template <typename _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {
+ return std::memcmp(std::addressof(__lhs), std::addressof(__rhs), sizeof(_Tp)) == 0;
}
template <class _Atp, class _Tp>
struct __cxx_atomic_wait_test_fn_impl {
- _Atp* __a;
- _Tp __val;
- memory_order __order;
- _LIBCPP_HIDE_FROM_ABI bool operator()() const
- {
- return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val);
- }
+ _Atp* __a;
+ _Tp __val;
+ memory_order __order;
+ _LIBCPP_HIDE_FROM_ABI bool operator()() const {
+ return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val);
+ }
};
template <class _Atp, class _Tp>
-_LIBCPP_AVAILABILITY_SYNC
-_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order)
-{
- __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order};
- return std::__cxx_atomic_wait(__a, __test_fn);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+__cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order) {
+ __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order};
+ return std::__cxx_atomic_wait(__a, __test_fn);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h b/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h
index d744312122bd..3012aec0521b 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/check_memory_order.h
@@ -15,20 +15,16 @@
# pragma GCC system_header
#endif
-#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
- _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
- __m == memory_order_acquire || \
- __m == memory_order_acq_rel, \
- "memory order argument to atomic operation is invalid")
+#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
+ _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || __m == memory_order_acquire || __m == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
-#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
- _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
- __m == memory_order_acq_rel, \
- "memory order argument to atomic operation is invalid")
+#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
+ _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || __m == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
-#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
- _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
- __f == memory_order_acq_rel, \
- "memory order argument to atomic operation is invalid")
+#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
+ _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || __f == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
#endif // _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H
diff --git a/contrib/llvm-project/libcxx/include/__atomic/contention_t.h b/contrib/llvm-project/libcxx/include/__atomic/contention_t.h
index 1d8d02430b4f..65890f338ce9 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/contention_t.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/contention_t.h
@@ -20,9 +20,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
- using __cxx_contention_t = int32_t;
+using __cxx_contention_t = int32_t;
#else
- using __cxx_contention_t = int64_t;
+using __cxx_contention_t = int64_t;
#endif // __linux__ || (_AIX && !__64BIT__)
using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
diff --git a/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h b/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h
index 5d724669fee8..1a0b808a0cb1 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h
@@ -26,20 +26,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \
- defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS)
+#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS)
// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
// the default operator= in an object is not volatile, a byte-by-byte copy
// is required.
-template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) {
+template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) {
__a_value = __val;
}
-template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) {
+template <typename _Tp, typename _Tv, __enable_if_t<is_assignable<_Tp&, _Tv>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) {
volatile char* __to = reinterpret_cast<volatile char*>(std::addressof(__a_value));
- volatile char* __end = __to + sizeof(_Tp);
+ volatile char* __end = __to + sizeof(_Tp);
volatile const char* __from = reinterpret_cast<volatile const char*>(std::addressof(__val));
while (__to != __end)
*__to++ = *__from++;
@@ -51,78 +50,74 @@ void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& _
template <typename _Tp>
struct __cxx_atomic_base_impl {
-
_LIBCPP_HIDE_FROM_ABI
-#ifndef _LIBCPP_CXX03_LANG
- __cxx_atomic_base_impl() _NOEXCEPT = default;
-#else
- __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
- : __a_value(value) {}
+# ifndef _LIBCPP_CXX03_LANG
+ __cxx_atomic_base_impl() _NOEXCEPT = default;
+# else
+ __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {
+ }
+# endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT : __a_value(value) {}
_Tp __a_value;
};
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
- return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
- (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
- (__order == memory_order_release ? __ATOMIC_RELEASE:
- (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST:
- (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL:
- __ATOMIC_CONSUME))));
+ return __order == memory_order_relaxed
+ ? __ATOMIC_RELAXED
+ : (__order == memory_order_acquire
+ ? __ATOMIC_ACQUIRE
+ : (__order == memory_order_release
+ ? __ATOMIC_RELEASE
+ : (__order == memory_order_seq_cst
+ ? __ATOMIC_SEQ_CST
+ : (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL : __ATOMIC_CONSUME))));
}
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
- return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
- (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
- (__order == memory_order_release ? __ATOMIC_RELAXED:
- (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST:
- (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE:
- __ATOMIC_CONSUME))));
+ return __order == memory_order_relaxed
+ ? __ATOMIC_RELAXED
+ : (__order == memory_order_acquire
+ ? __ATOMIC_ACQUIRE
+ : (__order == memory_order_release
+ ? __ATOMIC_RELAXED
+ : (__order == memory_order_seq_cst
+ ? __ATOMIC_SEQ_CST
+ : (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE : __ATOMIC_CONSUME))));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
__cxx_atomic_assign_volatile(__a->__a_value, __val);
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
__a->__a_value = __val;
}
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_thread_fence(memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_thread_fence(memory_order __order) {
__atomic_thread_fence(__to_gcc_order(__order));
}
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_signal_fence(memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_signal_fence(memory_order __order) {
__atomic_signal_fence(__to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI void
+__cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val, memory_order __order) {
__atomic_store(std::addressof(__a->__a_value), std::addressof(__val), __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val, memory_order __order) {
__atomic_store(std::addressof(__a->__a_value), std::addressof(__val), __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
_Tp __ret;
__atomic_load(std::addressof(__a->__a_value), std::addressof(__ret), __to_gcc_order(__order));
return __ret;
@@ -141,17 +136,15 @@ __cxx_atomic_load_inplace(const __cxx_atomic_base_impl<_Tp>* __a, _Tp* __dst, me
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
_Tp __ret;
__atomic_load(std::addressof(__a->__a_value), std::addressof(__ret), __to_gcc_order(__order));
return __ret;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __value, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __value, memory_order __order) {
_Tp __ret;
__atomic_exchange(
std::addressof(__a->__a_value), std::addressof(__value), std::addressof(__ret), __to_gcc_order(__order));
@@ -159,9 +152,7 @@ _Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value, memory_order __order) {
_Tp __ret;
__atomic_exchange(
std::addressof(__a->__a_value), std::addressof(__value), std::addressof(__ret), __to_gcc_order(__order));
@@ -169,10 +160,12 @@ _Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(
- volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
- memory_order __success, memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ volatile __cxx_atomic_base_impl<_Tp>* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -183,10 +176,8 @@ bool __cxx_atomic_compare_exchange_strong(
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(
- __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
- memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -197,10 +188,12 @@ bool __cxx_atomic_compare_exchange_strong(
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(
- volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
- memory_order __success, memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ volatile __cxx_atomic_base_impl<_Tp>* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -211,10 +204,8 @@ bool __cxx_atomic_compare_exchange_weak(
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(
- __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
- memory_order __failure) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) {
return __atomic_compare_exchange(
std::addressof(__a->__a_value),
__expected,
@@ -225,193 +216,182 @@ bool __cxx_atomic_compare_exchange_weak(
}
template <typename _Tp>
-struct __skip_amt { enum {value = 1}; };
+struct __skip_amt {
+ enum { value = 1 };
+};
template <typename _Tp>
-struct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; };
+struct __skip_amt<_Tp*> {
+ enum { value = sizeof(_Tp) };
+};
// FIXME: Haven't figured out what the spec says about using arrays with
// atomic_fetch_add. Force a failure rather than creating bad behavior.
template <typename _Tp>
-struct __skip_amt<_Tp[]> { };
+struct __skip_amt<_Tp[]> {};
template <typename _Tp, int n>
-struct __skip_amt<_Tp[n]> { };
+struct __skip_amt<_Tp[n]> {};
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Td __delta, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_add(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_add(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Td __delta, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_sub(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, memory_order __order) {
return __atomic_fetch_sub(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_and(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_and(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_or(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_or(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a,
- _Tp __pattern, memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_xor(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
- memory_order __order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) {
return __atomic_fetch_xor(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order));
}
-#define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
+# define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP)
template <typename _Tp>
struct __cxx_atomic_base_impl {
-
_LIBCPP_HIDE_FROM_ABI
-#ifndef _LIBCPP_CXX03_LANG
- __cxx_atomic_base_impl() _NOEXCEPT = default;
-#else
- __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp __value) _NOEXCEPT
- : __a_value(__value) {}
+# ifndef _LIBCPP_CXX03_LANG
+ __cxx_atomic_base_impl() _NOEXCEPT = default;
+# else
+ __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {
+ }
+# endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp __value) _NOEXCEPT : __a_value(__value) {}
_LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value;
};
-#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
+# define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT {
- __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order));
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT {
+ __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order));
}
-_LIBCPP_HIDE_FROM_ABI inline
-void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT {
- __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order));
+_LIBCPP_HIDE_FROM_ABI inline void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT {
+ __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT {
- __c11_atomic_init(std::addressof(__a->__a_value), __val);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT {
+ __c11_atomic_init(std::addressof(__a->__a_value), __val);
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) _NOEXCEPT {
- __c11_atomic_init(std::addressof(__a->__a_value), __val);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) _NOEXCEPT {
+ __c11_atomic_init(std::addressof(__a->__a_value), __val);
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
- __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void
+__cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
+ __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) _NOEXCEPT {
- __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI void
+__cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val, memory_order __order) _NOEXCEPT {
+ __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- return __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT {
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ return __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- return __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ return __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI void
__cxx_atomic_load_inplace(__cxx_atomic_base_impl<_Tp> const volatile* __a, _Tp* __dst, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- *__dst = __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ *__dst = __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI void
__cxx_atomic_load_inplace(__cxx_atomic_base_impl<_Tp> const* __a, _Tp* __dst, memory_order __order) _NOEXCEPT {
- using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
- *__dst = __c11_atomic_load(
- const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
+ using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
+ *__dst = __c11_atomic_load(
+ const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT {
- return __c11_atomic_exchange(
- std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT {
+ return __c11_atomic_exchange(
+ std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) _NOEXCEPT {
- return __c11_atomic_exchange(
- std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value, memory_order __order) _NOEXCEPT {
+ return __c11_atomic_exchange(
+ std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order));
}
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR memory_order __to_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
- return __order == memory_order_release ? memory_order_relaxed:
- (__order == memory_order_acq_rel ? memory_order_acquire:
- __order);
+ return __order == memory_order_release
+ ? memory_order_relaxed
+ : (__order == memory_order_acq_rel ? memory_order_acquire : __order);
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_base_impl<_Tp> volatile* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) _NOEXCEPT {
return __c11_atomic_compare_exchange_strong(
std::addressof(__a->__a_value),
__expected,
@@ -419,9 +399,10 @@ bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile*
static_cast<__memory_order_underlying_t>(__success),
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure)
+ _NOEXCEPT {
return __c11_atomic_compare_exchange_strong(
std::addressof(__a->__a_value),
__expected,
@@ -430,9 +411,13 @@ bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_base_impl<_Tp> volatile* __a,
+ _Tp* __expected,
+ _Tp __value,
+ memory_order __success,
+ memory_order __failure) _NOEXCEPT {
return __c11_atomic_compare_exchange_weak(
std::addressof(__a->__a_value),
__expected,
@@ -440,9 +425,10 @@ bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __
static_cast<__memory_order_underlying_t>(__success),
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure)
+ _NOEXCEPT {
return __c11_atomic_compare_exchange_weak(
std::addressof(__a->__a_value),
__expected,
@@ -451,92 +437,92 @@ bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp*
static_cast<__memory_order_underlying_t>(__to_failure_order(__failure)));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_add(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_sub(
std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_and(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_and(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_or(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_or(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_xor(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
return __c11_atomic_fetch_xor(
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
@@ -545,26 +531,23 @@ _Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, mem
#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
-template<typename _Tp>
+template <typename _Tp>
struct __cxx_atomic_lock_impl {
-
- _LIBCPP_HIDE_FROM_ABI
- __cxx_atomic_lock_impl() _NOEXCEPT
- : __a_value(), __a_lock(0) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit
- __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT
- : __a_value(value), __a_lock(0) {}
+ _LIBCPP_HIDE_FROM_ABI __cxx_atomic_lock_impl() _NOEXCEPT : __a_value(), __a_lock(0) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT
+ : __a_value(value),
+ __a_lock(0) {}
_Tp __a_value;
mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock;
_LIBCPP_HIDE_FROM_ABI void __lock() const volatile {
- while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
- /*spin*/;
+ while (1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
+ /*spin*/;
}
_LIBCPP_HIDE_FROM_ABI void __lock() const {
- while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
- /*spin*/;
+ while (1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
+ /*spin*/;
}
_LIBCPP_HIDE_FROM_ABI void __unlock() const volatile {
__cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
@@ -598,39 +581,33 @@ struct __cxx_atomic_lock_impl {
};
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
__cxx_atomic_assign_volatile(__a->__a_value, __val);
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
__a->__a_value = __val;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
__a->__lock();
__cxx_atomic_assign_volatile(__a->__a_value, __val);
__a->__unlock();
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
+_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
__a->__lock();
__a->__a_value = __val;
__a->__unlock();
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
return __a->__read();
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
return __a->__read();
}
@@ -645,8 +622,7 @@ _LIBCPP_HIDE_FROM_ABI void __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>*
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -655,24 +631,22 @@ _Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
__a->__lock();
- _Tp __old = __a->__a_value;
+ _Tp __old = __a->__a_value;
__a->__a_value = __value;
__a->__unlock();
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
_Tp __temp;
__a->__lock();
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
__cxx_atomic_assign_volatile(__a->__a_value, __value);
else
__cxx_atomic_assign_volatile(*__expected, __a->__a_value);
@@ -680,12 +654,11 @@ bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>*
return __ret;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_strong(
+ __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
__a->__lock();
bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
std::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
else
std::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
@@ -694,14 +667,13 @@ bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
_Tp __temp;
__a->__lock();
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
__cxx_atomic_assign_volatile(__a->__a_value, __value);
else
__cxx_atomic_assign_volatile(*__expected, __a->__a_value);
@@ -709,12 +681,11 @@ bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __
return __ret;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp* __expected, _Tp __value, memory_order, memory_order) {
+_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_compare_exchange_weak(
+ __cxx_atomic_lock_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order, memory_order) {
__a->__lock();
bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
- if(__ret)
+ if (__ret)
std::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
else
std::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
@@ -723,9 +694,7 @@ bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -734,9 +703,7 @@ _Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value += __delta;
@@ -745,9 +712,8 @@ _Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a,
- ptrdiff_t __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp*
+__cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order) {
__a->__lock();
_Tp* __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -756,9 +722,7 @@ _Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a,
return __old;
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a,
- ptrdiff_t __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a, ptrdiff_t __delta, memory_order) {
__a->__lock();
_Tp* __old = __a->__a_value;
__a->__a_value += __delta;
@@ -767,9 +731,7 @@ _Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a,
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -778,9 +740,7 @@ _Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp, typename _Td>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a,
- _Td __delta, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a, _Td __delta, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value -= __delta;
@@ -789,9 +749,8 @@ _Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -800,9 +759,7 @@ _Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value &= __pattern;
@@ -811,9 +768,8 @@ _Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -822,9 +778,7 @@ _Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value |= __pattern;
@@ -833,9 +787,8 @@ _Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a,
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old;
__cxx_atomic_assign_volatile(__old, __a->__a_value);
@@ -844,9 +797,7 @@ _Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a,
return __old;
}
template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a,
- _Tp __pattern, memory_order) {
+_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __pattern, memory_order) {
__a->__lock();
_Tp __old = __a->__a_value;
__a->__a_value ^= __pattern;
@@ -859,16 +810,13 @@ template <typename _Tp,
__cxx_atomic_base_impl<_Tp>,
__cxx_atomic_lock_impl<_Tp> >::type>
#else
-template <typename _Tp,
- typename _Base = __cxx_atomic_base_impl<_Tp> >
+template <typename _Tp, typename _Base = __cxx_atomic_base_impl<_Tp> >
#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS
struct __cxx_atomic_impl : public _Base {
- static_assert(is_trivially_copyable<_Tp>::value,
- "std::atomic<T> requires that 'T' be a trivially copyable type");
+ static_assert(is_trivially_copyable<_Tp>::value, "std::atomic<T> requires that 'T' be a trivially copyable type");
_LIBCPP_HIDE_FROM_ABI __cxx_atomic_impl() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp __value) _NOEXCEPT
- : _Base(__value) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp __value) _NOEXCEPT : _Base(__value) {}
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/fence.h b/contrib/llvm-project/libcxx/include/__atomic/fence.h
index c62f38f21157..8c27ea54d62d 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/fence.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/fence.h
@@ -19,19 +19,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_thread_fence(memory_order __m) _NOEXCEPT
-{
- __cxx_atomic_thread_fence(__m);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_signal_fence(memory_order __m) _NOEXCEPT
-{
- __cxx_atomic_signal_fence(__m);
-}
+inline _LIBCPP_HIDE_FROM_ABI void atomic_thread_fence(memory_order __m) _NOEXCEPT { __cxx_atomic_thread_fence(__m); }
+
+inline _LIBCPP_HIDE_FROM_ABI void atomic_signal_fence(memory_order __m) _NOEXCEPT { __cxx_atomic_signal_fence(__m); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h b/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h
index 1bd5c8ca765a..103d52d35787 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/kill_dependency.h
@@ -18,10 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp kill_dependency(_Tp __y) _NOEXCEPT
-{
- return __y;
+_LIBCPP_HIDE_FROM_ABI _Tp kill_dependency(_Tp __y) _NOEXCEPT {
+ return __y;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__atomic/memory_order.h b/contrib/llvm-project/libcxx/include/__atomic/memory_order.h
index 3671dc3cf9be..16fd1867698f 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/memory_order.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/memory_order.h
@@ -22,14 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Figure out what the underlying type for `memory_order` would be if it were
// declared as an unscoped enum (accounting for -fshort-enums). Use this result
// to pin the underlying type in C++20.
-enum __legacy_memory_order {
- __mo_relaxed,
- __mo_consume,
- __mo_acquire,
- __mo_release,
- __mo_acq_rel,
- __mo_seq_cst
-};
+enum __legacy_memory_order { __mo_relaxed, __mo_consume, __mo_acquire, __mo_release, __mo_acq_rel, __mo_seq_cst };
using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type;
@@ -45,7 +38,7 @@ enum class memory_order : __memory_order_underlying_t {
};
static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
- "unexpected underlying type for std::memory_order");
+ "unexpected underlying type for std::memory_order");
inline constexpr auto memory_order_relaxed = memory_order::relaxed;
inline constexpr auto memory_order_consume = memory_order::consume;
diff --git a/contrib/llvm-project/libcxx/include/__availability b/contrib/llvm-project/libcxx/include/__availability
index b5230b3f56b8..5df2783dd0c7 100644
--- a/contrib/llvm-project/libcxx/include/__availability
+++ b/contrib/llvm-project/libcxx/include/__availability
@@ -64,25 +64,22 @@
//
// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
-
// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
// for a while.
#if defined(_LIBCPP_DISABLE_AVAILABILITY)
-# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
-# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
-# endif
+# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
+# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
+# endif
#endif
// Availability markup is disabled when building the library, or when the compiler
// doesn't support the proper attributes.
-#if defined(_LIBCPP_BUILDING_LIBRARY) || \
- defined(_LIBCXXABI_BUILDING_LIBRARY) || \
- !__has_feature(attribute_availability_with_strict) || \
- !__has_feature(attribute_availability_in_templates) || \
+#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || \
+ !__has_feature(attribute_availability_with_strict) || !__has_feature(attribute_availability_in_templates) || \
!__has_extension(pragma_clang_attribute_external_declaration)
-# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
-# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
-# endif
+# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
+# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
+# endif
#endif
#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
@@ -139,6 +136,12 @@
# define _LIBCPP_AVAILABILITY_HAS_TZDB 1
# define _LIBCPP_AVAILABILITY_TZDB
+ // This controls the availability of C++23 <print>, which
+ // has a dependency on the built library (it needs access to
+ // the underlying buffer types of std::cout, std::cerr, and std::clog.
+# define _LIBCPP_AVAILABILITY_HAS_PRINT 1
+# define _LIBCPP_AVAILABILITY_PRINT
+
// Enable additional explicit instantiations of iostreams components. This
// reduces the number of weak definitions generated in programs that use
// iostreams by providing a single strong definition in the shared library.
@@ -160,7 +163,7 @@
# define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS
-# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((availability(watchos,strict,introduced=5.0)))
+# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((availability(watchos, strict, introduced = 5.0)))
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
@@ -175,11 +178,11 @@
# else
# define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 1
# endif
-# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \
- __attribute__((availability(macos,strict,introduced=10.15))) \
- __attribute__((availability(ios,strict,introduced=13.0))) \
- __attribute__((availability(tvos,strict,introduced=13.0))) \
- __attribute__((availability(watchos,strict,introduced=6.0)))
+# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \
+ __attribute__((availability(macos, strict, introduced = 10.15))) \
+ __attribute__((availability(ios, strict, introduced = 13.0))) \
+ __attribute__((availability(tvos, strict, introduced = 13.0))) \
+ __attribute__((availability(watchos, strict, introduced = 6.0)))
// clang-format off
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH \
_Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
@@ -204,13 +207,13 @@
# else
# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1
# endif
-# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \
- __attribute__((availability(macos,strict,introduced=13.3))) \
- __attribute__((availability(ios,strict,introduced=16.3))) \
- __attribute__((availability(tvos,strict,introduced=16.3))) \
- __attribute__((availability(watchos,strict,introduced=9.3)))
+# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \
+ __attribute__((availability(macos, strict, introduced = 13.3))) \
+ __attribute__((availability(ios, strict, introduced = 16.3))) \
+ __attribute__((availability(tvos, strict, introduced = 16.3))) \
+ __attribute__((availability(watchos, strict, introduced = 9.3)))
- // c++20 synchronization library
+// c++20 synchronization library
// clang-format off
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
@@ -220,19 +223,18 @@
# define _LIBCPP_AVAILABILITY_HAS_SYNC 0
# else
# define _LIBCPP_AVAILABILITY_HAS_SYNC 1
-# endif
-# define _LIBCPP_AVAILABILITY_SYNC \
- __attribute__((availability(macos,strict,introduced=11.0))) \
- __attribute__((availability(ios,strict,introduced=14.0))) \
- __attribute__((availability(tvos,strict,introduced=14.0))) \
- __attribute__((availability(watchos,strict,introduced=7.0)))
+# endif
+# define _LIBCPP_AVAILABILITY_SYNC \
+ __attribute__((availability(macos, strict, introduced = 11.0))) \
+ __attribute__((availability(ios, strict, introduced = 14.0))) \
+ __attribute__((availability(tvos, strict, introduced = 14.0))) \
+ __attribute__((availability(watchos, strict, introduced = 7.0)))
// __libcpp_verbose_abort
// TODO: Update once this is released
# define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT 0
-# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT \
- __attribute__((unavailable))
+# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT __attribute__((unavailable))
// std::pmr
// clang-format off
@@ -262,6 +264,9 @@
# define _LIBCPP_AVAILABILITY_HAS_TZDB 0
# define _LIBCPP_AVAILABILITY_TZDB __attribute__((unavailable))
+# define _LIBCPP_AVAILABILITY_HAS_PRINT 0
+# define _LIBCPP_AVAILABILITY_PRINT __attribute__((unavailable))
+
// clang-format off
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120000) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150000) || \
@@ -276,7 +281,8 @@
// ...New vendors can add availability markup here...
-# error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
+# error \
+ "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
#endif
@@ -284,13 +290,13 @@
// Those are defined in terms of the availability attributes above, and
// should not be vendor-specific.
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
-# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
-# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
+# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
#else
-# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
-# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
-# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
+# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
#endif
#endif // _LIBCPP___AVAILABILITY
diff --git a/contrib/llvm-project/libcxx/include/__bit/bit_cast.h b/contrib/llvm-project/libcxx/include/__bit/bit_cast.h
index 39842465e12a..f20b39ae748b 100644
--- a/contrib/llvm-project/libcxx/include/__bit/bit_cast.h
+++ b/contrib/llvm-project/libcxx/include/__bit/bit_cast.h
@@ -22,8 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _ToType, class _FromType>
- requires(sizeof(_ToType) == sizeof(_FromType) &&
- is_trivially_copyable_v<_ToType> &&
+ requires(sizeof(_ToType) == sizeof(_FromType) && is_trivially_copyable_v<_ToType> &&
is_trivially_copyable_v<_FromType>)
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _ToType bit_cast(const _FromType& __from) noexcept {
return __builtin_bit_cast(_ToType, __from);
diff --git a/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h b/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
index 9eae5c391a83..17fe06aa41cc 100644
--- a/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
+++ b/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
@@ -33,7 +33,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) no
if constexpr (sizeof(_Tp) >= sizeof(unsigned))
return _Tp{1} << __n;
else {
- const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
+ const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
const unsigned __ret_val = 1u << (__n + __extra);
return (_Tp)(__ret_val >> __extra);
}
diff --git a/contrib/llvm-project/libcxx/include/__bit/byteswap.h b/contrib/llvm-project/libcxx/include/__bit/byteswap.h
index a1e1b530975e..20045d6fd43c 100644
--- a/contrib/llvm-project/libcxx/include/__bit/byteswap.h
+++ b/contrib/llvm-project/libcxx/include/__bit/byteswap.h
@@ -24,7 +24,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <integral _Tp>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
-
if constexpr (sizeof(_Tp) == 1) {
return __val;
} else if constexpr (sizeof(_Tp) == 2) {
@@ -33,15 +32,15 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) no
return __builtin_bswap32(__val);
} else if constexpr (sizeof(_Tp) == 8) {
return __builtin_bswap64(__val);
-#ifndef _LIBCPP_HAS_NO_INT128
+# ifndef _LIBCPP_HAS_NO_INT128
} else if constexpr (sizeof(_Tp) == 16) {
-#if __has_builtin(__builtin_bswap128)
+# if __has_builtin(__builtin_bswap128)
return __builtin_bswap128(__val);
-#else
+# else
return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 |
static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64)));
-#endif // __has_builtin(__builtin_bswap128)
-#endif // _LIBCPP_HAS_NO_INT128
+# endif // __has_builtin(__builtin_bswap128)
+# endif // _LIBCPP_HAS_NO_INT128
} else {
static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
}
diff --git a/contrib/llvm-project/libcxx/include/__bit/countl.h b/contrib/llvm-project/libcxx/include/__bit/countl.h
index efc9e200b13a..396cfc2c3f40 100644
--- a/contrib/llvm-project/libcxx/include/__bit/countl.h
+++ b/contrib/llvm-project/libcxx/include/__bit/countl.h
@@ -24,18 +24,20 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned __x) _NOEXCEPT {
+ return __builtin_clz(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long __x) _NOEXCEPT {
+ return __builtin_clzl(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long long __x) _NOEXCEPT {
+ return __builtin_clzll(__x);
+}
-# ifndef _LIBCPP_HAS_NO_INT128
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
+#ifndef _LIBCPP_HAS_NO_INT128
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
// The function is written in this form due to C++ constexpr limitations.
// The algorithm:
// - Test whether any bit in the high 64-bits is set
@@ -45,42 +47,38 @@ int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
// - Any bits set:
// - The number of leading zeros of the input is the number of leading
// zeros in the high 64-bits.
- return ((__x >> 64) == 0)
- ? (64 + __builtin_clzll(static_cast<unsigned long long>(__x)))
- : __builtin_clzll(static_cast<unsigned long long>(__x >> 64));
+ return ((__x >> 64) == 0) ? (64 + __builtin_clzll(static_cast<unsigned long long>(__x)))
+ : __builtin_clzll(static_cast<unsigned long long>(__x >> 64));
}
-# endif // _LIBCPP_HAS_NO_INT128
-
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-int __countl_zero(_Tp __t) _NOEXCEPT
-{
- static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type");
- if (__t == 0)
- return numeric_limits<_Tp>::digits;
-
- if (sizeof(_Tp) <= sizeof(unsigned int))
- return std::__libcpp_clz(static_cast<unsigned int>(__t))
- - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits);
- else if (sizeof(_Tp) <= sizeof(unsigned long))
- return std::__libcpp_clz(static_cast<unsigned long>(__t))
- - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits);
- else if (sizeof(_Tp) <= sizeof(unsigned long long))
- return std::__libcpp_clz(static_cast<unsigned long long>(__t))
- - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits);
- else
- {
- int __ret = 0;
- int __iter = 0;
- const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
- while (true) {
- __t = std::__rotl(__t, __ulldigits);
- if ((__iter = std::__countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits)
- break;
- __ret += __iter;
- }
- return __ret + __iter;
+#endif // _LIBCPP_HAS_NO_INT128
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT {
+ static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type");
+ if (__t == 0)
+ return numeric_limits<_Tp>::digits;
+
+ if (sizeof(_Tp) <= sizeof(unsigned int))
+ return std::__libcpp_clz(static_cast<unsigned int>(__t)) -
+ (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits);
+ else if (sizeof(_Tp) <= sizeof(unsigned long))
+ return std::__libcpp_clz(static_cast<unsigned long>(__t)) -
+ (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits);
+ else if (sizeof(_Tp) <= sizeof(unsigned long long))
+ return std::__libcpp_clz(static_cast<unsigned long long>(__t)) -
+ (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits);
+ else {
+ int __ret = 0;
+ int __iter = 0;
+ const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
+ while (true) {
+ __t = std::__rotl(__t, __ulldigits);
+ if ((__iter = std::__countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits)
+ break;
+ __ret += __iter;
}
+ return __ret + __iter;
+ }
}
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__bit/countr.h b/contrib/llvm-project/libcxx/include/__bit/countr.h
index 66ca5e7e66f2..0cc679f87a99 100644
--- a/contrib/llvm-project/libcxx/include/__bit/countr.h
+++ b/contrib/llvm-project/libcxx/include/__bit/countr.h
@@ -23,14 +23,17 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned __x) _NOEXCEPT {
+ return __builtin_ctz(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long __x) _NOEXCEPT {
+ return __builtin_ctzl(__x);
+}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long long __x) _NOEXCEPT {
+ return __builtin_ctzll(__x);
+}
#if _LIBCPP_STD_VER >= 20
@@ -46,7 +49,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr int countr_zero(_Tp __t) n
else if (sizeof(_Tp) <= sizeof(unsigned long long))
return std::__libcpp_ctz(static_cast<unsigned long long>(__t));
else {
- int __ret = 0;
+ int __ret = 0;
const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
while (static_cast<unsigned long long>(__t) == 0uLL) {
__ret += __ulldigits;
diff --git a/contrib/llvm-project/libcxx/include/__bit/endian.h b/contrib/llvm-project/libcxx/include/__bit/endian.h
index 52635f2d2495..2d31e5ddff4f 100644
--- a/contrib/llvm-project/libcxx/include/__bit/endian.h
+++ b/contrib/llvm-project/libcxx/include/__bit/endian.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
enum class endian {
little = 0xDEAD,
- big = 0xFACE,
+ big = 0xFACE,
# if defined(_LIBCPP_LITTLE_ENDIAN)
native = little
# elif defined(_LIBCPP_BIG_ENDIAN)
diff --git a/contrib/llvm-project/libcxx/include/__bit/popcount.h b/contrib/llvm-project/libcxx/include/__bit/popcount.h
index f0bb87ea717e..b0319cef2518 100644
--- a/contrib/llvm-project/libcxx/include/__bit/popcount.h
+++ b/contrib/llvm-project/libcxx/include/__bit/popcount.h
@@ -23,14 +23,17 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned __x) _NOEXCEPT {
+ return __builtin_popcount(__x);
+}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned long __x) _NOEXCEPT {
+ return __builtin_popcountl(__x);
+}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned long long __x) _NOEXCEPT {
+ return __builtin_popcountll(__x);
+}
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__chrono/calendar.h b/contrib/llvm-project/libcxx/include/__chrono/calendar.h
index 91aaf6325389..bb1c5e7ebc8d 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/calendar.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/calendar.h
@@ -22,19 +22,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
struct local_t {};
-template<class _Duration>
-using local_time = time_point<local_t, _Duration>;
+template <class _Duration>
+using local_time = time_point<local_t, _Duration>;
using local_seconds = local_time<seconds>;
using local_days = local_time<days>;
-struct last_spec { explicit last_spec() = default; };
+struct last_spec {
+ explicit last_spec() = default;
+};
inline constexpr last_spec last{};
-
} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h b/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h
index fab07f2567d4..11e0b826d05b 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/convert_to_timespec.h
@@ -26,23 +26,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Convert a nanoseconds duration to the given TimeSpec type, which must have
// the same properties as std::timespec.
template <class _TimeSpec>
-_LIBCPP_HIDE_FROM_ABI inline
-_TimeSpec __convert_to_timespec(const chrono::nanoseconds& __ns)
-{
+_LIBCPP_HIDE_FROM_ABI inline _TimeSpec __convert_to_timespec(const chrono::nanoseconds& __ns) {
using namespace chrono;
seconds __s = duration_cast<seconds>(__ns);
_TimeSpec __ts;
typedef decltype(__ts.tv_sec) __ts_sec;
const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
- if (__s.count() < __ts_sec_max)
- {
- __ts.tv_sec = static_cast<__ts_sec>(__s.count());
+ if (__s.count() < __ts_sec_max) {
+ __ts.tv_sec = static_cast<__ts_sec>(__s.count());
__ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
- }
- else
- {
- __ts.tv_sec = __ts_sec_max;
+ } else {
+ __ts.tv_sec = __ts_sec_max;
__ts.tv_nsec = 999999999; // (10^9 - 1)
}
diff --git a/contrib/llvm-project/libcxx/include/__chrono/day.h b/contrib/llvm-project/libcxx/include/__chrono/day.h
index d908453d5b08..7342084b08c8 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/day.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/day.h
@@ -22,58 +22,73 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class day {
private:
- unsigned char __d_;
+ unsigned char __d_;
+
public:
- day() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept : __d_(static_cast<unsigned char>(__val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept { ++__d_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day operator++(int) noexcept { day __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept { --__d_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day operator--(int) noexcept { day __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
- };
-
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const day& __lhs, const day& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
+ day() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept
+ : __d_(static_cast<unsigned char>(__val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept {
+ ++__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day operator++(int) noexcept {
+ day __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept {
+ --__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day operator--(int) noexcept {
+ day __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const day& __lhs, const day& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const day& __lhs, const day& __rhs) noexcept {
return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day operator+ (const day& __lhs, const days& __rhs) noexcept
-{ return day(static_cast<unsigned>(__lhs) + __rhs.count()); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept {
+ return day(static_cast<unsigned>(__lhs) + __rhs.count());
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day operator+ (const days& __lhs, const day& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day operator- (const day& __lhs, const days& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days operator-(const day& __lhs, const day& __rhs) noexcept
-{ return days(static_cast<int>(static_cast<unsigned>(__lhs)) -
- static_cast<int>(static_cast<unsigned>(__rhs))); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept {
+ return days(static_cast<int>(static_cast<unsigned>(__lhs)) - static_cast<int>(static_cast<unsigned>(__rhs)));
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day& day::operator+=(const days& __dd) noexcept
-{ *this = *this + __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator+=(const days& __dd) noexcept {
+ *this = *this + __dd;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-day& day::operator-=(const days& __dd) noexcept
-{ *this = *this - __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) noexcept {
+ *this = *this - __dd;
+ return *this;
+}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/duration.h b/contrib/llvm-project/libcxx/include/__chrono/duration.h
index a19d55fc6682..5693ee644091 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/duration.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/duration.h
@@ -29,100 +29,82 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
-template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TEMPLATE_VIS duration;
+template <class _Rep, class _Period = ratio<1> >
+class _LIBCPP_TEMPLATE_VIS duration;
template <class _Tp>
struct __is_duration : false_type {};
template <class _Rep, class _Period>
-struct __is_duration<duration<_Rep, _Period> > : true_type {};
+struct __is_duration<duration<_Rep, _Period> > : true_type {};
template <class _Rep, class _Period>
-struct __is_duration<const duration<_Rep, _Period> > : true_type {};
+struct __is_duration<const duration<_Rep, _Period> > : true_type {};
template <class _Rep, class _Period>
-struct __is_duration<volatile duration<_Rep, _Period> > : true_type {};
+struct __is_duration<volatile duration<_Rep, _Period> > : true_type {};
template <class _Rep, class _Period>
-struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
+struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // namespace chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-struct _LIBCPP_TEMPLATE_VIS common_type<chrono::duration<_Rep1, _Period1>,
- chrono::duration<_Rep2, _Period2> >
-{
- typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
- typename __ratio_gcd<_Period1, _Period2>::type> type;
+struct _LIBCPP_TEMPLATE_VIS common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> > {
+ typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, typename __ratio_gcd<_Period1, _Period2>::type>
+ type;
};
namespace chrono {
// duration_cast
-template <class _FromDuration, class _ToDuration,
+template <class _FromDuration,
+ class _ToDuration,
class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type,
- bool = _Period::num == 1,
- bool = _Period::den == 1>
+ bool = _Period::num == 1,
+ bool = _Period::den == 1>
struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
+ }
};
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
+ }
};
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
+ }
};
template <class _FromDuration, class _ToDuration, class _Period>
-struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- _ToDuration operator()(const _FromDuration& __fd) const
- {
- typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
- return _ToDuration(static_cast<typename _ToDuration::rep>(
- static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)
- / static_cast<_Ct>(_Period::den)));
- }
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(static_cast<typename _ToDuration::rep>(
+ static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num) / static_cast<_Ct>(_Period::den)));
+ }
};
template <class _ToDuration, class _Rep, class _Period, __enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-_ToDuration
-duration_cast(const duration<_Rep, _Period>& __fd)
-{
- return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration duration_cast(const duration<_Rep, _Period>& __fd) {
+ return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
}
template <class _Rep>
@@ -134,190 +116,204 @@ inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>:
#endif
template <class _Rep>
-struct _LIBCPP_TEMPLATE_VIS duration_values
-{
+struct _LIBCPP_TEMPLATE_VIS duration_values {
public:
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT {return _Rep(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT {return numeric_limits<_Rep>::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT {return numeric_limits<_Rep>::lowest();}
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT { return _Rep(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT { return numeric_limits<_Rep>::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT { return numeric_limits<_Rep>::lowest(); }
};
#if _LIBCPP_STD_VER >= 17
template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_ToDuration
-floor(const duration<_Rep, _Period>& __d)
-{
- _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
- if (__t > __d)
- __t = __t - _ToDuration{1};
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor(const duration<_Rep, _Period>& __d) {
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
+ if (__t > __d)
+ __t = __t - _ToDuration{1};
+ return __t;
}
template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_ToDuration
-ceil(const duration<_Rep, _Period>& __d)
-{
- _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
- if (__t < __d)
- __t = __t + _ToDuration{1};
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_Rep, _Period>& __d) {
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
+ if (__t < __d)
+ __t = __t + _ToDuration{1};
+ return __t;
}
template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_ToDuration
-round(const duration<_Rep, _Period>& __d)
-{
- _ToDuration __lower = chrono::floor<_ToDuration>(__d);
- _ToDuration __upper = __lower + _ToDuration{1};
- auto __lower_diff = __d - __lower;
- auto __upper_diff = __upper - __d;
- if (__lower_diff < __upper_diff)
- return __lower;
- if (__lower_diff > __upper_diff)
- return __upper;
- return __lower.count() & 1 ? __upper : __lower;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<_Rep, _Period>& __d) {
+ _ToDuration __lower = chrono::floor<_ToDuration>(__d);
+ _ToDuration __upper = __lower + _ToDuration{1};
+ auto __lower_diff = __d - __lower;
+ auto __upper_diff = __upper - __d;
+ if (__lower_diff < __upper_diff)
+ return __lower;
+ if (__lower_diff > __upper_diff)
+ return __upper;
+ return __lower.count() & 1 ? __upper : __lower;
}
#endif
// duration
template <class _Rep, class _Period>
-class _LIBCPP_TEMPLATE_VIS duration
-{
- static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
- static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
- static_assert(_Period::num > 0, "duration period must be positive");
-
- template <class _R1, class _R2>
- struct __no_overflow
+class _LIBCPP_TEMPLATE_VIS duration {
+ static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
+ static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
+ static_assert(_Period::num > 0, "duration period must be positive");
+
+ template <class _R1, class _R2>
+ struct __no_overflow {
+ private:
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
+ static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
+ static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
+ static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
+ static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
+
+ template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
+ struct __mul // __overflow == false
{
- private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
- static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
- static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
- static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
- static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
- static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
-
- template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
- struct __mul // __overflow == false
- {
- static const intmax_t value = _Xp * _Yp;
- };
-
- template <intmax_t _Xp, intmax_t _Yp>
- struct __mul<_Xp, _Yp, true>
- {
- static const intmax_t value = 1;
- };
-
- public:
- static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
- typedef ratio<__mul<__n1, __d2, !value>::value,
- __mul<__n2, __d1, !value>::value> type;
+ static const intmax_t value = _Xp * _Yp;
+ };
+
+ template <intmax_t _Xp, intmax_t _Yp>
+ struct __mul<_Xp, _Yp, true> {
+ static const intmax_t value = 1;
};
+ public:
+ static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
+ typedef ratio<__mul<__n1, __d2, !value>::value, __mul<__n2, __d1, !value>::value> type;
+ };
+
public:
- typedef _Rep rep;
- typedef typename _Period::type period;
+ typedef _Rep rep;
+ typedef typename _Period::type period;
+
private:
- rep __rep_;
-public:
+ rep __rep_;
+public:
#ifndef _LIBCPP_CXX03_LANG
- constexpr duration() = default;
+ constexpr duration() = default;
#else
- _LIBCPP_HIDE_FROM_ABI duration() {}
+ _LIBCPP_HIDE_FROM_ABI duration() {}
#endif
- template <class _Rep2, __enable_if_t<is_convertible<const _Rep2&, rep>::value &&
- (treat_as_floating_point<rep>::value ||
- !treat_as_floating_point<_Rep2>::value), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit duration(const _Rep2& __r)
- : __rep_(__r) {}
-
- // conversions
- template <class _Rep2, class _Period2, __enable_if_t<__no_overflow<_Period2, period>::value && (
- treat_as_floating_point<rep>::value ||
- (__no_overflow<_Period2, period>::type::den == 1 &&
- !treat_as_floating_point<_Rep2>::value)), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- duration(const duration<_Rep2, _Period2>& __d)
- : __rep_(chrono::duration_cast<duration>(__d).count()) {}
-
- // observer
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
-
- // arithmetic
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {++__rep_; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator++(int) {return duration(__rep_++);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator--() {--__rep_; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator--(int) {return duration(__rep_--);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator*=(const rep& __rhs) {__rep_ *= __rhs; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator/=(const rep& __rhs) {__rep_ /= __rhs; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const rep& __rhs) {__rep_ %= __rhs; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const duration& __rhs) {__rep_ %= __rhs.count(); return *this;}
-
- // special values
-
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {return duration(duration_values<rep>::zero());}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {return duration(duration_values<rep>::min());}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {return duration(duration_values<rep>::max());}
+ template <class _Rep2,
+ __enable_if_t<is_convertible<const _Rep2&, rep>::value &&
+ (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value),
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit duration(const _Rep2& __r) : __rep_(__r) {}
+
+ // conversions
+ template <class _Rep2,
+ class _Period2,
+ __enable_if_t<__no_overflow<_Period2, period>::value && (treat_as_floating_point<rep>::value ||
+ (__no_overflow<_Period2, period>::type::den == 1 &&
+ !treat_as_floating_point<_Rep2>::value)),
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration(const duration<_Rep2, _Period2>& __d)
+ : __rep_(chrono::duration_cast<duration>(__d).count()) {}
+
+ // observer
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR rep count() const { return __rep_; }
+
+ // arithmetic
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {
+ return typename common_type<duration>::type(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {
+ return typename common_type<duration>::type(-__rep_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {
+ ++__rep_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator++(int) { return duration(__rep_++); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator--() {
+ --__rep_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator--(int) { return duration(__rep_--); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator+=(const duration& __d) {
+ __rep_ += __d.count();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator-=(const duration& __d) {
+ __rep_ -= __d.count();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator*=(const rep& __rhs) {
+ __rep_ *= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator/=(const rep& __rhs) {
+ __rep_ /= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const rep& __rhs) {
+ __rep_ %= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const duration& __rhs) {
+ __rep_ %= __rhs.count();
+ return *this;
+ }
+
+ // special values
+
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {
+ return duration(duration_values<rep>::zero());
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {
+ return duration(duration_values<rep>::min());
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {
+ return duration(duration_values<rep>::max());
+ }
};
-typedef duration<long long, nano> nanoseconds;
-typedef duration<long long, micro> microseconds;
-typedef duration<long long, milli> milliseconds;
-typedef duration<long long > seconds;
-typedef duration< long, ratio< 60> > minutes;
-typedef duration< long, ratio<3600> > hours;
+typedef duration<long long, nano> nanoseconds;
+typedef duration<long long, micro> microseconds;
+typedef duration<long long, milli> milliseconds;
+typedef duration<long long > seconds;
+typedef duration< long, ratio< 60> > minutes;
+typedef duration< long, ratio<3600> > hours;
#if _LIBCPP_STD_VER >= 20
-typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days;
-typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks;
-typedef duration< int, ratio_multiply<ratio<146097, 400>, days::period>> years;
-typedef duration< int, ratio_divide<years::period, ratio<12>>> months;
+typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days;
+typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks;
+typedef duration< int, ratio_multiply<ratio<146097, 400>, days::period>> years;
+typedef duration< int, ratio_divide<years::period, ratio<12>>> months;
#endif
// Duration ==
template <class _LhsDuration, class _RhsDuration>
-struct __duration_eq
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
- {
- typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
- return _Ct(__lhs).count() == _Ct(__rhs).count();
- }
+struct __duration_eq {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
+ typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+ return _Ct(__lhs).count() == _Ct(__rhs).count();
+ }
};
template <class _LhsDuration>
-struct __duration_eq<_LhsDuration, _LhsDuration>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
- {return __lhs.count() == __rhs.count();}
+struct __duration_eq<_LhsDuration, _LhsDuration> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
+ return __lhs.count() == __rhs.count();
+ }
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
}
#if _LIBCPP_STD_VER <= 17
@@ -325,12 +321,9 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
// Duration !=
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return !(__lhs == __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__lhs == __rhs);
}
#endif // _LIBCPP_STD_VER <= 17
@@ -338,76 +331,58 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
// Duration <
template <class _LhsDuration, class _RhsDuration>
-struct __duration_lt
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
- {
- typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
- return _Ct(__lhs).count() < _Ct(__rhs).count();
- }
+struct __duration_lt {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
+ typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+ return _Ct(__lhs).count() < _Ct(__rhs).count();
+ }
};
template <class _LhsDuration>
-struct __duration_lt<_LhsDuration, _LhsDuration>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
- {return __lhs.count() < __rhs.count();}
+struct __duration_lt<_LhsDuration, _LhsDuration> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
+ return __lhs.count() < __rhs.count();
+ }
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
}
// Duration >
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return __rhs < __lhs;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __rhs < __lhs;
}
// Duration <=
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return !(__rhs < __lhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__rhs < __lhs);
}
// Duration >=
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-bool
-operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- return !(__lhs < __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__lhs < __rhs);
}
#if _LIBCPP_STD_VER >= 20
-template<class _Rep1, class _Period1, class _Rep2, class _Period2>
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto operator<=>(const duration<_Rep1, _Period1>& __lhs,
- const duration<_Rep2, _Period2>& __rhs)
-{
- using _Ct = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>;
- return _Ct(__lhs).count() <=> _Ct(__rhs).count();
+_LIBCPP_HIDE_FROM_ABI constexpr auto
+operator<=>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ using _Ct = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>;
+ return _Ct(__lhs).count() <=> _Ct(__rhs).count();
}
#endif // _LIBCPP_STD_VER >= 20
@@ -415,179 +390,151 @@ constexpr auto operator<=>(const duration<_Rep1, _Period1>& __lhs,
// Duration +
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
-operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
- return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+ typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+ operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
}
// Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
-operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
- return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+ typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+ operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
}
// Duration *
-template <class _Rep1, class _Period, class _Rep2,
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
__enable_if_t<is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef duration<_Cr, _Period> _Cd;
- return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
}
-template <class _Rep1, class _Period, class _Rep2,
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
__enable_if_t<is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
-{
- return __d * __s;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) {
+ return __d * __s;
}
// Duration /
-template <class _Rep1, class _Period, class _Rep2,
- __enable_if_t<!__is_duration<_Rep2>::value && is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef duration<_Cr, _Period> _Cd;
- return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<!__is_duration<_Rep2>::value &&
+ is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<_Rep1, _Rep2>::type
-operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
- return _Ct(__lhs).count() / _Ct(__rhs).count();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<_Rep1, _Rep2>::type
+operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
+ return _Ct(__lhs).count() / _Ct(__rhs).count();
}
// Duration %
-template <class _Rep1, class _Period, class _Rep2,
- __enable_if_t<!__is_duration<_Rep2>::value && is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-duration<typename common_type<_Rep1, _Rep2>::type, _Period>
-operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef duration<_Cr, _Period> _Cd;
- return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<!__is_duration<_Rep2>::value &&
+ is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
-operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
- return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+ typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
}
} // namespace chrono
#if _LIBCPP_STD_VER >= 14
// Suffixes for duration literals [time.duration.literals]
-inline namespace literals
-{
- inline namespace chrono_literals
- {
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h)
- {
- return chrono::hours(static_cast<chrono::hours::rep>(__h));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h)
- {
- return chrono::duration<long double, ratio<3600,1>>(__h);
- }
-
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m)
- {
- return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m)
- {
- return chrono::duration<long double, ratio<60,1>> (__m);
- }
+inline namespace literals {
+inline namespace chrono_literals {
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h) {
+ return chrono::hours(static_cast<chrono::hours::rep>(__h));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s)
- {
- return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600, 1>> operator""h(long double __h) {
+ return chrono::duration<long double, ratio<3600, 1>>(__h);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s)
- {
- return chrono::duration<long double> (__s);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m) {
+ return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
+}
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60, 1>> operator""min(long double __m) {
+ return chrono::duration<long double, ratio<60, 1>>(__m);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms)
- {
- return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s) {
+ return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms)
- {
- return chrono::duration<long double, milli>(__ms);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s) {
+ return chrono::duration<long double>(__s);
+}
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms) {
+ return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us)
- {
- return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms) {
+ return chrono::duration<long double, milli>(__ms);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us)
- {
- return chrono::duration<long double, micro> (__us);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us) {
+ return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
+}
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us) {
+ return chrono::duration<long double, micro>(__us);
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns)
- {
- return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) {
+ return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
+}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns)
- {
- return chrono::duration<long double, nano> (__ns);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns) {
+ return chrono::duration<long double, nano>(__ns);
+}
} // namespace chrono_literals
} // namespace literals
namespace chrono { // hoist the literals into namespace std::chrono
- using namespace literals::chrono_literals;
+using namespace literals::chrono_literals;
} // namespace chrono
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__chrono/file_clock.h b/contrib/llvm-project/libcxx/include/__chrono/file_clock.h
index 9ea2fcb97935..7d25729fec01 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/file_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/file_clock.h
@@ -31,13 +31,12 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
// [time.clock.file], type file_clock
using file_clock = filesystem::_FilesystemClock;
-template<class _Duration>
+template <class _Duration>
using file_time = time_point<file_clock, _Duration>;
} // namespace chrono
@@ -49,35 +48,32 @@ _LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
struct _FilesystemClock {
-#if !defined(_LIBCPP_HAS_NO_INT128)
+# if !defined(_LIBCPP_HAS_NO_INT128)
typedef __int128_t rep;
typedef nano period;
-#else
+# else
typedef long long rep;
typedef nano period;
-#endif
+# endif
typedef chrono::duration<rep, period> duration;
typedef chrono::time_point<_FilesystemClock> time_point;
- _LIBCPP_EXPORTED_FROM_ABI
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
+ _LIBCPP_EXPORTED_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI static time_point now() noexcept;
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
+ _LIBCPP_HIDE_FROM_ABI static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
return chrono::sys_time<_Duration>(__t.time_since_epoch());
}
template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) {
+ _LIBCPP_HIDE_FROM_ABI static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) {
return chrono::file_time<_Duration>(__t.time_since_epoch());
}
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
};
_LIBCPP_END_NAMESPACE_FILESYSTEM
#endif // !_LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__chrono/formatter.h b/contrib/llvm-project/libcxx/include/__chrono/formatter.h
index 30ed360d4ef5..4ad59382a414 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/formatter.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/formatter.h
@@ -198,7 +198,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
if (__year < 1000 || __year > 9999)
__formatter::__format_century(__year, __sstr);
else
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
} break;
case _CharT('j'):
@@ -209,7 +210,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
// an intemediate step.
__sstr << chrono::duration_cast<chrono::days>(chrono::duration_cast<chrono::seconds>(__value)).count();
else
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
break;
case _CharT('q'):
@@ -237,7 +239,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
case _CharT('S'):
case _CharT('T'):
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
if constexpr (__use_fraction<_Tp>())
__formatter::__format_sub_seconds(__value, __sstr);
break;
@@ -289,7 +292,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
__formatter::__format_year(__year, __sstr);
__sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "-{:02}-{:02}"), __t.tm_mon + 1, __t.tm_mday);
} else
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
} break;
case _CharT('Z'):
@@ -304,7 +308,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
// fractional part should be formatted.
if (*(__it + 1) == 'S') {
++__it;
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
__formatter::__format_sub_seconds(__value, __sstr);
break;
}
@@ -314,7 +319,8 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
++__it;
[[fallthrough]];
default:
- __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
break;
}
} else {
@@ -634,8 +640,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::day, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::day, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -646,8 +651,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -658,8 +662,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -670,8 +673,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -682,8 +684,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_indexed, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_indexed, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -694,8 +695,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -706,8 +706,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -718,8 +717,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -730,8 +728,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -742,8 +739,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -754,8 +750,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -766,8 +761,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -778,8 +772,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -790,8 +783,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
@@ -802,8 +794,7 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday_last, _CharT>
- : public __formatter_chrono<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
public:
using _Base = __formatter_chrono<_CharT>;
diff --git a/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h b/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h
index 0adee2d60db8..57d2247fe6a3 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/hh_mm_ss.h
@@ -24,85 +24,84 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
template <class _Duration>
-class hh_mm_ss
-{
+class hh_mm_ss {
private:
- static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
- using __CommonType = common_type_t<_Duration, chrono::seconds>;
-
- _LIBCPP_HIDE_FROM_ABI static constexpr uint64_t __pow10(unsigned __exp)
- {
- uint64_t __ret = 1;
- for (unsigned __i = 0; __i < __exp; ++__i)
- __ret *= 10U;
- return __ret;
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0)
- {
- if (__n >= 2 && __d != 0 && __w < 19)
- return 1 + __width(__n, __d % __n * 10, __w+1);
- return 0;
- }
+ static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
+ using __CommonType = common_type_t<_Duration, chrono::seconds>;
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr uint64_t __pow10(unsigned __exp) {
+ uint64_t __ret = 1;
+ for (unsigned __i = 0; __i < __exp; ++__i)
+ __ret *= 10U;
+ return __ret;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0) {
+ if (__n >= 2 && __d != 0 && __w < 19)
+ return 1 + __width(__n, __d % __n * 10, __w + 1);
+ return 0;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI static unsigned constexpr fractional_width = __width(__CommonType::period::den) < 19 ?
- __width(__CommonType::period::den) : 6u;
- using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
+ _LIBCPP_HIDE_FROM_ABI static unsigned constexpr fractional_width =
+ __width(__CommonType::period::den) < 19 ? __width(__CommonType::period::den) : 6u;
+ using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
- _LIBCPP_HIDE_FROM_ABI constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
- _LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept :
- __is_neg_(__d < _Duration(0)),
- __h_(chrono::duration_cast<chrono::hours> (chrono::abs(__d))),
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept
+ : __is_neg_(__d < _Duration(0)),
+ __h_(chrono::duration_cast<chrono::hours>(chrono::abs(__d))),
__m_(chrono::duration_cast<chrono::minutes>(chrono::abs(__d) - hours())),
__s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())),
- __f_(chrono::duration_cast<precision> (chrono::abs(__d) - hours() - minutes() - seconds()))
- {}
+ __f_(chrono::duration_cast<precision>(chrono::abs(__d) - hours() - minutes() - seconds())) {}
- _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
- _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
- _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept
- {
- auto __dur = __h_ + __m_ + __s_ + __f_;
- return __is_neg_ ? -__dur : __dur;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept {
+ auto __dur = __h_ + __m_ + __s_ + __f_;
+ return __is_neg_ ? -__dur : __dur;
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator precision() const noexcept { return to_duration(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator precision() const noexcept { return to_duration(); }
private:
- bool __is_neg_;
- chrono::hours __h_;
- chrono::minutes __m_;
- chrono::seconds __s_;
- precision __f_;
+ bool __is_neg_;
+ chrono::hours __h_;
+ chrono::minutes __m_;
+ chrono::seconds __s_;
+ precision __f_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss);
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); }
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept {
+ return __h >= hours(0) && __h < hours(12);
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept {
+ return __h >= hours(12) && __h < hours(24);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept
-{
- if (__h == hours( 0)) return hours(12);
- else if (__h <= hours(12)) return __h;
- else return __h - hours(12);
+_LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept {
+ if (__h == hours(0))
+ return hours(12);
+ else if (__h <= hours(12))
+ return __h;
+ else
+ return __h - hours(12);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept
-{
- if (__is_pm)
- return __h == hours(12) ? __h : __h + hours(12);
- else
- return __h == hours(12) ? hours(0) : __h;
+_LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept {
+ if (__is_pm)
+ return __h == hours(12) ? __h : __h + hours(12);
+ else
+ return __h == hours(12) ? hours(0) : __h;
}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h b/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h
index 778ff44f3d09..0697fd2de9b4 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/high_resolution_clock.h
@@ -20,8 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
typedef steady_clock high_resolution_clock;
diff --git a/contrib/llvm-project/libcxx/include/__chrono/literals.h b/contrib/llvm-project/libcxx/include/__chrono/literals.h
index 28ddc43a2c0c..89800440edf4 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/literals.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/literals.h
@@ -22,24 +22,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline namespace literals
-{
- inline namespace chrono_literals
- {
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator ""d(unsigned long long __d) noexcept
- {
- return chrono::day(static_cast<unsigned>(__d));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator ""y(unsigned long long __y) noexcept
- {
- return chrono::year(static_cast<int>(__y));
- }
+inline namespace literals {
+inline namespace chrono_literals {
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept {
+ return chrono::day(static_cast<unsigned>(__d));
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept {
+ return chrono::year(static_cast<int>(__y));
+}
} // namespace chrono_literals
} // namespace literals
namespace chrono { // hoist the literals into namespace std::chrono
- using namespace literals::chrono_literals;
+using namespace literals::chrono_literals;
} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__chrono/month.h b/contrib/llvm-project/libcxx/include/__chrono/month.h
index 2dee5d8c6c70..ce5cc21aab7d 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/month.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/month.h
@@ -22,64 +22,76 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class month {
private:
- unsigned char __m_;
+ unsigned char __m_;
+
public:
- month() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept : __m_(static_cast<unsigned char>(__val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept { *this += months{1}; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept { month __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept { *this -= months{1}; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept { month __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
+ month() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept
+ : __m_(static_cast<unsigned char>(__val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept {
+ *this += months{1};
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept {
+ month __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept {
+ *this -= months{1};
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept {
+ month __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month& __lhs, const month& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month& __lhs, const month& __rhs) noexcept {
- return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
+ return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month operator+ (const month& __lhs, const months& __rhs) noexcept
-{
- auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
- auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
- return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
+_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept {
+ auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
+ auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
+ return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month operator+ (const months& __lhs, const month& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month operator- (const month& __lhs, const months& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-months operator-(const month& __lhs, const month& __rhs) noexcept
-{
- auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
- return months(__dm <= 11 ? __dm : __dm + 12);
+_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept {
+ auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
+ return months(__dm <= 11 ? __dm : __dm + 12);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month& month::operator+=(const months& __dm) noexcept
-{ *this = *this + __dm; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month& month::operator-=(const months& __dm) noexcept
-{ *this = *this - __dm; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
inline constexpr month January{1};
inline constexpr month February{2};
diff --git a/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h b/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h
index eb9e42d01f85..791987965521 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h
@@ -22,72 +22,80 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class month_weekday {
private:
- chrono::month __m_;
- chrono::weekday_indexed __wdi_;
+ chrono::month __m_;
+ chrono::weekday_indexed __wdi_;
+
public:
- _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept
- : __m_{__mval}, __wdi_{__wdival} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval,
+ const chrono::weekday_indexed& __wdival) noexcept
+ : __m_{__mval}, __wdi_{__wdival} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept
-{ return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept
-{ return month_weekday{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept
-{ return month_weekday{month(__lhs), __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept {
+ return month_weekday{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept
-{ return month_weekday{__rhs, __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept {
+ return month_weekday{month(__lhs), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept
-{ return month_weekday{month(__rhs), __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept {
+ return month_weekday{__rhs, __lhs};
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept {
+ return month_weekday{month(__rhs), __lhs};
+}
class month_weekday_last {
- chrono::month __m_;
- chrono::weekday_last __wdl_;
- public:
- _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept
- : __m_{__mval}, __wdl_{__wdlval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
+ chrono::month __m_;
+ chrono::weekday_last __wdl_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval,
+ const chrono::weekday_last& __wdlval) noexcept
+ : __m_{__mval}, __wdl_{__wdlval} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept
-{ return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(const month& __lhs, const weekday_last& __rhs) noexcept
-{ return month_weekday_last{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(const month& __lhs, const weekday_last& __rhs) noexcept {
+ return month_weekday_last{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept
-{ return month_weekday_last{month(__lhs), __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept {
+ return month_weekday_last{month(__lhs), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(const weekday_last& __lhs, const month& __rhs) noexcept
-{ return month_weekday_last{__rhs, __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(const weekday_last& __lhs, const month& __rhs) noexcept {
+ return month_weekday_last{__rhs, __lhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept
-{ return month_weekday_last{month(__rhs), __lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept {
+ return month_weekday_last{month(__rhs), __lhs};
+}
} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__chrono/monthday.h b/contrib/llvm-project/libcxx/include/__chrono/monthday.h
index 8403d9ec4eeb..a89d16e51861 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/monthday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/monthday.h
@@ -24,101 +24,105 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class month_day {
private:
- chrono::month __m_;
- chrono::day __d_;
+ chrono::month __m_;
+ chrono::day __d_;
+
public:
- month_day() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept
- : __m_{__mval}, __d_{__dval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+ month_day() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept
+ : __m_{__mval}, __d_{__dval} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool month_day::ok() const noexcept
-{
- if (!__m_.ok()) return false;
- const unsigned __dval = static_cast<unsigned>(__d_);
- if (__dval < 1 || __dval > 31) return false;
- if (__dval <= 29) return true;
-// Now we've got either 30 or 31
- const unsigned __mval = static_cast<unsigned>(__m_);
- if (__mval == 2) return false;
- if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11)
- return __dval == 30;
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool month_day::ok() const noexcept {
+ if (!__m_.ok())
+ return false;
+ const unsigned __dval = static_cast<unsigned>(__d_);
+ if (__dval < 1 || __dval > 31)
+ return false;
+ if (__dval <= 29)
return true;
+ // Now we've got either 30 or 31
+ const unsigned __mval = static_cast<unsigned>(__m_);
+ if (__mval == 2)
+ return false;
+ if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11)
+ return __dval == 30;
+ return true;
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept
-{ return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept {
- if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
- return __c;
- return __lhs.day() <=> __rhs.day();
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept {
+ if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
+ return __c;
+ return __lhs.day() <=> __rhs.day();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const month& __lhs, const day& __rhs) noexcept
-{ return month_day{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, const day& __rhs) noexcept {
+ return month_day{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const day& __lhs, const month& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, const month& __rhs) noexcept {
+ return __rhs / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const month& __lhs, int __rhs) noexcept
-{ return __lhs / day(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept {
+ return __lhs / day(__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(int __lhs, const day& __rhs) noexcept
-{ return month(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept {
+ return month(__lhs) / __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day operator/(const day& __lhs, int __rhs) noexcept
-{ return month(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept {
+ return month(__rhs) / __lhs;
+}
class month_day_last {
private:
- chrono::month __m_;
+ chrono::month __m_;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept
- : __m_{__val} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept : __m_{__val} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept
-{ return __lhs.month() == __rhs.month(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
+ return __lhs.month() == __rhs.month();
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
- return __lhs.month() <=> __rhs.month();
+ return __lhs.month() <=> __rhs.month();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(const month& __lhs, last_spec) noexcept
-{ return month_day_last{__lhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept {
+ return month_day_last{__lhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(last_spec, const month& __rhs) noexcept
-{ return month_day_last{__rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept {
+ return month_day_last{__rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(int __lhs, last_spec) noexcept
-{ return month_day_last{month(__lhs)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept {
+ return month_day_last{month(__lhs)};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-month_day_last operator/(last_spec, int __rhs) noexcept
-{ return month_day_last{month(__rhs)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept {
+ return month_day_last{month(__rhs)};
+}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h b/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h
index cdcd2fa0d970..612a7f156e63 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/steady_clock.h
@@ -20,20 +20,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
-class _LIBCPP_EXPORTED_FROM_ABI steady_clock
-{
+class _LIBCPP_EXPORTED_FROM_ABI steady_clock {
public:
- typedef nanoseconds duration;
- typedef duration::rep rep;
- typedef duration::period period;
- typedef chrono::time_point<steady_clock, duration> time_point;
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = true;
+ typedef nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<steady_clock, duration> time_point;
+ static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = true;
- static time_point now() _NOEXCEPT;
+ static time_point now() _NOEXCEPT;
};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__chrono/system_clock.h b/contrib/llvm-project/libcxx/include/__chrono/system_clock.h
index 06fe071df2b6..5a9eb65bdae7 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/system_clock.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/system_clock.h
@@ -21,21 +21,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
-class _LIBCPP_EXPORTED_FROM_ABI system_clock
-{
+class _LIBCPP_EXPORTED_FROM_ABI system_clock {
public:
- typedef microseconds duration;
- typedef duration::rep rep;
- typedef duration::period period;
- typedef chrono::time_point<system_clock> time_point;
- static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
-
- static time_point now() _NOEXCEPT;
- static time_t to_time_t (const time_point& __t) _NOEXCEPT;
- static time_point from_time_t(time_t __t) _NOEXCEPT;
+ typedef microseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<system_clock> time_point;
+ static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
+
+ static time_point now() _NOEXCEPT;
+ static time_t to_time_t(const time_point& __t) _NOEXCEPT;
+ static time_point from_time_t(time_t __t) _NOEXCEPT;
};
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__chrono/time_point.h b/contrib/llvm-project/libcxx/include/__chrono/time_point.h
index 5060d9b55539..e65253ddb98e 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/time_point.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/time_point.h
@@ -28,108 +28,99 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
template <class _Clock, class _Duration = typename _Clock::duration>
-class _LIBCPP_TEMPLATE_VIS time_point
-{
- static_assert(__is_duration<_Duration>::value,
- "Second template parameter of time_point must be a std::chrono::duration");
+class _LIBCPP_TEMPLATE_VIS time_point {
+ static_assert(__is_duration<_Duration>::value,
+ "Second template parameter of time_point must be a std::chrono::duration");
+
public:
- typedef _Clock clock;
- typedef _Duration duration;
- typedef typename duration::rep rep;
- typedef typename duration::period period;
+ typedef _Clock clock;
+ typedef _Duration duration;
+ typedef typename duration::rep rep;
+ typedef typename duration::period period;
+
private:
- duration __d_;
+ duration __d_;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point() : __d_(duration::zero()) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit time_point(const duration& __d) : __d_(__d) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point() : __d_(duration::zero()) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit time_point(const duration& __d) : __d_(__d) {}
- // conversions
- template <class _Duration2, __enable_if_t<is_convertible<_Duration2, duration>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- time_point(const time_point<clock, _Duration2>& __t)
- : __d_(__t.time_since_epoch()) {}
+ // conversions
+ template <class _Duration2, __enable_if_t<is_convertible<_Duration2, duration>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point(const time_point<clock, _Duration2>& __t)
+ : __d_(__t.time_since_epoch()) {}
- // observer
+ // observer
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const {return __d_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const { return __d_; }
- // arithmetic
+ // arithmetic
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator+=(const duration& __d) {
+ __d_ += __d;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator-=(const duration& __d) {
+ __d_ -= __d;
+ return *this;
+ }
- // special values
+ // special values
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT {return time_point(duration::min());}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT {return time_point(duration::max());}
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT { return time_point(duration::min()); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT { return time_point(duration::max()); }
};
} // namespace chrono
template <class _Clock, class _Duration1, class _Duration2>
-struct _LIBCPP_TEMPLATE_VIS common_type<chrono::time_point<_Clock, _Duration1>,
- chrono::time_point<_Clock, _Duration2> >
-{
- typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
+struct _LIBCPP_TEMPLATE_VIS
+ common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> > {
+ typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
};
namespace chrono {
template <class _ToDuration, class _Clock, class _Duration>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, _ToDuration>
-time_point_cast(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, _ToDuration>
+time_point_cast(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
}
#if _LIBCPP_STD_VER >= 17
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-time_point<_Clock, _ToDuration>
-floor(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
+floor(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-time_point<_Clock, _ToDuration>
-ceil(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
+ceil(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-time_point<_Clock, _ToDuration>
-round(const time_point<_Clock, _Duration>& __t)
-{
- return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
+round(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
}
template <class _Rep, class _Period, enable_if_t<numeric_limits<_Rep>::is_signed, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-duration<_Rep, _Period>
-abs(duration<_Rep, _Period> __d)
-{
- return __d >= __d.zero() ? +__d : -__d;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) {
+ return __d >= __d.zero() ? +__d : -__d;
}
#endif // _LIBCPP_STD_VER >= 17
// time_point ==
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __lhs.time_since_epoch() == __rhs.time_since_epoch();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() == __rhs.time_since_epoch();
}
#if _LIBCPP_STD_VER <= 17
@@ -137,11 +128,9 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point !=
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return !(__lhs == __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__lhs == __rhs);
}
#endif // _LIBCPP_STD_VER <= 17
@@ -149,41 +138,33 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point <
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __lhs.time_since_epoch() < __rhs.time_since_epoch();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() < __rhs.time_since_epoch();
}
// time_point >
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __rhs < __lhs;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __rhs < __lhs;
}
// time_point <=
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return !(__rhs < __lhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__rhs < __lhs);
}
// time_point >=
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return !(__lhs < __rhs);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__lhs < __rhs);
}
#if _LIBCPP_STD_VER >= 20
@@ -191,7 +172,7 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
template <class _Clock, class _Duration1, three_way_comparable_with<_Duration1> _Duration2>
_LIBCPP_HIDE_FROM_ABI constexpr auto
operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
- return __lhs.time_since_epoch() <=> __rhs.time_since_epoch();
+ return __lhs.time_since_epoch() <=> __rhs.time_since_epoch();
}
#endif // _LIBCPP_STD_VER >= 20
@@ -200,42 +181,37 @@ operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
-operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
- return _Tr (__lhs.time_since_epoch() + __rhs);
+ time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+ operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
+ return _Tr(__lhs.time_since_epoch() + __rhs);
}
// time_point operator+(duration x, time_point y);
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
-operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __rhs + __lhs;
+ time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
+ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __rhs + __lhs;
}
// time_point operator-(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
-operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
-{
- typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret;
- return _Ret(__lhs.time_since_epoch() -__rhs);
+ time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret;
+ return _Ret(__lhs.time_since_epoch() - __rhs);
}
// duration operator-(time_point x, time_point y);
template <class _Clock, class _Duration1, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename common_type<_Duration1, _Duration2>::type
-operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
-{
- return __lhs.time_since_epoch() - __rhs.time_since_epoch();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename common_type<_Duration1, _Duration2>::type
+operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() - __rhs.time_since_epoch();
}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/weekday.h b/contrib/llvm-project/libcxx/include/__chrono/weekday.h
index 292fcb40dc30..5a7dedc6e3a1 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/weekday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/weekday.h
@@ -24,144 +24,155 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class weekday_indexed;
class weekday_last;
class weekday {
private:
- unsigned char __wd_;
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned char __weekday_from_days(int __days) noexcept;
+ unsigned char __wd_;
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned char __weekday_from_days(int __days) noexcept;
+
public:
weekday() = default;
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept : __wd_(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday(const sys_days& __sysd) noexcept
- : __wd_(__weekday_from_days(__sysd.time_since_epoch().count())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept
+ : __wd_(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday(const sys_days& __sysd) noexcept
+ : __wd_(__weekday_from_days(__sysd.time_since_epoch().count())) {}
_LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(const local_days& __locd) noexcept
- : __wd_(__weekday_from_days(__locd.time_since_epoch().count())) {}
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept { __wd_ = (__wd_ == 6 ? 0 : __wd_ + 1); return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator++(int) noexcept { weekday __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept { __wd_ = (__wd_ == 0 ? 6 : __wd_ - 1); return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
+ : __wd_(__weekday_from_days(__locd.time_since_epoch().count())) {}
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept {
+ __wd_ = (__wd_ == 6 ? 0 : __wd_ + 1);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator++(int) noexcept {
+ weekday __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept {
+ __wd_ = (__wd_ == 0 ? 6 : __wd_ - 1);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator--(int) noexcept {
+ weekday __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
_LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { return __wd_ == 0u ? 7 : __wd_; }
_LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; }
- _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
};
-
// https://howardhinnant.github.io/date_algorithms.html#weekday_from_days
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-unsigned char weekday::__weekday_from_days(int __days) noexcept
-{
- return static_cast<unsigned char>(
- static_cast<unsigned>(__days >= -4 ? (__days+4) % 7 : (__days+5) % 7 + 6)
- );
+_LIBCPP_HIDE_FROM_ABI inline constexpr unsigned char weekday::__weekday_from_days(int __days) noexcept {
+ return static_cast<unsigned char>(static_cast<unsigned>(__days >= -4 ? (__days + 4) % 7 : (__days + 5) % 7 + 6));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return __lhs.c_encoding() == __rhs.c_encoding(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return __lhs.c_encoding() == __rhs.c_encoding();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept
-{ return __lhs.c_encoding() < __rhs.c_encoding(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return __lhs.c_encoding() < __rhs.c_encoding();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept
-{ return __rhs < __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return __rhs < __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator<=(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return !(__rhs < __lhs);}
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<=(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return !(__rhs < __lhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return !(__lhs < __rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return !(__lhs < __rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday operator+(const weekday& __lhs, const days& __rhs) noexcept
-{
- auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
- auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
- return weekday{static_cast<unsigned>(__mu - __yr * 7)};
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept {
+ auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
+ auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
+ return weekday{static_cast<unsigned>(__mu - __yr * 7)};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday operator+(const days& __lhs, const weekday& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const days& __lhs, const weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday operator-(const weekday& __lhs, const days& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days operator-(const weekday& __lhs, const weekday& __rhs) noexcept
-{
- const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
- const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7;
- return days{__wdu - __wk * 7};
+_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept {
+ const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
+ const int __wk = (__wdu >= 0 ? __wdu : __wdu - 6) / 7;
+ return days{__wdu - __wk * 7};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday& weekday::operator+=(const days& __dd) noexcept
-{ *this = *this + __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator+=(const days& __dd) noexcept {
+ *this = *this + __dd;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday& weekday::operator-=(const days& __dd) noexcept
-{ *this = *this - __dd; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept {
+ *this = *this - __dd;
+ return *this;
+}
class weekday_indexed {
private:
- chrono::weekday __wd_;
- unsigned char __idx_;
+ chrono::weekday __wd_;
+ unsigned char __idx_;
+
public:
- weekday_indexed() = default;
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept
- : __wd_{__wdval}, __idx_(__idxval) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; }
+ weekday_indexed() = default;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept
+ : __wd_{__wdval}, __idx_(__idxval) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept
-{ return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept {
+ return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index();
+}
class weekday_last {
private:
- chrono::weekday __wd_;
+ chrono::weekday __wd_;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept
- : __wd_{__val} {}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept : __wd_{__val} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept
-{ return __lhs.weekday() == __rhs.weekday(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept {
+ return __lhs.weekday() == __rhs.weekday();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-weekday_last weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed weekday::operator[](unsigned __index) const noexcept {
+ return weekday_indexed{*this, __index};
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_last weekday::operator[](last_spec) const noexcept {
+ return weekday_last{*this};
+}
-inline constexpr weekday Sunday{0};
-inline constexpr weekday Monday{1};
-inline constexpr weekday Tuesday{2};
-inline constexpr weekday Wednesday{3};
-inline constexpr weekday Thursday{4};
-inline constexpr weekday Friday{5};
-inline constexpr weekday Saturday{6};
+inline constexpr weekday Sunday{0};
+inline constexpr weekday Monday{1};
+inline constexpr weekday Tuesday{2};
+inline constexpr weekday Wednesday{3};
+inline constexpr weekday Thursday{4};
+inline constexpr weekday Friday{5};
+inline constexpr weekday Saturday{6};
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year.h b/contrib/llvm-project/libcxx/include/__chrono/year.h
index 14bcbdafdd8a..1899d09f38db 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year.h
@@ -26,65 +26,81 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year {
private:
- short __y_;
+ short __y_;
+
public:
- year() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y_(static_cast<short>(__val)) {}
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept { ++__y_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept { --__y_; return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; }
- _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept { return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0); }
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
- _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
- _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{ 32767}; }
+ year() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y_(static_cast<short>(__val)) {}
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept {
+ ++__y_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator++(int) noexcept {
+ year __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept {
+ --__y_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator--(int) noexcept {
+ year __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept {
+ return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0);
+ }
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+ _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
+ _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; }
};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year& __lhs, const year& __rhs) noexcept
-{ return static_cast<int>(__lhs) == static_cast<int>(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year& __lhs, const year& __rhs) noexcept {
+ return static_cast<int>(__lhs) == static_cast<int>(__rhs);
+}
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, const year& __rhs) noexcept {
- return static_cast<int>(__lhs) <=> static_cast<int>(__rhs);
+ return static_cast<int>(__lhs) <=> static_cast<int>(__rhs);
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year operator+ (const year& __lhs, const years& __rhs) noexcept
-{ return year(static_cast<int>(__lhs) + __rhs.count()); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year operator+ (const years& __lhs, const year& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept {
+ return year(static_cast<int>(__lhs) + __rhs.count());
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year operator- (const year& __lhs, const years& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-years operator-(const year& __lhs, const year& __rhs) noexcept
-{ return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept {
+ return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year& year::operator+=(const years& __dy) noexcept
-{ *this = *this + __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year& year::operator-=(const years& __dy) noexcept
-{ *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
_LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept {
static_assert(static_cast<int>(std::numeric_limits<decltype(__y_)>::max()) == static_cast<int>(max()));
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year_month.h b/contrib/llvm-project/libcxx/include/__chrono/year_month.h
index 320cf588ccd3..369ea38f7560 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year_month.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year_month.h
@@ -24,73 +24,75 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year_month {
- chrono::year __y_;
- chrono::month __m_;
+ chrono::year __y_;
+ chrono::month __m_;
+
public:
- year_month() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept
- : __y_{__yval}, __m_{__mval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
+ year_month() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept
+ : __y_{__yval}, __m_{__mval} {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator/(const year& __y, const month& __m) noexcept { return year_month{__y, __m}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept {
+ return year_month{__y, __m};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator/(const year& __y, int __m) noexcept { return year_month{__y, month(__m)}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept {
+ return year_month{__y, month(__m)};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept {
- if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
- return __c;
- return __lhs.month() <=> __rhs.month();
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept {
+ if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
+ return __c;
+ return __lhs.month() <=> __rhs.month();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const year_month& __lhs, const months& __rhs) noexcept
-{
- int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count();
- const int __dy = (__dmi >= 0 ? __dmi : __dmi-11) / 12;
- __dmi = __dmi - __dy * 12 + 1;
- return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi));
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const months& __rhs) noexcept {
+ int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count();
+ const int __dy = (__dmi >= 0 ? __dmi : __dmi - 11) / 12;
+ __dmi = __dmi - __dy * 12 + 1;
+ return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const months& __lhs, const year_month& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const months& __lhs, const year_month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const year_month& __lhs, const years& __rhs) noexcept
-{ return (__lhs.year() + __rhs) / __lhs.month(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const years& __rhs) noexcept {
+ return (__lhs.year() + __rhs) / __lhs.month();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator+(const years& __lhs, const year_month& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const years& __lhs, const year_month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-months operator-(const year_month& __lhs, const year_month& __rhs) noexcept
-{ return (__lhs.year() - __rhs.year()) + months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month())); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const year_month& __lhs, const year_month& __rhs) noexcept {
+ return (__lhs.year() - __rhs.year()) +
+ months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month()));
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator-(const year_month& __lhs, const months& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month operator-(const year_month& __lhs, const years& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator+=(const months& __dm) noexcept {
*this = *this + __dm;
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h b/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h
index e84d2f8a838b..75884f3654d8 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year_month_day.h
@@ -31,271 +31,323 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year_month_day_last;
class year_month_day {
private:
- chrono::year __y_;
- chrono::month __m_;
- chrono::day __d_;
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::day __d_;
+
public:
- year_month_day() = default;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(
- const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
- : __y_{__yval}, __m_{__mval}, __d_{__dval} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(const sys_days& __sysd) noexcept
- : year_month_day(__from_days(__sysd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_day(const local_days& __locd) noexcept
- : year_month_day(__from_days(__locd.time_since_epoch())) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
-
- _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+ year_month_day() = default;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
+ : __y_{__yval}, __m_{__mval}, __d_{__dval} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(const sys_days& __sysd) noexcept
+ : year_month_day(__from_days(__sysd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_day(const local_days& __locd) noexcept
+ : year_month_day(__from_days(__locd.time_since_epoch())) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
};
-
// https://howardhinnant.github.io/date_algorithms.html#civil_from_days
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day year_month_day::__from_days(days __d) noexcept
-{
- static_assert(numeric_limits<unsigned>::digits >= 18, "");
- static_assert(numeric_limits<int>::digits >= 20 , "");
- const int __z = __d.count() + 719468;
- const int __era = (__z >= 0 ? __z : __z - 146096) / 146097;
- const unsigned __doe = static_cast<unsigned>(__z - __era * 146097); // [0, 146096]
- const unsigned __yoe = (__doe - __doe/1460 + __doe/36524 - __doe/146096) / 365; // [0, 399]
- const int __yr = static_cast<int>(__yoe) + __era * 400;
- const unsigned __doy = __doe - (365 * __yoe + __yoe/4 - __yoe/100); // [0, 365]
- const unsigned __mp = (5 * __doy + 2)/153; // [0, 11]
- const unsigned __dy = __doy - (153 * __mp + 2)/5 + 1; // [1, 31]
- const unsigned __mth = __mp + (__mp < 10 ? 3 : -9); // [1, 12]
- return year_month_day{chrono::year{__yr + (__mth <= 2)}, chrono::month{__mth}, chrono::day{__dy}};
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day year_month_day::__from_days(days __d) noexcept {
+ static_assert(numeric_limits<unsigned>::digits >= 18, "");
+ static_assert(numeric_limits<int>::digits >= 20, "");
+ const int __z = __d.count() + 719468;
+ const int __era = (__z >= 0 ? __z : __z - 146096) / 146097;
+ const unsigned __doe = static_cast<unsigned>(__z - __era * 146097); // [0, 146096]
+ const unsigned __yoe = (__doe - __doe / 1460 + __doe / 36524 - __doe / 146096) / 365; // [0, 399]
+ const int __yr = static_cast<int>(__yoe) + __era * 400;
+ const unsigned __doy = __doe - (365 * __yoe + __yoe / 4 - __yoe / 100); // [0, 365]
+ const unsigned __mp = (5 * __doy + 2) / 153; // [0, 11]
+ const unsigned __dy = __doy - (153 * __mp + 2) / 5 + 1; // [1, 31]
+ const unsigned __mth = __mp + (__mp < 10 ? 3 : -9); // [1, 12]
+ return year_month_day{chrono::year{__yr + (__mth <= 2)}, chrono::month{__mth}, chrono::day{__dy}};
}
// https://howardhinnant.github.io/date_algorithms.html#days_from_civil
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days year_month_day::__to_days() const noexcept
-{
- static_assert(numeric_limits<unsigned>::digits >= 18, "");
- static_assert(numeric_limits<int>::digits >= 20 , "");
-
- const int __yr = static_cast<int>(__y_) - (__m_ <= February);
- const unsigned __mth = static_cast<unsigned>(__m_);
- const unsigned __dy = static_cast<unsigned>(__d_);
-
- const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400;
- const unsigned __yoe = static_cast<unsigned>(__yr - __era * 400); // [0, 399]
- const unsigned __doy = (153 * (__mth + (__mth > 2 ? -3 : 9)) + 2) / 5 + __dy-1; // [0, 365]
- const unsigned __doe = __yoe * 365 + __yoe/4 - __yoe/100 + __doy; // [0, 146096]
- return days{__era * 146097 + static_cast<int>(__doe) - 719468};
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_day::__to_days() const noexcept {
+ static_assert(numeric_limits<unsigned>::digits >= 18, "");
+ static_assert(numeric_limits<int>::digits >= 20, "");
+
+ const int __yr = static_cast<int>(__y_) - (__m_ <= February);
+ const unsigned __mth = static_cast<unsigned>(__m_);
+ const unsigned __dy = static_cast<unsigned>(__d_);
+
+ const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400;
+ const unsigned __yoe = static_cast<unsigned>(__yr - __era * 400); // [0, 399]
+ const unsigned __doy = (153 * (__mth + (__mth > 2 ? -3 : 9)) + 2) / 5 + __dy - 1; // [0, 365]
+ const unsigned __doe = __yoe * 365 + __yoe / 4 - __yoe / 100 + __doy; // [0, 146096]
+ return days{__era * 146097 + static_cast<int>(__doe) - 719468};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
- if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
- return __c;
- if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
- return __c;
- return __lhs.day() <=> __rhs.day();
+ if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
+ return __c;
+ if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
+ return __c;
+ return __lhs.day() <=> __rhs.day();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept
-{ return year_month_day{__lhs.year(), __lhs.month(), __rhs}; }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const year_month& __lhs, int __rhs) noexcept
-{ return __lhs / day(__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept {
+ return year_month_day{__lhs.year(), __lhs.month(), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept
-{ return __lhs / __rhs.month() / __rhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, int __rhs) noexcept {
+ return __lhs / day(__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(int __lhs, const month_day& __rhs) noexcept
-{ return year(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept {
+ return __lhs / __rhs.month() / __rhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(int __lhs, const month_day& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator/(const month_day& __lhs, int __rhs) noexcept
-{ return year(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const year_month_day& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year()/__lhs.month() + __rhs)/__lhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const year_month_day& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const months& __lhs, const year_month_day& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const months& __lhs, const year_month_day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator-(const year_month_day& __lhs, const months& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator-(const year_month_day& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const year_month_day& __lhs, const years& __rhs) noexcept
-{ return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const year_month_day& __lhs, const years& __rhs) noexcept {
+ return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator+(const years& __lhs, const year_month_day& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const years& __lhs, const year_month_day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day operator-(const year_month_day& __lhs, const years& __rhs) noexcept
-{ return __lhs + -__rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator-(const year_month_day& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
class year_month_day_last {
private:
- chrono::year __y_;
- chrono::month_day_last __mdl_;
+ chrono::year __y_;
+ chrono::month_day_last __mdl_;
+
public:
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept
- : __y_{__yval}, __mdl_{__mdlval} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const months& __m) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const months& __m) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{year()/month()/day()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{year()/month()/day()}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept
+ : __y_{__yval}, __mdl_{__mdlval} {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const months& __m) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const months& __m) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept {
+ return sys_days{year() / month() / day()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{year() / month() / day()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-chrono::day year_month_day_last::day() const noexcept
-{
- constexpr chrono::day __d[] =
- {
- chrono::day(31), chrono::day(28), chrono::day(31),
- chrono::day(30), chrono::day(31), chrono::day(30),
- chrono::day(31), chrono::day(31), chrono::day(30),
- chrono::day(31), chrono::day(30), chrono::day(31)
- };
- return (month() != February || !__y_.is_leap()) && month().ok() ?
- __d[static_cast<unsigned>(month()) - 1] : chrono::day{29};
+_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day year_month_day_last::day() const noexcept {
+ constexpr chrono::day __d[] = {
+ chrono::day(31),
+ chrono::day(28),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31)};
+ return (month() != February || !__y_.is_leap()) && month().ok()
+ ? __d[static_cast<unsigned>(month()) - 1]
+ : chrono::day{29};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator!=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return !(__lhs == __rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator!=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return !(__lhs == __rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator< (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{
- if (__lhs.year() < __rhs.year()) return true;
- if (__lhs.year() > __rhs.year()) return false;
- return __lhs.month_day_last() < __rhs.month_day_last();
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator<(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ if (__lhs.year() < __rhs.year())
+ return true;
+ if (__lhs.year() > __rhs.year())
+ return false;
+ return __lhs.month_day_last() < __rhs.month_day_last();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator> (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __rhs < __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs < __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator<=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return !(__rhs < __lhs);}
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator<=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return !(__rhs < __lhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator>=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept
-{ return !(__lhs < __rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator>=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return !(__lhs < __rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept
-{ return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept {
+ return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(const year& __lhs, const month_day_last& __rhs) noexcept
-{ return year_month_day_last{__lhs, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator/(const year& __lhs, const month_day_last& __rhs) noexcept {
+ return year_month_day_last{__lhs, __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept
-{ return year_month_day_last{year{__lhs}, __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept {
+ return year_month_day_last{year{__lhs}, __rhs};
+}
_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator/(const month_day_last& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept
-{ return year{__rhs} / __lhs; }
+operator/(const month_day_last& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept {
+ return year{__rhs} / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year() / __lhs.month() + __rhs) / last; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / last;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept
-{ return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept {
+ return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day_last operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
: __y_{__ymdl.year()}, __m_{__ymdl.month()}, __d_{__ymdl.day()} {}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool year_month_day::ok() const noexcept
-{
- if (!__y_.ok() || !__m_.ok()) return false;
- return chrono::day{1} <= __d_ && __d_ <= (__y_ / __m_ / last).day();
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept {
+ if (!__y_.ok() || !__m_.ok())
+ return false;
+ return chrono::day{1} <= __d_ && __d_ <= (__y_ / __m_ / last).day();
}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h b/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h
index 4b5cb492a191..0c3dd494c878 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/year_month_weekday.h
@@ -31,211 +31,252 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
class year_month_weekday {
- chrono::year __y_;
- chrono::month __m_;
- chrono::weekday_indexed __wdi_;
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::weekday_indexed __wdi_;
+
public:
- year_month_weekday() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const chrono::year& __yval, const chrono::month& __mval,
- const chrono::weekday_indexed& __wdival) noexcept
- : __y_{__yval}, __m_{__mval}, __wdi_{__wdival} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const sys_days& __sysd) noexcept
- : year_month_weekday(__from_days(__sysd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept
- : year_month_weekday(__from_days(__locd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const months&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const months&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept
- {
- if (!__y_.ok() || !__m_.ok() || !__wdi_.ok()) return false;
- if (__wdi_.index() <= 4) return true;
- auto __nth_weekday_day =
- __wdi_.weekday() -
- chrono::weekday{static_cast<sys_days>(__y_ / __m_ / 1)} +
- days{(__wdi_.index() - 1) * 7 + 1};
- return static_cast<unsigned>(__nth_weekday_day.count()) <=
- static_cast<unsigned>((__y_ / __m_ / last).day());
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr year_month_weekday __from_days(days __d) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+ year_month_weekday() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept
+ : __y_{__yval}, __m_{__mval}, __wdi_{__wdival} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const sys_days& __sysd) noexcept
+ : year_month_weekday(__from_days(__sysd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept
+ : year_month_weekday(__from_days(__locd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const months&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const months&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
+ if (!__y_.ok() || !__m_.ok() || !__wdi_.ok())
+ return false;
+ if (__wdi_.index() <= 4)
+ return true;
+ auto __nth_weekday_day =
+ __wdi_.weekday() - chrono::weekday{static_cast<sys_days>(__y_ / __m_ / 1)} + days{(__wdi_.index() - 1) * 7 + 1};
+ return static_cast<unsigned>(__nth_weekday_day.count()) <= static_cast<unsigned>((__y_ / __m_ / last).day());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr year_month_weekday __from_days(days __d) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday year_month_weekday::__from_days(days __d) noexcept
-{
- const sys_days __sysd{__d};
- const chrono::weekday __wd = chrono::weekday(__sysd);
- const year_month_day __ymd = year_month_day(__sysd);
- return year_month_weekday{__ymd.year(), __ymd.month(),
- __wd[(static_cast<unsigned>(__ymd.day())-1)/7+1]};
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday year_month_weekday::__from_days(days __d) noexcept {
+ const sys_days __sysd{__d};
+ const chrono::weekday __wd = chrono::weekday(__sysd);
+ const year_month_day __ymd = year_month_day(__sysd);
+ return year_month_weekday{__ymd.year(), __ymd.month(), __wd[(static_cast<unsigned>(__ymd.day()) - 1) / 7 + 1]};
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days year_month_weekday::__to_days() const noexcept
-{
- const sys_days __sysd = sys_days(__y_/__m_/1);
- return (__sysd + (__wdi_.weekday() - chrono::weekday(__sysd) + days{(__wdi_.index()-1)*7}))
- .time_since_epoch();
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday::__to_days() const noexcept {
+ const sys_days __sysd = sys_days(__y_ / __m_ / 1);
+ return (__sysd + (__wdi_.weekday() - chrono::weekday(__sysd) + days{(__wdi_.index() - 1) * 7})).time_since_epoch();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept
-{ return year_month_weekday{__lhs.year(), __lhs.month(), __rhs}; }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const year& __lhs, const month_weekday& __rhs) noexcept
-{ return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() &&
+ __lhs.weekday_indexed() == __rhs.weekday_indexed();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept
-{ return year(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept {
+ return year_month_weekday{__lhs.year(), __lhs.month(), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const month_weekday& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const year& __lhs, const month_weekday& __rhs) noexcept {
+ return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept
-{ return year(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const month_weekday& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept
-{ return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept {
+ return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
class year_month_weekday_last {
private:
- chrono::year __y_;
- chrono::month __m_;
- chrono::weekday_last __wdl_;
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last(const chrono::year& __yval, const chrono::month& __mval,
- const chrono::weekday_last& __wdlval) noexcept
- : __y_{__yval}, __m_{__mval}, __wdl_{__wdlval} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::weekday_last __wdl_;
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept
+ : __y_{__yval}, __m_{__mval}, __wdl_{__wdlval} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
};
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-days year_month_weekday_last::__to_days() const noexcept
-{
- const sys_days __last = sys_days{__y_/__m_/last};
- return (__last - (chrono::weekday{__last} - __wdl_.weekday())).time_since_epoch();
-
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday_last::__to_days() const noexcept {
+ const sys_days __last = sys_days{__y_ / __m_ / last};
+ return (__last - (chrono::weekday{__last} - __wdl_.weekday())).time_since_epoch();
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-bool operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept
-{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); }
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept
-{ return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept
-{ return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept {
+ return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(int __lhs, const month_weekday_last& __rhs) noexcept
-{ return year(__lhs) / __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept {
+ return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept
-{ return __rhs / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(int __lhs, const month_weekday_last& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept
-{ return year(__rhs) / __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const month_weekday_last& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept
-{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last(); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last();
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept
-{ return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()}; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
+ return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()};
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept
-{ return __rhs + __lhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr
-year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept
-{ return __lhs + (-__rhs); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
} // namespace chrono
diff --git a/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h b/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h
index 5fad99bf5ce0..7aeb3da03a4f 100644
--- a/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h
+++ b/contrib/llvm-project/libcxx/include/__compare/common_comparison_category.h
@@ -24,17 +24,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace __comp_detail {
-enum _ClassifyCompCategory : unsigned {
- _None,
- _PartialOrd,
- _WeakOrd,
- _StrongOrd,
- _CCC_Size
-};
+enum _ClassifyCompCategory : unsigned { _None, _PartialOrd, _WeakOrd, _StrongOrd, _CCC_Size };
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr _ClassifyCompCategory __type_to_enum() noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory __type_to_enum() noexcept {
if (is_same_v<_Tp, partial_ordering>)
return _PartialOrd;
if (is_same_v<_Tp, weak_ordering>)
@@ -45,8 +38,7 @@ constexpr _ClassifyCompCategory __type_to_enum() noexcept {
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI
-constexpr _ClassifyCompCategory
+_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory
__compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
int __seen[_CCC_Size] = {};
for (auto __type : __types)
@@ -60,12 +52,11 @@ __compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
return _StrongOrd;
}
-template <class ..._Ts, bool _False = false>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto __get_comp_type() {
- using _CCC = _ClassifyCompCategory;
+template <class... _Ts, bool _False = false>
+_LIBCPP_HIDE_FROM_ABI constexpr auto __get_comp_type() {
+ using _CCC = _ClassifyCompCategory;
constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...};
- constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds);
+ constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds);
if constexpr (__cat == _None)
return void();
else if constexpr (__cat == _PartialOrd)
@@ -80,12 +71,12 @@ constexpr auto __get_comp_type() {
} // namespace __comp_detail
// [cmp.common], common comparison category type
-template<class... _Ts>
+template <class... _Ts>
struct _LIBCPP_TEMPLATE_VIS common_comparison_category {
using type = decltype(__comp_detail::__get_comp_type<_Ts...>());
};
-template<class... _Ts>
+template <class... _Ts>
using common_comparison_category_t = typename common_comparison_category<_Ts...>::type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h b/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h
index a49408e1cfda..e0efa3ccb88d 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h
@@ -27,44 +27,46 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __compare_partial_order_fallback {
- struct __fn {
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype( std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))
- { return std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); }
+struct __fn {
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
+ -> decltype(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
+ return std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less :
- std::forward<_Up>(__u) < std::forward<_Tp>(__t) ? partial_ordering::greater :
- partial_ordering::unordered))
- -> decltype( std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less :
- std::forward<_Up>(__u) < std::forward<_Tp>(__t) ? partial_ordering::greater :
- partial_ordering::unordered)
- {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less :
- std::forward<_Up>(__u) < std::forward<_Tp>(__t) ? partial_ordering::greater :
- partial_ordering::unordered;
- }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
+ std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
+ : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
+ ? partial_ordering::greater
+ : partial_ordering::unordered))
+ -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
+ : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
+ ? partial_ordering::greater
+ : partial_ordering::unordered) {
+ return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
+ : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
+ ? partial_ordering::greater
+ : partial_ordering::unordered;
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
+ }
+};
} // namespace __compare_partial_order_fallback
inline namespace __cpo {
- inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{};
+inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h b/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h
index 9e2dfee6b389..a94d517ed30f 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h
@@ -27,41 +27,43 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __compare_strong_order_fallback {
- struct __fn {
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype( std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))
- { return std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); }
+struct __fn {
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
+ -> decltype(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
+ return std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? strong_ordering::less :
- strong_ordering::greater))
- -> decltype( std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? strong_ordering::less :
- strong_ordering::greater)
- {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? strong_ordering::less :
- strong_ordering::greater;
- }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
+ std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? strong_ordering::less
+ : strong_ordering::greater))
+ -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? strong_ordering::less
+ : strong_ordering::greater) {
+ return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? strong_ordering::less
+ : strong_ordering::greater;
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
+ }
+};
} // namespace __compare_strong_order_fallback
inline namespace __cpo {
- inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{};
+inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h b/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h
index b1ed2d1e7251..01c12076c0d7 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_three_way.h
@@ -22,16 +22,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-struct _LIBCPP_TEMPLATE_VIS compare_three_way
-{
- template<class _T1, class _T2>
- requires three_way_comparable_with<_T1, _T2>
- constexpr _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) <=> std::forward<_T2>(__u)))
- { return std::forward<_T1>(__t) <=> std::forward<_T2>(__u); }
-
- using is_transparent = void;
+struct _LIBCPP_TEMPLATE_VIS compare_three_way {
+ template <class _T1, class _T2>
+ requires three_way_comparable_with<_T1, _T2>
+ constexpr _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) <=> std::forward<_T2>(__u))) {
+ return std::forward<_T1>(__t) <=> std::forward<_T2>(__u);
+ }
+
+ using is_transparent = void;
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h b/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h
index 632ebdce1bce..d7508073433a 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_three_way_result.h
@@ -21,20 +21,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class, class, class>
-struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result { };
-
-template<class _Tp, class _Up>
-struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<_Tp, _Up, decltype(
- std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void()
-)> {
- using type = decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>());
+template <class, class, class>
+struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result {};
+
+template <class _Tp, class _Up>
+struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<
+ _Tp,
+ _Up,
+ decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void())> {
+ using type = decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>());
};
-template<class _Tp, class _Up = _Tp>
-struct _LIBCPP_TEMPLATE_VIS compare_three_way_result : __compare_three_way_result<_Tp, _Up, void> { };
+template <class _Tp, class _Up = _Tp>
+struct _LIBCPP_TEMPLATE_VIS compare_three_way_result : __compare_three_way_result<_Tp, _Up, void> {};
-template<class _Tp, class _Up = _Tp>
+template <class _Tp, class _Up = _Tp>
using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h b/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h
index b0a04abcaaf0..062b7b582cd7 100644
--- a/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h
+++ b/contrib/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h
@@ -27,41 +27,43 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __compare_weak_order_fallback {
- struct __fn {
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype( std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))
- { return std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); }
+struct __fn {
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
+ -> decltype(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
+ return std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? weak_ordering::less :
- weak_ordering::greater))
- -> decltype( std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? weak_ordering::less :
- weak_ordering::greater)
- {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent :
- std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? weak_ordering::less :
- weak_ordering::greater;
- }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
+ std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? weak_ordering::less
+ : weak_ordering::greater))
+ -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? weak_ordering::less
+ : weak_ordering::greater) {
+ return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
+ : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
+ ? weak_ordering::less
+ : weak_ordering::greater;
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
+ }
+};
} // namespace __compare_weak_order_fallback
inline namespace __cpo {
- inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{};
+inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/ordering.h b/contrib/llvm-project/libcxx/include/__compare/ordering.h
index c9a15efb3c2f..2995d381304f 100644
--- a/contrib/llvm-project/libcxx/include/__compare/ordering.h
+++ b/contrib/llvm-project/libcxx/include/__compare/ordering.h
@@ -22,46 +22,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// exposition only
-enum class _OrdResult : signed char {
- __less = -1,
- __equiv = 0,
- __greater = 1
-};
+enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 };
-enum class _NCmpResult : signed char {
- __unordered = -127
-};
+enum class _NCmpResult : signed char { __unordered = -127 };
class partial_ordering;
class weak_ordering;
class strong_ordering;
-template<class _Tp, class... _Args>
+template <class _Tp, class... _Args>
inline constexpr bool __one_of_v = (is_same_v<_Tp, _Args> || ...);
struct _CmpUnspecifiedParam {
- _LIBCPP_HIDE_FROM_ABI constexpr
- _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
- template<class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>>
+ template <class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>>
_CmpUnspecifiedParam(_Tp) = delete;
};
class partial_ordering {
using _ValueT = signed char;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr partial_ordering(_OrdResult __v) noexcept
- : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr partial_ordering(_NCmpResult __v) noexcept
- : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_NCmpResult __v) noexcept : __value_(_ValueT(__v)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool __is_ordered() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_ordered() const noexcept {
return __value_ != _ValueT(_NCmpResult::__unordered);
}
+
public:
// valid values
static const partial_ordering less;
@@ -70,63 +59,54 @@ public:
static const partial_ordering unordered;
// comparisons
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ == 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ < 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ <= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ > 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__is_ordered() && __v.__value_ >= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 < __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 <= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 > __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v.__is_ordered() && 0 >= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering
+ operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering
+ operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v);
}
+
private:
_ValueT __value_;
};
@@ -139,76 +119,62 @@ inline constexpr partial_ordering partial_ordering::unordered(_NCmpResult ::__un
class weak_ordering {
using _ValueT = signed char;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
public:
static const weak_ordering less;
static const weak_ordering equivalent;
static const weak_ordering greater;
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator partial_ordering() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept {
return __value_ == 0 ? partial_ordering::equivalent
- : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
+ : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
}
// comparisons
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ == 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ < 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ <= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ > 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ >= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 < __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 <= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 > __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return 0 >= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v);
}
@@ -223,8 +189,7 @@ inline constexpr weak_ordering weak_ordering::greater(_OrdResult::__greater);
class strong_ordering {
using _ValueT = signed char;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
public:
static const strong_ordering less;
@@ -233,74 +198,61 @@ public:
static const strong_ordering greater;
// conversions
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator partial_ordering() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept {
return __value_ == 0 ? partial_ordering::equivalent
- : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
+ : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator weak_ordering() const noexcept {
- return __value_ == 0 ? weak_ordering::equivalent
- : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater);
+ _LIBCPP_HIDE_FROM_ABI constexpr operator weak_ordering() const noexcept {
+ return __value_ == 0 ? weak_ordering::equivalent : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater);
}
// comparisons
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ == 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ < 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ <= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ > 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v.__value_ >= 0;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 < __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 <= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator> (_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 > __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return 0 >= __v.__value_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
+ operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
+ operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v);
}
diff --git a/contrib/llvm-project/libcxx/include/__compare/partial_order.h b/contrib/llvm-project/libcxx/include/__compare/partial_order.h
index 36a11dfaa288..f3ed4900fbff 100644
--- a/contrib/llvm-project/libcxx/include/__compare/partial_order.h
+++ b/contrib/llvm-project/libcxx/include/__compare/partial_order.h
@@ -28,43 +28,44 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __partial_order {
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>)
- noexcept(noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
+ noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
+ }
+};
} // namespace __partial_order
inline namespace __cpo {
- inline constexpr auto partial_order = __partial_order::__fn{};
+inline constexpr auto partial_order = __partial_order::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/strong_order.h b/contrib/llvm-project/libcxx/include/__compare/strong_order.h
index cbfcf7316de9..5f6ade5aef8e 100644
--- a/contrib/llvm-project/libcxx/include/__compare/strong_order.h
+++ b/contrib/llvm-project/libcxx/include/__compare/strong_order.h
@@ -34,100 +34,99 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __strong_order {
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>)
- noexcept(noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
+ noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept
- {
- if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
- int32_t __rx = std::bit_cast<int32_t>(__t);
- int32_t __ry = std::bit_cast<int32_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
- int64_t __rx = std::bit_cast<int64_t>(__t);
- int64_t __ry = std::bit_cast<int64_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if (__t < __u) {
- return strong_ordering::less;
- } else if (__t > __u) {
- return strong_ordering::greater;
- } else if (__t == __u) {
- if constexpr (numeric_limits<_Dp>::radix == 2) {
- return std::signbit(__u) <=> std::signbit(__t);
- } else {
- // This is bullet 3 of the IEEE754 algorithm, relevant
- // only for decimal floating-point;
- // see https://stackoverflow.com/questions/69068075/
- if (__t == 0 || std::isinf(__t)) {
- return std::signbit(__u) <=> std::signbit(__t);
- } else {
- int __texp, __uexp;
- (void)std::frexp(__t, &__texp);
- (void)std::frexp(__u, &__uexp);
- return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
- }
- }
- } else {
- // They're unordered, so one of them must be a NAN.
- // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
- bool __t_is_nan = std::isnan(__t);
- bool __u_is_nan = std::isnan(__u);
- bool __t_is_negative = std::signbit(__t);
- bool __u_is_negative = std::signbit(__u);
- using _IntType = conditional_t<
- sizeof(__t) == sizeof(int32_t), int32_t, conditional_t<
- sizeof(__t) == sizeof(int64_t), int64_t, void>
- >;
- if constexpr (is_same_v<_IntType, void>) {
- static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
- } else if (__t_is_nan && __u_is_nan) {
- // Order by sign bit, then by "payload bits" (we'll just use bit_cast).
- if (__t_is_negative != __u_is_negative) {
- return (__u_is_negative <=> __t_is_negative);
- } else {
- return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u);
- }
- } else if (__t_is_nan) {
- return __t_is_negative ? strong_ordering::less : strong_ordering::greater;
- } else {
- return __u_is_negative ? strong_ordering::greater : strong_ordering::less;
- }
- }
+ template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
+ requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept {
+ if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
+ int32_t __rx = std::bit_cast<int32_t>(__t);
+ int32_t __ry = std::bit_cast<int32_t>(__u);
+ __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
+ __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
+ return (__rx <=> __ry);
+ } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
+ int64_t __rx = std::bit_cast<int64_t>(__t);
+ int64_t __ry = std::bit_cast<int64_t>(__u);
+ __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
+ __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
+ return (__rx <=> __ry);
+ } else if (__t < __u) {
+ return strong_ordering::less;
+ } else if (__t > __u) {
+ return strong_ordering::greater;
+ } else if (__t == __u) {
+ if constexpr (numeric_limits<_Dp>::radix == 2) {
+ return std::signbit(__u) <=> std::signbit(__t);
+ } else {
+ // This is bullet 3 of the IEEE754 algorithm, relevant
+ // only for decimal floating-point;
+ // see https://stackoverflow.com/questions/69068075/
+ if (__t == 0 || std::isinf(__t)) {
+ return std::signbit(__u) <=> std::signbit(__t);
+ } else {
+ int __texp, __uexp;
+ (void)std::frexp(__t, &__texp);
+ (void)std::frexp(__u, &__uexp);
+ return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
}
+ }
+ } else {
+ // They're unordered, so one of them must be a NAN.
+ // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
+ bool __t_is_nan = std::isnan(__t);
+ bool __u_is_nan = std::isnan(__u);
+ bool __t_is_negative = std::signbit(__t);
+ bool __u_is_negative = std::signbit(__u);
+ using _IntType =
+ conditional_t< sizeof(__t) == sizeof(int32_t),
+ int32_t,
+ conditional_t< sizeof(__t) == sizeof(int64_t), int64_t, void> >;
+ if constexpr (is_same_v<_IntType, void>) {
+ static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
+ } else if (__t_is_nan && __u_is_nan) {
+ // Order by sign bit, then by "payload bits" (we'll just use bit_cast).
+ if (__t_is_negative != __u_is_negative) {
+ return (__u_is_negative <=> __t_is_negative);
+ } else {
+ return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u);
+ }
+ } else if (__t_is_nan) {
+ return __t_is_negative ? strong_ordering::less : strong_ordering::greater;
+ } else {
+ return __u_is_negative ? strong_ordering::greater : strong_ordering::less;
+ }
+ }
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
+ }
+};
} // namespace __strong_order
inline namespace __cpo {
- inline constexpr auto strong_order = __strong_order::__fn{};
+inline constexpr auto strong_order = __strong_order::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h b/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h
index 2b77bc3f54e6..7a44ea9158a6 100644
--- a/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h
+++ b/contrib/llvm-project/libcxx/include/__compare/three_way_comparable.h
@@ -27,30 +27,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Cat>
-concept __compares_as =
- same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;
+template <class _Tp, class _Cat>
+concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;
-template<class _Tp, class _Cat = partial_ordering>
+template <class _Tp, class _Cat = partial_ordering>
concept three_way_comparable =
- __weakly_equality_comparable_with<_Tp, _Tp> &&
- __partially_ordered_with<_Tp, _Tp> &&
- requires(__make_const_lvalue_ref<_Tp> __a, __make_const_lvalue_ref<_Tp> __b) {
- { __a <=> __b } -> __compares_as<_Cat>;
- };
+ __weakly_equality_comparable_with<_Tp, _Tp> && __partially_ordered_with<_Tp, _Tp> &&
+ requires(__make_const_lvalue_ref<_Tp> __a, __make_const_lvalue_ref<_Tp> __b) {
+ { __a <=> __b } -> __compares_as<_Cat>;
+ };
-template<class _Tp, class _Up, class _Cat = partial_ordering>
+template <class _Tp, class _Up, class _Cat = partial_ordering>
concept three_way_comparable_with =
- three_way_comparable<_Tp, _Cat> &&
- three_way_comparable<_Up, _Cat> &&
- common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
- three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
- __weakly_equality_comparable_with<_Tp, _Up> &&
- __partially_ordered_with<_Tp, _Up> &&
- requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
- { __t <=> __u } -> __compares_as<_Cat>;
- { __u <=> __t } -> __compares_as<_Cat>;
- };
+ three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> &&
+ common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
+ three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
+ __weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> &&
+ requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
+ { __t <=> __u } -> __compares_as<_Cat>;
+ { __u <=> __t } -> __compares_as<_Cat>;
+ };
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__compare/weak_order.h b/contrib/llvm-project/libcxx/include/__compare/weak_order.h
index e6a42ac4c923..9f719eb64bbc 100644
--- a/contrib/llvm-project/libcxx/include/__compare/weak_order.h
+++ b/contrib/llvm-project/libcxx/include/__compare/weak_order.h
@@ -28,71 +28,70 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __weak_order {
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<3>)
- noexcept(noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<3>) noexcept(
+ noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept
- {
- partial_ordering __po = (__t <=> __u);
- if (__po == partial_ordering::less) {
- return weak_ordering::less;
- } else if (__po == partial_ordering::equivalent) {
- return weak_ordering::equivalent;
- } else if (__po == partial_ordering::greater) {
- return weak_ordering::greater;
- } else {
- // Otherwise, at least one of them is a NaN.
- bool __t_is_nan = std::isnan(__t);
- bool __u_is_nan = std::isnan(__u);
- bool __t_is_negative = std::signbit(__t);
- bool __u_is_negative = std::signbit(__u);
- if (__t_is_nan && __u_is_nan) {
- return (__u_is_negative <=> __t_is_negative);
- } else if (__t_is_nan) {
- return __t_is_negative ? weak_ordering::less : weak_ordering::greater;
- } else {
- return __u_is_negative ? weak_ordering::greater : weak_ordering::less;
- }
- }
- }
+ template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
+ requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept {
+ partial_ordering __po = (__t <=> __u);
+ if (__po == partial_ordering::less) {
+ return weak_ordering::less;
+ } else if (__po == partial_ordering::equivalent) {
+ return weak_ordering::equivalent;
+ } else if (__po == partial_ordering::greater) {
+ return weak_ordering::greater;
+ } else {
+ // Otherwise, at least one of them is a NaN.
+ bool __t_is_nan = std::isnan(__t);
+ bool __u_is_nan = std::isnan(__u);
+ bool __t_is_negative = std::signbit(__t);
+ bool __u_is_negative = std::signbit(__u);
+ if (__t_is_nan && __u_is_nan) {
+ return (__u_is_negative <=> __t_is_negative);
+ } else if (__t_is_nan) {
+ return __t_is_negative ? weak_ordering::less : weak_ordering::greater;
+ } else {
+ return __u_is_negative ? weak_ordering::greater : weak_ordering::less;
+ }
+ }
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()); }
- };
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>());
+ }
+};
} // namespace __weak_order
inline namespace __cpo {
- inline constexpr auto weak_order = __weak_order::__fn{};
+inline constexpr auto weak_order = __weak_order::__fn{};
} // namespace __cpo
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config
index 7f66042f9025..adff13e714cb 100644
--- a/contrib/llvm-project/libcxx/include/__config
+++ b/contrib/llvm-project/libcxx/include/__config
@@ -1010,8 +1010,8 @@ typedef __char32_t char32_t;
# endif
# ifndef _LIBCPP_HAS_NO_ASAN
- extern "C" _LIBCPP_EXPORTED_FROM_ABI void
- __sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*);
+extern "C" _LIBCPP_EXPORTED_FROM_ABI void
+__sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*);
extern "C" _LIBCPP_EXPORTED_FROM_ABI void __sanitizer_annotate_double_ended_contiguous_container(
const void*, const void*, const void*, const void*, const void*, const void*);
extern "C" _LIBCPP_EXPORTED_FROM_ABI int
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
index 4e4e3eb5ba30..54bfe5b44f4c 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
@@ -32,166 +32,141 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle;
template <>
struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
public:
- // [coroutine.handle.con], construct/reset
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI
- coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept {
- return __handle_ != nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool done() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI
- void resume() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void destroy() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
+ // [coroutine.handle.con], construct/reset
+ constexpr coroutine_handle() noexcept = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr coroutine_handle(nullptr_t) noexcept {}
+
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle& operator=(nullptr_t) noexcept {
+ __handle_ = nullptr;
+ return *this;
+ }
+
+ // [coroutine.handle.export.import], export/import
+ _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
+ coroutine_handle __tmp;
+ __tmp.__handle_ = __addr;
+ return __tmp;
+ }
+
+ // [coroutine.handle.observers], observers
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI bool done() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
+ return __builtin_coro_done(__handle_);
+ }
+
+ // [coroutine.handle.resumption], resumption
+ _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
+
+ _LIBCPP_HIDE_FROM_ABI void resume() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
+ __builtin_coro_resume(__handle_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void destroy() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
+ __builtin_coro_destroy(__handle_);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
+ // FIXME actually implement a check for if the coro is suspended.
+ return __handle_ != nullptr;
+ }
- void* __handle_ = nullptr;
+ void* __handle_ = nullptr;
};
// [coroutine.handle.compare]
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return __x.address() == __y.address();
+inline _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+ return __x.address() == __y.address();
}
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr strong_ordering operator<=>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return compare_three_way()(__x.address(), __y.address());
+inline _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
+operator<=>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
+ return compare_three_way()(__x.address(), __y.address());
}
template <class _Promise>
struct _LIBCPP_TEMPLATE_VIS coroutine_handle {
public:
- // [coroutine.handle.con], construct/reset
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI
- static coroutine_handle from_promise(_Promise& __promise) {
- using _RawPromise = __remove_cv_t<_Promise>;
- coroutine_handle __tmp;
- __tmp.__handle_ =
- __builtin_coro_promise(std::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.conv], conversion
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept {
- return __handle_ != nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool done() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI
- void resume() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void destroy() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
-
- // [coroutine.handle.promise], promise access
- _LIBCPP_HIDE_FROM_ABI
- _Promise& promise() const {
- return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
- }
+ // [coroutine.handle.con], construct/reset
+ constexpr coroutine_handle() noexcept = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr coroutine_handle(nullptr_t) noexcept {}
+
+ _LIBCPP_HIDE_FROM_ABI static coroutine_handle from_promise(_Promise& __promise) {
+ using _RawPromise = __remove_cv_t<_Promise>;
+ coroutine_handle __tmp;
+ __tmp.__handle_ =
+ __builtin_coro_promise(std::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle& operator=(nullptr_t) noexcept {
+ __handle_ = nullptr;
+ return *this;
+ }
+
+ // [coroutine.handle.export.import], export/import
+ _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
+ coroutine_handle __tmp;
+ __tmp.__handle_ = __addr;
+ return __tmp;
+ }
+
+ // [coroutine.handle.conv], conversion
+ _LIBCPP_HIDE_FROM_ABI constexpr operator coroutine_handle<>() const noexcept {
+ return coroutine_handle<>::from_address(address());
+ }
+
+ // [coroutine.handle.observers], observers
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI bool done() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
+ return __builtin_coro_done(__handle_);
+ }
+
+ // [coroutine.handle.resumption], resumption
+ _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
+
+ _LIBCPP_HIDE_FROM_ABI void resume() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
+ __builtin_coro_resume(__handle_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void destroy() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
+ __builtin_coro_destroy(__handle_);
+ }
+
+ // [coroutine.handle.promise], promise access
+ _LIBCPP_HIDE_FROM_ABI _Promise& promise() const {
+ return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
+ }
private:
- _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
- void* __handle_ = nullptr;
+ _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
+ // FIXME actually implement a check for if the coro is suspended.
+ return __handle_ != nullptr;
+ }
+ void* __handle_ = nullptr;
};
// [coroutine.handle.hash]
template <class _Tp>
struct hash<coroutine_handle<_Tp>> {
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept { return hash<void*>()(__v.address()); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept {
+ return hash<void*>()(__v.address());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h
index 7122cc8ea8fb..78f05341f748 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_traits.h
@@ -34,17 +34,12 @@ template <class _Tp, class = void>
struct __coroutine_traits_sfinae {};
template <class _Tp>
-struct __coroutine_traits_sfinae<
- _Tp, __void_t<typename _Tp::promise_type> >
-{
+struct __coroutine_traits_sfinae< _Tp, __void_t<typename _Tp::promise_type> > {
using promise_type = typename _Tp::promise_type;
};
template <class _Ret, class... _Args>
-struct coroutine_traits
- : public __coroutine_traits_sfinae<_Ret>
-{
-};
+struct coroutine_traits : public __coroutine_traits_sfinae<_Ret> {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h b/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h
index 9b7802d1e282..da13d579604b 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
+# if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
// [coroutine.noop]
// [coroutine.promise.noop]
@@ -30,80 +30,67 @@ struct noop_coroutine_promise {};
template <>
struct _LIBCPP_TEMPLATE_VIS coroutine_handle<noop_coroutine_promise> {
public:
- // [coroutine.handle.noop.conv], conversion
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.noop.observers], observers
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool done() const noexcept { return false; }
-
- // [coroutine.handle.noop.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void resume() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void destroy() const noexcept {}
-
- // [coroutine.handle.noop.promise], promise access
- _LIBCPP_HIDE_FROM_ABI
- noop_coroutine_promise& promise() const noexcept {
- return *static_cast<noop_coroutine_promise*>(
- __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false));
- }
-
- // [coroutine.handle.noop.address], address
- _LIBCPP_HIDE_FROM_ABI
- constexpr void* address() const noexcept { return __handle_; }
+ // [coroutine.handle.noop.conv], conversion
+ _LIBCPP_HIDE_FROM_ABI constexpr operator coroutine_handle<>() const noexcept {
+ return coroutine_handle<>::from_address(address());
+ }
+
+ // [coroutine.handle.noop.observers], observers
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return true; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool done() const noexcept { return false; }
+
+ // [coroutine.handle.noop.resumption], resumption
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void resume() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void destroy() const noexcept {}
+
+ // [coroutine.handle.noop.promise], promise access
+ _LIBCPP_HIDE_FROM_ABI noop_coroutine_promise& promise() const noexcept {
+ return *static_cast<noop_coroutine_promise*>(
+ __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false));
+ }
+
+ // [coroutine.handle.noop.address], address
+ _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
private:
- _LIBCPP_HIDE_FROM_ABI
- friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept;
+ _LIBCPP_HIDE_FROM_ABI friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept;
-#if __has_builtin(__builtin_coro_noop)
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept {
- this->__handle_ = __builtin_coro_noop();
- }
+# if __has_builtin(__builtin_coro_noop)
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept { this->__handle_ = __builtin_coro_noop(); }
- void* __handle_ = nullptr;
+ void* __handle_ = nullptr;
-#elif defined(_LIBCPP_COMPILER_GCC)
- // GCC doesn't implement __builtin_coro_noop().
- // Construct the coroutine frame manually instead.
- struct __noop_coroutine_frame_ty_ {
- static void __dummy_resume_destroy_func() { }
+# elif defined(_LIBCPP_COMPILER_GCC)
+ // GCC doesn't implement __builtin_coro_noop().
+ // Construct the coroutine frame manually instead.
+ struct __noop_coroutine_frame_ty_ {
+ static void __dummy_resume_destroy_func() {}
- void (*__resume_)() = __dummy_resume_destroy_func;
- void (*__destroy_)() = __dummy_resume_destroy_func;
- struct noop_coroutine_promise __promise_;
- };
+ void (*__resume_)() = __dummy_resume_destroy_func;
+ void (*__destroy_)() = __dummy_resume_destroy_func;
+ struct noop_coroutine_promise __promise_;
+ };
- static __noop_coroutine_frame_ty_ __noop_coroutine_frame_;
+ static __noop_coroutine_frame_ty_ __noop_coroutine_frame_;
- void* __handle_ = &__noop_coroutine_frame_;
+ void* __handle_ = &__noop_coroutine_frame_;
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default;
-#endif // __has_builtin(__builtin_coro_noop)
+# endif // __has_builtin(__builtin_coro_noop)
};
using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
-#if defined(_LIBCPP_COMPILER_GCC)
-inline noop_coroutine_handle::__noop_coroutine_frame_ty_
- noop_coroutine_handle::__noop_coroutine_frame_{};
-#endif
+# if defined(_LIBCPP_COMPILER_GCC)
+inline noop_coroutine_handle::__noop_coroutine_frame_ty_ noop_coroutine_handle::__noop_coroutine_frame_{};
+# endif
// [coroutine.noop.coroutine]
-inline _LIBCPP_HIDE_FROM_ABI
-noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); }
+inline _LIBCPP_HIDE_FROM_ABI noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); }
-#endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
+# endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h b/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h
index 0e4b08e377c0..b604bd3c2d8a 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h
@@ -22,21 +22,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [coroutine.trivial.awaitables]
struct suspend_never {
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool await_ready() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_resume() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr bool await_ready() const noexcept { return true; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_suspend(coroutine_handle<>) const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_resume() const noexcept {}
};
struct suspend_always {
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool await_ready() const noexcept { return false; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void await_resume() const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr bool await_ready() const noexcept { return false; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_suspend(coroutine_handle<>) const noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr void await_resume() const noexcept {}
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h b/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h
index dce61923bc9c..7eb77d81ab2a 100644
--- a/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h
+++ b/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h
@@ -23,8 +23,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
# ifdef _LIBCPP_CXX03_LANG
# error Support for unspecified stability is only for C++11 and higher
diff --git a/contrib/llvm-project/libcxx/include/__expected/expected.h b/contrib/llvm-project/libcxx/include/__expected/expected.h
index bf16c8f720d2..97f92bdfe44c 100644
--- a/contrib/llvm-project/libcxx/include/__expected/expected.h
+++ b/contrib/llvm-project/libcxx/include/__expected/expected.h
@@ -90,19 +90,14 @@ _LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
template <class _Tp, class _Err>
class expected {
- static_assert(
- !is_reference_v<_Tp> &&
- !is_function_v<_Tp> &&
- !is_same_v<remove_cv_t<_Tp>, in_place_t> &&
- !is_same_v<remove_cv_t<_Tp>, unexpect_t> &&
- !__is_std_unexpected<remove_cv_t<_Tp>>::value &&
- __valid_std_unexpected<_Err>::value
- ,
- "[expected.object.general] A program that instantiates the definition of template expected<T, E> for a "
- "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a "
- "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the "
- "definition of the template expected<T, E> with a type for the E parameter that is not a valid "
- "template argument for unexpected is ill-formed.");
+ static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> &&
+ !is_same_v<remove_cv_t<_Tp>, unexpect_t> && !__is_std_unexpected<remove_cv_t<_Tp>>::value &&
+ __valid_std_unexpected<_Err>::value,
+ "[expected.object.general] A program that instantiates the definition of template expected<T, E> for a "
+ "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a "
+ "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the "
+ "definition of the template expected<T, E> with a type for the E parameter that is not a valid "
+ "template argument for unexpected is ill-formed.");
template <class _Up, class _OtherErr>
friend class expected;
@@ -116,36 +111,33 @@ public:
using rebind = expected<_Up, error_type>;
// [expected.object.ctor], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr expected()
- noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened
requires is_default_constructible_v<_Tp>
: __union_(std::in_place), __has_val_(true) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
_LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&)
- requires(is_copy_constructible_v<_Tp> &&
- is_copy_constructible_v<_Err> &&
- is_trivially_copy_constructible_v<_Tp> &&
+ requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Tp> &&
is_trivially_copy_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __other)
- noexcept(is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __other) noexcept(
+ is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
!(is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>))
- : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) { }
+ : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
- requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err>
- && is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)
+ requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Tp> &&
+ is_trivially_move_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __other)
- noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __other) noexcept(
+ is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>)
requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
!(is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>))
- : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) { }
+ : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {}
private:
template <class _Up, class _OtherErr, class _UfQual, class _OtherErrQual>
@@ -182,16 +174,16 @@ public:
requires __can_convert<_Up, _OtherErr, const _Up&, const _OtherErr&>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _Up&, _Tp> ||
!is_convertible_v<const _OtherErr&, _Err>)
- expected(const expected<_Up, _OtherErr>& __other)
- noexcept(is_nothrow_constructible_v<_Tp, const _Up&> &&
- is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ expected(const expected<_Up, _OtherErr>& __other) noexcept(
+ is_nothrow_constructible_v<_Tp, const _Up&> &&
+ is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, _Up, _OtherErr>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp> || !is_convertible_v<_OtherErr, _Err>)
- expected(expected<_Up, _OtherErr>&& __other)
- noexcept(is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(expected<_Up, _OtherErr>&& __other) noexcept(
+ is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {}
template <class _Up = _Tp>
@@ -204,42 +196,38 @@ public:
template <class _OtherErr>
requires is_constructible_v<_Err, const _OtherErr&>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
- expected(const unexpected<_OtherErr>& __unex)
- noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
+ const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(std::unexpect, __unex.error()), __has_val_(false) {}
template <class _OtherErr>
requires is_constructible_v<_Err, _OtherErr>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(unexpected<_OtherErr>&& __unex)
- noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {}
template <class... _Args>
requires is_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Tp, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Tp, _Args...>) // strengthened
: __union_(std::in_place, std::forward<_Args>(__args)...), __has_val_(true) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Tp, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit
- expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened
: __union_(std::in_place, __il, std::forward<_Args>(__args)...), __has_val_(true) {}
template <class... _Args>
requires is_constructible_v<_Err, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, _Args...>) // strengthened
: __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit
- expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
: __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {}
// [expected.object.dtor], destructor
@@ -286,17 +274,12 @@ public:
// [expected.object.assign], assignment
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs)
- noexcept(is_nothrow_copy_assignable_v<_Tp> &&
- is_nothrow_copy_constructible_v<_Tp> &&
- is_nothrow_copy_assignable_v<_Err> &&
- is_nothrow_copy_constructible_v<_Err>) // strengthened
- requires(is_copy_assignable_v<_Tp> &&
- is_copy_constructible_v<_Tp> &&
- is_copy_assignable_v<_Err> &&
+ _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
+ is_nothrow_copy_assignable_v<_Tp> && is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_assignable_v<_Err> &&
+ is_nothrow_copy_constructible_v<_Err>) // strengthened
+ requires(is_copy_assignable_v<_Tp> && is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Err> &&
is_copy_constructible_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> ||
- is_nothrow_move_constructible_v<_Err>))
+ (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
if (__has_val_ && __rhs.__has_val_) {
__union_.__val_ = __rhs.__union_.__val_;
@@ -312,17 +295,12 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&& __rhs)
- noexcept(is_nothrow_move_assignable_v<_Tp> &&
- is_nothrow_move_constructible_v<_Tp> &&
- is_nothrow_move_assignable_v<_Err> &&
- is_nothrow_move_constructible_v<_Err>)
- requires(is_move_constructible_v<_Tp> &&
- is_move_assignable_v<_Tp> &&
- is_move_constructible_v<_Err> &&
+ _LIBCPP_HIDE_FROM_ABI constexpr expected&
+ operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Tp> && is_nothrow_move_constructible_v<_Tp> &&
+ is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>)
+ requires(is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp> && is_move_constructible_v<_Err> &&
is_move_assignable_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> ||
- is_nothrow_move_constructible_v<_Err>))
+ (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
if (__has_val_ && __rhs.__has_val_) {
__union_.__val_ = std::move(__rhs.__union_.__val_);
@@ -340,12 +318,9 @@ public:
template <class _Up = _Tp>
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v)
- requires(!is_same_v<expected, remove_cvref_t<_Up>> &&
- !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
- is_constructible_v<_Tp, _Up> &&
- is_assignable_v<_Tp&, _Up> &&
- (is_nothrow_constructible_v<_Tp, _Up> ||
- is_nothrow_move_constructible_v<_Tp> ||
+ requires(!is_same_v<expected, remove_cvref_t<_Up>> && !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
+ is_constructible_v<_Tp, _Up> && is_assignable_v<_Tp&, _Up> &&
+ (is_nothrow_constructible_v<_Tp, _Up> || is_nothrow_move_constructible_v<_Tp> ||
is_nothrow_move_constructible_v<_Err>))
{
if (__has_val_) {
@@ -418,20 +393,14 @@ public:
return __union_.__val_;
}
-
public:
// [expected.object.swap], swap
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(expected& __rhs)
- noexcept(is_nothrow_move_constructible_v<_Tp> &&
- is_nothrow_swappable_v<_Tp> &&
- is_nothrow_move_constructible_v<_Err> &&
- is_nothrow_swappable_v<_Err>)
- requires(is_swappable_v<_Tp> &&
- is_swappable_v<_Err> &&
- is_move_constructible_v<_Tp> &&
+ _LIBCPP_HIDE_FROM_ABI constexpr void
+ swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp> &&
+ is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
+ requires(is_swappable_v<_Tp> && is_swappable_v<_Err> && is_move_constructible_v<_Tp> &&
is_move_constructible_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> ||
- is_nothrow_move_constructible_v<_Err>))
+ (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) {
if constexpr (is_nothrow_move_constructible_v<_Err>) {
@@ -479,8 +448,7 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y)
- noexcept(noexcept(__x.swap(__y)))
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y)))
requires requires { __x.swap(__y); }
{
__x.swap(__y);
@@ -724,7 +692,8 @@ public:
return expected<_Up, _Err>(unexpect, error());
}
if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
+ return expected<_Up, _Err>(
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
} else {
std::invoke(std::forward<_Func>(__f), __union_.__val_);
return expected<_Up, _Err>();
@@ -739,7 +708,8 @@ public:
return expected<_Up, _Err>(unexpect, error());
}
if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
+ return expected<_Up, _Err>(
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
} else {
std::invoke(std::forward<_Func>(__f), __union_.__val_);
return expected<_Up, _Err>();
@@ -900,7 +870,7 @@ private:
template <class _ValueType, class _ErrorType>
requires(is_trivially_move_constructible_v<_ValueType> && is_trivially_move_constructible_v<_ErrorType>)
union __union_t<_ValueType, _ErrorType> {
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
_LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default;
template <class... _Args>
@@ -982,8 +952,8 @@ public:
requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs)
- noexcept(is_nothrow_copy_constructible_v<_Err>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs) noexcept(
+ is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_constructible_v<_Err> && !is_trivially_copy_constructible_v<_Err>)
: __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {}
@@ -991,51 +961,47 @@ public:
requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
= default;
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs)
- noexcept(is_nothrow_move_constructible_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs) noexcept(is_nothrow_move_constructible_v<_Err>)
requires(is_move_constructible_v<_Err> && !is_trivially_move_constructible_v<_Err>)
: __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, const _OtherErr&>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
- expected(const expected<_Up, _OtherErr>& __rhs)
- noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ expected(const expected<_Up, _OtherErr>& __rhs) noexcept(
+ is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, _OtherErr>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(expected<_Up, _OtherErr>&& __rhs)
- noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(expected<_Up, _OtherErr>&& __rhs) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {}
template <class _OtherErr>
requires is_constructible_v<_Err, const _OtherErr&>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
- expected(const unexpected<_OtherErr>& __unex)
- noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
+ const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
: __union_(std::unexpect, __unex.error()), __has_val_(false) {}
template <class _OtherErr>
requires is_constructible_v<_Err, _OtherErr>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(unexpected<_OtherErr>&& __unex)
- noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
+ expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
: __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {}
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __has_val_(true) {}
template <class... _Args>
requires is_constructible_v<_Err, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, _Args...>) // strengthened
: __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args)
- noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
: __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {}
private:
@@ -1069,8 +1035,8 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs)
- noexcept(is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened
+ _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
+ is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>)
{
if (__has_val_) {
@@ -1091,11 +1057,9 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&& __rhs)
- noexcept(is_nothrow_move_assignable_v<_Err> &&
- is_nothrow_move_constructible_v<_Err>)
- requires(is_move_assignable_v<_Err> &&
- is_move_constructible_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr expected&
+ operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>)
+ requires(is_move_assignable_v<_Err> && is_move_constructible_v<_Err>)
{
if (__has_val_) {
if (!__rhs.__has_val_) {
@@ -1145,8 +1109,8 @@ public:
}
// [expected.void.swap], swap
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(expected& __rhs)
- noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
+ _LIBCPP_HIDE_FROM_ABI constexpr void
+ swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
requires(is_swappable_v<_Err> && is_move_constructible_v<_Err>)
{
auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) {
@@ -1170,8 +1134,7 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y)
- noexcept(noexcept(__x.swap(__y)))
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y)))
requires requires { __x.swap(__y); }
{
__x.swap(__y);
@@ -1318,8 +1281,8 @@ public:
template <class _Func>
_LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&&>>;
- static_assert(__is_std_expected<_Gp>::value,
- "The result of f(std::move(error())) must be a specialization of std::expected");
+ static_assert(
+ __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(std::move(error())) must have the same value_type as this expected");
if (has_value()) {
@@ -1331,8 +1294,8 @@ public:
template <class _Func>
_LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&&>>;
- static_assert(__is_std_expected<_Gp>::value,
- "The result of f(std::move(error())) must be a specialization of std::expected");
+ static_assert(
+ __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(std::move(error())) must have the same value_type as this expected");
if (has_value()) {
@@ -1506,7 +1469,7 @@ private:
requires is_trivially_move_constructible_v<_ErrorType>
union __union_t<_ErrorType> {
_LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {}
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
_LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default;
template <class... _Args>
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h b/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h
index 60cab4ee6973..1bf71292c8a6 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h
@@ -22,54 +22,44 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
enum class copy_options : unsigned short {
- none = 0,
- skip_existing = 1,
- overwrite_existing = 2,
- update_existing = 4,
- recursive = 8,
- copy_symlinks = 16,
- skip_symlinks = 32,
- directories_only = 64,
- create_symlinks = 128,
- create_hard_links = 256,
+ none = 0,
+ skip_existing = 1,
+ overwrite_existing = 2,
+ update_existing = 4,
+ recursive = 8,
+ copy_symlinks = 16,
+ skip_symlinks = 32,
+ directories_only = 64,
+ create_symlinks = 128,
+ create_hard_links = 256,
__in_recursive_copy = 512,
};
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
- static_cast<unsigned short>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
+ return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
- static_cast<unsigned short>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
+ return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
- static_cast<unsigned short>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
+ return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr copy_options operator~(copy_options __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
return __lhs = __lhs & __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
return __lhs = __lhs | __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
return __lhs = __lhs ^ __rhs;
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h b/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h
index fe3cace853d6..016ad94a853d 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/directory_entry.h
@@ -45,219 +45,149 @@ class directory_entry {
public:
// constructors and destructors
- _LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit directory_entry(_Path const& __p) : __p_(__p) {
+ _LIBCPP_HIDE_FROM_ABI explicit directory_entry(_Path const& __p) : __p_(__p) {
error_code __ec;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) {
- __refresh(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { __refresh(&__ec); }
_LIBCPP_HIDE_FROM_ABI ~directory_entry() {}
- _LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- void assign(_Path const& __p) {
+ _LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p) {
__p_ = __p;
error_code __ec;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void assign(_Path const& __p, error_code& __ec) {
+ _LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p, error_code& __ec) {
__p_ = __p;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void replace_filename(_Path const& __p) {
+ _LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p) {
__p_.replace_filename(__p);
error_code __ec;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void replace_filename(_Path const& __p, error_code& __ec) {
+ _LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p, error_code& __ec) {
__p_ = __p_.parent_path() / __p;
__refresh(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void refresh() { __refresh(); }
+ _LIBCPP_HIDE_FROM_ABI void refresh() { __refresh(); }
- _LIBCPP_HIDE_FROM_ABI
- void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
+ _LIBCPP_HIDE_FROM_ABI void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- _Path const& path() const noexcept { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI _Path const& path() const noexcept { return __p_; }
- _LIBCPP_HIDE_FROM_ABI
- operator const _Path&() const noexcept { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI operator const _Path&() const noexcept { return __p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
+ _LIBCPP_HIDE_FROM_ABI bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
- _LIBCPP_HIDE_FROM_ABI
- bool exists(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool exists(error_code& __ec) const noexcept {
return filesystem::exists(file_status{__get_ft(&__ec)});
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_block_file() const { return __get_ft() == file_type::block; }
+ _LIBCPP_HIDE_FROM_ABI bool is_block_file() const { return __get_ft() == file_type::block; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_block_file(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_block_file(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::block;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_character_file() const { return __get_ft() == file_type::character; }
+ _LIBCPP_HIDE_FROM_ABI bool is_character_file() const { return __get_ft() == file_type::character; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_character_file(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_character_file(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::character;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_directory() const { return __get_ft() == file_type::directory; }
+ _LIBCPP_HIDE_FROM_ABI bool is_directory() const { return __get_ft() == file_type::directory; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_directory(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_directory(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::directory;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_fifo() const { return __get_ft() == file_type::fifo; }
+ _LIBCPP_HIDE_FROM_ABI bool is_fifo() const { return __get_ft() == file_type::fifo; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_fifo(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::fifo;
- }
+ _LIBCPP_HIDE_FROM_ABI bool is_fifo(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::fifo; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
+ _LIBCPP_HIDE_FROM_ABI bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
- _LIBCPP_HIDE_FROM_ABI
- bool is_other(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_other(error_code& __ec) const noexcept {
return filesystem::is_other(file_status{__get_ft(&__ec)});
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_regular_file() const { return __get_ft() == file_type::regular; }
+ _LIBCPP_HIDE_FROM_ABI bool is_regular_file() const { return __get_ft() == file_type::regular; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_regular_file(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_regular_file(error_code& __ec) const noexcept {
return __get_ft(&__ec) == file_type::regular;
}
- _LIBCPP_HIDE_FROM_ABI
- bool is_socket() const { return __get_ft() == file_type::socket; }
+ _LIBCPP_HIDE_FROM_ABI bool is_socket() const { return __get_ft() == file_type::socket; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_socket(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::socket;
- }
+ _LIBCPP_HIDE_FROM_ABI bool is_socket(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::socket; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
+ _LIBCPP_HIDE_FROM_ABI bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
- _LIBCPP_HIDE_FROM_ABI
- bool is_symlink(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI bool is_symlink(error_code& __ec) const noexcept {
return __get_sym_ft(&__ec) == file_type::symlink;
}
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t file_size() const { return __get_size(); }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t file_size() const { return __get_size(); }
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t file_size(error_code& __ec) const noexcept {
- return __get_size(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t hard_link_count() const { return __get_nlink(); }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count() const { return __get_nlink(); }
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t hard_link_count(error_code& __ec) const noexcept {
- return __get_nlink(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(error_code& __ec) const noexcept { return __get_nlink(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- file_time_type last_write_time() const { return __get_write_time(); }
+ _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time() const { return __get_write_time(); }
- _LIBCPP_HIDE_FROM_ABI
- file_time_type last_write_time(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(error_code& __ec) const noexcept {
return __get_write_time(&__ec);
}
- _LIBCPP_HIDE_FROM_ABI
- file_status status() const { return __get_status(); }
+ _LIBCPP_HIDE_FROM_ABI file_status status() const { return __get_status(); }
- _LIBCPP_HIDE_FROM_ABI
- file_status status(error_code& __ec) const noexcept {
- return __get_status(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI file_status status(error_code& __ec) const noexcept { return __get_status(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- file_status symlink_status() const { return __get_symlink_status(); }
+ _LIBCPP_HIDE_FROM_ABI file_status symlink_status() const { return __get_symlink_status(); }
- _LIBCPP_HIDE_FROM_ABI
- file_status symlink_status(error_code& __ec) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI file_status symlink_status(error_code& __ec) const noexcept {
return __get_symlink_status(&__ec);
}
+ _LIBCPP_HIDE_FROM_ABI bool operator==(directory_entry const& __rhs) const noexcept { return __p_ == __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator==(directory_entry const& __rhs) const noexcept {
- return __p_ == __rhs.__p_;
- }
+# if _LIBCPP_STD_VER <= 17
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(directory_entry const& __rhs) const noexcept { return __p_ != __rhs.__p_; }
-#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(directory_entry const& __rhs) const noexcept {
- return __p_ != __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator<(directory_entry const& __rhs) const noexcept { return __p_ < __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator<(directory_entry const& __rhs) const noexcept {
- return __p_ < __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator<=(directory_entry const& __rhs) const noexcept { return __p_ <= __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator<=(directory_entry const& __rhs) const noexcept {
- return __p_ <= __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator>(directory_entry const& __rhs) const noexcept { return __p_ > __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator>(directory_entry const& __rhs) const noexcept {
- return __p_ > __rhs.__p_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool operator>=(directory_entry const& __rhs) const noexcept { return __p_ >= __rhs.__p_; }
- _LIBCPP_HIDE_FROM_ABI
- bool operator>=(directory_entry const& __rhs) const noexcept {
- return __p_ >= __rhs.__p_;
- }
-
-#else // _LIBCPP_STD_VER <= 17
+# else // _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
return __p_ <=> __rhs.__p_;
}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI
- friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
+ _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
return __os << __d.path();
}
@@ -284,23 +214,20 @@ private:
file_type __type_;
_CacheType __cache_type_;
- _LIBCPP_HIDE_FROM_ABI
- __cached_data() noexcept { __reset(); }
+ _LIBCPP_HIDE_FROM_ABI __cached_data() noexcept { __reset(); }
- _LIBCPP_HIDE_FROM_ABI
- void __reset() {
+ _LIBCPP_HIDE_FROM_ABI void __reset() {
__cache_type_ = _Empty;
- __type_ = file_type::none;
+ __type_ = file_type::none;
__sym_perms_ = __non_sym_perms_ = perms::unknown;
__size_ = __nlink_ = uintmax_t(-1);
- __write_time_ = file_time_type::min();
+ __write_time_ = file_time_type::min();
}
};
- _LIBCPP_HIDE_FROM_ABI
- static __cached_data __create_iter_result(file_type __ft) {
+ _LIBCPP_HIDE_FROM_ABI static __cached_data __create_iter_result(file_type __ft) {
__cached_data __data;
- __data.__type_ = __ft;
+ __data.__type_ = __ft;
__data.__cache_type_ = [&]() {
switch (__ft) {
case file_type::none:
@@ -314,16 +241,14 @@ private:
return __data;
}
- _LIBCPP_HIDE_FROM_ABI
- void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
- __p_ = std::move(__p);
+ _LIBCPP_HIDE_FROM_ABI void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
+ __p_ = std::move(__p);
__data_ = __dt;
}
_LIBCPP_EXPORTED_FROM_ABI error_code __do_refresh() noexcept;
- _LIBCPP_HIDE_FROM_ABI
- static bool __is_dne_error(error_code const& __ec) {
+ _LIBCPP_HIDE_FROM_ABI static bool __is_dne_error(error_code const& __ec) {
if (!__ec)
return true;
switch (static_cast<errc>(__ec.value())) {
@@ -335,9 +260,8 @@ private:
}
}
- _LIBCPP_HIDE_FROM_ABI
- void __handle_error(const char* __msg, error_code* __dest_ec,
- error_code const& __ec, bool __allow_dne = false) const {
+ _LIBCPP_HIDE_FROM_ABI void
+ __handle_error(const char* __msg, error_code* __dest_ec, error_code const& __ec, bool __allow_dne = false) const {
if (__dest_ec) {
*__dest_ec = __ec;
return;
@@ -346,14 +270,14 @@ private:
__throw_filesystem_error(__msg, __p_, __ec);
}
- _LIBCPP_HIDE_FROM_ABI
- void __refresh(error_code* __ec = nullptr) {
- __handle_error("in directory_entry::refresh", __ec, __do_refresh(),
+ _LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) {
+ __handle_error("in directory_entry::refresh",
+ __ec,
+ __do_refresh(),
/*allow_dne*/ true);
}
- _LIBCPP_HIDE_FROM_ABI
- file_type __get_sym_ft(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_type __get_sym_ft(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
return __symlink_status(__p_, __ec).type();
@@ -375,8 +299,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_type __get_ft(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_type __get_ft(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterSymlink:
@@ -396,8 +319,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_status __get_status(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_status __get_status(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -411,8 +333,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_status __get_symlink_status(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_status __get_symlink_status(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -427,8 +348,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t __get_size(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI uintmax_t __get_size(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -441,10 +361,8 @@ private:
file_status __st(__get_ft(&__m_ec));
__handle_error("in directory_entry::file_size", __ec, __m_ec);
if (filesystem::exists(__st) && !filesystem::is_regular_file(__st)) {
- errc __err_kind = filesystem::is_directory(__st) ? errc::is_a_directory
- : errc::not_supported;
- __handle_error("in directory_entry::file_size", __ec,
- make_error_code(__err_kind));
+ errc __err_kind = filesystem::is_directory(__st) ? errc::is_a_directory : errc::not_supported;
+ __handle_error("in directory_entry::file_size", __ec, make_error_code(__err_kind));
}
return __data_.__size_;
}
@@ -452,8 +370,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- uintmax_t __get_nlink(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI uintmax_t __get_nlink(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -471,8 +388,7 @@ private:
__libcpp_unreachable();
}
- _LIBCPP_HIDE_FROM_ABI
- file_time_type __get_write_time(error_code* __ec = nullptr) const {
+ _LIBCPP_HIDE_FROM_ABI file_time_type __get_write_time(error_code* __ec = nullptr) const {
switch (__data_.__cache_type_) {
case _Empty:
case _IterNonSymlink:
@@ -484,10 +400,8 @@ private:
error_code __m_ec;
file_status __st(__get_ft(&__m_ec));
__handle_error("in directory_entry::last_write_time", __ec, __m_ec);
- if (filesystem::exists(__st) &&
- __data_.__write_time_ == file_time_type::min())
- __handle_error("in directory_entry::last_write_time", __ec,
- make_error_code(errc::value_too_large));
+ if (filesystem::exists(__st) && __data_.__write_time_ == file_time_type::min())
+ __handle_error("in directory_entry::last_write_time", __ec, make_error_code(errc::value_too_large));
return __data_.__write_time_;
}
}
@@ -501,16 +415,13 @@ private:
class __dir_element_proxy {
public:
- inline _LIBCPP_HIDE_FROM_ABI directory_entry operator*() {
- return std::move(__elem_);
- }
+ inline _LIBCPP_HIDE_FROM_ABI directory_entry operator*() { return std::move(__elem_); }
private:
friend class directory_iterator;
friend class recursive_directory_iterator;
_LIBCPP_HIDE_FROM_ABI explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {}
- _LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o)
- : __elem_(std::move(__o.__elem_)) {}
+ _LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o) : __elem_(std::move(__o.__elem_)) {}
directory_entry __elem_;
};
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h b/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h
index a2a48e593307..29bd8da6caa4 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/directory_iterator.h
@@ -45,33 +45,24 @@ public:
typedef input_iterator_tag iterator_category;
public:
- //ctor & dtor
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator() noexcept {}
+ // ctor & dtor
+ _LIBCPP_HIDE_FROM_ABI directory_iterator() noexcept {}
- _LIBCPP_HIDE_FROM_ABI
- explicit directory_iterator(const path& __p)
- : directory_iterator(__p, nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit directory_iterator(const path& __p) : directory_iterator(__p, nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator(const path& __p, directory_options __opts)
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts)
: directory_iterator(__p, nullptr, __opts) {}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator(const path& __p, error_code& __ec)
- : directory_iterator(__p, &__ec) {}
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, error_code& __ec) : directory_iterator(__p, &__ec) {}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator(const path& __p, directory_options __opts,
- error_code& __ec)
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts, error_code& __ec)
: directory_iterator(__p, &__ec, __opts) {}
- _LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default;
+ _LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default;
_LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(const directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator& operator=(directory_iterator&& __o) noexcept {
+ _LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(directory_iterator&& __o) noexcept {
// non-default implementation provided to support self-move assign.
if (this != &__o) {
__imp_ = std::move(__o.__imp_);
@@ -81,27 +72,22 @@ public:
_LIBCPP_HIDE_FROM_ABI ~directory_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry& operator*() const {
+ _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const {
_LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "The end iterator cannot be dereferenced");
return __dereference();
}
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry* operator->() const { return &**this; }
+ _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &**this; }
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator& operator++() { return __increment(); }
+ _LIBCPP_HIDE_FROM_ABI directory_iterator& operator++() { return __increment(); }
- _LIBCPP_HIDE_FROM_ABI
- __dir_element_proxy operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
__dir_element_proxy __p(**this);
__increment();
return __p;
}
- _LIBCPP_HIDE_FROM_ABI
- directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
+ _LIBCPP_HIDE_FROM_ABI directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
# if _LIBCPP_STD_VER >= 20
@@ -111,8 +97,7 @@ public:
private:
inline _LIBCPP_HIDE_FROM_ABI friend bool
- operator==(const directory_iterator& __lhs,
- const directory_iterator& __rhs) noexcept;
+ operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept;
// construct the dir_stream
_LIBCPP_EXPORTED_FROM_ABI directory_iterator(const path&, error_code*, directory_options = directory_options::none);
@@ -126,43 +111,35 @@ private:
};
inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const directory_iterator& __lhs,
- const directory_iterator& __rhs) noexcept {
+operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
return __lhs.__imp_ == __rhs.__imp_;
}
inline _LIBCPP_HIDE_FROM_ABI bool
-operator!=(const directory_iterator& __lhs,
- const directory_iterator& __rhs) noexcept {
+operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
return !(__lhs == __rhs);
}
// enable directory_iterator range-based for statements
-inline _LIBCPP_HIDE_FROM_ABI directory_iterator
-begin(directory_iterator __iter) noexcept {
- return __iter;
-}
+inline _LIBCPP_HIDE_FROM_ABI directory_iterator begin(directory_iterator __iter) noexcept { return __iter; }
-inline _LIBCPP_HIDE_FROM_ABI directory_iterator
-end(directory_iterator) noexcept {
- return directory_iterator();
-}
+inline _LIBCPP_HIDE_FROM_ABI directory_iterator end(directory_iterator) noexcept { return directory_iterator(); }
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
_LIBCPP_END_NAMESPACE_FILESYSTEM
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_view<std::filesystem::directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_view<std::filesystem::directory_iterator> = true;
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h b/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h
index 05885bc488b0..683c4678e083 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/directory_options.h
@@ -21,53 +21,33 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-enum class directory_options : unsigned char {
- none = 0,
- follow_directory_symlink = 1,
- skip_permission_denied = 2
-};
-
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator&(directory_options __lhs,
- directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) &
- static_cast<unsigned char>(__rhs));
+enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 };
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator&(directory_options __lhs, directory_options __rhs) {
+ return static_cast<directory_options>(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator|(directory_options __lhs,
- directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) |
- static_cast<unsigned char>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator|(directory_options __lhs, directory_options __rhs) {
+ return static_cast<directory_options>(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator^(directory_options __lhs,
- directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^
- static_cast<unsigned char>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator^(directory_options __lhs, directory_options __rhs) {
+ return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr directory_options operator~(directory_options __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
return static_cast<directory_options>(~static_cast<unsigned char>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline directory_options& operator&=(directory_options& __lhs,
- directory_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline directory_options& operator&=(directory_options& __lhs, directory_options __rhs) {
return __lhs = __lhs & __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline directory_options& operator|=(directory_options& __lhs,
- directory_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline directory_options& operator|=(directory_options& __lhs, directory_options __rhs) {
return __lhs = __lhs | __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline directory_options& operator^=(directory_options& __lhs,
- directory_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline directory_options& operator^=(directory_options& __lhs, directory_options __rhs) {
return __lhs = __lhs ^ __rhs;
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/file_status.h b/contrib/llvm-project/libcxx/include/__filesystem/file_status.h
index 2a1ce85a3754..3e2b32eef82e 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/file_status.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/file_status.h
@@ -26,35 +26,27 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
class _LIBCPP_EXPORTED_FROM_ABI file_status {
public:
// constructors
- _LIBCPP_HIDE_FROM_ABI
- file_status() noexcept : file_status(file_type::none) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
- : __ft_(__ft),
- __prms_(__prms) {}
+ _LIBCPP_HIDE_FROM_ABI file_status() noexcept : file_status(file_type::none) {}
+ _LIBCPP_HIDE_FROM_ABI explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
+ : __ft_(__ft), __prms_(__prms) {}
_LIBCPP_HIDE_FROM_ABI file_status(const file_status&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI
- ~file_status() {}
+ _LIBCPP_HIDE_FROM_ABI ~file_status() {}
_LIBCPP_HIDE_FROM_ABI file_status& operator=(const file_status&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
// observers
- _LIBCPP_HIDE_FROM_ABI
- file_type type() const noexcept { return __ft_; }
+ _LIBCPP_HIDE_FROM_ABI file_type type() const noexcept { return __ft_; }
- _LIBCPP_HIDE_FROM_ABI
- perms permissions() const noexcept { return __prms_; }
+ _LIBCPP_HIDE_FROM_ABI perms permissions() const noexcept { return __prms_; }
// modifiers
- _LIBCPP_HIDE_FROM_ABI
- void type(file_type __ft) noexcept { __ft_ = __ft; }
+ _LIBCPP_HIDE_FROM_ABI void type(file_type __ft) noexcept { __ft_ = __ft; }
- _LIBCPP_HIDE_FROM_ABI
- void permissions(perms __p) noexcept { __prms_ = __p; }
+ _LIBCPP_HIDE_FROM_ABI void permissions(perms __p) noexcept { __prms_ = __p; }
# if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/file_type.h b/contrib/llvm-project/libcxx/include/__filesystem/file_type.h
index f456552db543..c509085d90de 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/file_type.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/file_type.h
@@ -24,16 +24,16 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
// On Windows, the library never identifies files as block, character, fifo
// or socket.
enum class file_type : signed char {
- none = 0,
+ none = 0,
not_found = -1,
- regular = 1,
+ regular = 1,
directory = 2,
- symlink = 3,
- block = 4,
+ symlink = 3,
+ block = 4,
character = 5,
- fifo = 6,
- socket = 7,
- unknown = 8
+ fifo = 6,
+ socket = 7,
+ unknown = 8
};
_LIBCPP_END_NAMESPACE_FILESYSTEM
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/operations.h b/contrib/llvm-project/libcxx/include/__filesystem/operations.h
index ebe816549a9e..9bb83576f54b 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/operations.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/operations.h
@@ -36,15 +36,21 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
_LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool __copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI bool
+__copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __create_directories(const path&, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, error_code* = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, const path& __attributes, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI void
+__create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI path __current_path(error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI void __current_path(const path&, error_code* __ec = nullptr);
_LIBCPP_EXPORTED_FROM_ABI bool __equivalent(const path&, const path&, error_code* __ec = nullptr);
@@ -64,38 +70,85 @@ _LIBCPP_EXPORTED_FROM_ABI path __temp_directory_path(error_code* __ec = nullptr)
inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) { return __absolute(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
+inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p, error_code& __ec) { return __canonical(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) { return __copy_file(__from, __to, copy_options::none); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, error_code& __ec) { return __copy_file(__from, __to, copy_options::none, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt) { return __copy_file(__from, __to, __opt); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { return __copy_file(__from, __to, __opt, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) {
+ return __copy_file(__from, __to, copy_options::none);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, error_code& __ec) {
+ return __copy_file(__from, __to, copy_options::none, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt) {
+ return __copy_file(__from, __to, __opt);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool
+copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
+ return __copy_file(__from, __to, __opt, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to) { __copy_symlink(__from, __to); }
-inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to, error_code& __ec) noexcept { __copy_symlink(__from, __to, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to) { __copy(__from, __to, copy_options::none); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, error_code& __ec) { __copy(__from, __to, copy_options::none, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt) { __copy(__from, __to, __opt); }
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { __copy(__from, __to, __opt, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to, error_code& __ec) noexcept {
+ __copy_symlink(__from, __to, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to) {
+ __copy(__from, __to, copy_options::none);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, error_code& __ec) {
+ __copy(__from, __to, copy_options::none, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt) {
+ __copy(__from, __to, __opt);
+}
+inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
+ __copy(__from, __to, __opt, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p) { return __create_directories(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p, error_code& __ec) { return __create_directories(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link) { __create_directory_symlink(__target, __link); }
-inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link, error_code& __ec) noexcept { __create_directory_symlink(__target, __link, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p, error_code& __ec) {
+ return __create_directories(__p, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link) {
+ __create_directory_symlink(__target, __link);
+}
+inline _LIBCPP_HIDE_FROM_ABI void
+create_directory_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
+ __create_directory_symlink(__target, __link, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p) { return __create_directory(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, error_code& __ec) noexcept { return __create_directory(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs) { return __create_directory(__p, __attrs); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept { return __create_directory(__p, __attrs, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link) { __create_hard_link(__target, __link); }
-inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link, error_code& __ec) noexcept { __create_hard_link(__target, __link, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link) { __create_symlink(__target, __link); }
-inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept { return __create_symlink(__target, __link, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, error_code& __ec) noexcept {
+ return __create_directory(__p, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs) {
+ return __create_directory(__p, __attrs);
+}
+inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept {
+ return __create_directory(__p, __attrs, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link) {
+ __create_hard_link(__target, __link);
+}
+inline _LIBCPP_HIDE_FROM_ABI void
+create_hard_link(const path& __target, const path& __link, error_code& __ec) noexcept {
+ __create_hard_link(__target, __link, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link) {
+ __create_symlink(__target, __link);
+}
+inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
+ return __create_symlink(__target, __link, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI path current_path() { return __current_path(); }
inline _LIBCPP_HIDE_FROM_ABI path current_path(error_code& __ec) { return __current_path(&__ec); }
inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p) { __current_path(__p); }
-inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept { __current_path(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept {
+ __current_path(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2) { return __equivalent(__p1, __p2); }
-inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { return __equivalent(__p1, __p2, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept {
+ return __equivalent(__p1, __p2, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool status_known(file_status __s) noexcept { return __s.type() != file_type::none; }
-inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept { return status_known(__s) && __s.type() != file_type::not_found; }
+inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept {
+ return status_known(__s) && __s.type() != file_type::not_found;
+}
inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p) { return exists(__status(__p)); }
inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noexcept {
@@ -106,44 +159,79 @@ inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noex
}
inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p) { return __file_size(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept { return __file_size(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept {
+ return __file_size(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept { return __hard_link_count(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept {
+ return __hard_link_count(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(file_status __s) noexcept { return __s.type() == file_type::block; }
inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p) { return is_block_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept { return is_block_file(__status(__p, &__ec)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept { return __s.type() == file_type::character; }
+inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept {
+ return is_block_file(__status(__p, &__ec));
+}
+inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept {
+ return __s.type() == file_type::character;
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p) { return is_character_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept { return is_character_file(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept {
+ return is_character_file(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(file_status __s) noexcept { return __s.type() == file_type::directory; }
inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p) { return is_directory(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept { return is_directory(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept {
+ return is_directory(__status(__p, &__ec));
+}
_LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec = nullptr);
inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p) { return __fs_is_empty(__p); }
inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p, error_code& __ec) { return __fs_is_empty(__p, &__ec); }
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(file_status __s) noexcept { return __s.type() == file_type::fifo; }
inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p) { return is_fifo(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept { return is_fifo(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept {
+ return is_fifo(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(file_status __s) noexcept { return __s.type() == file_type::regular; }
inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p) { return is_regular_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept { return is_regular_file(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept {
+ return is_regular_file(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(file_status __s) noexcept { return __s.type() == file_type::symlink; }
inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p) { return is_symlink(__symlink_status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept { return is_symlink(__symlink_status(__p, &__ec)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept { return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept {
+ return is_symlink(__symlink_status(__p, &__ec));
+}
+inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept {
+ return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s);
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p) { return is_other(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept { return is_other(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept {
+ return is_other(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(file_status __s) noexcept { return __s.type() == file_type::socket; }
inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p) { return is_socket(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept { return is_socket(__status(__p, &__ec)); }
+inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept {
+ return is_socket(__status(__p, &__ec));
+}
inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p) { return __last_write_time(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept { return __last_write_time(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept {
+ return __last_write_time(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t) { __last_write_time(__p, __t); }
-inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept { __last_write_time(__p, __t, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept {
+ __last_write_time(__p, __t, &__ec);
+}
_LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr);
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) { __permissions(__p, __prms, __opts); }
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, error_code& __ec) noexcept { __permissions(__p, __prms, perm_options::replace, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) { __permissions(__p, __prms, __opts, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void
+permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) {
+ __permissions(__p, __prms, __opts);
+}
+inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, error_code& __ec) noexcept {
+ __permissions(__p, __prms, perm_options::replace, &__ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) {
+ __permissions(__p, __prms, __opts, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base, error_code& __ec) {
path __tmp = __weakly_canonical(__p, &__ec);
@@ -155,8 +243,12 @@ inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base,
return __tmp.lexically_proximate(__tmp_base);
}
-inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) { return proximate(__p, current_path(), __ec); }
-inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base)); }
+inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) {
+ return proximate(__p, current_path(), __ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) {
+ return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base));
+}
inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p) { return __read_symlink(__p); }
inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p, error_code& __ec) { return __read_symlink(__p, &__ec); }
@@ -170,27 +262,45 @@ inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base,
return __tmp.lexically_relative(__tmpbase);
}
-inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) { return relative(__p, current_path(), __ec); }
-inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); }
+inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) {
+ return relative(__p, current_path(), __ec);
+}
+inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) {
+ return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base));
+}
inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p) { return __remove_all(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p, error_code& __ec) { return __remove_all(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p, error_code& __ec) {
+ return __remove_all(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p) { return __remove(__p); }
inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p, error_code& __ec) noexcept { return __remove(__p, &__ec); }
inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to) { return __rename(__from, __to); }
-inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to, error_code& __ec) noexcept { return __rename(__from, __to, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to, error_code& __ec) noexcept {
+ return __rename(__from, __to, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns) { return __resize_file(__p, __ns); }
-inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { return __resize_file(__p, __ns, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept {
+ return __resize_file(__p, __ns, &__ec);
+}
_LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr);
inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p) { return __space(__p); }
-inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept { return __space(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept {
+ return __space(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p) { return __status(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept { return __status(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept {
+ return __status(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p) { return __symlink_status(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept { return __symlink_status(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept {
+ return __symlink_status(__p, &__ec);
+}
inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path() { return __temp_directory_path(); }
inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path(error_code& __ec) { return __temp_directory_path(&__ec); }
inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p) { return __weakly_canonical(__p); }
-inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) { return __weakly_canonical(__p, &__ec); }
+inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) {
+ return __weakly_canonical(__p, &__ec);
+}
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/path.h b/contrib/llvm-project/libcxx/include/__filesystem/path.h
index 466fa25a38ed..1ff992dd64e6 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/path.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/path.h
@@ -28,8 +28,8 @@
#include <string_view>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iomanip> // for quoted
-# include <locale>
+# include <iomanip> // for quoted
+# include <locale>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -51,47 +51,45 @@ struct __can_convert_char<const _Tp> : public __can_convert_char<_Tp> {};
template <>
struct __can_convert_char<char> {
static const bool value = true;
- using __char_type = char;
+ using __char_type = char;
};
template <>
struct __can_convert_char<wchar_t> {
static const bool value = true;
- using __char_type = wchar_t;
+ using __char_type = wchar_t;
};
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
struct __can_convert_char<char8_t> {
static const bool value = true;
- using __char_type = char8_t;
+ using __char_type = char8_t;
};
-#endif
+# endif
template <>
struct __can_convert_char<char16_t> {
static const bool value = true;
- using __char_type = char16_t;
+ using __char_type = char16_t;
};
template <>
struct __can_convert_char<char32_t> {
static const bool value = true;
- using __char_type = char32_t;
+ using __char_type = char32_t;
};
template <class _ECharT, __enable_if_t<__can_convert_char<_ECharT>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-bool
-__is_separator(_ECharT __e) {
-#if defined(_LIBCPP_WIN32API)
+_LIBCPP_HIDE_FROM_ABI bool __is_separator(_ECharT __e) {
+# if defined(_LIBCPP_WIN32API)
return __e == _ECharT('/') || __e == _ECharT('\\');
-#else
+# else
return __e == _ECharT('/');
-#endif
+# endif
}
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
typedef u8string __u8_string;
-#else
+# else
typedef string __u8_string;
-#endif
+# endif
struct _NullSentinel {};
@@ -102,99 +100,75 @@ template <class _Tp, class = void>
struct __is_pathable_string : public false_type {};
template <class _ECharT, class _Traits, class _Alloc>
-struct __is_pathable_string<
- basic_string<_ECharT, _Traits, _Alloc>,
- _Void<typename __can_convert_char<_ECharT>::__char_type> >
+struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>,
+ _Void<typename __can_convert_char<_ECharT>::__char_type> >
: public __can_convert_char<_ECharT> {
using _Str = basic_string<_ECharT, _Traits, _Alloc>;
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_end(_Str const& __s) {
- return __s.data() + __s.length();
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(_Str const& __s) {
- return __s.empty() ? _ECharT{} : __s[0];
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; }
};
template <class _ECharT, class _Traits>
-struct __is_pathable_string<
- basic_string_view<_ECharT, _Traits>,
- _Void<typename __can_convert_char<_ECharT>::__char_type> >
+struct __is_pathable_string< basic_string_view<_ECharT, _Traits>,
+ _Void<typename __can_convert_char<_ECharT>::__char_type> >
: public __can_convert_char<_ECharT> {
using _Str = basic_string_view<_ECharT, _Traits>;
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_end(_Str const& __s) {
- return __s.data() + __s.length();
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(_Str const& __s) {
- return __s.empty() ? _ECharT{} : __s[0];
- }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; }
};
-template <class _Source, class _DS = __decay_t<_Source>,
- class _UnqualPtrType =
- __remove_const_t<__remove_pointer_t<_DS> >,
- bool _IsCharPtr = is_pointer<_DS>::value&&
- __can_convert_char<_UnqualPtrType>::value>
+template <class _Source,
+ class _DS = __decay_t<_Source>,
+ class _UnqualPtrType = __remove_const_t<__remove_pointer_t<_DS> >,
+ bool _IsCharPtr = is_pointer<_DS>::value && __can_convert_char<_UnqualPtrType>::value>
struct __is_pathable_char_array : false_type {};
template <class _Source, class _ECharT, class _UPtr>
-struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true>
- : __can_convert_char<__remove_const_t<_ECharT> > {
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_begin(const _ECharT* __b) { return __b; }
-
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT const* __range_end(const _ECharT* __b) {
- using _Iter = const _ECharT*;
+struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> : __can_convert_char<__remove_const_t<_ECharT> > {
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(const _ECharT* __b) { return __b; }
+
+ _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(const _ECharT* __b) {
+ using _Iter = const _ECharT*;
const _ECharT __sentinel = _ECharT{};
- _Iter __e = __b;
+ _Iter __e = __b;
for (; *__e != __sentinel; ++__e)
;
return __e;
}
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }
};
-template <class _Iter, bool _IsIt = __has_input_iterator_category<_Iter>::value,
- class = void>
+template <class _Iter, bool _IsIt = __has_input_iterator_category<_Iter>::value, class = void>
struct __is_pathable_iter : false_type {};
template <class _Iter>
struct __is_pathable_iter<
- _Iter, true,
- _Void<typename __can_convert_char<
- typename iterator_traits<_Iter>::value_type>::__char_type> >
+ _Iter,
+ true,
+ _Void<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> >
: __can_convert_char<typename iterator_traits<_Iter>::value_type> {
using _ECharT = typename iterator_traits<_Iter>::value_type;
- _LIBCPP_HIDE_FROM_ABI
- static _Iter __range_begin(_Iter __b) { return __b; }
+ _LIBCPP_HIDE_FROM_ABI static _Iter __range_begin(_Iter __b) { return __b; }
- _LIBCPP_HIDE_FROM_ABI
- static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; }
+ _LIBCPP_HIDE_FROM_ABI static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; }
- _LIBCPP_HIDE_FROM_ABI
- static _ECharT __first_or_null(_Iter __b) { return *__b; }
+ _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Iter __b) { return *__b; }
};
-template <class _Tp, bool _IsStringT = __is_pathable_string<_Tp>::value,
+template <class _Tp,
+ bool _IsStringT = __is_pathable_string<_Tp>::value,
bool _IsCharIterT = __is_pathable_char_array<_Tp>::value,
- bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value>
+ bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value>
struct __is_pathable : false_type {
static_assert(!_IsStringT && !_IsCharIterT && !_IsIterT, "Must all be false");
};
@@ -203,72 +177,64 @@ template <class _Tp>
struct __is_pathable<_Tp, true, false, false> : __is_pathable_string<_Tp> {};
template <class _Tp>
-struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {
-};
+struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {};
template <class _Tp>
struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {};
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
typedef wstring __path_string;
typedef wchar_t __path_value;
-#else
+# else
typedef string __path_string;
typedef char __path_value;
-#endif
+# endif
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
_LIBCPP_EXPORTED_FROM_ABI size_t __wide_to_char(const wstring&, char*, size_t);
_LIBCPP_EXPORTED_FROM_ABI size_t __char_to_wide(const string&, wchar_t*, size_t);
-#endif
+# endif
template <class _ECharT>
struct _PathCVT;
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
template <class _ECharT>
struct _PathCVT {
- static_assert(__can_convert_char<_ECharT>::value,
- "Char type not convertible");
+ static_assert(__can_convert_char<_ECharT>::value, "Char type not convertible");
typedef __narrow_to_utf8<sizeof(_ECharT) * __CHAR_BIT__> _Narrower;
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
typedef __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Widener;
-#endif
+# endif
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _ECharT const* __b,
- _ECharT const* __e) {
-#if defined(_LIBCPP_WIN32API)
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _ECharT const* __b, _ECharT const* __e) {
+# if defined(_LIBCPP_WIN32API)
string __utf8;
_Narrower()(back_inserter(__utf8), __b, __e);
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-#else
+# else
_Narrower()(back_inserter(__dest), __b, __e);
-#endif
+# endif
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload");
if (__b == __e)
return;
basic_string<_ECharT> __tmp(__b, __e);
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
string __utf8;
- _Narrower()(back_inserter(__utf8), __tmp.data(),
- __tmp.data() + __tmp.length());
+ _Narrower()(back_inserter(__utf8), __tmp.data(), __tmp.data() + __tmp.length());
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-#else
- _Narrower()(back_inserter(__dest), __tmp.data(),
- __tmp.data() + __tmp.length());
-#endif
+# else
+ _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length());
+# endif
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload");
const _ECharT __sentinel = _ECharT{};
if (*__b == __sentinel)
@@ -276,94 +242,74 @@ struct _PathCVT {
basic_string<_ECharT> __tmp;
for (; *__b != __sentinel; ++__b)
__tmp.push_back(*__b);
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
string __utf8;
- _Narrower()(back_inserter(__utf8), __tmp.data(),
- __tmp.data() + __tmp.length());
+ _Narrower()(back_inserter(__utf8), __tmp.data(), __tmp.data() + __tmp.length());
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-#else
- _Narrower()(back_inserter(__dest), __tmp.data(),
- __tmp.data() + __tmp.length());
-#endif
+# else
+ _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length());
+# endif
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_source(__path_string& __dest, _Source const& __s) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s),
- _Traits::__range_end(__s));
+ __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
}
};
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+# endif // !_LIBCPP_HAS_NO_LOCALIZATION
template <>
struct _PathCVT<__path_value> {
-
template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
for (; __b != __e; ++__b)
__dest.push_back(*__b);
}
template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
__dest.append(__b, __e);
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
const char __sentinel = char{};
for (; *__b != __sentinel; ++__b)
__dest.push_back(*__b);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_source(__path_string& __dest, _Source const& __s) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s),
- _Traits::__range_end(__s));
+ __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
}
};
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
template <>
struct _PathCVT<char> {
-
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_string(__path_string& __dest, const basic_string<char> &__str) {
- size_t __size = __char_to_wide(__str, nullptr, 0);
- size_t __pos = __dest.size();
- __dest.resize(__pos + __size);
- __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size);
+ _LIBCPP_HIDE_FROM_ABI static void __append_string(__path_string& __dest, const basic_string<char>& __str) {
+ size_t __size = __char_to_wide(__str, nullptr, 0);
+ size_t __pos = __dest.size();
+ __dest.resize(__pos + __size);
+ __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size);
}
template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
basic_string<char> __tmp(__b, __e);
__append_string(__dest, __tmp);
}
template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static void
- __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
basic_string<char> __tmp(__b, __e);
__append_string(__dest, __tmp);
}
template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
const char __sentinel = char{};
basic_string<char> __tmp;
for (; *__b != __sentinel; ++__b)
@@ -372,11 +318,9 @@ struct _PathCVT<char> {
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- static void __append_source(__path_string& __dest, _Source const& __s) {
+ _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s),
- _Traits::__range_end(__s));
+ __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
}
};
@@ -386,8 +330,7 @@ struct _PathExport {
typedef __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__> _Widener;
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
string __utf8;
_Narrower()(back_inserter(__utf8), __src.data(), __src.data() + __src.size());
_Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
@@ -397,10 +340,9 @@ struct _PathExport {
template <>
struct _PathExport<char> {
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
size_t __size = __wide_to_char(__src, nullptr, 0);
- size_t __pos = __dest.size();
+ size_t __pos = __dest.size();
__dest.resize(__size);
__wide_to_char(__src, const_cast<char*>(__dest.data()) + __pos, __size);
}
@@ -409,8 +351,7 @@ struct _PathExport<char> {
template <>
struct _PathExport<wchar_t> {
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
__dest.append(__src.begin(), __src.end());
}
};
@@ -418,25 +359,23 @@ struct _PathExport<wchar_t> {
template <>
struct _PathExport<char16_t> {
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
__dest.append(__src.begin(), __src.end());
}
};
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
struct _PathExport<char8_t> {
typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower;
template <class _Str>
- _LIBCPP_HIDE_FROM_ABI
- static void __append(_Str& __dest, const __path_string& __src) {
+ _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
_Narrower()(back_inserter(__dest), __src.data(), __src.data() + __src.size());
}
};
-#endif /* !_LIBCPP_HAS_NO_CHAR8_T */
-#endif /* _LIBCPP_WIN32API */
+# endif /* !_LIBCPP_HAS_NO_CHAR8_T */
+# endif /* _LIBCPP_WIN32API */
class _LIBCPP_EXPORTED_FROM_ABI path {
template <class _SourceOrIter, class _Tp = path&>
@@ -449,101 +388,84 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
using _SourceCVT = _PathCVT<_SourceChar<_Tp> >;
public:
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
typedef wchar_t value_type;
static constexpr value_type preferred_separator = L'\\';
-#else
+# else
typedef char value_type;
static constexpr value_type preferred_separator = '/';
-#endif
+# endif
typedef basic_string<value_type> string_type;
typedef basic_string_view<value_type> __string_view;
- enum format : unsigned char {
- auto_format,
- native_format,
- generic_format
- };
+ enum format : unsigned char { auto_format, native_format, generic_format };
// constructors and destructor
_LIBCPP_HIDE_FROM_ABI path() noexcept {}
_LIBCPP_HIDE_FROM_ABI path(const path& __p) : __pn_(__p.__pn_) {}
- _LIBCPP_HIDE_FROM_ABI path(path&& __p) noexcept
- : __pn_(std::move(__p.__pn_)) {}
+ _LIBCPP_HIDE_FROM_ABI path(path&& __p) noexcept : __pn_(std::move(__p.__pn_)) {}
- _LIBCPP_HIDE_FROM_ABI
- path(string_type&& __s, format = format::auto_format) noexcept
- : __pn_(std::move(__s)) {}
+ _LIBCPP_HIDE_FROM_ABI path(string_type&& __s, format = format::auto_format) noexcept : __pn_(std::move(__s)) {}
template <class _Source, class = _EnableIfPathable<_Source, void> >
- _LIBCPP_HIDE_FROM_ABI
- path(const _Source& __src, format = format::auto_format) {
+ _LIBCPP_HIDE_FROM_ABI path(const _Source& __src, format = format::auto_format) {
_SourceCVT<_Source>::__append_source(__pn_, __src);
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path(_InputIt __first, _InputIt __last, format = format::auto_format) {
+ _LIBCPP_HIDE_FROM_ABI path(_InputIt __first, _InputIt __last, format = format::auto_format) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
_PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
}
-/*
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- // TODO Implement locale conversions.
- template <class _Source, class = _EnableIfPathable<_Source, void> >
- path(const _Source& __src, const locale& __loc, format = format::auto_format);
- template <class _InputIt>
- path(_InputIt __first, _InputIt _last, const locale& __loc,
- format = format::auto_format);
-#endif
-*/
+ /*
+ #if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ // TODO Implement locale conversions.
+ template <class _Source, class = _EnableIfPathable<_Source, void> >
+ path(const _Source& __src, const locale& __loc, format = format::auto_format);
+ template <class _InputIt>
+ path(_InputIt __first, _InputIt _last, const locale& __loc,
+ format = format::auto_format);
+ #endif
+ */
- _LIBCPP_HIDE_FROM_ABI
- ~path() = default;
+ _LIBCPP_HIDE_FROM_ABI ~path() = default;
// assignments
- _LIBCPP_HIDE_FROM_ABI
- path& operator=(const path& __p) {
+ _LIBCPP_HIDE_FROM_ABI path& operator=(const path& __p) {
__pn_ = __p.__pn_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator=(path&& __p) noexcept {
+ _LIBCPP_HIDE_FROM_ABI path& operator=(path&& __p) noexcept {
__pn_ = std::move(__p.__pn_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator=(string_type&& __s) noexcept {
+ _LIBCPP_HIDE_FROM_ABI path& operator=(string_type&& __s) noexcept {
__pn_ = std::move(__s);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& assign(string_type&& __s) noexcept {
+ _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept {
__pn_ = std::move(__s);
return *this;
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source>
- operator=(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator=(const _Source& __src) {
return this->assign(__src);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> assign(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) {
__pn_.clear();
_SourceCVT<_Source>::__append_source(__pn_, __src);
return *this;
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& assign(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
__pn_.clear();
_PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
@@ -552,19 +474,17 @@ public:
public:
// appends
-#if defined(_LIBCPP_WIN32API)
- _LIBCPP_HIDE_FROM_ABI
- path& operator/=(const path& __p) {
- auto __p_root_name = __p.__root_name();
+# if defined(_LIBCPP_WIN32API)
+ _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) {
+ auto __p_root_name = __p.__root_name();
auto __p_root_name_size = __p_root_name.size();
- if (__p.is_absolute() ||
- (!__p_root_name.empty() && __p_root_name != __string_view(root_name().__pn_))) {
+ if (__p.is_absolute() || (!__p_root_name.empty() && __p_root_name != __string_view(root_name().__pn_))) {
__pn_ = __p.__pn_;
return *this;
}
if (__p.has_root_directory()) {
path __root_name_str = root_name();
- __pn_ = __root_name_str.native();
+ __pn_ = __root_name_str.native();
__pn_ += __string_view(__p.__pn_).substr(__p_root_name_size);
return *this;
}
@@ -574,25 +494,21 @@ public:
return *this;
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source>
- operator/=(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator/=(const _Source& __src) {
return operator/=(path(__src));
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> append(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
return operator/=(path(__src));
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& append(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
return operator/=(path(__first, __last));
}
-#else
- _LIBCPP_HIDE_FROM_ABI
- path& operator/=(const path& __p) {
+# else
+ _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) {
if (__p.is_absolute()) {
__pn_ = __p.__pn_;
return *this;
@@ -607,16 +523,14 @@ public:
// is known at compile time to be "/' since the user almost certainly intended
// to append a separator instead of overwriting the path with "/"
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source>
- operator/=(const _Source& __src) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator/=(const _Source& __src) {
return this->append(__src);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> append(const _Source& __src) {
- using _Traits = __is_pathable<_Source>;
- using _CVT = _PathCVT<_SourceChar<_Source> >;
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
+ using _Traits = __is_pathable<_Source>;
+ using _CVT = _PathCVT<_SourceChar<_Source> >;
bool __source_is_absolute = filesystem::__is_separator(_Traits::__first_or_null(__src));
if (__source_is_absolute)
__pn_.clear();
@@ -627,8 +541,7 @@ public:
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& append(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
static_assert(__can_convert_char<_ItVal>::value, "Must convertible");
using _CVT = _PathCVT<_ItVal>;
@@ -639,91 +552,76 @@ public:
_CVT::__append_range(__pn_, __first, __last);
return *this;
}
-#endif
+# endif
// concatenation
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(const path& __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(const path& __x) {
__pn_ += __x.__pn_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(const string_type& __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(const string_type& __x) {
__pn_ += __x;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(__string_view __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(__string_view __x) {
__pn_ += __x;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(const value_type* __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(const value_type* __x) {
__pn_ += __x;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& operator+=(value_type __x) {
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(value_type __x) {
__pn_ += __x;
return *this;
}
template <class _ECharT, __enable_if_t<__can_convert_char<_ECharT>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- path&
- operator+=(_ECharT __x) {
- _PathCVT<_ECharT>::__append_source(__pn_,
- basic_string_view<_ECharT>(&__x, 1));
+ _LIBCPP_HIDE_FROM_ABI path& operator+=(_ECharT __x) {
+ _PathCVT<_ECharT>::__append_source(__pn_, basic_string_view<_ECharT>(&__x, 1));
return *this;
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> operator+=(const _Source& __x) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator+=(const _Source& __x) {
return this->concat(__x);
}
template <class _Source>
- _LIBCPP_HIDE_FROM_ABI
- _EnableIfPathable<_Source> concat(const _Source& __x) {
+ _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) {
_SourceCVT<_Source>::__append_source(__pn_, __x);
return *this;
}
template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI
- path& concat(_InputIt __first, _InputIt __last) {
+ _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
_PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
return *this;
}
// modifiers
- _LIBCPP_HIDE_FROM_ABI
- void clear() noexcept { __pn_.clear(); }
+ _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __pn_.clear(); }
- _LIBCPP_HIDE_FROM_ABI
- path& make_preferred() {
-#if defined(_LIBCPP_WIN32API)
+ _LIBCPP_HIDE_FROM_ABI path& make_preferred() {
+# if defined(_LIBCPP_WIN32API)
std::replace(__pn_.begin(), __pn_.end(), L'/', L'\\');
-#endif
+# endif
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& remove_filename() {
+ _LIBCPP_HIDE_FROM_ABI path& remove_filename() {
auto __fname = __filename();
if (!__fname.empty())
__pn_.erase(__fname.data() - __pn_.data());
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- path& replace_filename(const path& __replacement) {
+ _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) {
remove_filename();
return (*this /= __replacement);
}
@@ -749,7 +647,7 @@ public:
friend _LIBCPP_HIDE_FROM_ABI bool operator>=(const path& __lhs, const path& __rhs) noexcept {
return __lhs.__compare(__rhs.__pn_) >= 0;
}
-# else // _LIBCPP_STD_VER <= 17
+# else // _LIBCPP_STD_VER <= 17
friend _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const path& __lhs, const path& __rhs) noexcept {
return __lhs.__compare(__rhs.__pn_) <=> 0;
}
@@ -761,39 +659,31 @@ public:
return __result;
}
- _LIBCPP_HIDE_FROM_ABI
- void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); }
+ _LIBCPP_HIDE_FROM_ABI void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); }
// private helper to allow reserving memory in the path
- _LIBCPP_HIDE_FROM_ABI
- void __reserve(size_t __s) { __pn_.reserve(__s); }
+ _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); }
// native format observers
- _LIBCPP_HIDE_FROM_ABI
- const string_type& native() const noexcept { return __pn_; }
+ _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; }
- _LIBCPP_HIDE_FROM_ABI
- const value_type* c_str() const noexcept { return __pn_.c_str(); }
+ _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); }
_LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; }
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
_LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return __pn_; }
- _LIBCPP_HIDE_FROM_ABI
- std::wstring generic_wstring() const {
+ _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const {
std::wstring __s;
__s.resize(__pn_.size());
std::replace_copy(__pn_.begin(), __pn_.end(), __s.begin(), '\\', '/');
return __s;
}
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
- string(const _Allocator& __a = _Allocator()) const {
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
using _Str = basic_string<_ECharT, _Traits, _Allocator>;
_Str __s(__a);
__s.reserve(__pn_.size());
@@ -801,9 +691,7 @@ public:
return __s;
}
- _LIBCPP_HIDE_FROM_ABI std::string string() const {
- return string<char>();
- }
+ _LIBCPP_HIDE_FROM_ABI std::string string() const { return string<char>(); }
_LIBCPP_HIDE_FROM_ABI __u8_string u8string() const {
using _CVT = __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
__u8_string __s;
@@ -812,54 +700,43 @@ public:
return __s;
}
- _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const {
- return string<char16_t>();
- }
- _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const {
- return string<char32_t>();
- }
+ _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
+ _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
// generic format observers
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
generic_string(const _Allocator& __a = _Allocator()) const {
using _Str = basic_string<_ECharT, _Traits, _Allocator>;
- _Str __s = string<_ECharT, _Traits, _Allocator>(__a);
+ _Str __s = string<_ECharT, _Traits, _Allocator>(__a);
// Note: This (and generic_u8string below) is slightly suboptimal as
// it iterates twice over the string; once to convert it to the right
// character type, and once to replace path delimiters.
- std::replace(__s.begin(), __s.end(),
- static_cast<_ECharT>('\\'), static_cast<_ECharT>('/'));
+ std::replace(__s.begin(), __s.end(), static_cast<_ECharT>('\\'), static_cast<_ECharT>('/'));
return __s;
}
_LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return generic_string<char>(); }
_LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return generic_string<char16_t>(); }
_LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return generic_string<char32_t>(); }
- _LIBCPP_HIDE_FROM_ABI
- __u8_string generic_u8string() const {
+ _LIBCPP_HIDE_FROM_ABI __u8_string generic_u8string() const {
__u8_string __s = u8string();
std::replace(__s.begin(), __s.end(), '\\', '/');
return __s;
}
-#endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
-#else /* _LIBCPP_WIN32API */
+# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+# else /* _LIBCPP_WIN32API */
_LIBCPP_HIDE_FROM_ABI std::string string() const { return __pn_; }
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
_LIBCPP_HIDE_FROM_ABI std::u8string u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
-#else
+# else
_LIBCPP_HIDE_FROM_ABI std::string u8string() const { return __pn_; }
-#endif
+# endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
- string(const _Allocator& __a = _Allocator()) const {
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
using _CVT = __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__>;
using _Str = basic_string<_ECharT, _Traits, _Allocator>;
_Str __s(__a);
@@ -868,43 +745,35 @@ public:
return __s;
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const {
- return string<wchar_t>();
- }
-#endif
- _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const {
- return string<char16_t>();
- }
- _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const {
- return string<char32_t>();
- }
-#endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+ _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return string<wchar_t>(); }
+# endif
+ _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
+ _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
+# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
// generic format observers
_LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; }
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
_LIBCPP_HIDE_FROM_ABI std::u8string generic_u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
-#else
+# else
_LIBCPP_HIDE_FROM_ABI std::string generic_u8string() const { return __pn_; }
-#endif
+# endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>,
- class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI
- basic_string<_ECharT, _Traits, _Allocator>
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
+ _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
generic_string(const _Allocator& __a = _Allocator()) const {
return string<_ECharT, _Traits, _Allocator>(__a);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const { return string<wchar_t>(); }
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return string<char16_t>(); }
_LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return string<char32_t>(); }
-#endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
-#endif /* !_LIBCPP_WIN32API */
+# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
+# endif /* !_LIBCPP_WIN32API */
private:
int __compare(__string_view) const;
@@ -919,80 +788,43 @@ private:
public:
// compare
- _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept {
- return __compare(__p.__pn_);
- }
- _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const {
- return __compare(__s);
- }
- _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const {
- return __compare(__s);
- }
- _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const {
- return __compare(__s);
- }
+ _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept { return __compare(__p.__pn_); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return __compare(__s); }
+ _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const { return __compare(__s); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return __compare(__s); }
// decomposition
- _LIBCPP_HIDE_FROM_ABI path root_name() const {
- return string_type(__root_name());
- }
- _LIBCPP_HIDE_FROM_ABI path root_directory() const {
- return string_type(__root_directory());
- }
+ _LIBCPP_HIDE_FROM_ABI path root_name() const { return string_type(__root_name()); }
+ _LIBCPP_HIDE_FROM_ABI path root_directory() const { return string_type(__root_directory()); }
_LIBCPP_HIDE_FROM_ABI path root_path() const {
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
return string_type(__root_path_raw());
-#else
+# else
return root_name().append(string_type(__root_directory()));
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI path relative_path() const {
- return string_type(__relative_path());
- }
- _LIBCPP_HIDE_FROM_ABI path parent_path() const {
- return string_type(__parent_path());
- }
- _LIBCPP_HIDE_FROM_ABI path filename() const {
- return string_type(__filename());
+# endif
}
+ _LIBCPP_HIDE_FROM_ABI path relative_path() const { return string_type(__relative_path()); }
+ _LIBCPP_HIDE_FROM_ABI path parent_path() const { return string_type(__parent_path()); }
+ _LIBCPP_HIDE_FROM_ABI path filename() const { return string_type(__filename()); }
_LIBCPP_HIDE_FROM_ABI path stem() const { return string_type(__stem()); }
- _LIBCPP_HIDE_FROM_ABI path extension() const {
- return string_type(__extension());
- }
+ _LIBCPP_HIDE_FROM_ABI path extension() const { return string_type(__extension()); }
// query
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool
- empty() const noexcept {
- return __pn_.empty();
- }
-
- _LIBCPP_HIDE_FROM_ABI bool has_root_name() const {
- return !__root_name().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const {
- return !__root_directory().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_root_path() const {
- return !__root_path_raw().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const {
- return !__relative_path().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const {
- return !__parent_path().empty();
- }
- _LIBCPP_HIDE_FROM_ABI bool has_filename() const {
- return !__filename().empty();
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __pn_.empty(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool has_root_name() const { return !__root_name().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const { return !__root_directory().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_root_path() const { return !__root_path_raw().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const { return !__relative_path().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const { return !__parent_path().empty(); }
+ _LIBCPP_HIDE_FROM_ABI bool has_filename() const { return !__filename().empty(); }
_LIBCPP_HIDE_FROM_ABI bool has_stem() const { return !__stem().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_extension() const {
- return !__extension().empty();
- }
+ _LIBCPP_HIDE_FROM_ABI bool has_extension() const { return !__extension().empty(); }
_LIBCPP_HIDE_FROM_ABI bool is_absolute() const {
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
__string_view __root_name_str = __root_name();
- __string_view __root_dir = __root_directory();
+ __string_view __root_dir = __root_directory();
if (__root_name_str.size() == 2 && __root_name_str[1] == ':') {
// A drive letter with no root directory is relative, e.g. x:example.
return !__root_dir.empty();
@@ -1009,9 +841,9 @@ public:
return false;
// Seems to be a server root name
return true;
-#else
+# else
return has_root_directory();
-#endif
+# endif
}
_LIBCPP_HIDE_FROM_ABI bool is_relative() const { return !is_absolute(); }
@@ -1033,21 +865,23 @@ public:
iterator begin() const;
iterator end() const;
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _CharT, class _Traits, __enable_if_t<is_same<_CharT, value_type>::value &&
- is_same<_Traits, char_traits<value_type> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+ template <
+ class _CharT,
+ class _Traits,
+ __enable_if_t<is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
__os << std::__quoted(__p.native());
return __os;
}
- template <class _CharT, class _Traits, __enable_if_t<!is_same<_CharT, value_type>::value ||
- !is_same<_Traits, char_traits<value_type> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
+ template <
+ class _CharT,
+ class _Traits,
+ __enable_if_t<!is_same<_CharT, value_type>::value || !is_same<_Traits, char_traits<value_type> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
__os << std::__quoted(__p.string<_CharT, _Traits>());
return __os;
}
@@ -1060,7 +894,7 @@ public:
__p = __tmp;
return __is;
}
-#endif // !_LIBCPP_HAS_NO_LOCALIZATION
+# endif // !_LIBCPP_HAS_NO_LOCALIZATION
private:
inline _LIBCPP_HIDE_FROM_ABI path& __assign_view(__string_view const& __s) {
@@ -1070,9 +904,7 @@ private:
string_type __pn_;
};
-inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept {
- __lhs.swap(__rhs);
-}
+inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
_LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept;
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h b/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h
index 598d65d3d72e..1a9aaf0e7d99 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/path_iterator.h
@@ -49,49 +49,37 @@ public:
typedef path reference;
public:
- _LIBCPP_HIDE_FROM_ABI
- iterator()
- : __stashed_elem_(), __path_ptr_(nullptr), __entry_(),
- __state_(_Singular) {}
+ _LIBCPP_HIDE_FROM_ABI iterator() : __stashed_elem_(), __path_ptr_(nullptr), __entry_(), __state_(_Singular) {}
_LIBCPP_HIDE_FROM_ABI iterator(const iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI ~iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI ~iterator() = default;
_LIBCPP_HIDE_FROM_ABI iterator& operator=(const iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const { return __stashed_elem_; }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __stashed_elem_; }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const { return &__stashed_elem_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return &__stashed_elem_; }
- _LIBCPP_HIDE_FROM_ABI
- iterator& operator++() {
- _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular,
- "attempting to increment a singular iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd,
- "attempting to increment the end iterator");
+ _LIBCPP_HIDE_FROM_ABI iterator& operator++() {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, "attempting to increment a singular iterator");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd, "attempting to increment the end iterator");
return __increment();
}
- _LIBCPP_HIDE_FROM_ABI
- iterator operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI iterator operator++(int) {
iterator __it(*this);
this->operator++();
return __it;
}
- _LIBCPP_HIDE_FROM_ABI
- iterator& operator--() {
- _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular,
- "attempting to decrement a singular iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(__entry_.data() != __path_ptr_->native().data(),
- "attempting to decrement the begin iterator");
+ _LIBCPP_HIDE_FROM_ABI iterator& operator--() {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, "attempting to decrement a singular iterator");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __entry_.data() != __path_ptr_->native().data(), "attempting to decrement the begin iterator");
return __decrement();
}
- _LIBCPP_HIDE_FROM_ABI
- iterator operator--(int) {
+ _LIBCPP_HIDE_FROM_ABI iterator operator--(int) {
iterator __it(*this);
this->operator--();
return __it;
@@ -100,8 +88,7 @@ public:
private:
friend class path;
- inline _LIBCPP_HIDE_FROM_ABI friend bool operator==(const iterator&,
- const iterator&);
+ inline _LIBCPP_HIDE_FROM_ABI friend bool operator==(const iterator&, const iterator&);
iterator& __increment();
iterator& __decrement();
@@ -113,15 +100,12 @@ private:
};
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline _LIBCPP_HIDE_FROM_ABI bool operator==(const path::iterator& __lhs,
- const path::iterator& __rhs) {
- return __lhs.__path_ptr_ == __rhs.__path_ptr_ &&
- __lhs.__entry_.data() == __rhs.__entry_.data();
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) {
+ return __lhs.__path_ptr_ == __rhs.__path_ptr_ && __lhs.__entry_.data() == __rhs.__entry_.data();
}
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs,
- const path::iterator& __rhs) {
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) {
return !(__lhs == __rhs);
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h b/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h
index ecf506fa4e8f..529ef13558e9 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/perm_options.h
@@ -21,48 +21,33 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-enum class perm_options : unsigned char {
- replace = 1,
- add = 2,
- remove = 4,
- nofollow = 8
-};
-
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) &
- static_cast<unsigned>(__rhs));
+enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
+ return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) |
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
+ return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
+ return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perm_options operator~(perm_options __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
return __lhs = __lhs & __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
return __lhs = __lhs | __rhs;
}
-_LIBCPP_HIDE_FROM_ABI
-inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
+_LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
return __lhs = __lhs ^ __rhs;
}
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/perms.h b/contrib/llvm-project/libcxx/include/__filesystem/perms.h
index 9f45f0c25f03..8f5f9a7e8248 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/perms.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/perms.h
@@ -28,61 +28,51 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
enum class perms : unsigned {
none = 0,
- owner_read = 0400,
+ owner_read = 0400,
owner_write = 0200,
- owner_exec = 0100,
- owner_all = 0700,
+ owner_exec = 0100,
+ owner_all = 0700,
- group_read = 040,
+ group_read = 040,
group_write = 020,
- group_exec = 010,
- group_all = 070,
+ group_exec = 010,
+ group_all = 070,
- others_read = 04,
+ others_read = 04,
others_write = 02,
- others_exec = 01,
- others_all = 07,
+ others_exec = 01,
+ others_all = 07,
all = 0777,
- set_uid = 04000,
- set_gid = 02000,
+ set_uid = 04000,
+ set_gid = 02000,
sticky_bit = 01000,
- mask = 07777,
- unknown = 0xFFFF,
+ mask = 07777,
+ unknown = 0xFFFF,
};
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator&(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) &
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
+ return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator|(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) |
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
+ return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator^(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) ^
- static_cast<unsigned>(__rhs));
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
+ return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline constexpr perms operator~(perms __lhs) {
+_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
return static_cast<perms>(~static_cast<unsigned>(__lhs));
}
-_LIBCPP_HIDE_FROM_ABI
-inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
-_LIBCPP_HIDE_FROM_ABI
-inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
-_LIBCPP_HIDE_FROM_ABI
-inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
_LIBCPP_END_NAMESPACE_FILESYSTEM
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h b/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h
index e0aac636db8c..7519cc2f2932 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h
@@ -36,40 +36,32 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
class recursive_directory_iterator {
public:
- using value_type = directory_entry;
- using difference_type = ptrdiff_t;
- using pointer = directory_entry const*;
- using reference = directory_entry const&;
+ using value_type = directory_entry;
+ using difference_type = ptrdiff_t;
+ using pointer = directory_entry const*;
+ using reference = directory_entry const&;
using iterator_category = input_iterator_tag;
public:
// constructors and destructor
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator() noexcept : __rec_(false) {}
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator() noexcept : __rec_(false) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit recursive_directory_iterator(
+ _LIBCPP_HIDE_FROM_ABI explicit recursive_directory_iterator(
const path& __p, directory_options __xoptions = directory_options::none)
: recursive_directory_iterator(__p, __xoptions, nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator(const path& __p, directory_options __xoptions,
- error_code& __ec)
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, directory_options __xoptions, error_code& __ec)
: recursive_directory_iterator(__p, __xoptions, &__ec) {}
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator(const path& __p, error_code& __ec)
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, error_code& __ec)
: recursive_directory_iterator(__p, directory_options::none, &__ec) {}
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const recursive_directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(recursive_directory_iterator&&) = default;
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(recursive_directory_iterator&&) = default;
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator&
- operator=(const recursive_directory_iterator&) = default;
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(const recursive_directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator&
- operator=(recursive_directory_iterator&& __o) noexcept {
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(recursive_directory_iterator&& __o) noexcept {
// non-default implementation provided to support self-move assign.
if (this != &__o) {
__imp_ = std::move(__o.__imp_);
@@ -80,40 +72,30 @@ public:
_LIBCPP_HIDE_FROM_ABI ~recursive_directory_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry& operator*() const { return __dereference(); }
+ _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { return __dereference(); }
- _LIBCPP_HIDE_FROM_ABI
- const directory_entry* operator->() const { return &__dereference(); }
+ _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &__dereference(); }
_LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator++() { return __increment(); }
- _LIBCPP_HIDE_FROM_ABI
- __dir_element_proxy operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
__dir_element_proxy __p(**this);
__increment();
return __p;
}
- _LIBCPP_HIDE_FROM_ABI
- recursive_directory_iterator& increment(error_code& __ec) {
- return __increment(&__ec);
- }
+ _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
_LIBCPP_EXPORTED_FROM_ABI directory_options options() const;
_LIBCPP_EXPORTED_FROM_ABI int depth() const;
- _LIBCPP_HIDE_FROM_ABI
- void pop() { __pop(); }
+ _LIBCPP_HIDE_FROM_ABI void pop() { __pop(); }
- _LIBCPP_HIDE_FROM_ABI
- void pop(error_code& __ec) { __pop(&__ec); }
+ _LIBCPP_HIDE_FROM_ABI void pop(error_code& __ec) { __pop(&__ec); }
- _LIBCPP_HIDE_FROM_ABI
- bool recursion_pending() const { return __rec_; }
+ _LIBCPP_HIDE_FROM_ABI bool recursion_pending() const { return __rec_; }
- _LIBCPP_HIDE_FROM_ABI
- void disable_recursion_pending() { __rec_ = false; }
+ _LIBCPP_HIDE_FROM_ABI void disable_recursion_pending() { __rec_ = false; }
# if _LIBCPP_STD_VER >= 20
@@ -132,8 +114,7 @@ private:
_LIBCPP_EXPORTED_FROM_ABI void __pop(error_code* __ec = nullptr);
inline _LIBCPP_HIDE_FROM_ABI friend bool
- operator==(const recursive_directory_iterator&,
- const recursive_directory_iterator&) noexcept;
+ operator==(const recursive_directory_iterator&, const recursive_directory_iterator&) noexcept;
struct _LIBCPP_HIDDEN __shared_imp;
shared_ptr<__shared_imp> __imp_;
@@ -141,24 +122,20 @@ private:
}; // class recursive_directory_iterator
inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const recursive_directory_iterator& __lhs,
- const recursive_directory_iterator& __rhs) noexcept {
+operator==(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
return __lhs.__imp_ == __rhs.__imp_;
}
-_LIBCPP_HIDE_FROM_ABI
-inline bool operator!=(const recursive_directory_iterator& __lhs,
- const recursive_directory_iterator& __rhs) noexcept {
+_LIBCPP_HIDE_FROM_ABI inline bool
+operator!=(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
return !(__lhs == __rhs);
}
// enable recursive_directory_iterator range-based for statements
-inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator
-begin(recursive_directory_iterator __iter) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept {
return __iter;
}
-inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator
-end(recursive_directory_iterator) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator end(recursive_directory_iterator) noexcept {
return recursive_directory_iterator();
}
@@ -166,17 +143,17 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
_LIBCPP_END_NAMESPACE_FILESYSTEM
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
+ std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
diff --git a/contrib/llvm-project/libcxx/include/__filesystem/u8path.h b/contrib/llvm-project/libcxx/include/__filesystem/u8path.h
index a79007e969ca..bde878054865 100644
--- a/contrib/llvm-project/libcxx/include/__filesystem/u8path.h
+++ b/contrib/llvm-project/libcxx/include/__filesystem/u8path.h
@@ -19,7 +19,7 @@
// Only required on Windows for __widen_from_utf8, and included conservatively
// because it requires support for localization.
#if defined(_LIBCPP_WIN32API)
-# include <locale>
+# include <locale>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -33,38 +33,34 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
- path
- u8path(_InputIt __f, _InputIt __l) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
static_assert(
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
-#endif
- is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
+# endif
+ is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
" or 'char8_t'");
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
string __tmp(__f, __l);
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
std::wstring __w;
__w.reserve(__tmp.size());
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
return path(__w);
-#else
+# else
return path(__f, __l);
-#endif /* !_LIBCPP_WIN32API */
+# endif /* !_LIBCPP_WIN32API */
}
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
- path
- u8path(_InputIt __f, _NullSentinel) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
static_assert(
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
-#endif
- is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
+# endif
+ is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
" or 'char8_t'");
string __tmp;
@@ -77,25 +73,23 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
return path(__w);
}
-#endif /* _LIBCPP_WIN32API */
+# endif /* _LIBCPP_WIN32API */
template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T
- path
- u8path(const _Source& __s) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
static_assert(
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
-#endif
- is_same<typename __is_pathable<_Source>::__char_type, char>::value,
+# endif
+ is_same<typename __is_pathable<_Source>::__char_type, char>::value,
"u8path(Source const&) requires Source have a character type of type "
"'char' or 'char8_t'");
-#if defined(_LIBCPP_WIN32API)
+# if defined(_LIBCPP_WIN32API)
using _Traits = __is_pathable<_Source>;
return u8path(std::__unwrap_iter(_Traits::__range_begin(__s)), std::__unwrap_iter(_Traits::__range_end(__s)));
-#else
+# else
return path(__s);
-#endif
+# endif
}
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
diff --git a/contrib/llvm-project/libcxx/include/__format/buffer.h b/contrib/llvm-project/libcxx/include/__format/buffer.h
index 8aa58d6464bb..7ee583d81394 100644
--- a/contrib/llvm-project/libcxx/include/__format/buffer.h
+++ b/contrib/llvm-project/libcxx/include/__format/buffer.h
@@ -71,7 +71,7 @@ public:
__obj_(__obj) {}
_LIBCPP_HIDE_FROM_ABI void __reset(_CharT* __ptr, size_t __capacity) {
- __ptr_ = __ptr;
+ __ptr_ = __ptr;
__capacity_ = __capacity;
}
@@ -130,8 +130,10 @@ public:
/// A std::transform wrapper.
///
/// Like @ref __copy it may need to do type conversion.
- template <__fmt_char_type _InCharT, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) {
+ template <contiguous_iterator _Iterator,
+ class _UnaryOperation,
+ __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type>
+ _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range");
size_t __n = static_cast<size_t>(__last - __first);
@@ -251,19 +253,18 @@ template <__fmt_char_type _CharT>
class _LIBCPP_TEMPLATE_VIS __direct_storage {};
template <class _OutIt, class _CharT>
-concept __enable_direct_output = __fmt_char_type<_CharT> &&
+concept __enable_direct_output =
+ __fmt_char_type<_CharT> &&
(same_as<_OutIt, _CharT*>
// TODO(hardening): the following check might not apply to hardened iterators and might need to be wrapped in an
// `#ifdef`.
- || same_as<_OutIt, __wrap_iter<_CharT*>>
- );
+ || same_as<_OutIt, __wrap_iter<_CharT*>>);
/// Write policy for directly writing to the underlying output.
template <class _OutIt, __fmt_char_type _CharT>
class _LIBCPP_TEMPLATE_VIS __writer_direct {
public:
- _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it)
- : __out_it_(__out_it) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it) : __out_it_(__out_it) {}
_LIBCPP_HIDE_FROM_ABI _OutIt __out_it() { return __out_it_; }
@@ -281,8 +282,7 @@ private:
template <class _OutIt, __fmt_char_type _CharT>
class _LIBCPP_TEMPLATE_VIS __writer_iterator {
public:
- _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it)
- : __out_it_{std::move(__out_it)} {}
+ _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it) : __out_it_{std::move(__out_it)} {}
_LIBCPP_HIDE_FROM_ABI _OutIt __out_it() && { return std::move(__out_it_); }
@@ -304,7 +304,8 @@ private:
template <class _Container>
concept __insertable =
__enable_insertable<_Container> && __fmt_char_type<typename _Container::value_type> &&
- requires(_Container& __t, add_pointer_t<typename _Container::value_type> __first,
+ requires(_Container& __t,
+ add_pointer_t<typename _Container::value_type> __first,
add_pointer_t<typename _Container::value_type> __last) { __t.insert(__t.end(), __first, __last); };
/// Extract the container type of a \ref back_insert_iterator.
@@ -343,28 +344,29 @@ class _LIBCPP_TEMPLATE_VIS __writer_selector {
using _Container = typename __back_insert_iterator_container<_OutIt>::type;
public:
- using type = conditional_t<!same_as<_Container, void>, __writer_container<_Container>,
- conditional_t<__enable_direct_output<_OutIt, _CharT>, __writer_direct<_OutIt, _CharT>,
- __writer_iterator<_OutIt, _CharT>>>;
+ using type =
+ conditional_t<!same_as<_Container, void>,
+ __writer_container<_Container>,
+ conditional_t<__enable_direct_output<_OutIt, _CharT>,
+ __writer_direct<_OutIt, _CharT>,
+ __writer_iterator<_OutIt, _CharT>>>;
};
/// The generic formatting buffer.
template <class _OutIt, __fmt_char_type _CharT>
-requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS
- __format_buffer {
+ requires(output_iterator<_OutIt, const _CharT&>)
+class _LIBCPP_TEMPLATE_VIS __format_buffer {
using _Storage =
- conditional_t<__enable_direct_output<_OutIt, _CharT>,
- __direct_storage<_CharT>, __internal_storage<_CharT>>;
+ conditional_t<__enable_direct_output<_OutIt, _CharT>, __direct_storage<_CharT>, __internal_storage<_CharT>>;
public:
_LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it)
requires(same_as<_Storage, __internal_storage<_CharT>>)
: __output_(__storage_.__begin(), __storage_.__buffer_size, this), __writer_(std::move(__out_it)) {}
- _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires(
- same_as<_Storage, __direct_storage<_CharT>>)
- : __output_(std::__unwrap_iter(__out_it), size_t(-1), this),
- __writer_(std::move(__out_it)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it)
+ requires(same_as<_Storage, __direct_storage<_CharT>>)
+ : __output_(std::__unwrap_iter(__out_it), size_t(-1), this), __writer_(std::move(__out_it)) {}
_LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return __output_.__make_output_iterator(); }
@@ -590,8 +592,10 @@ public:
__size_ += __n;
}
- template <__fmt_char_type _InCharT, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) {
+ template <contiguous_iterator _Iterator,
+ class _UnaryOperation,
+ __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type>
+ _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range");
size_t __n = static_cast<size_t>(__last - __first);
diff --git a/contrib/llvm-project/libcxx/include/__format/concepts.h b/contrib/llvm-project/libcxx/include/__format/concepts.h
index ae96b6a19811..299c5f40ee35 100644
--- a/contrib/llvm-project/libcxx/include/__format/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__format/concepts.h
@@ -74,7 +74,7 @@ concept __fmt_pair_like =
__is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2);
# endif //_LIBCPP_STD_VER >= 23
-#endif //_LIBCPP_STD_VER >= 20
+#endif //_LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__format/format_arg.h b/contrib/llvm-project/libcxx/include/__format/format_arg.h
index cc6be7a25660..280c91082417 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_arg.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_arg.h
@@ -73,16 +73,16 @@ enum class __arg_t : uint8_t {
};
inline constexpr unsigned __packed_arg_t_bits = 5;
-inline constexpr uint8_t __packed_arg_t_mask = 0x1f;
+inline constexpr uint8_t __packed_arg_t_mask = 0x1f;
inline constexpr unsigned __packed_types_storage_bits = 64;
-inline constexpr unsigned __packed_types_max = __packed_types_storage_bits / __packed_arg_t_bits;
+inline constexpr unsigned __packed_types_max = __packed_types_storage_bits / __packed_arg_t_bits;
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool __use_packed_format_arg_store(size_t __size) { return __size <= __packed_types_max; }
+_LIBCPP_HIDE_FROM_ABI constexpr bool __use_packed_format_arg_store(size_t __size) {
+ return __size <= __packed_types_max;
+}
-_LIBCPP_HIDE_FROM_ABI
-constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) {
+_LIBCPP_HIDE_FROM_ABI constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) {
_LIBCPP_ASSERT_UNCATEGORIZED(__id <= __packed_types_max, "");
if (__id > 0)
@@ -96,8 +96,7 @@ constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) {
// This function is not user obervable, so it can directly use the non-standard
// types of the "variant". See __arg_t for more details.
template <class _Visitor, class _Context>
-_LIBCPP_HIDE_FROM_ABI decltype(auto)
-__visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
+_LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
switch (__arg.__type_) {
case __format::__arg_t::__none:
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__monostate_);
@@ -138,8 +137,8 @@ __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
case __format::__arg_t::__ptr:
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__ptr_);
case __format::__arg_t::__handle:
- return std::invoke(std::forward<_Visitor>(__vis),
- typename basic_format_arg<_Context>::handle{__arg.__value_.__handle_});
+ return std::invoke(
+ std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__arg.__value_.__handle_});
}
__libcpp_unreachable();
@@ -224,12 +223,9 @@ class _LIBCPP_TEMPLATE_VIS basic_format_arg {
public:
class _LIBCPP_TEMPLATE_VIS handle;
- _LIBCPP_HIDE_FROM_ABI basic_format_arg() noexcept
- : __type_{__format::__arg_t::__none} {}
+ _LIBCPP_HIDE_FROM_ABI basic_format_arg() noexcept : __type_{__format::__arg_t::__none} {}
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept {
- return __type_ != __format::__arg_t::__none;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; }
private:
using char_type = typename _Context::char_type;
@@ -257,8 +253,7 @@ public:
template <class _Context>
class _LIBCPP_TEMPLATE_VIS basic_format_arg<_Context>::handle {
public:
- _LIBCPP_HIDE_FROM_ABI
- void format(basic_format_parse_context<char_type>& __parse_ctx, _Context& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI void format(basic_format_parse_context<char_type>& __parse_ctx, _Context& __ctx) const {
__handle_.__format_(__parse_ctx, __ctx, __handle_.__ptr_);
}
@@ -272,8 +267,7 @@ private:
// This function is user facing, so it must wrap the non-standard types of
// the "variant" in a handle to stay conforming. See __arg_t for more details.
template <class _Visitor, class _Context>
-_LIBCPP_HIDE_FROM_ABI decltype(auto)
-visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
+_LIBCPP_HIDE_FROM_ABI decltype(auto) visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
switch (__arg.__type_) {
# ifndef _LIBCPP_HAS_NO_INT128
case __format::__arg_t::__i128: {
diff --git a/contrib/llvm-project/libcxx/include/__format/format_arg_store.h b/contrib/llvm-project/libcxx/include/__format/format_arg_store.h
index 64ee12440b62..c481992d2d71 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_arg_store.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_arg_store.h
@@ -243,8 +243,7 @@ struct __unpacked_format_arg_store {
template <class _Context, class... _Args>
struct _LIBCPP_TEMPLATE_VIS __format_arg_store {
- _LIBCPP_HIDE_FROM_ABI
- __format_arg_store(_Args&... __args) noexcept {
+ _LIBCPP_HIDE_FROM_ABI __format_arg_store(_Args&... __args) noexcept {
if constexpr (sizeof...(_Args) != 0) {
if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args)))
__format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
@@ -253,9 +252,10 @@ struct _LIBCPP_TEMPLATE_VIS __format_arg_store {
}
}
- using _Storage = conditional_t<__format::__use_packed_format_arg_store(sizeof...(_Args)),
- __format::__packed_format_arg_store<_Context, sizeof...(_Args)>,
- __format::__unpacked_format_arg_store<_Context, sizeof...(_Args)>>;
+ using _Storage =
+ conditional_t<__format::__use_packed_format_arg_store(sizeof...(_Args)),
+ __format::__packed_format_arg_store<_Context, sizeof...(_Args)>,
+ __format::__unpacked_format_arg_store<_Context, sizeof...(_Args)>>;
_Storage __storage;
};
diff --git a/contrib/llvm-project/libcxx/include/__format/format_args.h b/contrib/llvm-project/libcxx/include/__format/format_args.h
index defb42a4ab00..9e0afecc0ae9 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_args.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_args.h
@@ -37,14 +37,13 @@ public:
if constexpr (sizeof...(_Args) != 0) {
if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args))) {
__values_ = __store.__storage.__values_;
- __types_ = __store.__storage.__types_;
+ __types_ = __store.__storage.__types_;
} else
__args_ = __store.__storage.__args_;
}
}
- _LIBCPP_HIDE_FROM_ABI
- basic_format_arg<_Context> get(size_t __id) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> get(size_t __id) const noexcept {
if (__id >= __size_)
return basic_format_arg<_Context>{};
diff --git a/contrib/llvm-project/libcxx/include/__format/format_context.h b/contrib/llvm-project/libcxx/include/__format/format_context.h
index 4e3d15ec862e..5b252b81f691 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_context.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_context.h
@@ -27,8 +27,8 @@
#include <cstddef>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#include <locale>
-#include <optional>
+# include <locale>
+# include <optional>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -40,10 +40,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _OutIt, class _CharT>
-requires output_iterator<_OutIt, const _CharT&>
+ requires output_iterator<_OutIt, const _CharT&>
class _LIBCPP_TEMPLATE_VIS basic_format_context;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# ifndef _LIBCPP_HAS_NO_LOCALIZATION
/**
* Helper to create a basic_format_context.
*
@@ -51,32 +51,26 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context;
*/
template <class _OutIt, class _CharT>
_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
-__format_context_create(
- _OutIt __out_it,
- basic_format_args<basic_format_context<_OutIt, _CharT>> __args,
- optional<std::locale>&& __loc = nullopt) {
+__format_context_create(_OutIt __out_it,
+ basic_format_args<basic_format_context<_OutIt, _CharT>> __args,
+ optional<std::locale>&& __loc = nullopt) {
return std::basic_format_context(std::move(__out_it), __args, std::move(__loc));
}
-#else
+# else
template <class _OutIt, class _CharT>
_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
-__format_context_create(
- _OutIt __out_it,
- basic_format_args<basic_format_context<_OutIt, _CharT>> __args) {
+__format_context_create(_OutIt __out_it, basic_format_args<basic_format_context<_OutIt, _CharT>> __args) {
return std::basic_format_context(std::move(__out_it), __args);
}
-#endif
+# endif
-using format_context =
- basic_format_context<back_insert_iterator<__format::__output_buffer<char>>,
- char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using wformat_context = basic_format_context<
- back_insert_iterator<__format::__output_buffer<wchar_t>>, wchar_t>;
-#endif
+using format_context = basic_format_context<back_insert_iterator<__format::__output_buffer<char>>, char>;
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+using wformat_context = basic_format_context< back_insert_iterator<__format::__output_buffer<wchar_t>>, wchar_t>;
+# endif
template <class _OutIt, class _CharT>
-requires output_iterator<_OutIt, const _CharT&>
+ requires output_iterator<_OutIt, const _CharT&>
class
// clang-format off
_LIBCPP_TEMPLATE_VIS
@@ -85,29 +79,28 @@ class
// clang-format on
basic_format_context {
public:
- using iterator = _OutIt;
+ using iterator = _OutIt;
using char_type = _CharT;
template <class _Tp>
using formatter_type = formatter<_Tp, _CharT>;
- _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context>
- arg(size_t __id) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
return __args_.get(__id);
}
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# ifndef _LIBCPP_HAS_NO_LOCALIZATION
_LIBCPP_HIDE_FROM_ABI std::locale locale() {
if (!__loc_)
__loc_ = std::locale{};
return *__loc_;
}
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
_LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); }
private:
iterator __out_it_;
basic_format_args<basic_format_context> __args_;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# ifndef _LIBCPP_HAS_NO_LOCALIZATION
// The Standard doesn't specify how the locale is stored.
// [format.context]/6
@@ -121,27 +114,21 @@ private:
optional<std::locale> __loc_;
template <class _OtherOutIt, class _OtherCharT>
- friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
- __format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>,
- optional<std::locale>&&);
+ friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
+ _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
// Note: the Standard doesn't specify the required constructors.
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_format_context(_OutIt __out_it,
- basic_format_args<basic_format_context> __args,
- optional<std::locale>&& __loc)
- : __out_it_(std::move(__out_it)), __args_(__args),
- __loc_(std::move(__loc)) {}
-#else
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(
+ _OutIt __out_it, basic_format_args<basic_format_context> __args, optional<std::locale>&& __loc)
+ : __out_it_(std::move(__out_it)), __args_(__args), __loc_(std::move(__loc)) {}
+# else
template <class _OtherOutIt, class _OtherCharT>
friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
__format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>);
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_format_context(_OutIt __out_it,
- basic_format_args<basic_format_context> __args)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args)
: __out_it_(std::move(__out_it)), __args_(__args) {}
-#endif
+# endif
};
// A specialization for __retarget_buffer
@@ -161,8 +148,7 @@ private:
// Here the width of an element in input is determined dynamically.
// Note when the top-level element has no width the retargeting is not needed.
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS
- basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> {
+class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> {
public:
using iterator = typename __format::__retarget_buffer<_CharT>::__iterator;
using char_type = _CharT;
diff --git a/contrib/llvm-project/libcxx/include/__format/format_error.h b/contrib/llvm-project/libcxx/include/__format/format_error.h
index 51d6c5823091..ed40e395d6af 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_error.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_error.h
@@ -26,24 +26,21 @@ _LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
class _LIBCPP_EXPORTED_FROM_ABI format_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit format_error(const string& __s)
- : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s)
- : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI format_error(const format_error&) = default;
+ _LIBCPP_HIDE_FROM_ABI explicit format_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI format_error(const format_error&) = default;
_LIBCPP_HIDE_FROM_ABI format_error& operator=(const format_error&) = default;
_LIBCPP_HIDE_FROM_ABI_VIRTUAL
~format_error() noexcept override = default;
};
_LIBCPP_DIAGNOSTIC_POP
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void
-__throw_format_error(const char* __s) {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw format_error(__s);
-#else
+# else
_LIBCPP_VERBOSE_ABORT("format_error was thrown in -fno-exceptions mode with message \"%s\"", __s);
-#endif
+# endif
}
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/format_functions.h b/contrib/llvm-project/libcxx/include/__format/format_functions.h
index 8b2111f0e287..015bff70f51d 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_functions.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_functions.h
@@ -41,7 +41,7 @@
#include <string_view>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#include <locale>
+# include <locale>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -58,9 +58,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// to do this optimization now.
using format_args = basic_format_args<format_context>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wformat_args = basic_format_args<wformat_context>;
-#endif
+# endif
template <class _Context = format_context, class... _Args>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) {
@@ -188,9 +188,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_validate_argument(
// This function is not user facing, so it can directly use the non-standard types of the "variant".
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_format_parse_context<_CharT>& __parse_ctx,
- __compile_time_basic_format_context<_CharT>& __ctx,
- __arg_t __type) {
+_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(
+ basic_format_parse_context<_CharT>& __parse_ctx,
+ __compile_time_basic_format_context<_CharT>& __ctx,
+ __arg_t __type) {
switch (__type) {
case __arg_t::__none:
std::__throw_format_error("Invalid argument");
@@ -203,22 +204,22 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
case __arg_t::__long_long:
return __format::__compile_time_validate_argument<_CharT, long long>(__parse_ctx, __ctx);
case __arg_t::__i128:
-# ifndef _LIBCPP_HAS_NO_INT128
+# ifndef _LIBCPP_HAS_NO_INT128
return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx);
-# else
+# else
std::__throw_format_error("Invalid argument");
-# endif
+# endif
return;
case __arg_t::__unsigned:
return __format::__compile_time_validate_argument<_CharT, unsigned>(__parse_ctx, __ctx);
case __arg_t::__unsigned_long_long:
return __format::__compile_time_validate_argument<_CharT, unsigned long long>(__parse_ctx, __ctx);
case __arg_t::__u128:
-# ifndef _LIBCPP_HAS_NO_INT128
+# ifndef _LIBCPP_HAS_NO_INT128
return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx);
-# else
+# else
std::__throw_format_error("Invalid argument");
-# endif
+# endif
return;
case __arg_t::__float:
return __format::__compile_time_validate_argument<_CharT, float, true>(__parse_ctx, __ctx);
@@ -240,9 +241,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_forma
template <contiguous_iterator _Iterator, class _ParseCtx, class _Ctx>
_LIBCPP_HIDE_FROM_ABI constexpr _Iterator
-__handle_replacement_field(_Iterator __begin, _Iterator __end,
- _ParseCtx& __parse_ctx, _Ctx& __ctx) {
- using _CharT = iter_value_t<_Iterator>;
+__handle_replacement_field(_Iterator __begin, _Iterator __end, _ParseCtx& __parse_ctx, _Ctx& __ctx) {
+ using _CharT = iter_value_t<_Iterator>;
__format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx);
if (__r.__last == __end)
@@ -294,13 +294,12 @@ __handle_replacement_field(_Iterator __begin, _Iterator __end,
}
template <class _ParseCtx, class _Ctx>
-_LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator
-__vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
+_LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
using _CharT = typename _ParseCtx::char_type;
static_assert(same_as<typename _Ctx::char_type, _CharT>);
- auto __begin = __parse_ctx.begin();
- auto __end = __parse_ctx.end();
+ auto __begin = __parse_ctx.begin();
+ auto __end = __parse_ctx.end();
typename _Ctx::iterator __out_it = __ctx.out();
while (__begin != __end) {
switch (*__begin) {
@@ -311,8 +310,7 @@ __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
if (*__begin != _CharT('{')) [[likely]] {
__ctx.advance_to(std::move(__out_it));
- __begin =
- __format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
+ __begin = __format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
__out_it = __ctx.out();
// The output is written and __begin points to the next character. So
@@ -371,9 +369,7 @@ struct _LIBCPP_TEMPLATE_VIS basic_format_string {
_Context{__types_.data(), __handles_.data(), sizeof...(_Args)});
}
- _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept {
- return __str_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; }
# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI basic_format_string(__runtime_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
# endif
@@ -399,23 +395,23 @@ private:
template <class... _Args>
using format_string = basic_format_string<char, type_identity_t<_Args>...>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>;
-#endif
+# endif
template <class _OutIt, class _CharT, class _FormatOutIt>
-requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
- __vformat_to(
- _OutIt __out_it, basic_string_view<_CharT> __fmt,
- basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
+ requires(output_iterator<_OutIt, const _CharT&>)
+_LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(_OutIt __out_it,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
if constexpr (same_as<_OutIt, _FormatOutIt>)
- return std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(std::move(__out_it), __args));
+ return std::__format::__vformat_to(
+ basic_format_parse_context{__fmt, __args.__size()}, std::__format_context_create(std::move(__out_it), __args));
else {
__format::__format_buffer<_OutIt, _CharT> __buffer{std::move(__out_it)};
std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
+ std::__format_context_create(__buffer.__make_output_iterator(), __args));
return std::move(__buffer).__out_it();
}
}
@@ -424,34 +420,31 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
// https://reviews.llvm.org/D110499#inline-1180704
// TODO FMT Evaluate whether we want to file a Clang bug report regarding this.
template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
return std::__vformat_to(std::move(__out_it), __fmt, __args);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) {
return std::__vformat_to(std::move(__out_it), __fmt, __args);
}
-#endif
+# endif
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), __fmt.get(),
- std::make_format_args(__args...));
+ return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), __fmt.get(),
- std::make_wformat_args(__args...));
+ return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
// fires too eagerly, see http://llvm.org/PR61563.
@@ -490,12 +483,14 @@ format(wformat_string<_Args...> __fmt, _Args&&... __args) {
# endif
template <class _Context, class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n,
- basic_string_view<_CharT> __fmt,
- basic_format_args<_Context> __args) {
+_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
+__vformat_to_n(_OutIt __out_it,
+ iter_difference_t<_OutIt> __n,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<_Context> __args) {
__format::__format_to_n_buffer<_OutIt, _CharT> __buffer{std::move(__out_it), __n};
std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
+ std::__format_context_create(__buffer.__make_output_iterator(), __args));
return std::move(__buffer).__result();
}
@@ -505,20 +500,19 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args.
return std::__vformat_to_n<format_context>(std::move(__out_it), __n, __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt,
- _Args&&... __args) {
+format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, _Args&&... __args) {
return std::__vformat_to_n<wformat_context>(std::move(__out_it), __n, __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt, auto __args) {
__format::__formatted_size_buffer<_CharT> __buffer;
std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
+ std::__format_context_create(__buffer.__make_output_iterator(), __args));
return std::move(__buffer).__result();
}
@@ -539,14 +533,15 @@ formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
# ifndef _LIBCPP_HAS_NO_LOCALIZATION
template <class _OutIt, class _CharT, class _FormatOutIt>
-requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
- __vformat_to(
- _OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt,
- basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
+ requires(output_iterator<_OutIt, const _CharT&>)
+_LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(
+ _OutIt __out_it,
+ locale __loc,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
if constexpr (same_as<_OutIt, _FormatOutIt>)
- return std::__format::__vformat_to(
- basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(std::move(__out_it), __args, std::move(__loc)));
+ return std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
+ std::__format_context_create(std::move(__out_it), __args, std::move(__loc)));
else {
__format::__format_buffer<_OutIt, _CharT> __buffer{std::move(__out_it)};
std::__format::__vformat_to(
@@ -557,36 +552,32 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
}
template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(
- _OutIt __out_it, locale __loc, string_view __fmt, format_args __args) {
- return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt,
- __args);
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, format_args __args) {
+ return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(
- _OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
- return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt,
- __args);
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
+ return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
}
-#endif
+# endif
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(),
- std::make_format_args(__args...));
+ return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(),
- std::make_wformat_args(__args...));
+ return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
// fires too eagerly, see http://llvm.org/PR61563.
@@ -594,8 +585,7 @@ template <class = void>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
vformat(locale __loc, string_view __fmt, format_args __args) {
string __res;
- std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt,
- __args);
+ std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt, __args);
return __res;
}
@@ -606,8 +596,7 @@ template <class = void>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
wstring __res;
- std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt,
- __args);
+ std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt, __args);
return __res;
}
# endif
@@ -615,23 +604,24 @@ vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
template <class... _Args>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(std::move(__loc), __fmt.get(),
- std::make_format_args(__args...));
+ return std::vformat(std::move(__loc), __fmt.get(), std::make_format_args(__args...));
}
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(std::move(__loc), __fmt.get(),
- std::make_wformat_args(__args...));
+ return std::vformat(std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
}
# endif
template <class _Context, class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n,
- locale __loc, basic_string_view<_CharT> __fmt,
- basic_format_args<_Context> __args) {
+_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(
+ _OutIt __out_it,
+ iter_difference_t<_OutIt> __n,
+ locale __loc,
+ basic_string_view<_CharT> __fmt,
+ basic_format_args<_Context> __args) {
__format::__format_to_n_buffer<_OutIt, _CharT> __buffer{std::move(__out_it), __n};
std::__format::__vformat_to(
basic_format_parse_context{__fmt, __args.__size()},
@@ -640,22 +630,20 @@ _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it,
}
template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt,
- _Args&&... __args) {
- return std::__vformat_to_n<format_context>(std::move(__out_it), __n, std::move(__loc), __fmt.get(),
- std::make_format_args(__args...));
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(
+ _OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
+ return std::__vformat_to_n<format_context>(
+ std::move(__out_it), __n, std::move(__loc), __fmt.get(), std::make_format_args(__args...));
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt,
- _Args&&... __args) {
- return std::__vformat_to_n<wformat_context>(std::move(__out_it), __n, std::move(__loc), __fmt.get(),
- std::make_wformat_args(__args...));
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(
+ _OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+ return std::__vformat_to_n<wformat_context>(
+ std::move(__out_it), __n, std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
}
-#endif
+# endif
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(locale __loc, basic_string_view<_CharT> __fmt, auto __args) {
diff --git a/contrib/llvm-project/libcxx/include/__format/format_parse_context.h b/contrib/llvm-project/libcxx/include/__format/format_parse_context.h
index 79f53f77d4a0..aefcd5497f3b 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_parse_context.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_parse_context.h
@@ -26,32 +26,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT>
class _LIBCPP_TEMPLATE_VIS basic_format_parse_context {
public:
- using char_type = _CharT;
+ using char_type = _CharT;
using const_iterator = typename basic_string_view<_CharT>::const_iterator;
- using iterator = const_iterator;
+ using iterator = const_iterator;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit basic_format_parse_context(basic_string_view<_CharT> __fmt,
- size_t __num_args = 0) noexcept
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_parse_context(
+ basic_string_view<_CharT> __fmt, size_t __num_args = 0) noexcept
: __begin_(__fmt.begin()),
__end_(__fmt.end()),
__indexing_(__unknown),
__next_arg_id_(0),
__num_args_(__num_args) {}
- basic_format_parse_context(const basic_format_parse_context&) = delete;
- basic_format_parse_context&
- operator=(const basic_format_parse_context&) = delete;
+ basic_format_parse_context(const basic_format_parse_context&) = delete;
+ basic_format_parse_context& operator=(const basic_format_parse_context&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept {
- return __begin_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept {
- return __end_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(const_iterator __it) {
- __begin_ = __it;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept { return __begin_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept { return __end_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(const_iterator __it) { __begin_ = __it; }
_LIBCPP_HIDE_FROM_ABI constexpr size_t next_arg_id() {
if (__indexing_ == __manual)
@@ -102,9 +94,9 @@ private:
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_parse_context);
using format_parse_context = basic_format_parse_context<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wformat_parse_context = basic_format_parse_context<wchar_t>;
-#endif
+# endif
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/format_string.h b/contrib/llvm-project/libcxx/include/__format/format_string.h
index 2e1c71b3d01b..bdf3cff7f49b 100644
--- a/contrib/llvm-project/libcxx/include/__format/format_string.h
+++ b/contrib/llvm-project/libcxx/include/__format/format_string.h
@@ -38,8 +38,7 @@ template <contiguous_iterator _Iterator>
__parse_number_result(_Iterator, uint32_t) -> __parse_number_result<_Iterator>;
template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
-__parse_number(_Iterator __begin, _Iterator __end);
+_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> __parse_number(_Iterator __begin, _Iterator __end);
/**
* The maximum value of a numeric argument.
@@ -66,9 +65,7 @@ template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
__parse_automatic(_Iterator __begin, _Iterator, auto& __parse_ctx) {
size_t __value = __parse_ctx.next_arg_id();
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __value <= __number_max,
- "Compilers don't support this number of arguments");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__value <= __number_max, "Compilers don't support this number of arguments");
return {__begin, uint32_t(__value)};
}
@@ -93,8 +90,7 @@ template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
__parse_number(_Iterator __begin, _Iterator __end_input) {
using _CharT = iter_value_t<_Iterator>;
- static_assert(__format::__number_max == INT32_MAX,
- "The algorithm is implemented based on this value.");
+ static_assert(__format::__number_max == INT32_MAX, "The algorithm is implemented based on this value.");
/*
* Limit the input to 9 digits, otherwise we need two checks during every
* iteration:
@@ -102,7 +98,7 @@ __parse_number(_Iterator __begin, _Iterator __end_input) {
* - Does the value exceed width of an uint32_t? (Switching to uint64_t would
* have the same issue, but with a higher maximum.)
*/
- _Iterator __end = __end_input - __begin > 9 ? __begin + 9 : __end_input;
+ _Iterator __end = __end_input - __begin > 9 ? __begin + 9 : __end_input;
uint32_t __value = *__begin - _CharT('0');
while (++__begin != __end) {
if (*__begin < _CharT('0') || *__begin > _CharT('9'))
@@ -111,9 +107,7 @@ __parse_number(_Iterator __begin, _Iterator __end_input) {
__value = __value * 10 + *__begin - _CharT('0');
}
- if (__begin != __end_input && *__begin >= _CharT('0') &&
- *__begin <= _CharT('9')) {
-
+ if (__begin != __end_input && *__begin >= _CharT('0') && *__begin <= _CharT('9')) {
/*
* There are more than 9 digits, do additional validations:
* - Does the 10th digit exceed the maximum allowed value?
@@ -121,9 +115,7 @@ __parse_number(_Iterator __begin, _Iterator __end_input) {
* (More than 10 digits always overflows the maximum.)
*/
uint64_t __v = uint64_t(__value) * 10 + *__begin++ - _CharT('0');
- if (__v > __number_max ||
- (__begin != __end_input && *__begin >= _CharT('0') &&
- *__begin <= _CharT('9')))
+ if (__v > __number_max || (__begin != __end_input && *__begin >= _CharT('0') && *__begin <= _CharT('9')))
std::__throw_format_error("The numeric value of the format specifier is too large");
__value = __v;
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter.h b/contrib/llvm-project/libcxx/include/__format/formatter.h
index 172b2d5f7b8a..079befc5bd9c 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter.h
@@ -33,8 +33,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
/// - is_move_assignable<F>.
template <class _Tp, class _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter {
- formatter() = delete;
- formatter(const formatter&) = delete;
+ formatter() = delete;
+ formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h b/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h
index b45c2a6ebd39..33cc2a4ed661 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_floating_point.h
@@ -116,8 +116,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr size_t __float_buffer_size(int __precision) {
template <>
struct __traits<float> {
- static constexpr int __max_integral = 38;
- static constexpr int __max_fractional = 149;
+ static constexpr int __max_integral = 38;
+ static constexpr int __max_fractional = 149;
static constexpr int __max_fractional_value = 3;
static constexpr size_t __stack_buffer_size = 256;
@@ -126,8 +126,8 @@ struct __traits<float> {
template <>
struct __traits<double> {
- static constexpr int __max_integral = 308;
- static constexpr int __max_fractional = 1074;
+ static constexpr int __max_integral = 308;
+ static constexpr int __max_fractional = 1074;
static constexpr int __max_fractional_value = 4;
static constexpr size_t __stack_buffer_size = 1024;
@@ -153,7 +153,6 @@ public:
// required.
explicit _LIBCPP_HIDE_FROM_ABI __float_buffer(int __precision)
: __precision_(__precision != -1 ? __precision : _Traits::__max_fractional) {
-
// When the precision is larger than _Traits::__max_fractional the digits in
// the range (_Traits::__max_fractional, precision] will contain the value
// zero. There's no need to request to_chars to write these zeros:
@@ -165,7 +164,7 @@ public:
// to be converted from a char to a wchar_t.
if (__precision_ > _Traits::__max_fractional) {
__num_trailing_zeros_ = __precision_ - _Traits::__max_fractional;
- __precision_ = _Traits::__max_fractional;
+ __precision_ = _Traits::__max_fractional;
}
__size_ = __formatter::__float_buffer_size<_Fp>(__precision_);
@@ -180,7 +179,7 @@ public:
if (__size_ > _Traits::__stack_buffer_size)
allocator<char>{}.deallocate(__begin_, __size_);
}
- _LIBCPP_HIDE_FROM_ABI __float_buffer(const __float_buffer&) = delete;
+ _LIBCPP_HIDE_FROM_ABI __float_buffer(const __float_buffer&) = delete;
_LIBCPP_HIDE_FROM_ABI __float_buffer& operator=(const __float_buffer&) = delete;
_LIBCPP_HIDE_FROM_ABI char* begin() const { return __begin_; }
@@ -234,8 +233,8 @@ constexpr inline _LIBCPP_HIDE_FROM_ABI char* __find_exponent(char* __first, char
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_default(const __float_buffer<_Fp>& __buffer, _Tp __value,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_default(const __float_buffer<_Fp>& __buffer, _Tp __value, char* __integral) {
__float_result __result;
__result.__integral = __integral;
__result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value);
@@ -263,9 +262,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_default(const __float_buffe
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result;
__result.__integral = __integral;
if (__precision == -1)
@@ -297,12 +295,12 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(cons
// 0123456789
static_assert(__traits<_Fp>::__hex_precision_digits <= 4, "Guard against possible underflow.");
- char* __last = __result.__last - 2;
- __first = __last - __traits<_Fp>::__hex_precision_digits;
+ char* __last = __result.__last - 2;
+ __first = __last - __traits<_Fp>::__hex_precision_digits;
__result.__exponent = std::find(__first, __last, 'p');
} else {
__result.__radix_point = __result.__last;
- __result.__exponent = __first;
+ __result.__exponent = __first;
}
// clang-format off
@@ -316,9 +314,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(cons
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_upper_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_upper_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result =
__formatter::__format_buffer_hexadecimal_lower_case(__buffer, __value, __precision, __integral);
std::transform(__result.__integral, __result.__exponent, __result.__integral, __hex_to_upper);
@@ -327,9 +324,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_upper_case(cons
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result;
__result.__integral = __integral;
__result.__last =
@@ -342,7 +338,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const
__result.__exponent = __formatter::__find_exponent(__first + 1, __result.__last);
} else {
__result.__radix_point = __result.__last;
- __result.__exponent = __first;
+ __result.__exponent = __first;
}
// clang-format off
@@ -355,9 +351,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_upper_case(const __float_buffer<_Fp>& __buffer,
- _Tp __value, int __precision,
- char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_upper_case(
+ const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result =
__formatter::__format_buffer_scientific_lower_case(__buffer, __value, __precision, __integral);
*__result.__exponent = 'E';
@@ -365,8 +360,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_upper_case(const
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_fixed(const __float_buffer<_Fp>& __buffer, _Tp __value,
- int __precision, char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_fixed(const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result;
__result.__integral = __integral;
__result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::fixed, __precision);
@@ -376,7 +371,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_fixed(const __float_buffer<
// By converting __precision to a bool the subtraction can be done
// unconditionally.
__result.__radix_point = __result.__last - (__precision + bool(__precision));
- __result.__exponent = __result.__last;
+ __result.__exponent = __result.__last;
// clang-format off
_LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) &&
@@ -388,9 +383,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_fixed(const __float_buffer<
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_buffer<_Fp>& __buffer, _Tp __value,
- int __precision, char* __integral) {
-
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_general_lower_case(__float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__buffer.__remove_trailing_zeros();
__float_result __result;
@@ -400,7 +394,7 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_
char* __first = __integral + 1;
if (__first == __result.__last) {
__result.__radix_point = __result.__last;
- __result.__exponent = __result.__last;
+ __result.__exponent = __result.__last;
} else {
__result.__exponent = __formatter::__find_exponent(__first, __result.__last);
if (__result.__exponent != __result.__last)
@@ -426,8 +420,8 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_
}
template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_upper_case(__float_buffer<_Fp>& __buffer, _Tp __value,
- int __precision, char* __integral) {
+_LIBCPP_HIDE_FROM_ABI __float_result
+__format_buffer_general_upper_case(__float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
__float_result __result = __formatter::__format_buffer_general_lower_case(__buffer, __value, __precision, __integral);
if (__result.__exponent != __result.__last)
*__result.__exponent = 'E';
@@ -504,9 +498,9 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
const __float_result& __result,
std::locale __loc,
__format_spec::__parsed_specifications<_CharT> __specs) {
- const auto& __np = std::use_facet<numpunct<_CharT>>(__loc);
+ const auto& __np = std::use_facet<numpunct<_CharT>>(__loc);
string __grouping = __np.grouping();
- char* __first = __result.__integral;
+ char* __first = __result.__integral;
// When no radix point or exponent are present __last will be __result.__last.
char* __last = std::min(__result.__radix_point, __result.__exponent);
@@ -524,11 +518,11 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
__grouping.size() - // Grouping contains one
!__grouping.empty(); // additional character
- __formatter::__padding_size_result __padding = {0, 0};
- bool __zero_padding = __specs.__alignment_ == __format_spec::__alignment::__zero_padding;
+ __formatter::__padding_size_result __padding = {0, 0};
+ bool __zero_padding = __specs.__alignment_ == __format_spec::__alignment::__zero_padding;
if (__size < __specs.__width_) {
if (__zero_padding) {
- __specs.__alignment_ = __format_spec::__alignment::__right;
+ __specs.__alignment_ = __format_spec::__alignment::__right;
__specs.__fill_.__data[0] = _CharT('0');
}
@@ -546,8 +540,8 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
if (__grouping.empty()) {
__out_it = __formatter::__copy(__first, __digits, std::move(__out_it));
} else {
- auto __r = __grouping.rbegin();
- auto __e = __grouping.rend() - 1;
+ auto __r = __grouping.rbegin();
+ auto __e = __grouping.rend() - 1;
_CharT __sep = __np.thousands_sep();
// The output is divided in small groups of numbers to write:
// - A group before the first separator.
@@ -627,8 +621,8 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
const _CharT* __exponent,
size_t __num_trailing_zeros) -> decltype(__out_it) {
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
- _LIBCPP_ASSERT_UNCATEGORIZED(__num_trailing_zeros > 0,
- "The overload not writing trailing zeros should have been used");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used");
__padding_size_result __padding =
__formatter::__padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_);
@@ -639,7 +633,6 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
}
-
template <floating_point _Tp, class _CharT, class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
__format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
@@ -743,7 +736,7 @@ __format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__par
*__out_it++ = *__first++;
// After the sign is written, zero padding is the same a right alignment
// with '0'.
- __specs.__alignment_ = __format_spec::__alignment::__right;
+ __specs.__alignment_ = __format_spec::__alignment::__right;
__specs.__fill_.__data[0] = _CharT('0');
}
@@ -775,14 +768,11 @@ public:
};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<float, _CharT>
- : public __formatter_floating_point<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<float, _CharT> : public __formatter_floating_point<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<double, _CharT>
- : public __formatter_floating_point<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<double, _CharT> : public __formatter_floating_point<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<long double, _CharT>
- : public __formatter_floating_point<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<long double, _CharT> : public __formatter_floating_point<_CharT> {};
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_integer.h b/contrib/llvm-project/libcxx/include/__format/formatter_integer.h
index 5590bff5aa98..d57082b3881b 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_integer.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_integer.h
@@ -26,13 +26,12 @@
# pragma GCC system_header
#endif
- _LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
- template <__fmt_char_type _CharT>
- struct _LIBCPP_TEMPLATE_VIS __formatter_integer {
-
+template <__fmt_char_type _CharT>
+struct _LIBCPP_TEMPLATE_VIS __formatter_integer {
public:
template <class _ParseContext>
_LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
@@ -60,44 +59,34 @@ public:
// Signed integral types.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<signed char, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<signed char, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<short, _CharT> : public __formatter_integer<_CharT> {
-};
+struct _LIBCPP_TEMPLATE_VIS formatter<short, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<int, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<long, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<long long, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<long long, _CharT> : public __formatter_integer<_CharT> {};
# ifndef _LIBCPP_HAS_NO_INT128
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<__int128_t, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<__int128_t, _CharT> : public __formatter_integer<_CharT> {};
# endif
// Unsigned integral types.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned char, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned char, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned short, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned short, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long long, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long long, _CharT> : public __formatter_integer<_CharT> {};
# ifndef _LIBCPP_HAS_NO_INT128
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT>
- : public __formatter_integer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT> : public __formatter_integer<_CharT> {};
# endif
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_integral.h b/contrib/llvm-project/libcxx/include/__format/formatter_integral.h
index 598decb0a95e..ca66e26ede10 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_integral.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_integral.h
@@ -20,6 +20,9 @@
#include <__format/format_error.h>
#include <__format/formatter_output.h>
#include <__format/parser_std_format_spec.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__memory/pointer_traits.h>
#include <__system_error/errc.h>
#include <__type_traits/make_unsigned.h>
#include <__utility/unreachable.h>
@@ -49,7 +52,9 @@ namespace __formatter {
// Generic
//
-_LIBCPP_HIDE_FROM_ABI inline char* __insert_sign(char* __buf, bool __negative, __format_spec::__sign __sign) {
+template <contiguous_iterator _Iterator>
+ requires same_as<char, iter_value_t<_Iterator>>
+_LIBCPP_HIDE_FROM_ABI inline _Iterator __insert_sign(_Iterator __buf, bool __negative, __format_spec::__sign __sign) {
if (__negative)
*__buf++ = '-';
else
@@ -85,9 +90,10 @@ _LIBCPP_HIDE_FROM_ABI inline char* __insert_sign(char* __buf, bool __negative, _
* regardless whether the @c std::numpunct's type is @c char or @c wchar_t.
*/
_LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const string& __grouping) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__grouping.empty() && __size > __grouping[0],
- "The slow grouping formatting is used while there will be no "
- "separators written");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ !__grouping.empty() && __size > __grouping[0],
+ "The slow grouping formatting is used while there will be no "
+ "separators written");
string __r;
auto __end = __grouping.end() - 1;
auto __ptr = __grouping.begin();
@@ -119,10 +125,10 @@ _LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const
//
template <__fmt_char_type _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __format_char(
- integral auto __value,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__format_char(integral auto __value,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
using _Tp = decltype(__value);
if constexpr (!same_as<_CharT, _Tp>) {
// cmp_less and cmp_greater can't be used for character types.
@@ -148,14 +154,16 @@ _LIBCPP_HIDE_FROM_ABI auto __format_char(
// Integer
//
-/** Wrapper around @ref to_chars, returning the output pointer. */
-template <integral _Tp>
-_LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, int __base) {
+/** Wrapper around @ref to_chars, returning the output iterator. */
+template <contiguous_iterator _Iterator, integral _Tp>
+ requires same_as<char, iter_value_t<_Iterator>>
+_LIBCPP_HIDE_FROM_ABI _Iterator __to_buffer(_Iterator __first, _Iterator __last, _Tp __value, int __base) {
// TODO FMT Evaluate code overhead due to not calling the internal function
// directly. (Should be zero overhead.)
- to_chars_result __r = std::to_chars(__first, __last, __value, __base);
+ to_chars_result __r = std::to_chars(std::to_address(__first), std::to_address(__last), __value, __base);
_LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small");
- return __r.ptr;
+ auto __diff = __r.ptr - std::to_address(__first);
+ return __first + __diff;
}
/**
@@ -203,10 +211,16 @@ consteval size_t __buffer_size() noexcept
+ 1; // Reserve space for the sign.
}
-template <class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, const char* __begin, const char* __first,
- const char* __last, string&& __grouping, _CharT __sep,
- __format_spec::__parsed_specifications<_CharT> __specs) {
+template <class _OutIt, contiguous_iterator _Iterator, class _CharT>
+ requires same_as<char, iter_value_t<_Iterator>>
+_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(
+ _OutIt __out_it,
+ _Iterator __begin,
+ _Iterator __first,
+ _Iterator __last,
+ string&& __grouping,
+ _CharT __sep,
+ __format_spec::__parsed_specifications<_CharT> __specs) {
int __size = (__first - __begin) + // [sign][prefix]
(__last - __first) + // data
(__grouping.size() - 1); // number of separator characters
@@ -234,8 +248,10 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
auto __r = __grouping.rbegin();
auto __e = __grouping.rend() - 1;
- _LIBCPP_ASSERT_UNCATEGORIZED(__r != __e, "The slow grouping formatting is used while "
- "there will be no separators written.");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __r != __e,
+ "The slow grouping formatting is used while "
+ "there will be no separators written.");
// The output is divided in small groups of numbers to write:
// - A group before the first separator.
// - A separator and a group, repeated for the number of separators.
@@ -249,9 +265,9 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
// hoisting the invariant is worth the effort.
while (true) {
if (__specs.__std_.__type_ == __format_spec::__type::__hexadecimal_upper_case) {
- __last = __first + *__r;
+ __last = __first + *__r;
__out_it = __formatter::__transform(__first, __last, std::move(__out_it), __hex_to_upper);
- __first = __last;
+ __first = __last;
} else {
__out_it = __formatter::__copy(__first, *__r, std::move(__out_it));
__first += *__r;
@@ -267,24 +283,23 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
}
-
-
-template <unsigned_integral _Tp, class _CharT, class _FormatContext>
+template <unsigned_integral _Tp, contiguous_iterator _Iterator, class _CharT, class _FormatContext>
+ requires same_as<char, iter_value_t<_Iterator>>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
_Tp __value,
_FormatContext& __ctx,
__format_spec::__parsed_specifications<_CharT> __specs,
bool __negative,
- char* __begin,
- char* __end,
+ _Iterator __begin,
+ _Iterator __end,
const char* __prefix,
int __base) {
- char* __first = __formatter::__insert_sign(__begin, __negative, __specs.__std_.__sign_);
+ _Iterator __first = __formatter::__insert_sign(__begin, __negative, __specs.__std_.__sign_);
if (__specs.__std_.__alternate_form_ && __prefix)
while (*__prefix)
*__first++ = *__prefix++;
- char* __last = __formatter::__to_buffer(__first, __end, __value, __base);
+ _Iterator __last = __formatter::__to_buffer(__first, __end, __value, __base);
# ifndef _LIBCPP_HAS_NO_LOCALIZATION
if (__specs.__std_.__locale_specific_form_) {
@@ -315,10 +330,10 @@ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
// The zero padding is done like:
// - Write [sign][prefix]
// - Write data right aligned with '0' as fill character.
- __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
- __specs.__alignment_ = __format_spec::__alignment::__right;
+ __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
+ __specs.__alignment_ = __format_spec::__alignment::__right;
__specs.__fill_.__data[0] = _CharT('0');
- int32_t __size = __first - __begin;
+ int32_t __size = __first - __begin;
__specs.__width_ -= std::min(__size, __specs.__width_);
}
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_output.h b/contrib/llvm-project/libcxx/include/__format/formatter_output.h
index 2909fcd9baf1..31e06425703a 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_output.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_output.h
@@ -23,8 +23,9 @@
#include <__format/unicode.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/concepts.h>
-#include <__iterator/iterator_traits.h> // iter_value_t
+#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
+#include <__memory/pointer_traits.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
#include <cstddef>
@@ -101,8 +102,7 @@ _LIBCPP_HIDE_FROM_ABI auto __copy(basic_string_view<_CharT> __str, output_iterat
if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
__out_it.__get_container()->__copy(__str);
return __out_it;
- } else if constexpr (std::same_as<decltype(__out_it),
- typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
+ } else if constexpr (std::same_as<decltype(__out_it), typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
__out_it.__buffer_->__copy(__str);
return __out_it;
} else {
@@ -110,33 +110,36 @@ _LIBCPP_HIDE_FROM_ABI auto __copy(basic_string_view<_CharT> __str, output_iterat
}
}
-template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__copy(const _CharT* __first, const _CharT* __last, output_iterator<const _OutCharT&> auto __out_it)
+template <contiguous_iterator _Iterator,
+ __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
+ __fmt_char_type _OutCharT = _CharT>
+_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it)
-> decltype(__out_it) {
return __formatter::__copy(basic_string_view{__first, __last}, std::move(__out_it));
}
-template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __copy(const _CharT* __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it)
+template <contiguous_iterator _Iterator,
+ __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
+ __fmt_char_type _OutCharT = _CharT>
+_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it)
-> decltype(__out_it) {
- return __formatter::__copy(basic_string_view{__first, __n}, std::move(__out_it));
+ return __formatter::__copy(basic_string_view{std::to_address(__first), __n}, std::move(__out_it));
}
/// Transform wrapper.
///
/// This uses a "mass output function" of __format::__output_buffer when possible.
-template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT, class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto
-__transform(const _CharT* __first,
- const _CharT* __last,
- output_iterator<const _OutCharT&> auto __out_it,
- _UnaryOperation __operation) -> decltype(__out_it) {
+template <contiguous_iterator _Iterator,
+ __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
+ __fmt_char_type _OutCharT = _CharT,
+ class _UnaryOperation>
+_LIBCPP_HIDE_FROM_ABI auto __transform(
+ _Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it, _UnaryOperation __operation)
+ -> decltype(__out_it) {
if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
__out_it.__get_container()->__transform(__first, __last, std::move(__operation));
return __out_it;
- } else if constexpr (std::same_as<decltype(__out_it),
- typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
+ } else if constexpr (std::same_as<decltype(__out_it), typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
__out_it.__buffer_->__transform(__first, __last, std::move(__operation));
return __out_it;
} else {
@@ -243,7 +246,7 @@ __write(_Iterator __first,
output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
__format_spec::__parsed_specifications<_ParserCharT> __specs,
ptrdiff_t __size) -> decltype(__out_it) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
return __formatter::__write(basic_string_view{__first, __last}, std::move(__out_it), __specs, __size);
}
@@ -256,16 +259,21 @@ __write(_Iterator __first,
_Iterator __last,
output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
__format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
return __formatter::__write(__first, __last, std::move(__out_it), __specs, __last - __first);
}
-template <class _CharT, class _ParserCharT, class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto __write_transformed(const _CharT* __first, const _CharT* __last,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs,
- _UnaryOperation __op) -> decltype(__out_it) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
+template <contiguous_iterator _Iterator,
+ class _CharT = typename iterator_traits<_Iterator>::value_type,
+ class _ParserCharT,
+ class _UnaryOperation>
+_LIBCPP_HIDE_FROM_ABI auto __write_transformed(
+ _Iterator __first,
+ _Iterator __last,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_ParserCharT> __specs,
+ _UnaryOperation __op) -> decltype(__out_it) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
ptrdiff_t __size = __last - __first;
if (__size >= __specs.__width_)
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h b/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h
index a2212611df48..3373996ec3d5 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_pointer.h
@@ -60,14 +60,11 @@ public:
// - template<> struct formatter<void*, charT>;
// - template<> struct formatter<const void*, charT>;
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<nullptr_t, _CharT>
- : public __formatter_pointer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<nullptr_t, _CharT> : public __formatter_pointer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<void*, _CharT> : public __formatter_pointer<_CharT> {
-};
+struct _LIBCPP_TEMPLATE_VIS formatter<void*, _CharT> : public __formatter_pointer<_CharT> {};
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<const void*, _CharT>
- : public __formatter_pointer<_CharT> {};
+struct _LIBCPP_TEMPLATE_VIS formatter<const void*, _CharT> : public __formatter_pointer<_CharT> {};
#endif //_LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__format/formatter_string.h b/contrib/llvm-project/libcxx/include/__format/formatter_string.h
index ba64a64af80a..4ba5617a49c8 100644
--- a/contrib/llvm-project/libcxx/include/__format/formatter_string.h
+++ b/contrib/llvm-project/libcxx/include/__format/formatter_string.h
@@ -59,14 +59,15 @@ public:
// Formatter const char*.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT>
- : public __formatter_string<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT> : public __formatter_string<_CharT> {
using _Base = __formatter_string<_CharT>;
template <class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _CharT* __str, _FormatContext& __ctx) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__str, "The basic_format_arg constructor should have "
- "prevented an invalid pointer.");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __str,
+ "The basic_format_arg constructor should have "
+ "prevented an invalid pointer.");
__format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx);
# if _LIBCPP_STD_VER >= 23
@@ -98,8 +99,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT>
// Formatter char*.
template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT>
- : public formatter<const _CharT*, _CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT> : public formatter<const _CharT*, _CharT> {
using _Base = formatter<const _CharT*, _CharT>;
template <class _FormatContext>
@@ -110,8 +110,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT>
// Formatter char[].
template <__fmt_char_type _CharT, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS formatter<_CharT[_Size], _CharT>
- : public __formatter_string<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<_CharT[_Size], _CharT> : public __formatter_string<_CharT> {
using _Base = __formatter_string<_CharT>;
template <class _FormatContext>
@@ -137,8 +136,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<basic_string<_CharT, _Traits, _Allocator>,
// Formatter std::string_view.
template <__fmt_char_type _CharT, class _Traits>
-struct _LIBCPP_TEMPLATE_VIS formatter<basic_string_view<_CharT, _Traits>, _CharT>
- : public __formatter_string<_CharT> {
+struct _LIBCPP_TEMPLATE_VIS formatter<basic_string_view<_CharT, _Traits>, _CharT> : public __formatter_string<_CharT> {
using _Base = __formatter_string<_CharT>;
template <class _FormatContext>
diff --git a/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h b/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
index ea5dfdf30511..e38729db965c 100644
--- a/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
+++ b/contrib/llvm-project/libcxx/include/__format/parser_std_format_spec.h
@@ -82,8 +82,7 @@ __parse_arg_id(_Iterator __begin, _Iterator __end, _ParseContext& __ctx) {
}
template <class _Context>
-_LIBCPP_HIDE_FROM_ABI constexpr uint32_t
-__substitute_arg_id(basic_format_arg<_Context> __format_arg) {
+_LIBCPP_HIDE_FROM_ABI constexpr uint32_t __substitute_arg_id(basic_format_arg<_Context> __format_arg) {
// [format.string.std]/8
// If the corresponding formatting argument is not of integral type...
// This wording allows char and bool too. LWG-3720 changes the wording to
@@ -240,22 +239,22 @@ inline constexpr uint32_t __type_mask_integer =
__create_type_mask(__type::__hexadecimal_upper_case);
struct __std {
- __alignment __alignment_ : 3;
- __sign __sign_ : 2;
- bool __alternate_form_ : 1;
+ __alignment __alignment_ : 3;
+ __sign __sign_ : 2;
+ bool __alternate_form_ : 1;
bool __locale_specific_form_ : 1;
__type __type_;
};
struct __chrono {
- __alignment __alignment_ : 3;
+ __alignment __alignment_ : 3;
bool __locale_specific_form_ : 1;
bool __hour_ : 1;
- bool __weekday_name_ : 1;
+ bool __weekday_name_ : 1;
bool __weekday_ : 1;
bool __day_of_year_ : 1;
bool __week_of_year_ : 1;
- bool __month_name_ : 1;
+ bool __month_name_ : 1;
};
// The fill UCS scalar value.
@@ -495,8 +494,7 @@ public:
}
/// \returns the `__parsed_specifications` with the resolved dynamic sizes..
- _LIBCPP_HIDE_FROM_ABI
- __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
return __parsed_specifications<_CharT>{
.__std_ = __std{.__alignment_ = __alignment_,
.__sign_ = __sign_,
@@ -524,9 +522,9 @@ public:
.__fill_{__fill_}};
}
- __alignment __alignment_ : 3 {__alignment::__default};
- __sign __sign_ : 2 {__sign::__default};
- bool __alternate_form_ : 1 {false};
+ __alignment __alignment_ : 3 {__alignment::__default};
+ __sign __sign_ : 2 {__sign::__default};
+ bool __alternate_form_ : 1 {false};
bool __locale_specific_form_ : 1 {false};
bool __clear_brackets_ : 1 {false};
__type __type_{__type::__default};
@@ -547,7 +545,7 @@ public:
uint8_t __reserved_1_ : 6 {0};
// These two flags are only used internally and not part of the
// __parsed_specifications. Therefore put them at the end.
- bool __width_as_arg_ : 1 {false};
+ bool __width_as_arg_ : 1 {false};
bool __precision_as_arg_ : 1 {false};
/// The requested width, either the value or the arg-id.
@@ -593,9 +591,10 @@ private:
|| (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_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _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");
__unicode::__code_point_view<_CharT> __view{__begin, __end};
__unicode::__consume_result __consumed = __view.__consume();
if (__consumed.__status != __unicode::__consume_result::__ok)
@@ -625,9 +624,10 @@ private:
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_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _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 && __parse_alignment(*(__begin + 1))) {
if (!__unicode::__is_scalar_value(*__begin))
std::__throw_format_error("The fill option contains an invalid value");
@@ -652,9 +652,10 @@ private:
// 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_ASSERT_UNCATEGORIZED(__begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
+ _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);
@@ -721,9 +722,9 @@ private:
if (*__begin == _CharT('{')) {
__format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __width_as_arg_ = true;
- __width_ = __r.__value;
- __begin = __r.__last;
+ __width_as_arg_ = true;
+ __width_ = __r.__value;
+ __begin = __r.__last;
return true;
}
@@ -731,9 +732,11 @@ private:
return false;
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __width_ = __r.__value;
- _LIBCPP_ASSERT_UNCATEGORIZED(__width_ != 0, "A zero value isn't allowed and should be impossible, "
- "due to validations in this function");
+ __width_ = __r.__value;
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __width_ != 0,
+ "A zero value isn't allowed and should be impossible, "
+ "due to validations in this function");
__begin = __r.__last;
return true;
}
@@ -749,9 +752,9 @@ private:
if (*__begin == _CharT('{')) {
__format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __precision_as_arg_ = true;
- __precision_ = __arg_id.__value;
- __begin = __arg_id.__last;
+ __precision_as_arg_ = true;
+ __precision_ = __arg_id.__value;
+ __begin = __arg_id.__last;
return true;
}
@@ -759,9 +762,9 @@ private:
std::__throw_format_error("The precision option does not contain a value or an argument index");
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __precision_ = __r.__value;
- __precision_as_arg_ = false;
- __begin = __r.__last;
+ __precision_ = __r.__value;
+ __precision_as_arg_ = false;
+ __begin = __r.__last;
return true;
}
@@ -858,16 +861,14 @@ private:
++__begin;
}
- _LIBCPP_HIDE_FROM_ABI
- int32_t __get_width(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI int32_t __get_width(auto& __ctx) const {
if (!__width_as_arg_)
return __width_;
return __format_spec::__substitute_arg_id(__ctx.arg(__width_));
}
- _LIBCPP_HIDE_FROM_ABI
- int32_t __get_precision(auto& __ctx) const {
+ _LIBCPP_HIDE_FROM_ABI int32_t __get_precision(auto& __ctx) const {
if (!__precision_as_arg_)
return __precision_;
diff --git a/contrib/llvm-project/libcxx/include/__format/unicode.h b/contrib/llvm-project/libcxx/include/__format/unicode.h
index 8666f80c78a2..8e1e7bb192a0 100644
--- a/contrib/llvm-project/libcxx/include/__format/unicode.h
+++ b/contrib/llvm-project/libcxx/include/__format/unicode.h
@@ -319,9 +319,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
return true;
// *** Do not break Hangul syllable sequences. ***
- if (__prev == __property::__L &&
- (__next == __property::__L || __next == __property::__V || __next == __property::__LV ||
- __next == __property::__LVT)) // GB6
+ if (__prev == __property::__L && (__next == __property::__L || __next == __property::__V ||
+ __next == __property::__LV || __next == __property::__LVT)) // GB6
return false;
if ((__prev == __property::__LV || __prev == __property::__V) &&
@@ -402,9 +401,8 @@ public:
};
_LIBCPP_HIDE_FROM_ABI constexpr __cluster __consume() {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot,
- "can't move beyond the end of input");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot,
+ "can't move beyond the end of input");
char32_t __code_point = __next_code_point_;
if (!__code_point_view_.__at_end())
diff --git a/contrib/llvm-project/libcxx/include/__format/write_escaped.h b/contrib/llvm-project/libcxx/include/__format/write_escaped.h
index 51bae3cb238f..15141eebc029 100644
--- a/contrib/llvm-project/libcxx/include/__format/write_escaped.h
+++ b/contrib/llvm-project/libcxx/include/__format/write_escaped.h
@@ -32,7 +32,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-
namespace __formatter {
#if _LIBCPP_STD_VER >= 20
@@ -42,10 +41,10 @@ namespace __formatter {
/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
/// input is ASCII.
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __write_string(
- basic_string_view<_CharT> __str,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__write_string(basic_string_view<_CharT> __str,
+ output_iterator<const _CharT&> auto __out_it,
+ __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
if (!__specs.__has_precision())
return __formatter::__write_string_no_precision(__str, std::move(__out_it), __specs);
@@ -54,8 +53,8 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string(
return __formatter::__write(__str.begin(), __str.end(), std::move(__out_it), __specs, __size);
}
-# endif // _LIBCPP_STD_VER >= 20
-# if _LIBCPP_STD_VER >= 23
+#endif // _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 23
struct __nul_terminator {};
@@ -100,11 +99,11 @@ _LIBCPP_HIDE_FROM_ABI void __write_escape_ill_formed_code_unit(basic_string<_Cha
template <class _CharT>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool __is_escaped_sequence_written(basic_string<_CharT>& __str, char32_t __value) {
-# ifdef _LIBCPP_HAS_NO_UNICODE
+# ifdef _LIBCPP_HAS_NO_UNICODE
// For ASCII assume everything above 127 is printable.
if (__value > 127)
return false;
-# endif
+# endif
if (!__escaped_output_table::__needs_escape(__value))
return false;
@@ -213,7 +212,7 @@ __format_escaped_string(basic_string_view<_CharT> __values,
return __formatter::__write_string(basic_string_view{__str}, std::move(__out_it), __specs);
}
-# endif // _LIBCPP_STD_VER >= 23
+#endif // _LIBCPP_STD_VER >= 23
} // namespace __formatter
diff --git a/contrib/llvm-project/libcxx/include/__functional/binary_function.h b/contrib/llvm-project/libcxx/include/__functional/binary_function.h
index fdedb8b177da..ddee3b170311 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binary_function.h
@@ -21,20 +21,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
template <class _Arg1, class _Arg2, class _Result>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function
-{
- typedef _Arg1 first_argument_type;
- typedef _Arg2 second_argument_type;
- typedef _Result result_type;
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
};
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
-template <class _Arg1, class _Arg2, class _Result> struct __binary_function_keep_layout_base {
+template <class _Arg1, class _Arg2, class _Result>
+struct __binary_function_keep_layout_base {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1;
+ using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1;
using second_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg2;
- using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
+ using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
#endif
};
diff --git a/contrib/llvm-project/libcxx/include/__functional/binary_negate.h b/contrib/llvm-project/libcxx/include/__functional/binary_negate.h
index 3180284fc382..ce52b5ae9fc4 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binary_negate.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binary_negate.h
@@ -25,23 +25,24 @@ template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate
: public __binary_function<typename _Predicate::first_argument_type,
typename _Predicate::second_argument_type,
- bool>
-{
- _Predicate __pred_;
+ bool> {
+ _Predicate __pred_;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX14
- binary_negate(const _Predicate& __pred) : __pred_(__pred) {}
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX14 binary_negate(const _Predicate& __pred)
+ : __pred_(__pred) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Predicate::first_argument_type& __x,
- const typename _Predicate::second_argument_type& __y) const
- {return !__pred_(__x, __y);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(
+ const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const {
+ return !__pred_(__x, __y);
+ }
};
template <class _Predicate>
-_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-binary_negate<_Predicate>
-not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI binary_negate<_Predicate>
+not2(const _Predicate& __pred) {
+ return binary_negate<_Predicate>(__pred);
+}
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/bind.h b/contrib/llvm-project/libcxx/include/__functional/bind.h
index 61d99e1fd564..19e7d82155ec 100644
--- a/contrib/llvm-project/libcxx/include/__functional/bind.h
+++ b/contrib/llvm-project/libcxx/include/__functional/bind.h
@@ -25,34 +25,30 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp>
-struct is_bind_expression : _If<
- _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
- false_type,
- is_bind_expression<__remove_cvref_t<_Tp> >
-> {};
+template <class _Tp>
+struct is_bind_expression
+ : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, false_type, is_bind_expression<__remove_cvref_t<_Tp> > > {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_bind_expression_v = is_bind_expression<_Tp>::value;
#endif
-template<class _Tp>
-struct is_placeholder : _If<
- _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
- integral_constant<int, 0>,
- is_placeholder<__remove_cvref_t<_Tp> >
-> {};
+template <class _Tp>
+struct is_placeholder
+ : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value,
+ integral_constant<int, 0>,
+ is_placeholder<__remove_cvref_t<_Tp> > > {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr int is_placeholder_v = is_placeholder<_Tp>::value;
#endif
-namespace placeholders
-{
+namespace placeholders {
-template <int _Np> struct __ph {};
+template <int _Np>
+struct __ph {};
// C++17 recommends that we implement placeholders as `inline constexpr`, but allows
// implementing them as `extern <implementation-defined>`. Libc++ implements them as
@@ -62,291 +58,234 @@ template <int _Np> struct __ph {};
//
// In practice, since placeholders are empty, `extern const` is almost impossible
// to distinguish from `inline constexpr` from a usage stand point.
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;
-_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;
+_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10;
} // namespace placeholders
-template<int _Np>
-struct is_placeholder<placeholders::__ph<_Np> >
- : public integral_constant<int, _Np> {};
-
+template <int _Np>
+struct is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {};
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Uj>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp&
-__mu(reference_wrapper<_Tp> __t, _Uj&)
-{
- return __t.get();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __mu(reference_wrapper<_Tp> __t, _Uj&) {
+ return __t.get();
}
-template <class _Ti, class ..._Uj, size_t ..._Indx>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __invoke_of<_Ti&, _Uj...>::type
-__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
-{
- return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...);
+template <class _Ti, class... _Uj, size_t... _Indx>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type
+__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) {
+ return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...);
}
-template <class _Ti, class ..._Uj, __enable_if_t<is_bind_expression<_Ti>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __invoke_of<_Ti&, _Uj...>::type
-__mu(_Ti& __ti, tuple<_Uj...>& __uj)
-{
- typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
- return std::__mu_expand(__ti, __uj, __indices());
+template <class _Ti, class... _Uj, __enable_if_t<is_bind_expression<_Ti>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type
+__mu(_Ti& __ti, tuple<_Uj...>& __uj) {
+ typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
+ return std::__mu_expand(__ti, __uj, __indices());
}
template <bool IsPh, class _Ti, class _Uj>
struct __mu_return2 {};
template <class _Ti, class _Uj>
-struct __mu_return2<true, _Ti, _Uj>
-{
- typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
+struct __mu_return2<true, _Ti, _Uj> {
+ typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
};
template <class _Ti, class _Uj, __enable_if_t<0 < is_placeholder<_Ti>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
-__mu(_Ti&, _Uj& __uj)
-{
- const size_t __indx = is_placeholder<_Ti>::value - 1;
- return std::forward<typename tuple_element<__indx, _Uj>::type>(std::get<__indx>(__uj));
+ typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
+ __mu(_Ti&, _Uj& __uj) {
+ const size_t __indx = is_placeholder<_Ti>::value - 1;
+ return std::forward<typename tuple_element<__indx, _Uj>::type>(std::get<__indx>(__uj));
}
-template <class _Ti, class _Uj, __enable_if_t<!is_bind_expression<_Ti>::value &&
- is_placeholder<_Ti>::value == 0 &&
- !__is_reference_wrapper<_Ti>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Ti&
-__mu(_Ti& __ti, _Uj&)
-{
- return __ti;
+template <class _Ti,
+ class _Uj,
+ __enable_if_t<!is_bind_expression<_Ti>::value && is_placeholder<_Ti>::value == 0 &&
+ !__is_reference_wrapper<_Ti>::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Ti& __mu(_Ti& __ti, _Uj&) {
+ return __ti;
}
-template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
- class _TupleUj>
+template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh, class _TupleUj>
struct __mu_return_impl;
-template <bool _Invokable, class _Ti, class ..._Uj>
-struct __mu_return_invokable // false
+template <bool _Invokable, class _Ti, class... _Uj>
+struct __mu_return_invokable // false
{
- typedef __nat type;
+ typedef __nat type;
};
-template <class _Ti, class ..._Uj>
-struct __mu_return_invokable<true, _Ti, _Uj...>
-{
- typedef typename __invoke_of<_Ti&, _Uj...>::type type;
+template <class _Ti, class... _Uj>
+struct __mu_return_invokable<true, _Ti, _Uj...> {
+ typedef typename __invoke_of<_Ti&, _Uj...>::type type;
};
-template <class _Ti, class ..._Uj>
+template <class _Ti, class... _Uj>
struct __mu_return_impl<_Ti, false, true, false, tuple<_Uj...> >
- : public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...>
-{
-};
+ : public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...> {};
template <class _Ti, class _TupleUj>
-struct __mu_return_impl<_Ti, false, false, true, _TupleUj>
-{
- typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
- _TupleUj>::type&& type;
+struct __mu_return_impl<_Ti, false, false, true, _TupleUj> {
+ typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _TupleUj>::type&& type;
};
template <class _Ti, class _TupleUj>
-struct __mu_return_impl<_Ti, true, false, false, _TupleUj>
-{
- typedef typename _Ti::type& type;
+struct __mu_return_impl<_Ti, true, false, false, _TupleUj> {
+ typedef typename _Ti::type& type;
};
template <class _Ti, class _TupleUj>
-struct __mu_return_impl<_Ti, false, false, false, _TupleUj>
-{
- typedef _Ti& type;
+struct __mu_return_impl<_Ti, false, false, false, _TupleUj> {
+ typedef _Ti& type;
};
template <class _Ti, class _TupleUj>
struct __mu_return
- : public __mu_return_impl<_Ti,
- __is_reference_wrapper<_Ti>::value,
- is_bind_expression<_Ti>::value,
- 0 < is_placeholder<_Ti>::value &&
- is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
- _TupleUj>
-{
-};
+ : public __mu_return_impl<
+ _Ti,
+ __is_reference_wrapper<_Ti>::value,
+ is_bind_expression<_Ti>::value,
+ 0 < is_placeholder<_Ti>::value && is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
+ _TupleUj> {};
template <class _Fp, class _BoundArgs, class _TupleUj>
-struct __is_valid_bind_return
-{
- static const bool value = false;
+struct __is_valid_bind_return {
+ static const bool value = false;
};
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
-{
- static const bool value = __invokable<_Fp,
- typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> {
+ static const bool value = __invokable<_Fp, typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
};
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
-{
- static const bool value = __invokable<_Fp,
- typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> {
+ static const bool value = __invokable<_Fp, typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
};
-template <class _Fp, class _BoundArgs, class _TupleUj,
- bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
+template <class _Fp, class _BoundArgs, class _TupleUj, bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
struct __bind_return;
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true>
-{
- typedef typename __invoke_of
- <
- _Fp&,
- typename __mu_return
- <
- _BoundArgs,
- _TupleUj
- >::type...
- >::type type;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true> {
+ typedef typename __invoke_of< _Fp&, typename __mu_return< _BoundArgs, _TupleUj >::type... >::type type;
};
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true>
-{
- typedef typename __invoke_of
- <
- _Fp&,
- typename __mu_return
- <
- const _BoundArgs,
- _TupleUj
- >::type...
- >::type type;
+template <class _Fp, class... _BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> {
+ typedef typename __invoke_of< _Fp&, typename __mu_return< const _BoundArgs, _TupleUj >::type... >::type type;
};
-template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __bind_return<_Fp, _BoundArgs, _Args>::type
-__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
- _Args&& __args)
-{
- return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...);
+template <class _Fp, class _BoundArgs, size_t... _Indx, class _Args>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fp, _BoundArgs, _Args>::type
+__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) {
+ return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...);
}
-template<class _Fp, class ..._BoundArgs>
-class __bind : public __weak_result_type<__decay_t<_Fp> >
-{
+template <class _Fp, class... _BoundArgs>
+class __bind : public __weak_result_type<__decay_t<_Fp> > {
protected:
- using _Fd = __decay_t<_Fp>;
- typedef tuple<__decay_t<_BoundArgs>...> _Td;
+ using _Fd = __decay_t<_Fp>;
+ typedef tuple<__decay_t<_BoundArgs>...> _Td;
+
private:
- _Fd __f_;
- _Td __bound_args_;
+ _Fd __f_;
+ _Td __bound_args_;
+
+ typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
- typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
- template <class _Gp, class ..._BA,
- __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
- : __f_(std::forward<_Gp>(__f)),
- __bound_args_(std::forward<_BA>(__bound_args)...) {}
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
- operator()(_Args&& ...__args)
- {
- return std::__apply_functor(__f_, __bound_args_, __indices(),
- tuple<_Args&&...>(std::forward<_Args>(__args)...));
- }
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
- operator()(_Args&& ...__args) const
- {
- return std::__apply_functor(__f_, __bound_args_, __indices(),
- tuple<_Args&&...>(std::forward<_Args>(__args)...));
- }
+ template <
+ class _Gp,
+ class... _BA,
+ __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind(_Gp&& __f, _BA&&... __bound_args)
+ : __f_(std::forward<_Gp>(__f)), __bound_args_(std::forward<_BA>(__bound_args)...) {}
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
+ operator()(_Args&&... __args) {
+ return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
+ operator()(_Args&&... __args) const {
+ return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
+ }
};
-template<class _Fp, class ..._BoundArgs>
+template <class _Fp, class... _BoundArgs>
struct is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
-template<class _Rp, class _Fp, class ..._BoundArgs>
-class __bind_r
- : public __bind<_Fp, _BoundArgs...>
-{
- typedef __bind<_Fp, _BoundArgs...> base;
- typedef typename base::_Fd _Fd;
- typedef typename base::_Td _Td;
+template <class _Rp, class _Fp, class... _BoundArgs>
+class __bind_r : public __bind<_Fp, _BoundArgs...> {
+ typedef __bind<_Fp, _BoundArgs...> base;
+ typedef typename base::_Fd _Fd;
+ typedef typename base::_Td _Td;
+
public:
- typedef _Rp result_type;
-
-
- template <class _Gp, class ..._BA,
- __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind_r>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
- : base(std::forward<_Gp>(__f),
- std::forward<_BA>(__bound_args)...) {}
-
- template <class ..._Args, __enable_if_t<is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
- result_type>::value || is_void<_Rp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- result_type
- operator()(_Args&& ...__args)
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(static_cast<base&>(*this), std::forward<_Args>(__args)...);
- }
-
- template <class ..._Args, __enable_if_t<is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
- result_type>::value || is_void<_Rp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- result_type
- operator()(_Args&& ...__args) const
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(static_cast<base const&>(*this), std::forward<_Args>(__args)...);
- }
+ typedef _Rp result_type;
+
+ template <
+ class _Gp,
+ class... _BA,
+ __enable_if_t<is_constructible<_Fd, _Gp>::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind_r>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind_r(_Gp&& __f, _BA&&... __bound_args)
+ : base(std::forward<_Gp>(__f), std::forward<_BA>(__bound_args)...) {}
+
+ template <
+ class... _Args,
+ __enable_if_t<is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type, result_type>::value ||
+ is_void<_Rp>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) {
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(static_cast<base&>(*this), std::forward<_Args>(__args)...);
+ }
+
+ template <class... _Args,
+ __enable_if_t<is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
+ result_type>::value ||
+ is_void<_Rp>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) const {
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(static_cast<base const&>(*this), std::forward<_Args>(__args)...);
+ }
};
-template<class _Rp, class _Fp, class ..._BoundArgs>
+template <class _Rp, class _Fp, class... _BoundArgs>
struct is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
-template<class _Fp, class ..._BoundArgs>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-__bind<_Fp, _BoundArgs...>
-bind(_Fp&& __f, _BoundArgs&&... __bound_args)
-{
- typedef __bind<_Fp, _BoundArgs...> type;
- return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
+template <class _Fp, class... _BoundArgs>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind<_Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
+ typedef __bind<_Fp, _BoundArgs...> type;
+ return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
}
-template<class _Rp, class _Fp, class ..._BoundArgs>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-__bind_r<_Rp, _Fp, _BoundArgs...>
-bind(_Fp&& __f, _BoundArgs&&... __bound_args)
-{
- typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
- return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
+template <class _Rp, class _Fp, class... _BoundArgs>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind_r<_Rp, _Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args) {
+ typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
+ return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...);
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__functional/bind_back.h b/contrib/llvm-project/libcxx/include/__functional/bind_back.h
index 5b5b40520933..ce26d3b70630 100644
--- a/contrib/llvm-project/libcxx/include/__functional/bind_back.h
+++ b/contrib/llvm-project/libcxx/include/__functional/bind_back.h
@@ -29,28 +29,38 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _NBound, class = make_index_sequence<_NBound>>
struct __bind_back_op;
-template <size_t _NBound, size_t ..._Ip>
+template <size_t _NBound, size_t... _Ip>
struct __bind_back_op<_NBound, index_sequence<_Ip...>> {
- template <class _Fn, class _BoundArgs, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
- noexcept(noexcept(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)..., std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)))
- -> decltype( std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)..., std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...))
- { return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)..., std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...); }
+ template <class _Fn, class _BoundArgs, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
+ noexcept(noexcept(std::invoke(std::forward<_Fn>(__f),
+ std::forward<_Args>(__args)...,
+ std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)))
+ -> decltype(std::invoke(std::forward<_Fn>(__f),
+ std::forward<_Args>(__args)...,
+ std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)) {
+ return std::invoke(std::forward<_Fn>(__f),
+ std::forward<_Args>(__args)...,
+ std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...);
+ }
};
template <class _Fn, class _BoundArgs>
struct __bind_back_t : __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs> {
- using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
+ using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
};
template <class _Fn, class... _Args>
requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
(is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto __bind_back(_Fn&& __f, _Args&&... __args)
- noexcept(noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))))
- -> decltype( __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...)))
- { return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...)); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto __bind_back(_Fn&& __f, _Args&&... __args) noexcept(
+ noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
+ std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))))
+ -> decltype(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
+ std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))) {
+ return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
+ std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...));
+}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/bind_front.h b/contrib/llvm-project/libcxx/include/__functional/bind_front.h
index d47624343876..30dda533615b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/bind_front.h
+++ b/contrib/llvm-project/libcxx/include/__functional/bind_front.h
@@ -29,25 +29,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
struct __bind_front_op {
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Args&& ...__args) const
- noexcept(noexcept(std::invoke(std::forward<_Args>(__args)...)))
- -> decltype( std::invoke(std::forward<_Args>(__args)...))
- { return std::invoke(std::forward<_Args>(__args)...); }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const
+ noexcept(noexcept(std::invoke(std::forward<_Args>(__args)...)))
+ -> decltype(std::invoke(std::forward<_Args>(__args)...)) {
+ return std::invoke(std::forward<_Args>(__args)...);
+ }
};
-template <class _Fn, class ..._BoundArgs>
+template <class _Fn, class... _BoundArgs>
struct __bind_front_t : __perfect_forward<__bind_front_op, _Fn, _BoundArgs...> {
- using __perfect_forward<__bind_front_op, _Fn, _BoundArgs...>::__perfect_forward;
+ using __perfect_forward<__bind_front_op, _Fn, _BoundArgs...>::__perfect_forward;
};
template <class _Fn, class... _Args>
requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
(is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto bind_front(_Fn&& __f, _Args&&... __args) {
- return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
+_LIBCPP_HIDE_FROM_ABI constexpr auto bind_front(_Fn&& __f, _Args&&... __args) {
+ return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/binder1st.h b/contrib/llvm-project/libcxx/include/__functional/binder1st.h
index 9f0dc08ba6b1..04b51fefab70 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binder1st.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binder1st.h
@@ -23,28 +23,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st
- : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type>
-{
+ : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> {
protected:
- _Operation op;
- typename _Operation::first_argument_type value;
+ _Operation op;
+ typename _Operation::first_argument_type value;
+
public:
- _LIBCPP_HIDE_FROM_ABI binder1st(const _Operation& __x,
- const typename _Operation::first_argument_type __y)
- : op(__x), value(__y) {}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- (typename _Operation::second_argument_type& __x) const
- {return op(value, __x);}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- (const typename _Operation::second_argument_type& __x) const
- {return op(value, __x);}
+ _LIBCPP_HIDE_FROM_ABI binder1st(const _Operation& __x, const typename _Operation::first_argument_type __y)
+ : op(__x), value(__y) {}
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(typename _Operation::second_argument_type& __x) const {
+ return op(value, __x);
+ }
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(const typename _Operation::second_argument_type& __x) const {
+ return op(value, __x);
+ }
};
template <class _Operation, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-binder1st<_Operation>
-bind1st(const _Operation& __op, const _Tp& __x)
- {return binder1st<_Operation>(__op, __x);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI binder1st<_Operation>
+bind1st(const _Operation& __op, const _Tp& __x) {
+ return binder1st<_Operation>(__op, __x);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/binder2nd.h b/contrib/llvm-project/libcxx/include/__functional/binder2nd.h
index cf80a55bc6a3..9d22e4430b1b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/binder2nd.h
+++ b/contrib/llvm-project/libcxx/include/__functional/binder2nd.h
@@ -23,28 +23,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Operation>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
- : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type>
-{
+ : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> {
protected:
- _Operation op;
- typename _Operation::second_argument_type value;
+ _Operation op;
+ typename _Operation::second_argument_type value;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- binder2nd(const _Operation& __x, const typename _Operation::second_argument_type __y)
- : op(__x), value(__y) {}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- ( typename _Operation::first_argument_type& __x) const
- {return op(__x, value);}
- _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type operator()
- (const typename _Operation::first_argument_type& __x) const
- {return op(__x, value);}
+ _LIBCPP_HIDE_FROM_ABI binder2nd(const _Operation& __x, const typename _Operation::second_argument_type __y)
+ : op(__x), value(__y) {}
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(typename _Operation::first_argument_type& __x) const {
+ return op(__x, value);
+ }
+ _LIBCPP_HIDE_FROM_ABI typename _Operation::result_type
+ operator()(const typename _Operation::first_argument_type& __x) const {
+ return op(__x, value);
+ }
};
template <class _Operation, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-binder2nd<_Operation>
-bind2nd(const _Operation& __op, const _Tp& __x)
- {return binder2nd<_Operation>(__op, __x);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI binder2nd<_Operation>
+bind2nd(const _Operation& __op, const _Tp& __x) {
+ return binder2nd<_Operation>(__op, __x);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h b/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h
index 0165e062810f..648b60c50521 100644
--- a/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h
+++ b/contrib/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h
@@ -29,39 +29,29 @@
#if _LIBCPP_STD_VER >= 17
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key,
- class _Value,
- class _Hash,
- class _BinaryPredicate,
- bool /*useArray*/>
+template <class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/>
class _BMSkipTable;
// General case for BM data searching; use a map
-template <class _Key,
- class _Value,
- class _Hash,
- class _BinaryPredicate>
+template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
private:
using value_type = _Value;
- using key_type = _Key;
+ using key_type = _Key;
const value_type __default_value_;
unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit _BMSkipTable(size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
- : __default_value_(__default_value),
- __table_(__sz, __hash, __pred) {}
+ _LIBCPP_HIDE_FROM_ABI explicit _BMSkipTable(
+ size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
+ : __default_value_(__default_value), __table_(__sz, __hash, __pred) {}
- _LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) {
- __table_[__key] = __val;
- }
+ _LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) { __table_[__key] = __val; }
_LIBCPP_HIDE_FROM_ABI value_type operator[](const key_type& __key) const {
auto __it = __table_.find(__key);
@@ -70,14 +60,11 @@ public:
};
// Special case small numeric values; use an array
-template <class _Key,
- class _Value,
- class _Hash,
- class _BinaryPredicate>
+template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
private:
using value_type = _Value;
- using key_type = _Key;
+ using key_type = _Key;
using unsigned_key_type = make_unsigned_t<key_type>;
std::array<value_type, 256> __table_;
@@ -98,34 +85,33 @@ public:
};
template <class _RandomAccessIterator1,
- class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
class _LIBCPP_TEMPLATE_VIS boyer_moore_searcher {
private:
using difference_type = typename std::iterator_traits<_RandomAccessIterator1>::difference_type;
- using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
- using __skip_table_type = _BMSkipTable<value_type,
- difference_type,
- _Hash,
- _BinaryPredicate,
- is_integral_v<value_type>
- && sizeof(value_type) == 1
- && is_same_v<_Hash, hash<value_type>>
- && is_same_v<_BinaryPredicate, equal_to<>>>;
+ using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
+ using __skip_table_type =
+ _BMSkipTable<value_type,
+ difference_type,
+ _Hash,
+ _BinaryPredicate,
+ is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
+ is_same_v<_BinaryPredicate, equal_to<>>>;
public:
- _LIBCPP_HIDE_FROM_ABI
- boyer_moore_searcher(_RandomAccessIterator1 __first,
- _RandomAccessIterator1 __last,
- _Hash __hash = _Hash(),
- _BinaryPredicate __pred = _BinaryPredicate())
- : __first_(__first),
- __last_(__last),
- __pred_(__pred),
- __pattern_length_(__last - __first),
- __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
- __suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
- allocator<difference_type>(), __pattern_length_ + 1)) {
+ _LIBCPP_HIDE_FROM_ABI boyer_moore_searcher(
+ _RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _Hash __hash = _Hash(),
+ _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__first),
+ __last_(__last),
+ __pred_(__pred),
+ __pattern_length_(__last - __first),
+ __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
+ __suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
+ allocator<difference_type>(), __pattern_length_ + 1)) {
difference_type __i = 0;
while (__first != __last) {
__skip_table_->insert(*__first, __i);
@@ -162,8 +148,8 @@ private:
template <class _RandomAccessIterator2>
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
__search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
- _RandomAccessIterator2 __current = __f;
- const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ _RandomAccessIterator2 __current = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
const __skip_table_type& __skip_table = *__skip_table_;
while (__current <= __last) {
@@ -190,7 +176,7 @@ private:
const size_t __count = __last - __first;
__prefix[0] = 0;
- size_t __k = 0;
+ size_t __k = 0;
for (size_t __i = 1; __i != __count; ++__i) {
while (__k > 0 && !__pred(__first[__k], __first[__i]))
@@ -219,7 +205,7 @@ private:
__compute_bm_prefix(_ReverseIter(__last), _ReverseIter(__first), __pred, __scratch);
for (size_t __i = 0; __i != __count; ++__i) {
- const size_t __j = __count - __scratch[__i];
+ const size_t __j = __count - __scratch[__i];
const difference_type __k = __i - __scratch[__i] + 1;
if (__suffix_[__j] > __k)
@@ -230,31 +216,31 @@ private:
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(boyer_moore_searcher);
template <class _RandomAccessIterator1,
- class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
class _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher {
private:
using difference_type = typename iterator_traits<_RandomAccessIterator1>::difference_type;
- using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
- using __skip_table_type = _BMSkipTable<value_type,
- difference_type,
- _Hash,
- _BinaryPredicate,
- is_integral_v<value_type>
- && sizeof(value_type) == 1
- && is_same_v<_Hash, hash<value_type>>
- && is_same_v<_BinaryPredicate, equal_to<>>>;
+ using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
+ using __skip_table_type =
+ _BMSkipTable<value_type,
+ difference_type,
+ _Hash,
+ _BinaryPredicate,
+ is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
+ is_same_v<_BinaryPredicate, equal_to<>>>;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- boyer_moore_horspool_searcher(_RandomAccessIterator1 __first,
- _RandomAccessIterator1 __last,
- _Hash __hash = _Hash(),
- _BinaryPredicate __pred = _BinaryPredicate())
- : __first_(__first),
- __last_(__last),
- __pred_(__pred),
- __pattern_length_(__last - __first),
- __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
+ _LIBCPP_HIDE_FROM_ABI boyer_moore_horspool_searcher(
+ _RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _Hash __hash = _Hash(),
+ _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__first),
+ __last_(__last),
+ __pred_(__pred),
+ __pattern_length_(__last - __first),
+ __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
if (__first == __last)
return;
--__last;
@@ -293,8 +279,8 @@ private:
template <class _RandomAccessIterator2>
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
__search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
- _RandomAccessIterator2 __current = __f;
- const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ _RandomAccessIterator2 __current = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
const __skip_table_type& __skip_table = *__skip_table_;
while (__current <= __last) {
diff --git a/contrib/llvm-project/libcxx/include/__functional/compose.h b/contrib/llvm-project/libcxx/include/__functional/compose.h
index af207e7cbafb..4b86dd37cd48 100644
--- a/contrib/llvm-project/libcxx/include/__functional/compose.h
+++ b/contrib/llvm-project/libcxx/include/__functional/compose.h
@@ -25,25 +25,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
struct __compose_op {
- template<class _Fn1, class _Fn2, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const
- noexcept(noexcept(std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))))
- -> decltype( std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...)))
- { return std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...)); }
+ template <class _Fn1, class _Fn2, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const noexcept(noexcept(
+ std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))))
+ -> decltype(std::invoke(std::forward<_Fn1>(__f1),
+ std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))) {
+ return std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...));
+ }
};
template <class _Fn1, class _Fn2>
struct __compose_t : __perfect_forward<__compose_op, _Fn1, _Fn2> {
- using __perfect_forward<__compose_op, _Fn1, _Fn2>::__perfect_forward;
+ using __perfect_forward<__compose_op, _Fn1, _Fn2>::__perfect_forward;
};
template <class _Fn1, class _Fn2>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2)
- noexcept(noexcept(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))))
- -> decltype( __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2)))
- { return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2)); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) noexcept(
+ noexcept(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))))
+ -> decltype(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))) {
+ return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2));
+}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/default_searcher.h b/contrib/llvm-project/libcxx/include/__functional/default_searcher.h
index 21b6de9c34c8..db89d10757c1 100644
--- a/contrib/llvm-project/libcxx/include/__functional/default_searcher.h
+++ b/contrib/llvm-project/libcxx/include/__functional/default_searcher.h
@@ -26,27 +26,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
// default searcher
-template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
+template <class _ForwardIterator, class _BinaryPredicate = equal_to<>>
class _LIBCPP_TEMPLATE_VIS default_searcher {
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- default_searcher(_ForwardIterator __f, _ForwardIterator __l,
- _BinaryPredicate __p = _BinaryPredicate())
- : __first_(__f), __last_(__l), __pred_(__p) {}
-
- template <typename _ForwardIterator2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair<_ForwardIterator2, _ForwardIterator2>
- operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
- {
- auto __proj = __identity();
- return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate())
+ : __first_(__f), __last_(__l), __pred_(__p) {}
+
+ template <typename _ForwardIterator2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2>
+ operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const {
+ auto __proj = __identity();
+ return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
+ }
private:
- _ForwardIterator __first_;
- _ForwardIterator __last_;
- _BinaryPredicate __pred_;
+ _ForwardIterator __first_;
+ _ForwardIterator __last_;
+ _BinaryPredicate __pred_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher);
diff --git a/contrib/llvm-project/libcxx/include/__functional/function.h b/contrib/llvm-project/libcxx/include/__functional/function.h
index 7cc4cccc26cd..6505bb587173 100644
--- a/contrib/llvm-project/libcxx/include/__functional/function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/function.h
@@ -53,86 +53,77 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
-class _LIBCPP_EXPORTED_FROM_ABI bad_function_call
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_function_call : public exception {
public:
- _LIBCPP_HIDE_FROM_ABI bad_function_call() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_function_call(const bad_function_call&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_function_call& operator=(const bad_function_call&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_function_call() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_function_call(const bad_function_call&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_function_call& operator=(const bad_function_call&) _NOEXCEPT = default;
// Note that when a key function is not used, every translation unit that uses
// bad_function_call will end up containing a weak definition of the vtable and
// typeinfo.
-#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
- ~bad_function_call() _NOEXCEPT override;
-#else
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~bad_function_call() _NOEXCEPT override {}
-#endif
-
-#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
- const char* what() const _NOEXCEPT override;
-#endif
+# ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+ ~bad_function_call() _NOEXCEPT override;
+# else
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~bad_function_call() _NOEXCEPT override {}
+# endif
+
+# ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
+ const char* what() const _NOEXCEPT override;
+# endif
};
_LIBCPP_DIAGNOSTIC_POP
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_function_call()
-{
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_function_call();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_function_call();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode");
+# endif
}
-template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined
+template <class _Fp>
+class _LIBCPP_TEMPLATE_VIS function; // undefined
-namespace __function
-{
+namespace __function {
-template<class _Rp>
-struct __maybe_derive_from_unary_function
-{
-};
+template <class _Rp>
+struct __maybe_derive_from_unary_function {};
-template<class _Rp, class _A1>
-struct __maybe_derive_from_unary_function<_Rp(_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+template <class _Rp, class _A1>
+struct __maybe_derive_from_unary_function<_Rp(_A1)> : public __unary_function<_A1, _Rp> {};
-template<class _Rp>
-struct __maybe_derive_from_binary_function
-{
-};
+template <class _Rp>
+struct __maybe_derive_from_binary_function {};
-template<class _Rp, class _A1, class _A2>
-struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+template <class _Rp, class _A1, class _A2>
+struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Fp const&) { return true; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp const&) {
+ return true;
+}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Fp* __ptr) { return __ptr; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp* __ptr) {
+ return __ptr;
+}
template <class _Ret, class _Class>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Ret _Class::*__ptr) { return __ptr; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Ret _Class::*__ptr) {
+ return __ptr;
+}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(function<_Fp> const& __f) { return !!__f; }
+_LIBCPP_HIDE_FROM_ABI bool __not_null(function<_Fp> const& __f) {
+ return !!__f;
+}
-#ifdef _LIBCPP_HAS_EXTENSION_BLOCKS
-template <class _Rp, class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-bool __not_null(_Rp (^__p)(_Args...)) { return __p; }
-#endif
+# ifdef _LIBCPP_HAS_EXTENSION_BLOCKS
+template <class _Rp, class... _Args>
+_LIBCPP_HIDE_FROM_ABI bool __not_null(_Rp (^__p)(_Args...)) {
+ return __p;
+}
+# endif
} // namespace __function
@@ -140,84 +131,60 @@ namespace __function {
// __alloc_func holds a functor and an allocator.
-template <class _Fp, class _Ap, class _FB> class __alloc_func;
+template <class _Fp, class _Ap, class _FB>
+class __alloc_func;
template <class _Fp, class _FB>
class __default_alloc_func;
template <class _Fp, class _Ap, class _Rp, class... _ArgTypes>
-class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
-{
- __compressed_pair<_Fp, _Ap> __f_;
-
- public:
- typedef _LIBCPP_NODEBUG _Fp _Target;
- typedef _LIBCPP_NODEBUG _Ap _Alloc;
-
- _LIBCPP_HIDE_FROM_ABI
- const _Target& __target() const { return __f_.first(); }
-
- // WIN32 APIs may define __allocator, so use __get_allocator instead.
- _LIBCPP_HIDE_FROM_ABI
- const _Alloc& __get_allocator() const { return __f_.second(); }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(_Target&& __f)
- : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)),
- std::forward_as_tuple())
- {
- }
+class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> {
+ __compressed_pair<_Fp, _Ap> __f_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(const _Target& __f, const _Alloc& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(__f),
- std::forward_as_tuple(__a))
- {
- }
+public:
+ typedef _LIBCPP_NODEBUG _Fp _Target;
+ typedef _LIBCPP_NODEBUG _Ap _Alloc;
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(const _Target& __f, _Alloc&& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(__f),
- std::forward_as_tuple(std::move(__a)))
- {
- }
+ _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_.first(); }
- _LIBCPP_HIDE_FROM_ABI
- explicit __alloc_func(_Target&& __f, _Alloc&& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)),
- std::forward_as_tuple(std::move(__a)))
- {
- }
+ // WIN32 APIs may define __allocator, so use __get_allocator instead.
+ _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator() const { return __f_.second(); }
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __arg)
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_.first(),
- std::forward<_ArgTypes>(__arg)...);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f)
+ : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple()) {}
- _LIBCPP_HIDE_FROM_ABI
- __alloc_func* __clone() const
- {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA;
- _AA __a(__f_.second());
- typedef __allocator_destructor<_AA> _Dp;
- unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a));
- return __hold.release();
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, const _Alloc& __a)
+ : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, _Alloc&& __a)
+ : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(std::move(__a))) {}
- _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __alloc_func> _FunAlloc;
- _FunAlloc __a(__f->__get_allocator());
- __f->destroy();
- __a.deallocate(__f, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f, _Alloc&& __a)
+ : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple(std::move(__a))) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) {
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(__f_.first(), std::forward<_ArgTypes>(__arg)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __alloc_func* __clone() const {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA;
+ _AA __a(__f_.second());
+ typedef __allocator_destructor<_AA> _Dp;
+ unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a));
+ return __hold.release();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
+
+ _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __alloc_func> _FunAlloc;
+ _FunAlloc __a(__f->__get_allocator());
+ __f->destroy();
+ __a.deallocate(__f, 1);
+ }
};
template <class _Fp, class _Rp, class... _ArgTypes>
@@ -227,454 +194,377 @@ class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
public:
typedef _LIBCPP_NODEBUG _Fp _Target;
- _LIBCPP_HIDE_FROM_ABI
- const _Target& __target() const { return __f_; }
+ _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_; }
- _LIBCPP_HIDE_FROM_ABI
- explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __arg) {
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) {
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
return _Invoker::__call(__f_, std::forward<_ArgTypes>(__arg)...);
}
- _LIBCPP_HIDE_FROM_ABI
- __default_alloc_func* __clone() const {
- __builtin_new_allocator::__holder_t __hold =
- __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
- __default_alloc_func* __res =
- ::new ((void*)__hold.get()) __default_alloc_func(__f_);
+ _LIBCPP_HIDE_FROM_ABI __default_alloc_func* __clone() const {
+ __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
+ __default_alloc_func* __res = ::new ((void*)__hold.get()) __default_alloc_func(__f_);
(void)__hold.release();
return __res;
}
- _LIBCPP_HIDE_FROM_ABI
- void destroy() _NOEXCEPT { __f_.~_Target(); }
+ _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~_Target(); }
_LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__default_alloc_func* __f) {
__f->destroy();
- __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
+ __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
}
};
// __base provides an abstract interface for copyable functors.
-template<class _Fp> class _LIBCPP_TEMPLATE_VIS __base;
+template <class _Fp>
+class _LIBCPP_TEMPLATE_VIS __base;
+
+template <class _Rp, class... _ArgTypes>
+class __base<_Rp(_ArgTypes...)> {
+ __base(const __base&);
+ __base& operator=(const __base&);
-template<class _Rp, class ..._ArgTypes>
-class __base<_Rp(_ArgTypes...)>
-{
- __base(const __base&);
- __base& operator=(const __base&);
public:
- _LIBCPP_HIDE_FROM_ABI __base() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
- virtual __base* __clone() const = 0;
- virtual void __clone(__base*) const = 0;
- virtual void destroy() _NOEXCEPT = 0;
- virtual void destroy_deallocate() _NOEXCEPT = 0;
- virtual _Rp operator()(_ArgTypes&& ...) = 0;
-#ifndef _LIBCPP_HAS_NO_RTTI
- virtual const void* target(const type_info&) const _NOEXCEPT = 0;
- virtual const std::type_info& target_type() const _NOEXCEPT = 0;
-#endif // _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI __base() {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
+ virtual __base* __clone() const = 0;
+ virtual void __clone(__base*) const = 0;
+ virtual void destroy() _NOEXCEPT = 0;
+ virtual void destroy_deallocate() _NOEXCEPT = 0;
+ virtual _Rp operator()(_ArgTypes&&...) = 0;
+# ifndef _LIBCPP_HAS_NO_RTTI
+ virtual const void* target(const type_info&) const _NOEXCEPT = 0;
+ virtual const std::type_info& target_type() const _NOEXCEPT = 0;
+# endif // _LIBCPP_HAS_NO_RTTI
};
// __func implements __base for a given functor type.
-template<class _FD, class _Alloc, class _FB> class __func;
+template <class _FD, class _Alloc, class _FB>
+class __func;
+
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+class __func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
+ __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> __f_;
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-class __func<_Fp, _Alloc, _Rp(_ArgTypes...)>
- : public __base<_Rp(_ArgTypes...)>
-{
- __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> __f_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(_Fp&& __f)
- : __f_(std::move(__f)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(const _Fp& __f, const _Alloc& __a)
- : __f_(__f, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(const _Fp& __f, _Alloc&& __a)
- : __f_(__f, std::move(__a)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(_Fp&& __f, _Alloc&& __a)
- : __f_(std::move(__f), std::move(__a)) {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg);
-#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(const type_info&) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI explicit __func(_Fp&& __f) : __f_(std::move(__f)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit __func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit __func(const _Fp& __f, _Alloc&& __a) : __f_(__f, std::move(__a)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit __func(_Fp&& __f, _Alloc&& __a) : __f_(std::move(__f), std::move(__a)) {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg);
+# ifndef _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(const type_info&) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT;
+# endif // _LIBCPP_HAS_NO_RTTI
};
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-__base<_Rp(_ArgTypes...)>*
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.__get_allocator());
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));
- return __hold.release();
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+__base<_Rp(_ArgTypes...)>* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __func> _Ap;
+ _Ap __a(__f_.__get_allocator());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));
+ return __hold.release();
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
-{
- ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator());
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const {
+ ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator());
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT
-{
- __f_.destroy();
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT {
+ __f_.destroy();
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.__get_allocator());
- __f_.destroy();
- __a.deallocate(this, 1);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, __func> _Ap;
+ _Ap __a(__f_.__get_allocator());
+ __f_.destroy();
+ __a.deallocate(this, 1);
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-_Rp
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
-{
- return __f_(std::forward<_ArgTypes>(__arg)...);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+_Rp __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&&... __arg) {
+ return __f_(std::forward<_ArgTypes>(__arg)...);
}
-#ifndef _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-const void*
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT
-{
- if (__ti == typeid(_Fp))
- return std::addressof(__f_.__target());
- return nullptr;
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+const void* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT {
+ if (__ti == typeid(_Fp))
+ return std::addressof(__f_.__target());
+ return nullptr;
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-const std::type_info&
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
-{
- return typeid(_Fp);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+const std::type_info& __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT {
+ return typeid(_Fp);
}
-#endif // _LIBCPP_HAS_NO_RTTI
+# endif // _LIBCPP_HAS_NO_RTTI
// __value_func creates a value-type from a __func.
-template <class _Fp> class __value_func;
+template <class _Fp>
+class __value_func;
-template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
-{
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<3 * sizeof(void*)>::type __buf_;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
+template <class _Rp, class... _ArgTypes>
+class __value_func<_Rp(_ArgTypes...)> {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<3 * sizeof(void*)>::type __buf_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
- typedef __base<_Rp(_ArgTypes...)> __func;
- __func* __f_;
+ typedef __base<_Rp(_ArgTypes...)> __func;
+ __func* __f_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI static __func* __as_base(void* __p)
- {
- return reinterpret_cast<__func*>(__p);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI static __func* __as_base(void* __p) { return reinterpret_cast<__func*>(__p); }
- public:
- _LIBCPP_HIDE_FROM_ABI
- __value_func() _NOEXCEPT : __f_(nullptr) {}
-
- template <class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __value_func(_Fp&& __f, const _Alloc& __a)
- : __f_(nullptr)
- {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
- typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
-
- if (__function::__not_null(__f))
- {
- _FunAlloc __af(__a);
- if (sizeof(_Fun) <= sizeof(__buf_) &&
- is_nothrow_copy_constructible<_Fp>::value &&
- is_nothrow_copy_constructible<_FunAlloc>::value)
- {
- __f_ =
- ::new ((void*)&__buf_) _Fun(std::move(__f), _Alloc(__af));
- }
- else
- {
- typedef __allocator_destructor<_FunAlloc> _Dp;
- unique_ptr<__func, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
- ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__a));
- __f_ = __hold.release();
- }
- }
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI __value_func() _NOEXCEPT : __f_(nullptr) {}
- template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __value_func>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit __value_func(_Fp&& __f)
- : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __value_func(const __value_func& __f)
- {
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI __value_func(_Fp&& __f, const _Alloc& __a) : __f_(nullptr) {
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
+ typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
+
+ if (__function::__not_null(__f)) {
+ _FunAlloc __af(__a);
+ if (sizeof(_Fun) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value &&
+ is_nothrow_copy_constructible<_FunAlloc>::value) {
+ __f_ = ::new ((void*)&__buf_) _Fun(std::move(__f), _Alloc(__af));
+ } else {
+ typedef __allocator_destructor<_FunAlloc> _Dp;
+ unique_ptr<__func, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
+ ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__a));
+ __f_ = __hold.release();
+ }
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __value_func(__value_func&& __f) _NOEXCEPT
- {
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- }
+ template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __value_func>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __value_func(_Fp&& __f) : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
+
+ _LIBCPP_HIDE_FROM_ABI __value_func(const __value_func& __f) {
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f_ = __as_base(&__buf_);
+ __f.__f_->__clone(__f_);
+ } else
+ __f_ = __f.__f_->__clone();
+ }
- _LIBCPP_HIDE_FROM_ABI
- ~__value_func()
- {
- if ((void*)__f_ == &__buf_)
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
+ _LIBCPP_HIDE_FROM_ABI __value_func(__value_func&& __f) _NOEXCEPT {
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f_ = __as_base(&__buf_);
+ __f.__f_->__clone(__f_);
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __value_func& operator=(__value_func&& __f)
- {
- *this = nullptr;
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ~__value_func() {
+ if ((void*)__f_ == &__buf_)
+ __f_->destroy();
+ else if (__f_)
+ __f_->destroy_deallocate();
+ }
- _LIBCPP_HIDE_FROM_ABI
- __value_func& operator=(nullptr_t)
- {
- __func* __f = __f_;
- __f_ = nullptr;
- if ((void*)__f == &__buf_)
- __f->destroy();
- else if (__f)
- __f->destroy_deallocate();
- return *this;
+ _LIBCPP_HIDE_FROM_ABI __value_func& operator=(__value_func&& __f) {
+ *this = nullptr;
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f_ = __as_base(&__buf_);
+ __f.__f_->__clone(__f_);
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __args) const
- {
- if (__f_ == nullptr)
- __throw_bad_function_call();
- return (*__f_)(std::forward<_ArgTypes>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI __value_func& operator=(nullptr_t) {
+ __func* __f = __f_;
+ __f_ = nullptr;
+ if ((void*)__f == &__buf_)
+ __f->destroy();
+ else if (__f)
+ __f->destroy_deallocate();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(__value_func& __f) _NOEXCEPT
- {
- if (&__f == this)
- return;
- if ((void*)__f_ == &__buf_ && (void*)__f.__f_ == &__f.__buf_)
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __func* __t = __as_base(&__tempbuf);
- __f_->__clone(__t);
- __f_->destroy();
- __f_ = nullptr;
- __f.__f_->__clone(__as_base(&__buf_));
- __f.__f_->destroy();
- __f.__f_ = nullptr;
- __f_ = __as_base(&__buf_);
- __t->__clone(__as_base(&__f.__buf_));
- __t->destroy();
- __f.__f_ = __as_base(&__f.__buf_);
- }
- else if ((void*)__f_ == &__buf_)
- {
- __f_->__clone(__as_base(&__f.__buf_));
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = __as_base(&__f.__buf_);
- }
- else if ((void*)__f.__f_ == &__f.__buf_)
- {
- __f.__f_->__clone(__as_base(&__buf_));
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = __as_base(&__buf_);
- }
- else
- std::swap(__f_, __f.__f_);
- }
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
+ if (__f_ == nullptr)
+ __throw_bad_function_call();
+ return (*__f_)(std::forward<_ArgTypes>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT { return __f_ != nullptr; }
+ _LIBCPP_HIDE_FROM_ABI void swap(__value_func& __f) _NOEXCEPT {
+ if (&__f == this)
+ return;
+ if ((void*)__f_ == &__buf_ && (void*)__f.__f_ == &__f.__buf_) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __func* __t = __as_base(&__tempbuf);
+ __f_->__clone(__t);
+ __f_->destroy();
+ __f_ = nullptr;
+ __f.__f_->__clone(__as_base(&__buf_));
+ __f.__f_->destroy();
+ __f.__f_ = nullptr;
+ __f_ = __as_base(&__buf_);
+ __t->__clone(__as_base(&__f.__buf_));
+ __t->destroy();
+ __f.__f_ = __as_base(&__f.__buf_);
+ } else if ((void*)__f_ == &__buf_) {
+ __f_->__clone(__as_base(&__f.__buf_));
+ __f_->destroy();
+ __f_ = __f.__f_;
+ __f.__f_ = __as_base(&__f.__buf_);
+ } else if ((void*)__f.__f_ == &__f.__buf_) {
+ __f.__f_->__clone(__as_base(&__buf_));
+ __f.__f_->destroy();
+ __f.__f_ = __f_;
+ __f_ = __as_base(&__buf_);
+ } else
+ std::swap(__f_, __f.__f_);
+ }
-#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI
- const std::type_info& target_type() const _NOEXCEPT
- {
- if (__f_ == nullptr)
- return typeid(void);
- return __f_->target_type();
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __f_ != nullptr; }
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT
- {
- if (__f_ == nullptr)
- return nullptr;
- return (const _Tp*)__f_->target(typeid(_Tp));
- }
-#endif // _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT {
+ if (__f_ == nullptr)
+ return typeid(void);
+ return __f_->target_type();
+ }
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT {
+ if (__f_ == nullptr)
+ return nullptr;
+ return (const _Tp*)__f_->target(typeid(_Tp));
+ }
+# endif // _LIBCPP_HAS_NO_RTTI
};
// Storage for a functor object, to be used with __policy to manage copy and
// destruction.
-union __policy_storage
-{
- mutable char __small[sizeof(void*) * 2];
- void* __large;
+union __policy_storage {
+ mutable char __small[sizeof(void*) * 2];
+ void* __large;
};
// True if _Fun can safely be held in __policy_storage.__small.
template <typename _Fun>
struct __use_small_storage
: public integral_constant<
- bool, sizeof(_Fun) <= sizeof(__policy_storage) &&
- _LIBCPP_ALIGNOF(_Fun) <= _LIBCPP_ALIGNOF(__policy_storage) &&
- is_trivially_copy_constructible<_Fun>::value &&
- is_trivially_destructible<_Fun>::value> {};
+ bool,
+ sizeof(_Fun) <= sizeof(__policy_storage)&& _LIBCPP_ALIGNOF(_Fun) <= _LIBCPP_ALIGNOF(__policy_storage) &&
+ is_trivially_copy_constructible<_Fun>::value && is_trivially_destructible<_Fun>::value> {};
// Policy contains information about how to copy, destroy, and move the
// underlying functor. You can think of it as a vtable of sorts.
-struct __policy
-{
- // Used to copy or destroy __large values. null for trivial objects.
- void* (*const __clone)(const void*);
- void (*const __destroy)(void*);
-
- // True if this is the null policy (no value).
- const bool __is_null;
-
- // The target type. May be null if RTTI is disabled.
- const std::type_info* const __type_info;
-
- // Returns a pointer to a static policy object suitable for the functor
- // type.
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy* __create()
- {
- return __choose_policy<_Fun>(__use_small_storage<_Fun>());
- }
+struct __policy {
+ // Used to copy or destroy __large values. null for trivial objects.
+ void* (*const __clone)(const void*);
+ void (*const __destroy)(void*);
+
+ // True if this is the null policy (no value).
+ const bool __is_null;
+
+ // The target type. May be null if RTTI is disabled.
+ const std::type_info* const __type_info;
+
+ // Returns a pointer to a static policy object suitable for the functor
+ // type.
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __create() {
+ return __choose_policy<_Fun>(__use_small_storage<_Fun>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- static const __policy* __create_empty()
- {
- static const _LIBCPP_CONSTEXPR __policy __policy = {nullptr, nullptr,
- true,
-#ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(void)
-#else
- nullptr
-#endif
- };
- return &__policy;
- }
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __create_empty() {
+ static const _LIBCPP_CONSTEXPR __policy __policy = {
+ nullptr,
+ nullptr,
+ true,
+# ifndef _LIBCPP_HAS_NO_RTTI
+ &typeid(void)
+# else
+ nullptr
+# endif
+ };
+ return &__policy;
+ }
- private:
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static void* __large_clone(const void* __s)
- {
- const _Fun* __f = static_cast<const _Fun*>(__s);
- return __f->__clone();
- }
+private:
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static void* __large_clone(const void* __s) {
+ const _Fun* __f = static_cast<const _Fun*>(__s);
+ return __f->__clone();
+ }
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static void __large_destroy(void* __s) {
- _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
- }
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static void __large_destroy(void* __s) {
+ _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
+ }
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy*
- __choose_policy(/* is_small = */ false_type) {
- static const _LIBCPP_CONSTEXPR __policy __policy = {
- &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
-#ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(typename _Fun::_Target)
-#else
- nullptr
-#endif
- };
- return &__policy;
- }
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ false_type) {
+ static const _LIBCPP_CONSTEXPR __policy __policy = {
+ &__large_clone<_Fun>,
+ &__large_destroy<_Fun>,
+ false,
+# ifndef _LIBCPP_HAS_NO_RTTI
+ &typeid(typename _Fun::_Target)
+# else
+ nullptr
+# endif
+ };
+ return &__policy;
+ }
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy*
- __choose_policy(/* is_small = */ true_type)
- {
- static const _LIBCPP_CONSTEXPR __policy __policy = {
- nullptr, nullptr, false,
-#ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(typename _Fun::_Target)
-#else
- nullptr
-#endif
- };
- return &__policy;
- }
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ true_type) {
+ static const _LIBCPP_CONSTEXPR __policy __policy = {
+ nullptr,
+ nullptr,
+ false,
+# ifndef _LIBCPP_HAS_NO_RTTI
+ &typeid(typename _Fun::_Target)
+# else
+ nullptr
+# endif
+ };
+ return &__policy;
+ }
};
// Used to choose between perfect forwarding or pass-by-value. Pass-by-value is
@@ -684,548 +574,459 @@ using __fast_forward = __conditional_t<is_scalar<_Tp>::value, _Tp, _Tp&&>;
// __policy_invoker calls an instance of __alloc_func held in __policy_storage.
-template <class _Fp> struct __policy_invoker;
+template <class _Fp>
+struct __policy_invoker;
template <class _Rp, class... _ArgTypes>
-struct __policy_invoker<_Rp(_ArgTypes...)>
-{
- typedef _Rp (*__Call)(const __policy_storage*,
- __fast_forward<_ArgTypes>...);
-
- __Call __call_;
-
- // Creates an invoker that throws bad_function_call.
- _LIBCPP_HIDE_FROM_ABI
- __policy_invoker() : __call_(&__call_empty) {}
-
- // Creates an invoker that calls the given instance of __func.
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static __policy_invoker __create()
- {
- return __policy_invoker(&__call_impl<_Fun>);
- }
+struct __policy_invoker<_Rp(_ArgTypes...)> {
+ typedef _Rp (*__Call)(const __policy_storage*, __fast_forward<_ArgTypes>...);
- private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __policy_invoker(__Call __c) : __call_(__c) {}
+ __Call __call_;
- _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*,
- __fast_forward<_ArgTypes>...)
- {
- __throw_bad_function_call();
- }
+ // Creates an invoker that throws bad_function_call.
+ _LIBCPP_HIDE_FROM_ABI __policy_invoker() : __call_(&__call_empty) {}
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static _Rp __call_impl(const __policy_storage* __buf,
- __fast_forward<_ArgTypes>... __args)
- {
- _Fun* __f = reinterpret_cast<_Fun*>(__use_small_storage<_Fun>::value
- ? &__buf->__small
- : __buf->__large);
- return (*__f)(std::forward<_ArgTypes>(__args)...);
- }
+ // Creates an invoker that calls the given instance of __func.
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static __policy_invoker __create() {
+ return __policy_invoker(&__call_impl<_Fun>);
+ }
+
+private:
+ _LIBCPP_HIDE_FROM_ABI explicit __policy_invoker(__Call __c) : __call_(__c) {}
+
+ _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) {
+ __throw_bad_function_call();
+ }
+
+ template <typename _Fun>
+ _LIBCPP_HIDE_FROM_ABI static _Rp __call_impl(const __policy_storage* __buf, __fast_forward<_ArgTypes>... __args) {
+ _Fun* __f = reinterpret_cast<_Fun*>(__use_small_storage<_Fun>::value ? &__buf->__small : __buf->__large);
+ return (*__f)(std::forward<_ArgTypes>(__args)...);
+ }
};
// __policy_func uses a __policy and __policy_invoker to create a type-erased,
// copyable functor.
-template <class _Fp> class __policy_func;
-
-template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
-{
- // Inline storage for small objects.
- __policy_storage __buf_;
-
- // Calls the value stored in __buf_. This could technically be part of
- // policy, but storing it here eliminates a level of indirection inside
- // operator().
- typedef __function::__policy_invoker<_Rp(_ArgTypes...)> __invoker;
- __invoker __invoker_;
-
- // The policy that describes how to move / copy / destroy __buf_. Never
- // null, even if the function is empty.
- const __policy* __policy_;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __policy_func() : __policy_(__policy::__create_empty()) {}
-
- template <class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __policy_func(_Fp&& __f, const _Alloc& __a)
- : __policy_(__policy::__create_empty())
- {
- typedef __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
-
- if (__function::__not_null(__f))
- {
- __invoker_ = __invoker::template __create<_Fun>();
- __policy_ = __policy::__create<_Fun>();
-
- _FunAlloc __af(__a);
- if (__use_small_storage<_Fun>())
- {
- ::new ((void*)&__buf_.__small)
- _Fun(std::move(__f), _Alloc(__af));
- }
- else
- {
- typedef __allocator_destructor<_FunAlloc> _Dp;
- unique_ptr<_Fun, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
- ::new ((void*)__hold.get())
- _Fun(std::move(__f), _Alloc(__af));
- __buf_.__large = __hold.release();
- }
- }
- }
+template <class _Fp>
+class __policy_func;
+
+template <class _Rp, class... _ArgTypes>
+class __policy_func<_Rp(_ArgTypes...)> {
+ // Inline storage for small objects.
+ __policy_storage __buf_;
+
+ // Calls the value stored in __buf_. This could technically be part of
+ // policy, but storing it here eliminates a level of indirection inside
+ // operator().
+ typedef __function::__policy_invoker<_Rp(_ArgTypes...)> __invoker;
+ __invoker __invoker_;
- template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __policy_func>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit __policy_func(_Fp&& __f)
- : __policy_(__policy::__create_empty()) {
- typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
-
- if (__function::__not_null(__f)) {
- __invoker_ = __invoker::template __create<_Fun>();
- __policy_ = __policy::__create<_Fun>();
- if (__use_small_storage<_Fun>()) {
- ::new ((void*)&__buf_.__small) _Fun(std::move(__f));
- } else {
- __builtin_new_allocator::__holder_t __hold =
- __builtin_new_allocator::__allocate_type<_Fun>(1);
- __buf_.__large = ::new ((void*)__hold.get()) _Fun(std::move(__f));
- (void)__hold.release();
- }
+ // The policy that describes how to move / copy / destroy __buf_. Never
+ // null, even if the function is empty.
+ const __policy* __policy_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI __policy_func() : __policy_(__policy::__create_empty()) {}
+
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI __policy_func(_Fp&& __f, const _Alloc& __a) : __policy_(__policy::__create_empty()) {
+ typedef __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
+
+ if (__function::__not_null(__f)) {
+ __invoker_ = __invoker::template __create<_Fun>();
+ __policy_ = __policy::__create<_Fun>();
+
+ _FunAlloc __af(__a);
+ if (__use_small_storage<_Fun>()) {
+ ::new ((void*)&__buf_.__small) _Fun(std::move(__f), _Alloc(__af));
+ } else {
+ typedef __allocator_destructor<_FunAlloc> _Dp;
+ unique_ptr<_Fun, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
+ ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__af));
+ __buf_.__large = __hold.release();
}
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func(const __policy_func& __f)
- : __buf_(__f.__buf_), __invoker_(__f.__invoker_),
- __policy_(__f.__policy_)
- {
- if (__policy_->__clone)
- __buf_.__large = __policy_->__clone(__f.__buf_.__large);
+ template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __policy_func>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) {
+ typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
+
+ if (__function::__not_null(__f)) {
+ __invoker_ = __invoker::template __create<_Fun>();
+ __policy_ = __policy::__create<_Fun>();
+ if (__use_small_storage<_Fun>()) {
+ ::new ((void*)&__buf_.__small) _Fun(std::move(__f));
+ } else {
+ __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<_Fun>(1);
+ __buf_.__large = ::new ((void*)__hold.get()) _Fun(std::move(__f));
+ (void)__hold.release();
+ }
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func(__policy_func&& __f)
- : __buf_(__f.__buf_), __invoker_(__f.__invoker_),
- __policy_(__f.__policy_)
- {
- if (__policy_->__destroy)
- {
- __f.__policy_ = __policy::__create_empty();
- __f.__invoker_ = __invoker();
- }
- }
+ _LIBCPP_HIDE_FROM_ABI __policy_func(const __policy_func& __f)
+ : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) {
+ if (__policy_->__clone)
+ __buf_.__large = __policy_->__clone(__f.__buf_.__large);
+ }
- _LIBCPP_HIDE_FROM_ABI
- ~__policy_func()
- {
- if (__policy_->__destroy)
- __policy_->__destroy(__buf_.__large);
+ _LIBCPP_HIDE_FROM_ABI __policy_func(__policy_func&& __f)
+ : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) {
+ if (__policy_->__destroy) {
+ __f.__policy_ = __policy::__create_empty();
+ __f.__invoker_ = __invoker();
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func& operator=(__policy_func&& __f)
- {
- *this = nullptr;
- __buf_ = __f.__buf_;
- __invoker_ = __f.__invoker_;
- __policy_ = __f.__policy_;
- __f.__policy_ = __policy::__create_empty();
- __f.__invoker_ = __invoker();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ~__policy_func() {
+ if (__policy_->__destroy)
+ __policy_->__destroy(__buf_.__large);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __policy_func& operator=(nullptr_t)
- {
- const __policy* __p = __policy_;
- __policy_ = __policy::__create_empty();
- __invoker_ = __invoker();
- if (__p->__destroy)
- __p->__destroy(__buf_.__large);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __policy_func& operator=(__policy_func&& __f) {
+ *this = nullptr;
+ __buf_ = __f.__buf_;
+ __invoker_ = __f.__invoker_;
+ __policy_ = __f.__policy_;
+ __f.__policy_ = __policy::__create_empty();
+ __f.__invoker_ = __invoker();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- _Rp operator()(_ArgTypes&&... __args) const
- {
- return __invoker_.__call_(std::addressof(__buf_),
- std::forward<_ArgTypes>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI __policy_func& operator=(nullptr_t) {
+ const __policy* __p = __policy_;
+ __policy_ = __policy::__create_empty();
+ __invoker_ = __invoker();
+ if (__p->__destroy)
+ __p->__destroy(__buf_.__large);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(__policy_func& __f)
- {
- std::swap(__invoker_, __f.__invoker_);
- std::swap(__policy_, __f.__policy_);
- std::swap(__buf_, __f.__buf_);
- }
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
+ return __invoker_.__call_(std::addressof(__buf_), std::forward<_ArgTypes>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT
- {
- return !__policy_->__is_null;
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__policy_func& __f) {
+ std::swap(__invoker_, __f.__invoker_);
+ std::swap(__policy_, __f.__policy_);
+ std::swap(__buf_, __f.__buf_);
+ }
-#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI
- const std::type_info& target_type() const _NOEXCEPT
- {
- return *__policy_->__type_info;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return !__policy_->__is_null; }
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT
- {
- if (__policy_->__is_null || typeid(_Tp) != *__policy_->__type_info)
- return nullptr;
- if (__policy_->__clone) // Out of line storage.
- return reinterpret_cast<const _Tp*>(__buf_.__large);
- else
- return reinterpret_cast<const _Tp*>(&__buf_.__small);
- }
-#endif // _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
+ _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT { return *__policy_->__type_info; }
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT {
+ if (__policy_->__is_null || typeid(_Tp) != *__policy_->__type_info)
+ return nullptr;
+ if (__policy_->__clone) // Out of line storage.
+ return reinterpret_cast<const _Tp*>(__buf_.__large);
+ else
+ return reinterpret_cast<const _Tp*>(&__buf_.__small);
+ }
+# endif // _LIBCPP_HAS_NO_RTTI
};
-#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME)
+# if defined(_LIBCPP_HAS_BLOCKS_RUNTIME)
-extern "C" void *_Block_copy(const void *);
-extern "C" void _Block_release(const void *);
+extern "C" void* _Block_copy(const void*);
+extern "C" void _Block_release(const void*);
-template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes>
-class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
- : public __base<_Rp(_ArgTypes...)>
-{
- typedef _Rp1(^__block_type)(_ArgTypes1...);
- __block_type __f_;
+template <class _Rp1, class... _ArgTypes1, class _Alloc, class _Rp, class... _ArgTypes>
+class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
+ typedef _Rp1 (^__block_type)(_ArgTypes1...);
+ __block_type __f_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(__block_type const& __f)
-#ifdef _LIBCPP_HAS_OBJC_ARC
- : __f_(__f)
-#else
- : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
-#endif
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit __func(__block_type const& __f)
+# ifdef _LIBCPP_HAS_OBJC_ARC
+ : __f_(__f)
+# else
+ : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
+# endif
+ {
+ }
- // [TODO] add && to save on a retain
+ // [TODO] add && to save on a retain
- _LIBCPP_HIDE_FROM_ABI
- explicit __func(__block_type __f, const _Alloc& /* unused */)
-#ifdef _LIBCPP_HAS_OBJC_ARC
- : __f_(__f)
-#else
- : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
-#endif
- { }
-
- virtual __base<_Rp(_ArgTypes...)>* __clone() const {
- _LIBCPP_ASSERT_INTERNAL(false,
- "Block pointers are just pointers, so they should always fit into "
- "std::function's small buffer optimization. This function should "
- "never be invoked.");
- return nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __func(__block_type __f, const _Alloc& /* unused */)
+# ifdef _LIBCPP_HAS_OBJC_ARC
+ : __f_(__f)
+# else
+ : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
+# endif
+ {
+ }
- virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const {
- ::new ((void*)__p) __func(__f_);
- }
+ virtual __base<_Rp(_ArgTypes...)>* __clone() const {
+ _LIBCPP_ASSERT_INTERNAL(
+ false,
+ "Block pointers are just pointers, so they should always fit into "
+ "std::function's small buffer optimization. This function should "
+ "never be invoked.");
+ return nullptr;
+ }
- virtual void destroy() _NOEXCEPT {
-#ifndef _LIBCPP_HAS_OBJC_ARC
- if (__f_)
- _Block_release(__f_);
-#endif
- __f_ = 0;
- }
+ virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const { ::new ((void*)__p) __func(__f_); }
- virtual void destroy_deallocate() _NOEXCEPT {
- _LIBCPP_ASSERT_INTERNAL(false,
- "Block pointers are just pointers, so they should always fit into "
- "std::function's small buffer optimization. This function should "
- "never be invoked.");
- }
+ virtual void destroy() _NOEXCEPT {
+# ifndef _LIBCPP_HAS_OBJC_ARC
+ if (__f_)
+ _Block_release(__f_);
+# endif
+ __f_ = 0;
+ }
- virtual _Rp operator()(_ArgTypes&& ... __arg) {
- return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...);
- }
+ virtual void destroy_deallocate() _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(
+ false,
+ "Block pointers are just pointers, so they should always fit into "
+ "std::function's small buffer optimization. This function should "
+ "never be invoked.");
+ }
-#ifndef _LIBCPP_HAS_NO_RTTI
- virtual const void* target(type_info const& __ti) const _NOEXCEPT {
- if (__ti == typeid(__func::__block_type))
- return &__f_;
- return (const void*)nullptr;
- }
+ virtual _Rp operator()(_ArgTypes&&... __arg) { return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...); }
- virtual const std::type_info& target_type() const _NOEXCEPT {
- return typeid(__func::__block_type);
- }
-#endif // _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
+ virtual const void* target(type_info const& __ti) const _NOEXCEPT {
+ if (__ti == typeid(__func::__block_type))
+ return &__f_;
+ return (const void*)nullptr;
+ }
+
+ virtual const std::type_info& target_type() const _NOEXCEPT { return typeid(__func::__block_type); }
+# endif // _LIBCPP_HAS_NO_RTTI
};
-#endif // _LIBCPP_HAS_EXTENSION_BLOCKS
+# endif // _LIBCPP_HAS_EXTENSION_BLOCKS
} // namespace __function
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
: public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>,
- public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)>
-{
-#ifndef _LIBCPP_ABI_OPTIMIZED_FUNCTION
- typedef __function::__value_func<_Rp(_ArgTypes...)> __func;
-#else
- typedef __function::__policy_func<_Rp(_ArgTypes...)> __func;
-#endif
-
- __func __f_;
-
- template <class _Fp, bool = _And<
- _IsNotSame<__remove_cvref_t<_Fp>, function>,
- __invokable<_Fp, _ArgTypes...>
- >::value>
- struct __callable;
- template <class _Fp>
- struct __callable<_Fp, true>
- {
- static const bool value = is_void<_Rp>::value ||
- __is_core_convertible<typename __invoke_of<_Fp, _ArgTypes...>::type,
- _Rp>::value;
- };
- template <class _Fp>
- struct __callable<_Fp, false>
- {
- static const bool value = false;
- };
+ public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)> {
+# ifndef _LIBCPP_ABI_OPTIMIZED_FUNCTION
+ typedef __function::__value_func<_Rp(_ArgTypes...)> __func;
+# else
+ typedef __function::__policy_func<_Rp(_ArgTypes...)> __func;
+# endif
+
+ __func __f_;
+
+ template <class _Fp,
+ bool = _And< _IsNotSame<__remove_cvref_t<_Fp>, function>, __invokable<_Fp, _ArgTypes...> >::value>
+ struct __callable;
+ template <class _Fp>
+ struct __callable<_Fp, true> {
+ static const bool value =
+ is_void<_Rp>::value || __is_core_convertible<typename __invoke_of<_Fp, _ArgTypes...>::type, _Rp>::value;
+ };
+ template <class _Fp>
+ struct __callable<_Fp, false> {
+ static const bool value = false;
+ };
template <class _Fp>
using _EnableIfLValueCallable = __enable_if_t<__callable<_Fp&>::value>;
-public:
- typedef _Rp result_type;
-
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- function() _NOEXCEPT { }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_HIDE_FROM_ABI function(nullptr_t) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI function(const function&);
- _LIBCPP_HIDE_FROM_ABI function(function&&) _NOEXCEPT;
- template<class _Fp, class = _EnableIfLValueCallable<_Fp>>
- _LIBCPP_HIDE_FROM_ABI function(_Fp);
-
-#if _LIBCPP_STD_VER <= 14
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- function(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT {}
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, const function&);
- template<class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, function&&);
- template<class _Fp, class _Alloc, class = _EnableIfLValueCallable<_Fp>>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc& __a, _Fp __f);
-#endif
- _LIBCPP_HIDE_FROM_ABI function& operator=(const function&);
- _LIBCPP_HIDE_FROM_ABI function& operator=(function&&) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI function& operator=(nullptr_t) _NOEXCEPT;
- template<class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>>
- _LIBCPP_HIDE_FROM_ABI function& operator=(_Fp&&);
-
- _LIBCPP_HIDE_FROM_ABI ~function();
-
- // function modifiers:
- _LIBCPP_HIDE_FROM_ABI void swap(function&) _NOEXCEPT;
+public:
+ typedef _Rp result_type;
+
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI function() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI function(nullptr_t) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI function(const function&);
+ _LIBCPP_HIDE_FROM_ABI function(function&&) _NOEXCEPT;
+ template <class _Fp, class = _EnableIfLValueCallable<_Fp>>
+ _LIBCPP_HIDE_FROM_ABI function(_Fp);
+
+# if _LIBCPP_STD_VER <= 14
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, const function&);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, function&&);
+ template <class _Fp, class _Alloc, class = _EnableIfLValueCallable<_Fp>>
+ _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc& __a, _Fp __f);
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI function& operator=(const function&);
+ _LIBCPP_HIDE_FROM_ABI function& operator=(function&&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI function& operator=(nullptr_t) _NOEXCEPT;
+ template <class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>>
+ _LIBCPP_HIDE_FROM_ABI function& operator=(_Fp&&);
+
+ _LIBCPP_HIDE_FROM_ABI ~function();
+
+ // function modifiers:
+ _LIBCPP_HIDE_FROM_ABI void swap(function&) _NOEXCEPT;
+
+# if _LIBCPP_STD_VER <= 14
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI void assign(_Fp&& __f, const _Alloc& __a) {
+ function(allocator_arg, __a, std::forward<_Fp>(__f)).swap(*this);
+ }
+# endif
-#if _LIBCPP_STD_VER <= 14
- template<class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- void assign(_Fp&& __f, const _Alloc& __a)
- {function(allocator_arg, __a, std::forward<_Fp>(__f)).swap(*this);}
-#endif
+ // function capacity:
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return static_cast<bool>(__f_); }
- // function capacity:
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT {
- return static_cast<bool>(__f_);
- }
+ // deleted overloads close possible hole in the type system
+ template <class _R2, class... _ArgTypes2>
+ bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
+# if _LIBCPP_STD_VER <= 17
+ template <class _R2, class... _ArgTypes2>
+ bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
+# endif
- // deleted overloads close possible hole in the type system
- template<class _R2, class... _ArgTypes2>
- bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
-#if _LIBCPP_STD_VER <= 17
- template<class _R2, class... _ArgTypes2>
- bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
-#endif
public:
- // function invocation:
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
-
-#ifndef _LIBCPP_HAS_NO_RTTI
- // function target access:
- _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_RTTI
+ // function invocation:
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
+
+# ifndef _LIBCPP_HAS_NO_RTTI
+ // function target access:
+ _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
+# endif // _LIBCPP_HAS_NO_RTTI
};
-#if _LIBCPP_STD_VER >= 17
-template<class _Rp, class ..._Ap>
-function(_Rp(*)(_Ap...)) -> function<_Rp(_Ap...)>;
+# if _LIBCPP_STD_VER >= 17
+template <class _Rp, class... _Ap>
+function(_Rp (*)(_Ap...)) -> function<_Rp(_Ap...)>;
-template<class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
+template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
function(_Fp) -> function<_Stripped>;
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
function<_Rp(_ArgTypes...)>::function(const function& __f) : __f_(__f.__f_) {}
-#if _LIBCPP_STD_VER <= 14
-template<class _Rp, class ..._ArgTypes>
+# if _LIBCPP_STD_VER <= 14
+template <class _Rp, class... _ArgTypes>
template <class _Alloc>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
- const function& __f) : __f_(__f.__f_) {}
-#endif
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, const function& __f) : __f_(__f.__f_) {}
+# endif
template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
- : __f_(std::move(__f.__f_)) {}
+function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT : __f_(std::move(__f.__f_)) {}
-#if _LIBCPP_STD_VER <= 14
-template<class _Rp, class ..._ArgTypes>
+# if _LIBCPP_STD_VER <= 14
+template <class _Rp, class... _ArgTypes>
template <class _Alloc>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
- function&& __f)
- : __f_(std::move(__f.__f_)) {}
-#endif
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, function&& __f) : __f_(std::move(__f.__f_)) {}
+# endif
template <class _Rp, class... _ArgTypes>
template <class _Fp, class>
function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(std::move(__f)) {}
-#if _LIBCPP_STD_VER <= 14
+# if _LIBCPP_STD_VER <= 14
template <class _Rp, class... _ArgTypes>
template <class _Fp, class _Alloc, class>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a,
- _Fp __f)
- : __f_(std::move(__f), __a) {}
-#endif
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a, _Fp __f) : __f_(std::move(__f), __a) {}
+# endif
-template<class _Rp, class ..._ArgTypes>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(const function& __f)
-{
- function(__f).swap(*this);
- return *this;
+template <class _Rp, class... _ArgTypes>
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(const function& __f) {
+ function(__f).swap(*this);
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
-{
- __f_ = std::move(__f.__f_);
- return *this;
+template <class _Rp, class... _ArgTypes>
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT {
+ __f_ = std::move(__f.__f_);
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
-{
- __f_ = nullptr;
- return *this;
+template <class _Rp, class... _ArgTypes>
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT {
+ __f_ = nullptr;
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
template <class _Fp, class>
-function<_Rp(_ArgTypes...)>&
-function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f)
-{
- function(std::forward<_Fp>(__f)).swap(*this);
- return *this;
+function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) {
+ function(std::forward<_Fp>(__f)).swap(*this);
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
function<_Rp(_ArgTypes...)>::~function() {}
-template<class _Rp, class ..._ArgTypes>
-void
-function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
-{
- __f_.swap(__f.__f_);
+template <class _Rp, class... _ArgTypes>
+void function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT {
+ __f_.swap(__f.__f_);
}
-template<class _Rp, class ..._ArgTypes>
-_Rp
-function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
-{
- return __f_(std::forward<_ArgTypes>(__arg)...);
+template <class _Rp, class... _ArgTypes>
+_Rp function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const {
+ return __f_(std::forward<_ArgTypes>(__arg)...);
}
-#ifndef _LIBCPP_HAS_NO_RTTI
+# ifndef _LIBCPP_HAS_NO_RTTI
-template<class _Rp, class ..._ArgTypes>
-const std::type_info&
-function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
-{
- return __f_.target_type();
+template <class _Rp, class... _ArgTypes>
+const std::type_info& function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT {
+ return __f_.target_type();
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
template <typename _Tp>
-_Tp*
-function<_Rp(_ArgTypes...)>::target() _NOEXCEPT
-{
- return (_Tp*)(__f_.template target<_Tp>());
+_Tp* function<_Rp(_ArgTypes...)>::target() _NOEXCEPT {
+ return (_Tp*)(__f_.template target<_Tp>());
}
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
template <typename _Tp>
-const _Tp*
-function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT
-{
- return __f_.template target<_Tp>();
+const _Tp* function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT {
+ return __f_.template target<_Tp>();
}
-#endif // _LIBCPP_HAS_NO_RTTI
+# endif // _LIBCPP_HAS_NO_RTTI
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {
+ return !__f;
+}
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {
+ return !__f;
+}
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {
+ return (bool)__f;
+}
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {
+ return (bool)__f;
+}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
-{return __x.swap(__y);}
+inline _LIBCPP_HIDE_FROM_ABI void swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {
+ return __x.swap(__y);
+}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__functional/hash.h b/contrib/llvm-project/libcxx/include/__functional/hash.h
index c369e39ce003..ff22055d6915 100644
--- a/contrib/llvm-project/libcxx/include/__functional/hash.h
+++ b/contrib/llvm-project/libcxx/include/__functional/hash.h
@@ -35,133 +35,117 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_Size
-__loadword(const void* __p)
-{
- _Size __r;
- std::memcpy(&__r, __p, sizeof(__r));
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) {
+ _Size __r;
+ std::memcpy(&__r, __p, sizeof(__r));
+ return __r;
}
// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
// is 64 bits. This is because cityhash64 uses 64bit x 64bit
// multiplication, which can be very slow on 32-bit systems.
-template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
+template <class _Size, size_t = sizeof(_Size) * __CHAR_BIT__>
struct __murmur2_or_cityhash;
template <class _Size>
-struct __murmur2_or_cityhash<_Size, 32>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- _Size operator()(const void* __key, _Size __len) const {
- // murmur2
- const _Size __m = 0x5bd1e995;
- const _Size __r = 24;
- _Size __h = __len;
- const unsigned char* __data = static_cast<const unsigned char*>(__key);
- for (; __len >= 4; __data += 4, __len -= 4)
- {
- _Size __k = std::__loadword<_Size>(__data);
- __k *= __m;
- __k ^= __k >> __r;
- __k *= __m;
- __h *= __m;
- __h ^= __k;
- }
- switch (__len)
- {
- case 3:
- __h ^= static_cast<_Size>(__data[2] << 16);
- _LIBCPP_FALLTHROUGH();
- case 2:
- __h ^= static_cast<_Size>(__data[1] << 8);
- _LIBCPP_FALLTHROUGH();
- case 1:
- __h ^= __data[0];
- __h *= __m;
- }
- __h ^= __h >> 13;
+struct __murmur2_or_cityhash<_Size, 32> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
+ operator()(const void* __key, _Size __len) const {
+ // murmur2
+ const _Size __m = 0x5bd1e995;
+ const _Size __r = 24;
+ _Size __h = __len;
+ const unsigned char* __data = static_cast<const unsigned char*>(__key);
+ for (; __len >= 4; __data += 4, __len -= 4) {
+ _Size __k = std::__loadword<_Size>(__data);
+ __k *= __m;
+ __k ^= __k >> __r;
+ __k *= __m;
__h *= __m;
- __h ^= __h >> 15;
- return __h;
+ __h ^= __k;
}
+ switch (__len) {
+ case 3:
+ __h ^= static_cast<_Size>(__data[2] << 16);
+ _LIBCPP_FALLTHROUGH();
+ case 2:
+ __h ^= static_cast<_Size>(__data[1] << 8);
+ _LIBCPP_FALLTHROUGH();
+ case 1:
+ __h ^= __data[0];
+ __h *= __m;
+ }
+ __h ^= __h >> 13;
+ __h *= __m;
+ __h ^= __h >> 15;
+ return __h;
+ }
};
template <class _Size>
-struct __murmur2_or_cityhash<_Size, 64>
-{
+struct __murmur2_or_cityhash<_Size, 64> {
// cityhash64
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- _Size operator()(const void* __key, _Size __len) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
+ operator()(const void* __key, _Size __len) const {
const char* __s = static_cast<const char*>(__key);
if (__len <= 32) {
- if (__len <= 16) {
+ if (__len <= 16) {
return __hash_len_0_to_16(__s, __len);
- } else {
+ } else {
return __hash_len_17_to_32(__s, __len);
- }
+ }
} else if (__len <= 64) {
- return __hash_len_33_to_64(__s, __len);
+ return __hash_len_33_to_64(__s, __len);
}
// For strings over 64 bytes we hash the end first, and then as we
// loop we keep 56 bytes of state: v, w, x, y, and z.
_Size __x = std::__loadword<_Size>(__s + __len - 40);
- _Size __y = std::__loadword<_Size>(__s + __len - 16) +
- std::__loadword<_Size>(__s + __len - 56);
- _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len,
- std::__loadword<_Size>(__s + __len - 24));
+ _Size __y = std::__loadword<_Size>(__s + __len - 16) + std::__loadword<_Size>(__s + __len - 56);
+ _Size __z =
+ __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, std::__loadword<_Size>(__s + __len - 24));
pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
- __x = __x * __k1 + std::__loadword<_Size>(__s);
+ __x = __x * __k1 + std::__loadword<_Size>(__s);
// Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
__len = (__len - 1) & ~static_cast<_Size>(63);
do {
- __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
- __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
- __x ^= __w.second;
- __y += __v.first + std::__loadword<_Size>(__s + 40);
- __z = __rotate(__z + __w.first, 33) * __k1;
- __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
- __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
- __y + std::__loadword<_Size>(__s + 16));
- std::swap(__z, __x);
- __s += 64;
- __len -= 64;
+ __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
+ __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
+ __x ^= __w.second;
+ __y += __v.first + std::__loadword<_Size>(__s + 40);
+ __z = __rotate(__z + __w.first, 33) * __k1;
+ __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
+ __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, __y + std::__loadword<_Size>(__s + 16));
+ std::swap(__z, __x);
+ __s += 64;
+ __len -= 64;
} while (__len != 0);
- return __hash_len_16(
- __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
- __hash_len_16(__v.second, __w.second) + __x);
+ return __hash_len_16(__hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
+ __hash_len_16(__v.second, __w.second) + __x);
}
- private:
- // Some primes between 2^63 and 2^64.
- static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
- static const _Size __k1 = 0xb492b66fbe98f273ULL;
- static const _Size __k2 = 0x9ae16a3b2f90404fULL;
- static const _Size __k3 = 0xc949d7c7509e6557ULL;
+private:
+ // Some primes between 2^63 and 2^64.
+ static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
+ static const _Size __k1 = 0xb492b66fbe98f273ULL;
+ static const _Size __k2 = 0x9ae16a3b2f90404fULL;
+ static const _Size __k3 = 0xc949d7c7509e6557ULL;
- _LIBCPP_HIDE_FROM_ABI
- static _Size __rotate(_Size __val, int __shift) {
+ _LIBCPP_HIDE_FROM_ABI static _Size __rotate(_Size __val, int __shift) {
return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
}
- _LIBCPP_HIDE_FROM_ABI
- static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
+ _LIBCPP_HIDE_FROM_ABI static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
return (__val >> __shift) | (__val << (64 - __shift));
}
- _LIBCPP_HIDE_FROM_ABI
- static _Size __shift_mix(_Size __val) {
- return __val ^ (__val >> 47);
- }
+ _LIBCPP_HIDE_FROM_ABI static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_16(_Size __u, _Size __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size __hash_len_16(_Size __u, _Size __v) {
const _Size __mul = 0x9ddfea08eb382d69ULL;
- _Size __a = (__u ^ __v) * __mul;
+ _Size __a = (__u ^ __v) * __mul;
__a ^= (__a >> 47);
_Size __b = (__v ^ __a) * __mul;
__b ^= (__b >> 47);
@@ -169,8 +153,8 @@ struct __murmur2_or_cityhash<_Size, 64>
return __b;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_0_to_16(const char* __s, _Size __len) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
+ __hash_len_0_to_16(const char* __s, _Size __len) {
if (__len > 8) {
const _Size __a = std::__loadword<_Size>(__s);
const _Size __b = std::__loadword<_Size>(__s + __len - 8);
@@ -189,32 +173,29 @@ struct __murmur2_or_cityhash<_Size, 64>
const unsigned char __a = static_cast<unsigned char>(__s[0]);
const unsigned char __b = static_cast<unsigned char>(__s[__len >> 1]);
const unsigned char __c = static_cast<unsigned char>(__s[__len - 1]);
- const uint32_t __y = static_cast<uint32_t>(__a) +
- (static_cast<uint32_t>(__b) << 8);
- const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
+ const uint32_t __y = static_cast<uint32_t>(__a) + (static_cast<uint32_t>(__b) << 8);
+ const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
}
return __k2;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_17_to_32(const char *__s, _Size __len) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
+ __hash_len_17_to_32(const char* __s, _Size __len) {
const _Size __a = std::__loadword<_Size>(__s) * __k1;
const _Size __b = std::__loadword<_Size>(__s + 8);
const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2;
const _Size __d = std::__loadword<_Size>(__s + __len - 16) * __k0;
- return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
- __a + __rotate(__b ^ __k3, 20) - __c + __len);
+ return __hash_len_16(
+ __rotate(__a - __b, 43) + __rotate(__c, 30) + __d, __a + __rotate(__b ^ __k3, 20) - __c + __len);
}
// Return a 16-byte hash for 48 bytes. Quick and dirty.
// Callers do best to use "random-looking" values for a and b.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
- _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
+ __weak_hash_len_32_with_seeds(_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
__a += __w;
- __b = __rotate(__b + __a + __z, 21);
+ __b = __rotate(__b + __a + __z, 21);
const _Size __c = __a;
__a += __x;
__a += __y;
@@ -223,24 +204,22 @@ struct __murmur2_or_cityhash<_Size, 64>
}
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
- const char* __s, _Size __a, _Size __b)
- {
- return __weak_hash_len_32_with_seeds(std::__loadword<_Size>(__s),
- std::__loadword<_Size>(__s + 8),
- std::__loadword<_Size>(__s + 16),
- std::__loadword<_Size>(__s + 24),
- __a,
- __b);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
+ __weak_hash_len_32_with_seeds(const char* __s, _Size __a, _Size __b) {
+ return __weak_hash_len_32_with_seeds(
+ std::__loadword<_Size>(__s),
+ std::__loadword<_Size>(__s + 8),
+ std::__loadword<_Size>(__s + 16),
+ std::__loadword<_Size>(__s + 24),
+ __a,
+ __b);
}
// Return an 8-byte hash for 33 to 64 bytes.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
- static _Size __hash_len_33_to_64(const char *__s, size_t __len) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
+ __hash_len_33_to_64(const char* __s, size_t __len) {
_Size __z = std::__loadword<_Size>(__s + 24);
- _Size __a = std::__loadword<_Size>(__s) +
- (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
+ _Size __a = std::__loadword<_Size>(__s) + (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
_Size __b = __rotate(__a + __z, 52);
_Size __c = __rotate(__a, 37);
__a += std::__loadword<_Size>(__s + 8);
@@ -248,7 +227,7 @@ struct __murmur2_or_cityhash<_Size, 64>
__a += std::__loadword<_Size>(__s + 16);
_Size __vf = __a + __z;
_Size __vs = __b + __rotate(__a, 31) + __c;
- __a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
+ __a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
__z += std::__loadword<_Size>(__s + __len - 8);
__b = __rotate(__a + __z, 52);
__c = __rotate(__a, 37);
@@ -257,7 +236,7 @@ struct __murmur2_or_cityhash<_Size, 64>
__a += std::__loadword<_Size>(__s + __len - 16);
_Size __wf = __a + __z;
_Size __ws = __b + __rotate(__a, 31) + __c;
- _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
+ _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
return __shift_mix(__r * __k0 + __vs) * __k2;
}
};
@@ -266,104 +245,76 @@ template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
struct __scalar_hash;
template <class _Tp>
-struct __scalar_hash<_Tp, 0>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- size_t __a;
- } __u;
- __u.__a = 0;
- __u.__t = __v;
- return __u.__a;
- }
+struct __scalar_hash<_Tp, 0> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__a = 0;
+ __u.__t = __v;
+ return __u.__a;
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 1>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- size_t __a;
- } __u;
- __u.__t = __v;
- return __u.__a;
- }
+struct __scalar_hash<_Tp, 1> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __u.__a;
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 2>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+struct __scalar_hash<_Tp, 2> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 3>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+struct __scalar_hash<_Tp, 3> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
template <class _Tp>
-struct __scalar_hash<_Tp, 4>
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- size_t __d;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ union {
+ _Tp __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
struct _PairT {
@@ -371,314 +322,223 @@ struct _PairT {
size_t second;
};
-_LIBCPP_HIDE_FROM_ABI
-inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
- typedef __scalar_hash<_PairT> _HashT;
- const _PairT __p = {__lhs, __rhs};
- return _HashT()(__p);
+_LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
+ typedef __scalar_hash<_PairT> _HashT;
+ const _PairT __p = {__lhs, __rhs};
+ return _HashT()(__p);
}
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
- : public __unary_function<_Tp*, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp* __v) const _NOEXCEPT
- {
- union
- {
- _Tp* __t;
- size_t __a;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> : public __unary_function<_Tp*, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp* __v) const _NOEXCEPT {
+ union {
+ _Tp* __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<bool>
- : public __unary_function<bool, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<bool> : public __unary_function<bool, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(bool __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char>
- : public __unary_function<char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char> : public __unary_function<char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<signed char>
- : public __unary_function<signed char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public __unary_function<signed char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
- : public __unary_function<unsigned char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public __unary_function<unsigned char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
- : public __unary_function<char8_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char8_t> : public __unary_function<char8_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char8_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#endif // !_LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
- : public __unary_function<char16_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public __unary_function<char16_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char16_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
- : public __unary_function<char32_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public __unary_function<char32_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char32_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
- : public __unary_function<wchar_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public __unary_function<wchar_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<short>
- : public __unary_function<short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<short> : public __unary_function<short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
- : public __unary_function<unsigned short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public __unary_function<unsigned short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<int>
- : public __unary_function<int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<int> : public __unary_function<int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
- : public __unary_function<unsigned int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public __unary_function<unsigned int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long>
- : public __unary_function<long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<long> : public __unary_function<long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
- : public __unary_function<unsigned long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public __unary_function<unsigned long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long long>
- : public __scalar_hash<long long>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<long long> : public __scalar_hash<long long> {};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
- : public __scalar_hash<unsigned long long>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long> : public __scalar_hash<unsigned long long> {};
#ifndef _LIBCPP_HAS_NO_INT128
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
- : public __scalar_hash<__int128_t>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<__int128_t> : public __scalar_hash<__int128_t> {};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
- : public __scalar_hash<__uint128_t>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t> : public __scalar_hash<__uint128_t> {};
#endif
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<float>
- : public __scalar_hash<float>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(float __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0.0f)
- return 0;
- return __scalar_hash<float>::operator()(__v);
- }
+struct _LIBCPP_TEMPLATE_VIS hash<float> : public __scalar_hash<float> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(float __v) const _NOEXCEPT {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0.0f)
+ return 0;
+ return __scalar_hash<float>::operator()(__v);
+ }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<double>
- : public __scalar_hash<double>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(double __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0.0)
- return 0;
- return __scalar_hash<double>::operator()(__v);
- }
+struct _LIBCPP_TEMPLATE_VIS hash<double> : public __scalar_hash<double> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(double __v) const _NOEXCEPT {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0.0)
+ return 0;
+ return __scalar_hash<double>::operator()(__v);
+ }
};
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long double>
- : public __scalar_hash<long double>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(long double __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0.0L)
- return 0;
+struct _LIBCPP_TEMPLATE_VIS hash<long double> : public __scalar_hash<long double> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(long double __v) const _NOEXCEPT {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0.0L)
+ return 0;
#if defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__))
- // Zero out padding bits
- union
- {
- long double __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- size_t __d;
- } __s;
- } __u;
- __u.__s.__a = 0;
- __u.__s.__b = 0;
- __u.__s.__c = 0;
- __u.__s.__d = 0;
- __u.__t = __v;
- return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
+ // Zero out padding bits
+ union {
+ long double __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ } __s;
+ } __u;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__s.__c = 0;
+ __u.__s.__d = 0;
+ __u.__t = __v;
+ return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
#elif defined(__x86_64__)
- // Zero out padding bits
- union
- {
- long double __t;
- struct
- {
- size_t __a;
- size_t __b;
- } __s;
- } __u;
- __u.__s.__a = 0;
- __u.__s.__b = 0;
- __u.__t = __v;
- return __u.__s.__a ^ __u.__s.__b;
+ // Zero out padding bits
+ union {
+ long double __t;
+ struct {
+ size_t __a;
+ size_t __b;
+ } __s;
+ } __u;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__t = __v;
+ return __u.__s.__a ^ __u.__s.__b;
#else
- return __scalar_hash<long double>::operator()(__v);
+ return __scalar_hash<long double>::operator()(__v);
#endif
- }
+ }
};
template <class _Tp, bool = is_enum<_Tp>::value>
-struct _LIBCPP_TEMPLATE_VIS __enum_hash
- : public __unary_function<_Tp, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- typedef typename underlying_type<_Tp>::type type;
- return hash<type>()(static_cast<type>(__v));
- }
+struct _LIBCPP_TEMPLATE_VIS __enum_hash : public __unary_function<_Tp, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
+ typedef typename underlying_type<_Tp>::type type;
+ return hash<type>()(static_cast<type>(__v));
+ }
};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
- __enum_hash() = delete;
- __enum_hash(__enum_hash const&) = delete;
- __enum_hash& operator=(__enum_hash const&) = delete;
+ __enum_hash() = delete;
+ __enum_hash(__enum_hash const&) = delete;
+ __enum_hash& operator=(__enum_hash const&) = delete;
};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> {};
#if _LIBCPP_STD_VER >= 17
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
- : public __unary_function<nullptr_t, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(nullptr_t) const _NOEXCEPT {
- return 662607004ull;
- }
+struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t> : public __unary_function<nullptr_t, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; }
};
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Hash>
-using __check_hash_requirements _LIBCPP_NODEBUG = integral_constant<bool,
- is_copy_constructible<_Hash>::value &&
- is_move_constructible<_Hash>::value &&
- __invokable_r<size_t, _Hash, _Key const&>::value
->;
+using __check_hash_requirements _LIBCPP_NODEBUG =
+ integral_constant<bool,
+ is_copy_constructible<_Hash>::value && is_move_constructible<_Hash>::value &&
+ __invokable_r<size_t, _Hash, _Key const&>::value >;
template <class _Key, class _Hash = hash<_Key> >
-using __has_enabled_hash _LIBCPP_NODEBUG = integral_constant<bool,
- __check_hash_requirements<_Key, _Hash>::value &&
- is_default_constructible<_Hash>::value
->;
+using __has_enabled_hash _LIBCPP_NODEBUG =
+ integral_constant<bool, __check_hash_requirements<_Key, _Hash>::value && is_default_constructible<_Hash>::value >;
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Type, class>
using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;
-template <class _Type, class ..._Keys>
-using __enable_hash_helper _LIBCPP_NODEBUG = __enable_hash_helper_imp<_Type,
- __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value>
->;
-#else
-template <class _Type, class ...>
+template <class _Type, class... _Keys>
+using __enable_hash_helper _LIBCPP_NODEBUG =
+ __enable_hash_helper_imp<_Type, __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value> >;
+# else
+template <class _Type, class...>
using __enable_hash_helper _LIBCPP_NODEBUG = _Type;
-#endif
+# endif
#endif // !_LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__functional/identity.h b/contrib/llvm-project/libcxx/include/__functional/identity.h
index ee92c4130e71..7fbfc6c6249b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/identity.h
+++ b/contrib/llvm-project/libcxx/include/__functional/identity.h
@@ -11,6 +11,7 @@
#define _LIBCPP___FUNCTIONAL_IDENTITY_H
#include <__config>
+#include <__functional/reference_wrapper.h>
#include <__type_traits/integral_constant.h>
#include <__utility/forward.h>
@@ -34,21 +35,28 @@ struct __identity {
template <>
struct __is_identity<__identity> : true_type {};
+template <>
+struct __is_identity<reference_wrapper<__identity> > : true_type {};
+template <>
+struct __is_identity<reference_wrapper<const __identity> > : true_type {};
#if _LIBCPP_STD_VER >= 20
struct identity {
- template<class _Tp>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept
- {
- return std::forward<_Tp>(__t);
- }
+ template <class _Tp>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept {
+ return std::forward<_Tp>(__t);
+ }
- using is_transparent = void;
+ using is_transparent = void;
};
template <>
struct __is_identity<identity> : true_type {};
+template <>
+struct __is_identity<reference_wrapper<identity> > : true_type {};
+template <>
+struct __is_identity<reference_wrapper<const identity> > : true_type {};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__functional/invoke.h b/contrib/llvm-project/libcxx/include/__functional/invoke.h
index df2f99fe27d6..ef4bf25f0775 100644
--- a/contrib/llvm-project/libcxx/include/__functional/invoke.h
+++ b/contrib/llvm-project/libcxx/include/__functional/invoke.h
@@ -22,12 +22,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _Fn, class ..._Args>
+template <class _Fn, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...>
-invoke(_Fn&& __f, _Args&&... __args)
- noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
-{
- return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
+invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) {
+ return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
}
#endif // _LIBCPP_STD_VER >= 17
@@ -37,17 +35,17 @@ template <class _Result, class _Fn, class... _Args>
requires is_invocable_r_v<_Result, _Fn, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr _Result
invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result, _Fn, _Args...>) {
- if constexpr (is_void_v<_Result>) {
- static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
- } else {
- // TODO: Use reference_converts_from_temporary_v once implemented
- // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
- // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
- static_assert(true,
- "Returning from invoke_r would bind a temporary object to the reference return type, "
- "which would result in a dangling reference.");
- return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
- }
+ if constexpr (is_void_v<_Result>) {
+ static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
+ } else {
+ // TODO: Use reference_converts_from_temporary_v once implemented
+ // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
+ // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
+ static_assert(true,
+ "Returning from invoke_r would bind a temporary object to the reference return type, "
+ "which would result in a dangling reference.");
+ return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
+ }
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/is_transparent.h b/contrib/llvm-project/libcxx/include/__functional/is_transparent.h
index c539a07d696d..13fc94f71c6b 100644
--- a/contrib/llvm-project/libcxx/include/__functional/is_transparent.h
+++ b/contrib/llvm-project/libcxx/include/__functional/is_transparent.h
@@ -26,8 +26,7 @@ template <class _Tp, class, class = void>
struct __is_transparent : false_type {};
template <class _Tp, class _Up>
-struct __is_transparent<_Tp, _Up, __void_t<typename _Tp::is_transparent> >
- : true_type {};
+struct __is_transparent<_Tp, _Up, __void_t<typename _Tp::is_transparent> > : true_type {};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/mem_fn.h b/contrib/llvm-project/libcxx/include/__functional/mem_fn.h
index 77c8136d8785..349a6ce3a757 100644
--- a/contrib/llvm-project/libcxx/include/__functional/mem_fn.h
+++ b/contrib/llvm-project/libcxx/include/__functional/mem_fn.h
@@ -23,34 +23,30 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-class __mem_fn : public __weak_result_type<_Tp>
-{
+class __mem_fn : public __weak_result_type<_Tp> {
public:
- // types
- typedef _Tp type;
+ // types
+ typedef _Tp type;
+
private:
- type __f_;
+ type __f_;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
- // invoke
- template <class... _ArgTypes>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ // invoke
+ template <class... _ArgTypes>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __invoke_return<type, _ArgTypes...>::type
- operator() (_ArgTypes&&... __args) const {
- return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
- }
+ typename __invoke_return<type, _ArgTypes...>::type
+ operator()(_ArgTypes&&... __args) const {
+ return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
+ }
};
-template<class _Rp, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-__mem_fn<_Rp _Tp::*>
-mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
-{
- return __mem_fn<_Rp _Tp::*>(__pm);
+template <class _Rp, class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn<_Rp _Tp::*> mem_fn(_Rp _Tp::*__pm) _NOEXCEPT {
+ return __mem_fn<_Rp _Tp::*>(__pm);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h b/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h
index 620d479fdd61..fe43c4656092 100644
--- a/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h
+++ b/contrib/llvm-project/libcxx/include/__functional/mem_fun_ref.h
@@ -22,149 +22,122 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
-template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t
- : public __unary_function<_Tp*, _Sp>
-{
- _Sp (_Tp::*__p_)();
+template <class _Sp, class _Tp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> {
+ _Sp (_Tp::*__p_)();
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun_t(_Sp (_Tp::*__p)())
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p) const
- {return (__p->*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun_t(_Sp (_Tp::*__p)()) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p) const { return (__p->*__p_)(); }
};
-template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t
- : public __binary_function<_Tp*, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap);
+template <class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t : public __binary_function<_Tp*, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap))
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p, _Ap __x) const
- {return (__p->*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp* __p, _Ap __x) const { return (__p->*__p_)(__x); }
};
-template<class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun_t<_Sp,_Tp>
-mem_fun(_Sp (_Tp::*__f)())
- {return mem_fun_t<_Sp,_Tp>(__f);}
-
-template<class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun1_t<_Sp,_Tp,_Ap>
-mem_fun(_Sp (_Tp::*__f)(_Ap))
- {return mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
-
-template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t
- : public __unary_function<_Tp, _Sp>
-{
- _Sp (_Tp::*__p_)();
+template <class _Sp, class _Tp>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun_t<_Sp, _Tp> mem_fun(_Sp (_Tp::*__f)()) {
+ return mem_fun_t<_Sp, _Tp>(__f);
+}
+
+template <class _Sp, class _Tp, class _Ap>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun1_t<_Sp, _Tp, _Ap> mem_fun(_Sp (_Tp::*__f)(_Ap)) {
+ return mem_fun1_t<_Sp, _Tp, _Ap>(__f);
+}
+
+template <class _Sp, class _Tp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t : public __unary_function<_Tp, _Sp> {
+ _Sp (_Tp::*__p_)();
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun_ref_t(_Sp (_Tp::*__p)())
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p) const
- {return (__p.*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun_ref_t(_Sp (_Tp::*__p)()) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p) const { return (__p.*__p_)(); }
};
-template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t
- : public __binary_function<_Tp, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap);
+template <class _Sp, class _Tp, class _Ap>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t : public __binary_function<_Tp, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap))
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p, _Ap __x) const
- {return (__p.*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(_Tp& __p, _Ap __x) const { return (__p.*__p_)(__x); }
};
-template<class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun_ref_t<_Sp,_Tp>
-mem_fun_ref(_Sp (_Tp::*__f)())
- {return mem_fun_ref_t<_Sp,_Tp>(__f);}
+template <class _Sp, class _Tp>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun_ref_t<_Sp, _Tp> mem_fun_ref(_Sp (_Tp::*__f)()) {
+ return mem_fun_ref_t<_Sp, _Tp>(__f);
+}
-template<class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-mem_fun1_ref_t<_Sp,_Tp,_Ap>
-mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
- {return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
+template <class _Sp, class _Tp, class _Ap>
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI mem_fun1_ref_t<_Sp, _Tp, _Ap>
+mem_fun_ref(_Sp (_Tp::*__f)(_Ap)) {
+ return mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f);
+}
template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t
- : public __unary_function<const _Tp*, _Sp>
-{
- _Sp (_Tp::*__p_)() const;
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t : public __unary_function<const _Tp*, _Sp> {
+ _Sp (_Tp::*__p_)() const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_t(_Sp (_Tp::*__p)() const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p) const
- {return (__p->*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_t(_Sp (_Tp::*__p)() const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p) const { return (__p->*__p_)(); }
};
template <class _Sp, class _Tp, class _Ap>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t
- : public __binary_function<const _Tp*, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap) const;
+ : public __binary_function<const _Tp*, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap) const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p, _Ap __x) const
- {return (__p->*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp* __p, _Ap __x) const { return (__p->*__p_)(__x); }
};
template <class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun_t<_Sp,_Tp>
-mem_fun(_Sp (_Tp::*__f)() const)
- {return const_mem_fun_t<_Sp,_Tp>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun_t<_Sp, _Tp> mem_fun(_Sp (_Tp::*__f)() const) {
+ return const_mem_fun_t<_Sp, _Tp>(__f);
+}
template <class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun1_t<_Sp,_Tp,_Ap>
-mem_fun(_Sp (_Tp::*__f)(_Ap) const)
- {return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun1_t<_Sp, _Tp, _Ap>
+mem_fun(_Sp (_Tp::*__f)(_Ap) const) {
+ return const_mem_fun1_t<_Sp, _Tp, _Ap>(__f);
+}
template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t
- : public __unary_function<_Tp, _Sp>
-{
- _Sp (_Tp::*__p_)() const;
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t : public __unary_function<_Tp, _Sp> {
+ _Sp (_Tp::*__p_)() const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p) const
- {return (__p.*__p_)();}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p) const { return (__p.*__p_)(); }
};
template <class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t
- : public __binary_function<_Tp, _Ap, _Sp>
-{
- _Sp (_Tp::*__p_)(_Ap) const;
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t : public __binary_function<_Tp, _Ap, _Sp> {
+ _Sp (_Tp::*__p_)(_Ap) const;
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p, _Ap __x) const
- {return (__p.*__p_)(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _Sp operator()(const _Tp& __p, _Ap __x) const { return (__p.*__p_)(__x); }
};
template <class _Sp, class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun_ref_t<_Sp,_Tp>
-mem_fun_ref(_Sp (_Tp::*__f)() const)
- {return const_mem_fun_ref_t<_Sp,_Tp>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun_ref_t<_Sp, _Tp>
+mem_fun_ref(_Sp (_Tp::*__f)() const) {
+ return const_mem_fun_ref_t<_Sp, _Tp>(__f);
+}
template <class _Sp, class _Tp, class _Ap>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
-mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
- {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI const_mem_fun1_ref_t<_Sp, _Tp, _Ap>
+mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {
+ return const_mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/not_fn.h b/contrib/llvm-project/libcxx/include/__functional/not_fn.h
index bbd1a8bc35af..23a491c135d7 100644
--- a/contrib/llvm-project/libcxx/include/__functional/not_fn.h
+++ b/contrib/llvm-project/libcxx/include/__functional/not_fn.h
@@ -28,26 +28,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
struct __not_fn_op {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
- noexcept(noexcept(!std::invoke(std::forward<_Args>(__args)...)))
- -> decltype( !std::invoke(std::forward<_Args>(__args)...))
- { return !std::invoke(std::forward<_Args>(__args)...); }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
+ noexcept(noexcept(!std::invoke(std::forward<_Args>(__args)...)))
+ -> decltype(!std::invoke(std::forward<_Args>(__args)...)) {
+ return !std::invoke(std::forward<_Args>(__args)...);
+ }
};
template <class _Fn>
struct __not_fn_t : __perfect_forward<__not_fn_op, _Fn> {
- using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
+ using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
};
-template <class _Fn, class = enable_if_t<
- is_constructible_v<decay_t<_Fn>, _Fn> &&
- is_move_constructible_v<decay_t<_Fn>>
->>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
- return __not_fn_t<decay_t<_Fn>>(std::forward<_Fn>(__f));
+template <class _Fn,
+ class = enable_if_t< is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> >>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
+ return __not_fn_t<decay_t<_Fn>>(std::forward<_Fn>(__f));
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__functional/operations.h b/contrib/llvm-project/libcxx/include/__functional/operations.h
index 23928e9fc22d..7ddc00650f16 100644
--- a/contrib/llvm-project/libcxx/include/__functional/operations.h
+++ b/contrib/llvm-project/libcxx/include/__functional/operations.h
@@ -30,13 +30,11 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS plus
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x + __y;}
+struct _LIBCPP_TEMPLATE_VIS plus : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x + __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus);
@@ -50,15 +48,14 @@ struct __desugars_to<__plus_tag, plus<void>, _Tp, _Up> : true_type {};
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS plus<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) + std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) + std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS plus<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) + std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -67,27 +64,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS minus
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x - __y;}
+struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x - __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS minus<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) - std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) - std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS minus<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) - std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -96,27 +90,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS multiplies
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x * __y;}
+struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x * __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS multiplies<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) * std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) * std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS multiplies<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) * std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -125,27 +116,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS divides
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x / __y;}
+struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x / __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS divides<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) / std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) / std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS divides<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) / std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -154,27 +142,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS modulus
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x % __y;}
+struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x % __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS modulus<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) % std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) % std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS modulus<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) % std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -183,27 +168,21 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS negate
- : __unary_function<_Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return -__x;}
+struct _LIBCPP_TEMPLATE_VIS negate : __unary_function<_Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return -__x; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS negate<void>
-{
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(- std::forward<_Tp>(__x)))
- -> decltype( - std::forward<_Tp>(__x))
- { return - std::forward<_Tp>(__x); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS negate<void> {
+ template <class _Tp>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
+ noexcept(noexcept(-std::forward<_Tp>(__x))) -> decltype(-std::forward<_Tp>(__x)) {
+ return -std::forward<_Tp>(__x);
+ }
+ typedef void is_transparent;
};
#endif
@@ -214,51 +193,42 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS bit_and
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x & __y;}
+struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x & __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_and<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) & std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) & std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) & std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_and<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) & std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) & std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
#if _LIBCPP_STD_VER >= 14
template <class _Tp = void>
-struct _LIBCPP_TEMPLATE_VIS bit_not
- : __unary_function<_Tp, _Tp>
-{
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return ~__x;}
+struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> {
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not);
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_not<void>
-{
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(~std::forward<_Tp>(__x)))
- -> decltype( ~std::forward<_Tp>(__x))
- { return ~std::forward<_Tp>(__x); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_not<void> {
+ template <class _Tp>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
+ noexcept(noexcept(~std::forward<_Tp>(__x))) -> decltype(~std::forward<_Tp>(__x)) {
+ return ~std::forward<_Tp>(__x);
+ }
+ typedef void is_transparent;
};
#endif
@@ -267,27 +237,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS bit_or
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x | __y;}
+struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x | __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_or<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) | std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) | std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_or<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) | std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -296,27 +263,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS bit_xor
- : __binary_function<_Tp, _Tp, _Tp>
-{
- typedef _Tp __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x ^ __y;}
+struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> {
+ typedef _Tp __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x ^ __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS bit_xor<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) ^ std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) ^ std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS bit_xor<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) ^ std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -327,27 +291,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS equal_to
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x == __y;}
+struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x == __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS equal_to<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) == std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) == std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS equal_to<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) == std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -365,27 +326,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS not_equal_to
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x != __y;}
+struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x != __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS not_equal_to<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) != std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) != std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) != std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -394,27 +352,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS less
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x < __y;}
+struct _LIBCPP_TEMPLATE_VIS less : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x < __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS less<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) < std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) < std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS less<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) < std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -423,27 +378,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS less_equal
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x <= __y;}
+struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x <= __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS less_equal<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) <= std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) <= std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS less_equal<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) <= std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -452,27 +404,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS greater_equal
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x >= __y;}
+struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x >= __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS greater_equal<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) >= std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) >= std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) >= std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS greater_equal<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) >= std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) >= std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -481,27 +430,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS greater
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x > __y;}
+struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x > __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS greater<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) > std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) > std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS greater<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) > std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -512,27 +458,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS logical_and
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x && __y;}
+struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x && __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS logical_and<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) && std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) && std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS logical_and<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) && std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
@@ -541,27 +484,21 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS logical_not
- : __unary_function<_Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x) const
- {return !__x;}
+struct _LIBCPP_TEMPLATE_VIS logical_not : __unary_function<_Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x) const { return !__x; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS logical_not<void>
-{
- template <class _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_Tp&& __x) const
- noexcept(noexcept(!std::forward<_Tp>(__x)))
- -> decltype( !std::forward<_Tp>(__x))
- { return !std::forward<_Tp>(__x); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS logical_not<void> {
+ template <class _Tp>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
+ noexcept(noexcept(!std::forward<_Tp>(__x))) -> decltype(!std::forward<_Tp>(__x)) {
+ return !std::forward<_Tp>(__x);
+ }
+ typedef void is_transparent;
};
#endif
@@ -570,27 +507,24 @@ template <class _Tp = void>
#else
template <class _Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS logical_or
- : __binary_function<_Tp, _Tp, bool>
-{
- typedef bool __result_type; // used by valarray
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x || __y;}
+struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> {
+ typedef bool __result_type; // used by valarray
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return __x || __y;
+ }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or);
#if _LIBCPP_STD_VER >= 14
template <>
-struct _LIBCPP_TEMPLATE_VIS logical_or<void>
-{
- template <class _T1, class _T2>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u)))
- -> decltype( std::forward<_T1>(__t) || std::forward<_T2>(__u))
- { return std::forward<_T1>(__t) || std::forward<_T2>(__u); }
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS logical_or<void> {
+ template <class _T1, class _T2>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
+ noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u)))
+ -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
+ return std::forward<_T1>(__t) || std::forward<_T2>(__u);
+ }
+ typedef void is_transparent;
};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h b/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h
index 2fbb623a7d89..74177c789b4a 100644
--- a/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h
+++ b/contrib/llvm-project/libcxx/include/__functional/perfect_forward.h
@@ -40,57 +40,59 @@ private:
tuple<_BoundArgs...> __bound_args_;
public:
- template <class... _Args, class = enable_if_t<
- is_constructible_v<tuple<_BoundArgs...>, _Args&&...>
- >>
+ template <class... _Args, class = enable_if_t< is_constructible_v<tuple<_BoundArgs...>, _Args&&...> >>
_LIBCPP_HIDE_FROM_ABI explicit constexpr __perfect_forward_impl(_Args&&... __bound_args)
- : __bound_args_(std::forward<_Args>(__bound_args)...) {}
+ : __bound_args_(std::forward<_Args>(__bound_args)...) {}
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default;
_LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &
- noexcept(noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & noexcept(
+ noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
auto operator()(_Args&&...) & = delete;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&
- noexcept(noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& noexcept(
+ noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
auto operator()(_Args&&...) const& = delete;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &&
- noexcept(noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) && noexcept(
+ noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs..., _Args...>>>
auto operator()(_Args&&...) && = delete;
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&&
- noexcept(noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
- -> decltype( _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...))
- { return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&& noexcept(
+ noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
+ -> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
+ return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
+ }
template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
auto operator()(_Args&&...) const&& = delete;
};
// __perfect_forward implements a perfect-forwarding call wrapper as explained in [func.require].
-template <class _Op, class ..._Args>
+template <class _Op, class... _Args>
using __perfect_forward = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>;
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h b/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h
index 88e6db222e07..51a7c3fe0fc0 100644
--- a/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/pointer_to_binary_function.h
@@ -23,21 +23,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg1, class _Arg2, class _Result>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function
- : public __binary_function<_Arg1, _Arg2, _Result>
-{
- _Result (*__f_)(_Arg1, _Arg2);
+ : public __binary_function<_Arg1, _Arg2, _Result> {
+ _Result (*__f_)(_Arg1, _Arg2);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2))
- : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg1 __x, _Arg2 __y) const
- {return __f_(__x, __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2)) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg1 __x, _Arg2 __y) const { return __f_(__x, __y); }
};
template <class _Arg1, class _Arg2, class _Result>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-pointer_to_binary_function<_Arg1,_Arg2,_Result>
-ptr_fun(_Result (*__f)(_Arg1,_Arg2))
- {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_binary_function<_Arg1, _Arg2, _Result>
+ptr_fun(_Result (*__f)(_Arg1, _Arg2)) {
+ return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f);
+}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h b/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h
index ee13acfff757..0338e7671789 100644
--- a/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/pointer_to_unary_function.h
@@ -23,21 +23,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function
- : public __unary_function<_Arg, _Result>
-{
- _Result (*__f_)(_Arg);
+ : public __unary_function<_Arg, _Result> {
+ _Result (*__f_)(_Arg);
+
public:
- _LIBCPP_HIDE_FROM_ABI explicit pointer_to_unary_function(_Result (*__f)(_Arg))
- : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg __x) const
- {return __f_(__x);}
+ _LIBCPP_HIDE_FROM_ABI explicit pointer_to_unary_function(_Result (*__f)(_Arg)) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg __x) const { return __f_(__x); }
};
template <class _Arg, class _Result>
-_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI
-pointer_to_unary_function<_Arg,_Result>
-ptr_fun(_Result (*__f)(_Arg))
- {return pointer_to_unary_function<_Arg,_Result>(__f);}
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_unary_function<_Arg, _Result>
+ptr_fun(_Result (*__f)(_Arg)) {
+ return pointer_to_unary_function<_Arg, _Result>(__f);
+}
#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h b/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h
index 0ed631d8a74b..38b28018049e 100644
--- a/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h
+++ b/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h
@@ -29,8 +29,8 @@ namespace ranges {
struct equal_to {
template <class _Tp, class _Up>
- requires equality_comparable_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires equality_comparable_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))) {
return std::forward<_Tp>(__t) == std::forward<_Up>(__u);
}
@@ -40,8 +40,8 @@ struct equal_to {
struct not_equal_to {
template <class _Tp, class _Up>
- requires equality_comparable_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires equality_comparable_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(!(std::forward<_Tp>(__t) == std::forward<_Up>(__u))))) {
return !(std::forward<_Tp>(__t) == std::forward<_Up>(__u));
}
@@ -51,8 +51,8 @@ struct not_equal_to {
struct less {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))) {
return std::forward<_Tp>(__t) < std::forward<_Up>(__u);
}
@@ -62,8 +62,8 @@ struct less {
struct less_equal {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(!(std::forward<_Up>(__u) < std::forward<_Tp>(__t))))) {
return !(std::forward<_Up>(__u) < std::forward<_Tp>(__t));
}
@@ -73,8 +73,8 @@ struct less_equal {
struct greater {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(std::forward<_Up>(__u) < std::forward<_Tp>(__t)))) {
return std::forward<_Up>(__u) < std::forward<_Tp>(__t);
}
@@ -84,8 +84,8 @@ struct greater {
struct greater_equal {
template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const
+ requires totally_ordered_with<_Tp, _Up>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
noexcept(noexcept(bool(!(std::forward<_Tp>(__t) < std::forward<_Up>(__u))))) {
return !(std::forward<_Tp>(__t) < std::forward<_Up>(__u));
}
diff --git a/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h b/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h
index 3688590d10d1..54de06a8879c 100644
--- a/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h
+++ b/contrib/llvm-project/libcxx/include/__functional/reference_wrapper.h
@@ -26,44 +26,43 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp>
-{
+class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp> {
public:
- // types
- typedef _Tp type;
+ // types
+ typedef _Tp type;
+
private:
- type* __f_;
+ type* __f_;
- static void __fun(_Tp&) _NOEXCEPT;
- static void __fun(_Tp&&) = delete;
+ static void __fun(_Tp&) _NOEXCEPT;
+ static void __fun(_Tp&&) = delete;
public:
- template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
- type& __f = static_cast<_Up&&>(__u);
- __f_ = std::addressof(__f);
- }
-
- // access
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- operator type&() const _NOEXCEPT {return *__f_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- type& get() const _NOEXCEPT {return *__f_;}
-
- // invoke
- template <class... _ArgTypes>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __invoke_of<type&, _ArgTypes...>::type
- operator() (_ArgTypes&&... __args) const
+ template <
+ class _Up,
+ class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper(_Up&& __u)
+ _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
+ type& __f = static_cast<_Up&&>(__u);
+ __f_ = std::addressof(__f);
+ }
+
+ // access
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator type&() const _NOEXCEPT { return *__f_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 type& get() const _NOEXCEPT { return *__f_; }
+
+ // invoke
+ template <class... _ArgTypes>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<type&, _ArgTypes...>::type
+ operator()(_ArgTypes&&... __args) const
#if _LIBCPP_STD_VER >= 17
- // Since is_nothrow_invocable requires C++17 LWG3764 is not backported
- // to earlier versions.
- noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>)
+ // Since is_nothrow_invocable requires C++17 LWG3764 is not backported
+ // to earlier versions.
+ noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>)
#endif
- {
- return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
- }
+ {
+ return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
+ }
};
#if _LIBCPP_STD_VER >= 17
@@ -72,39 +71,31 @@ reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
#endif
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<_Tp>
-ref(_Tp& __t) _NOEXCEPT
-{
- return reference_wrapper<_Tp>(__t);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp> ref(_Tp& __t) _NOEXCEPT {
+ return reference_wrapper<_Tp>(__t);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<_Tp>
-ref(reference_wrapper<_Tp> __t) _NOEXCEPT
-{
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp>
+ref(reference_wrapper<_Tp> __t) _NOEXCEPT {
+ return __t;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<const _Tp>
-cref(const _Tp& __t) _NOEXCEPT
-{
- return reference_wrapper<const _Tp>(__t);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp> cref(const _Tp& __t) _NOEXCEPT {
+ return reference_wrapper<const _Tp>(__t);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-reference_wrapper<const _Tp>
-cref(reference_wrapper<_Tp> __t) _NOEXCEPT
-{
- return __t;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<const _Tp>
+cref(reference_wrapper<_Tp> __t) _NOEXCEPT {
+ return __t;
}
-template <class _Tp> void ref(const _Tp&&) = delete;
-template <class _Tp> void cref(const _Tp&&) = delete;
+template <class _Tp>
+void ref(const _Tp&&) = delete;
+template <class _Tp>
+void cref(const _Tp&&) = delete;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__functional/unary_function.h b/contrib/llvm-project/libcxx/include/__functional/unary_function.h
index f07cac175a99..69b1bc94220a 100644
--- a/contrib/llvm-project/libcxx/include/__functional/unary_function.h
+++ b/contrib/llvm-project/libcxx/include/__functional/unary_function.h
@@ -20,18 +20,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
template <class _Arg, class _Result>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function
-{
- typedef _Arg argument_type;
- typedef _Result result_type;
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function {
+ typedef _Arg argument_type;
+ typedef _Result result_type;
};
#endif // _LIBCPP_STD_VER <= 14
-template <class _Arg, class _Result> struct __unary_function_keep_layout_base {
+template <class _Arg, class _Result>
+struct __unary_function_keep_layout_base {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg;
- using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
+ using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
#endif
};
diff --git a/contrib/llvm-project/libcxx/include/__functional/unary_negate.h b/contrib/llvm-project/libcxx/include/__functional/unary_negate.h
index b2eed8e2db35..d130b7d728a2 100644
--- a/contrib/llvm-project/libcxx/include/__functional/unary_negate.h
+++ b/contrib/llvm-project/libcxx/include/__functional/unary_negate.h
@@ -23,22 +23,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Predicate>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
- : public __unary_function<typename _Predicate::argument_type, bool>
-{
- _Predicate __pred_;
+ : public __unary_function<typename _Predicate::argument_type, bool> {
+ _Predicate __pred_;
+
public:
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- explicit unary_negate(const _Predicate& __pred)
- : __pred_(__pred) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Predicate::argument_type& __x) const
- {return !__pred_(__x);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI explicit unary_negate(const _Predicate& __pred)
+ : __pred_(__pred) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const typename _Predicate::argument_type& __x) const {
+ return !__pred_(__x);
+ }
};
template <class _Predicate>
-_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-unary_negate<_Predicate>
-not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI unary_negate<_Predicate>
+not1(const _Predicate& __pred) {
+ return unary_negate<_Predicate>(__pred);
+}
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
diff --git a/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h b/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h
index da6fe54bfae7..ad7a8395186c 100644
--- a/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h
+++ b/contrib/llvm-project/libcxx/include/__functional/weak_result_type.h
@@ -25,268 +25,205 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __has_result_type
-{
+struct __has_result_type {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::result_type* = 0);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::result_type* = 0);
+
public:
- static const bool value = decltype(__test<_Tp>(0))::value;
+ static const bool value = decltype(__test<_Tp>(0))::value;
};
// __weak_result_type
template <class _Tp>
-struct __derives_from_unary_function
-{
+struct __derives_from_unary_function {
private:
- struct __two {char __lx; char __lxx;};
- static __two __test(...);
- template <class _Ap, class _Rp>
- static __unary_function<_Ap, _Rp>
- __test(const volatile __unary_function<_Ap, _Rp>*);
+ struct __two {
+ char __lx;
+ char __lxx;
+ };
+ static __two __test(...);
+ template <class _Ap, class _Rp>
+ static __unary_function<_Ap, _Rp> __test(const volatile __unary_function<_Ap, _Rp>*);
public:
- static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
- typedef decltype(__test((_Tp*)0)) type;
+ static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
+ typedef decltype(__test((_Tp*)0)) type;
};
template <class _Tp>
-struct __derives_from_binary_function
-{
+struct __derives_from_binary_function {
private:
- struct __two {char __lx; char __lxx;};
- static __two __test(...);
- template <class _A1, class _A2, class _Rp>
- static __binary_function<_A1, _A2, _Rp>
- __test(const volatile __binary_function<_A1, _A2, _Rp>*);
+ struct __two {
+ char __lx;
+ char __lxx;
+ };
+ static __two __test(...);
+ template <class _A1, class _A2, class _Rp>
+ static __binary_function<_A1, _A2, _Rp> __test(const volatile __binary_function<_A1, _A2, _Rp>*);
public:
- static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
- typedef decltype(__test((_Tp*)0)) type;
+ static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
+ typedef decltype(__test((_Tp*)0)) type;
};
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
-struct __maybe_derive_from_unary_function // bool is true
- : public __derives_from_unary_function<_Tp>::type
-{
-};
+struct __maybe_derive_from_unary_function // bool is true
+ : public __derives_from_unary_function<_Tp>::type {};
template <class _Tp>
-struct __maybe_derive_from_unary_function<_Tp, false>
-{
-};
+struct __maybe_derive_from_unary_function<_Tp, false> {};
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
-struct __maybe_derive_from_binary_function // bool is true
- : public __derives_from_binary_function<_Tp>::type
-{
-};
+struct __maybe_derive_from_binary_function // bool is true
+ : public __derives_from_binary_function<_Tp>::type {};
template <class _Tp>
-struct __maybe_derive_from_binary_function<_Tp, false>
-{
-};
+struct __maybe_derive_from_binary_function<_Tp, false> {};
template <class _Tp, bool = __has_result_type<_Tp>::value>
struct __weak_result_type_imp // bool is true
: public __maybe_derive_from_unary_function<_Tp>,
- public __maybe_derive_from_binary_function<_Tp>
-{
+ public __maybe_derive_from_binary_function<_Tp> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type;
#endif
};
template <class _Tp>
struct __weak_result_type_imp<_Tp, false>
- : public __maybe_derive_from_unary_function<_Tp>,
- public __maybe_derive_from_binary_function<_Tp>
-{
-};
+ : public __maybe_derive_from_unary_function<_Tp>, public __maybe_derive_from_binary_function<_Tp> {};
template <class _Tp>
-struct __weak_result_type
- : public __weak_result_type_imp<_Tp>
-{
-};
+struct __weak_result_type : public __weak_result_type_imp<_Tp> {};
// 0 argument case
template <class _Rp>
-struct __weak_result_type<_Rp ()>
-{
+struct __weak_result_type<_Rp()> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
template <class _Rp>
-struct __weak_result_type<_Rp (&)()>
-{
+struct __weak_result_type<_Rp (&)()> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
template <class _Rp>
-struct __weak_result_type<_Rp (*)()>
-{
+struct __weak_result_type<_Rp (*)()> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
// 1 argument case
template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp(_A1)> : public __unary_function<_A1, _Rp> {};
template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (&)(_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (&)(_A1)> : public __unary_function<_A1, _Rp> {};
template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (*)(_A1)>
- : public __unary_function<_A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (*)(_A1)> : public __unary_function<_A1, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)()>
- : public __unary_function<_Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)()> : public __unary_function<_Cp*, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() const>
- : public __unary_function<const _Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)() const> : public __unary_function<const _Cp*, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() volatile>
- : public __unary_function<volatile _Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)() volatile> : public __unary_function<volatile _Cp*, _Rp> {};
template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() const volatile>
- : public __unary_function<const volatile _Cp*, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)() const volatile> : public __unary_function<const volatile _Cp*, _Rp> {};
// 2 argument case
template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+struct __weak_result_type<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (*)(_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+struct __weak_result_type<_Rp (*)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (&)(_A1, _A2)>
- : public __binary_function<_A1, _A2, _Rp>
-{
-};
+struct __weak_result_type<_Rp (&)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1)>
- : public __binary_function<_Cp*, _A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)(_A1)> : public __binary_function<_Cp*, _A1, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
- : public __binary_function<const _Cp*, _A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const> : public __binary_function<const _Cp*, _A1, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
- : public __binary_function<volatile _Cp*, _A1, _Rp>
-{
-};
+struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> : public __binary_function<volatile _Cp*, _A1, _Rp> {};
template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
- : public __binary_function<const volatile _Cp*, _A1, _Rp>
-{
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> : public __binary_function<const volatile _Cp*, _A1, _Rp> {
};
// 3 or more arguments
-template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
-{
+template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
+struct __weak_result_type<_Rp(_A1, _A2, _A3, _A4...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
-{
+template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
+struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
-{
+template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
+struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
-{
+template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
+ using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp;
#endif
};
-template <class _Tp, class ..._Args>
-struct __invoke_return
-{
- typedef decltype(std::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type;
+template <class _Tp, class... _Args>
+struct __invoke_return {
+ typedef decltype(std::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__fwd/get.h b/contrib/llvm-project/libcxx/include/__fwd/get.h
index 1ca7148e3fa2..e7261b826953 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/get.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/get.h
@@ -26,70 +26,54 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT;
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT;
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
-template <size_t _Ip, class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+template <size_t _Ip, class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(const tuple<_Tp...>&&) _NOEXCEPT;
#endif //_LIBCPP_CXX03_LANG
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT;
#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(const pair<_T1, _T2>&&) _NOEXCEPT;
#endif
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&
-get(array<_Tp, _Size>&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-get(const array<_Tp, _Size>&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT;
#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&&
-get(array<_Tp, _Size>&&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&&
-get(const array<_Tp, _Size>&&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT;
#endif
#if _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__fwd/span.h b/contrib/llvm-project/libcxx/include/__fwd/span.h
index e9fa70382f59..8dafa742c19d 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/span.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/span.h
@@ -26,7 +26,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
-template <typename _Tp, size_t _Extent = dynamic_extent> class span;
+template <typename _Tp, size_t _Extent = dynamic_extent>
+class span;
#endif
diff --git a/contrib/llvm-project/libcxx/include/__fwd/string_view.h b/contrib/llvm-project/libcxx/include/__fwd/string_view.h
index 786765ca6a2e..72a64be5b00b 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/string_view.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/string_view.h
@@ -19,17 +19,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _CharT, class _Traits = char_traits<_CharT> >
+template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS basic_string_view;
-typedef basic_string_view<char> string_view;
+typedef basic_string_view<char> string_view;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
-typedef basic_string_view<char8_t> u8string_view;
+typedef basic_string_view<char8_t> u8string_view;
#endif
typedef basic_string_view<char16_t> u16string_view;
typedef basic_string_view<char32_t> u32string_view;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef basic_string_view<wchar_t> wstring_view;
+typedef basic_string_view<wchar_t> wstring_view;
#endif
// clang-format off
diff --git a/contrib/llvm-project/libcxx/include/__fwd/subrange.h b/contrib/llvm-project/libcxx/include/__fwd/subrange.h
index 24db670575f4..d09b9b1c5b97 100644
--- a/contrib/llvm-project/libcxx/include/__fwd/subrange.h
+++ b/contrib/llvm-project/libcxx/include/__fwd/subrange.h
@@ -17,7 +17,7 @@
#if _LIBCPP_STD_VER >= 20
-#include <__iterator/concepts.h>
+# include <__iterator/concepts.h>
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__hash_table b/contrib/llvm-project/libcxx/include/__hash_table
index fa950ac7e9b7..3cee48ef8538 100644
--- a/contrib/llvm-project/libcxx/include/__hash_table
+++ b/contrib/llvm-project/libcxx/include/__hash_table
@@ -55,7 +55,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Tp>
@@ -67,7 +66,7 @@ struct __is_hash_value_type_imp : false_type {};
template <class _Key, class _Value>
struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value> > : true_type {};
-template <class ..._Args>
+template <class... _Args>
struct __is_hash_value_type : false_type {};
template <class _One>
@@ -76,110 +75,91 @@ struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__remove_cvref_t<_O
_LIBCPP_EXPORTED_FROM_ABI size_t __next_prime(size_t __n);
template <class _NodePtr>
-struct __hash_node_base
-{
- typedef typename pointer_traits<_NodePtr>::element_type __node_type;
- typedef __hash_node_base __first_node;
- typedef __rebind_pointer_t<_NodePtr, __first_node> __node_base_pointer;
- typedef _NodePtr __node_pointer;
+struct __hash_node_base {
+ typedef typename pointer_traits<_NodePtr>::element_type __node_type;
+ typedef __hash_node_base __first_node;
+ typedef __rebind_pointer_t<_NodePtr, __first_node> __node_base_pointer;
+ typedef _NodePtr __node_pointer;
#if defined(_LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB)
typedef __node_base_pointer __next_pointer;
#else
- typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer;
+ typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer;
#endif
- __next_pointer __next_;
+ __next_pointer __next_;
- _LIBCPP_HIDE_FROM_ABI
- __next_pointer __ptr() _NOEXCEPT {
- return static_cast<__next_pointer>(
- pointer_traits<__node_base_pointer>::pointer_to(*this));
- }
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __ptr() _NOEXCEPT {
+ return static_cast<__next_pointer>(pointer_traits<__node_base_pointer>::pointer_to(*this));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __upcast() _NOEXCEPT {
- return static_cast<__node_pointer>(
- pointer_traits<__node_base_pointer>::pointer_to(*this));
- }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __upcast() _NOEXCEPT {
+ return static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::pointer_to(*this));
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash() const _NOEXCEPT {
- return static_cast<__node_type const&>(*this).__hash_;
- }
+ _LIBCPP_HIDE_FROM_ABI size_t __hash() const _NOEXCEPT { return static_cast<__node_type const&>(*this).__hash_; }
- _LIBCPP_HIDE_FROM_ABI __hash_node_base() _NOEXCEPT : __next_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI explicit __hash_node_base(__next_pointer __next) _NOEXCEPT : __next_(__next) {}
+ _LIBCPP_HIDE_FROM_ABI __hash_node_base() _NOEXCEPT : __next_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_node_base(__next_pointer __next) _NOEXCEPT : __next_(__next) {}
};
template <class _Tp, class _VoidPtr>
-struct __hash_node
- : public __hash_node_base
- <
- __rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> >
- >
-{
- typedef _Tp __node_value_type;
- using _Base = __hash_node_base<__rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > >;
- using __next_pointer = typename _Base::__next_pointer;
+struct __hash_node : public __hash_node_base< __rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > > {
+ typedef _Tp __node_value_type;
+ using _Base = __hash_node_base<__rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > >;
+ using __next_pointer = typename _Base::__next_pointer;
- size_t __hash_;
+ size_t __hash_;
- // We allow starting the lifetime of nodes without initializing the value held by the node,
- // since that is handled by the hash table itself in order to be allocator-aware.
+ // We allow starting the lifetime of nodes without initializing the value held by the node,
+ // since that is handled by the hash table itself in order to be allocator-aware.
#ifndef _LIBCPP_CXX03_LANG
+
private:
- union {
- _Tp __value_;
- };
+ union {
+ _Tp __value_;
+ };
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
#else
+
private:
- _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
+ _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() {
- return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_));
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_)); }
#endif
- _LIBCPP_HIDE_FROM_ABI explicit __hash_node(__next_pointer __next, size_t __hash) : _Base(__next), __hash_(__hash) {}
- _LIBCPP_HIDE_FROM_ABI ~__hash_node() {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_node(__next_pointer __next, size_t __hash) : _Base(__next), __hash_(__hash) {}
+ _LIBCPP_HIDE_FROM_ABI ~__hash_node() {}
};
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-__is_hash_power2(size_t __bc)
-{
- return __bc > 2 && !(__bc & (__bc - 1));
-}
+inline _LIBCPP_HIDE_FROM_ABI bool __is_hash_power2(size_t __bc) { return __bc > 2 && !(__bc & (__bc - 1)); }
-inline _LIBCPP_HIDE_FROM_ABI
-size_t
-__constrain_hash(size_t __h, size_t __bc)
-{
- return !(__bc & (__bc - 1)) ? __h & (__bc - 1) :
- (__h < __bc ? __h : __h % __bc);
+inline _LIBCPP_HIDE_FROM_ABI size_t __constrain_hash(size_t __h, size_t __bc) {
+ return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : (__h < __bc ? __h : __h % __bc);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t
-__next_hash_pow2(size_t __n)
-{
- return __n < 2 ? __n : (size_t(1) << (numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
+inline _LIBCPP_HIDE_FROM_ABI size_t __next_hash_pow2(size_t __n) {
+ return __n < 2 ? __n : (size_t(1) << (numeric_limits<size_t>::digits - __libcpp_clz(__n - 1)));
}
+template <class _Tp, class _Hash, class _Equal, class _Alloc>
+class __hash_table;
-template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
-
-template <class _NodePtr> class _LIBCPP_TEMPLATE_VIS __hash_iterator;
-template <class _ConstNodePtr> class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
-template <class _NodePtr> class _LIBCPP_TEMPLATE_VIS __hash_local_iterator;
-template <class _ConstNodePtr> class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
-template <class _HashIterator> class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
-template <class _HashIterator> class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+template <class _NodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_iterator;
+template <class _ConstNodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+template <class _NodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_local_iterator;
+template <class _ConstNodePtr>
+class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+template <class _HashIterator>
+class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
+template <class _HashIterator>
+class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
template <class _Tp>
struct __hash_key_value_types {
@@ -189,73 +169,47 @@ struct __hash_key_value_types {
typedef _Tp __container_value_type;
static const bool __is_map = false;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const& __get_key(_Tp const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const& __get_value(__node_value_type const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
- return std::addressof(__n);
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type&& __move(__node_value_type& __v) {
- return std::move(__v);
- }
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(_Tp const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(__node_value_type const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) { return std::addressof(__n); }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type&& __move(__node_value_type& __v) { return std::move(__v); }
};
template <class _Key, class _Tp>
struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __hash_value_type<_Key, _Tp> __node_value_type;
- typedef pair<const _Key, _Tp> __container_value_type;
- typedef __container_value_type __map_value_type;
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __hash_value_type<_Key, _Tp> __node_value_type;
+ typedef pair<const _Key, _Tp> __container_value_type;
+ typedef __container_value_type __map_value_type;
static const bool __is_map = true;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const& __get_key(__container_value_type const& __v) {
- return __v.first;
- }
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(__container_value_type const& __v) { return __v.first; }
template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __node_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const&
- __get_value(_Up& __t) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
return __t.__get_value();
}
template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const&
- __get_value(_Up& __t) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
return __t;
}
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) {
return std::addressof(__n.__get_value());
}
- _LIBCPP_HIDE_FROM_ABI
- static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
- return __v.__move();
- }
+ _LIBCPP_HIDE_FROM_ABI static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { return __v.__move(); }
};
-template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>,
- bool = _KVTypes::__is_map>
+template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>, bool = _KVTypes::__is_map>
struct __hash_map_pointer_types {};
template <class _Tp, class _AllocPtr, class _KVTypes>
struct __hash_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> {
- typedef typename _KVTypes::__map_value_type _Mv;
- typedef __rebind_pointer_t<_AllocPtr, _Mv>
- __map_value_type_pointer;
- typedef __rebind_pointer_t<_AllocPtr, const _Mv>
- __const_map_value_type_pointer;
+ typedef typename _KVTypes::__map_value_type _Mv;
+ typedef __rebind_pointer_t<_AllocPtr, _Mv> __map_value_type_pointer;
+ typedef __rebind_pointer_t<_AllocPtr, const _Mv> __const_map_value_type_pointer;
};
template <class _NodePtr, class _NodeT = typename pointer_traits<_NodePtr>::element_type>
@@ -263,39 +217,36 @@ struct __hash_node_types;
template <class _NodePtr, class _Tp, class _VoidPtr>
struct __hash_node_types<_NodePtr, __hash_node<_Tp, _VoidPtr> >
- : public __hash_key_value_types<_Tp>, __hash_map_pointer_types<_Tp, _VoidPtr>
+ : public __hash_key_value_types<_Tp>,
+ __hash_map_pointer_types<_Tp, _VoidPtr>
{
- typedef __hash_key_value_types<_Tp> __base;
+ typedef __hash_key_value_types<_Tp> __base;
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
- typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
+ typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
- typedef typename pointer_traits<_NodePtr>::element_type __node_type;
- typedef _NodePtr __node_pointer;
+ typedef typename pointer_traits<_NodePtr>::element_type __node_type;
+ typedef _NodePtr __node_pointer;
- typedef __hash_node_base<__node_pointer> __node_base_type;
- typedef __rebind_pointer_t<_NodePtr, __node_base_type>
- __node_base_pointer;
+ typedef __hash_node_base<__node_pointer> __node_base_type;
+ typedef __rebind_pointer_t<_NodePtr, __node_base_type> __node_base_pointer;
- typedef typename __node_base_type::__next_pointer __next_pointer;
+ typedef typename __node_base_type::__next_pointer __next_pointer;
- typedef _Tp __node_value_type;
- typedef __rebind_pointer_t<_VoidPtr, __node_value_type>
- __node_value_type_pointer;
- typedef __rebind_pointer_t<_VoidPtr, const __node_value_type>
- __const_node_value_type_pointer;
+ typedef _Tp __node_value_type;
+ typedef __rebind_pointer_t<_VoidPtr, __node_value_type> __node_value_type_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> __const_node_value_type_pointer;
private:
- static_assert(!is_const<__node_type>::value,
- "_NodePtr should never be a pointer to const");
- static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
- "_VoidPtr does not point to unqualified void type");
- static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>,
- _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr.");
+ static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
+ static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
+ "_VoidPtr does not point to unqualified void type");
+ static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value),
+ "_VoidPtr does not rebind to _NodePtr.");
};
template <class _HashIterator>
@@ -309,7 +260,6 @@ struct __hash_node_types_from_iterator<__hash_local_iterator<_NodePtr> > : __has
template <class _NodePtr>
struct __hash_node_types_from_iterator<__hash_const_local_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {};
-
template <class _NodeValueTp, class _VoidPtr>
struct __make_hash_node_types {
typedef __hash_node<_NodeValueTp, _VoidPtr> _NodeTp;
@@ -318,394 +268,327 @@ struct __make_hash_node_types {
};
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_iterator
-{
- typedef __hash_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+class _LIBCPP_TEMPLATE_VIS __hash_iterator {
+ typedef __hash_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- __next_pointer __node_;
+ __next_pointer __node_;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__node_value_type_pointer pointer;
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_iterator& operator++() {
- __node_ = __node_->__next_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_iterator& operator++() {
+ __node_ = __node_->__next_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_iterator operator++(int)
- {
- __hash_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_iterator operator++(int) {
+ __hash_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_iterator& __x, const __hash_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_iterator(__next_pointer __node) _NOEXCEPT
- : __node_(__node)
- {
- }
-
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_iterator(__next_pointer __node) _NOEXCEPT : __node_(__node) {}
+
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
};
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_const_iterator
-{
- static_assert(!is_const<typename pointer_traits<_NodePtr>::element_type>::value, "");
- typedef __hash_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+class _LIBCPP_TEMPLATE_VIS __hash_const_iterator {
+ static_assert(!is_const<typename pointer_traits<_NodePtr>::element_type>::value, "");
+ typedef __hash_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- __next_pointer __node_;
+ __next_pointer __node_;
public:
- typedef __hash_iterator<_NodePtr> __non_const_iterator;
-
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
+ typedef __hash_iterator<_NodePtr> __non_const_iterator;
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
- : __node_(__x.__node_)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT : __node_(__x.__node_) {}
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_iterator& operator++() {
- __node_ = __node_->__next_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator& operator++() {
+ __node_ = __node_->__next_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_iterator operator++(int)
- {
- __hash_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_iterator operator++(int) {
+ __hash_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_const_iterator(__next_pointer __node) _NOEXCEPT
- : __node_(__node)
- {
- }
-
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_const_iterator(__next_pointer __node) _NOEXCEPT : __node_(__node) {}
+
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
};
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_local_iterator
-{
- typedef __hash_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+class _LIBCPP_TEMPLATE_VIS __hash_local_iterator {
+ typedef __hash_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- __next_pointer __node_;
- size_t __bucket_;
- size_t __bucket_count_;
+ __next_pointer __node_;
+ size_t __bucket_;
+ size_t __bucket_count_;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__node_value_type_pointer pointer;
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_local_iterator& operator++() {
- __node_ = __node_->__next_;
- if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
- __node_ = nullptr;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_local_iterator& operator++() {
+ __node_ = __node_->__next_;
+ if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
+ __node_ = nullptr;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_local_iterator operator++(int)
- {
- __hash_local_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_local_iterator operator++(int) {
+ __hash_local_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_local_iterator(__next_pointer __node, size_t __bucket,
- size_t __bucket_count) _NOEXCEPT
- : __node_(__node),
- __bucket_(__bucket),
- __bucket_count_(__bucket_count)
- {
- if (__node_ != nullptr)
- __node_ = __node_->__next_;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_local_iterator(
+ __next_pointer __node, size_t __bucket, size_t __bucket_count) _NOEXCEPT
+ : __node_(__node),
+ __bucket_(__bucket),
+ __bucket_count_(__bucket_count) {
+ if (__node_ != nullptr)
+ __node_ = __node_->__next_;
+ }
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
};
template <class _ConstNodePtr>
-class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator
-{
- typedef __hash_node_types<_ConstNodePtr> _NodeTypes;
- typedef _ConstNodePtr __node_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
-
- __next_pointer __node_;
- size_t __bucket_;
- size_t __bucket_count_;
-
- typedef pointer_traits<__node_pointer> __pointer_traits;
- typedef typename __pointer_traits::element_type __node;
- typedef __remove_const_t<__node> __non_const_node;
- typedef __rebind_pointer_t<__node_pointer, __non_const_node>
- __non_const_node_pointer;
-public:
- typedef __hash_local_iterator<__non_const_node_pointer>
- __non_const_iterator;
+class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator {
+ typedef __hash_node_types<_ConstNodePtr> _NodeTypes;
+ typedef _ConstNodePtr __node_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__node_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
+ __next_pointer __node_;
+ size_t __bucket_;
+ size_t __bucket_count_;
+ typedef pointer_traits<__node_pointer> __pointer_traits;
+ typedef typename __pointer_traits::element_type __node;
+ typedef __remove_const_t<__node> __non_const_node;
+ typedef __rebind_pointer_t<__node_pointer, __non_const_node> __non_const_node_pointer;
- _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
- }
+public:
+ typedef __hash_local_iterator<__non_const_node_pointer> __non_const_iterator;
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_local_iterator(const __non_const_iterator& __x) _NOEXCEPT
- : __node_(__x.__node_),
- __bucket_(__x.__bucket_),
- __bucket_count_(__x.__bucket_count_)
- {
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__node_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {
- return __node_->__upcast()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator(const __non_const_iterator& __x) _NOEXCEPT
+ : __node_(__x.__node_),
+ __bucket_(__x.__bucket_),
+ __bucket_count_(__x.__bucket_count_) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_local_iterator& operator++() {
- __node_ = __node_->__next_;
- if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
- __node_ = nullptr;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI
- __hash_const_local_iterator operator++(int)
- {
- __hash_const_local_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
- {
- return __x.__node_ == __y.__node_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator& operator++() {
+ __node_ = __node_->__next_;
+ if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
+ __node_ = nullptr;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator operator++(int) {
+ __hash_const_local_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) {
+ return __x.__node_ == __y.__node_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket,
- size_t __bucket_count) _NOEXCEPT
- : __node_(__node_ptr),
- __bucket_(__bucket),
- __bucket_count_(__bucket_count)
- {
- if (__node_ != nullptr)
- __node_ = __node_->__next_;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_const_local_iterator(
+ __next_pointer __node_ptr, size_t __bucket, size_t __bucket_count) _NOEXCEPT
+ : __node_(__node_ptr),
+ __bucket_(__bucket),
+ __bucket_count_(__bucket_count) {
+ if (__node_ != nullptr)
+ __node_ = __node_->__next_;
+ }
- template <class, class, class, class> friend class __hash_table;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ template <class, class, class, class>
+ friend class __hash_table;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
};
template <class _Alloc>
-class __bucket_list_deallocator
-{
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
+class __bucket_list_deallocator {
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+
+ __compressed_pair<size_type, allocator_type> __data_;
- __compressed_pair<size_type, allocator_type> __data_;
public:
- typedef typename __alloc_traits::pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __bucket_list_deallocator()
- _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- : __data_(0, __default_init_tag()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __bucket_list_deallocator(const allocator_type& __a, size_type __size)
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
- : __data_(__size, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __bucket_list_deallocator(__bucket_list_deallocator&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
- : __data_(std::move(__x.__data_))
- {
- __x.size() = 0;
- }
+ typedef typename __alloc_traits::pointer pointer;
- _LIBCPP_HIDE_FROM_ABI
- size_type& size() _NOEXCEPT {return __data_.first();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __data_.first();}
+ _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+ : __data_(0, __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- allocator_type& __alloc() _NOEXCEPT {return __data_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const allocator_type& __alloc() const _NOEXCEPT {return __data_.second();}
+ _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(const allocator_type& __a, size_type __size)
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+ : __data_(__size, __a) {}
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- __alloc_traits::deallocate(__alloc(), __p, size());
- }
+ _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(__bucket_list_deallocator&& __x)
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+ : __data_(std::move(__x.__data_)) {
+ __x.size() = 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __data_.first(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __data_.first(); }
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __data_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __data_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT { __alloc_traits::deallocate(__alloc(), __p, size()); }
};
-template <class _Alloc> class __hash_map_node_destructor;
+template <class _Alloc>
+class __hash_map_node_destructor;
template <class _Alloc>
-class __hash_node_destructor
-{
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __hash_node_destructor {
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
- typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::pointer pointer;
+
private:
- typedef __hash_node_types<pointer> _NodeTypes;
+ typedef __hash_node_types<pointer> _NodeTypes;
- allocator_type& __na_;
+ allocator_type& __na_;
public:
- bool __value_constructed;
-
- _LIBCPP_HIDE_FROM_ABI __hash_node_destructor(__hash_node_destructor const&) = default;
- _LIBCPP_HIDE_FROM_ABI __hash_node_destructor& operator=(const __hash_node_destructor&) = delete;
+ bool __value_constructed;
+ _LIBCPP_HIDE_FROM_ABI __hash_node_destructor(__hash_node_destructor const&) = default;
+ _LIBCPP_HIDE_FROM_ABI __hash_node_destructor& operator=(const __hash_node_destructor&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_node_destructor(allocator_type& __na,
- bool __constructed = false) _NOEXCEPT
- : __na_(__na),
- __value_constructed(__constructed)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_node_destructor(allocator_type& __na, bool __constructed = false) _NOEXCEPT
+ : __na_(__na),
+ __value_constructed(__constructed) {}
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__value_constructed) {
- __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__get_value()));
- std::__destroy_at(std::addressof(*__p));
- }
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__value_constructed) {
+ __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__get_value()));
+ std::__destroy_at(std::addressof(*__p));
}
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
- template <class> friend class __hash_map_node_destructor;
+ template <class>
+ friend class __hash_map_node_destructor;
};
#if _LIBCPP_STD_VER >= 17
@@ -713,33 +596,30 @@ template <class _NodeType, class _Alloc>
struct __generic_container_node_destructor;
template <class _Tp, class _VoidPtr, class _Alloc>
-struct __generic_container_node_destructor<__hash_node<_Tp, _VoidPtr>, _Alloc>
- : __hash_node_destructor<_Alloc>
-{
- using __hash_node_destructor<_Alloc>::__hash_node_destructor;
+struct __generic_container_node_destructor<__hash_node<_Tp, _VoidPtr>, _Alloc> : __hash_node_destructor<_Alloc> {
+ using __hash_node_destructor<_Alloc>::__hash_node_destructor;
};
#endif
template <class _Key, class _Hash, class _Equal>
struct __enforce_unordered_container_requirements {
#ifndef _LIBCPP_CXX03_LANG
- static_assert(__check_hash_requirements<_Key, _Hash>::value,
- "the specified hash does not meet the Hash requirements");
- static_assert(is_copy_constructible<_Equal>::value,
- "the specified comparator is required to be copy constructible");
+ static_assert(__check_hash_requirements<_Key, _Hash>::value,
+ "the specified hash does not meet the Hash requirements");
+ static_assert(is_copy_constructible<_Equal>::value, "the specified comparator is required to be copy constructible");
#endif
- typedef int type;
+ typedef int type;
};
template <class _Key, class _Hash, class _Equal>
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,
- "the specified comparator type does not provide a viable const call operator")
- _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,
- "the specified hash functor does not provide a viable const call operator")
+_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,
+ "the specified comparator type does not provide a viable const call operator")
+_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,
+ "the specified hash functor does not provide a viable const call operator")
#endif
-typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
-__diagnose_unordered_container_requirements(int);
+ typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
+ __diagnose_unordered_container_requirements(int);
// This dummy overload is used so that the compiler won't emit a spurious
// "no matching function for call to __diagnose_unordered_xxx" diagnostic
@@ -748,890 +628,668 @@ template <class _Key, class _Hash, class _Equal>
int __diagnose_unordered_container_requirements(void*);
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-class __hash_table
-{
+class __hash_table {
public:
- typedef _Tp value_type;
- typedef _Hash hasher;
- typedef _Equal key_equal;
- typedef _Alloc allocator_type;
+ typedef _Tp value_type;
+ typedef _Hash hasher;
+ typedef _Equal key_equal;
+ typedef _Alloc allocator_type;
private:
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename
- __make_hash_node_types<value_type, typename __alloc_traits::void_pointer>::type
- _NodeTypes;
-public:
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __make_hash_node_types<value_type, typename __alloc_traits::void_pointer>::type _NodeTypes;
- typedef typename _NodeTypes::__node_value_type __node_value_type;
- typedef typename _NodeTypes::__container_value_type __container_value_type;
- typedef typename _NodeTypes::key_type key_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
+public:
+ typedef typename _NodeTypes::__node_value_type __node_value_type;
+ typedef typename _NodeTypes::__container_value_type __container_value_type;
+ typedef typename _NodeTypes::key_type key_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
#ifndef _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
- typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::size_type size_type;
#else
- typedef typename _NodeTypes::size_type size_type;
+ typedef typename _NodeTypes::size_type size_type;
#endif
- typedef typename _NodeTypes::difference_type difference_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+
public:
- // Create __node
-
- typedef typename _NodeTypes::__node_type __node;
- typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_traits;
- typedef typename _NodeTypes::__void_pointer __void_pointer;
- typedef typename _NodeTypes::__node_pointer __node_pointer;
- typedef typename _NodeTypes::__node_pointer __node_const_pointer;
- typedef typename _NodeTypes::__node_base_type __first_node;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__next_pointer __next_pointer;
+ // Create __node
+
+ typedef typename _NodeTypes::__node_type __node;
+ typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_traits;
+ typedef typename _NodeTypes::__void_pointer __void_pointer;
+ typedef typename _NodeTypes::__node_pointer __node_pointer;
+ typedef typename _NodeTypes::__node_pointer __node_const_pointer;
+ typedef typename _NodeTypes::__node_base_type __first_node;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__next_pointer __next_pointer;
private:
- // check for sane allocator pointer rebinding semantics. Rebinding the
- // allocator for a new pointer type should be exactly the same as rebinding
- // the pointer using 'pointer_traits'.
- static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
- typedef __rebind_alloc<__node_traits, __first_node> __node_base_allocator;
- typedef allocator_traits<__node_base_allocator> __node_base_traits;
- static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
+ // check for sane allocator pointer rebinding semantics. Rebinding the
+ // allocator for a new pointer type should be exactly the same as rebinding
+ // the pointer using 'pointer_traits'.
+ static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
+ typedef __rebind_alloc<__node_traits, __first_node> __node_base_allocator;
+ typedef allocator_traits<__node_base_allocator> __node_base_traits;
+ static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
private:
+ typedef __rebind_alloc<__node_traits, __next_pointer> __pointer_allocator;
+ typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter;
+ typedef unique_ptr<__next_pointer[], __bucket_list_deleter> __bucket_list;
+ typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
+ typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
+
+ // --- Member data begin ---
+ __bucket_list __bucket_list_;
+ __compressed_pair<__first_node, __node_allocator> __p1_;
+ __compressed_pair<size_type, hasher> __p2_;
+ __compressed_pair<float, key_equal> __p3_;
+ // --- Member data end ---
+
+ _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __p2_.first(); }
- typedef __rebind_alloc<__node_traits, __next_pointer> __pointer_allocator;
- typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter;
- typedef unique_ptr<__next_pointer[], __bucket_list_deleter> __bucket_list;
- typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
- typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
-
- // --- Member data begin ---
- __bucket_list __bucket_list_;
- __compressed_pair<__first_node, __node_allocator> __p1_;
- __compressed_pair<size_type, hasher> __p2_;
- __compressed_pair<float, key_equal> __p3_;
- // --- Member data end ---
-
- _LIBCPP_HIDE_FROM_ABI
- size_type& size() _NOEXCEPT {return __p2_.first();}
public:
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __p2_.first();}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher& hash_function() _NOEXCEPT {return __p2_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const hasher& hash_function() const _NOEXCEPT {return __p2_.second();}
-
- _LIBCPP_HIDE_FROM_ABI
- float& max_load_factor() _NOEXCEPT {return __p3_.first();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __p3_.first();}
-
- _LIBCPP_HIDE_FROM_ABI
- key_equal& key_eq() _NOEXCEPT {return __p3_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const key_equal& key_eq() const _NOEXCEPT {return __p3_.second();}
-
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __node_alloc() _NOEXCEPT {return __p1_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __node_alloc() const _NOEXCEPT
- {return __p1_.second();}
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __p2_.first(); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher& hash_function() _NOEXCEPT { return __p2_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const hasher& hash_function() const _NOEXCEPT { return __p2_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI float& max_load_factor() _NOEXCEPT { return __p3_.first(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __p3_.first(); }
+
+ _LIBCPP_HIDE_FROM_ABI key_equal& key_eq() _NOEXCEPT { return __p3_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const key_equal& key_eq() const _NOEXCEPT { return __p3_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __p1_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __p1_.second(); }
public:
- typedef __hash_iterator<__node_pointer> iterator;
- typedef __hash_const_iterator<__node_pointer> const_iterator;
- typedef __hash_local_iterator<__node_pointer> local_iterator;
- typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_table()
- _NOEXCEPT_(
- is_nothrow_default_constructible<__bucket_list>::value &&
- is_nothrow_default_constructible<__first_node>::value &&
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value);
- _LIBCPP_HIDE_FROM_ABI
- __hash_table(const hasher& __hf, const key_equal& __eql);
- _LIBCPP_HIDE_FROM_ABI __hash_table(const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI explicit __hash_table(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u);
- _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__bucket_list>::value &&
- is_nothrow_move_constructible<__first_node>::value &&
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<hasher>::value &&
- is_nothrow_move_constructible<key_equal>::value);
- _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI ~__hash_table();
-
- _LIBCPP_HIDE_FROM_ABI __hash_table& operator=(const __hash_table& __u);
- _LIBCPP_HIDE_FROM_ABI
- __hash_table& operator=(__hash_table&& __u)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_unique(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {
- return std::min<size_type>(
- __node_traits::max_size(__node_alloc()),
- numeric_limits<difference_type >::max()
- );
- }
+ typedef __hash_iterator<__node_pointer> iterator;
+ typedef __hash_const_iterator<__node_pointer> const_iterator;
+ typedef __hash_local_iterator<__node_pointer> local_iterator;
+ typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_table() _NOEXCEPT_(
+ is_nothrow_default_constructible<__bucket_list>::value&& is_nothrow_default_constructible<__first_node>::value&&
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_default_constructible<hasher>::value&&
+ is_nothrow_default_constructible<key_equal>::value);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const hasher& __hf, const key_equal& __eql);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_table(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(const __hash_table& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u) _NOEXCEPT_(
+ is_nothrow_move_constructible<__bucket_list>::value&& is_nothrow_move_constructible<__first_node>::value&&
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<hasher>::value&&
+ is_nothrow_move_constructible<key_equal>::value);
+ _LIBCPP_HIDE_FROM_ABI __hash_table(__hash_table&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI ~__hash_table();
+
+ _LIBCPP_HIDE_FROM_ABI __hash_table& operator=(const __hash_table& __u);
+ _LIBCPP_HIDE_FROM_ABI __hash_table& operator=(__hash_table&& __u)
+ _NOEXCEPT_(__node_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<__node_allocator>::value&& is_nothrow_move_assignable<hasher>::value&&
+ is_nothrow_move_assignable<key_equal>::value);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_unique(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- __next_pointer __node_insert_multi_prepare(size_t __cp_hash,
- value_type& __cp_val);
- _LIBCPP_HIDE_FROM_ABI
- void __node_insert_multi_perform(__node_pointer __cp,
- __next_pointer __pn) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- __next_pointer __node_insert_unique_prepare(size_t __nd_hash,
- value_type& __nd_val);
- _LIBCPP_HIDE_FROM_ABI
- void __node_insert_unique_perform(__node_pointer __ptr) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __node_insert_multi_prepare(size_t __cp_hash, value_type& __cp_val);
+ _LIBCPP_HIDE_FROM_ABI void __node_insert_multi_perform(__node_pointer __cp, __next_pointer __pn) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __node_insert_unique_prepare(size_t __nd_hash, value_type& __nd_val);
+ _LIBCPP_HIDE_FROM_ABI void __node_insert_unique_perform(__node_pointer __ptr) _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(__node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(const_iterator __p,
- __node_pointer __nd);
-
- template <class _Key, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
-
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Pp&& __x) {
- return __emplace_unique_extract_key(std::forward<_Pp>(__x),
- __can_extract_key<_Pp, key_type>());
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(__node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
- template <class _First, class _Second,
- __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique(_First&& __f, _Second&& __s) {
- return __emplace_unique_key_args(__f, std::forward<_First>(__f),
- std::forward<_Second>(__s));
- }
+ template <class _Key, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Args&&... __args) {
- return __emplace_unique_impl(std::forward<_Args>(__args)...);
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
- return __emplace_unique_impl(std::forward<_Pp>(__x));
- }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
- return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
- }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
- return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Pp&& __x) {
+ return __emplace_unique_extract_key(std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_multi(_Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
+ template <class _First,
+ class _Second,
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_First&& __f, _Second&& __s) {
+ return __emplace_unique_key_args(__f, std::forward<_First>(__f), std::forward<_Second>(__s));
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
+ return __emplace_unique_impl(std::forward<_Args>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __insert_unique(__container_value_type&& __x) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__x), std::move(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
+ return __emplace_unique_impl(std::forward<_Pp>(__x));
+ }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
+ return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
+ }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
+ return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
+ }
- template <class _Pp, class = __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(_Pp&& __x) {
- return __emplace_unique(std::forward<_Pp>(__x));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(_Pp&& __x) {
- return __emplace_multi(std::forward<_Pp>(__x));
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(__container_value_type&& __x) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__x), std::move(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(const_iterator __p, _Pp&& __x) {
- return __emplace_hint_multi(__p, std::forward<_Pp>(__x));
- }
+ template <class _Pp, class = __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(_Pp&& __x) {
+ return __emplace_unique(std::forward<_Pp>(__x));
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(const __container_value_type& __x) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(_Pp&& __x) {
+ return __emplace_multi(std::forward<_Pp>(__x));
+ }
+
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(const_iterator __p, _Pp&& __x) {
+ return __emplace_hint_multi(__p, std::forward<_Pp>(__x));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(const __container_value_type& __x) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
+ }
#if _LIBCPP_STD_VER >= 17
- template <class _NodeHandle, class _InsertReturnType>
- _LIBCPP_HIDE_FROM_ABI
- _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_unique(const_iterator __hint,
- _NodeHandle&& __nh);
- template <class _Table>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_unique(_Table& __source);
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(_NodeHandle&& __nh);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh);
- template <class _Table>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_multi(_Table& __source);
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(key_type const& __key);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(const_iterator __it);
+ template <class _NodeHandle, class _InsertReturnType>
+ _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh);
+ template <class _Table>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(_Table& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&& __nh);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh);
+ template <class _Table>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(_Table& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const& __key);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator __it);
#endif
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash<true>(__n); }
- _LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash<false>(__n); }
- _LIBCPP_HIDE_FROM_ABI void __reserve_unique(size_type __n)
- {
- __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor())));
- }
- _LIBCPP_HIDE_FROM_ABI void __reserve_multi(size_type __n)
- {
- __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor())));
- }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash<true>(__n); }
+ _LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash<false>(__n); }
+ _LIBCPP_HIDE_FROM_ABI void __reserve_unique(size_type __n) {
+ __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor())));
+ }
+ _LIBCPP_HIDE_FROM_ABI void __reserve_multi(size_type __n) {
+ __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor())));
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT
- {
- return __bucket_list_.get_deleter().size();
- }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __bucket_list_.get_deleter().size(); }
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const _Key& __k) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(bucket_count() > 0,
- "unordered container::bucket(key) called when bucket_count() == 0");
- return std::__constrain_hash(hash_function()(__k), bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const _Key& __k) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ bucket_count() > 0, "unordered container::bucket(key) called when bucket_count() == 0");
+ return std::__constrain_hash(hash_function()(__k), bucket_count());
+ }
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __x);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __x) const;
-
- typedef __hash_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
-
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
- _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- size_type __count_unique(const _Key& __k) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_unique(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_multi(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_multi(const _Key& __k) const;
-
- _LIBCPP_HIDE_FROM_ABI void swap(__hash_table& __u)
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __x);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __x) const;
+
+ typedef __hash_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_multi(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const;
+
+ _LIBCPP_HIDE_FROM_ABI void swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
- && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
- || __is_nothrow_swappable<__pointer_allocator>::value)
- && (!__node_traits::propagate_on_container_swap::value
- || __is_nothrow_swappable<__node_allocator>::value)
- );
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value &&
+ (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__pointer_allocator>::value) &&
+ (!__node_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value));
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT
- {return max_size(); }
- _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const;
- _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT
- {
- size_type __bc = bucket_count();
- return __bc != 0 ? (float)size() / __bc : 0.f;
- }
- _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) _NOEXCEPT
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__mlf > 0,
- "unordered container::max_load_factor(lf) called with lf <= 0");
- max_load_factor() = std::max(__mlf, load_factor());
- }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return max_size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const;
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT {
+ size_type __bc = bucket_count();
+ return __bc != 0 ? (float)size() / __bc : 0.f;
+ }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) _NOEXCEPT {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__mlf > 0, "unordered container::max_load_factor(lf) called with lf <= 0");
+ max_load_factor() = std::max(__mlf, load_factor());
+ }
- _LIBCPP_HIDE_FROM_ABI
- local_iterator
- begin(size_type __n)
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::begin(n) called with n >= bucket_count()");
- return local_iterator(__bucket_list_[__n], __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::begin(n) called with n >= bucket_count()");
+ return local_iterator(__bucket_list_[__n], __n, bucket_count());
+ }
- _LIBCPP_HIDE_FROM_ABI
- local_iterator
- end(size_type __n)
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::end(n) called with n >= bucket_count()");
- return local_iterator(nullptr, __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::end(n) called with n >= bucket_count()");
+ return local_iterator(nullptr, __n, bucket_count());
+ }
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator
- cbegin(size_type __n) const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::cbegin(n) called with n >= bucket_count()");
- return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::cbegin(n) called with n >= bucket_count()");
+ return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
+ }
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator
- cend(size_type __n) const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::cend(n) called with n >= bucket_count()");
- return const_local_iterator(nullptr, __n, bucket_count());
- }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::cend(n) called with n >= bucket_count()");
+ return const_local_iterator(nullptr, __n, bucket_count());
+ }
private:
- template <bool _UniqueKeys>
- _LIBCPP_HIDE_FROM_ABI void __rehash(size_type __n);
- template <bool _UniqueKeys>
- _LIBCPP_HIDE_FROM_ABI void __do_rehash(size_type __n);
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&& ...__args);
-
- template <class _First, class ..._Rest>
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest);
-
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __hash_table& __u)
- {__copy_assign_alloc(__u, integral_constant<bool,
- __node_traits::propagate_on_container_copy_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table& __u, true_type);
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __hash_table&, false_type) {}
-
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, false_type);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, true_type)
- _NOEXCEPT_(
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value);
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__hash_table& __u)
- _NOEXCEPT_(
- !__node_traits::propagate_on_container_move_assignment::value ||
- (is_nothrow_move_assignable<__pointer_allocator>::value &&
- is_nothrow_move_assignable<__node_allocator>::value))
- {__move_assign_alloc(__u, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__hash_table& __u, true_type)
- _NOEXCEPT_(
- is_nothrow_move_assignable<__pointer_allocator>::value &&
- is_nothrow_move_assignable<__node_allocator>::value)
- {
- __bucket_list_.get_deleter().__alloc() =
- std::move(__u.__bucket_list_.get_deleter().__alloc());
- __node_alloc() = std::move(__u.__node_alloc());
- }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
+ template <bool _UniqueKeys>
+ _LIBCPP_HIDE_FROM_ABI void __rehash(size_type __n);
+ template <bool _UniqueKeys>
+ _LIBCPP_HIDE_FROM_ABI void __do_rehash(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __deallocate_node(__next_pointer __np) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI __next_pointer __detach() _NOEXCEPT;
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ template <class _First, class... _Rest>
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest);
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table& __u) {
+ __copy_assign_alloc(__u, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table& __u, true_type);
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __hash_table&, false_type) {}
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__hash_table& __u, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value&& is_nothrow_move_assignable<hasher>::value&&
+ is_nothrow_move_assignable<key_equal>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__hash_table& __u) _NOEXCEPT_(
+ !__node_traits::propagate_on_container_move_assignment::value ||
+ (is_nothrow_move_assignable<__pointer_allocator>::value && is_nothrow_move_assignable<__node_allocator>::value)) {
+ __move_assign_alloc(__u, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__hash_table& __u, true_type) _NOEXCEPT_(
+ is_nothrow_move_assignable<__pointer_allocator>::value&& is_nothrow_move_assignable<__node_allocator>::value) {
+ __bucket_list_.get_deleter().__alloc() = std::move(__u.__bucket_list_.get_deleter().__alloc());
+ __node_alloc() = std::move(__u.__node_alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI void __deallocate_node(__next_pointer __np) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __next_pointer __detach() _NOEXCEPT;
+
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
- _NOEXCEPT_(
- is_nothrow_default_constructible<__bucket_list>::value &&
- is_nothrow_default_constructible<__first_node>::value &&
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_default_constructible<hasher>::value &&
- is_nothrow_default_constructible<key_equal>::value)
- : __p2_(0, __default_init_tag()),
- __p3_(1.0f, __default_init_tag())
-{
-}
+inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table() _NOEXCEPT_(
+ is_nothrow_default_constructible<__bucket_list>::value&& is_nothrow_default_constructible<__first_node>::value&&
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_default_constructible<hasher>::value&&
+ is_nothrow_default_constructible<key_equal>::value)
+ : __p2_(0, __default_init_tag()), __p3_(1.0f, __default_init_tag()) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
- const key_equal& __eql)
- : __bucket_list_(nullptr, __bucket_list_deleter()),
- __p1_(),
- __p2_(0, __hf),
- __p3_(1.0f, __eql)
-{
-}
+inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, const key_equal& __eql)
+ : __bucket_list_(nullptr, __bucket_list_deleter()), __p1_(), __p2_(0, __hf), __p3_(1.0f, __eql) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(
+ const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, __hf),
- __p3_(1.0f, __eql)
-{
-}
+ __p3_(1.0f, __eql) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, __default_init_tag()),
- __p3_(1.0f, __default_init_tag())
-{
-}
+ __p3_(1.0f, __default_init_tag()) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
: __bucket_list_(nullptr,
- __bucket_list_deleter(allocator_traits<__pointer_allocator>::
- select_on_container_copy_construction(
- __u.__bucket_list_.get_deleter().__alloc()), 0)),
- __p1_(__default_init_tag(), allocator_traits<__node_allocator>::
- select_on_container_copy_construction(__u.__node_alloc())),
+ __bucket_list_deleter(allocator_traits<__pointer_allocator>::select_on_container_copy_construction(
+ __u.__bucket_list_.get_deleter().__alloc()),
+ 0)),
+ __p1_(__default_init_tag(),
+ allocator_traits<__node_allocator>::select_on_container_copy_construction(__u.__node_alloc())),
__p2_(0, __u.hash_function()),
- __p3_(__u.__p3_)
-{
-}
+ __p3_(__u.__p3_) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
- const allocator_type& __a)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, __u.hash_function()),
- __p3_(__u.__p3_)
-{
-}
+ __p3_(__u.__p3_) {}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__bucket_list>::value &&
- is_nothrow_move_constructible<__first_node>::value &&
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<hasher>::value &&
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) _NOEXCEPT_(
+ is_nothrow_move_constructible<__bucket_list>::value&& is_nothrow_move_constructible<__first_node>::value&&
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<hasher>::value&&
is_nothrow_move_constructible<key_equal>::value)
: __bucket_list_(std::move(__u.__bucket_list_)),
__p1_(std::move(__u.__p1_)),
__p2_(std::move(__u.__p2_)),
- __p3_(std::move(__u.__p3_))
-{
- if (size() > 0)
- {
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- __u.__p1_.first().__next_ = nullptr;
- __u.size() = 0;
- }
+ __p3_(std::move(__u.__p3_)) {
+ if (size() > 0) {
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ __u.__p1_.first().__next_ = nullptr;
+ __u.size() = 0;
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
- const allocator_type& __a)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__default_init_tag(), __node_allocator(__a)),
__p2_(0, std::move(__u.hash_function())),
- __p3_(std::move(__u.__p3_))
-{
- if (__a == allocator_type(__u.__node_alloc()))
- {
- __bucket_list_.reset(__u.__bucket_list_.release());
- __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
- __u.__bucket_list_.get_deleter().size() = 0;
- if (__u.size() > 0)
- {
- __p1_.first().__next_ = __u.__p1_.first().__next_;
- __u.__p1_.first().__next_ = nullptr;
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- size() = __u.size();
- __u.size() = 0;
- }
+ __p3_(std::move(__u.__p3_)) {
+ if (__a == allocator_type(__u.__node_alloc())) {
+ __bucket_list_.reset(__u.__bucket_list_.release());
+ __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
+ __u.__bucket_list_.get_deleter().size() = 0;
+ if (__u.size() > 0) {
+ __p1_.first().__next_ = __u.__p1_.first().__next_;
+ __u.__p1_.first().__next_ = nullptr;
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ size() = __u.size();
+ __u.size() = 0;
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
-{
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() {
#if defined(_LIBCPP_CXX03_LANG)
- static_assert((is_copy_constructible<key_equal>::value),
- "Predicate must be copy-constructible.");
- static_assert((is_copy_constructible<hasher>::value),
- "Hasher must be copy-constructible.");
+ static_assert((is_copy_constructible<key_equal>::value), "Predicate must be copy-constructible.");
+ static_assert((is_copy_constructible<hasher>::value), "Hasher must be copy-constructible.");
#endif
- __deallocate_node(__p1_.first().__next_);
+ __deallocate_node(__p1_.first().__next_);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc(
- const __hash_table& __u, true_type)
-{
- if (__node_alloc() != __u.__node_alloc())
- {
- clear();
- __bucket_list_.reset();
- __bucket_list_.get_deleter().size() = 0;
- }
- __bucket_list_.get_deleter().__alloc() = __u.__bucket_list_.get_deleter().__alloc();
- __node_alloc() = __u.__node_alloc();
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc(const __hash_table& __u, true_type) {
+ if (__node_alloc() != __u.__node_alloc()) {
+ clear();
+ __bucket_list_.reset();
+ __bucket_list_.get_deleter().size() = 0;
+ }
+ __bucket_list_.get_deleter().__alloc() = __u.__bucket_list_.get_deleter().__alloc();
+ __node_alloc() = __u.__node_alloc();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>&
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u)
-{
- if (this != std::addressof(__u))
- {
- __copy_assign_alloc(__u);
- hash_function() = __u.hash_function();
- key_eq() = __u.key_eq();
- max_load_factor() = __u.max_load_factor();
- __assign_multi(__u.begin(), __u.end());
- }
- return *this;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>& __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u) {
+ if (this != std::addressof(__u)) {
+ __copy_assign_alloc(__u);
+ hash_function() = __u.hash_function();
+ key_eq() = __u.key_eq();
+ max_load_factor() = __u.max_load_factor();
+ __assign_multi(__u.begin(), __u.end());
+ }
+ return *this;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
- _NOEXCEPT
-{
- __node_allocator& __na = __node_alloc();
- while (__np != nullptr)
- {
- __next_pointer __next = __np->__next_;
- __node_pointer __real_np = __np->__upcast();
- __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__get_value()));
- std::__destroy_at(std::addressof(*__real_np));
- __node_traits::deallocate(__na, __real_np, 1);
- __np = __next;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) _NOEXCEPT {
+ __node_allocator& __na = __node_alloc();
+ while (__np != nullptr) {
+ __next_pointer __next = __np->__next_;
+ __node_pointer __real_np = __np->__upcast();
+ __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__get_value()));
+ std::__destroy_at(std::addressof(*__real_np));
+ __node_traits::deallocate(__na, __real_np, 1);
+ __np = __next;
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
-{
- size_type __bc = bucket_count();
- for (size_type __i = 0; __i < __bc; ++__i)
- __bucket_list_[__i] = nullptr;
- size() = 0;
- __next_pointer __cache = __p1_.first().__next_;
- __p1_.first().__next_ = nullptr;
- return __cache;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT {
+ size_type __bc = bucket_count();
+ for (size_type __i = 0; __i < __bc; ++__i)
+ __bucket_list_[__i] = nullptr;
+ size() = 0;
+ __next_pointer __cache = __p1_.first().__next_;
+ __p1_.first().__next_ = nullptr;
+ return __cache;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
- __hash_table& __u, true_type)
- _NOEXCEPT_(
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value)
-{
- clear();
- __bucket_list_.reset(__u.__bucket_list_.release());
- __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
- __u.__bucket_list_.get_deleter().size() = 0;
- __move_assign_alloc(__u);
- size() = __u.size();
- hash_function() = std::move(__u.hash_function());
- max_load_factor() = __u.max_load_factor();
- key_eq() = std::move(__u.key_eq());
- __p1_.first().__next_ = __u.__p1_.first().__next_;
- if (size() > 0)
- {
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- __u.__p1_.first().__next_ = nullptr;
- __u.size() = 0;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value&& is_nothrow_move_assignable<hasher>::value&&
+ is_nothrow_move_assignable<key_equal>::value) {
+ clear();
+ __bucket_list_.reset(__u.__bucket_list_.release());
+ __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size();
+ __u.__bucket_list_.get_deleter().size() = 0;
+ __move_assign_alloc(__u);
+ size() = __u.size();
+ hash_function() = std::move(__u.hash_function());
+ max_load_factor() = __u.max_load_factor();
+ key_eq() = std::move(__u.key_eq());
+ __p1_.first().__next_ = __u.__p1_.first().__next_;
+ if (size() > 0) {
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ __u.__p1_.first().__next_ = nullptr;
+ __u.size() = 0;
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
- __hash_table& __u, false_type)
-{
- if (__node_alloc() == __u.__node_alloc())
- __move_assign(__u, true_type());
- else
- {
- hash_function() = std::move(__u.hash_function());
- key_eq() = std::move(__u.key_eq());
- max_load_factor() = __u.max_load_factor();
- if (bucket_count() != 0)
- {
- __next_pointer __cache = __detach();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- const_iterator __i = __u.begin();
- while (__cache != nullptr && __u.size() != 0)
- {
- __cache->__upcast()->__get_value() =
- std::move(__u.remove(__i++)->__get_value());
- __next_pointer __next = __cache->__next_;
- __node_insert_multi(__cache->__upcast());
- __cache = __next;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u, false_type) {
+ if (__node_alloc() == __u.__node_alloc())
+ __move_assign(__u, true_type());
+ else {
+ hash_function() = std::move(__u.hash_function());
+ key_eq() = std::move(__u.key_eq());
+ max_load_factor() = __u.max_load_factor();
+ if (bucket_count() != 0) {
+ __next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __deallocate_node(__cache);
- throw;
- }
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __deallocate_node(__cache);
- }
const_iterator __i = __u.begin();
- while (__u.size() != 0)
- {
- __node_holder __h = __construct_node(_NodeTypes::__move(__u.remove(__i++)->__get_value()));
- __node_insert_multi(__h.get());
- __h.release();
+ while (__cache != nullptr && __u.size() != 0) {
+ __cache->__upcast()->__get_value() = std::move(__u.remove(__i++)->__get_value());
+ __next_pointer __next = __cache->__next_;
+ __node_insert_multi(__cache->__upcast());
+ __cache = __next;
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __deallocate_node(__cache);
+ throw;
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __deallocate_node(__cache);
+ }
+ const_iterator __i = __u.begin();
+ while (__u.size() != 0) {
+ __node_holder __h = __construct_node(_NodeTypes::__move(__u.remove(__i++)->__get_value()));
+ __node_insert_multi(__h.get());
+ __h.release();
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-__hash_table<_Tp, _Hash, _Equal, _Alloc>&
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value &&
- is_nothrow_move_assignable<hasher>::value &&
- is_nothrow_move_assignable<key_equal>::value)
-{
- __move_assign(__u, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline __hash_table<_Tp, _Hash, _Equal, _Alloc>&
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<__node_allocator>::value&&
+ is_nothrow_move_assignable<hasher>::value&& is_nothrow_move_assignable<key_equal>::value) {
+ __move_assign(__u, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _InputIterator>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first,
- _InputIterator __last)
-{
- typedef iterator_traits<_InputIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value),
- "__assign_unique may only be called with the containers value type");
-
- if (bucket_count() != 0)
- {
- __next_pointer __cache = __detach();
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first, _InputIterator __last) {
+ typedef iterator_traits<_InputIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert((is_same<_ItValueType, __container_value_type>::value),
+ "__assign_unique may only be called with the containers value type");
+
+ if (bucket_count() != 0) {
+ __next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __cache != nullptr && __first != __last; ++__first)
- {
- __cache->__upcast()->__get_value() = *__first;
- __next_pointer __next = __cache->__next_;
- __node_insert_unique(__cache->__upcast());
- __cache = __next;
- }
+ for (; __cache != nullptr && __first != __last; ++__first) {
+ __cache->__upcast()->__get_value() = *__first;
+ __next_pointer __next = __cache->__next_;
+ __node_insert_unique(__cache->__upcast());
+ __cache = __next;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __deallocate_node(__cache);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __deallocate_node(__cache);
+ } catch (...) {
+ __deallocate_node(__cache);
+ throw;
}
- for (; __first != __last; ++__first)
- __insert_unique(*__first);
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __deallocate_node(__cache);
+ }
+ for (; __first != __last; ++__first)
+ __insert_unique(*__first);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _InputIterator>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
- _InputIterator __last)
-{
- typedef iterator_traits<_InputIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value ||
- is_same<_ItValueType, __node_value_type>::value),
- "__assign_multi may only be called with the containers value type"
- " or the nodes value type");
- if (bucket_count() != 0)
- {
- __next_pointer __cache = __detach();
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first, _InputIterator __last) {
+ typedef iterator_traits<_InputIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert(
+ (is_same<_ItValueType, __container_value_type>::value || is_same<_ItValueType, __node_value_type>::value),
+ "__assign_multi may only be called with the containers value type"
+ " or the nodes value type");
+ if (bucket_count() != 0) {
+ __next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __cache != nullptr && __first != __last; ++__first)
- {
- __cache->__upcast()->__get_value() = *__first;
- __next_pointer __next = __cache->__next_;
- __node_insert_multi(__cache->__upcast());
- __cache = __next;
- }
+ for (; __cache != nullptr && __first != __last; ++__first) {
+ __cache->__upcast()->__get_value() = *__first;
+ __next_pointer __next = __cache->__next_;
+ __node_insert_multi(__cache->__upcast());
+ __cache = __next;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __deallocate_node(__cache);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __deallocate_node(__cache);
+ } catch (...) {
+ __deallocate_node(__cache);
+ throw;
}
- for (; __first != __last; ++__first)
- __insert_multi(_NodeTypes::__get_value(*__first));
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __deallocate_node(__cache);
+ }
+ for (; __first != __last; ++__first)
+ __insert_multi(_NodeTypes::__get_value(*__first));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
-{
- return iterator(__p1_.first().__next_);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT {
+ return iterator(__p1_.first().__next_);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
-{
- return iterator(nullptr);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT {
+ return iterator(nullptr);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
-{
- return const_iterator(__p1_.first().__next_);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT {
+ return const_iterator(__p1_.first().__next_);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
-{
- return const_iterator(nullptr);
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT {
+ return const_iterator(nullptr);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
-{
- if (size() > 0)
- {
- __deallocate_node(__p1_.first().__next_);
- __p1_.first().__next_ = nullptr;
- size_type __bc = bucket_count();
- for (size_type __i = 0; __i < __bc; ++__i)
- __bucket_list_[__i] = nullptr;
- size() = 0;
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT {
+ if (size() > 0) {
+ __deallocate_node(__p1_.first().__next_);
+ __p1_.first().__next_ = nullptr;
+ size_type __bc = bucket_count();
+ for (size_type __i = 0; __i < __bc; ++__i)
+ __bucket_list_[__i] = nullptr;
+ size() = 0;
+ }
}
-
// Prepare the container for an insertion of the value __value with the hash
// __hash. This does a lookup into the container to see if __value is already
// present, and performs a rehash if necessary. Returns a pointer to the
@@ -1640,36 +1298,28 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
// Note that this function does forward exceptions if key_eq() throws, and never
// mutates __value or actually inserts into the map.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(
- size_t __hash, value_type& __value)
-{
- size_type __bc = bucket_count();
-
- if (__bc != 0)
- {
- size_t __chash = std::__constrain_hash(__hash, __bc);
- __next_pointer __ndptr = __bucket_list_[__chash];
- if (__ndptr != nullptr)
- {
- for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
- (__ndptr->__hash() == __hash ||
- std::__constrain_hash(__ndptr->__hash(), __bc) == __chash);
- __ndptr = __ndptr->__next_)
- {
- if ((__ndptr->__hash() == __hash) &&
- key_eq()(__ndptr->__upcast()->__get_value(), __value))
- return __ndptr;
- }
- }
- }
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_unique(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(size_t __hash, value_type& __value) {
+ size_type __bc = bucket_count();
+
+ if (__bc != 0) {
+ size_t __chash = std::__constrain_hash(__hash, __bc);
+ __next_pointer __ndptr = __bucket_list_[__chash];
+ if (__ndptr != nullptr) {
+ for (__ndptr = __ndptr->__next_;
+ __ndptr != nullptr &&
+ (__ndptr->__hash() == __hash || std::__constrain_hash(__ndptr->__hash(), __bc) == __chash);
+ __ndptr = __ndptr->__next_) {
+ if ((__ndptr->__hash() == __hash) && key_eq()(__ndptr->__upcast()->__get_value(), __value))
+ return __ndptr;
+ }
}
- return nullptr;
+ }
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_unique(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ }
+ return nullptr;
}
// Insert the node __nd into the container by pushing it into the right bucket,
@@ -1677,50 +1327,41 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(
// rehashing has already occurred and that no element with the same key exists
// in the map.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform(
- __node_pointer __nd) _NOEXCEPT
-{
- size_type __bc = bucket_count();
- size_t __chash = std::__constrain_hash(__nd->__hash(), __bc);
- // insert_after __bucket_list_[__chash], or __first_node if bucket is null
- __next_pointer __pn = __bucket_list_[__chash];
- if (__pn == nullptr)
- {
- __pn =__p1_.first().__ptr();
- __nd->__next_ = __pn->__next_;
- __pn->__next_ = __nd->__ptr();
- // fix up __bucket_list_
- __bucket_list_[__chash] = __pn;
- if (__nd->__next_ != nullptr)
- __bucket_list_[std::__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr();
- }
- else
- {
- __nd->__next_ = __pn->__next_;
- __pn->__next_ = __nd->__ptr();
- }
- ++size();
+_LIBCPP_HIDE_FROM_ABI void
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform(__node_pointer __nd) _NOEXCEPT {
+ size_type __bc = bucket_count();
+ size_t __chash = std::__constrain_hash(__nd->__hash(), __bc);
+ // insert_after __bucket_list_[__chash], or __first_node if bucket is null
+ __next_pointer __pn = __bucket_list_[__chash];
+ if (__pn == nullptr) {
+ __pn = __p1_.first().__ptr();
+ __nd->__next_ = __pn->__next_;
+ __pn->__next_ = __nd->__ptr();
+ // fix up __bucket_list_
+ __bucket_list_[__chash] = __pn;
+ if (__nd->__next_ != nullptr)
+ __bucket_list_[std::__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr();
+ } else {
+ __nd->__next_ = __pn->__next_;
+ __pn->__next_ = __nd->__ptr();
+ }
+ ++size();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __nd)
-{
- __nd->__hash_ = hash_function()(__nd->__get_value());
- __next_pointer __existing_node =
- __node_insert_unique_prepare(__nd->__hash(), __nd->__get_value());
-
- // Insert the node, unless it already exists in the container.
- bool __inserted = false;
- if (__existing_node == nullptr)
- {
- __node_insert_unique_perform(__nd);
- __existing_node = __nd->__ptr();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__existing_node), __inserted);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __nd) {
+ __nd->__hash_ = hash_function()(__nd->__get_value());
+ __next_pointer __existing_node = __node_insert_unique_prepare(__nd->__hash(), __nd->__get_value());
+
+ // Insert the node, unless it already exists in the container.
+ bool __inserted = false;
+ if (__existing_node == nullptr) {
+ __node_insert_unique_perform(__nd);
+ __existing_node = __nd->__ptr();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__existing_node), __inserted);
}
// Prepare the container for an insertion of the value __cp_val with the hash
@@ -1732,40 +1373,34 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
// mutates __value or actually inserts into the map.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(
- size_t __cp_hash, value_type& __cp_val)
-{
- size_type __bc = bucket_count();
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_multi(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
- __bc = bucket_count();
- }
- size_t __chash = std::__constrain_hash(__cp_hash, __bc);
- __next_pointer __pn = __bucket_list_[__chash];
- if (__pn != nullptr)
- {
- for (bool __found = false; __pn->__next_ != nullptr &&
- std::__constrain_hash(__pn->__next_->__hash(), __bc) == __chash;
- __pn = __pn->__next_)
- {
- // __found key_eq() action
- // false false loop
- // true true loop
- // false true set __found to true
- // true false break
- if (__found != (__pn->__next_->__hash() == __cp_hash &&
- key_eq()(__pn->__next_->__upcast()->__get_value(), __cp_val)))
- {
- if (!__found)
- __found = true;
- else
- break;
- }
- }
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(size_t __cp_hash, value_type& __cp_val) {
+ size_type __bc = bucket_count();
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_multi(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ __bc = bucket_count();
+ }
+ size_t __chash = std::__constrain_hash(__cp_hash, __bc);
+ __next_pointer __pn = __bucket_list_[__chash];
+ if (__pn != nullptr) {
+ for (bool __found = false;
+ __pn->__next_ != nullptr && std::__constrain_hash(__pn->__next_->__hash(), __bc) == __chash;
+ __pn = __pn->__next_) {
+ // __found key_eq() action
+ // false false loop
+ // true true loop
+ // false true set __found to true
+ // true false break
+ if (__found !=
+ (__pn->__next_->__hash() == __cp_hash && key_eq()(__pn->__next_->__upcast()->__get_value(), __cp_val))) {
+ if (!__found)
+ __found = true;
+ else
+ break;
+ }
}
- return __pn;
+ }
+ return __pn;
}
// Insert the node __cp into the container after __pn (which is the last node in
@@ -1774,746 +1409,601 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(
// all we need to do is update the bucket and size(). Assumes that __cp->__hash
// is up-to-date.
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform(
- __node_pointer __cp, __next_pointer __pn) _NOEXCEPT
-{
- size_type __bc = bucket_count();
- size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
- if (__pn == nullptr)
- {
- __pn =__p1_.first().__ptr();
- __cp->__next_ = __pn->__next_;
- __pn->__next_ = __cp->__ptr();
- // fix up __bucket_list_
- __bucket_list_[__chash] = __pn;
- if (__cp->__next_ != nullptr)
- __bucket_list_[std::__constrain_hash(__cp->__next_->__hash(), __bc)]
- = __cp->__ptr();
- }
- else
- {
- __cp->__next_ = __pn->__next_;
- __pn->__next_ = __cp->__ptr();
- if (__cp->__next_ != nullptr)
- {
- size_t __nhash = std::__constrain_hash(__cp->__next_->__hash(), __bc);
- if (__nhash != __chash)
- __bucket_list_[__nhash] = __cp->__ptr();
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform(
+ __node_pointer __cp, __next_pointer __pn) _NOEXCEPT {
+ size_type __bc = bucket_count();
+ size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
+ if (__pn == nullptr) {
+ __pn = __p1_.first().__ptr();
+ __cp->__next_ = __pn->__next_;
+ __pn->__next_ = __cp->__ptr();
+ // fix up __bucket_list_
+ __bucket_list_[__chash] = __pn;
+ if (__cp->__next_ != nullptr)
+ __bucket_list_[std::__constrain_hash(__cp->__next_->__hash(), __bc)] = __cp->__ptr();
+ } else {
+ __cp->__next_ = __pn->__next_;
+ __pn->__next_ = __cp->__ptr();
+ if (__cp->__next_ != nullptr) {
+ size_t __nhash = std::__constrain_hash(__cp->__next_->__hash(), __bc);
+ if (__nhash != __chash)
+ __bucket_list_[__nhash] = __cp->__ptr();
}
- ++size();
+ }
+ ++size();
}
-
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __cp)
-{
- __cp->__hash_ = hash_function()(__cp->__get_value());
- __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__get_value());
- __node_insert_multi_perform(__cp, __pn);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __cp) {
+ __cp->__hash_ = hash_function()(__cp->__get_value());
+ __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__get_value());
+ __node_insert_multi_perform(__cp, __pn);
- return iterator(__cp->__ptr());
+ return iterator(__cp->__ptr());
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
- const_iterator __p, __node_pointer __cp)
-{
- if (__p != end() && key_eq()(*__p, __cp->__get_value()))
- {
- __next_pointer __np = __p.__node_;
- __cp->__hash_ = __np->__hash();
- size_type __bc = bucket_count();
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_multi(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
- __bc = bucket_count();
- }
- size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
- __next_pointer __pp = __bucket_list_[__chash];
- while (__pp->__next_ != __np)
- __pp = __pp->__next_;
- __cp->__next_ = __np;
- __pp->__next_ = static_cast<__next_pointer>(__cp);
- ++size();
- return iterator(static_cast<__next_pointer>(__cp));
- }
- return __node_insert_multi(__cp);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(const_iterator __p, __node_pointer __cp) {
+ if (__p != end() && key_eq()(*__p, __cp->__get_value())) {
+ __next_pointer __np = __p.__node_;
+ __cp->__hash_ = __np->__hash();
+ size_type __bc = bucket_count();
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_multi(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ __bc = bucket_count();
+ }
+ size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
+ __next_pointer __pp = __bucket_list_[__chash];
+ while (__pp->__next_ != __np)
+ __pp = __pp->__next_;
+ __cp->__next_ = __np;
+ __pp->__next_ = static_cast<__next_pointer>(__cp);
+ ++size();
+ return iterator(static_cast<__next_pointer>(__cp));
+ }
+ return __node_insert_multi(__cp);
}
-
-
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _Key, class ..._Args>
+template <class _Key, class... _Args>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
-{
-
- size_t __hash = hash_function()(__k);
- size_type __bc = bucket_count();
- bool __inserted = false;
- __next_pointer __nd;
- size_t __chash;
- if (__bc != 0)
- {
- __chash = std::__constrain_hash(__hash, __bc);
- __nd = __bucket_list_[__chash];
- if (__nd != nullptr)
- {
- for (__nd = __nd->__next_; __nd != nullptr &&
- (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
- __nd = __nd->__next_)
- {
- if ((__nd->__hash() == __hash) &&
- key_eq()(__nd->__upcast()->__get_value(), __k))
- goto __done;
- }
- }
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) {
+ size_t __hash = hash_function()(__k);
+ size_type __bc = bucket_count();
+ bool __inserted = false;
+ __next_pointer __nd;
+ size_t __chash;
+ if (__bc != 0) {
+ __chash = std::__constrain_hash(__hash, __bc);
+ __nd = __bucket_list_[__chash];
+ if (__nd != nullptr) {
+ for (__nd = __nd->__next_;
+ __nd != nullptr && (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
+ __nd = __nd->__next_) {
+ if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __k))
+ goto __done;
+ }
}
- {
- __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...);
- if (size()+1 > __bc * max_load_factor() || __bc == 0)
- {
- __rehash_unique(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
- size_type(std::ceil(float(size() + 1) / max_load_factor()))));
- __bc = bucket_count();
- __chash = std::__constrain_hash(__hash, __bc);
- }
- // insert_after __bucket_list_[__chash], or __first_node if bucket is null
- __next_pointer __pn = __bucket_list_[__chash];
- if (__pn == nullptr)
- {
- __pn = __p1_.first().__ptr();
- __h->__next_ = __pn->__next_;
- __pn->__next_ = __h.get()->__ptr();
- // fix up __bucket_list_
- __bucket_list_[__chash] = __pn;
- if (__h->__next_ != nullptr)
- __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)]
- = __h.get()->__ptr();
- }
- else
- {
- __h->__next_ = __pn->__next_;
- __pn->__next_ = static_cast<__next_pointer>(__h.get());
- }
- __nd = static_cast<__next_pointer>(__h.release());
- // increment size
- ++size();
- __inserted = true;
+ }
+ {
+ __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...);
+ if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+ __rehash_unique(std::max<size_type>(
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ __bc = bucket_count();
+ __chash = std::__constrain_hash(__hash, __bc);
}
+ // insert_after __bucket_list_[__chash], or __first_node if bucket is null
+ __next_pointer __pn = __bucket_list_[__chash];
+ if (__pn == nullptr) {
+ __pn = __p1_.first().__ptr();
+ __h->__next_ = __pn->__next_;
+ __pn->__next_ = __h.get()->__ptr();
+ // fix up __bucket_list_
+ __bucket_list_[__chash] = __pn;
+ if (__h->__next_ != nullptr)
+ __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)] = __h.get()->__ptr();
+ } else {
+ __h->__next_ = __pn->__next_;
+ __pn->__next_ = static_cast<__next_pointer>(__h.get());
+ }
+ __nd = static_cast<__next_pointer>(__h.release());
+ // increment size
+ ++size();
+ __inserted = true;
+ }
__done:
- return pair<iterator, bool>(iterator(__nd), __inserted);
+ return pair<iterator, bool>(iterator(__nd), __inserted);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class... _Args>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_impl(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- pair<iterator, bool> __r = __node_insert_unique(__h.get());
- if (__r.second)
- __h.release();
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_impl(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ pair<iterator, bool> __r = __node_insert_unique(__h.get());
+ if (__r.second)
+ __h.release();
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class... _Args>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- iterator __r = __node_insert_multi(__h.get());
- __h.release();
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ iterator __r = __node_insert_multi(__h.get());
+ __h.release();
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class... _Args>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
- const_iterator __p, _Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- iterator __r = __node_insert_multi(__p, __h.get());
- __h.release();
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ iterator __r = __node_insert_multi(__p, __h.get());
+ __h.release();
+ return __r;
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle, class _InsertReturnType>
-_LIBCPP_HIDE_FROM_ABI
-_InsertReturnType
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
- _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return _InsertReturnType{end(), false, _NodeHandle()};
- pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
- if (__result.second)
- __nh.__release_ptr();
- return _InsertReturnType{__result.first, __result.second, std::move(__nh)};
+_LIBCPP_HIDE_FROM_ABI _InsertReturnType
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return _InsertReturnType{end(), false, _NodeHandle()};
+ pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
+ if (__result.second)
+ __nh.__release_ptr();
+ return _InsertReturnType{__result.first, __result.second, std::move(__nh)};
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
- const_iterator, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
- if (__result.second)
- __nh.__release_ptr();
- return __result.first;
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(const_iterator, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
+ if (__result.second)
+ __nh.__release_ptr();
+ return __result.first;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(
- key_type const& __key)
-{
- iterator __i = find(__key);
- if (__i == end())
- return _NodeHandle();
- return __node_handle_extract<_NodeHandle>(__i);
+_LIBCPP_HIDE_FROM_ABI _NodeHandle
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(key_type const& __key) {
+ iterator __i = find(__key);
+ if (__i == end())
+ return _NodeHandle();
+ return __node_handle_extract<_NodeHandle>(__i);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(
- const_iterator __p)
-{
- allocator_type __alloc(__node_alloc());
- return _NodeHandle(remove(__p).release(), __alloc);
+_LIBCPP_HIDE_FROM_ABI _NodeHandle __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(const_iterator __p) {
+ allocator_type __alloc(__node_alloc());
+ return _NodeHandle(remove(__p).release(), __alloc);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Table>
-_LIBCPP_HIDE_FROM_ABI
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_unique(
- _Table& __source)
-{
- static_assert(is_same<__node, typename _Table::__node>::value, "");
-
- for (typename _Table::iterator __it = __source.begin();
- __it != __source.end();)
- {
- __node_pointer __src_ptr = __it.__node_->__upcast();
- size_t __hash = hash_function()(__src_ptr->__get_value());
- __next_pointer __existing_node =
- __node_insert_unique_prepare(__hash, __src_ptr->__get_value());
- auto __prev_iter = __it++;
- if (__existing_node == nullptr)
- {
- (void)__source.remove(__prev_iter).release();
- __src_ptr->__hash_ = __hash;
- __node_insert_unique_perform(__src_ptr);
- }
+_LIBCPP_HIDE_FROM_ABI void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_unique(_Table& __source) {
+ static_assert(is_same<__node, typename _Table::__node>::value, "");
+
+ for (typename _Table::iterator __it = __source.begin(); __it != __source.end();) {
+ __node_pointer __src_ptr = __it.__node_->__upcast();
+ size_t __hash = hash_function()(__src_ptr->__get_value());
+ __next_pointer __existing_node = __node_insert_unique_prepare(__hash, __src_ptr->__get_value());
+ auto __prev_iter = __it++;
+ if (__existing_node == nullptr) {
+ (void)__source.remove(__prev_iter).release();
+ __src_ptr->__hash_ = __hash;
+ __node_insert_unique_perform(__src_ptr);
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
- _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- iterator __result = __node_insert_multi(__nh.__ptr_);
- __nh.__release_ptr();
- return __result;
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ iterator __result = __node_insert_multi(__nh.__ptr_);
+ __nh.__release_ptr();
+ return __result;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
- const_iterator __hint, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- iterator __result = __node_insert_multi(__hint, __nh.__ptr_);
- __nh.__release_ptr();
- return __result;
+_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ iterator __result = __node_insert_multi(__hint, __nh.__ptr_);
+ __nh.__release_ptr();
+ return __result;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Table>
-_LIBCPP_HIDE_FROM_ABI
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(
- _Table& __source)
-{
- static_assert(is_same<typename _Table::__node, __node>::value, "");
-
- for (typename _Table::iterator __it = __source.begin();
- __it != __source.end();)
- {
- __node_pointer __src_ptr = __it.__node_->__upcast();
- size_t __src_hash = hash_function()(__src_ptr->__get_value());
- __next_pointer __pn =
- __node_insert_multi_prepare(__src_hash, __src_ptr->__get_value());
- (void)__source.remove(__it++).release();
- __src_ptr->__hash_ = __src_hash;
- __node_insert_multi_perform(__src_ptr, __pn);
- }
+_LIBCPP_HIDE_FROM_ABI void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(_Table& __source) {
+ static_assert(is_same<typename _Table::__node, __node>::value, "");
+
+ for (typename _Table::iterator __it = __source.begin(); __it != __source.end();) {
+ __node_pointer __src_ptr = __it.__node_->__upcast();
+ size_t __src_hash = hash_function()(__src_ptr->__get_value());
+ __next_pointer __pn = __node_insert_multi_prepare(__src_hash, __src_ptr->__get_value());
+ (void)__source.remove(__it++).release();
+ __src_ptr->__hash_ = __src_hash;
+ __node_insert_multi_perform(__src_ptr, __pn);
+ }
}
#endif // _LIBCPP_STD_VER >= 17
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <bool _UniqueKeys>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n)
-_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- if (__n == 1)
- __n = 2;
- else if (__n & (__n - 1))
- __n = std::__next_prime(__n);
- size_type __bc = bucket_count();
- if (__n > __bc)
- __do_rehash<_UniqueKeys>(__n);
- else if (__n < __bc)
- {
- __n = std::max<size_type>
- (
- __n,
- std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor()))) :
- std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor())))
- );
- if (__n < __bc)
- __do_rehash<_UniqueKeys>(__n);
- }
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ if (__n == 1)
+ __n = 2;
+ else if (__n & (__n - 1))
+ __n = std::__next_prime(__n);
+ size_type __bc = bucket_count();
+ if (__n > __bc)
+ __do_rehash<_UniqueKeys>(__n);
+ else if (__n < __bc) {
+ __n = std::max<size_type>(
+ __n,
+ std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor())))
+ : std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor()))));
+ if (__n < __bc)
+ __do_rehash<_UniqueKeys>(__n);
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <bool _UniqueKeys>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc)
-{
- __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
- __bucket_list_.reset(__nbc > 0 ?
- __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
- __bucket_list_.get_deleter().size() = __nbc;
- if (__nbc > 0)
- {
- for (size_type __i = 0; __i < __nbc; ++__i)
- __bucket_list_[__i] = nullptr;
- __next_pointer __pp = __p1_.first().__ptr();
- __next_pointer __cp = __pp->__next_;
- if (__cp != nullptr)
- {
- size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc);
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc) {
+ __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
+ __bucket_list_.reset(__nbc > 0 ? __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
+ __bucket_list_.get_deleter().size() = __nbc;
+ if (__nbc > 0) {
+ for (size_type __i = 0; __i < __nbc; ++__i)
+ __bucket_list_[__i] = nullptr;
+ __next_pointer __pp = __p1_.first().__ptr();
+ __next_pointer __cp = __pp->__next_;
+ if (__cp != nullptr) {
+ size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc);
+ __bucket_list_[__chash] = __pp;
+ size_type __phash = __chash;
+ for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr; __cp = __pp->__next_) {
+ __chash = std::__constrain_hash(__cp->__hash(), __nbc);
+ if (__chash == __phash)
+ __pp = __cp;
+ else {
+ if (__bucket_list_[__chash] == nullptr) {
__bucket_list_[__chash] = __pp;
- size_type __phash = __chash;
- for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr;
- __cp = __pp->__next_)
- {
- __chash = std::__constrain_hash(__cp->__hash(), __nbc);
- if (__chash == __phash)
- __pp = __cp;
- else
- {
- if (__bucket_list_[__chash] == nullptr)
- {
- __bucket_list_[__chash] = __pp;
- __pp = __cp;
- __phash = __chash;
- }
- else
- {
- __next_pointer __np = __cp;
- if _LIBCPP_CONSTEXPR_SINCE_CXX17 (!_UniqueKeys)
- {
- for (; __np->__next_ != nullptr &&
- key_eq()(__cp->__upcast()->__get_value(),
- __np->__next_->__upcast()->__get_value());
- __np = __np->__next_)
- ;
- }
- __pp->__next_ = __np->__next_;
- __np->__next_ = __bucket_list_[__chash]->__next_;
- __bucket_list_[__chash]->__next_ = __cp;
-
- }
- }
+ __pp = __cp;
+ __phash = __chash;
+ } else {
+ __next_pointer __np = __cp;
+ if _LIBCPP_CONSTEXPR_SINCE_CXX17 (!_UniqueKeys) {
+ for (; __np->__next_ != nullptr &&
+ key_eq()(__cp->__upcast()->__get_value(), __np->__next_->__upcast()->__get_value());
+ __np = __np->__next_)
+ ;
}
+ __pp->__next_ = __np->__next_;
+ __np->__next_ = __bucket_list_[__chash]->__next_;
+ __bucket_list_[__chash]->__next_ = __cp;
+ }
}
+ }
}
+ }
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
-{
- size_t __hash = hash_function()(__k);
- size_type __bc = bucket_count();
- if (__bc != 0)
- {
- size_t __chash = std::__constrain_hash(__hash, __bc);
- __next_pointer __nd = __bucket_list_[__chash];
- if (__nd != nullptr)
- {
- for (__nd = __nd->__next_; __nd != nullptr &&
- (__nd->__hash() == __hash
- || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
- __nd = __nd->__next_)
- {
- if ((__nd->__hash() == __hash)
- && key_eq()(__nd->__upcast()->__get_value(), __k))
- return iterator(__nd);
- }
- }
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) {
+ size_t __hash = hash_function()(__k);
+ size_type __bc = bucket_count();
+ if (__bc != 0) {
+ size_t __chash = std::__constrain_hash(__hash, __bc);
+ __next_pointer __nd = __bucket_list_[__chash];
+ if (__nd != nullptr) {
+ for (__nd = __nd->__next_;
+ __nd != nullptr && (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
+ __nd = __nd->__next_) {
+ if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __k))
+ return iterator(__nd);
+ }
}
- return end();
+ }
+ return end();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
-{
- size_t __hash = hash_function()(__k);
- size_type __bc = bucket_count();
- if (__bc != 0)
- {
- size_t __chash = std::__constrain_hash(__hash, __bc);
- __next_pointer __nd = __bucket_list_[__chash];
- if (__nd != nullptr)
- {
- for (__nd = __nd->__next_; __nd != nullptr &&
- (__hash == __nd->__hash()
- || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
- __nd = __nd->__next_)
- {
- if ((__nd->__hash() == __hash)
- && key_eq()(__nd->__upcast()->__get_value(), __k))
- return const_iterator(__nd);
- }
- }
-
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const {
+ size_t __hash = hash_function()(__k);
+ size_type __bc = bucket_count();
+ if (__bc != 0) {
+ size_t __chash = std::__constrain_hash(__hash, __bc);
+ __next_pointer __nd = __bucket_list_[__chash];
+ if (__nd != nullptr) {
+ for (__nd = __nd->__next_;
+ __nd != nullptr && (__hash == __nd->__hash() || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
+ __nd = __nd->__next_) {
+ if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__get_value(), __k))
+ return const_iterator(__nd);
+ }
}
- return end();
+ }
+ return end();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class ..._Args>
+template <class... _Args>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
-{
- static_assert(!__is_hash_value_type<_Args...>::value,
- "Construct cannot be called with a hash value type");
- __node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
-
- // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
- // held inside the node, since we need to use the allocator's construct() method for that.
- //
- // We don't use the allocator's construct() method to construct the node itself since the
- // Cpp17FooInsertable named requirements don't require the allocator's construct() method
- // to work on anything other than the value_type.
- std::__construct_at(std::addressof(*__h), /* next = */nullptr, /* hash = */0);
-
- // Now construct the value_type using the allocator's construct() method.
- __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_Args>(__args)...);
- __h.get_deleter().__value_constructed = true;
-
- __h->__hash_ = hash_function()(__h->__get_value());
- return __h;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&&... __args) {
+ static_assert(!__is_hash_value_type<_Args...>::value, "Construct cannot be called with a hash value type");
+ __node_allocator& __na = __node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+
+ // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
+ // held inside the node, since we need to use the allocator's construct() method for that.
+ //
+ // We don't use the allocator's construct() method to construct the node itself since the
+ // Cpp17FooInsertable named requirements don't require the allocator's construct() method
+ // to work on anything other than the value_type.
+ std::__construct_at(std::addressof(*__h), /* next = */ nullptr, /* hash = */ 0);
+
+ // Now construct the value_type using the allocator's construct() method.
+ __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_Args>(__args)...);
+ __h.get_deleter().__value_constructed = true;
+
+ __h->__hash_ = hash_function()(__h->__get_value());
+ return __h;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _First, class ..._Rest>
+template <class _First, class... _Rest>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(
- size_t __hash, _First&& __f, _Rest&& ...__rest)
-{
- static_assert(!__is_hash_value_type<_First, _Rest...>::value,
- "Construct cannot be called with a hash value type");
- __node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- std::__construct_at(std::addressof(*__h), /* next = */nullptr, /* hash = */__hash);
- __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__get_value()),
- std::forward<_First>(__f),
- std::forward<_Rest>(__rest)...);
- __h.get_deleter().__value_constructed = true;
- return __h;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest) {
+ static_assert(!__is_hash_value_type<_First, _Rest...>::value, "Construct cannot be called with a hash value type");
+ __node_allocator& __na = __node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ std::__construct_at(std::addressof(*__h), /* next = */ nullptr, /* hash = */ __hash);
+ __node_traits::construct(
+ __na, _NodeTypes::__get_ptr(__h->__get_value()), std::forward<_First>(__f), std::forward<_Rest>(__rest)...);
+ __h.get_deleter().__value_constructed = true;
+ return __h;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
-{
- __next_pointer __np = __p.__node_;
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p != end(),
- "unordered container::erase(iterator) called with a non-dereferenceable iterator");
- iterator __r(__np);
- ++__r;
- remove(__p);
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) {
+ __next_pointer __np = __p.__node_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __p != end(), "unordered container::erase(iterator) called with a non-dereferenceable iterator");
+ iterator __r(__np);
+ ++__r;
+ remove(__p);
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
- const_iterator __last)
-{
- for (const_iterator __p = __first; __first != __last; __p = __first)
- {
- ++__first;
- erase(__p);
- }
- __next_pointer __np = __last.__node_;
- return iterator (__np);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, const_iterator __last) {
+ for (const_iterator __p = __first; __first != __last; __p = __first) {
+ ++__first;
+ erase(__p);
+ }
+ __next_pointer __np = __last.__node_;
+ return iterator(__np);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_unique(const _Key& __k)
-{
- iterator __i = find(__k);
- if (__i == end())
- return 0;
- erase(__i);
- return 1;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_unique(const _Key& __k) {
+ iterator __i = find(__k);
+ if (__i == end())
+ return 0;
+ erase(__i);
+ return 1;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k)
-{
- size_type __r = 0;
- iterator __i = find(__k);
- if (__i != end())
- {
- iterator __e = end();
- do
- {
- erase(__i++);
- ++__r;
- } while (__i != __e && key_eq()(*__i, __k));
- }
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k) {
+ size_type __r = 0;
+ iterator __i = find(__k);
+ if (__i != end()) {
+ iterator __e = end();
+ do {
+ erase(__i++);
+ ++__r;
+ } while (__i != __e && key_eq()(*__i, __k));
+ }
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
-{
- // current node
- __next_pointer __cn = __p.__node_;
- size_type __bc = bucket_count();
- size_t __chash = std::__constrain_hash(__cn->__hash(), __bc);
- // find previous node
- __next_pointer __pn = __bucket_list_[__chash];
- for (; __pn->__next_ != __cn; __pn = __pn->__next_)
- ;
- // Fix up __bucket_list_
- // if __pn is not in same bucket (before begin is not in same bucket) &&
- // if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
- if (__pn == __p1_.first().__ptr()
- || std::__constrain_hash(__pn->__hash(), __bc) != __chash)
- {
- if (__cn->__next_ == nullptr
- || std::__constrain_hash(__cn->__next_->__hash(), __bc) != __chash)
- __bucket_list_[__chash] = nullptr;
- }
- // if __cn->__next_ is not in same bucket (nullptr is in same bucket)
- if (__cn->__next_ != nullptr)
- {
- size_t __nhash = std::__constrain_hash(__cn->__next_->__hash(), __bc);
- if (__nhash != __chash)
- __bucket_list_[__nhash] = __pn;
- }
- // remove __cn
- __pn->__next_ = __cn->__next_;
- __cn->__next_ = nullptr;
- --size();
- return __node_holder(__cn->__upcast(), _Dp(__node_alloc(), true));
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT {
+ // current node
+ __next_pointer __cn = __p.__node_;
+ size_type __bc = bucket_count();
+ size_t __chash = std::__constrain_hash(__cn->__hash(), __bc);
+ // find previous node
+ __next_pointer __pn = __bucket_list_[__chash];
+ for (; __pn->__next_ != __cn; __pn = __pn->__next_)
+ ;
+ // Fix up __bucket_list_
+ // if __pn is not in same bucket (before begin is not in same bucket) &&
+ // if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
+ if (__pn == __p1_.first().__ptr() || std::__constrain_hash(__pn->__hash(), __bc) != __chash) {
+ if (__cn->__next_ == nullptr || std::__constrain_hash(__cn->__next_->__hash(), __bc) != __chash)
+ __bucket_list_[__chash] = nullptr;
+ }
+ // if __cn->__next_ is not in same bucket (nullptr is in same bucket)
+ if (__cn->__next_ != nullptr) {
+ size_t __nhash = std::__constrain_hash(__cn->__next_->__hash(), __bc);
+ if (__nhash != __chash)
+ __bucket_list_[__nhash] = __pn;
+ }
+ // remove __cn
+ __pn->__next_ = __cn->__next_;
+ __cn->__next_ = nullptr;
+ --size();
+ return __node_holder(__cn->__upcast(), _Dp(__node_alloc(), true));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
-inline
-typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
-{
- return static_cast<size_type>(find(__k) != end());
+inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const {
+ return static_cast<size_type>(find(__k) != end());
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_multi(const _Key& __k) const
-{
- size_type __r = 0;
- const_iterator __i = find(__k);
- if (__i != end())
- {
- const_iterator __e = end();
- do
- {
- ++__i;
- ++__r;
- } while (__i != __e && key_eq()(*__i, __k));
- }
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_multi(const _Key& __k) const {
+ size_type __r = 0;
+ const_iterator __i = find(__k);
+ if (__i != end()) {
+ const_iterator __e = end();
+ do {
+ ++__i;
+ ++__r;
+ } while (__i != __e && key_eq()(*__i, __k));
+ }
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(
- const _Key& __k)
-{
- iterator __i = find(__k);
- iterator __j = __i;
- if (__i != end())
- ++__j;
- return pair<iterator, iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(const _Key& __k) {
+ iterator __i = find(__k);
+ iterator __j = __i;
+ if (__i != end())
+ ++__j;
+ return pair<iterator, iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(
- const _Key& __k) const
-{
- const_iterator __i = find(__k);
- const_iterator __j = __i;
- if (__i != end())
- ++__j;
- return pair<const_iterator, const_iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique(const _Key& __k) const {
+ const_iterator __i = find(__k);
+ const_iterator __j = __i;
+ if (__i != end())
+ ++__j;
+ return pair<const_iterator, const_iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
- const _Key& __k)
-{
- iterator __i = find(__k);
- iterator __j = __i;
- if (__i != end())
- {
- iterator __e = end();
- do
- {
- ++__j;
- } while (__j != __e && key_eq()(*__j, __k));
- }
- return pair<iterator, iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(const _Key& __k) {
+ iterator __i = find(__k);
+ iterator __j = __i;
+ if (__i != end()) {
+ iterator __e = end();
+ do {
+ ++__j;
+ } while (__j != __e && key_eq()(*__j, __k));
+ }
+ return pair<iterator, iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator,
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
- const _Key& __k) const
-{
- const_iterator __i = find(__k);
- const_iterator __j = __i;
- if (__i != end())
- {
- const_iterator __e = end();
- do
- {
- ++__j;
- } while (__j != __e && key_eq()(*__j, __k));
- }
- return pair<const_iterator, const_iterator>(__i, __j);
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(const _Key& __k) const {
+ const_iterator __i = find(__k);
+ const_iterator __j = __i;
+ if (__i != end()) {
+ const_iterator __e = end();
+ do {
+ ++__j;
+ } while (__j != __e && key_eq()(*__j, __k));
+ }
+ return pair<const_iterator, const_iterator>(__i, __j);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-void
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
+void __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
- && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
- || __is_nothrow_swappable<__pointer_allocator>::value)
- && (!__node_traits::propagate_on_container_swap::value
- || __is_nothrow_swappable<__node_allocator>::value)
- )
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value &&
+ (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__pointer_allocator>::value) &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value))
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__node_traits::propagate_on_container_swap::value ||
- this->__node_alloc() == __u.__node_alloc(),
- "unordered container::swap: Either propagate_on_container_swap "
- "must be true or the allocators must compare equal");
- {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __node_traits::propagate_on_container_swap::value || this->__node_alloc() == __u.__node_alloc(),
+ "unordered container::swap: Either propagate_on_container_swap "
+ "must be true or the allocators must compare equal");
+ {
__node_pointer_pointer __npp = __bucket_list_.release();
__bucket_list_.reset(__u.__bucket_list_.release());
__u.__bucket_list_.reset(__npp);
- }
- std::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
- std::__swap_allocator(__bucket_list_.get_deleter().__alloc(),
- __u.__bucket_list_.get_deleter().__alloc());
- std::__swap_allocator(__node_alloc(), __u.__node_alloc());
- std::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
- __p2_.swap(__u.__p2_);
- __p3_.swap(__u.__p3_);
- if (size() > 0)
- __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
- __p1_.first().__ptr();
- if (__u.size() > 0)
- __u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
- __u.__p1_.first().__ptr();
+ }
+ std::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
+ std::__swap_allocator(__bucket_list_.get_deleter().__alloc(), __u.__bucket_list_.get_deleter().__alloc());
+ std::__swap_allocator(__node_alloc(), __u.__node_alloc());
+ std::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
+ __p2_.swap(__u.__p2_);
+ __p3_.swap(__u.__p3_);
+ if (size() > 0)
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr();
+ if (__u.size() > 0)
+ __u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
+ __u.__p1_.first().__ptr();
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < bucket_count(),
- "unordered container::bucket_size(n) called with n >= bucket_count()");
- __next_pointer __np = __bucket_list_[__n];
- size_type __bc = bucket_count();
- size_type __r = 0;
- if (__np != nullptr)
- {
- for (__np = __np->__next_; __np != nullptr &&
- std::__constrain_hash(__np->__hash(), __bc) == __n;
- __np = __np->__next_, (void) ++__r)
- ;
- }
- return __r;
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __n < bucket_count(), "unordered container::bucket_size(n) called with n >= bucket_count()");
+ __next_pointer __np = __bucket_list_[__n];
+ size_type __bc = bucket_count();
+ size_type __r = 0;
+ if (__np != nullptr) {
+ for (__np = __np->__next_; __np != nullptr && std::__constrain_hash(__np->__hash(), __bc) == __n;
+ __np = __np->__next_, (void)++__r)
+ ;
+ }
+ return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
- __hash_table<_Tp, _Hash, _Equal, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x, __hash_table<_Tp, _Hash, _Equal, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__ios/fpos.h b/contrib/llvm-project/libcxx/include/__ios/fpos.h
index ae578bdbb916..1af1e23ee50d 100644
--- a/contrib/llvm-project/libcxx/include/__ios/fpos.h
+++ b/contrib/llvm-project/libcxx/include/__ios/fpos.h
@@ -57,20 +57,17 @@ public:
};
template <class _StateT>
-inline _LIBCPP_HIDE_FROM_ABI
-streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
+inline _LIBCPP_HIDE_FROM_ABI streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
return streamoff(__x) - streamoff(__y);
}
template <class _StateT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
return streamoff(__x) == streamoff(__y);
}
template <class _StateT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
return streamoff(__x) != streamoff(__y);
}
diff --git a/contrib/llvm-project/libcxx/include/__iterator/access.h b/contrib/llvm-project/libcxx/include/__iterator/access.h
index 3ab3955e12a5..5c6090eeb40c 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/access.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/access.h
@@ -32,85 +32,60 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT
#if !defined(_LIBCPP_CXX03_LANG)
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-begin(_Cp& __c) -> decltype(__c.begin())
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(_Cp& __c) -> decltype(__c.begin()) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-begin(const _Cp& __c) -> decltype(__c.begin())
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(const _Cp& __c) -> decltype(__c.begin()) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-end(_Cp& __c) -> decltype(__c.end())
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(_Cp& __c) -> decltype(__c.end()) {
+ return __c.end();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
-end(const _Cp& __c) -> decltype(__c.end())
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) -> decltype(__c.end()) {
+ return __c.end();
}
-#if _LIBCPP_STD_VER >= 14
+# if _LIBCPP_STD_VER >= 14
template <class _Cp>
_LIBCPP_HIDE_FROM_ABI constexpr auto cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c)))
-> decltype(std::begin(__c)) {
- return std::begin(__c);
+ return std::begin(__c);
}
template <class _Cp>
_LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std::end(__c))) -> decltype(std::end(__c)) {
- return std::end(__c);
+ return std::end(__c);
}
-#endif
-
+# endif
-#else // defined(_LIBCPP_CXX03_LANG)
+#else // defined(_LIBCPP_CXX03_LANG)
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::iterator
-begin(_Cp& __c)
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::const_iterator
-begin(const _Cp& __c)
-{
- return __c.begin();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator begin(const _Cp& __c) {
+ return __c.begin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::iterator
-end(_Cp& __c)
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator end(_Cp& __c) {
+ return __c.end();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI
-typename _Cp::const_iterator
-end(const _Cp& __c)
-{
- return __c.end();
+_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) {
+ return __c.end();
}
#endif // !defined(_LIBCPP_CXX03_LANG)
diff --git a/contrib/llvm-project/libcxx/include/__iterator/advance.h b/contrib/llvm-project/libcxx/include/__iterator/advance.h
index 76938970b0c3..64c8d249f78f 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/advance.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/advance.h
@@ -35,15 +35,15 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void __advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+__advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) {
for (; __n > 0; --__n)
++__i;
}
template <class _BiDirIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+__advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) {
if (__n >= 0)
for (; __n > 0; --__n)
++__i;
@@ -53,17 +53,16 @@ void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference
}
template <class _RandIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+__advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) {
__i += __n;
}
-template <
- class _InputIter, class _Distance,
- class _IntegralDistance = decltype(std::__convert_to_integral(std::declval<_Distance>())),
- class = __enable_if_t<is_integral<_IntegralDistance>::value> >
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-void advance(_InputIter& __i, _Distance __orig_n) {
+template < class _InputIter,
+ class _Distance,
+ class _IntegralDistance = decltype(std::__convert_to_integral(std::declval<_Distance>())),
+ class = __enable_if_t<is_integral<_IntegralDistance>::value> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void advance(_InputIter& __i, _Distance __orig_n) {
typedef typename iterator_traits<_InputIter>::difference_type _Difference;
_Difference __n = static_cast<_Difference>(std::__convert_to_integral(__orig_n));
_LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
@@ -81,8 +80,7 @@ namespace __advance {
struct __fn {
private:
template <class _Ip>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr void __advance_forward(_Ip& __i, iter_difference_t<_Ip> __n) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr void __advance_forward(_Ip& __i, iter_difference_t<_Ip> __n) {
while (__n > 0) {
--__n;
++__i;
@@ -90,8 +88,7 @@ private:
}
template <class _Ip>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr void __advance_backward(_Ip& __i, iter_difference_t<_Ip> __n) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr void __advance_backward(_Ip& __i, iter_difference_t<_Ip> __n) {
while (__n < 0) {
++__n;
--__i;
@@ -101,10 +98,9 @@ private:
public:
// Preconditions: If `I` does not model `bidirectional_iterator`, `n` is not negative.
template <input_or_output_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_Ip& __i, iter_difference_t<_Ip> __n) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || bidirectional_iterator<_Ip>,
- "If `n < 0`, then `bidirectional_iterator<I>` must be true.");
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, iter_difference_t<_Ip> __n) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __n >= 0 || bidirectional_iterator<_Ip>, "If `n < 0`, then `bidirectional_iterator<I>` must be true.");
// If `I` models `random_access_iterator`, equivalent to `i += n`.
if constexpr (random_access_iterator<_Ip>) {
@@ -123,14 +119,16 @@ public:
}
}
- // Preconditions: Either `assignable_from<I&, S> || sized_sentinel_for<S, I>` is modeled, or [i, bound_sentinel) denotes a range.
+ // Preconditions: Either `assignable_from<I&, S> || sized_sentinel_for<S, I>` is modeled, or [i, bound_sentinel)
+ // denotes a range.
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
_LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, _Sp __bound_sentinel) const {
// If `I` and `S` model `assignable_from<I&, S>`, equivalent to `i = std::move(bound_sentinel)`.
if constexpr (assignable_from<_Ip&, _Sp>) {
__i = std::move(__bound_sentinel);
}
- // Otherwise, if `S` and `I` model `sized_sentinel_for<S, I>`, equivalent to `ranges::advance(i, bound_sentinel - i)`.
+ // Otherwise, if `S` and `I` model `sized_sentinel_for<S, I>`, equivalent to `ranges::advance(i, bound_sentinel -
+ // i)`.
else if constexpr (sized_sentinel_for<_Sp, _Ip>) {
(*this)(__i, __bound_sentinel - __i);
}
@@ -145,22 +143,19 @@ public:
// Preconditions:
// * If `n > 0`, [i, bound_sentinel) denotes a range.
// * If `n == 0`, [i, bound_sentinel) or [bound_sentinel, i) denotes a range.
- // * If `n < 0`, [bound_sentinel, i) denotes a range, `I` models `bidirectional_iterator`, and `I` and `S` model `same_as<I, S>`.
+ // * If `n < 0`, [bound_sentinel, i) denotes a range, `I` models `bidirectional_iterator`, and `I` and `S` model
+ // `same_as<I, S>`.
// Returns: `n - M`, where `M` is the difference between the ending and starting position.
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
- _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip& __i, iter_difference_t<_Ip> __n,
- _Sp __bound_sentinel) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip>
+ operator()(_Ip& __i, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const {
_LIBCPP_ASSERT_UNCATEGORIZED((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>),
"If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true.");
// If `S` and `I` model `sized_sentinel_for<S, I>`:
if constexpr (sized_sentinel_for<_Sp, _Ip>) {
// If |n| >= |bound_sentinel - i|, equivalent to `ranges::advance(i, bound_sentinel)`.
// __magnitude_geq(a, b) returns |a| >= |b|, assuming they have the same sign.
- auto __magnitude_geq = [](auto __a, auto __b) {
- return __a == 0 ? __b == 0 :
- __a > 0 ? __a >= __b :
- __a <= __b;
- };
+ auto __magnitude_geq = [](auto __a, auto __b) { return __a == 0 ? __b == 0 : __a > 0 ? __a >= __b : __a <= __b; };
if (const auto __m = __bound_sentinel - __i; __magnitude_geq(__n, __m)) {
(*this)(__i, __bound_sentinel);
return __n - __m;
@@ -194,7 +189,7 @@ public:
} // namespace __advance
inline namespace __cpo {
- inline constexpr auto advance = __advance::__fn{};
+inline constexpr auto advance = __advance::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h
index f022d3bdf8dd..6d3dd4b12966 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/back_insert_iterator.h
@@ -33,42 +33,49 @@ class _LIBCPP_TEMPLATE_VIS back_insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Container* container;
+ _Container* container;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _Container container_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _Container container_type;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit back_insert_iterator(_Container& __x) : container(std::addressof(__x)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator=(const typename _Container::value_type& __value)
- {container->push_back(__value); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit back_insert_iterator(_Container& __x)
+ : container(std::addressof(__x)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator&
+ operator=(const typename _Container::value_type& __value) {
+ container->push_back(__value);
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator=(typename _Container::value_type&& __value)
- {container->push_back(std::move(__value)); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator&
+ operator=(typename _Container::value_type&& __value) {
+ container->push_back(std::move(__value));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) { return *this; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Container* __get_container() const { return container; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Container* __get_container() const { return container; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(back_insert_iterator);
template <class _Container>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-back_insert_iterator<_Container>
-back_inserter(_Container& __x)
-{
- return back_insert_iterator<_Container>(__x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator<_Container>
+back_inserter(_Container& __x) {
+ return back_insert_iterator<_Container>(__x);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h
index d7c308d8da00..7b3f4610d531 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/common_iterator.h
@@ -41,13 +41,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Iter>
+template <class _Iter>
concept __can_use_postfix_proxy =
- constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> &&
- move_constructible<iter_value_t<_Iter>>;
+ constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> && move_constructible<iter_value_t<_Iter>>;
-template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- requires (!same_as<_Iter, _Sent> && copyable<_Iter>)
+template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
+ requires(!same_as<_Iter, _Sent> && copyable<_Iter>)
class common_iterator {
struct __proxy {
_LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>* operator->() const noexcept {
@@ -57,42 +56,42 @@ class common_iterator {
};
struct __postfix_proxy {
- _LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>& operator*() const noexcept {
- return __value_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>& operator*() const noexcept { return __value_; }
iter_value_t<_Iter> __value_;
};
variant<_Iter, _Sent> __hold_;
- template<input_or_output_iterator _OtherIter, sentinel_for<_OtherIter> _OtherSent>
- requires (!same_as<_OtherIter, _OtherSent> && copyable<_OtherIter>)
+ template <input_or_output_iterator _OtherIter, sentinel_for<_OtherIter> _OtherSent>
+ requires(!same_as<_OtherIter, _OtherSent> && copyable<_OtherIter>)
friend class common_iterator;
public:
- _LIBCPP_HIDE_FROM_ABI common_iterator() requires default_initializable<_Iter> = default;
+ _LIBCPP_HIDE_FROM_ABI common_iterator()
+ requires default_initializable<_Iter>
+ = default;
_LIBCPP_HIDE_FROM_ABI constexpr common_iterator(_Iter __i) : __hold_(in_place_type<_Iter>, std::move(__i)) {}
_LIBCPP_HIDE_FROM_ABI constexpr common_iterator(_Sent __s) : __hold_(in_place_type<_Sent>, std::move(__s)) {}
- template<class _I2, class _S2>
+ template <class _I2, class _S2>
requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent>
_LIBCPP_HIDE_FROM_ABI constexpr common_iterator(const common_iterator<_I2, _S2>& __other)
- : __hold_([&]() -> variant<_Iter, _Sent> {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__other.__hold_.valueless_by_exception(),
- "Attempted to construct from a valueless common_iterator");
- if (__other.__hold_.index() == 0)
- return variant<_Iter, _Sent>{in_place_index<0>, std::__unchecked_get<0>(__other.__hold_)};
- return variant<_Iter, _Sent>{in_place_index<1>, std::__unchecked_get<1>(__other.__hold_)};
- }()) {}
-
- template<class _I2, class _S2>
+ : __hold_([&]() -> variant<_Iter, _Sent> {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__other.__hold_.valueless_by_exception(), "Attempted to construct from a valueless common_iterator");
+ if (__other.__hold_.index() == 0)
+ return variant<_Iter, _Sent>{in_place_index<0>, std::__unchecked_get<0>(__other.__hold_)};
+ return variant<_Iter, _Sent>{in_place_index<1>, std::__unchecked_get<1>(__other.__hold_)};
+ }()) {}
+
+ template <class _I2, class _S2>
requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent> &&
assignable_from<_Iter&, const _I2&> && assignable_from<_Sent&, const _S2&>
_LIBCPP_HIDE_FROM_ABI common_iterator& operator=(const common_iterator<_I2, _S2>& __other) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__other.__hold_.valueless_by_exception(),
- "Attempted to assign from a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__other.__hold_.valueless_by_exception(), "Attempted to assign from a valueless common_iterator");
- auto __idx = __hold_.index();
+ auto __idx = __hold_.index();
auto __other_idx = __other.__hold_.index();
// If they're the same index, just assign.
@@ -110,31 +109,29 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*()
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to dereference a non-dereferenceable common_iterator");
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
return *std::__unchecked_get<_Iter>(__hold_);
}
_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
requires __dereferenceable<const _Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to dereference a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
return *std::__unchecked_get<_Iter>(__hold_);
}
- template<class _I2 = _Iter>
+ template <class _I2 = _Iter>
_LIBCPP_HIDE_FROM_ABI decltype(auto) operator->() const
- requires indirectly_readable<const _I2> &&
- (requires(const _I2& __i) { __i.operator->(); } ||
- is_reference_v<iter_reference_t<_I2>> ||
- constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>)
+ requires indirectly_readable<const _I2> && (requires(const _I2& __i) {
+ __i.operator->();
+ } || is_reference_v<iter_reference_t<_I2>> || constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>)
{
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to dereference a non-dereferenceable common_iterator");
- if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
+ if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) {
return std::__unchecked_get<_Iter>(__hold_);
} else if constexpr (is_reference_v<iter_reference_t<_Iter>>) {
auto&& __tmp = *std::__unchecked_get<_Iter>(__hold_);
@@ -145,20 +142,22 @@ public:
}
_LIBCPP_HIDE_FROM_ABI common_iterator& operator++() {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to increment a non-dereferenceable common_iterator");
- ++std::__unchecked_get<_Iter>(__hold_); return *this;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
+ ++std::__unchecked_get<_Iter>(__hold_);
+ return *this;
}
_LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_),
- "Attempted to increment a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
if constexpr (forward_iterator<_Iter>) {
auto __tmp = *this;
++*this;
return __tmp;
- } else if constexpr (requires (_Iter& __i) { { *__i++ } -> __can_reference; } ||
- !__can_use_postfix_proxy<_Iter>) {
+ } else if constexpr (requires(_Iter& __i) {
+ { *__i++ } -> __can_reference;
+ } || !__can_use_postfix_proxy<_Iter>) {
return std::__unchecked_get<_Iter>(__hold_)++;
} else {
auto __p = __postfix_proxy{**this};
@@ -167,14 +166,14 @@ public:
}
}
- template<class _I2, sentinel_for<_Iter> _S2>
+ template <class _I2, sentinel_for<_Iter> _S2>
requires sentinel_for<_Sent, _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool
+ operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
auto __x_index = __x.__hold_.index();
auto __y_index = __y.__hold_.index();
@@ -188,14 +187,14 @@ public:
return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
}
- template<class _I2, sentinel_for<_Iter> _S2>
+ template <class _I2, sentinel_for<_Iter> _S2>
requires sentinel_for<_Sent, _I2> && equality_comparable_with<_Iter, _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(),
- "Attempted to compare a valueless common_iterator");
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool
+ operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
auto __x_index = __x.__hold_.index();
auto __y_index = __y.__hold_.index();
@@ -204,22 +203,22 @@ public:
return true;
if (__x_index == 0 && __y_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
if (__x_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_S2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_S2>(__y.__hold_);
- return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
+ return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
}
- template<sized_sentinel_for<_Iter> _I2, sized_sentinel_for<_Iter> _S2>
+ template <sized_sentinel_for<_Iter> _I2, sized_sentinel_for<_Iter> _S2>
requires sized_sentinel_for<_Sent, _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_I2> operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(),
- "Attempted to subtract from a valueless common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(),
- "Attempted to subtract a valueless common_iterator");
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
+ operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__x.__hold_.valueless_by_exception(), "Attempted to subtract from a valueless common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !__y.__hold_.valueless_by_exception(), "Attempted to subtract a valueless common_iterator");
auto __x_index = __x.__hold_.index();
auto __y_index = __y.__hold_.index();
@@ -228,73 +227,67 @@ public:
return 0;
if (__x_index == 0 && __y_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
if (__x_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_S2>(__y.__hold_);
+ return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_S2>(__y.__hold_);
return std::__unchecked_get<_Sent>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& __i)
- noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
- requires input_iterator<_Iter>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
+ requires input_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__i.__hold_),
- "Attempted to iter_move a non-dereferenceable common_iterator");
- return ranges::iter_move( std::__unchecked_get<_Iter>(__i.__hold_));
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator");
+ return ranges::iter_move(std::__unchecked_get<_Iter>(__i.__hold_));
}
- template<indirectly_swappable<_Iter> _I2, class _S2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y)
- noexcept(noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>())))
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__x.__hold_),
- "Attempted to iter_swap a non-dereferenceable common_iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_I2>(__y.__hold_),
- "Attempted to iter_swap a non-dereferenceable common_iterator");
+ template <indirectly_swappable<_Iter> _I2, class _S2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) noexcept(
+ noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>()))) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
return ranges::iter_swap(std::__unchecked_get<_Iter>(__x.__hold_), std::__unchecked_get<_I2>(__y.__hold_));
}
};
-template<class _Iter, class _Sent>
+template <class _Iter, class _Sent>
struct incrementable_traits<common_iterator<_Iter, _Sent>> {
using difference_type = iter_difference_t<_Iter>;
};
-template<class _Iter>
-concept __denotes_forward_iter =
- requires { typename iterator_traits<_Iter>::iterator_category; } &&
- derived_from<typename iterator_traits<_Iter>::iterator_category, forward_iterator_tag>;
+template <class _Iter>
+concept __denotes_forward_iter = requires {
+ typename iterator_traits<_Iter>::iterator_category;
+} && derived_from<typename iterator_traits<_Iter>::iterator_category, forward_iterator_tag>;
-template<class _Iter, class _Sent>
-concept __common_iter_has_ptr_op = requires(const common_iterator<_Iter, _Sent>& __a) {
- __a.operator->();
-};
+template <class _Iter, class _Sent>
+concept __common_iter_has_ptr_op = requires(const common_iterator<_Iter, _Sent>& __a) { __a.operator->(); };
-template<class, class>
+template <class, class>
struct __arrow_type_or_void {
- using type = void;
+ using type = void;
};
-template<class _Iter, class _Sent>
+template <class _Iter, class _Sent>
requires __common_iter_has_ptr_op<_Iter, _Sent>
struct __arrow_type_or_void<_Iter, _Sent> {
- using type = decltype(std::declval<const common_iterator<_Iter, _Sent>&>().operator->());
+ using type = decltype(std::declval<const common_iterator<_Iter, _Sent>&>().operator->());
};
-template<input_iterator _Iter, class _Sent>
+template <input_iterator _Iter, class _Sent>
struct iterator_traits<common_iterator<_Iter, _Sent>> {
- using iterator_concept = _If<forward_iterator<_Iter>,
- forward_iterator_tag,
- input_iterator_tag>;
- using iterator_category = _If<__denotes_forward_iter<_Iter>,
- forward_iterator_tag,
- input_iterator_tag>;
- using pointer = typename __arrow_type_or_void<_Iter, _Sent>::type;
- using value_type = iter_value_t<_Iter>;
- using difference_type = iter_difference_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
+ using iterator_concept = _If<forward_iterator<_Iter>, forward_iterator_tag, input_iterator_tag>;
+ using iterator_category = _If<__denotes_forward_iter<_Iter>, forward_iterator_tag, input_iterator_tag>;
+ using pointer = typename __arrow_type_or_void<_Iter, _Sent>::type;
+ using value_type = iter_value_t<_Iter>;
+ using difference_type = iter_difference_t<_Iter>;
+ using reference = iter_reference_t<_Iter>;
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/concepts.h b/contrib/llvm-project/libcxx/include/__iterator/concepts.h
index 614de85847a0..afb7b821a99c 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/concepts.h
@@ -49,246 +49,198 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [iterator.concept.readable]
-template<class _In>
+template <class _In>
concept __indirectly_readable_impl =
- requires(const _In __i) {
- typename iter_value_t<_In>;
- typename iter_reference_t<_In>;
- typename iter_rvalue_reference_t<_In>;
- { *__i } -> same_as<iter_reference_t<_In>>;
- { ranges::iter_move(__i) } -> same_as<iter_rvalue_reference_t<_In>>;
- } &&
- common_reference_with<iter_reference_t<_In>&&, iter_value_t<_In>&> &&
- common_reference_with<iter_reference_t<_In>&&, iter_rvalue_reference_t<_In>&&> &&
- common_reference_with<iter_rvalue_reference_t<_In>&&, const iter_value_t<_In>&>;
-
-template<class _In>
+ requires(const _In __i) {
+ typename iter_value_t<_In>;
+ typename iter_reference_t<_In>;
+ typename iter_rvalue_reference_t<_In>;
+ { *__i } -> same_as<iter_reference_t<_In>>;
+ { ranges::iter_move(__i) } -> same_as<iter_rvalue_reference_t<_In>>;
+ } && common_reference_with<iter_reference_t<_In>&&, iter_value_t<_In>&> &&
+ common_reference_with<iter_reference_t<_In>&&, iter_rvalue_reference_t<_In>&&> &&
+ common_reference_with<iter_rvalue_reference_t<_In>&&, const iter_value_t<_In>&>;
+
+template <class _In>
concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>;
-template<indirectly_readable _Tp>
+template <indirectly_readable _Tp>
using iter_common_reference_t = common_reference_t<iter_reference_t<_Tp>, iter_value_t<_Tp>&>;
// [iterator.concept.writable]
-template<class _Out, class _Tp>
-concept indirectly_writable =
- requires(_Out&& __o, _Tp&& __t) {
- *__o = std::forward<_Tp>(__t); // not required to be equality-preserving
- *std::forward<_Out>(__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
- const_cast<const iter_reference_t<_Out>&&>(*__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
- const_cast<const iter_reference_t<_Out>&&>(*std::forward<_Out>(__o)) = std::forward<_Tp>(__t); // not required to be equality-preserving
- };
+template <class _Out, class _Tp>
+concept indirectly_writable = requires(_Out&& __o, _Tp&& __t) {
+ *__o = std::forward<_Tp>(__t); // not required to be equality-preserving
+ *std::forward<_Out>(__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
+ const_cast<const iter_reference_t<_Out>&&>(*__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
+ const_cast<const iter_reference_t<_Out>&&>(*std::forward<_Out>(__o)) =
+ std::forward<_Tp>(__t); // not required to be equality-preserving
+};
// [iterator.concept.winc]
-template<class _Tp>
+template <class _Tp>
concept __integer_like = integral<_Tp> && !same_as<_Tp, bool>;
-template<class _Tp>
+template <class _Tp>
concept __signed_integer_like = signed_integral<_Tp>;
-template<class _Ip>
+template <class _Ip>
concept weakly_incrementable =
- // TODO: remove this once the clang bug is fixed (bugs.llvm.org/PR48173).
- !same_as<_Ip, bool> && // Currently, clang does not handle bool correctly.
- movable<_Ip> &&
- requires(_Ip __i) {
- typename iter_difference_t<_Ip>;
- requires __signed_integer_like<iter_difference_t<_Ip>>;
- { ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
- __i++; // not required to be equality-preserving
- };
+ // TODO: remove this once the clang bug is fixed (bugs.llvm.org/PR48173).
+ !same_as<_Ip, bool> && // Currently, clang does not handle bool correctly.
+ movable<_Ip> && requires(_Ip __i) {
+ typename iter_difference_t<_Ip>;
+ requires __signed_integer_like<iter_difference_t<_Ip>>;
+ { ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
+ __i++; // not required to be equality-preserving
+ };
// [iterator.concept.inc]
-template<class _Ip>
-concept incrementable =
- regular<_Ip> &&
- weakly_incrementable<_Ip> &&
- requires(_Ip __i) {
- { __i++ } -> same_as<_Ip>;
- };
+template <class _Ip>
+concept incrementable = regular<_Ip> && weakly_incrementable<_Ip> && requires(_Ip __i) {
+ { __i++ } -> same_as<_Ip>;
+};
// [iterator.concept.iterator]
-template<class _Ip>
-concept input_or_output_iterator =
- requires(_Ip __i) {
- { *__i } -> __can_reference;
- } &&
- weakly_incrementable<_Ip>;
+template <class _Ip>
+concept input_or_output_iterator = requires(_Ip __i) {
+ { *__i } -> __can_reference;
+} && weakly_incrementable<_Ip>;
// [iterator.concept.sentinel]
-template<class _Sp, class _Ip>
-concept sentinel_for =
- semiregular<_Sp> &&
- input_or_output_iterator<_Ip> &&
- __weakly_equality_comparable_with<_Sp, _Ip>;
+template <class _Sp, class _Ip>
+concept sentinel_for = semiregular<_Sp> && input_or_output_iterator<_Ip> && __weakly_equality_comparable_with<_Sp, _Ip>;
-template<class, class>
+template <class, class>
inline constexpr bool disable_sized_sentinel_for = false;
-template<class _Sp, class _Ip>
+template <class _Sp, class _Ip>
concept sized_sentinel_for =
- sentinel_for<_Sp, _Ip> &&
- !disable_sized_sentinel_for<remove_cv_t<_Sp>, remove_cv_t<_Ip>> &&
- requires(const _Ip& __i, const _Sp& __s) {
- { __s - __i } -> same_as<iter_difference_t<_Ip>>;
- { __i - __s } -> same_as<iter_difference_t<_Ip>>;
- };
+ sentinel_for<_Sp, _Ip> && !disable_sized_sentinel_for<remove_cv_t<_Sp>, remove_cv_t<_Ip>> &&
+ requires(const _Ip& __i, const _Sp& __s) {
+ { __s - __i } -> same_as<iter_difference_t<_Ip>>;
+ { __i - __s } -> same_as<iter_difference_t<_Ip>>;
+ };
// [iterator.concept.input]
-template<class _Ip>
-concept input_iterator =
- input_or_output_iterator<_Ip> &&
- indirectly_readable<_Ip> &&
- requires { typename _ITER_CONCEPT<_Ip>; } &&
- derived_from<_ITER_CONCEPT<_Ip>, input_iterator_tag>;
+template <class _Ip>
+concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
+ typename _ITER_CONCEPT<_Ip>;
+} && derived_from<_ITER_CONCEPT<_Ip>, input_iterator_tag>;
// [iterator.concept.output]
-template<class _Ip, class _Tp>
+template <class _Ip, class _Tp>
concept output_iterator =
- input_or_output_iterator<_Ip> &&
- indirectly_writable<_Ip, _Tp> &&
- requires (_Ip __it, _Tp&& __t) {
- *__it++ = std::forward<_Tp>(__t); // not required to be equality-preserving
- };
+ input_or_output_iterator<_Ip> && indirectly_writable<_Ip, _Tp> && requires(_Ip __it, _Tp&& __t) {
+ *__it++ = std::forward<_Tp>(__t); // not required to be equality-preserving
+ };
// [iterator.concept.forward]
-template<class _Ip>
+template <class _Ip>
concept forward_iterator =
- input_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> &&
- incrementable<_Ip> &&
- sentinel_for<_Ip, _Ip>;
+ input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
+ sentinel_for<_Ip, _Ip>;
// [iterator.concept.bidir]
-template<class _Ip>
+template <class _Ip>
concept bidirectional_iterator =
- forward_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> &&
- requires(_Ip __i) {
- { --__i } -> same_as<_Ip&>;
- { __i-- } -> same_as<_Ip>;
- };
-
-template<class _Ip>
+ forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
+ { --__i } -> same_as<_Ip&>;
+ { __i-- } -> same_as<_Ip>;
+ };
+
+template <class _Ip>
concept random_access_iterator =
- bidirectional_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
- totally_ordered<_Ip> &&
- sized_sentinel_for<_Ip, _Ip> &&
- requires(_Ip __i, const _Ip __j, const iter_difference_t<_Ip> __n) {
- { __i += __n } -> same_as<_Ip&>;
- { __j + __n } -> same_as<_Ip>;
- { __n + __j } -> same_as<_Ip>;
- { __i -= __n } -> same_as<_Ip&>;
- { __j - __n } -> same_as<_Ip>;
- { __j[__n] } -> same_as<iter_reference_t<_Ip>>;
- };
-
-template<class _Ip>
+ bidirectional_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
+ totally_ordered<_Ip> && sized_sentinel_for<_Ip, _Ip> &&
+ requires(_Ip __i, const _Ip __j, const iter_difference_t<_Ip> __n) {
+ { __i += __n } -> same_as<_Ip&>;
+ { __j + __n } -> same_as<_Ip>;
+ { __n + __j } -> same_as<_Ip>;
+ { __i -= __n } -> same_as<_Ip&>;
+ { __j - __n } -> same_as<_Ip>;
+ { __j[__n] } -> same_as<iter_reference_t<_Ip>>;
+ };
+
+template <class _Ip>
concept contiguous_iterator =
- random_access_iterator<_Ip> &&
- derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
- is_lvalue_reference_v<iter_reference_t<_Ip>> &&
- same_as<iter_value_t<_Ip>, remove_cvref_t<iter_reference_t<_Ip>>> &&
- requires(const _Ip& __i) {
- { std::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
- };
-
-template<class _Ip>
+ random_access_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
+ is_lvalue_reference_v<iter_reference_t<_Ip>> && same_as<iter_value_t<_Ip>, remove_cvref_t<iter_reference_t<_Ip>>> &&
+ requires(const _Ip& __i) {
+ { std::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
+ };
+
+template <class _Ip>
concept __has_arrow = input_iterator<_Ip> && (is_pointer_v<_Ip> || requires(_Ip __i) { __i.operator->(); });
// [indirectcallable.indirectinvocable]
-template<class _Fp, class _It>
+template <class _Fp, class _It>
concept indirectly_unary_invocable =
- indirectly_readable<_It> &&
- copy_constructible<_Fp> &&
- invocable<_Fp&, iter_value_t<_It>&> &&
- invocable<_Fp&, iter_reference_t<_It>> &&
- invocable<_Fp&, iter_common_reference_t<_It>> &&
- common_reference_with<
- invoke_result_t<_Fp&, iter_value_t<_It>&>,
- invoke_result_t<_Fp&, iter_reference_t<_It>>>;
-
-template<class _Fp, class _It>
+ indirectly_readable<_It> && copy_constructible<_Fp> && invocable<_Fp&, iter_value_t<_It>&> &&
+ invocable<_Fp&, iter_reference_t<_It>> && invocable<_Fp&, iter_common_reference_t<_It>> &&
+ common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>;
+
+template <class _Fp, class _It>
concept indirectly_regular_unary_invocable =
- indirectly_readable<_It> &&
- copy_constructible<_Fp> &&
- regular_invocable<_Fp&, iter_value_t<_It>&> &&
- regular_invocable<_Fp&, iter_reference_t<_It>> &&
- regular_invocable<_Fp&, iter_common_reference_t<_It>> &&
- common_reference_with<
- invoke_result_t<_Fp&, iter_value_t<_It>&>,
- invoke_result_t<_Fp&, iter_reference_t<_It>>>;
-
-template<class _Fp, class _It>
+ indirectly_readable<_It> && copy_constructible<_Fp> && regular_invocable<_Fp&, iter_value_t<_It>&> &&
+ regular_invocable<_Fp&, iter_reference_t<_It>> && regular_invocable<_Fp&, iter_common_reference_t<_It>> &&
+ common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>;
+
+template <class _Fp, class _It>
concept indirect_unary_predicate =
- indirectly_readable<_It> &&
- copy_constructible<_Fp> &&
- predicate<_Fp&, iter_value_t<_It>&> &&
- predicate<_Fp&, iter_reference_t<_It>> &&
- predicate<_Fp&, iter_common_reference_t<_It>>;
+ indirectly_readable<_It> && copy_constructible<_Fp> && predicate<_Fp&, iter_value_t<_It>&> &&
+ predicate<_Fp&, iter_reference_t<_It>> && predicate<_Fp&, iter_common_reference_t<_It>>;
-template<class _Fp, class _It1, class _It2>
+template <class _Fp, class _It1, class _It2>
concept indirect_binary_predicate =
- indirectly_readable<_It1> && indirectly_readable<_It2> &&
- copy_constructible<_Fp> &&
- predicate<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- predicate<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- predicate<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- predicate<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
- predicate<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
-
-template<class _Fp, class _It1, class _It2 = _It1>
+ indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
+ predicate<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
+ predicate<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
+ predicate<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
+ predicate<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
+ predicate<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
+
+template <class _Fp, class _It1, class _It2 = _It1>
concept indirect_equivalence_relation =
- indirectly_readable<_It1> && indirectly_readable<_It2> &&
- copy_constructible<_Fp> &&
- equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
- equivalence_relation<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
-
-template<class _Fp, class _It1, class _It2 = _It1>
+ indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
+ equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
+ equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
+ equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
+ equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
+ equivalence_relation<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
+
+template <class _Fp, class _It1, class _It2 = _It1>
concept indirect_strict_weak_order =
- indirectly_readable<_It1> && indirectly_readable<_It2> &&
- copy_constructible<_Fp> &&
- strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
- strict_weak_order<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
-
-template<class _Fp, class... _Its>
- requires (indirectly_readable<_Its> && ...) && invocable<_Fp, iter_reference_t<_Its>...>
+ indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
+ strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
+ strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
+ strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
+ strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> &&
+ strict_weak_order<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>;
+
+template <class _Fp, class... _Its>
+ requires(indirectly_readable<_Its> && ...) && invocable<_Fp, iter_reference_t<_Its>...>
using indirect_result_t = invoke_result_t<_Fp, iter_reference_t<_Its>...>;
-template<class _In, class _Out>
-concept indirectly_movable =
- indirectly_readable<_In> &&
- indirectly_writable<_Out, iter_rvalue_reference_t<_In>>;
+template <class _In, class _Out>
+concept indirectly_movable = indirectly_readable<_In> && indirectly_writable<_Out, iter_rvalue_reference_t<_In>>;
-template<class _In, class _Out>
+template <class _In, class _Out>
concept indirectly_movable_storable =
- indirectly_movable<_In, _Out> &&
- indirectly_writable<_Out, iter_value_t<_In>> &&
- movable<iter_value_t<_In>> &&
- constructible_from<iter_value_t<_In>, iter_rvalue_reference_t<_In>> &&
- assignable_from<iter_value_t<_In>&, iter_rvalue_reference_t<_In>>;
-
-template<class _In, class _Out>
-concept indirectly_copyable =
- indirectly_readable<_In> &&
- indirectly_writable<_Out, iter_reference_t<_In>>;
-
-template<class _In, class _Out>
+ indirectly_movable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>> && movable<iter_value_t<_In>> &&
+ constructible_from<iter_value_t<_In>, iter_rvalue_reference_t<_In>> &&
+ assignable_from<iter_value_t<_In>&, iter_rvalue_reference_t<_In>>;
+
+template <class _In, class _Out>
+concept indirectly_copyable = indirectly_readable<_In> && indirectly_writable<_Out, iter_reference_t<_In>>;
+
+template <class _In, class _Out>
concept indirectly_copyable_storable =
- indirectly_copyable<_In, _Out> &&
- indirectly_writable<_Out, iter_value_t<_In>&> &&
- indirectly_writable<_Out, const iter_value_t<_In>&> &&
- indirectly_writable<_Out, iter_value_t<_In>&&> &&
- indirectly_writable<_Out, const iter_value_t<_In>&&> &&
- copyable<iter_value_t<_In>> &&
- constructible_from<iter_value_t<_In>, iter_reference_t<_In>> &&
- assignable_from<iter_value_t<_In>&, iter_reference_t<_In>>;
+ indirectly_copyable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>&> &&
+ indirectly_writable<_Out, const iter_value_t<_In>&> && indirectly_writable<_Out, iter_value_t<_In>&&> &&
+ indirectly_writable<_Out, const iter_value_t<_In>&&> && copyable<iter_value_t<_In>> &&
+ constructible_from<iter_value_t<_In>, iter_reference_t<_In>> &&
+ assignable_from<iter_value_t<_In>&, iter_reference_t<_In>>;
// Note: indirectly_swappable is located in iter_swap.h to prevent a dependency cycle
// (both iter_swap and indirectly_swappable require indirectly_readable).
@@ -298,10 +250,10 @@ concept indirectly_copyable_storable =
template <class _Tp>
using __has_random_access_iterator_category_or_concept
#if _LIBCPP_STD_VER >= 20
- = integral_constant<bool, random_access_iterator<_Tp>>;
-#else // _LIBCPP_STD_VER < 20
- = __has_random_access_iterator_category<_Tp>;
-#endif // _LIBCPP_STD_VER
+ = integral_constant<bool, random_access_iterator<_Tp>>;
+#else // _LIBCPP_STD_VER < 20
+ = __has_random_access_iterator_category<_Tp>;
+#endif // _LIBCPP_STD_VER
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h
index 171c0d7f0e77..008c52fa87ce 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/counted_iterator.h
@@ -41,118 +41,110 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class>
+template <class>
struct __counted_iterator_concept {};
-template<class _Iter>
+template <class _Iter>
requires requires { typename _Iter::iterator_concept; }
struct __counted_iterator_concept<_Iter> {
using iterator_concept = typename _Iter::iterator_concept;
};
-template<class>
+template <class>
struct __counted_iterator_category {};
-template<class _Iter>
+template <class _Iter>
requires requires { typename _Iter::iterator_category; }
struct __counted_iterator_category<_Iter> {
using iterator_category = typename _Iter::iterator_category;
};
-template<class>
+template <class>
struct __counted_iterator_value_type {};
-template<indirectly_readable _Iter>
+template <indirectly_readable _Iter>
struct __counted_iterator_value_type<_Iter> {
using value_type = iter_value_t<_Iter>;
};
-template<input_or_output_iterator _Iter>
+template <input_or_output_iterator _Iter>
class counted_iterator
- : public __counted_iterator_concept<_Iter>
- , public __counted_iterator_category<_Iter>
- , public __counted_iterator_value_type<_Iter>
-{
+ : public __counted_iterator_concept<_Iter>,
+ public __counted_iterator_category<_Iter>,
+ public __counted_iterator_value_type<_Iter> {
public:
- using iterator_type = _Iter;
+ using iterator_type = _Iter;
using difference_type = iter_difference_t<_Iter>;
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator() requires default_initializable<_Iter> = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator()
+ requires default_initializable<_Iter>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator(_Iter __iter, iter_difference_t<_Iter> __n)
- : __current_(std::move(__iter)), __count_(__n) {
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator(_Iter __iter, iter_difference_t<_Iter> __n)
+ : __current_(std::move(__iter)), __count_(__n) {
_LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "__n must not be negative.");
}
- template<class _I2>
+ template <class _I2>
requires convertible_to<const _I2&, _Iter>
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator(const counted_iterator<_I2>& __other)
- : __current_(__other.__current_), __count_(__other.__count_) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator(const counted_iterator<_I2>& __other)
+ : __current_(__other.__current_), __count_(__other.__count_) {}
- template<class _I2>
+ template <class _I2>
requires assignable_from<_Iter&, const _I2&>
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator=(const counted_iterator<_I2>& __other) {
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator=(const counted_iterator<_I2>& __other) {
__current_ = __other.__current_;
- __count_ = __other.__count_;
+ __count_ = __other.__count_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr const _Iter& base() const& noexcept { return __current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Iter base() && { return std::move(__current_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end.");
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
return *__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
requires __dereferenceable<const _Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
return *__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator->() const noexcept
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator->() const noexcept
requires contiguous_iterator<_Iter>
{
return std::to_address(__current_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator++() {
_LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
++__current_;
--__count_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- decltype(auto) operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) {
_LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
--__count_;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try { return __current_++; }
- catch(...) { ++__count_; throw; }
-#else
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+ return __current_++;
+ } catch (...) {
+ ++__count_;
+ throw;
+ }
+# else
return __current_++;
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator++(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator++(int)
requires forward_iterator<_Iter>
{
_LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
@@ -161,8 +153,7 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator--()
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator--()
requires bidirectional_iterator<_Iter>
{
--__current_;
@@ -170,8 +161,7 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator--(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator--(int)
requires bidirectional_iterator<_Iter>
{
counted_iterator __tmp = *this;
@@ -179,23 +169,20 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const
requires random_access_iterator<_Iter>
{
return counted_iterator(__current_ + __n, __count_ - __n);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr counted_iterator operator+(
- iter_difference_t<_Iter> __n, const counted_iterator& __x)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr counted_iterator
+ operator+(iter_difference_t<_Iter> __n, const counted_iterator& __x)
requires random_access_iterator<_Iter>
{
return __x + __n;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator+=(iter_difference_t<_Iter> __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator+=(iter_difference_t<_Iter> __n)
requires random_access_iterator<_Iter>
{
_LIBCPP_ASSERT_UNCATEGORIZED(__n <= __count_, "Cannot advance iterator past end.");
@@ -204,110 +191,93 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const
requires random_access_iterator<_Iter>
{
return counted_iterator(__current_ - __n, __count_ + __n);
}
- template<common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_I2> operator-(
- const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs)
- {
+ template <common_with<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
+ operator-(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
return __rhs.__count_ - __lhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Iter> operator-(
- const counted_iterator& __lhs, default_sentinel_t)
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
+ operator-(const counted_iterator& __lhs, default_sentinel_t) {
return -__lhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Iter> operator-(
- default_sentinel_t, const counted_iterator& __rhs)
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
+ operator-(default_sentinel_t, const counted_iterator& __rhs) {
return __rhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr counted_iterator& operator-=(iter_difference_t<_Iter> __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator-=(iter_difference_t<_Iter> __n)
requires random_access_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(-__n <= __count_,
- "Attempt to subtract too large of a size: "
- "counted_iterator would be decremented before the "
- "first element of its range.");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ -__n <= __count_,
+ "Attempt to subtract too large of a size: "
+ "counted_iterator would be decremented before the "
+ "first element of its range.");
__current_ -= __n;
__count_ += __n;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const
requires random_access_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(__n < __count_, "Subscript argument must be less than size.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < __count_, "Subscript argument must be less than size.");
return __current_[__n];
}
- template<common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(
- const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs)
- {
+ template <common_with<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool
+ operator==(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
return __lhs.__count_ == __rhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(
- const counted_iterator& __lhs, default_sentinel_t)
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const counted_iterator& __lhs, default_sentinel_t) {
return __lhs.__count_ == 0;
}
- template<common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>(
- const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs)
- {
+ template <common_with<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
+ operator<=>(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
return __rhs.__count_ <=> __lhs.__count_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const counted_iterator& __i)
- noexcept(noexcept(ranges::iter_move(__i.__current_)))
- requires input_iterator<_Iter>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_)))
+ requires input_iterator<_Iter>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(__i.__count_ > 0, "Iterator must not be past end of range.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i.__count_ > 0, "Iterator must not be past end of range.");
return ranges::iter_move(__i.__current_);
}
- template<indirectly_swappable<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const counted_iterator& __x, const counted_iterator<_I2>& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__x.__count_ > 0 && __y.__count_ > 0,
- "Iterators must not be past end of range.");
+ template <indirectly_swappable<_Iter> _I2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const counted_iterator& __x,
+ const counted_iterator<_I2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __x.__count_ > 0 && __y.__count_ > 0, "Iterators must not be past end of range.");
return ranges::iter_swap(__x.__current_, __y.__current_);
}
private:
_LIBCPP_NO_UNIQUE_ADDRESS _Iter __current_ = _Iter();
- iter_difference_t<_Iter> __count_ = 0;
- template<input_or_output_iterator _OtherIter>
+ iter_difference_t<_Iter> __count_ = 0;
+ template <input_or_output_iterator _OtherIter>
friend class counted_iterator;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(counted_iterator);
-template<input_iterator _Iter>
+template <input_iterator _Iter>
requires same_as<_ITER_TRAITS<_Iter>, iterator_traits<_Iter>>
struct iterator_traits<counted_iterator<_Iter>> : iterator_traits<_Iter> {
- using pointer = conditional_t<contiguous_iterator<_Iter>,
- add_pointer_t<iter_reference_t<_Iter>>, void>;
+ using pointer = conditional_t<contiguous_iterator<_Iter>, add_pointer_t<iter_reference_t<_Iter>>, void>;
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/data.h b/contrib/llvm-project/libcxx/include/__iterator/data.h
index 894de49991d6..398673906101 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/data.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/data.h
@@ -22,27 +22,25 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _Cont> constexpr
-_LIBCPP_HIDE_FROM_ABI
-auto data(_Cont& __c)
-_NOEXCEPT_(noexcept(__c.data()))
--> decltype (__c.data())
-{ return __c.data(); }
-
-template <class _Cont> constexpr
-_LIBCPP_HIDE_FROM_ABI
-auto data(const _Cont& __c)
-_NOEXCEPT_(noexcept(__c.data()))
--> decltype (__c.data())
-{ return __c.data(); }
+template <class _Cont>
+constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) _NOEXCEPT_(noexcept(__c.data())) -> decltype(__c.data()) {
+ return __c.data();
+}
+
+template <class _Cont>
+constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) _NOEXCEPT_(noexcept(__c.data())) -> decltype(__c.data()) {
+ return __c.data();
+}
template <class _Tp, size_t _Sz>
-_LIBCPP_HIDE_FROM_ABI
-constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept {
+ return __array;
+}
template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI
-constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
+_LIBCPP_HIDE_FROM_ABI constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept {
+ return __il.begin();
+}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h b/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h
index d5fb2b699ad4..3b65f442f1a8 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/default_sentinel.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-struct default_sentinel_t { };
+struct default_sentinel_t {};
inline constexpr default_sentinel_t default_sentinel{};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/distance.h b/contrib/llvm-project/libcxx/include/__iterator/distance.h
index 83a926539095..75bd49c9ae73 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/distance.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/distance.h
@@ -27,30 +27,24 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-typename iterator_traits<_InputIter>::difference_type
-__distance(_InputIter __first, _InputIter __last, input_iterator_tag)
-{
- typename iterator_traits<_InputIter>::difference_type __r(0);
- for (; __first != __last; ++__first)
- ++__r;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type
+__distance(_InputIter __first, _InputIter __last, input_iterator_tag) {
+ typename iterator_traits<_InputIter>::difference_type __r(0);
+ for (; __first != __last; ++__first)
+ ++__r;
+ return __r;
}
template <class _RandIter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-typename iterator_traits<_RandIter>::difference_type
-__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag)
-{
- return __last - __first;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_RandIter>::difference_type
+__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) {
+ return __last - __first;
}
template <class _InputIter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-typename iterator_traits<_InputIter>::difference_type
-distance(_InputIter __first, _InputIter __last)
-{
- return std::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type
+distance(_InputIter __first, _InputIter __last) {
+ return std::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
}
#if _LIBCPP_STD_VER >= 20
@@ -61,10 +55,9 @@ namespace ranges {
namespace __distance {
struct __fn {
- template<class _Ip, sentinel_for<_Ip> _Sp>
- requires (!sized_sentinel_for<_Sp, _Ip>)
- _LIBCPP_HIDE_FROM_ABI
- constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const {
+ template <class _Ip, sentinel_for<_Ip> _Sp>
+ requires(!sized_sentinel_for<_Sp, _Ip>)
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const {
iter_difference_t<_Ip> __n = 0;
while (__first != __last) {
++__first;
@@ -73,9 +66,8 @@ struct __fn {
return __n;
}
- template<class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
+ template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) {
return __last - __first;
} else {
@@ -83,9 +75,8 @@ struct __fn {
}
}
- template<range _Rp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const {
+ template <range _Rp>
+ _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const {
if constexpr (sized_range<_Rp>) {
return static_cast<range_difference_t<_Rp>>(ranges::size(__r));
} else {
@@ -97,7 +88,7 @@ struct __fn {
} // namespace __distance
inline namespace __cpo {
- inline constexpr auto distance = __distance::__fn{};
+inline constexpr auto distance = __distance::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/empty.h b/contrib/llvm-project/libcxx/include/__iterator/empty.h
index 6c7b0dcb1ebc..3ca0aff6be46 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/empty.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/empty.h
@@ -23,19 +23,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Cont>
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-constexpr auto empty(const _Cont& __c)
-_NOEXCEPT_(noexcept(__c.empty()))
--> decltype (__c.empty())
-{ return __c.empty(); }
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI constexpr auto empty(const _Cont& __c)
+ _NOEXCEPT_(noexcept(__c.empty())) -> decltype(__c.empty()) {
+ return __c.empty();
+}
template <class _Tp, size_t _Sz>
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI constexpr bool empty(const _Tp (&)[_Sz]) noexcept {
+ return false;
+}
template <class _Ep>
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI constexpr bool empty(initializer_list<_Ep> __il) noexcept {
+ return __il.size() == 0;
+}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h b/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h
index 532ec9c1de0b..0f87f50cd1c1 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/erase_if_container.h
@@ -22,9 +22,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Container, class _Predicate>
-_LIBCPP_HIDE_FROM_ABI
-typename _Container::size_type
-__libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
+_LIBCPP_HIDE_FROM_ABI typename _Container::size_type __libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
typename _Container::size_type __old_size = __c.size();
const typename _Container::iterator __last = __c.end();
diff --git a/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h
index f9aa442177b2..7f2c54ec8744 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/front_insert_iterator.h
@@ -33,40 +33,47 @@ class _LIBCPP_TEMPLATE_VIS front_insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Container* container;
+ _Container* container;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _Container container_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _Container container_type;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit front_insert_iterator(_Container& __x) : container(std::addressof(__x)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator=(const typename _Container::value_type& __value)
- {container->push_front(__value); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit front_insert_iterator(_Container& __x)
+ : container(std::addressof(__x)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator&
+ operator=(const typename _Container::value_type& __value) {
+ container->push_front(__value);
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator=(typename _Container::value_type&& __value)
- {container->push_front(std::move(__value)); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator&
+ operator=(typename _Container::value_type&& __value) {
+ container->push_front(std::move(__value));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) { return *this; }
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(front_insert_iterator);
template <class _Container>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-front_insert_iterator<_Container>
-front_inserter(_Container& __x)
-{
- return front_insert_iterator<_Container>(__x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator<_Container>
+front_inserter(_Container& __x) {
+ return front_insert_iterator<_Container>(__x);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h b/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h
index 604e9580ef7c..a228b228f6e5 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/incrementable_traits.h
@@ -29,33 +29,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [incrementable.traits]
-template<class> struct incrementable_traits {};
+template <class>
+struct incrementable_traits {};
-template<class _Tp>
-requires is_object_v<_Tp>
+template <class _Tp>
+ requires is_object_v<_Tp>
struct incrementable_traits<_Tp*> {
using difference_type = ptrdiff_t;
};
-template<class _Ip>
+template <class _Ip>
struct incrementable_traits<const _Ip> : incrementable_traits<_Ip> {};
-template<class _Tp>
+template <class _Tp>
concept __has_member_difference_type = requires { typename _Tp::difference_type; };
-template<__has_member_difference_type _Tp>
+template <__has_member_difference_type _Tp>
struct incrementable_traits<_Tp> {
using difference_type = typename _Tp::difference_type;
};
-template<class _Tp>
-concept __has_integral_minus =
- requires(const _Tp& __x, const _Tp& __y) {
- { __x - __y } -> integral;
- };
+template <class _Tp>
+concept __has_integral_minus = requires(const _Tp& __x, const _Tp& __y) {
+ { __x - __y } -> integral;
+};
-template<__has_integral_minus _Tp>
-requires (!__has_member_difference_type<_Tp>)
+template <__has_integral_minus _Tp>
+ requires(!__has_member_difference_type<_Tp>)
struct incrementable_traits<_Tp> {
using difference_type = make_signed_t<decltype(std::declval<_Tp>() - std::declval<_Tp>())>;
};
@@ -67,9 +67,10 @@ struct iterator_traits;
// `incrementable_traits<RI>::difference_type` if `iterator_traits<RI>` names a specialization
// generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise.
template <class _Ip>
-using iter_difference_t = typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
- incrementable_traits<remove_cvref_t<_Ip> >,
- iterator_traits<remove_cvref_t<_Ip> > >::difference_type;
+using iter_difference_t =
+ typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
+ incrementable_traits<remove_cvref_t<_Ip> >,
+ iterator_traits<remove_cvref_t<_Ip> > >::difference_type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h b/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h
index e60ba25ca768..e8a7398bacd2 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/indirectly_comparable.h
@@ -24,8 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _I1, class _I2, class _Rp, class _P1 = identity, class _P2 = identity>
-concept indirectly_comparable =
- indirect_binary_predicate<_Rp, projected<_I1, _P1>, projected<_I2, _P2>>;
+concept indirectly_comparable = indirect_binary_predicate<_Rp, projected<_I1, _P1>, projected<_I2, _P2>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h
index 1a9c74a16f4f..8b7574dc9ec0 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/insert_iterator.h
@@ -42,41 +42,50 @@ class _LIBCPP_TEMPLATE_VIS insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Container* container;
- __insert_iterator_iter_t<_Container> iter;
+ _Container* container;
+ __insert_iterator_iter_t<_Container> iter;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _Container container_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _Container container_type;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator(_Container& __x, __insert_iterator_iter_t<_Container> __i)
- : container(std::addressof(__x)), iter(__i) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator=(const typename _Container::value_type& __value)
- {iter = container->insert(iter, __value); ++iter; return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ insert_iterator(_Container& __x, __insert_iterator_iter_t<_Container> __i)
+ : container(std::addressof(__x)), iter(__i) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator&
+ operator=(const typename _Container::value_type& __value) {
+ iter = container->insert(iter, __value);
+ ++iter;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator=(typename _Container::value_type&& __value)
- {iter = container->insert(iter, std::move(__value)); ++iter; return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator&
+ operator=(typename _Container::value_type&& __value) {
+ iter = container->insert(iter, std::move(__value));
+ ++iter;
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) { return *this; }
};
template <class _Container>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-insert_iterator<_Container>
-inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i)
-{
- return insert_iterator<_Container>(__x, __i);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator<_Container>
+inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i) {
+ return insert_iterator<_Container>(__x, __i);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h
index 2efe5772ba61..58c9ac6d4ccc 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/istream_iterator.h
@@ -26,78 +26,73 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Tp, class _CharT = char,
- class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
+template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class _LIBCPP_TEMPLATE_VIS istream_iterator
#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_istream<_CharT,_Traits> istream_type;
+ typedef input_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
private:
- istream_type* __in_stream_;
- _Tp __value_;
+ istream_type* __in_stream_;
+ _Tp __value_;
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr istream_iterator(default_sentinel_t) : istream_iterator() {}
+ _LIBCPP_HIDE_FROM_ABI constexpr istream_iterator(default_sentinel_t) : istream_iterator() {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI istream_iterator(istream_type& __s) : __in_stream_(std::addressof(__s))
- {
- if (!(*__in_stream_ >> __value_))
- __in_stream_ = nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI istream_iterator(istream_type& __s) : __in_stream_(std::addressof(__s)) {
+ if (!(*__in_stream_ >> __value_))
+ __in_stream_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const {return __value_;}
- _LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const {return std::addressof((operator*()));}
- _LIBCPP_HIDE_FROM_ABI istream_iterator& operator++()
- {
- if (!(*__in_stream_ >> __value_))
- __in_stream_ = nullptr;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI istream_iterator operator++(int)
- {istream_iterator __t(*this); ++(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const { return std::addressof((operator*())); }
+ _LIBCPP_HIDE_FROM_ABI istream_iterator& operator++() {
+ if (!(*__in_stream_ >> __value_))
+ __in_stream_ = nullptr;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI istream_iterator operator++(int) {
+ istream_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- template <class _Up, class _CharU, class _TraitsU, class _DistanceU>
- friend _LIBCPP_HIDE_FROM_ABI
- bool
- operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x,
- const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y);
+ template <class _Up, class _CharU, class _TraitsU, class _DistanceU>
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x,
+ const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y);
#if _LIBCPP_STD_VER >= 20
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator& __i, default_sentinel_t) {
- return __i.__in_stream_ == nullptr;
- }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator& __i, default_sentinel_t) {
+ return __i.__in_stream_ == nullptr;
+ }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _Tp, class _CharT, class _Traits, class _Distance>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
- const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y)
-{
- return __x.__in_stream_ == __y.__in_stream_;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y) {
+ return __x.__in_stream_ == __y.__in_stream_;
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _CharT, class _Traits, class _Distance>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
- const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y) {
+ return !(__x == __y);
}
#endif // _LIBCPP_STD_VER <= 17
diff --git a/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h
index ed5012a68d82..51c4ecff351f 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h
@@ -24,95 +24,84 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
class _LIBCPP_TEMPLATE_VIS istreambuf_iterator
#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
- : public iterator<input_iterator_tag, _CharT,
- typename _Traits::off_type, _CharT*,
- _CharT>
+ : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef input_iterator_tag iterator_category;
- typedef _CharT value_type;
- typedef typename _Traits::off_type difference_type;
- typedef _CharT* pointer;
- typedef _CharT reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename _Traits::int_type int_type;
- typedef basic_streambuf<_CharT,_Traits> streambuf_type;
- typedef basic_istream<_CharT,_Traits> istream_type;
+ typedef input_iterator_tag iterator_category;
+ typedef _CharT value_type;
+ typedef typename _Traits::off_type difference_type;
+ typedef _CharT* pointer;
+ typedef _CharT reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
private:
- mutable streambuf_type* __sbuf_;
-
- class __proxy
- {
- char_type __keep_;
- streambuf_type* __sbuf_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __proxy(char_type __c, streambuf_type* __s)
- : __keep_(__c), __sbuf_(__s) {}
- friend class istreambuf_iterator;
- public:
- _LIBCPP_HIDE_FROM_ABI char_type operator*() const {return __keep_;}
- };
-
- _LIBCPP_HIDE_FROM_ABI
- bool __test_for_eof() const
- {
- if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
- __sbuf_ = nullptr;
- return __sbuf_ == nullptr;
- }
+ mutable streambuf_type* __sbuf_;
+
+ class __proxy {
+ char_type __keep_;
+ streambuf_type* __sbuf_;
+ _LIBCPP_HIDE_FROM_ABI explicit __proxy(char_type __c, streambuf_type* __s) : __keep_(__c), __sbuf_(__s) {}
+ friend class istreambuf_iterator;
+
+ public:
+ _LIBCPP_HIDE_FROM_ABI char_type operator*() const { return __keep_; }
+ };
+
+ _LIBCPP_HIDE_FROM_ABI bool __test_for_eof() const {
+ if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
+ __sbuf_ = nullptr;
+ return __sbuf_ == nullptr;
+ }
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr istreambuf_iterator(default_sentinel_t) noexcept
- : istreambuf_iterator() {}
+ _LIBCPP_HIDE_FROM_ABI constexpr istreambuf_iterator(default_sentinel_t) noexcept : istreambuf_iterator() {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(istream_type& __s) _NOEXCEPT
- : __sbuf_(__s.rdbuf()) {}
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
- : __sbuf_(__s) {}
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT
- : __sbuf_(__p.__sbuf_) {}
-
- _LIBCPP_HIDE_FROM_ABI char_type operator*() const
- {return static_cast<char_type>(__sbuf_->sgetc());}
- _LIBCPP_HIDE_FROM_ABI istreambuf_iterator& operator++()
- {
- __sbuf_->sbumpc();
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI __proxy operator++(int)
- {
- return __proxy(__sbuf_->sbumpc(), __sbuf_);
- }
-
- _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const
- {return __test_for_eof() == __b.__test_for_eof();}
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(istream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {}
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {}
+
+ _LIBCPP_HIDE_FROM_ABI char_type operator*() const { return static_cast<char_type>(__sbuf_->sgetc()); }
+ _LIBCPP_HIDE_FROM_ABI istreambuf_iterator& operator++() {
+ __sbuf_->sbumpc();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __proxy operator++(int) { return __proxy(__sbuf_->sbumpc(), __sbuf_); }
+
+ _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const {
+ return __test_for_eof() == __b.__test_for_eof();
+ }
#if _LIBCPP_STD_VER >= 20
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istreambuf_iterator& __i, default_sentinel_t) {
- return __i.__test_for_eof();
- }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istreambuf_iterator& __i, default_sentinel_t) {
+ return __i.__test_for_eof();
+ }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a,
- const istreambuf_iterator<_CharT,_Traits>& __b)
- {return __a.equal(__b);}
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) {
+ return __a.equal(__b);
+}
#if _LIBCPP_STD_VER <= 17
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
- const istreambuf_iterator<_CharT,_Traits>& __b)
- {return !__a.equal(__b);}
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) {
+ return !__a.equal(__b);
+}
#endif // _LIBCPP_STD_VER <= 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iter_move.h b/contrib/llvm-project/libcxx/include/__iterator/iter_move.h
index d9ff90bf6545..202b94cccc5a 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iter_move.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iter_move.h
@@ -38,66 +38,60 @@ namespace __iter_move {
void iter_move();
template <class _Tp>
-concept __unqualified_iter_move =
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires (_Tp&& __t) {
- // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
- iter_move(std::forward<_Tp>(__t));
- };
-
-template<class _Tp>
-concept __move_deref =
- !__unqualified_iter_move<_Tp> &&
- requires (_Tp&& __t) {
- *__t;
- requires is_lvalue_reference_v<decltype(*__t)>;
- };
-
-template<class _Tp>
-concept __just_deref =
- !__unqualified_iter_move<_Tp> &&
- !__move_deref<_Tp> &&
- requires (_Tp&& __t) {
- *__t;
- requires (!is_lvalue_reference_v<decltype(*__t)>);
- };
+concept __unqualified_iter_move = __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
+ iter_move(std::forward<_Tp>(__t));
+};
+
+template <class _Tp>
+concept __move_deref = !__unqualified_iter_move<_Tp> && requires(_Tp&& __t) {
+ *__t;
+ requires is_lvalue_reference_v<decltype(*__t)>;
+};
+
+template <class _Tp>
+concept __just_deref = !__unqualified_iter_move<_Tp> && !__move_deref<_Tp> && requires(_Tp&& __t) {
+ *__t;
+ requires(!is_lvalue_reference_v<decltype(*__t)>);
+};
// [iterator.cust.move]
struct __fn {
// NOLINTBEGIN(libcpp-robust-against-adl) iter_move ADL calls should only be made through ranges::iter_move
- template<class _Ip>
+ template <class _Ip>
requires __unqualified_iter_move<_Ip>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Ip&& __i) const
- noexcept(noexcept(iter_move(std::forward<_Ip>(__i))))
- {
+ noexcept(noexcept(iter_move(std::forward<_Ip>(__i)))) {
return iter_move(std::forward<_Ip>(__i));
}
// NOLINTEND(libcpp-robust-against-adl)
- template<class _Ip>
+ template <class _Ip>
requires __move_deref<_Ip>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const
- noexcept(noexcept(std::move(*std::forward<_Ip>(__i))))
- -> decltype( std::move(*std::forward<_Ip>(__i)))
- { return std::move(*std::forward<_Ip>(__i)); }
+ noexcept(noexcept(std::move(*std::forward<_Ip>(__i)))) -> decltype(std::move(*std::forward<_Ip>(__i))) {
+ return std::move(*std::forward<_Ip>(__i));
+ }
- template<class _Ip>
+ template <class _Ip>
requires __just_deref<_Ip>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const
- noexcept(noexcept(*std::forward<_Ip>(__i)))
- -> decltype( *std::forward<_Ip>(__i))
- { return *std::forward<_Ip>(__i); }
+ noexcept(noexcept(*std::forward<_Ip>(__i))) -> decltype(*std::forward<_Ip>(__i)) {
+ return *std::forward<_Ip>(__i);
+ }
};
} // namespace __iter_move
inline namespace __cpo {
- inline constexpr auto iter_move = __iter_move::__fn{};
+inline constexpr auto iter_move = __iter_move::__fn{};
} // namespace __cpo
} // namespace ranges
-template<__dereferenceable _Tp>
- requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __can_reference; }
+template <__dereferenceable _Tp>
+ requires requires(_Tp& __t) {
+ { ranges::iter_move(__t) } -> __can_reference;
+ }
using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>()));
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h b/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h
index 23d3e4009f53..52c3f095e7fb 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iter_swap.h
@@ -37,77 +37,67 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __iter_swap {
- template<class _I1, class _I2>
- void iter_swap(_I1, _I2) = delete;
+template <class _I1, class _I2>
+void iter_swap(_I1, _I2) = delete;
- template<class _T1, class _T2>
- concept __unqualified_iter_swap =
- (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>) &&
- requires (_T1&& __x, _T2&& __y) {
+template <class _T1, class _T2>
+concept __unqualified_iter_swap =
+ (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>)&&requires(_T1&& __x, _T2&& __y) {
// NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
};
- template<class _T1, class _T2>
- concept __readable_swappable =
+template <class _T1, class _T2>
+concept __readable_swappable =
indirectly_readable<_T1> && indirectly_readable<_T2> &&
swappable_with<iter_reference_t<_T1>, iter_reference_t<_T2>>;
-
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
- template <class _T1, class _T2>
- requires __unqualified_iter_swap<_T1, _T2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_T1&& __x, _T2&& __y) const
- noexcept(noexcept(iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y))))
- {
- (void)iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
- }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template <class _T1, class _T2>
- requires (!__unqualified_iter_swap<_T1, _T2>) &&
- __readable_swappable<_T1, _T2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_T1&& __x, _T2&& __y) const
- noexcept(noexcept(ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y))))
- {
- ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y));
- }
-
- template <class _T1, class _T2>
- requires (!__unqualified_iter_swap<_T1, _T2> && //
- !__readable_swappable<_T1, _T2>) && //
- indirectly_movable_storable<_T1, _T2> && //
- indirectly_movable_storable<_T2, _T1>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_T1&& __x, _T2&& __y) const
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
+ template <class _T1, class _T2>
+ requires __unqualified_iter_swap<_T1, _T2>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
+ noexcept(noexcept(iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y)))) {
+ (void)iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
+
+ template <class _T1, class _T2>
+ requires(!__unqualified_iter_swap<_T1, _T2>) && __readable_swappable<_T1, _T2>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
+ noexcept(noexcept(ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y)))) {
+ ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y));
+ }
+
+ template <class _T1, class _T2>
+ requires(!__unqualified_iter_swap<_T1, _T2> && //
+ !__readable_swappable<_T1, _T2>) && //
+ indirectly_movable_storable<_T1, _T2> && //
+ indirectly_movable_storable<_T2, _T1>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
noexcept(noexcept(iter_value_t<_T2>(ranges::iter_move(__y))) && //
- noexcept(*__y = ranges::iter_move(__x)) && //
- noexcept(*std::forward<_T1>(__x) = std::declval<iter_value_t<_T2>>()))
- {
- iter_value_t<_T2> __old(ranges::iter_move(__y));
- *__y = ranges::iter_move(__x);
- *std::forward<_T1>(__x) = std::move(__old);
- }
- };
+ noexcept(*__y = ranges::iter_move(__x)) && //
+ noexcept(*std::forward<_T1>(__x) = std::declval<iter_value_t<_T2>>())) {
+ iter_value_t<_T2> __old(ranges::iter_move(__y));
+ *__y = ranges::iter_move(__x);
+ *std::forward<_T1>(__x) = std::move(__old);
+ }
+};
} // namespace __iter_swap
inline namespace __cpo {
- inline constexpr auto iter_swap = __iter_swap::__fn{};
+inline constexpr auto iter_swap = __iter_swap::__fn{};
} // namespace __cpo
} // namespace ranges
-template<class _I1, class _I2 = _I1>
+template <class _I1, class _I2 = _I1>
concept indirectly_swappable =
- indirectly_readable<_I1> && indirectly_readable<_I2> &&
- requires(const _I1 __i1, const _I2 __i2) {
- ranges::iter_swap(__i1, __i1);
- ranges::iter_swap(__i2, __i2);
- ranges::iter_swap(__i1, __i2);
- ranges::iter_swap(__i2, __i1);
- };
+ indirectly_readable<_I1> && indirectly_readable<_I2> && requires(const _I1 __i1, const _I2 __i2) {
+ ranges::iter_swap(__i1, __i1);
+ ranges::iter_swap(__i2, __i2);
+ ranges::iter_swap(__i1, __i2);
+ ranges::iter_swap(__i2, __i1);
+ };
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iterator.h b/contrib/llvm-project/libcxx/include/__iterator/iterator.h
index b417eeab79bf..ba9308f3c224 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iterator.h
@@ -19,15 +19,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Category, class _Tp, class _Distance = ptrdiff_t,
- class _Pointer = _Tp*, class _Reference = _Tp&>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
-{
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
- typedef _Category iterator_category;
+template <class _Category, class _Tp, class _Distance = ptrdiff_t, class _Pointer = _Tp*, class _Reference = _Tp&>
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator {
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef _Pointer pointer;
+ typedef _Reference reference;
+ typedef _Category iterator_category;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h b/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
index 248987e9b560..dae8cc75ae34 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
@@ -49,9 +49,7 @@ template <class _Tp>
using __with_reference = _Tp&;
template <class _Tp>
-concept __can_reference = requires {
- typename __with_reference<_Tp>;
-};
+concept __can_reference = requires { typename __with_reference<_Tp>; };
template <class _Tp>
concept __dereferenceable = requires(_Tp& __t) {
@@ -59,7 +57,7 @@ concept __dereferenceable = requires(_Tp& __t) {
};
// [iterator.traits]
-template<__dereferenceable _Tp>
+template <__dereferenceable _Tp>
using iter_reference_t = decltype(*std::declval<_Tp&>());
#endif // _LIBCPP_STD_VER >= 20
@@ -69,20 +67,16 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits;
struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {};
-struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};
+struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};
#if _LIBCPP_STD_VER >= 20
-struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag : public random_access_iterator_tag {};
+struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag : public random_access_iterator_tag {};
#endif
template <class _Iter>
struct __iter_traits_cache {
- using type = _If<
- __is_primary_template<iterator_traits<_Iter> >::value,
- _Iter,
- iterator_traits<_Iter>
- >;
+ using type = _If< __is_primary_template<iterator_traits<_Iter> >::value, _Iter, iterator_traits<_Iter> >;
};
template <class _Iter>
using _ITER_TRAITS = typename __iter_traits_cache<_Iter>::type;
@@ -97,64 +91,61 @@ struct __iter_concept_category_test {
};
struct __iter_concept_random_fallback {
template <class _Iter>
- using _Apply = __enable_if_t<
- __is_primary_template<iterator_traits<_Iter> >::value,
- random_access_iterator_tag
- >;
+ using _Apply = __enable_if_t< __is_primary_template<iterator_traits<_Iter> >::value, random_access_iterator_tag >;
};
-template <class _Iter, class _Tester> struct __test_iter_concept
- : _IsValidExpansion<_Tester::template _Apply, _Iter>,
- _Tester
-{
-};
+template <class _Iter, class _Tester>
+struct __test_iter_concept : _IsValidExpansion<_Tester::template _Apply, _Iter>, _Tester {};
template <class _Iter>
struct __iter_concept_cache {
- using type = _Or<
- __test_iter_concept<_Iter, __iter_concept_concept_test>,
- __test_iter_concept<_Iter, __iter_concept_category_test>,
- __test_iter_concept<_Iter, __iter_concept_random_fallback>
- >;
+ using type = _Or< __test_iter_concept<_Iter, __iter_concept_concept_test>,
+ __test_iter_concept<_Iter, __iter_concept_category_test>,
+ __test_iter_concept<_Iter, __iter_concept_random_fallback> >;
};
template <class _Iter>
using _ITER_CONCEPT = typename __iter_concept_cache<_Iter>::type::template _Apply<_Iter>;
-
template <class _Tp>
-struct __has_iterator_typedefs
-{
+struct __has_iterator_typedefs {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(__void_t<typename _Up::iterator_category>* = nullptr,
- __void_t<typename _Up::difference_type>* = nullptr,
- __void_t<typename _Up::value_type>* = nullptr,
- __void_t<typename _Up::reference>* = nullptr,
- __void_t<typename _Up::pointer>* = nullptr);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type
+ __test(__void_t<typename _Up::iterator_category>* = nullptr,
+ __void_t<typename _Up::difference_type>* = nullptr,
+ __void_t<typename _Up::value_type>* = nullptr,
+ __void_t<typename _Up::reference>* = nullptr,
+ __void_t<typename _Up::pointer>* = nullptr);
+
public:
- static const bool value = decltype(__test<_Tp>(0,0,0,0,0))::value;
+ static const bool value = decltype(__test<_Tp>(0, 0, 0, 0, 0))::value;
};
-
template <class _Tp>
-struct __has_iterator_category
-{
+struct __has_iterator_category {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::iterator_category* = nullptr);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::iterator_category* = nullptr);
+
public:
- static const bool value = decltype(__test<_Tp>(nullptr))::value;
+ static const bool value = decltype(__test<_Tp>(nullptr))::value;
};
template <class _Tp>
-struct __has_iterator_concept
-{
+struct __has_iterator_concept {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::iterator_concept* = nullptr);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::iterator_concept* = nullptr);
+
public:
- static const bool value = decltype(__test<_Tp>(nullptr))::value;
+ static const bool value = decltype(__test<_Tp>(nullptr))::value;
};
#if _LIBCPP_STD_VER >= 20
@@ -163,200 +154,194 @@ public:
// from `[iterator.cpp17]`. To avoid confusion between the two, the exposition-only concepts have been banished to
// a "detail" namespace indicating they have a niche use-case.
namespace __iterator_traits_detail {
-template<class _Ip>
-concept __cpp17_iterator =
- requires(_Ip __i) {
- { *__i } -> __can_reference;
- { ++__i } -> same_as<_Ip&>;
- { *__i++ } -> __can_reference;
- } &&
- copyable<_Ip>;
-
-template<class _Ip>
-concept __cpp17_input_iterator =
- __cpp17_iterator<_Ip> &&
- equality_comparable<_Ip> &&
- requires(_Ip __i) {
- typename incrementable_traits<_Ip>::difference_type;
- typename indirectly_readable_traits<_Ip>::value_type;
- typename common_reference_t<iter_reference_t<_Ip>&&,
- typename indirectly_readable_traits<_Ip>::value_type&>;
- typename common_reference_t<decltype(*__i++)&&,
- typename indirectly_readable_traits<_Ip>::value_type&>;
- requires signed_integral<typename incrementable_traits<_Ip>::difference_type>;
- };
-
-template<class _Ip>
+template <class _Ip>
+concept __cpp17_iterator = requires(_Ip __i) {
+ { *__i } -> __can_reference;
+ { ++__i } -> same_as<_Ip&>;
+ { *__i++ } -> __can_reference;
+} && copyable<_Ip>;
+
+template <class _Ip>
+concept __cpp17_input_iterator = __cpp17_iterator<_Ip> && equality_comparable<_Ip> && requires(_Ip __i) {
+ typename incrementable_traits<_Ip>::difference_type;
+ typename indirectly_readable_traits<_Ip>::value_type;
+ typename common_reference_t<iter_reference_t<_Ip>&&, typename indirectly_readable_traits<_Ip>::value_type&>;
+ typename common_reference_t<decltype(*__i++)&&, typename indirectly_readable_traits<_Ip>::value_type&>;
+ requires signed_integral<typename incrementable_traits<_Ip>::difference_type>;
+};
+
+template <class _Ip>
concept __cpp17_forward_iterator =
- __cpp17_input_iterator<_Ip> &&
- constructible_from<_Ip> &&
- is_reference_v<iter_reference_t<_Ip>> &&
- same_as<remove_cvref_t<iter_reference_t<_Ip>>,
- typename indirectly_readable_traits<_Ip>::value_type> &&
- requires(_Ip __i) {
- { __i++ } -> convertible_to<_Ip const&>;
- { *__i++ } -> same_as<iter_reference_t<_Ip>>;
- };
-
-template<class _Ip>
-concept __cpp17_bidirectional_iterator =
- __cpp17_forward_iterator<_Ip> &&
- requires(_Ip __i) {
- { --__i } -> same_as<_Ip&>;
- { __i-- } -> convertible_to<_Ip const&>;
- { *__i-- } -> same_as<iter_reference_t<_Ip>>;
- };
-
-template<class _Ip>
+ __cpp17_input_iterator<_Ip> && constructible_from<_Ip> && is_reference_v<iter_reference_t<_Ip>> &&
+ same_as<remove_cvref_t<iter_reference_t<_Ip>>, typename indirectly_readable_traits<_Ip>::value_type> &&
+ requires(_Ip __i) {
+ { __i++ } -> convertible_to<_Ip const&>;
+ { *__i++ } -> same_as<iter_reference_t<_Ip>>;
+ };
+
+template <class _Ip>
+concept __cpp17_bidirectional_iterator = __cpp17_forward_iterator<_Ip> && requires(_Ip __i) {
+ { --__i } -> same_as<_Ip&>;
+ { __i-- } -> convertible_to<_Ip const&>;
+ { *__i-- } -> same_as<iter_reference_t<_Ip>>;
+};
+
+template <class _Ip>
concept __cpp17_random_access_iterator =
- __cpp17_bidirectional_iterator<_Ip> &&
- totally_ordered<_Ip> &&
- requires(_Ip __i, typename incrementable_traits<_Ip>::difference_type __n) {
- { __i += __n } -> same_as<_Ip&>;
- { __i -= __n } -> same_as<_Ip&>;
- { __i + __n } -> same_as<_Ip>;
- { __n + __i } -> same_as<_Ip>;
- { __i - __n } -> same_as<_Ip>;
- { __i - __i } -> same_as<decltype(__n)>; // NOLINT(misc-redundant-expression) ; This is llvm.org/PR54114
- { __i[__n] } -> convertible_to<iter_reference_t<_Ip>>;
- };
+ __cpp17_bidirectional_iterator<_Ip> && totally_ordered<_Ip> &&
+ requires(_Ip __i, typename incrementable_traits<_Ip>::difference_type __n) {
+ { __i += __n } -> same_as<_Ip&>;
+ { __i -= __n } -> same_as<_Ip&>;
+ { __i + __n } -> same_as<_Ip>;
+ { __n + __i } -> same_as<_Ip>;
+ { __i - __n } -> same_as<_Ip>;
+ { __i - __i } -> same_as<decltype(__n)>; // NOLINT(misc-redundant-expression) ; This is llvm.org/PR54114
+ { __i[__n] } -> convertible_to<iter_reference_t<_Ip>>;
+ };
} // namespace __iterator_traits_detail
-template<class _Ip>
+template <class _Ip>
concept __has_member_reference = requires { typename _Ip::reference; };
-template<class _Ip>
+template <class _Ip>
concept __has_member_pointer = requires { typename _Ip::pointer; };
-template<class _Ip>
+template <class _Ip>
concept __has_member_iterator_category = requires { typename _Ip::iterator_category; };
-template<class _Ip>
+template <class _Ip>
concept __specifies_members = requires {
- typename _Ip::value_type;
- typename _Ip::difference_type;
- requires __has_member_reference<_Ip>;
- requires __has_member_iterator_category<_Ip>;
- };
+ typename _Ip::value_type;
+ typename _Ip::difference_type;
+ requires __has_member_reference<_Ip>;
+ requires __has_member_iterator_category<_Ip>;
+};
-template<class>
+template <class>
struct __iterator_traits_member_pointer_or_void {
using type = void;
};
-template<__has_member_pointer _Tp>
+template <__has_member_pointer _Tp>
struct __iterator_traits_member_pointer_or_void<_Tp> {
using type = typename _Tp::pointer;
};
-template<class _Tp>
-concept __cpp17_iterator_missing_members =
- !__specifies_members<_Tp> &&
- __iterator_traits_detail::__cpp17_iterator<_Tp>;
+template <class _Tp>
+concept __cpp17_iterator_missing_members = !__specifies_members<_Tp> && __iterator_traits_detail::__cpp17_iterator<_Tp>;
-template<class _Tp>
+template <class _Tp>
concept __cpp17_input_iterator_missing_members =
- __cpp17_iterator_missing_members<_Tp> &&
- __iterator_traits_detail::__cpp17_input_iterator<_Tp>;
+ __cpp17_iterator_missing_members<_Tp> && __iterator_traits_detail::__cpp17_input_iterator<_Tp>;
// Otherwise, `pointer` names `void`.
-template<class>
-struct __iterator_traits_member_pointer_or_arrow_or_void { using type = void; };
+template <class>
+struct __iterator_traits_member_pointer_or_arrow_or_void {
+ using type = void;
+};
// [iterator.traits]/3.2.1
// If the qualified-id `I::pointer` is valid and denotes a type, `pointer` names that type.
-template<__has_member_pointer _Ip>
-struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { using type = typename _Ip::pointer; };
+template <__has_member_pointer _Ip>
+struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> {
+ using type = typename _Ip::pointer;
+};
// Otherwise, if `decltype(declval<I&>().operator->())` is well-formed, then `pointer` names that
// type.
-template<class _Ip>
+template <class _Ip>
requires requires(_Ip& __i) { __i.operator->(); } && (!__has_member_pointer<_Ip>)
struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> {
using type = decltype(std::declval<_Ip&>().operator->());
};
// Otherwise, `reference` names `iter-reference-t<I>`.
-template<class _Ip>
-struct __iterator_traits_member_reference { using type = iter_reference_t<_Ip>; };
+template <class _Ip>
+struct __iterator_traits_member_reference {
+ using type = iter_reference_t<_Ip>;
+};
// [iterator.traits]/3.2.2
// If the qualified-id `I::reference` is valid and denotes a type, `reference` names that type.
-template<__has_member_reference _Ip>
-struct __iterator_traits_member_reference<_Ip> { using type = typename _Ip::reference; };
+template <__has_member_reference _Ip>
+struct __iterator_traits_member_reference<_Ip> {
+ using type = typename _Ip::reference;
+};
// [iterator.traits]/3.2.3.4
// input_iterator_tag
-template<class _Ip>
+template <class _Ip>
struct __deduce_iterator_category {
using type = input_iterator_tag;
};
// [iterator.traits]/3.2.3.1
// `random_access_iterator_tag` if `I` satisfies `cpp17-random-access-iterator`, or otherwise
-template<__iterator_traits_detail::__cpp17_random_access_iterator _Ip>
+template <__iterator_traits_detail::__cpp17_random_access_iterator _Ip>
struct __deduce_iterator_category<_Ip> {
using type = random_access_iterator_tag;
};
// [iterator.traits]/3.2.3.2
// `bidirectional_iterator_tag` if `I` satisfies `cpp17-bidirectional-iterator`, or otherwise
-template<__iterator_traits_detail::__cpp17_bidirectional_iterator _Ip>
+template <__iterator_traits_detail::__cpp17_bidirectional_iterator _Ip>
struct __deduce_iterator_category<_Ip> {
using type = bidirectional_iterator_tag;
};
// [iterator.traits]/3.2.3.3
// `forward_iterator_tag` if `I` satisfies `cpp17-forward-iterator`, or otherwise
-template<__iterator_traits_detail::__cpp17_forward_iterator _Ip>
+template <__iterator_traits_detail::__cpp17_forward_iterator _Ip>
struct __deduce_iterator_category<_Ip> {
using type = forward_iterator_tag;
};
-template<class _Ip>
+template <class _Ip>
struct __iterator_traits_iterator_category : __deduce_iterator_category<_Ip> {};
// [iterator.traits]/3.2.3
// If the qualified-id `I::iterator-category` is valid and denotes a type, `iterator-category` names
// that type.
-template<__has_member_iterator_category _Ip>
+template <__has_member_iterator_category _Ip>
struct __iterator_traits_iterator_category<_Ip> {
using type = typename _Ip::iterator_category;
};
// otherwise, it names void.
-template<class>
-struct __iterator_traits_difference_type { using type = void; };
+template <class>
+struct __iterator_traits_difference_type {
+ using type = void;
+};
// If the qualified-id `incrementable_traits<I>::difference_type` is valid and denotes a type, then
// `difference_type` names that type;
-template<class _Ip>
-requires requires { typename incrementable_traits<_Ip>::difference_type; }
+template <class _Ip>
+ requires requires { typename incrementable_traits<_Ip>::difference_type; }
struct __iterator_traits_difference_type<_Ip> {
using type = typename incrementable_traits<_Ip>::difference_type;
};
// [iterator.traits]/3.4
// Otherwise, `iterator_traits<I>` has no members by any of the above names.
-template<class>
+template <class>
struct __iterator_traits {};
// [iterator.traits]/3.1
// If `I` has valid ([temp.deduct]) member types `difference-type`, `value-type`, `reference`, and
// `iterator-category`, then `iterator-traits<I>` has the following publicly accessible members:
-template<__specifies_members _Ip>
+template <__specifies_members _Ip>
struct __iterator_traits<_Ip> {
- using iterator_category = typename _Ip::iterator_category;
- using value_type = typename _Ip::value_type;
- using difference_type = typename _Ip::difference_type;
- using pointer = typename __iterator_traits_member_pointer_or_void<_Ip>::type;
- using reference = typename _Ip::reference;
+ using iterator_category = typename _Ip::iterator_category;
+ using value_type = typename _Ip::value_type;
+ using difference_type = typename _Ip::difference_type;
+ using pointer = typename __iterator_traits_member_pointer_or_void<_Ip>::type;
+ using reference = typename _Ip::reference;
};
// [iterator.traits]/3.2
// Otherwise, if `I` satisfies the exposition-only concept `cpp17-input-iterator`,
// `iterator-traits<I>` has the following publicly accessible members:
-template<__cpp17_input_iterator_missing_members _Ip>
+template <__cpp17_input_iterator_missing_members _Ip>
struct __iterator_traits<_Ip> {
using iterator_category = typename __iterator_traits_iterator_category<_Ip>::type;
using value_type = typename indirectly_readable_traits<_Ip>::value_type;
@@ -367,7 +352,7 @@ struct __iterator_traits<_Ip> {
// Otherwise, if `I` satisfies the exposition-only concept `cpp17-iterator`, then
// `iterator_traits<I>` has the following publicly accessible members:
-template<__cpp17_iterator_missing_members _Ip>
+template <__cpp17_iterator_missing_members _Ip>
struct __iterator_traits<_Ip> {
using iterator_category = output_iterator_tag;
using value_type = void;
@@ -376,36 +361,33 @@ struct __iterator_traits<_Ip> {
using reference = void;
};
-template<class _Ip>
+template <class _Ip>
struct iterator_traits : __iterator_traits<_Ip> {
using __primary_template = iterator_traits;
};
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
-template <class _Iter, bool> struct __iterator_traits {};
+template <class _Iter, bool>
+struct __iterator_traits {};
-template <class _Iter, bool> struct __iterator_traits_impl {};
+template <class _Iter, bool>
+struct __iterator_traits_impl {};
template <class _Iter>
-struct __iterator_traits_impl<_Iter, true>
-{
- typedef typename _Iter::difference_type difference_type;
- typedef typename _Iter::value_type value_type;
- typedef typename _Iter::pointer pointer;
- typedef typename _Iter::reference reference;
- typedef typename _Iter::iterator_category iterator_category;
+struct __iterator_traits_impl<_Iter, true> {
+ typedef typename _Iter::difference_type difference_type;
+ typedef typename _Iter::value_type value_type;
+ typedef typename _Iter::pointer pointer;
+ typedef typename _Iter::reference reference;
+ typedef typename _Iter::iterator_category iterator_category;
};
template <class _Iter>
struct __iterator_traits<_Iter, true>
- : __iterator_traits_impl
- <
- _Iter,
- is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value ||
- is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value
- >
-{};
+ : __iterator_traits_impl< _Iter,
+ is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value ||
+ is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value > {};
// iterator_traits<Iterator> will only have the nested types if Iterator::iterator_category
// exists. Else iterator_traits<Iterator> will be an empty class. This is a
@@ -413,41 +395,35 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
-struct _LIBCPP_TEMPLATE_VIS iterator_traits
- : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {
-
+struct _LIBCPP_TEMPLATE_VIS iterator_traits : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {
using __primary_template = iterator_traits;
};
#endif // _LIBCPP_STD_VER >= 20
-template<class _Tp>
+template <class _Tp>
#if _LIBCPP_STD_VER >= 20
-requires is_object_v<_Tp>
+ requires is_object_v<_Tp>
#endif
-struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
-{
- typedef ptrdiff_t difference_type;
- typedef __remove_cv_t<_Tp> value_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
- typedef random_access_iterator_tag iterator_category;
+struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> {
+ typedef ptrdiff_t difference_type;
+ typedef __remove_cv_t<_Tp> value_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+ typedef random_access_iterator_tag iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef contiguous_iterator_tag iterator_concept;
+ typedef contiguous_iterator_tag iterator_concept;
#endif
};
template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value>
-struct __has_iterator_category_convertible_to
- : is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up>
-{};
+struct __has_iterator_category_convertible_to : is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up> {
+};
template <class _Tp, class _Up>
struct __has_iterator_category_convertible_to<_Tp, _Up, false> : false_type {};
template <class _Tp, class _Up, bool = __has_iterator_concept<_Tp>::value>
-struct __has_iterator_concept_convertible_to
- : is_convertible<typename _Tp::iterator_concept, _Up>
-{};
+struct __has_iterator_concept_convertible_to : is_convertible<typename _Tp::iterator_concept, _Up> {};
template <class _Tp, class _Up>
struct __has_iterator_concept_convertible_to<_Tp, _Up, false> : false_type {};
@@ -473,10 +449,9 @@ using __has_random_access_iterator_category = __has_iterator_category_convertibl
//
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
-struct __libcpp_is_contiguous_iterator : _Or<
- __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag>,
- __has_iterator_concept_convertible_to<_Tp, contiguous_iterator_tag>
-> {};
+struct __libcpp_is_contiguous_iterator
+ : _Or< __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag>,
+ __has_iterator_concept_convertible_to<_Tp, contiguous_iterator_tag> > {};
#else
template <class _Tp>
struct __libcpp_is_contiguous_iterator : false_type {};
@@ -486,41 +461,40 @@ struct __libcpp_is_contiguous_iterator : false_type {};
template <class _Up>
struct __libcpp_is_contiguous_iterator<_Up*> : true_type {};
-
template <class _Iter>
class __wrap_iter;
template <class _Tp>
-using __has_exactly_input_iterator_category
- = integral_constant<bool,
- __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
- !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value>;
+using __has_exactly_input_iterator_category =
+ integral_constant<bool,
+ __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
+ !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value>;
template <class _Tp>
-using __has_exactly_forward_iterator_category
- = integral_constant<bool,
- __has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value &&
- !__has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value>;
+using __has_exactly_forward_iterator_category =
+ integral_constant<bool,
+ __has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value &&
+ !__has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value>;
template <class _Tp>
-using __has_exactly_bidirectional_iterator_category
- = integral_constant<bool,
- __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value &&
- !__has_iterator_category_convertible_to<_Tp, random_access_iterator_tag>::value>;
+using __has_exactly_bidirectional_iterator_category =
+ integral_constant<bool,
+ __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag>::value &&
+ !__has_iterator_category_convertible_to<_Tp, random_access_iterator_tag>::value>;
-template<class _InputIterator>
+template <class _InputIterator>
using __iter_value_type = typename iterator_traits<_InputIterator>::value_type;
-template<class _InputIterator>
+template <class _InputIterator>
using __iter_key_type = __remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>;
-template<class _InputIterator>
+template <class _InputIterator>
using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type;
-template<class _InputIterator>
-using __iter_to_alloc_type = pair<
- typename add_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type,
- typename iterator_traits<_InputIterator>::value_type::second_type>;
+template <class _InputIterator>
+using __iter_to_alloc_type =
+ pair< typename add_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type,
+ typename iterator_traits<_InputIterator>::value_type::second_type>;
template <class _Iter>
using __iterator_category_type = typename iterator_traits<_Iter>::iterator_category;
@@ -543,9 +517,10 @@ using __iter_reference = typename iterator_traits<_Iter>::reference;
// generated from the primary template, and `iterator_traits<RI>::value_type` otherwise.
// This has to be in this file and not readable_traits.h to break the include cycle between the two.
template <class _Ip>
-using iter_value_t = typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
- indirectly_readable_traits<remove_cvref_t<_Ip> >,
- iterator_traits<remove_cvref_t<_Ip> > >::value_type;
+using iter_value_t =
+ typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
+ indirectly_readable_traits<remove_cvref_t<_Ip> >,
+ iterator_traits<remove_cvref_t<_Ip> > >::value_type;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/mergeable.h b/contrib/llvm-project/libcxx/include/__iterator/mergeable.h
index 494fda956e27..7976d751095e 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/mergeable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/mergeable.h
@@ -24,14 +24,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template <class _Input1, class _Input2, class _Output,
- class _Comp = ranges::less, class _Proj1 = identity, class _Proj2 = identity>
+template <class _Input1,
+ class _Input2,
+ class _Output,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
concept mergeable =
- input_iterator<_Input1> &&
- input_iterator<_Input2> &&
- weakly_incrementable<_Output> &&
- indirectly_copyable<_Input1, _Output> &&
- indirectly_copyable<_Input2, _Output> &&
+ input_iterator<_Input1> && input_iterator<_Input2> && weakly_incrementable<_Output> &&
+ indirectly_copyable<_Input1, _Output> && indirectly_copyable<_Input2, _Output> &&
indirect_strict_weak_order<_Comp, projected<_Input1, _Proj1>, projected<_Input2, _Proj2>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h
index 2f79d9a3d263..d1bd0138bdda 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/move_iterator.h
@@ -45,22 +45,21 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Iter, class = void>
+template <class _Iter, class = void>
struct __move_iter_category_base {};
-template<class _Iter>
+template <class _Iter>
requires requires { typename iterator_traits<_Iter>::iterator_category; }
struct __move_iter_category_base<_Iter> {
- using iterator_category = _If<
- derived_from<typename iterator_traits<_Iter>::iterator_category, random_access_iterator_tag>,
- random_access_iterator_tag,
- typename iterator_traits<_Iter>::iterator_category
- >;
+ using iterator_category =
+ _If< derived_from<typename iterator_traits<_Iter>::iterator_category, random_access_iterator_tag>,
+ random_access_iterator_tag,
+ typename iterator_traits<_Iter>::iterator_category >;
};
-template<class _Iter, class _Sent>
+template <class _Iter, class _Sent>
concept __move_iter_comparable = requires {
- { std::declval<const _Iter&>() == std::declval<_Sent>() } -> convertible_to<bool>;
+ { std::declval<const _Iter&>() == std::declval<_Sent>() } -> convertible_to<bool>;
};
#endif // _LIBCPP_STD_VER >= 20
@@ -70,282 +69,270 @@ class _LIBCPP_TEMPLATE_VIS move_iterator
: public __move_iter_category_base<_Iter>
#endif
{
- #if _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 20
+
private:
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __get_iter_concept() {
- if constexpr (random_access_iterator<_Iter>) {
- return random_access_iterator_tag{};
- } else if constexpr (bidirectional_iterator<_Iter>) {
- return bidirectional_iterator_tag{};
- } else if constexpr (forward_iterator<_Iter>) {
- return forward_iterator_tag{};
- } else {
- return input_iterator_tag{};
- }
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __get_iter_concept() {
+ if constexpr (random_access_iterator<_Iter>) {
+ return random_access_iterator_tag{};
+ } else if constexpr (bidirectional_iterator<_Iter>) {
+ return bidirectional_iterator_tag{};
+ } else if constexpr (forward_iterator<_Iter>) {
+ return forward_iterator_tag{};
+ } else {
+ return input_iterator_tag{};
}
+ }
#endif // _LIBCPP_STD_VER >= 20
+
public:
#if _LIBCPP_STD_VER >= 20
- using iterator_type = _Iter;
- using iterator_concept = decltype(__get_iter_concept());
- // iterator_category is inherited and not always present
- using value_type = iter_value_t<_Iter>;
- using difference_type = iter_difference_t<_Iter>;
- using pointer = _Iter;
- using reference = iter_rvalue_reference_t<_Iter>;
+ using iterator_type = _Iter;
+ using iterator_concept = decltype(__get_iter_concept());
+ // iterator_category is inherited and not always present
+ using value_type = iter_value_t<_Iter>;
+ using difference_type = iter_difference_t<_Iter>;
+ using pointer = _Iter;
+ using reference = iter_rvalue_reference_t<_Iter>;
#else
- typedef _Iter iterator_type;
- typedef _If<
- __has_random_access_iterator_category<_Iter>::value,
- random_access_iterator_tag,
- typename iterator_traits<_Iter>::iterator_category
- > iterator_category;
- typedef typename iterator_traits<iterator_type>::value_type value_type;
- typedef typename iterator_traits<iterator_type>::difference_type difference_type;
- typedef iterator_type pointer;
-
- typedef typename iterator_traits<iterator_type>::reference __reference;
- typedef typename conditional<
- is_reference<__reference>::value,
- __libcpp_remove_reference_t<__reference>&&,
- __reference
- >::type reference;
+ typedef _Iter iterator_type;
+ typedef _If< __has_random_access_iterator_category<_Iter>::value,
+ random_access_iterator_tag,
+ typename iterator_traits<_Iter>::iterator_category >
+ iterator_category;
+ typedef typename iterator_traits<iterator_type>::value_type value_type;
+ typedef typename iterator_traits<iterator_type>::difference_type difference_type;
+ typedef iterator_type pointer;
+
+ typedef typename iterator_traits<iterator_type>::reference __reference;
+ typedef typename conditional< is_reference<__reference>::value,
+ __libcpp_remove_reference_t<__reference>&&,
+ __reference >::type reference;
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator++() { ++__current_; return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator++() {
+ ++__current_;
+ return *this;
+ }
- _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- pointer operator->() const { return __current_; }
+ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pointer operator->() const {
+ return __current_;
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_iterator() requires is_constructible_v<_Iter> : __current_() {}
-
- template <class _Up>
- requires (!_IsSame<_Up, _Iter>::value) && convertible_to<const _Up&, _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {}
-
- template <class _Up>
- requires (!_IsSame<_Up, _Iter>::value) &&
- convertible_to<const _Up&, _Iter> &&
- assignable_from<_Iter&, const _Up&>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_iterator& operator=(const move_iterator<_Up>& __u) {
- __current_ = __u.base();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const & noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- reference operator*() const { return ranges::iter_move(__current_); }
- _LIBCPP_HIDE_FROM_ABI constexpr
- reference operator[](difference_type __n) const { return ranges::iter_move(__current_ + __n); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- auto operator++(int)
- requires forward_iterator<_Iter>
- {
- move_iterator __tmp(*this); ++__current_; return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- void operator++(int) { ++__current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr move_iterator()
+ requires is_constructible_v<_Iter>
+ : __current_() {}
+
+ template <class _Up>
+ requires(!_IsSame<_Up, _Iter>::value) && convertible_to<const _Up&, _Iter>
+ _LIBCPP_HIDE_FROM_ABI constexpr move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {}
+
+ template <class _Up>
+ requires(!_IsSame<_Up, _Iter>::value) && convertible_to<const _Up&, _Iter> && assignable_from<_Iter&, const _Up&>
+ _LIBCPP_HIDE_FROM_ABI constexpr move_iterator& operator=(const move_iterator<_Up>& __u) {
+ __current_ = __u.base();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return ranges::iter_move(__current_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const {
+ return ranges::iter_move(__current_ + __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(int)
+ requires forward_iterator<_Iter>
+ {
+ move_iterator __tmp(*this);
+ ++__current_;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator() : __current_() {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value &&
- is_convertible<const _Up&, _Iter>::value &&
- is_assignable<_Iter&, const _Up&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator=(const move_iterator<_Up>& __u) {
- __current_ = __u.base();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _Iter base() const { return __current_; }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator*() const { return static_cast<reference>(*__current_); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](difference_type __n) const { return static_cast<reference>(__current_[__n]); }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator++(int) { move_iterator __tmp(*this); ++__current_; return __tmp; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator() : __current_() {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator(const move_iterator<_Up>& __u)
+ : __current_(__u.base()) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value &&
+ is_assignable<_Iter&, const _Up&>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator=(const move_iterator<_Up>& __u) {
+ __current_ = __u.base();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return __current_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
+ return static_cast<reference>(*__current_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const {
+ return static_cast<reference>(__current_[__n]);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator++(int) {
+ move_iterator __tmp(*this);
+ ++__current_;
+ return __tmp;
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator--() { --__current_; return *this; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator--(int) { move_iterator __tmp(*this); --__current_; return __tmp; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator+(difference_type __n) const { return move_iterator(__current_ + __n); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator+=(difference_type __n) { __current_ += __n; return *this; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator operator-(difference_type __n) const { return move_iterator(__current_ - __n); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- move_iterator& operator-=(difference_type __n) { __current_ -= __n; return *this; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator--() {
+ --__current_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator--(int) {
+ move_iterator __tmp(*this);
+ --__current_;
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator+(difference_type __n) const {
+ return move_iterator(__current_ + __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator+=(difference_type __n) {
+ __current_ += __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator-(difference_type __n) const {
+ return move_iterator(__current_ - __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator-=(difference_type __n) {
+ __current_ -= __n;
+ return *this;
+ }
#if _LIBCPP_STD_VER >= 20
- template<sentinel_for<_Iter> _Sent>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator==(const move_iterator& __x, const move_sentinel<_Sent>& __y)
- requires __move_iter_comparable<_Iter, _Sent>
- {
- return __x.base() == __y.base();
- }
-
- template<sized_sentinel_for<_Iter> _Sent>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- iter_difference_t<_Iter> operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y)
- {
- return __x.base() - __y.base();
- }
-
- template<sized_sentinel_for<_Iter> _Sent>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- iter_difference_t<_Iter> operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y)
- {
- return __x.base() - __y.base();
- }
+ template <sentinel_for<_Iter> _Sent>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const move_iterator& __x, const move_sentinel<_Sent>& __y)
+ requires __move_iter_comparable<_Iter, _Sent>
+ {
+ return __x.base() == __y.base();
+ }
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- iter_rvalue_reference_t<_Iter> iter_move(const move_iterator& __i)
- noexcept(noexcept(ranges::iter_move(__i.__current_)))
- {
- return ranges::iter_move(__i.__current_);
- }
+ template <sized_sentinel_for<_Iter> _Sent>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
+ operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y) {
+ return __x.base() - __y.base();
+ }
- template<indirectly_swappable<_Iter> _It2>
- friend _LIBCPP_HIDE_FROM_ABI constexpr
- void iter_swap(const move_iterator& __x, const move_iterator<_It2>& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
- {
- return ranges::iter_swap(__x.__current_, __y.__current_);
- }
+ template <sized_sentinel_for<_Iter> _Sent>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
+ operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y) {
+ return __x.base() - __y.base();
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const move_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) {
+ return ranges::iter_move(__i.__current_);
+ }
+
+ template <indirectly_swappable<_Iter> _It2>
+ friend _LIBCPP_HIDE_FROM_ABI constexpr void
+ iter_swap(const move_iterator& __x,
+ const move_iterator<_It2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) {
+ return ranges::iter_swap(__x.__current_, __y.__current_);
+ }
#endif // _LIBCPP_STD_VER >= 20
private:
- template<class _It2> friend class move_iterator;
+ template <class _It2>
+ friend class move_iterator;
- _Iter __current_;
+ _Iter __current_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_iterator);
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() == __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() == __y.base();
}
#if _LIBCPP_STD_VER <= 17
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() != __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() != __y.base();
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() < __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() < __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() > __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() > __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() <= __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() <= __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() >= __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
+operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() >= __y.base();
}
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
- -> compare_three_way_result_t<_Iter1, _Iter2>
-{
- return __x.base() <=> __y.base();
+inline _LIBCPP_HIDE_FROM_ABI constexpr auto
+operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+ -> compare_three_way_result_t<_Iter1, _Iter2> {
+ return __x.base() <=> __y.base();
}
#endif // _LIBCPP_STD_VER >= 20
#ifndef _LIBCPP_CXX03_LANG
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
- -> decltype(__x.base() - __y.base())
-{
- return __x.base() - __y.base();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto
+operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) {
+ return __x.base() - __y.base();
}
#else
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI
-typename move_iterator<_Iter1>::difference_type
-operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
-{
- return __x.base() - __y.base();
+inline _LIBCPP_HIDE_FROM_ABI typename move_iterator<_Iter1>::difference_type
+operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
+ return __x.base() - __y.base();
}
#endif // !_LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 20
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-move_iterator<_Iter> operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x)
- requires requires { { __x.base() + __n } -> same_as<_Iter>; }
+inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter>
+operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x)
+ requires requires {
+ { __x.base() + __n } -> same_as<_Iter>;
+ }
{
- return __x + __n;
+ return __x + __n;
}
#else
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-move_iterator<_Iter>
-operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x)
-{
- return move_iterator<_Iter>(__x.base() + __n);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter>
+operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) {
+ return move_iterator<_Iter>(__x.base() + __n);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-move_iterator<_Iter>
-make_move_iterator(_Iter __i)
-{
- return move_iterator<_Iter>(std::move(__i));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> make_move_iterator(_Iter __i) {
+ return move_iterator<_Iter>(std::move(__i));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h b/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h
index 34b3c25417c4..4a2a09ef0611 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h
@@ -27,30 +27,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <semiregular _Sent>
-class _LIBCPP_TEMPLATE_VIS move_sentinel
-{
+class _LIBCPP_TEMPLATE_VIS move_sentinel {
public:
- _LIBCPP_HIDE_FROM_ABI
- move_sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI move_sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {}
template <class _S2>
requires convertible_to<const _S2&, _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}
template <class _S2>
requires assignable_from<_Sent&, const _S2&>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_sentinel& operator=(const move_sentinel<_S2>& __s)
- { __last_ = __s.base(); return *this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel& operator=(const move_sentinel<_S2>& __s) {
+ __last_ = __s.base();
+ return *this;
+ }
_LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; }
private:
- _Sent __last_ = _Sent();
+ _Sent __last_ = _Sent();
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel);
diff --git a/contrib/llvm-project/libcxx/include/__iterator/next.h b/contrib/llvm-project/libcxx/include/__iterator/next.h
index ae98229bdabf..da60aacfd08d 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/next.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/next.h
@@ -25,9 +25,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _InputIter
- next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter
+next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
_LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
"Attempt to next(it, n) with negative n on a non-bidirectional iterator");
@@ -44,15 +43,13 @@ namespace __next {
struct __fn {
template <input_or_output_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const {
++__x;
return __x;
}
template <input_or_output_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
ranges::advance(__x, __n);
return __x;
}
@@ -73,7 +70,7 @@ struct __fn {
} // namespace __next
inline namespace __cpo {
- inline constexpr auto next = __next::__fn{};
+inline constexpr auto next = __next::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h
index 381f75832fc6..05697e62d9dc 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/ostream_iterator.h
@@ -31,40 +31,43 @@ class _LIBCPP_TEMPLATE_VIS ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_ostream<_CharT, _Traits> ostream_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
private:
- ostream_type* __out_stream_;
- const char_type* __delim_;
+ ostream_type* __out_stream_;
+ const char_type* __delim_;
+
public:
- _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s) _NOEXCEPT
- : __out_stream_(std::addressof(__s)), __delim_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT
- : __out_stream_(std::addressof(__s)), __delim_(__delimiter) {}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator=(const _Tp& __value)
- {
- *__out_stream_ << __value;
- if (__delim_)
- *__out_stream_ << __delim_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s) _NOEXCEPT
+ : __out_stream_(std::addressof(__s)),
+ __delim_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT
+ : __out_stream_(std::addressof(__s)),
+ __delim_(__delimiter) {}
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator=(const _Tp& __value) {
+ *__out_stream_ << __value;
+ if (__delim_)
+ *__out_stream_ << __delim_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++(int) {return *this;}
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++(int) { return *this; }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h
index 6f7491eda5b4..dda0094dc3f5 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h
@@ -29,47 +29,42 @@ class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
#else
- typedef void difference_type;
+ typedef void difference_type;
#endif
- typedef void pointer;
- typedef void reference;
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_streambuf<_CharT, _Traits> streambuf_type;
- typedef basic_ostream<_CharT, _Traits> ostream_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
private:
- streambuf_type* __sbuf_;
+ streambuf_type* __sbuf_;
+
public:
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(ostream_type& __s) _NOEXCEPT
- : __sbuf_(__s.rdbuf()) {}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT
- : __sbuf_(__s) {}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator=(_CharT __c)
- {
- if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
- __sbuf_ = nullptr;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() {return *this;}
- _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) {return *this;}
- _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT {return __sbuf_ == nullptr;}
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(ostream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {}
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator=(_CharT __c) {
+ if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
+ __sbuf_ = nullptr;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; }
- template <class _Ch, class _Tr>
- friend
- _LIBCPP_HIDE_FROM_ABI
- ostreambuf_iterator<_Ch, _Tr>
- __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
- const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
- ios_base& __iob, _Ch __fl);
+ template <class _Ch, class _Tr>
+ friend _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_Ch, _Tr> __pad_and_output(
+ ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl);
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__iterator/permutable.h b/contrib/llvm-project/libcxx/include/__iterator/permutable.h
index adf88f506529..f65ba3bfbbaa 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/permutable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/permutable.h
@@ -24,8 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Iterator>
concept permutable =
- forward_iterator<_Iterator> &&
- indirectly_movable_storable<_Iterator, _Iterator> &&
+ forward_iterator<_Iterator> && indirectly_movable_storable<_Iterator, _Iterator> &&
indirectly_swappable<_Iterator, _Iterator>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/prev.h b/contrib/llvm-project/libcxx/include/__iterator/prev.h
index 3bc29a27e743..1651942acea9 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/prev.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/prev.h
@@ -25,9 +25,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _InputIter
- prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter
+prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
_LIBCPP_ASSERT_UNCATEGORIZED(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
"Attempt to prev(it, n) with a positive n on a non-bidirectional iterator");
std::advance(__x, -__n);
@@ -43,15 +42,13 @@ namespace __prev {
struct __fn {
template <bidirectional_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const {
--__x;
return __x;
}
template <bidirectional_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
ranges::advance(__x, -__n);
return __x;
}
@@ -66,7 +63,7 @@ struct __fn {
} // namespace __prev
inline namespace __cpo {
- inline constexpr auto prev = __prev::__fn{};
+inline constexpr auto prev = __prev::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h b/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h
index 9e101fc28a6f..25e74567fff1 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/readable_traits.h
@@ -29,50 +29,50 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [readable.traits]
-template<class> struct __cond_value_type {};
+template <class>
+struct __cond_value_type {};
-template<class _Tp>
-requires is_object_v<_Tp>
-struct __cond_value_type<_Tp> { using value_type = remove_cv_t<_Tp>; };
+template <class _Tp>
+ requires is_object_v<_Tp>
+struct __cond_value_type<_Tp> {
+ using value_type = remove_cv_t<_Tp>;
+};
-template<class _Tp>
+template <class _Tp>
concept __has_member_value_type = requires { typename _Tp::value_type; };
-template<class _Tp>
+template <class _Tp>
concept __has_member_element_type = requires { typename _Tp::element_type; };
-template<class> struct indirectly_readable_traits {};
+template <class>
+struct indirectly_readable_traits {};
-template<class _Ip>
-requires is_array_v<_Ip>
+template <class _Ip>
+ requires is_array_v<_Ip>
struct indirectly_readable_traits<_Ip> {
using value_type = remove_cv_t<remove_extent_t<_Ip>>;
};
-template<class _Ip>
+template <class _Ip>
struct indirectly_readable_traits<const _Ip> : indirectly_readable_traits<_Ip> {};
-template<class _Tp>
+template <class _Tp>
struct indirectly_readable_traits<_Tp*> : __cond_value_type<_Tp> {};
-template<__has_member_value_type _Tp>
-struct indirectly_readable_traits<_Tp>
- : __cond_value_type<typename _Tp::value_type> {};
+template <__has_member_value_type _Tp>
+struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {};
-template<__has_member_element_type _Tp>
-struct indirectly_readable_traits<_Tp>
- : __cond_value_type<typename _Tp::element_type> {};
+template <__has_member_element_type _Tp>
+struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::element_type> {};
-template<__has_member_value_type _Tp>
+template <__has_member_value_type _Tp>
requires __has_member_element_type<_Tp>
struct indirectly_readable_traits<_Tp> {};
-template<__has_member_value_type _Tp>
+template <__has_member_value_type _Tp>
requires __has_member_element_type<_Tp> &&
- same_as<remove_cv_t<typename _Tp::element_type>,
- remove_cv_t<typename _Tp::value_type>>
-struct indirectly_readable_traits<_Tp>
- : __cond_value_type<typename _Tp::value_type> {};
+ same_as<remove_cv_t<typename _Tp::element_type>, remove_cv_t<typename _Tp::value_type>>
+struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h b/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h
index 5e01f667e115..54d7270b04a5 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h
@@ -24,73 +24,53 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 14
template <class _Tp, size_t _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
-{
- return reverse_iterator<_Tp*>(__array + _Np);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) {
+ return reverse_iterator<_Tp*>(__array + _Np);
}
template <class _Tp, size_t _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
-{
- return reverse_iterator<_Tp*>(__array);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) {
+ return reverse_iterator<_Tp*>(__array);
}
template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
-{
- return reverse_iterator<const _Ep*>(__il.end());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) {
+ return reverse_iterator<const _Ep*>(__il.end());
}
template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
-{
- return reverse_iterator<const _Ep*>(__il.begin());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) {
+ return reverse_iterator<const _Ep*>(__il.begin());
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
-{
- return __c.rbegin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) {
+ return __c.rbegin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
-{
- return __c.rbegin();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) {
+ return __c.rbegin();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rend(_Cp& __c) -> decltype(__c.rend())
-{
- return __c.rend();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) {
+ return __c.rend();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto rend(const _Cp& __c) -> decltype(__c.rend())
-{
- return __c.rend();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c) -> decltype(__c.rend()) {
+ return __c.rend();
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c))
-{
- return std::rbegin(__c);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c)) {
+ return std::rbegin(__c);
}
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto crend(const _Cp& __c) -> decltype(std::rend(__c))
-{
- return std::rend(__c);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c) -> decltype(std::rend(__c)) {
+ return std::rend(__c);
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h b/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h
index 552699bfafa4..79b48bcea57a 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/reverse_iterator.h
@@ -57,279 +57,262 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator
typename iterator_traits<_Iter>::reference>
#endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
private:
#ifndef _LIBCPP_ABI_NO_ITERATOR_BASES
- _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break
+ _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break
#endif
#if _LIBCPP_STD_VER >= 20
- static_assert(__has_bidirectional_iterator_category<_Iter>::value || bidirectional_iterator<_Iter>,
- "reverse_iterator<It> requires It to be a bidirectional iterator.");
+ static_assert(__has_bidirectional_iterator_category<_Iter>::value || bidirectional_iterator<_Iter>,
+ "reverse_iterator<It> requires It to be a bidirectional iterator.");
#endif // _LIBCPP_STD_VER >= 20
protected:
- _Iter current;
+ _Iter current;
+
public:
- using iterator_type = _Iter;
+ using iterator_type = _Iter;
- using iterator_category = _If<__has_random_access_iterator_category<_Iter>::value,
- random_access_iterator_tag,
- typename iterator_traits<_Iter>::iterator_category>;
- using pointer = typename iterator_traits<_Iter>::pointer;
+ using iterator_category =
+ _If<__has_random_access_iterator_category<_Iter>::value,
+ random_access_iterator_tag,
+ typename iterator_traits<_Iter>::iterator_category>;
+ using pointer = typename iterator_traits<_Iter>::pointer;
#if _LIBCPP_STD_VER >= 20
- using iterator_concept = _If<random_access_iterator<_Iter>, random_access_iterator_tag, bidirectional_iterator_tag>;
- using value_type = iter_value_t<_Iter>;
- using difference_type = iter_difference_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
+ using iterator_concept = _If<random_access_iterator<_Iter>, random_access_iterator_tag, bidirectional_iterator_tag>;
+ using value_type = iter_value_t<_Iter>;
+ using difference_type = iter_difference_t<_Iter>;
+ using reference = iter_reference_t<_Iter>;
#else
- using value_type = typename iterator_traits<_Iter>::value_type;
- using difference_type = typename iterator_traits<_Iter>::difference_type;
- using reference = typename iterator_traits<_Iter>::reference;
+ using value_type = typename iterator_traits<_Iter>::value_type;
+ using difference_type = typename iterator_traits<_Iter>::difference_type;
+ using reference = typename iterator_traits<_Iter>::reference;
#endif
#ifndef _LIBCPP_ABI_NO_ITERATOR_BASES
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator() : __t_(), current() {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit reverse_iterator(_Iter __x) : __t_(__x), current(__x) {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator(const reverse_iterator<_Up>& __u)
- : __t_(__u.base()), current(__u.base())
- { }
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value &&
- is_convertible<_Up const&, _Iter>::value &&
- is_assignable<_Iter&, _Up const&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
- __t_ = current = __u.base();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator() : __t_(), current() {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit reverse_iterator(_Iter __x) : __t_(__x), current(__x) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator(const reverse_iterator<_Up>& __u)
+ : __t_(__u.base()), current(__u.base()) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value &&
+ is_assignable<_Iter&, _Up const&>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
+ __t_ = current = __u.base();
+ return *this;
+ }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator() : current() {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit reverse_iterator(_Iter __x) : current(__x) {}
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator(const reverse_iterator<_Up>& __u)
- : current(__u.base())
- { }
-
- template <class _Up, class = __enable_if_t<
- !is_same<_Up, _Iter>::value &&
- is_convertible<_Up const&, _Iter>::value &&
- is_assignable<_Iter&, _Up const&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
- current = __u.base();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator() : current() {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit reverse_iterator(_Iter __x) : current(__x) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator(const reverse_iterator<_Up>& __u)
+ : current(__u.base()) {}
+
+ template <class _Up,
+ class = __enable_if_t< !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value &&
+ is_assignable<_Iter&, _Up const&>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
+ current = __u.base();
+ return *this;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- _Iter base() const {return current;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator*() const {_Iter __tmp = current; return *--__tmp;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return current; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
+ _Iter __tmp = current;
+ return *--__tmp;
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- constexpr pointer operator->() const
- requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); }
- {
- if constexpr (is_pointer_v<_Iter>) {
- return std::prev(current);
- } else {
- return std::prev(current).operator->();
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() const
+ requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); }
+ {
+ if constexpr (is_pointer_v<_Iter>) {
+ return std::prev(current);
+ } else {
+ return std::prev(current).operator->();
}
+ }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- pointer operator->() const {
- return std::addressof(operator*());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pointer operator->() const { return std::addressof(operator*()); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator++() {--current; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator++(int) {reverse_iterator __tmp(*this); --current; return __tmp;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator--() {++current; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator--(int) {reverse_iterator __tmp(*this); ++current; return __tmp;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator+(difference_type __n) const {return reverse_iterator(current - __n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator+=(difference_type __n) {current -= __n; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator operator-(difference_type __n) const {return reverse_iterator(current + __n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator& operator-=(difference_type __n) {current += __n; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](difference_type __n) const {return *(*this + __n);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator++() {
+ --current;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator++(int) {
+ reverse_iterator __tmp(*this);
+ --current;
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator--() {
+ ++current;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator--(int) {
+ reverse_iterator __tmp(*this);
+ ++current;
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator+(difference_type __n) const {
+ return reverse_iterator(current - __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator+=(difference_type __n) {
+ current -= __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator-(difference_type __n) const {
+ return reverse_iterator(current + __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator-=(difference_type __n) {
+ current += __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const {
+ return *(*this + __n);
+ }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI friend constexpr
- iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i)
- noexcept(is_nothrow_copy_constructible_v<_Iter> &&
- noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
- auto __tmp = __i.base();
- return ranges::iter_move(--__tmp);
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept(
+ is_nothrow_copy_constructible_v<_Iter>&& noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
+ auto __tmp = __i.base();
+ return ranges::iter_move(--__tmp);
+ }
- template <indirectly_swappable<_Iter> _Iter2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr
- void iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y)
- noexcept(is_nothrow_copy_constructible_v<_Iter> &&
- is_nothrow_copy_constructible_v<_Iter2> &&
- noexcept(ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) {
- auto __xtmp = __x.base();
- auto __ytmp = __y.base();
- ranges::iter_swap(--__xtmp, --__ytmp);
- }
+ template <indirectly_swappable<_Iter> _Iter2>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y) noexcept(
+ is_nothrow_copy_constructible_v<_Iter> &&
+ is_nothrow_copy_constructible_v<_Iter2>&& noexcept(
+ ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) {
+ auto __xtmp = __x.base();
+ auto __ytmp = __y.base();
+ ranges::iter_swap(--__xtmp, --__ytmp);
+ }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() == __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() == __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() == __y.base();
+ return __x.base() == __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() > __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() > __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() > __y.base();
+ return __x.base() > __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() != __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() != __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() != __y.base();
+ return __x.base() != __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() < __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() < __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() < __y.base();
+ return __x.base() < __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() <= __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() <= __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() <= __y.base();
+ return __x.base() <= __y.base();
}
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool
operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
#if _LIBCPP_STD_VER >= 20
- requires requires {
- { __x.base() >= __y.base() } -> convertible_to<bool>;
- }
+ requires requires {
+ { __x.base() >= __y.base() } -> convertible_to<bool>;
+ }
#endif // _LIBCPP_STD_VER >= 20
{
- return __x.base() >= __y.base();
+ return __x.base() >= __y.base();
}
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2>
-_LIBCPP_HIDE_FROM_ABI constexpr
-compare_three_way_result_t<_Iter1, _Iter2>
-operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
-{
- return __y.base() <=> __x.base();
+_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Iter1, _Iter2>
+operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) {
+ return __y.base() <=> __x.base();
}
#endif // _LIBCPP_STD_VER >= 20
#ifndef _LIBCPP_CXX03_LANG
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-auto
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto
operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
--> decltype(__y.base() - __x.base())
-{
- return __y.base() - __x.base();
+ -> decltype(__y.base() - __x.base()) {
+ return __y.base() - __x.base();
}
#else
template <class _Iter1, class _Iter2>
-inline _LIBCPP_HIDE_FROM_ABI
-typename reverse_iterator<_Iter1>::difference_type
-operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
-{
- return __y.base() - __x.base();
+inline _LIBCPP_HIDE_FROM_ABI typename reverse_iterator<_Iter1>::difference_type
+operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) {
+ return __y.base() - __x.base();
}
#endif
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Iter>
-operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x)
-{
- return reverse_iterator<_Iter>(__x.base() - __n);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter>
+operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) {
+ return reverse_iterator<_Iter>(__x.base() - __n);
}
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, class _Iter2>
- requires (!sized_sentinel_for<_Iter1, _Iter2>)
+ requires(!sized_sentinel_for<_Iter1, _Iter2>)
inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, reverse_iterator<_Iter2>> = true;
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 14
template <class _Iter>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
-reverse_iterator<_Iter> make_reverse_iterator(_Iter __i)
-{
- return reverse_iterator<_Iter>(__i);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) {
+ return reverse_iterator<_Iter>(__i);
}
#endif
@@ -369,13 +352,15 @@ public:
using iterator_type = _Iter;
using iterator_category =
- _If<__has_random_access_iterator_category<_Iter>::value, random_access_iterator_tag, __iterator_category_type<_Iter>>;
- using pointer = __iterator_pointer_type<_Iter>;
- using value_type = iter_value_t<_Iter>;
+ _If<__has_random_access_iterator_category<_Iter>::value,
+ random_access_iterator_tag,
+ __iterator_category_type<_Iter>>;
+ using pointer = __iterator_pointer_type<_Iter>;
+ using value_type = iter_value_t<_Iter>;
using difference_type = iter_difference_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
+ using reference = iter_reference_t<_Iter>;
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator() = default;
_LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator(const __unconstrained_reverse_iterator&) = default;
_LIBCPP_HIDE_FROM_ABI constexpr explicit __unconstrained_reverse_iterator(_Iter __iter) : __iter_(__iter) {}
@@ -393,10 +378,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr
- iter_rvalue_reference_t<_Iter> iter_move(const __unconstrained_reverse_iterator& __i)
- noexcept(is_nothrow_copy_constructible_v<_Iter> &&
- noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
+ iter_move(const __unconstrained_reverse_iterator& __i) noexcept(
+ is_nothrow_copy_constructible_v<_Iter>&& noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
auto __tmp = __i.base();
return ranges::iter_move(--__tmp);
}
@@ -484,7 +468,7 @@ public:
template <template <class> class _RevIter1, template <class> class _RevIter2, class _Iter>
struct __unwrap_reverse_iter_impl {
- using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
+ using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
using _ReverseWrapper = _RevIter1<_RevIter2<_Iter> >;
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ReverseWrapper
@@ -500,9 +484,9 @@ struct __unwrap_reverse_iter_impl {
#if _LIBCPP_STD_VER >= 20
template <ranges::bidirectional_range _Range>
-_LIBCPP_HIDE_FROM_ABI constexpr ranges::
- subrange<reverse_iterator<ranges::iterator_t<_Range>>, reverse_iterator<ranges::iterator_t<_Range>>>
- __reverse_range(_Range&& __range) {
+_LIBCPP_HIDE_FROM_ABI constexpr ranges::subrange<reverse_iterator<ranges::iterator_t<_Range>>,
+ reverse_iterator<ranges::iterator_t<_Range>>>
+__reverse_range(_Range&& __range) {
auto __first = ranges::begin(__range);
return {std::make_reverse_iterator(ranges::next(__first, ranges::end(__range))), std::make_reverse_iterator(__first)};
}
diff --git a/contrib/llvm-project/libcxx/include/__iterator/size.h b/contrib/llvm-project/libcxx/include/__iterator/size.h
index 11c757f751c0..eac3ccf522c3 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/size.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/size.h
@@ -24,33 +24,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto size(const _Cont& __c)
-_NOEXCEPT_(noexcept(__c.size()))
--> decltype (__c.size())
-{ return __c.size(); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) _NOEXCEPT_(noexcept(__c.size())) -> decltype(__c.size()) {
+ return __c.size();
+}
template <class _Tp, size_t _Sz>
-_LIBCPP_HIDE_FROM_ABI
-constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }
+_LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept {
+ return _Sz;
+}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto ssize(const _Cont& __c)
-_NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
--> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>
-{ return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()); }
+_LIBCPP_HIDE_FROM_ABI constexpr auto ssize(const _Cont& __c)
+ _NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
+ -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> {
+ return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size());
+}
// GCC complains about the implicit conversion from ptrdiff_t to size_t in
// the array bound.
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion")
template <class _Tp, ptrdiff_t _Sz>
-_LIBCPP_HIDE_FROM_ABI
-constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { return _Sz; }
+_LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept {
+ return _Sz;
+}
_LIBCPP_DIAGNOSTIC_POP
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__iterator/sortable.h b/contrib/llvm-project/libcxx/include/__iterator/sortable.h
index d4d77d6cf334..1444860f2aa1 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/sortable.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/sortable.h
@@ -26,9 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _Iter, class _Comp = ranges::less, class _Proj = identity>
-concept sortable =
- permutable<_Iter> &&
- indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>;
+concept sortable = permutable<_Iter> && indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h b/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h
index 91fd0a57ab3f..77e663da4b3a 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h
@@ -22,9 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
struct unreachable_sentinel_t {
- template<weakly_incrementable _Iter>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(unreachable_sentinel_t, const _Iter&) noexcept {
+ template <weakly_incrementable _Iter>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(unreachable_sentinel_t, const _Iter&) noexcept {
return false;
}
};
diff --git a/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h b/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h
index d028d7b3c33c..3827241e5fe4 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/wrap_iter.h
@@ -25,187 +25,175 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Iter>
-class __wrap_iter
-{
+class __wrap_iter {
public:
- typedef _Iter iterator_type;
- typedef typename iterator_traits<iterator_type>::value_type value_type;
- typedef typename iterator_traits<iterator_type>::difference_type difference_type;
- typedef typename iterator_traits<iterator_type>::pointer pointer;
- typedef typename iterator_traits<iterator_type>::reference reference;
- typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
+ typedef _Iter iterator_type;
+ typedef typename iterator_traits<iterator_type>::value_type value_type;
+ typedef typename iterator_traits<iterator_type>::difference_type difference_type;
+ typedef typename iterator_traits<iterator_type>::pointer pointer;
+ typedef typename iterator_traits<iterator_type>::reference reference;
+ typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef contiguous_iterator_tag iterator_concept;
+ typedef contiguous_iterator_tag iterator_concept;
#endif
private:
- iterator_type __i_;
+ iterator_type __i_;
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT
- : __i_()
- {
- }
- template <class _Up, __enable_if_t<is_convertible<_Up, iterator_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_Up>& __u) _NOEXCEPT
- : __i_(__u.base())
- {
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT
- {
- return *__i_;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT
- {
- return std::__to_address(__i_);
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator++() _NOEXCEPT
- {
- ++__i_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator++(int) _NOEXCEPT
- {__wrap_iter __tmp(*this); ++(*this); return __tmp;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator--() _NOEXCEPT
- {
- --__i_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator--(int) _NOEXCEPT
- {__wrap_iter __tmp(*this); --(*this); return __tmp;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
- {__wrap_iter __w(*this); __w += __n; return __w;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
- {
- __i_ += __n;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator- (difference_type __n) const _NOEXCEPT
- {return *this + (-__n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
- {*this += -__n; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT
- {
- return __i_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator_type base() const _NOEXCEPT {return __i_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT : __i_() {}
+ template <class _Up, __enable_if_t<is_convertible<_Up, iterator_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_Up>& __u) _NOEXCEPT
+ : __i_(__u.base()) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { return *__i_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT {
+ return std::__to_address(__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator++() _NOEXCEPT {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator++(int) _NOEXCEPT {
+ __wrap_iter __tmp(*this);
+ ++(*this);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator--() _NOEXCEPT {
+ --__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator--(int) _NOEXCEPT {
+ __wrap_iter __tmp(*this);
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+(difference_type __n) const _NOEXCEPT {
+ __wrap_iter __w(*this);
+ __w += __n;
+ return __w;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT {
+ __i_ += __n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator-(difference_type __n) const _NOEXCEPT {
+ return *this + (-__n);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT {
+ *this += -__n;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT {
+ return __i_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator_type base() const _NOEXCEPT { return __i_; }
private:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x)
- {
- }
-
- template <class _Up> friend class __wrap_iter;
- template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
- template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector;
- template <class _Tp, size_t> friend class _LIBCPP_TEMPLATE_VIS span;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x) {}
+
+ template <class _Up>
+ friend class __wrap_iter;
+ template <class _CharT, class _Traits, class _Alloc>
+ friend class basic_string;
+ template <class _Tp, class _Alloc>
+ friend class _LIBCPP_TEMPLATE_VIS vector;
+ template <class _Tp, size_t>
+ friend class _LIBCPP_TEMPLATE_VIS span;
};
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return __x.base() == __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return __x.base() == __y.base();
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return __x.base() == __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return __x.base() == __y.base();
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return __x.base() < __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return __x.base() < __y.base();
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return __x.base() < __y.base();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return __x.base() < __y.base();
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return !(__x == __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return !(__x == __y);
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return !(__x == __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return !(__x == __y);
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return __y < __x;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return __y < __x;
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return __y < __x;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return __y < __x;
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return !(__x < __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return !(__x < __y);
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return !(__x < __y);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return !(__x < __y);
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
-{
- return !(__y < __x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
+ return !(__y < __x);
}
template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
-{
- return !(__y < __x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+ return !(__y < __x);
}
template <class _Iter1, class _Iter2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
#ifndef _LIBCPP_CXX03_LANG
-auto operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
- -> decltype(__x.base() - __y.base())
+ auto
+ operator-(const __wrap_iter<_Iter1>& __x,
+ const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() - __y.base())
#else
-typename __wrap_iter<_Iter1>::difference_type
-operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+ typename __wrap_iter<_Iter1>::difference_type
+ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
#endif // C++03
{
- return __x.base() - __y.base();
+ return __x.base() - __y.base();
}
template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-__wrap_iter<_Iter1> operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT
-{
- __x += __n;
- return __x;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter<_Iter1>
+operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT {
+ __x += __n;
+ return __x;
}
#if _LIBCPP_STD_VER <= 17
@@ -214,16 +202,14 @@ struct __libcpp_is_contiguous_iterator<__wrap_iter<_It> > : true_type {};
#endif
template <class _It>
-struct _LIBCPP_TEMPLATE_VIS pointer_traits<__wrap_iter<_It> >
-{
- typedef __wrap_iter<_It> pointer;
- typedef typename pointer_traits<_It>::element_type element_type;
- typedef typename pointer_traits<_It>::difference_type difference_type;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- static element_type *to_address(pointer __w) _NOEXCEPT {
- return std::__to_address(__w.base());
- }
+struct _LIBCPP_TEMPLATE_VIS pointer_traits<__wrap_iter<_It> > {
+ typedef __wrap_iter<_It> pointer;
+ typedef typename pointer_traits<_It>::element_type element_type;
+ typedef typename pointer_traits<_It>::difference_type difference_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static element_type* to_address(pointer __w) _NOEXCEPT {
+ return std::__to_address(__w.base());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__locale b/contrib/llvm-project/libcxx/include/__locale
index 6eb892287160..3ba7ac18b0b3 100644
--- a/contrib/llvm-project/libcxx/include/__locale
+++ b/contrib/llvm-project/libcxx/include/__locale
@@ -33,24 +33,24 @@
#endif
#if defined(_LIBCPP_MSVCRT_LIKE)
-# include <__support/win32/locale_win32.h>
+# include <__support/win32/locale_win32.h>
#elif defined(_AIX) || defined(__MVS__)
-# include <__support/ibm/xlocale.h>
+# include <__support/ibm/xlocale.h>
#elif defined(__ANDROID__)
-# include <__support/android/locale_bionic.h>
+# include <__support/android/locale_bionic.h>
#elif defined(_NEWLIB_VERSION)
-# include <__support/newlib/xlocale.h>
+# include <__support/newlib/xlocale.h>
#elif defined(__OpenBSD__)
-# include <__support/openbsd/xlocale.h>
+# include <__support/openbsd/xlocale.h>
#elif (defined(__APPLE__) || defined(__FreeBSD__))
-# include <xlocale.h>
+# include <xlocale.h>
#elif defined(__Fuchsia__)
-# include <__support/fuchsia/xlocale.h>
+# include <__support/fuchsia/xlocale.h>
#elif defined(__wasi__)
// WASI libc uses musl's locales support.
-# include <__support/musl/xlocale.h>
+# include <__support/musl/xlocale.h>
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
-# include <__support/musl/xlocale.h>
+# include <__support/musl/xlocale.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -62,235 +62,195 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_EXPORTED_FROM_ABI locale;
template <class _Facet>
-_LIBCPP_HIDE_FROM_ABI
-bool
-has_facet(const locale&) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI bool has_facet(const locale&) _NOEXCEPT;
template <class _Facet>
-_LIBCPP_HIDE_FROM_ABI
-const _Facet&
-use_facet(const locale&);
+_LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale&);
-class _LIBCPP_EXPORTED_FROM_ABI locale
-{
+class _LIBCPP_EXPORTED_FROM_ABI locale {
public:
- // types:
- class _LIBCPP_EXPORTED_FROM_ABI facet;
- class _LIBCPP_EXPORTED_FROM_ABI id;
-
- typedef int category;
-
- static const category // values assigned here are for exposition only
- none = 0,
- collate = LC_COLLATE_MASK,
- ctype = LC_CTYPE_MASK,
- monetary = LC_MONETARY_MASK,
- numeric = LC_NUMERIC_MASK,
- time = LC_TIME_MASK,
- messages = LC_MESSAGES_MASK,
- all = collate | ctype | monetary | numeric | time | messages;
-
- // construct/copy/destroy:
- locale() _NOEXCEPT;
- locale(const locale&) _NOEXCEPT;
- explicit locale(const char*);
- explicit locale(const string&);
- locale(const locale&, const char*, category);
- locale(const locale&, const string&, category);
- template <class _Facet>
- _LIBCPP_HIDE_FROM_ABI locale(const locale&, _Facet*);
- locale(const locale&, const locale&, category);
-
- ~locale();
-
- const locale& operator=(const locale&) _NOEXCEPT;
-
- template <class _Facet>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- locale combine(const locale&) const;
-
- // locale operations:
- string name() const;
- bool operator==(const locale&) const;
+ // types:
+ class _LIBCPP_EXPORTED_FROM_ABI facet;
+ class _LIBCPP_EXPORTED_FROM_ABI id;
+
+ typedef int category;
+
+ static const category // values assigned here are for exposition only
+ none = 0,
+ collate = LC_COLLATE_MASK, ctype = LC_CTYPE_MASK, monetary = LC_MONETARY_MASK, numeric = LC_NUMERIC_MASK,
+ time = LC_TIME_MASK, messages = LC_MESSAGES_MASK, all = collate | ctype | monetary | numeric | time | messages;
+
+ // construct/copy/destroy:
+ locale() _NOEXCEPT;
+ locale(const locale&) _NOEXCEPT;
+ explicit locale(const char*);
+ explicit locale(const string&);
+ locale(const locale&, const char*, category);
+ locale(const locale&, const string&, category);
+ template <class _Facet>
+ _LIBCPP_HIDE_FROM_ABI locale(const locale&, _Facet*);
+ locale(const locale&, const locale&, category);
+
+ ~locale();
+
+ const locale& operator=(const locale&) _NOEXCEPT;
+
+ template <class _Facet>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS locale combine(const locale&) const;
+
+ // locale operations:
+ string name() const;
+ bool operator==(const locale&) const;
#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const {return !(*this == __y);}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const { return !(*this == __y); }
#endif
- template <class _CharT, class _Traits, class _Allocator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
- const basic_string<_CharT, _Traits, _Allocator>&) const;
+ template <class _CharT, class _Traits, class _Allocator>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
+ operator()(const basic_string<_CharT, _Traits, _Allocator>&, const basic_string<_CharT, _Traits, _Allocator>&) const;
- // global locale objects:
- static locale global(const locale&);
- static const locale& classic();
+ // global locale objects:
+ static locale global(const locale&);
+ static const locale& classic();
private:
- class __imp;
- __imp* __locale_;
-
- template <class> friend struct __no_destroy;
- struct __private_tag { };
- _LIBCPP_HIDE_FROM_ABI explicit locale(__private_tag, __imp* __loc) : __locale_(__loc) {}
-
- void __install_ctor(const locale&, facet*, long);
- static locale& __global();
- bool has_facet(id&) const;
- const facet* use_facet(id&) const;
-
- template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT;
- template <class _Facet> friend const _Facet& use_facet(const locale&);
+ class __imp;
+ __imp* __locale_;
+
+ template <class>
+ friend struct __no_destroy;
+ struct __private_tag {};
+ _LIBCPP_HIDE_FROM_ABI explicit locale(__private_tag, __imp* __loc) : __locale_(__loc) {}
+
+ void __install_ctor(const locale&, facet*, long);
+ static locale& __global();
+ bool has_facet(id&) const;
+ const facet* use_facet(id&) const;
+
+ template <class _Facet>
+ friend bool has_facet(const locale&) _NOEXCEPT;
+ template <class _Facet>
+ friend const _Facet& use_facet(const locale&);
};
-class _LIBCPP_EXPORTED_FROM_ABI locale::facet
- : public __shared_count
-{
+class _LIBCPP_EXPORTED_FROM_ABI locale::facet : public __shared_count {
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit facet(size_t __refs = 0)
- : __shared_count(static_cast<long>(__refs)-1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit facet(size_t __refs = 0) : __shared_count(static_cast<long>(__refs) - 1) {}
- ~facet() override;
+ ~facet() override;
+
+ // facet(const facet&) = delete; // effectively done in __shared_count
+ // void operator=(const facet&) = delete;
-// facet(const facet&) = delete; // effectively done in __shared_count
-// void operator=(const facet&) = delete;
private:
- void __on_zero_shared() _NOEXCEPT override;
+ void __on_zero_shared() _NOEXCEPT override;
};
-class _LIBCPP_EXPORTED_FROM_ABI locale::id
-{
- once_flag __flag_;
- int32_t __id_;
+class _LIBCPP_EXPORTED_FROM_ABI locale::id {
+ once_flag __flag_;
+ int32_t __id_;
+
+ static int32_t __next_id;
- static int32_t __next_id;
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR id() :__id_(0) {}
- void operator=(const id&) = delete;
- id(const id&) = delete;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR id() : __id_(0) {}
+ void operator=(const id&) = delete;
+ id(const id&) = delete;
-public: // only needed for tests
- long __get();
+public: // only needed for tests
+ long __get();
- friend class locale;
- friend class locale::__imp;
+ friend class locale;
+ friend class locale::__imp;
};
template <class _Facet>
-inline _LIBCPP_HIDE_FROM_ABI
-locale::locale(const locale& __other, _Facet* __f)
-{
- __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
+inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f) {
+ __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
}
template <class _Facet>
-locale
-locale::combine(const locale& __other) const
-{
- if (!std::has_facet<_Facet>(__other))
- __throw_runtime_error("locale::combine: locale missing facet");
+locale locale::combine(const locale& __other) const {
+ if (!std::has_facet<_Facet>(__other))
+ __throw_runtime_error("locale::combine: locale missing facet");
- return locale(*this, &const_cast<_Facet&>(std::use_facet<_Facet>(__other)));
+ return locale(*this, &const_cast<_Facet&>(std::use_facet<_Facet>(__other)));
}
template <class _Facet>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-has_facet(const locale& __l) _NOEXCEPT
-{
- return __l.has_facet(_Facet::id);
+inline _LIBCPP_HIDE_FROM_ABI bool has_facet(const locale& __l) _NOEXCEPT {
+ return __l.has_facet(_Facet::id);
}
template <class _Facet>
-inline _LIBCPP_HIDE_FROM_ABI
-const _Facet&
-use_facet(const locale& __l)
-{
- return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
+inline _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale& __l) {
+ return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
}
// template <class _CharT> class collate;
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS collate
- : public locale::facet
-{
+class _LIBCPP_TEMPLATE_VIS collate : public locale::facet {
public:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit collate(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- int compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const
- {
- return do_compare(__lo1, __hi1, __lo2, __hi2);
- }
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
- // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
- // around a dllimport bug that expects an external instantiation.
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_ALWAYS_INLINE
- string_type transform(const char_type* __lo, const char_type* __hi) const
- {
- return do_transform(__lo, __hi);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- long hash(const char_type* __lo, const char_type* __hi) const
- {
- return do_hash(__lo, __hi);
- }
+ _LIBCPP_HIDE_FROM_ABI int
+ compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const {
+ return do_compare(__lo1, __hi1, __lo2, __hi2);
+ }
+
+ // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
+ // around a dllimport bug that expects an external instantiation.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE string_type
+ transform(const char_type* __lo, const char_type* __hi) const {
+ return do_transform(__lo, __hi);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI long hash(const char_type* __lo, const char_type* __hi) const { return do_hash(__lo, __hi); }
- static locale::id id;
+ static locale::id id;
protected:
- ~collate() override;
- virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const;
- virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const
- {return string_type(__lo, __hi);}
- virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
+ ~collate() override;
+ virtual int
+ do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const;
+ virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const {
+ return string_type(__lo, __hi);
+ }
+ virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
};
-template <class _CharT> locale::id collate<_CharT>::id;
+template <class _CharT>
+locale::id collate<_CharT>::id;
template <class _CharT>
-collate<_CharT>::~collate()
-{
-}
+collate<_CharT>::~collate() {}
template <class _CharT>
-int
-collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const
-{
- for (; __lo2 != __hi2; ++__lo1, ++__lo2)
- {
- if (__lo1 == __hi1 || *__lo1 < *__lo2)
- return -1;
- if (*__lo2 < *__lo1)
- return 1;
- }
- return __lo1 != __hi1;
+int collate<_CharT>::do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const {
+ for (; __lo2 != __hi2; ++__lo1, ++__lo2) {
+ if (__lo1 == __hi1 || *__lo1 < *__lo2)
+ return -1;
+ if (*__lo2 < *__lo1)
+ return 1;
+ }
+ return __lo1 != __hi1;
}
template <class _CharT>
-long
-collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
-{
- size_t __h = 0;
- const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
- const size_t __mask = size_t(0xF) << (__sr + 4);
- for(const char_type* __p = __lo; __p != __hi; ++__p)
- {
- __h = (__h << 4) + static_cast<size_t>(*__p);
- size_t __g = __h & __mask;
- __h ^= __g | (__g >> __sr);
- }
- return static_cast<long>(__h);
+long collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const {
+ size_t __h = 0;
+ const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
+ const size_t __mask = size_t(0xF) << (__sr + 4);
+ for (const char_type* __p = __lo; __p != __hi; ++__p) {
+ __h = (__h << 4) + static_cast<size_t>(*__p);
+ size_t __g = __h & __mask;
+ __h ^= __g | (__g >> __sr);
+ }
+ return static_cast<long>(__h);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>;
@@ -300,786 +260,663 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>;
// template <class CharT> class collate_byname;
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS collate_byname;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS collate_byname;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI collate_byname<char>
- : public collate<char>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI collate_byname<char> : public collate<char> {
+ locale_t __l_;
+
public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
- explicit collate_byname(const char* __n, size_t __refs = 0);
- explicit collate_byname(const string& __n, size_t __refs = 0);
+ explicit collate_byname(const char* __n, size_t __refs = 0);
+ explicit collate_byname(const string& __n, size_t __refs = 0);
protected:
- ~collate_byname() override;
- int do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const override;
- string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
+ ~collate_byname() override;
+ int do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const override;
+ string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI collate_byname<wchar_t>
- : public collate<wchar_t>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI collate_byname<wchar_t> : public collate<wchar_t> {
+ locale_t __l_;
+
public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
- explicit collate_byname(const char* __n, size_t __refs = 0);
- explicit collate_byname(const string& __n, size_t __refs = 0);
+ explicit collate_byname(const char* __n, size_t __refs = 0);
+ explicit collate_byname(const string& __n, size_t __refs = 0);
protected:
- ~collate_byname() override;
+ ~collate_byname() override;
- int do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const override;
- string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
+ int do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const override;
+ string_type do_transform(const char_type* __lo, const char_type* __hi) const override;
};
#endif
template <class _CharT, class _Traits, class _Allocator>
-bool
-locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
- const basic_string<_CharT, _Traits, _Allocator>& __y) const
-{
- return std::use_facet<std::collate<_CharT> >(*this).compare(
- __x.data(), __x.data() + __x.size(),
- __y.data(), __y.data() + __y.size()) < 0;
+bool locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
+ const basic_string<_CharT, _Traits, _Allocator>& __y) const {
+ return std::use_facet<std::collate<_CharT> >(*this).compare(
+ __x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0;
}
// template <class charT> class ctype
-class _LIBCPP_EXPORTED_FROM_ABI ctype_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI ctype_base {
public:
#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
- typedef unsigned long mask;
- static const mask space = 1<<0;
- static const mask print = 1<<1;
- static const mask cntrl = 1<<2;
- static const mask upper = 1<<3;
- static const mask lower = 1<<4;
- static const mask alpha = 1<<5;
- static const mask digit = 1<<6;
- static const mask punct = 1<<7;
- static const mask xdigit = 1<<8;
- static const mask blank = 1<<9;
-#if defined(__BIONIC__)
- // Historically this was a part of regex_traits rather than ctype_base. The
- // historical value of the constant is preserved for ABI compatibility.
- static const mask __regex_word = 0x8000;
-#else
- static const mask __regex_word = 1<<10;
-#endif // defined(__BIONIC__)
+ typedef unsigned long mask;
+ static const mask space = 1 << 0;
+ static const mask print = 1 << 1;
+ static const mask cntrl = 1 << 2;
+ static const mask upper = 1 << 3;
+ static const mask lower = 1 << 4;
+ static const mask alpha = 1 << 5;
+ static const mask digit = 1 << 6;
+ static const mask punct = 1 << 7;
+ static const mask xdigit = 1 << 8;
+ static const mask blank = 1 << 9;
+# if defined(__BIONIC__)
+ // Historically this was a part of regex_traits rather than ctype_base. The
+ // historical value of the constant is preserved for ABI compatibility.
+ static const mask __regex_word = 0x8000;
+# else
+ static const mask __regex_word = 1 << 10;
+# endif // defined(__BIONIC__)
#elif defined(__GLIBC__)
- typedef unsigned short mask;
- static const mask space = _ISspace;
- static const mask print = _ISprint;
- static const mask cntrl = _IScntrl;
- static const mask upper = _ISupper;
- static const mask lower = _ISlower;
- static const mask alpha = _ISalpha;
- static const mask digit = _ISdigit;
- static const mask punct = _ISpunct;
- static const mask xdigit = _ISxdigit;
- static const mask blank = _ISblank;
-#if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
- static const mask __regex_word = static_cast<mask>(_ISbit(15));
-#else
- static const mask __regex_word = 0x80;
-#endif
+ typedef unsigned short mask;
+ static const mask space = _ISspace;
+ static const mask print = _ISprint;
+ static const mask cntrl = _IScntrl;
+ static const mask upper = _ISupper;
+ static const mask lower = _ISlower;
+ static const mask alpha = _ISalpha;
+ static const mask digit = _ISdigit;
+ static const mask punct = _ISpunct;
+ static const mask xdigit = _ISxdigit;
+ static const mask blank = _ISblank;
+# if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
+ static const mask __regex_word = static_cast<mask>(_ISbit(15));
+# else
+ static const mask __regex_word = 0x80;
+# endif
#elif defined(_LIBCPP_MSVCRT_LIKE)
- typedef unsigned short mask;
- static const mask space = _SPACE;
- static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
- static const mask cntrl = _CONTROL;
- static const mask upper = _UPPER;
- static const mask lower = _LOWER;
- static const mask alpha = _ALPHA;
- static const mask digit = _DIGIT;
- static const mask punct = _PUNCT;
- static const mask xdigit = _HEX;
- static const mask blank = _BLANK;
- static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+ typedef unsigned short mask;
+ static const mask space = _SPACE;
+ static const mask print = _BLANK | _PUNCT | _ALPHA | _DIGIT;
+ static const mask cntrl = _CONTROL;
+ static const mask upper = _UPPER;
+ static const mask lower = _LOWER;
+ static const mask alpha = _ALPHA;
+ static const mask digit = _DIGIT;
+ static const mask punct = _PUNCT;
+ static const mask xdigit = _HEX;
+ static const mask blank = _BLANK;
+ static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
-# ifdef __APPLE__
- typedef __uint32_t mask;
-# elif defined(__FreeBSD__)
- typedef unsigned long mask;
-# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
- typedef unsigned short mask;
-# endif
- static const mask space = _CTYPE_S;
- static const mask print = _CTYPE_R;
- static const mask cntrl = _CTYPE_C;
- static const mask upper = _CTYPE_U;
- static const mask lower = _CTYPE_L;
- static const mask alpha = _CTYPE_A;
- static const mask digit = _CTYPE_D;
- static const mask punct = _CTYPE_P;
- static const mask xdigit = _CTYPE_X;
-
-# if defined(__NetBSD__)
- static const mask blank = _CTYPE_BL;
- // NetBSD defines classes up to 0x2000
- // see sys/ctype_bits.h, _CTYPE_Q
- static const mask __regex_word = 0x8000;
-# else
- static const mask blank = _CTYPE_B;
- static const mask __regex_word = 0x80;
-# endif
+# ifdef __APPLE__
+ typedef __uint32_t mask;
+# elif defined(__FreeBSD__)
+ typedef unsigned long mask;
+# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+ typedef unsigned short mask;
+# endif
+ static const mask space = _CTYPE_S;
+ static const mask print = _CTYPE_R;
+ static const mask cntrl = _CTYPE_C;
+ static const mask upper = _CTYPE_U;
+ static const mask lower = _CTYPE_L;
+ static const mask alpha = _CTYPE_A;
+ static const mask digit = _CTYPE_D;
+ static const mask punct = _CTYPE_P;
+ static const mask xdigit = _CTYPE_X;
+
+# if defined(__NetBSD__)
+ static const mask blank = _CTYPE_BL;
+ // NetBSD defines classes up to 0x2000
+ // see sys/ctype_bits.h, _CTYPE_Q
+ static const mask __regex_word = 0x8000;
+# else
+ static const mask blank = _CTYPE_B;
+ static const mask __regex_word = 0x80;
+# endif
#elif defined(_AIX)
- typedef unsigned int mask;
- static const mask space = _ISSPACE;
- static const mask print = _ISPRINT;
- static const mask cntrl = _ISCNTRL;
- static const mask upper = _ISUPPER;
- static const mask lower = _ISLOWER;
- static const mask alpha = _ISALPHA;
- static const mask digit = _ISDIGIT;
- static const mask punct = _ISPUNCT;
- static const mask xdigit = _ISXDIGIT;
- static const mask blank = _ISBLANK;
- static const mask __regex_word = 0x8000;
+ typedef unsigned int mask;
+ static const mask space = _ISSPACE;
+ static const mask print = _ISPRINT;
+ static const mask cntrl = _ISCNTRL;
+ static const mask upper = _ISUPPER;
+ static const mask lower = _ISLOWER;
+ static const mask alpha = _ISALPHA;
+ static const mask digit = _ISDIGIT;
+ static const mask punct = _ISPUNCT;
+ static const mask xdigit = _ISXDIGIT;
+ static const mask blank = _ISBLANK;
+ static const mask __regex_word = 0x8000;
#elif defined(_NEWLIB_VERSION)
- // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
- typedef char mask;
- // In case char is signed, static_cast is needed to avoid warning on
- // positive value becomming negative.
- static const mask space = static_cast<mask>(_S);
- static const mask print = static_cast<mask>(_P | _U | _L | _N | _B);
- static const mask cntrl = static_cast<mask>(_C);
- static const mask upper = static_cast<mask>(_U);
- static const mask lower = static_cast<mask>(_L);
- static const mask alpha = static_cast<mask>(_U | _L);
- static const mask digit = static_cast<mask>(_N);
- static const mask punct = static_cast<mask>(_P);
- static const mask xdigit = static_cast<mask>(_X | _N);
- static const mask blank = static_cast<mask>(_B);
- // mask is already fully saturated, use a different type in regex_type_traits.
- static const unsigned short __regex_word = 0x100;
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
-# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
+ // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
+ typedef char mask;
+ // In case char is signed, static_cast is needed to avoid warning on
+ // positive value becomming negative.
+ static const mask space = static_cast<mask>(_S);
+ static const mask print = static_cast<mask>(_P | _U | _L | _N | _B);
+ static const mask cntrl = static_cast<mask>(_C);
+ static const mask upper = static_cast<mask>(_U);
+ static const mask lower = static_cast<mask>(_L);
+ static const mask alpha = static_cast<mask>(_U | _L);
+ static const mask digit = static_cast<mask>(_N);
+ static const mask punct = static_cast<mask>(_P);
+ static const mask xdigit = static_cast<mask>(_X | _N);
+ static const mask blank = static_cast<mask>(_B);
+ // mask is already fully saturated, use a different type in regex_type_traits.
+ static const unsigned short __regex_word = 0x100;
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
#elif defined(__MVS__)
-# if defined(__NATIVE_ASCII_F)
- typedef unsigned int mask;
- static const mask space = _ISSPACE_A;
- static const mask print = _ISPRINT_A;
- static const mask cntrl = _ISCNTRL_A;
- static const mask upper = _ISUPPER_A;
- static const mask lower = _ISLOWER_A;
- static const mask alpha = _ISALPHA_A;
- static const mask digit = _ISDIGIT_A;
- static const mask punct = _ISPUNCT_A;
- static const mask xdigit = _ISXDIGIT_A;
- static const mask blank = _ISBLANK_A;
-# else
- typedef unsigned short mask;
- static const mask space = __ISSPACE;
- static const mask print = __ISPRINT;
- static const mask cntrl = __ISCNTRL;
- static const mask upper = __ISUPPER;
- static const mask lower = __ISLOWER;
- static const mask alpha = __ISALPHA;
- static const mask digit = __ISDIGIT;
- static const mask punct = __ISPUNCT;
- static const mask xdigit = __ISXDIGIT;
- static const mask blank = __ISBLANK;
-# endif
- static const mask __regex_word = 0x8000;
+# if defined(__NATIVE_ASCII_F)
+ typedef unsigned int mask;
+ static const mask space = _ISSPACE_A;
+ static const mask print = _ISPRINT_A;
+ static const mask cntrl = _ISCNTRL_A;
+ static const mask upper = _ISUPPER_A;
+ static const mask lower = _ISLOWER_A;
+ static const mask alpha = _ISALPHA_A;
+ static const mask digit = _ISDIGIT_A;
+ static const mask punct = _ISPUNCT_A;
+ static const mask xdigit = _ISXDIGIT_A;
+ static const mask blank = _ISBLANK_A;
+# else
+ typedef unsigned short mask;
+ static const mask space = __ISSPACE;
+ static const mask print = __ISPRINT;
+ static const mask cntrl = __ISCNTRL;
+ static const mask upper = __ISUPPER;
+ static const mask lower = __ISLOWER;
+ static const mask alpha = __ISALPHA;
+ static const mask digit = __ISDIGIT;
+ static const mask punct = __ISPUNCT;
+ static const mask xdigit = __ISXDIGIT;
+ static const mask blank = __ISBLANK;
+# endif
+ static const mask __regex_word = 0x8000;
#else
-# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
+# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
#endif
- static const mask alnum = alpha | digit;
- static const mask graph = alnum | punct;
+ static const mask alnum = alpha | digit;
+ static const mask graph = alnum | punct;
- _LIBCPP_HIDE_FROM_ABI ctype_base() {}
+ _LIBCPP_HIDE_FROM_ABI ctype_base() {}
- static_assert((__regex_word & ~(std::make_unsigned<mask>::type)(space | print | cntrl | upper | lower | alpha |
- digit | punct | xdigit | blank)) == __regex_word,
- "__regex_word can't overlap other bits");
+ static_assert((__regex_word & ~(std::make_unsigned<mask>::type)(space | print | cntrl | upper | lower | alpha |
+ digit | punct | xdigit | blank)) == __regex_word,
+ "__regex_word can't overlap other bits");
};
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS ctype;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype<wchar_t>
- : public locale::facet,
- public ctype_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI ctype<wchar_t> : public locale::facet, public ctype_base {
public:
- typedef wchar_t char_type;
+ typedef wchar_t char_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit ctype(size_t __refs = 0)
- : locale::facet(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit ctype(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- bool is(mask __m, char_type __c) const
- {
- return do_is(__m, __c);
- }
+ _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { return do_is(__m, __c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
- {
- return do_is(__low, __high, __vec);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const {
+ return do_is(__low, __high, __vec);
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
- {
- return do_scan_is(__m, __low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const {
+ return do_scan_is(__m, __low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
- {
- return do_scan_not(__m, __low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const {
+ return do_scan_not(__m, __low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type toupper(char_type __c) const
- {
- return do_toupper(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* toupper(char_type* __low, const char_type* __high) const
- {
- return do_toupper(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const {
+ return do_toupper(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type tolower(char_type __c) const
- {
- return do_tolower(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* tolower(char_type* __low, const char_type* __high) const
- {
- return do_tolower(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const {
+ return do_tolower(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type widen(char __c) const
- {
- return do_widen(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char* widen(const char* __low, const char* __high, char_type* __to) const
- {
- return do_widen(__low, __high, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const {
+ return do_widen(__low, __high, __to);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char narrow(char_type __c, char __dfault) const
- {
- return do_narrow(__c, __dfault);
- }
+ _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
- {
- return do_narrow(__low, __high, __dfault, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type*
+ narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const {
+ return do_narrow(__low, __high, __dfault, __to);
+ }
- static locale::id id;
+ static locale::id id;
protected:
- ~ctype() override;
- virtual bool do_is(mask __m, char_type __c) const;
- virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
- virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
- virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
- virtual char_type do_toupper(char_type) const;
- virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
- virtual char_type do_tolower(char_type) const;
- virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
- virtual char_type do_widen(char) const;
- virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
- virtual char do_narrow(char_type, char __dfault) const;
- virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
+ ~ctype() override;
+ virtual bool do_is(mask __m, char_type __c) const;
+ virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
+ virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
+ virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
+ virtual char_type do_toupper(char_type) const;
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+ virtual char_type do_tolower(char_type) const;
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+ virtual char_type do_widen(char) const;
+ virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
+ virtual char do_narrow(char_type, char __dfault) const;
+ virtual const char_type*
+ do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype<char>
- : public locale::facet, public ctype_base
-{
- const mask* __tab_;
- bool __del_;
+class _LIBCPP_EXPORTED_FROM_ABI ctype<char> : public locale::facet, public ctype_base {
+ const mask* __tab_;
+ bool __del_;
+
public:
- typedef char char_type;
+ typedef char char_type;
- explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
+ explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
- _LIBCPP_HIDE_FROM_ABI
- bool is(mask __m, char_type __c) const
- {
- return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
- }
+ _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const {
+ return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) != 0 : false;
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
- {
- for (; __low != __high; ++__low, ++__vec)
- *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
- return __low;
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const {
+ for (; __low != __high; ++__low, ++__vec)
+ *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
+ return __low;
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
- {
- for (; __low != __high; ++__low)
- if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
- break;
- return __low;
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const {
+ for (; __low != __high; ++__low)
+ if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
+ break;
+ return __low;
+ }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
- {
- for (; __low != __high; ++__low)
- if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m))
- break;
- return __low;
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const {
+ for (; __low != __high; ++__low)
+ if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m))
+ break;
+ return __low;
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type toupper(char_type __c) const
- {
- return do_toupper(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* toupper(char_type* __low, const char_type* __high) const
- {
- return do_toupper(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const {
+ return do_toupper(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type tolower(char_type __c) const
- {
- return do_tolower(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char_type* tolower(char_type* __low, const char_type* __high) const
- {
- return do_tolower(__low, __high);
- }
+ _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const {
+ return do_tolower(__low, __high);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char_type widen(char __c) const
- {
- return do_widen(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
- _LIBCPP_HIDE_FROM_ABI
- const char* widen(const char* __low, const char* __high, char_type* __to) const
- {
- return do_widen(__low, __high, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const {
+ return do_widen(__low, __high, __to);
+ }
- _LIBCPP_HIDE_FROM_ABI
- char narrow(char_type __c, char __dfault) const
- {
- return do_narrow(__c, __dfault);
- }
+ _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); }
- _LIBCPP_HIDE_FROM_ABI
- const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
- {
- return do_narrow(__low, __high, __dfault, __to);
- }
+ _LIBCPP_HIDE_FROM_ABI const char*
+ narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const {
+ return do_narrow(__low, __high, __dfault, __to);
+ }
- static locale::id id;
+ static locale::id id;
#ifdef _CACHED_RUNES
- static const size_t table_size = _CACHED_RUNES;
+ static const size_t table_size = _CACHED_RUNES;
#else
- static const size_t table_size = 256; // FIXME: Don't hardcode this.
+ static const size_t table_size = 256; // FIXME: Don't hardcode this.
#endif
- _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT {return __tab_;}
- static const mask* classic_table() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; }
+ static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
- static const int* __classic_upper_table() _NOEXCEPT;
- static const int* __classic_lower_table() _NOEXCEPT;
+ static const int* __classic_upper_table() _NOEXCEPT;
+ static const int* __classic_lower_table() _NOEXCEPT;
#endif
#if defined(__NetBSD__)
- static const short* __classic_upper_table() _NOEXCEPT;
- static const short* __classic_lower_table() _NOEXCEPT;
+ static const short* __classic_upper_table() _NOEXCEPT;
+ static const short* __classic_lower_table() _NOEXCEPT;
#endif
#if defined(__MVS__)
- static const unsigned short* __classic_upper_table() _NOEXCEPT;
- static const unsigned short* __classic_lower_table() _NOEXCEPT;
+ static const unsigned short* __classic_upper_table() _NOEXCEPT;
+ static const unsigned short* __classic_lower_table() _NOEXCEPT;
#endif
protected:
- ~ctype() override;
- virtual char_type do_toupper(char_type __c) const;
- virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
- virtual char_type do_tolower(char_type __c) const;
- virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
- virtual char_type do_widen(char __c) const;
- virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
- virtual char do_narrow(char_type __c, char __dfault) const;
- virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
+ ~ctype() override;
+ virtual char_type do_toupper(char_type __c) const;
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
+ virtual char_type do_tolower(char_type __c) const;
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
+ virtual char_type do_widen(char __c) const;
+ virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
+ virtual char do_narrow(char_type __c, char __dfault) const;
+ virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
};
// template <class CharT> class ctype_byname;
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype_byname;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS ctype_byname;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<char>
- : public ctype<char>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<char> : public ctype<char> {
+ locale_t __l_;
public:
- explicit ctype_byname(const char*, size_t = 0);
- explicit ctype_byname(const string&, size_t = 0);
+ explicit ctype_byname(const char*, size_t = 0);
+ explicit ctype_byname(const string&, size_t = 0);
protected:
- ~ctype_byname() override;
- char_type do_toupper(char_type) const override;
- const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
- char_type do_tolower(char_type) const override;
- const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
+ ~ctype_byname() override;
+ char_type do_toupper(char_type) const override;
+ const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
+ char_type do_tolower(char_type) const override;
+ const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<wchar_t>
- : public ctype<wchar_t>
-{
- locale_t __l_;
+class _LIBCPP_EXPORTED_FROM_ABI ctype_byname<wchar_t> : public ctype<wchar_t> {
+ locale_t __l_;
public:
- explicit ctype_byname(const char*, size_t = 0);
- explicit ctype_byname(const string&, size_t = 0);
+ explicit ctype_byname(const char*, size_t = 0);
+ explicit ctype_byname(const string&, size_t = 0);
protected:
- ~ctype_byname() override;
- bool do_is(mask __m, char_type __c) const override;
- const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override;
- const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override;
- const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override;
- char_type do_toupper(char_type) const override;
- const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
- char_type do_tolower(char_type) const override;
- const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
- char_type do_widen(char) const override;
- const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override;
- char do_narrow(char_type, char __dfault) const override;
- const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override;
+ ~ctype_byname() override;
+ bool do_is(mask __m, char_type __c) const override;
+ const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override;
+ const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override;
+ const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override;
+ char_type do_toupper(char_type) const override;
+ const char_type* do_toupper(char_type* __low, const char_type* __high) const override;
+ char_type do_tolower(char_type) const override;
+ const char_type* do_tolower(char_type* __low, const char_type* __high) const override;
+ char_type do_widen(char) const override;
+ const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override;
+ char do_narrow(char_type, char __dfault) const override;
+ const char_type*
+ do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isspace(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isprint(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isprint(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-iscntrl(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool iscntrl(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isupper(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isupper(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-islower(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool islower(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isalpha(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isalpha(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isdigit(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isdigit(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ispunct(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool ispunct(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isxdigit(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isxdigit(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isalnum(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isalnum(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-isgraph(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
+inline _LIBCPP_HIDE_FROM_ABI bool isgraph(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
}
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) {
- return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-toupper(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).toupper(__c);
+inline _LIBCPP_HIDE_FROM_ABI _CharT toupper(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).toupper(__c);
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-tolower(_CharT __c, const locale& __loc)
-{
- return std::use_facet<ctype<_CharT> >(__loc).tolower(__c);
+inline _LIBCPP_HIDE_FROM_ABI _CharT tolower(_CharT __c, const locale& __loc) {
+ return std::use_facet<ctype<_CharT> >(__loc).tolower(__c);
}
// codecvt_base
-class _LIBCPP_EXPORTED_FROM_ABI codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt_base {
public:
- _LIBCPP_HIDE_FROM_ABI codecvt_base() {}
- enum result {ok, partial, error, noconv};
+ _LIBCPP_HIDE_FROM_ABI codecvt_base() {}
+ enum result { ok, partial, error, noconv };
};
// template <class internT, class externT, class stateT> class codecvt;
-template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TEMPLATE_VIS codecvt;
+template <class _InternT, class _ExternT, class _StateT>
+class _LIBCPP_TEMPLATE_VIS codecvt;
// template <> class codecvt<char, char, mbstate_t>
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<char, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<char, char, mbstate_t> : public locale::facet, public codecvt_base {
public:
- typedef char intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
// template <> class codecvt<wchar_t, char, mbstate_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<wchar_t, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
- locale_t __l_;
-public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- explicit codecvt(size_t __refs = 0);
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<wchar_t, char, mbstate_t> : public locale::facet, public codecvt_base {
+ locale_t __l_;
- static locale::id id;
+public:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0);
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- explicit codecvt(const char*, size_t __refs = 0);
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ explicit codecvt(const char*, size_t __refs = 0);
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -1087,86 +924,80 @@ protected:
template <>
class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+ : public locale::facet, public codecvt_base {
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
@@ -1174,87 +1005,80 @@ protected:
// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base {
public:
- typedef char16_t intern_type;
- typedef char8_t extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char16_t intern_type;
+ typedef char8_t extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#endif
@@ -1263,86 +1087,80 @@ protected:
template <>
class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+ : public locale::facet, public codecvt_base {
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
@@ -1350,87 +1168,80 @@ protected:
// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
template <>
-class _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t>
- : public locale::facet,
- public codecvt_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base {
public:
- typedef char32_t intern_type;
- typedef char8_t extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
- {
- return do_unshift(__st, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
- {
- return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int encoding() const _NOEXCEPT
- {
- return do_encoding();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool always_noconv() const _NOEXCEPT
- {
- return do_always_noconv();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
- {
- return do_length(__st, __frm, __end, __mx);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- int max_length() const _NOEXCEPT
- {
- return do_max_length();
- }
-
- static locale::id id;
+ typedef char32_t intern_type;
+ typedef char8_t extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI result
+ out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const {
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const {
+ return do_unshift(__st, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result
+ in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const {
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
+
+ _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
+
+ _LIBCPP_HIDE_FROM_ABI int
+ length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
+ return do_length(__st, __frm, __end, __mx);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt(const char*, size_t __refs = 0)
- : locale::facet(__refs) {}
-
- ~codecvt() override;
-
- virtual result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
- virtual result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
- virtual int do_encoding() const _NOEXCEPT;
- virtual bool do_always_noconv() const _NOEXCEPT;
- virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
- virtual int do_max_length() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {}
+
+ ~codecvt() override;
+
+ virtual result
+ do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const;
+ virtual result
+ do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const;
+ virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
+ virtual int do_encoding() const _NOEXCEPT;
+ virtual bool do_always_noconv() const _NOEXCEPT;
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
+ virtual int do_max_length() const _NOEXCEPT;
};
#endif
@@ -1438,333 +1249,280 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
-class _LIBCPP_TEMPLATE_VIS codecvt_byname
- : public codecvt<_InternT, _ExternT, _StateT>
-{
+class _LIBCPP_TEMPLATE_VIS codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_byname(const char* __nm, size_t __refs = 0)
- : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_byname(const string& __nm, size_t __refs = 0)
- : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_byname(const char* __nm, size_t __refs = 0)
+ : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_byname(const string& __nm, size_t __refs = 0)
+ : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
+
protected:
- ~codecvt_byname() override;
+ ~codecvt_byname() override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _InternT, class _ExternT, class _StateT>
-codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
-{
-}
+codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>;
#endif
-extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // deprecated in C++20
-extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20
+extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
+ codecvt_byname<char16_t, char, mbstate_t>; // deprecated in C++20
+extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
+ codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20
#ifndef _LIBCPP_HAS_NO_CHAR8_T
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20
#endif
template <size_t _Np>
-struct __narrow_to_utf8
-{
- template <class _OutputIterator, class _CharT>
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
+struct __narrow_to_utf8 {
+ template <class _OutputIterator, class _CharT>
+ _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
};
template <>
-struct __narrow_to_utf8<8>
-{
- template <class _OutputIterator, class _CharT>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
- {
- for (; __wb < __we; ++__wb, ++__s)
- *__s = *__wb;
- return __s;
- }
+struct __narrow_to_utf8<8> {
+ template <class _OutputIterator, class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const {
+ for (; __wb < __we; ++__wb, ++__s)
+ *__s = *__wb;
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<16>
- : public codecvt<char16_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__narrow_to_utf8() override;
-
- template <class _OutputIterator, class _CharT>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__wb < __we && __r != error)
- {
- const int __sz = 32;
- char __buf[__sz];
- char* __bn;
- const char16_t* __wn = (const char16_t*)__wb;
- __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
- __throw_runtime_error("locale not supported");
- for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __wb = (const _CharT*)__wn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<16> : public codecvt<char16_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__narrow_to_utf8() override;
+
+ template <class _OutputIterator, class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__wb < __we && __r != error) {
+ const int __sz = 32;
+ char __buf[__sz];
+ char* __bn;
+ const char16_t* __wn = (const char16_t*)__wb;
+ __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
+ __throw_runtime_error("locale not supported");
+ for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __wb = (const _CharT*)__wn;
+ }
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<32>
- : public codecvt<char32_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__narrow_to_utf8() override;
-
- template <class _OutputIterator, class _CharT>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__wb < __we && __r != error)
- {
- const int __sz = 32;
- char __buf[__sz];
- char* __bn;
- const char32_t* __wn = (const char32_t*)__wb;
- __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
- __throw_runtime_error("locale not supported");
- for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __wb = (const _CharT*)__wn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<32> : public codecvt<char32_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__narrow_to_utf8() override;
+
+ template <class _OutputIterator, class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__wb < __we && __r != error) {
+ const int __sz = 32;
+ char __buf[__sz];
+ char* __bn;
+ const char32_t* __wn = (const char32_t*)__wb;
+ __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
+ __throw_runtime_error("locale not supported");
+ for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __wb = (const _CharT*)__wn;
+ }
+ return __s;
+ }
};
template <size_t _Np>
-struct __widen_from_utf8
-{
- template <class _OutputIterator>
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
+struct __widen_from_utf8 {
+ template <class _OutputIterator>
+ _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
};
template <>
-struct __widen_from_utf8<8>
-{
- template <class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
- {
- for (; __nb < __ne; ++__nb, ++__s)
- *__s = *__nb;
- return __s;
- }
+struct __widen_from_utf8<8> {
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const {
+ for (; __nb < __ne; ++__nb, ++__s)
+ *__s = *__nb;
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<16>
- : public codecvt<char16_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__widen_from_utf8() override;
-
- template <class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__nb < __ne && __r != error)
- {
- const int __sz = 32;
- char16_t __buf[__sz];
- char16_t* __bn;
- const char* __nn = __nb;
- __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __nn == __nb)
- __throw_runtime_error("locale not supported");
- for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __nb = __nn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<16> : public codecvt<char16_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__widen_from_utf8() override;
+
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__nb < __ne && __r != error) {
+ const int __sz = 32;
+ char16_t __buf[__sz];
+ char16_t* __bn;
+ const char* __nn = __nb;
+ __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __nn == __nb)
+ __throw_runtime_error("locale not supported");
+ for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __nb = __nn;
+ }
+ return __s;
+ }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32>
- : public codecvt<char32_t, char, mbstate_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
- ~__widen_from_utf8() override;
-
- template <class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIterator
- operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
- {
- result __r = ok;
- mbstate_t __mb;
- while (__nb < __ne && __r != error)
- {
- const int __sz = 32;
- char32_t __buf[__sz];
- char32_t* __bn;
- const char* __nn = __nb;
- __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
- __buf, __buf+__sz, __bn);
- if (__r == codecvt_base::error || __nn == __nb)
- __throw_runtime_error("locale not supported");
- for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = *__p;
- __nb = __nn;
- }
- return __s;
- }
+struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32> : public codecvt<char32_t, char, mbstate_t> {
+ _LIBCPP_HIDE_FROM_ABI __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
+ ~__widen_from_utf8() override;
+
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const {
+ result __r = ok;
+ mbstate_t __mb;
+ while (__nb < __ne && __r != error) {
+ const int __sz = 32;
+ char32_t __buf[__sz];
+ char32_t* __bn;
+ const char* __nn = __nb;
+ __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
+ if (__r == codecvt_base::error || __nn == __nb)
+ __throw_runtime_error("locale not supported");
+ for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
+ *__s = *__p;
+ __nb = __nn;
+ }
+ return __s;
+ }
};
// template <class charT> class numpunct
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS numpunct;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct<char>
- : public locale::facet
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct<char> : public locale::facet {
public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct(size_t __refs = 0);
+ explicit numpunct(size_t __refs = 0);
- _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const {return do_decimal_point();}
- _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const {return do_thousands_sep();}
- _LIBCPP_HIDE_FROM_ABI string grouping() const {return do_grouping();}
- _LIBCPP_HIDE_FROM_ABI string_type truename() const {return do_truename();}
- _LIBCPP_HIDE_FROM_ABI string_type falsename() const {return do_falsename();}
+ _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
+ _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
- static locale::id id;
+ static locale::id id;
protected:
- ~numpunct() override;
- virtual char_type do_decimal_point() const;
- virtual char_type do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual string_type do_truename() const;
- virtual string_type do_falsename() const;
-
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
+ ~numpunct() override;
+ virtual char_type do_decimal_point() const;
+ virtual char_type do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string_type do_truename() const;
+ virtual string_type do_falsename() const;
+
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t>
- : public locale::facet
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct(size_t __refs = 0);
+ explicit numpunct(size_t __refs = 0);
- _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const {return do_decimal_point();}
- _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const {return do_thousands_sep();}
- _LIBCPP_HIDE_FROM_ABI string grouping() const {return do_grouping();}
- _LIBCPP_HIDE_FROM_ABI string_type truename() const {return do_truename();}
- _LIBCPP_HIDE_FROM_ABI string_type falsename() const {return do_falsename();}
+ _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
+ _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
- static locale::id id;
+ static locale::id id;
protected:
- ~numpunct() override;
- virtual char_type do_decimal_point() const;
- virtual char_type do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual string_type do_truename() const;
- virtual string_type do_falsename() const;
-
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
+ ~numpunct() override;
+ virtual char_type do_decimal_point() const;
+ virtual char_type do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string_type do_truename() const;
+ virtual string_type do_falsename() const;
+
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// template <class charT> class numpunct_byname
-template <class _CharT> class _LIBCPP_TEMPLATE_VIS numpunct_byname;
+template <class _CharT>
+class _LIBCPP_TEMPLATE_VIS numpunct_byname;
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char>
-: public numpunct<char>
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char> : public numpunct<char> {
public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct_byname(const char* __nm, size_t __refs = 0);
- explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
protected:
- ~numpunct_byname() override;
+ ~numpunct_byname() override;
private:
- void __init(const char*);
+ void __init(const char*);
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t>
-: public numpunct<wchar_t>
-{
+class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
- explicit numpunct_byname(const char* __nm, size_t __refs = 0);
- explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
protected:
- ~numpunct_byname() override;
+ ~numpunct_byname() override;
private:
- void __init(const char*);
+ void __init(const char*);
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
diff --git a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
index 38d36f0aa8fc..1f9607209842 100644
--- a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
+++ b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
@@ -18,19 +18,19 @@
# pragma GCC system_header
#endif
-#define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc)
-#define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc)
-#define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc)
-#define __libcpp_wcsnrtombs_l(dst, src, nwc, len, ps, loc) wcsnrtombs_l(dst, src, nwc, len, ps, loc)
-#define __libcpp_wcrtomb_l(src, wc, ps, loc) wcrtomb_l(src, wc, ps, loc)
-#define __libcpp_mbsnrtowcs_l(dst, src, nms, len, ps, loc) mbsnrtowcs_l(dst, src, nms, len, ps, loc)
-#define __libcpp_mbrtowc_l(pwc, s, n, ps, l) mbrtowc_l(pwc, s, n, ps, l)
-#define __libcpp_mbtowc_l(pwc, pmb, max, l) mbtowc_l(pwc, pmb, max, l)
-#define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l)
-#define __libcpp_localeconv_l(l) localeconv_l(l)
-#define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l)
-#define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__)
-#define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__)
-#define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__)
+#define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc)
+#define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc)
+#define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc)
+#define __libcpp_wcsnrtombs_l(dst, src, nwc, len, ps, loc) wcsnrtombs_l(dst, src, nwc, len, ps, loc)
+#define __libcpp_wcrtomb_l(src, wc, ps, loc) wcrtomb_l(src, wc, ps, loc)
+#define __libcpp_mbsnrtowcs_l(dst, src, nms, len, ps, loc) mbsnrtowcs_l(dst, src, nms, len, ps, loc)
+#define __libcpp_mbrtowc_l(pwc, s, n, ps, l) mbrtowc_l(pwc, s, n, ps, l)
+#define __libcpp_mbtowc_l(pwc, pmb, max, l) mbtowc_l(pwc, pmb, max, l)
+#define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l)
+#define __libcpp_localeconv_l(l) localeconv_l(l)
+#define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l)
+#define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__)
+#define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__)
+#define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__)
#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_DEFAULTS_H
diff --git a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
index 575a942125d4..76b94287cd6c 100644
--- a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
+++ b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
@@ -28,119 +28,97 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI
-decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return MB_CUR_MAX;
+inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return MB_CUR_MAX;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline _LIBCPP_HIDE_FROM_ABI
-wint_t __libcpp_btowc_l(int __c, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return btowc(__c);
+inline _LIBCPP_HIDE_FROM_ABI wint_t __libcpp_btowc_l(int __c, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return btowc(__c);
}
-inline _LIBCPP_HIDE_FROM_ABI
-int __libcpp_wctob_l(wint_t __c, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return wctob(__c);
+inline _LIBCPP_HIDE_FROM_ABI int __libcpp_wctob_l(wint_t __c, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return wctob(__c);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
- size_t __len, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_wcsnrtombs_l(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return wcrtomb(__s, __wc, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_wcrtomb_l(char* __s, wchar_t __wc, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return wcrtomb(__s, __wc, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
- size_t __len, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_mbsnrtowcs_l(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
- mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbrtowc(__pwc, __s, __n, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_mbrtowc_l(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbrtowc(__pwc, __s, __n, __ps);
}
-inline _LIBCPP_HIDE_FROM_ABI
-int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbtowc(__pwc, __pmb, __max);
+inline _LIBCPP_HIDE_FROM_ABI int __libcpp_mbtowc_l(wchar_t* __pwc, const char* __pmb, size_t __max, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbtowc(__pwc, __pmb, __max);
}
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbrlen(__s, __n, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_mbrlen_l(const char* __s, size_t __n, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbrlen(__s, __n, __ps);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline _LIBCPP_HIDE_FROM_ABI
-lconv *__libcpp_localeconv_l(locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return localeconv();
+inline _LIBCPP_HIDE_FROM_ABI lconv* __libcpp_localeconv_l(locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return localeconv();
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
- mbstate_t *__ps, locale_t __l)
-{
- __libcpp_locale_guard __current(__l);
- return mbsrtowcs(__dest, __src, __len, __ps);
+inline _LIBCPP_HIDE_FROM_ABI size_t
+__libcpp_mbsrtowcs_l(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, locale_t __l) {
+ __libcpp_locale_guard __current(__l);
+ return mbsrtowcs(__dest, __src, __len, __ps);
}
#endif
-inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5)
-int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- __libcpp_locale_guard __current(__l);
- int __res = vsnprintf(__s, __n, __format, __va);
- va_end(__va);
- return __res;
+inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __libcpp_snprintf_l(
+ char* __s, size_t __n, locale_t __l, const char* __format, ...) {
+ va_list __va;
+ va_start(__va, __format);
+ __libcpp_locale_guard __current(__l);
+ int __res = vsnprintf(__s, __n, __format, __va);
+ va_end(__va);
+ return __res;
}
-inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4)
-int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- __libcpp_locale_guard __current(__l);
- int __res = vasprintf(__s, __format, __va);
- va_end(__va);
- return __res;
+inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __libcpp_asprintf_l(
+ char** __s, locale_t __l, const char* __format, ...) {
+ va_list __va;
+ va_start(__va, __format);
+ __libcpp_locale_guard __current(__l);
+ int __res = vasprintf(__s, __format, __va);
+ va_end(__va);
+ return __res;
}
-inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4)
-int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- __libcpp_locale_guard __current(__l);
- int __res = vsscanf(__s, __format, __va);
- va_end(__va);
- return __res;
+inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __libcpp_sscanf_l(
+ const char* __s, locale_t __l, const char* __format, ...) {
+ va_list __va;
+ va_start(__va, __format);
+ __libcpp_locale_guard __current(__l);
+ int __res = vsscanf(__s, __format, __va);
+ va_end(__va);
+ return __res;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
index efe674b5e7b3..b7e3be756e71 100644
--- a/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
+++ b/contrib/llvm-project/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
@@ -36,42 +36,41 @@ private:
};
#elif defined(_LIBCPP_MSVCRT_LIKE)
struct __libcpp_locale_guard {
- __libcpp_locale_guard(locale_t __l) :
- __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
- // Setting the locale can be expensive even when the locale given is
- // already the current locale, so do an explicit check to see if the
- // current locale is already the one we want.
- const char* __lc = __setlocale(nullptr);
- // If every category is the same, the locale string will simply be the
- // locale name, otherwise it will be a semicolon-separated string listing
- // each category. In the second case, we know at least one category won't
- // be what we want, so we only have to check the first case.
- if (std::strcmp(__l.__get_locale(), __lc) != 0) {
- __locale_all = _strdup(__lc);
- if (__locale_all == nullptr)
- __throw_bad_alloc();
- __setlocale(__l.__get_locale());
- }
- }
- ~__libcpp_locale_guard() {
- // The CRT documentation doesn't explicitly say, but setlocale() does the
- // right thing when given a semicolon-separated list of locale settings
- // for the different categories in the same format as returned by
- // setlocale(LC_ALL, nullptr).
- if (__locale_all != nullptr) {
- __setlocale(__locale_all);
- free(__locale_all);
- }
- _configthreadlocale(__status);
- }
- static const char* __setlocale(const char* __locale) {
- const char* __new_locale = setlocale(LC_ALL, __locale);
- if (__new_locale == nullptr)
+ __libcpp_locale_guard(locale_t __l) : __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
+ // Setting the locale can be expensive even when the locale given is
+ // already the current locale, so do an explicit check to see if the
+ // current locale is already the one we want.
+ const char* __lc = __setlocale(nullptr);
+ // If every category is the same, the locale string will simply be the
+ // locale name, otherwise it will be a semicolon-separated string listing
+ // each category. In the second case, we know at least one category won't
+ // be what we want, so we only have to check the first case.
+ if (std::strcmp(__l.__get_locale(), __lc) != 0) {
+ __locale_all = _strdup(__lc);
+ if (__locale_all == nullptr)
__throw_bad_alloc();
- return __new_locale;
+ __setlocale(__l.__get_locale());
+ }
+ }
+ ~__libcpp_locale_guard() {
+ // The CRT documentation doesn't explicitly say, but setlocale() does the
+ // right thing when given a semicolon-separated list of locale settings
+ // for the different categories in the same format as returned by
+ // setlocale(LC_ALL, nullptr).
+ if (__locale_all != nullptr) {
+ __setlocale(__locale_all);
+ free(__locale_all);
}
- int __status;
- char* __locale_all = nullptr;
+ _configthreadlocale(__status);
+ }
+ static const char* __setlocale(const char* __locale) {
+ const char* __new_locale = setlocale(LC_ALL, __locale);
+ if (__new_locale == nullptr)
+ __throw_bad_alloc();
+ return __new_locale;
+ }
+ int __status;
+ char* __locale_all = nullptr;
};
#endif
diff --git a/contrib/llvm-project/libcxx/include/__mbstate_t.h b/contrib/llvm-project/libcxx/include/__mbstate_t.h
index 2b9e719b1f2e..bfa6d617e2b8 100644
--- a/contrib/llvm-project/libcxx/include/__mbstate_t.h
+++ b/contrib/llvm-project/libcxx/include/__mbstate_t.h
@@ -36,19 +36,19 @@
#endif
#if defined(_LIBCPP_HAS_MUSL_LIBC)
-# define __NEED_mbstate_t
-# include <bits/alltypes.h>
-# undef __NEED_mbstate_t
+# define __NEED_mbstate_t
+# include <bits/alltypes.h>
+# undef __NEED_mbstate_t
#elif __has_include(<bits/types/mbstate_t.h>)
-# include <bits/types/mbstate_t.h> // works on most Unixes
+# include <bits/types/mbstate_t.h> // works on most Unixes
#elif __has_include(<sys/_types/_mbstate_t.h>)
-# include <sys/_types/_mbstate_t.h> // works on Darwin
+# include <sys/_types/_mbstate_t.h> // works on Darwin
#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
-# include_next <wchar.h> // fall back to the C standard provider of mbstate_t
+# include_next <wchar.h> // fall back to the C standard provider of mbstate_t
#elif __has_include_next(<uchar.h>)
-# include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible
+# include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible
#else
-# error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
+# error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
#endif
#endif // _LIBCPP___MBSTATE_T_H
diff --git a/contrib/llvm-project/libcxx/include/__memory/addressof.h b/contrib/llvm-project/libcxx/include/__memory/addressof.h
index 7cb2065038a7..fa590212c49b 100644
--- a/contrib/llvm-project/libcxx/include/__memory/addressof.h
+++ b/contrib/llvm-project/libcxx/include/__memory/addressof.h
@@ -19,12 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-_LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI
-_Tp*
-addressof(_Tp& __x) _NOEXCEPT
-{
- return __builtin_addressof(__x);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp* addressof(_Tp& __x) _NOEXCEPT {
+ return __builtin_addressof(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
@@ -33,42 +29,31 @@ addressof(_Tp& __x) _NOEXCEPT
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__strong _Tp*
-addressof(__strong _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEPT {
return &__x;
}
-#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
+# ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__weak _Tp*
-addressof(__weak _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT {
return &__x;
}
-#endif
+# endif
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__autoreleasing _Tp*
-addressof(__autoreleasing _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) _NOEXCEPT {
return &__x;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-__unsafe_unretained _Tp*
-addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT {
return &__x;
}
#endif
#if !defined(_LIBCPP_CXX03_LANG)
-template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
+template <class _Tp>
+_Tp* addressof(const _Tp&&) noexcept = delete;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h b/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h
index 786963c72dfc..cb424328bcaf 100644
--- a/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h
+++ b/contrib/llvm-project/libcxx/include/__memory/aligned_alloc.h
@@ -27,36 +27,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// chances are that you want to use `__libcpp_allocate` instead.
//
// Returns the allocated memory, or `nullptr` on failure.
-inline _LIBCPP_HIDE_FROM_ABI
-void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
+inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
# if defined(_LIBCPP_MSVCRT_LIKE)
- return ::_aligned_malloc(__size, __alignment);
+ return ::_aligned_malloc(__size, __alignment);
# elif _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC)
- // aligned_alloc() requires that __size is a multiple of __alignment,
- // but for C++ [new.delete.general], only states "if the value of an
- // alignment argument passed to any of these functions is not a valid
- // alignment value, the behavior is undefined".
- // To handle calls such as ::operator new(1, std::align_val_t(128)), we
- // round __size up to the next multiple of __alignment.
- size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1);
- // Rounding up could have wrapped around to zero, so we have to add another
- // max() ternary to the actual call site to avoid succeeded in that case.
- return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size);
+ // aligned_alloc() requires that __size is a multiple of __alignment,
+ // but for C++ [new.delete.general], only states "if the value of an
+ // alignment argument passed to any of these functions is not a valid
+ // alignment value, the behavior is undefined".
+ // To handle calls such as ::operator new(1, std::align_val_t(128)), we
+ // round __size up to the next multiple of __alignment.
+ size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1);
+ // Rounding up could have wrapped around to zero, so we have to add another
+ // max() ternary to the actual call site to avoid succeeded in that case.
+ return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size);
# else
- void* __result = nullptr;
- (void)::posix_memalign(&__result, __alignment, __size);
- // If posix_memalign fails, __result is unmodified so we still return `nullptr`.
- return __result;
+ void* __result = nullptr;
+ (void)::posix_memalign(&__result, __alignment, __size);
+ // If posix_memalign fails, __result is unmodified so we still return `nullptr`.
+ return __result;
# endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_aligned_free(void* __ptr) {
-#if defined(_LIBCPP_MSVCRT_LIKE)
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_aligned_free(void* __ptr) {
+# if defined(_LIBCPP_MSVCRT_LIKE)
::_aligned_free(__ptr);
-#else
+# else
::free(__ptr);
-#endif
+# endif
}
#endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h b/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h
index 8d8ad071e2c2..05cbdee82883 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h
@@ -28,8 +28,8 @@ struct allocation_result {
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result);
template <class _Alloc>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
-allocation_result<typename allocator_traits<_Alloc>::pointer> allocate_at_least(_Alloc& __alloc, size_t __n) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<typename allocator_traits<_Alloc>::pointer>
+allocate_at_least(_Alloc& __alloc, size_t __n) {
if constexpr (requires { __alloc.allocate_at_least(__n); }) {
return __alloc.allocate_at_least(__n);
} else {
@@ -38,8 +38,7 @@ allocation_result<typename allocator_traits<_Alloc>::pointer> allocate_at_least(
}
template <class _Alloc>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
-auto __allocate_at_least(_Alloc& __alloc, size_t __n) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __allocate_at_least(_Alloc& __alloc, size_t __n) {
return std::allocate_at_least(__alloc, __n);
}
#else
@@ -51,7 +50,8 @@ struct __allocation_result {
template <class _Alloc>
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__allocation_result<typename allocator_traits<_Alloc>::pointer> __allocate_at_least(_Alloc& __alloc, size_t __n) {
+ __allocation_result<typename allocator_traits<_Alloc>::pointer>
+ __allocate_at_least(_Alloc& __alloc, size_t __n) {
return {__alloc.allocate(__n), __n};
}
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h b/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h
index c36ce15397c0..cb870af7be67 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h
@@ -44,69 +44,61 @@ _LIBCPP_BEGIN_NAMESPACE_STD
//
// This is similar to a unique_ptr, except it's easier to use with a
// custom allocator.
-template<class _Alloc>
+template <class _Alloc>
struct __allocation_guard {
- using _Pointer = typename allocator_traits<_Alloc>::pointer;
- using _Size = typename allocator_traits<_Alloc>::size_type;
-
- template<class _AllocT> // we perform the allocator conversion inside the constructor
- _LIBCPP_HIDE_FROM_ABI
- explicit __allocation_guard(_AllocT __alloc, _Size __n)
- : __alloc_(std::move(__alloc))
- , __n_(__n)
- , __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- ~__allocation_guard() _NOEXCEPT {
- __destroy();
- }
-
- _LIBCPP_HIDE_FROM_ABI __allocation_guard(const __allocation_guard&) = delete;
- _LIBCPP_HIDE_FROM_ABI __allocation_guard(__allocation_guard&& __other) _NOEXCEPT
- : __alloc_(std::move(__other.__alloc_))
- , __n_(__other.__n_)
- , __ptr_(__other.__ptr_) {
+ using _Pointer = typename allocator_traits<_Alloc>::pointer;
+ using _Size = typename allocator_traits<_Alloc>::size_type;
+
+ template <class _AllocT> // we perform the allocator conversion inside the constructor
+ _LIBCPP_HIDE_FROM_ABI explicit __allocation_guard(_AllocT __alloc, _Size __n)
+ : __alloc_(std::move(__alloc)),
+ __n_(__n),
+ __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important
+ {}
+
+ _LIBCPP_HIDE_FROM_ABI ~__allocation_guard() _NOEXCEPT { __destroy(); }
+
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard(const __allocation_guard&) = delete;
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard(__allocation_guard&& __other) _NOEXCEPT
+ : __alloc_(std::move(__other.__alloc_)),
+ __n_(__other.__n_),
+ __ptr_(__other.__ptr_) {
+ __other.__ptr_ = nullptr;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(const __allocation_guard& __other) = delete;
+ _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(__allocation_guard&& __other) _NOEXCEPT {
+ if (std::addressof(__other) != this) {
+ __destroy();
+
+ __alloc_ = std::move(__other.__alloc_);
+ __n_ = __other.__n_;
+ __ptr_ = __other.__ptr_;
__other.__ptr_ = nullptr;
}
- _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(const __allocation_guard& __other) = delete;
- _LIBCPP_HIDE_FROM_ABI __allocation_guard& operator=(__allocation_guard&& __other) _NOEXCEPT {
- if (std::addressof(__other) != this) {
- __destroy();
+ return *this;
+ }
- __alloc_ = std::move(__other.__alloc_);
- __n_ = __other.__n_;
- __ptr_ = __other.__ptr_;
- __other.__ptr_ = nullptr;
- }
-
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _Pointer
+ __release_ptr() _NOEXCEPT { // not called __release() because it's a keyword in objective-c++
+ _Pointer __tmp = __ptr_;
+ __ptr_ = nullptr;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- _Pointer __release_ptr() _NOEXCEPT { // not called __release() because it's a keyword in objective-c++
- _Pointer __tmp = __ptr_;
- __ptr_ = nullptr;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Pointer __get() const _NOEXCEPT {
- return __ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI _Pointer __get() const _NOEXCEPT { return __ptr_; }
private:
- _LIBCPP_HIDE_FROM_ABI
- void __destroy() _NOEXCEPT {
- if (__ptr_ != nullptr) {
- allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_);
- }
+ _LIBCPP_HIDE_FROM_ABI void __destroy() _NOEXCEPT {
+ if (__ptr_ != nullptr) {
+ allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_);
}
+ }
- _Alloc __alloc_;
- _Size __n_;
- _Pointer __ptr_;
+ _Alloc __alloc_;
+ _Size __n_;
+ _Pointer __ptr_;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator.h b/contrib/llvm-project/libcxx/include/__memory/allocator.h
index 7568da799782..747ce30d8fef 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator.h
@@ -28,35 +28,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> class allocator;
+template <class _Tp>
+class allocator;
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION)
// These specializations shouldn't be marked _LIBCPP_DEPRECATED_IN_CXX17.
// Specializing allocator<void> is deprecated, but not using it.
template <>
-class _LIBCPP_TEMPLATE_VIS allocator<void>
-{
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
-public:
- _LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef void value_type;
+class _LIBCPP_TEMPLATE_VIS allocator<void> {
+# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;};
-#endif
+public:
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef void value_type;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+# endif
};
template <>
-class _LIBCPP_TEMPLATE_VIS allocator<const void>
-{
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
-public:
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const void value_type;
+class _LIBCPP_TEMPLATE_VIS allocator<const void> {
+# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;};
-#endif
+public:
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const void value_type;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+# endif
};
#endif
@@ -73,12 +80,11 @@ public:
// By making those __non_trivial_if base classes unique, we work around this problem and
// it is safe to start deriving from __non_trivial_if in existing classes.
template <bool _Cond, class _Unique>
-struct __non_trivial_if { };
+struct __non_trivial_if {};
template <class _Unique>
struct __non_trivial_if<true, _Unique> {
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT { }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT {}
};
// allocator
@@ -87,186 +93,169 @@ struct __non_trivial_if<true, _Unique> {
// allocator<void> trivial in C++20.
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS allocator
- : private __non_trivial_if<!is_void<_Tp>::value, allocator<_Tp> >
-{
- static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if<!is_void<_Tp>::value, allocator<_Tp> > {
+ static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp value_type;
- typedef true_type propagate_on_container_move_assignment;
- typedef true_type is_always_equal;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- allocator(const allocator<_Up>&) _NOEXCEPT { }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- _Tp* allocate(size_t __n) {
- if (__n > allocator_traits<allocator>::max_size(*this))
- __throw_bad_array_new_length();
- if (__libcpp_is_constant_evaluated()) {
- return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
- } else {
- return static_cast<_Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
- }
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp value_type;
+ typedef true_type propagate_on_container_move_assignment;
+ typedef true_type is_always_equal;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
+
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {}
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) {
+ if (__n > allocator_traits<allocator>::max_size(*this))
+ __throw_bad_array_new_length();
+ if (__libcpp_is_constant_evaluated()) {
+ return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
+ } else {
+ return static_cast<_Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
}
+ }
#if _LIBCPP_STD_VER >= 23
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
- allocation_result<_Tp*> allocate_at_least(size_t __n) {
- return {allocate(__n), __n};
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<_Tp*> allocate_at_least(size_t __n) {
+ return {allocate(__n), __n};
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void deallocate(_Tp* __p, size_t __n) _NOEXCEPT {
- if (__libcpp_is_constant_evaluated()) {
- ::operator delete(__p);
- } else {
- std::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(_Tp* __p, size_t __n) _NOEXCEPT {
+ if (__libcpp_is_constant_evaluated()) {
+ ::operator delete(__p);
+ } else {
+ std::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
+ }
- // C++20 Removed members
+ // C++20 Removed members
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
-
- template <class _Up>
- struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
- typedef allocator<_Up> other;
- };
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- pointer address(reference __x) const _NOEXCEPT {
- return std::addressof(__x);
- }
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_pointer address(const_reference __x) const _NOEXCEPT {
- return std::addressof(__x);
- }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17
- _Tp* allocate(size_t __n, const void*) {
- return allocate(__n);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
- return size_type(~0) / sizeof(_Tp);
- }
-
- template <class _Up, class... _Args>
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void construct(_Up* __p, _Args&&... __args) {
- ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void destroy(pointer __p) {
- __p->~_Tp();
- }
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI pointer address(reference __x) const _NOEXCEPT {
+ return std::addressof(__x);
+ }
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT {
+ return std::addressof(__x);
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 _Tp*
+ allocate(size_t __n, const void*) {
+ return allocate(__n);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return size_type(~0) / sizeof(_Tp);
+ }
+
+ template <class _Up, class... _Args>
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) {
+ ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); }
#endif
};
template <class _Tp>
class _LIBCPP_TEMPLATE_VIS allocator<const _Tp>
- : private __non_trivial_if<!is_void<_Tp>::value, allocator<const _Tp> >
-{
- static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+ : private __non_trivial_if<!is_void<_Tp>::value, allocator<const _Tp> > {
+ static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
+
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp value_type;
- typedef true_type propagate_on_container_move_assignment;
- typedef true_type is_always_equal;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- allocator(const allocator<_Up>&) _NOEXCEPT { }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const _Tp* allocate(size_t __n) {
- if (__n > allocator_traits<allocator>::max_size(*this))
- __throw_bad_array_new_length();
- if (__libcpp_is_constant_evaluated()) {
- return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp)));
- } else {
- return static_cast<const _Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
- }
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp value_type;
+ typedef true_type propagate_on_container_move_assignment;
+ typedef true_type is_always_equal;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
+
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {}
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const _Tp* allocate(size_t __n) {
+ if (__n > allocator_traits<allocator>::max_size(*this))
+ __throw_bad_array_new_length();
+ if (__libcpp_is_constant_evaluated()) {
+ return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp)));
+ } else {
+ return static_cast<const _Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
}
+ }
#if _LIBCPP_STD_VER >= 23
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr
- allocation_result<const _Tp*> allocate_at_least(size_t __n) {
- return {allocate(__n), __n};
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<const _Tp*> allocate_at_least(size_t __n) {
+ return {allocate(__n), __n};
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void deallocate(const _Tp* __p, size_t __n) {
- if (__libcpp_is_constant_evaluated()) {
- ::operator delete(const_cast<_Tp*>(__p));
- } else {
- std::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(const _Tp* __p, size_t __n) {
+ if (__libcpp_is_constant_evaluated()) {
+ ::operator delete(const_cast<_Tp*>(__p));
+ } else {
+ std::__libcpp_deallocate((void*)const_cast<_Tp*>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
+ }
- // C++20 Removed members
+ // C++20 Removed members
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
-
- template <class _Up>
- struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
- typedef allocator<_Up> other;
- };
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_pointer address(const_reference __x) const _NOEXCEPT {
- return std::addressof(__x);
- }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17
- const _Tp* allocate(size_t __n, const void*) {
- return allocate(__n);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
- return size_type(~0) / sizeof(_Tp);
- }
-
- template <class _Up, class... _Args>
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void construct(_Up* __p, _Args&&... __args) {
- ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI
- void destroy(pointer __p) {
- __p->~_Tp();
- }
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
+
+ template <class _Up>
+ struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
+ typedef allocator<_Up> other;
+ };
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT {
+ return std::addressof(__x);
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp*
+ allocate(size_t __n, const void*) {
+ return allocate(__n);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return size_type(~0) / sizeof(_Tp);
+ }
+
+ template <class _Up, class... _Args>
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) {
+ ::new ((void*)__p) _Up(std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); }
#endif
};
template <class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {
+ return true;
+}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {
+ return false;
+}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h b/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h
index 09a015acdf11..7e66da740cd4 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h
@@ -23,7 +23,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
+struct _LIBCPP_TEMPLATE_VIS allocator_arg_t {
+ explicit allocator_arg_t() = default;
+};
#if _LIBCPP_STD_VER >= 17
inline constexpr allocator_arg_t allocator_arg = allocator_arg_t();
@@ -35,42 +37,35 @@ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
// allocator construction
-template <class _Tp, class _Alloc, class ..._Args>
-struct __uses_alloc_ctor_imp
-{
- typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc;
- static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
- static const bool __ic =
- is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
- static const int value = __ua ? 2 - __ic : 0;
+template <class _Tp, class _Alloc, class... _Args>
+struct __uses_alloc_ctor_imp {
+ typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc;
+ static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
+ static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+ static const int value = __ua ? 2 - __ic : 0;
};
-template <class _Tp, class _Alloc, class ..._Args>
-struct __uses_alloc_ctor
- : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
- {};
+template <class _Tp, class _Alloc, class... _Args>
+struct __uses_alloc_ctor : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value> {};
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (allocator_arg, __a, std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(allocator_arg, __a, std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)..., __a);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)..., __a);
}
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h b/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h
index ea0ad9bec674..ed3d8918f5fe 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h
@@ -19,22 +19,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Alloc>
-class __allocator_destructor
-{
- typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits;
+class __allocator_destructor {
+ typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits;
+
public:
- typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer;
- typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type;
+ typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer;
+ typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type;
+
private:
- _Alloc& __alloc_;
- size_type __s_;
+ _Alloc& __alloc_;
+ size_type __s_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s)
- _NOEXCEPT
- : __alloc_(__a), __s_(__s) {}
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {__alloc_traits::deallocate(__alloc_, __p, __s_);}
+ _LIBCPP_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s) _NOEXCEPT : __alloc_(__a), __s_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT { __alloc_traits::deallocate(__alloc_, __p, __s_); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h b/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h
index c5db3e896fad..c4482872ea81 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h
@@ -33,318 +33,312 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-#define _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
- template <class _Tp, class = void> struct NAME : false_type { }; \
- template <class _Tp> struct NAME<_Tp, __void_t<typename _Tp:: PROPERTY > > : true_type { }
+#define _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
+ template <class _Tp, class = void> \
+ struct NAME : false_type {}; \
+ template <class _Tp> \
+ struct NAME<_Tp, __void_t<typename _Tp::PROPERTY > > : true_type {}
// __pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer);
-template <class _Tp, class _Alloc,
+template <class _Tp,
+ class _Alloc,
class _RawAlloc = __libcpp_remove_reference_t<_Alloc>,
- bool = __has_pointer<_RawAlloc>::value>
+ bool = __has_pointer<_RawAlloc>::value>
struct __pointer {
- using type _LIBCPP_NODEBUG = typename _RawAlloc::pointer;
+ using type _LIBCPP_NODEBUG = typename _RawAlloc::pointer;
};
template <class _Tp, class _Alloc, class _RawAlloc>
struct __pointer<_Tp, _Alloc, _RawAlloc, false> {
- using type _LIBCPP_NODEBUG = _Tp*;
+ using type _LIBCPP_NODEBUG = _Tp*;
};
// __const_pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_pointer, const_pointer);
-template <class _Tp, class _Ptr, class _Alloc,
- bool = __has_const_pointer<_Alloc>::value>
+template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
struct __const_pointer {
- using type _LIBCPP_NODEBUG = typename _Alloc::const_pointer;
+ using type _LIBCPP_NODEBUG = typename _Alloc::const_pointer;
};
template <class _Tp, class _Ptr, class _Alloc>
struct __const_pointer<_Tp, _Ptr, _Alloc, false> {
#ifdef _LIBCPP_CXX03_LANG
- using type = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
+ using type = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
#else
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
#endif
};
// __void_pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_void_pointer, void_pointer);
-template <class _Ptr, class _Alloc,
- bool = __has_void_pointer<_Alloc>::value>
+template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
struct __void_pointer {
- using type _LIBCPP_NODEBUG = typename _Alloc::void_pointer;
+ using type _LIBCPP_NODEBUG = typename _Alloc::void_pointer;
};
template <class _Ptr, class _Alloc>
struct __void_pointer<_Ptr, _Alloc, false> {
#ifdef _LIBCPP_CXX03_LANG
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>::other;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>::other;
#else
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void>;
#endif
};
// __const_void_pointer
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_void_pointer, const_void_pointer);
-template <class _Ptr, class _Alloc,
- bool = __has_const_void_pointer<_Alloc>::value>
+template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
struct __const_void_pointer {
- using type _LIBCPP_NODEBUG = typename _Alloc::const_void_pointer;
+ using type _LIBCPP_NODEBUG = typename _Alloc::const_void_pointer;
};
template <class _Ptr, class _Alloc>
struct __const_void_pointer<_Ptr, _Alloc, false> {
#ifdef _LIBCPP_CXX03_LANG
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>::other;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>::other;
#else
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void>;
#endif
};
// __size_type
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_size_type, size_type);
template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
-struct __size_type : make_unsigned<_DiffType> { };
+struct __size_type : make_unsigned<_DiffType> {};
template <class _Alloc, class _DiffType>
struct __size_type<_Alloc, _DiffType, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::size_type;
+ using type _LIBCPP_NODEBUG = typename _Alloc::size_type;
};
// __alloc_traits_difference_type
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_alloc_traits_difference_type, difference_type);
template <class _Alloc, class _Ptr, bool = __has_alloc_traits_difference_type<_Alloc>::value>
struct __alloc_traits_difference_type {
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::difference_type;
+ using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::difference_type;
};
template <class _Alloc, class _Ptr>
struct __alloc_traits_difference_type<_Alloc, _Ptr, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::difference_type;
+ using type _LIBCPP_NODEBUG = typename _Alloc::difference_type;
};
// __propagate_on_container_copy_assignment
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_copy_assignment, propagate_on_container_copy_assignment);
template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
-struct __propagate_on_container_copy_assignment : false_type { };
+struct __propagate_on_container_copy_assignment : false_type {};
template <class _Alloc>
struct __propagate_on_container_copy_assignment<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_copy_assignment;
+ using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_copy_assignment;
};
// __propagate_on_container_move_assignment
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_move_assignment, propagate_on_container_move_assignment);
template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
-struct __propagate_on_container_move_assignment : false_type { };
+struct __propagate_on_container_move_assignment : false_type {};
template <class _Alloc>
struct __propagate_on_container_move_assignment<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_move_assignment;
+ using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_move_assignment;
};
// __propagate_on_container_swap
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_swap, propagate_on_container_swap);
template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
-struct __propagate_on_container_swap : false_type { };
+struct __propagate_on_container_swap : false_type {};
template <class _Alloc>
struct __propagate_on_container_swap<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_swap;
+ using type _LIBCPP_NODEBUG = typename _Alloc::propagate_on_container_swap;
};
// __is_always_equal
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_is_always_equal, is_always_equal);
template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
-struct __is_always_equal : is_empty<_Alloc> { };
+struct __is_always_equal : is_empty<_Alloc> {};
template <class _Alloc>
struct __is_always_equal<_Alloc, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc::is_always_equal;
+ using type _LIBCPP_NODEBUG = typename _Alloc::is_always_equal;
};
// __allocator_traits_rebind
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp, class _Up, class = void>
-struct __has_rebind_other : false_type { };
+struct __has_rebind_other : false_type {};
template <class _Tp, class _Up>
-struct __has_rebind_other<_Tp, _Up, __void_t<typename _Tp::template rebind<_Up>::other> > : true_type { };
+struct __has_rebind_other<_Tp, _Up, __void_t<typename _Tp::template rebind<_Up>::other> > : true_type {};
template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
struct __allocator_traits_rebind {
static_assert(__has_rebind_other<_Tp, _Up>::value, "This allocator has to implement rebind");
using type _LIBCPP_NODEBUG = typename _Tp::template rebind<_Up>::other;
};
-template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+template <template <class, class...> class _Alloc, class _Tp, class... _Args, class _Up>
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true> {
- using type _LIBCPP_NODEBUG = typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other;
+ using type _LIBCPP_NODEBUG = typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other;
};
-template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
+template <template <class, class...> class _Alloc, class _Tp, class... _Args, class _Up>
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> {
- using type _LIBCPP_NODEBUG = _Alloc<_Up, _Args...>;
+ using type _LIBCPP_NODEBUG = _Alloc<_Up, _Args...>;
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
-template<class _Alloc, class _Tp>
+template <class _Alloc, class _Tp>
using __allocator_traits_rebind_t = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
// __has_allocate_hint
template <class _Alloc, class _SizeType, class _ConstVoidPtr, class = void>
-struct __has_allocate_hint : false_type { };
+struct __has_allocate_hint : false_type {};
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
-struct __has_allocate_hint<_Alloc, _SizeType, _ConstVoidPtr, decltype(
- (void)std::declval<_Alloc>().allocate(std::declval<_SizeType>(), std::declval<_ConstVoidPtr>())
-)> : true_type { };
+struct __has_allocate_hint<
+ _Alloc,
+ _SizeType,
+ _ConstVoidPtr,
+ decltype((void)std::declval<_Alloc>().allocate(std::declval<_SizeType>(), std::declval<_ConstVoidPtr>()))>
+ : true_type {};
// __has_construct
-template <class, class _Alloc, class ..._Args>
-struct __has_construct_impl : false_type { };
+template <class, class _Alloc, class... _Args>
+struct __has_construct_impl : false_type {};
-template <class _Alloc, class ..._Args>
-struct __has_construct_impl<decltype(
- (void)std::declval<_Alloc>().construct(std::declval<_Args>()...)
-), _Alloc, _Args...> : true_type { };
+template <class _Alloc, class... _Args>
+struct __has_construct_impl<decltype((void)std::declval<_Alloc>().construct(std::declval<_Args>()...)),
+ _Alloc,
+ _Args...> : true_type {};
-template <class _Alloc, class ..._Args>
-struct __has_construct : __has_construct_impl<void, _Alloc, _Args...> { };
+template <class _Alloc, class... _Args>
+struct __has_construct : __has_construct_impl<void, _Alloc, _Args...> {};
// __has_destroy
template <class _Alloc, class _Pointer, class = void>
-struct __has_destroy : false_type { };
+struct __has_destroy : false_type {};
template <class _Alloc, class _Pointer>
-struct __has_destroy<_Alloc, _Pointer, decltype(
- (void)std::declval<_Alloc>().destroy(std::declval<_Pointer>())
-)> : true_type { };
+struct __has_destroy<_Alloc, _Pointer, decltype((void)std::declval<_Alloc>().destroy(std::declval<_Pointer>()))>
+ : true_type {};
// __has_max_size
template <class _Alloc, class = void>
-struct __has_max_size : false_type { };
+struct __has_max_size : false_type {};
template <class _Alloc>
-struct __has_max_size<_Alloc, decltype(
- (void)std::declval<_Alloc&>().max_size()
-)> : true_type { };
+struct __has_max_size<_Alloc, decltype((void)std::declval<_Alloc&>().max_size())> : true_type {};
// __has_select_on_container_copy_construction
template <class _Alloc, class = void>
-struct __has_select_on_container_copy_construction : false_type { };
+struct __has_select_on_container_copy_construction : false_type {};
template <class _Alloc>
-struct __has_select_on_container_copy_construction<_Alloc, decltype(
- (void)std::declval<_Alloc>().select_on_container_copy_construction()
-)> : true_type { };
+struct __has_select_on_container_copy_construction<
+ _Alloc,
+ decltype((void)std::declval<_Alloc>().select_on_container_copy_construction())> : true_type {};
_LIBCPP_SUPPRESS_DEPRECATED_POP
template <class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS allocator_traits
-{
- using allocator_type = _Alloc;
- using value_type = typename allocator_type::value_type;
- using pointer = typename __pointer<value_type, allocator_type>::type;
- using const_pointer = typename __const_pointer<value_type, pointer, allocator_type>::type;
- using void_pointer = typename __void_pointer<pointer, allocator_type>::type;
- using const_void_pointer = typename __const_void_pointer<pointer, allocator_type>::type;
- using difference_type = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
- using size_type = typename __size_type<allocator_type, difference_type>::type;
- using propagate_on_container_copy_assignment = typename __propagate_on_container_copy_assignment<allocator_type>::type;
- using propagate_on_container_move_assignment = typename __propagate_on_container_move_assignment<allocator_type>::type;
- using propagate_on_container_swap = typename __propagate_on_container_swap<allocator_type>::type;
- using is_always_equal = typename __is_always_equal<allocator_type>::type;
+struct _LIBCPP_TEMPLATE_VIS allocator_traits {
+ using allocator_type = _Alloc;
+ using value_type = typename allocator_type::value_type;
+ using pointer = typename __pointer<value_type, allocator_type>::type;
+ using const_pointer = typename __const_pointer<value_type, pointer, allocator_type>::type;
+ using void_pointer = typename __void_pointer<pointer, allocator_type>::type;
+ using const_void_pointer = typename __const_void_pointer<pointer, allocator_type>::type;
+ using difference_type = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
+ using size_type = typename __size_type<allocator_type, difference_type>::type;
+ using propagate_on_container_copy_assignment =
+ typename __propagate_on_container_copy_assignment<allocator_type>::type;
+ using propagate_on_container_move_assignment =
+ typename __propagate_on_container_move_assignment<allocator_type>::type;
+ using propagate_on_container_swap = typename __propagate_on_container_swap<allocator_type>::type;
+ using is_always_equal = typename __is_always_equal<allocator_type>::type;
#ifndef _LIBCPP_CXX03_LANG
- template <class _Tp>
- using rebind_alloc = __allocator_traits_rebind_t<allocator_type, _Tp>;
- template <class _Tp>
- using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
+ template <class _Tp>
+ using rebind_alloc = __allocator_traits_rebind_t<allocator_type, _Tp>;
+ template <class _Tp>
+ using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
#else // _LIBCPP_CXX03_LANG
- template <class _Tp>
- struct rebind_alloc {
- using other = __allocator_traits_rebind_t<allocator_type, _Tp>;
- };
- template <class _Tp>
- struct rebind_traits {
- using other = allocator_traits<typename rebind_alloc<_Tp>::other>;
- };
+ template <class _Tp>
+ struct rebind_alloc {
+ using other = __allocator_traits_rebind_t<allocator_type, _Tp>;
+ };
+ template <class _Tp>
+ struct rebind_traits {
+ using other = allocator_traits<typename rebind_alloc<_Tp>::other>;
+ };
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer allocate(allocator_type& __a, size_type __n) {
- return __a.allocate(__n);
- }
-
- template <class _Ap = _Alloc, class =
- __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- return __a.allocate(__n, __hint);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Ap = _Alloc, class = void, class =
- __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) {
- return __a.allocate(__n);
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT {
- __a.deallocate(__p, __n);
- }
-
- template <class _Tp, class... _Args, class =
- __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __a.construct(__p, std::forward<_Args>(__args)...);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Tp, class... _Args, class = void, class =
- __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void construct(allocator_type&, _Tp* __p, _Args&&... __args) {
- std::__construct_at(__p, std::forward<_Args>(__args)...);
- }
-
- template <class _Tp, class =
- __enable_if_t<__has_destroy<allocator_type, _Tp*>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void destroy(allocator_type& __a, _Tp* __p) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __a.destroy(__p);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Tp, class = void, class =
- __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static void destroy(allocator_type&, _Tp* __p) {
- std::__destroy_at(__p);
- }
-
- template <class _Ap = _Alloc, class =
- __enable_if_t<__has_max_size<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type max_size(const allocator_type& __a) _NOEXCEPT {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- return __a.max_size();
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- }
- template <class _Ap = _Alloc, class = void, class =
- __enable_if_t<!__has_max_size<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type max_size(const allocator_type&) _NOEXCEPT {
- return numeric_limits<size_type>::max() / sizeof(value_type);
- }
-
- template <class _Ap = _Alloc, class =
- __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static allocator_type select_on_container_copy_construction(const allocator_type& __a) {
- return __a.select_on_container_copy_construction();
- }
- template <class _Ap = _Alloc, class = void, class =
- __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static allocator_type select_on_container_copy_construction(const allocator_type& __a) {
- return __a;
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ allocate(allocator_type& __a, size_type __n) {
+ return __a.allocate(__n);
+ }
+
+ template <class _Ap = _Alloc, class = __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ return __a.allocate(__n, __hint);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Ap = _Alloc,
+ class = void,
+ class = __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> >
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ allocate(allocator_type& __a, size_type __n, const_void_pointer) {
+ return __a.allocate(__n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void
+ deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT {
+ __a.deallocate(__p, __n);
+ }
+
+ template <class _Tp, class... _Args, class = __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void
+ construct(allocator_type& __a, _Tp* __p, _Args&&... __args) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __a.construct(__p, std::forward<_Args>(__args)...);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Tp,
+ class... _Args,
+ class = void,
+ class = __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void
+ construct(allocator_type&, _Tp* __p, _Args&&... __args) {
+ std::__construct_at(__p, std::forward<_Args>(__args)...);
+ }
+
+ template <class _Tp, class = __enable_if_t<__has_destroy<allocator_type, _Tp*>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type& __a, _Tp* __p) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __a.destroy(__p);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Tp, class = void, class = __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type&, _Tp* __p) {
+ std::__destroy_at(__p);
+ }
+
+ template <class _Ap = _Alloc, class = __enable_if_t<__has_max_size<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type& __a) _NOEXCEPT {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ return __a.max_size();
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ }
+ template <class _Ap = _Alloc, class = void, class = __enable_if_t<!__has_max_size<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type&) _NOEXCEPT {
+ return numeric_limits<size_type>::max() / sizeof(value_type);
+ }
+
+ template <class _Ap = _Alloc, class = __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
+ select_on_container_copy_construction(const allocator_type& __a) {
+ return __a.select_on_container_copy_construction();
+ }
+ template <class _Ap = _Alloc,
+ class = void,
+ class = __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type
+ select_on_container_copy_construction(const allocator_type& __a) {
+ return __a;
+ }
};
#ifndef _LIBCPP_CXX03_LANG
@@ -357,45 +351,42 @@ using __rebind_alloc = typename _Traits::template rebind_alloc<_Tp>::other;
// __is_default_allocator
template <class _Tp>
-struct __is_default_allocator : false_type { };
+struct __is_default_allocator : false_type {};
-template <class> class allocator;
+template <class>
+class allocator;
template <class _Tp>
-struct __is_default_allocator<allocator<_Tp> > : true_type { };
+struct __is_default_allocator<allocator<_Tp> > : true_type {};
// __is_cpp17_move_insertable
template <class _Alloc, class = void>
-struct __is_cpp17_move_insertable
- : is_move_constructible<typename _Alloc::value_type>
-{ };
+struct __is_cpp17_move_insertable : is_move_constructible<typename _Alloc::value_type> {};
template <class _Alloc>
-struct __is_cpp17_move_insertable<_Alloc, __enable_if_t<
- !__is_default_allocator<_Alloc>::value &&
- __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value
-> > : true_type { };
+struct __is_cpp17_move_insertable<
+ _Alloc,
+ __enable_if_t< !__is_default_allocator<_Alloc>::value &&
+ __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value > >
+ : true_type {};
// __is_cpp17_copy_insertable
template <class _Alloc, class = void>
struct __is_cpp17_copy_insertable
: integral_constant<bool,
- is_copy_constructible<typename _Alloc::value_type>::value &&
- __is_cpp17_move_insertable<_Alloc>::value
- >
-{ };
+ is_copy_constructible<typename _Alloc::value_type>::value &&
+ __is_cpp17_move_insertable<_Alloc>::value > {};
template <class _Alloc>
-struct __is_cpp17_copy_insertable<_Alloc, __enable_if_t<
- !__is_default_allocator<_Alloc>::value &&
- __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value
-> >
- : __is_cpp17_move_insertable<_Alloc>
-{ };
+struct __is_cpp17_copy_insertable<
+ _Alloc,
+ __enable_if_t< !__is_default_allocator<_Alloc>::value &&
+ __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value > >
+ : __is_cpp17_move_insertable<_Alloc> {};
// ASan choices
#ifndef _LIBCPP_HAS_NO_ASAN
-# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
+# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
#endif
#ifdef _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS
diff --git a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
index bce00bf02a71..c66fb49ebb3c 100644
--- a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
+++ b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
@@ -24,8 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _Np, class _Tp>
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __assume_aligned(_Tp* __ptr) {
- static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0,
- "std::assume_aligned<N>(p) requires N to be a power of two");
+ static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0, "std::assume_aligned<N>(p) requires N to be a power of two");
if (__libcpp_is_constant_evaluated()) {
return __ptr;
diff --git a/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h b/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h
index 00a6329c178d..752143616bb2 100644
--- a/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h
+++ b/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h
@@ -21,60 +21,68 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr_ref
-{
- _Tp* __ptr_;
+struct _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr_ref {
+ _Tp* __ptr_;
};
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr
-{
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr {
private:
- _Tp* __ptr_;
+ _Tp* __ptr_;
+
public:
- typedef _Tp element_type;
+ typedef _Tp element_type;
- _LIBCPP_HIDE_FROM_ABI explicit auto_ptr(_Tp* __p = 0) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr& __p) _NOEXCEPT : __ptr_(__p.release()) {}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr<_Up>& __p) _NOEXCEPT
- : __ptr_(__p.release()) {}
- _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr& __p) _NOEXCEPT
- {reset(__p.release()); return *this;}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr<_Up>& __p) _NOEXCEPT
- {reset(__p.release()); return *this;}
- _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr_ref<_Tp> __p) _NOEXCEPT
- {reset(__p.__ptr_); return *this;}
- _LIBCPP_HIDE_FROM_ABI ~auto_ptr() _NOEXCEPT {delete __ptr_;}
+ _LIBCPP_HIDE_FROM_ABI explicit auto_ptr(_Tp* __p = 0) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr& __p) _NOEXCEPT : __ptr_(__p.release()) {}
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr<_Up>& __p) _NOEXCEPT : __ptr_(__p.release()) {}
+ _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr& __p) _NOEXCEPT {
+ reset(__p.release());
+ return *this;
+ }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr<_Up>& __p) _NOEXCEPT {
+ reset(__p.release());
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr_ref<_Tp> __p) _NOEXCEPT {
+ reset(__p.__ptr_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI ~auto_ptr() _NOEXCEPT { delete __ptr_; }
- _LIBCPP_HIDE_FROM_ABI _Tp& operator*() const _NOEXCEPT
- {return *__ptr_;}
- _LIBCPP_HIDE_FROM_ABI _Tp* operator->() const _NOEXCEPT {return __ptr_;}
- _LIBCPP_HIDE_FROM_ABI _Tp* get() const _NOEXCEPT {return __ptr_;}
- _LIBCPP_HIDE_FROM_ABI _Tp* release() _NOEXCEPT
- {
- _Tp* __t = __ptr_;
- __ptr_ = nullptr;
- return __t;
- }
- _LIBCPP_HIDE_FROM_ABI void reset(_Tp* __p = 0) _NOEXCEPT
- {
- if (__ptr_ != __p)
- delete __ptr_;
- __ptr_ = __p;
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& operator*() const _NOEXCEPT { return *__ptr_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* operator->() const _NOEXCEPT { return __ptr_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* get() const _NOEXCEPT { return __ptr_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp* release() _NOEXCEPT {
+ _Tp* __t = __ptr_;
+ __ptr_ = nullptr;
+ return __t;
+ }
+ _LIBCPP_HIDE_FROM_ABI void reset(_Tp* __p = 0) _NOEXCEPT {
+ if (__ptr_ != __p)
+ delete __ptr_;
+ __ptr_ = __p;
+ }
- _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr_ref<_Tp> __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI operator auto_ptr_ref<_Up>() _NOEXCEPT
- {auto_ptr_ref<_Up> __t; __t.__ptr_ = release(); return __t;}
- template<class _Up> _LIBCPP_HIDE_FROM_ABI operator auto_ptr<_Up>() _NOEXCEPT
- {return auto_ptr<_Up>(release());}
+ _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr_ref<_Tp> __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI operator auto_ptr_ref<_Up>() _NOEXCEPT {
+ auto_ptr_ref<_Up> __t;
+ __t.__ptr_ = release();
+ return __t;
+ }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI operator auto_ptr<_Up>() _NOEXCEPT {
+ return auto_ptr<_Up>(release());
+ }
};
template <>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr<void>
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr<void> {
public:
- typedef void element_type;
+ typedef void element_type;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h b/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h
index 348712c6d8d6..c6f7f3c5ff52 100644
--- a/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h
@@ -32,10 +32,10 @@ struct __builtin_new_allocator {
: __size_(__size), __align_(__align) {}
_LIBCPP_HIDE_FROM_ABI void operator()(void* __p) const _NOEXCEPT {
- std::__libcpp_deallocate(__p, __size_, __align_);
+ std::__libcpp_deallocate(__p, __size_, __align_);
}
- private:
+ private:
size_t __size_;
size_t __align_;
};
@@ -43,25 +43,22 @@ struct __builtin_new_allocator {
typedef unique_ptr<void, __builtin_new_deleter> __holder_t;
_LIBCPP_HIDE_FROM_ABI static __holder_t __allocate_bytes(size_t __s, size_t __align) {
- return __holder_t(std::__libcpp_allocate(__s, __align),
- __builtin_new_deleter(__s, __align));
+ return __holder_t(std::__libcpp_allocate(__s, __align), __builtin_new_deleter(__s, __align));
}
- _LIBCPP_HIDE_FROM_ABI static void __deallocate_bytes(void* __p, size_t __s,
- size_t __align) _NOEXCEPT {
- std::__libcpp_deallocate(__p, __s, __align);
+ _LIBCPP_HIDE_FROM_ABI static void __deallocate_bytes(void* __p, size_t __s, size_t __align) _NOEXCEPT {
+ std::__libcpp_deallocate(__p, __s, __align);
}
template <class _Tp>
- _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
- _LIBCPP_HIDE_FROM_ABI static __holder_t __allocate_type(size_t __n) {
- return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
+ _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI static __holder_t __allocate_type(size_t __n) {
+ return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
template <class _Tp>
- _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
- _LIBCPP_HIDE_FROM_ABI static void __deallocate_type(void* __p, size_t __n) _NOEXCEPT {
- __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
+ _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI static void
+ __deallocate_type(void* __p, size_t __n) _NOEXCEPT {
+ __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
}
};
diff --git a/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h b/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h
index f24b2bac5664..e9faada2f0b2 100644
--- a/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h
+++ b/contrib/llvm-project/libcxx/include/__memory/compressed_pair.h
@@ -42,21 +42,21 @@ struct __value_init_tag {};
template <class _Tp, int _Idx, bool _CanBeEmptyBase = is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value>
struct __compressed_pair_elem {
- using _ParamT = _Tp;
- using reference = _Tp&;
+ using _ParamT = _Tp;
+ using reference = _Tp&;
using const_reference = const _Tp&;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_() {}
template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair_elem(_Up&& __u) : __value_(std::forward<_Up>(__u)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u)
+ : __value_(std::forward<_Up>(__u)) {}
#ifndef _LIBCPP_CXX03_LANG
template <class... _Args, size_t... _Indices>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair_elem(
+ piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>)
: __value_(std::forward<_Args>(std::get<_Indices>(__args))...) {}
#endif
@@ -69,18 +69,18 @@ private:
template <class _Tp, int _Idx>
struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
- using _ParamT = _Tp;
- using reference = _Tp&;
+ using _ParamT = _Tp;
+ using reference = _Tp&;
using const_reference = const _Tp&;
- using __value_type = _Tp;
+ using __value_type = _Tp;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem() = default;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_type() {}
template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair_elem(_Up&& __u) : __value_type(std::forward<_Up>(__u)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u)
+ : __value_type(std::forward<_Up>(__u)) {}
#ifndef _LIBCPP_CXX03_LANG
template <class... _Args, size_t... _Indices>
@@ -94,74 +94,63 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
};
template <class _T1, class _T2>
-class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
- private __compressed_pair_elem<_T2, 1> {
+class __compressed_pair : private __compressed_pair_elem<_T1, 0>, private __compressed_pair_elem<_T2, 1> {
public:
// NOTE: This static assert should never fire because __compressed_pair
// is *almost never* used in a scenario where it's possible for T1 == T2.
// (The exception is std::function where it is possible that the function
// object and the allocator have the same type).
- static_assert((!is_same<_T1, _T2>::value),
- "__compressed_pair cannot be instantiated when T1 and T2 are the same type; "
- "The current implementation is NOT ABI-compatible with the previous implementation for this configuration");
+ static_assert(
+ (!is_same<_T1, _T2>::value),
+ "__compressed_pair cannot be instantiated when T1 and T2 are the same type; "
+ "The current implementation is NOT ABI-compatible with the previous implementation for this configuration");
using _Base1 _LIBCPP_NODEBUG = __compressed_pair_elem<_T1, 0>;
using _Base2 _LIBCPP_NODEBUG = __compressed_pair_elem<_T2, 1>;
template <bool _Dummy = true,
- class = __enable_if_t<
- __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
- __dependent_type<is_default_constructible<_T2>, _Dummy>::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair() : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {}
+ class = __enable_if_t< __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
+ __dependent_type<is_default_constructible<_T2>, _Dummy>::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair()
+ : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {}
template <class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit __compressed_pair(_U1&& __t1, _U2&& __t2) : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair(_U1&& __t1, _U2&& __t2)
+ : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
#ifndef _LIBCPP_CXX03_LANG
template <class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- explicit __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
- tuple<_Args2...> __second_args)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair(
+ piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
: _Base1(__pc, std::move(__first_args), typename __make_tuple_indices<sizeof...(_Args1)>::type()),
_Base2(__pc, std::move(__second_args), typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename _Base1::reference first() _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename _Base1::reference first() _NOEXCEPT {
return static_cast<_Base1&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- typename _Base1::const_reference first() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename _Base1::const_reference first() const _NOEXCEPT {
return static_cast<_Base1 const&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename _Base2::reference second() _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename _Base2::reference second() _NOEXCEPT {
return static_cast<_Base2&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- typename _Base2::const_reference second() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename _Base2::const_reference second() const _NOEXCEPT {
return static_cast<_Base2 const&>(*this).__get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static
- _Base1* __get_first_base(__compressed_pair* __pair) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _Base1* __get_first_base(__compressed_pair* __pair) _NOEXCEPT {
return static_cast<_Base1*>(__pair);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static
- _Base2* __get_second_base(__compressed_pair* __pair) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _Base2* __get_second_base(__compressed_pair* __pair) _NOEXCEPT {
return static_cast<_Base2*>(__pair);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- void swap(__compressed_pair& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(__compressed_pair& __x)
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) {
using std::swap;
swap(first(), __x.first());
swap(second(), __x.second());
@@ -169,9 +158,9 @@ public:
};
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) {
__x.swap(__y);
}
diff --git a/contrib/llvm-project/libcxx/include/__memory/concepts.h b/contrib/llvm-project/libcxx/include/__memory/concepts.h
index 97cc3583ec96..216144aad748 100644
--- a/contrib/llvm-project/libcxx/include/__memory/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__memory/concepts.h
@@ -37,8 +37,7 @@ namespace ranges {
// at the address pointed-to by the iterator, which requires an lvalue.
template <class _Ip>
concept __nothrow_input_iterator =
- input_iterator<_Ip> &&
- is_lvalue_reference_v<iter_reference_t<_Ip>> &&
+ input_iterator<_Ip> && is_lvalue_reference_v<iter_reference_t<_Ip>> &&
same_as<remove_cvref_t<iter_reference_t<_Ip>>, iter_value_t<_Ip>>;
template <class _Sp, class _Ip>
@@ -46,20 +45,14 @@ concept __nothrow_sentinel_for = sentinel_for<_Sp, _Ip>;
template <class _Rp>
concept __nothrow_input_range =
- range<_Rp> &&
- __nothrow_input_iterator<iterator_t<_Rp>> &&
- __nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>;
+ range<_Rp> && __nothrow_input_iterator<iterator_t<_Rp>> && __nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>;
template <class _Ip>
concept __nothrow_forward_iterator =
- __nothrow_input_iterator<_Ip> &&
- forward_iterator<_Ip> &&
- __nothrow_sentinel_for<_Ip, _Ip>;
+ __nothrow_input_iterator<_Ip> && forward_iterator<_Ip> && __nothrow_sentinel_for<_Ip, _Ip>;
template <class _Rp>
-concept __nothrow_forward_range =
- __nothrow_input_range<_Rp> &&
- __nothrow_forward_iterator<iterator_t<_Rp>>;
+concept __nothrow_forward_range = __nothrow_input_range<_Rp> && __nothrow_forward_iterator<iterator_t<_Rp>>;
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__memory/construct_at.h b/contrib/llvm-project/libcxx/include/__memory/construct_at.h
index 6797a3862973..91d17134db01 100644
--- a/contrib/llvm-project/libcxx/include/__memory/construct_at.h
+++ b/contrib/llvm-project/libcxx/include/__memory/construct_at.h
@@ -59,71 +59,64 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Ar
// taking an array).
template <class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator __destroy(_ForwardIterator, _ForwardIterator);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator __destroy(_ForwardIterator, _ForwardIterator);
template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __destroy_at(_Tp* __loc) {
- _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
- __loc->~_Tp();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) {
+ _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
+ __loc->~_Tp();
}
#if _LIBCPP_STD_VER >= 20
template <class _Tp, __enable_if_t<is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void __destroy_at(_Tp* __loc) {
- _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
- std::__destroy(std::begin(*__loc), std::end(*__loc));
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) {
+ _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
+ std::__destroy(std::begin(*__loc), std::end(*__loc));
}
#endif
template <class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator __destroy(_ForwardIterator __first, _ForwardIterator __last) {
- for (; __first != __last; ++__first)
- std::__destroy_at(std::addressof(*__first));
- return __first;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
+__destroy(_ForwardIterator __first, _ForwardIterator __last) {
+ for (; __first != __last; ++__first)
+ std::__destroy_at(std::addressof(*__first));
+ return __first;
}
template <class _BidirectionalIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_BidirectionalIterator __reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last) {
- while (__last != __first) {
- --__last;
- std::__destroy_at(std::addressof(*__last));
- }
- return __last;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator
+__reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last) {
+ while (__last != __first) {
+ --__last;
+ std::__destroy_at(std::addressof(*__last));
+ }
+ return __last;
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp, enable_if_t<!is_array_v<_Tp>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void destroy_at(_Tp* __loc) {
- std::__destroy_at(__loc);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) {
+ std::__destroy_at(__loc);
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp, enable_if_t<is_array_v<_Tp>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void destroy_at(_Tp* __loc) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) {
std::__destroy_at(__loc);
}
-#endif
+# endif
template <class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void destroy(_ForwardIterator __first, _ForwardIterator __last) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy(_ForwardIterator __first, _ForwardIterator __last) {
(void)std::__destroy(std::move(__first), std::move(__last));
}
template <class _ForwardIterator, class _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) {
- for (; __n > 0; (void)++__first, --__n)
- std::__destroy_at(std::addressof(*__first));
- return __first;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) {
+ for (; __n > 0; (void)++__first, --__n)
+ std::__destroy_at(std::addressof(*__first));
+ return __first;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__memory/destruct_n.h b/contrib/llvm-project/libcxx/include/__memory/destruct_n.h
index 3a0ad9218af1..78635ad0af04 100644
--- a/contrib/llvm-project/libcxx/include/__memory/destruct_n.h
+++ b/contrib/llvm-project/libcxx/include/__memory/destruct_n.h
@@ -20,43 +20,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct __destruct_n
-{
+struct __destruct_n {
private:
- size_t __size_;
+ size_t __size_;
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __process(_Tp* __p, false_type) _NOEXCEPT
- {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();}
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __process(_Tp* __p, false_type) _NOEXCEPT {
+ for (size_t __i = 0; __i < __size_; ++__i, ++__p)
+ __p->~_Tp();
+ }
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __process(_Tp*, true_type) _NOEXCEPT
- {}
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __process(_Tp*, true_type) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI void __incr(false_type) _NOEXCEPT
- {++__size_;}
- _LIBCPP_HIDE_FROM_ABI void __incr(true_type) _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI void __incr(false_type) _NOEXCEPT { ++__size_; }
+ _LIBCPP_HIDE_FROM_ABI void __incr(true_type) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, false_type) _NOEXCEPT
- {__size_ = __s;}
- _LIBCPP_HIDE_FROM_ABI void __set(size_t, true_type) _NOEXCEPT
- {}
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __destruct_n(size_t __s) _NOEXCEPT
- : __size_(__s) {}
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __incr() _NOEXCEPT
- {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
+ _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, false_type) _NOEXCEPT { __size_ = __s; }
+ _LIBCPP_HIDE_FROM_ABI void __set(size_t, true_type) _NOEXCEPT {}
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, _Tp*) _NOEXCEPT
- {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) _NOEXCEPT
- {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit __destruct_n(size_t __s) _NOEXCEPT : __size_(__s) {}
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __incr() _NOEXCEPT {
+ __incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());
+ }
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, _Tp*) _NOEXCEPT {
+ __set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());
+ }
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) _NOEXCEPT {
+ __process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h b/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h
index 7fcf3bf06110..643b7391d3d6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h
+++ b/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h
@@ -38,21 +38,18 @@ template <class _Ptr, bool = __has_element_type<_Ptr>::value>
struct __pointer_traits_element_type {};
template <class _Ptr>
-struct __pointer_traits_element_type<_Ptr, true>
-{
- typedef _LIBCPP_NODEBUG typename _Ptr::element_type type;
+struct __pointer_traits_element_type<_Ptr, true> {
+ typedef _LIBCPP_NODEBUG typename _Ptr::element_type type;
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args>
-struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
-{
- typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::element_type type;
+template <template <class, class...> class _Sp, class _Tp, class... _Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true> {
+ typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::element_type type;
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args>
-struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
-{
- typedef _LIBCPP_NODEBUG _Tp type;
+template <template <class, class...> class _Sp, class _Tp, class... _Args>
+struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false> {
+ typedef _LIBCPP_NODEBUG _Tp type;
};
template <class _Tp, class = void>
@@ -62,53 +59,50 @@ template <class _Tp>
struct __has_difference_type<_Tp, __void_t<typename _Tp::difference_type> > : true_type {};
template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
-struct __pointer_traits_difference_type
-{
- typedef _LIBCPP_NODEBUG ptrdiff_t type;
+struct __pointer_traits_difference_type {
+ typedef _LIBCPP_NODEBUG ptrdiff_t type;
};
template <class _Ptr>
-struct __pointer_traits_difference_type<_Ptr, true>
-{
- typedef _LIBCPP_NODEBUG typename _Ptr::difference_type type;
+struct __pointer_traits_difference_type<_Ptr, true> {
+ typedef _LIBCPP_NODEBUG typename _Ptr::difference_type type;
};
template <class _Tp, class _Up>
-struct __has_rebind
-{
+struct __has_rebind {
private:
- template <class _Xp> static false_type __test(...);
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- template <class _Xp> static true_type __test(typename _Xp::template rebind<_Up>* = 0);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
+ template <class _Xp>
+ static false_type __test(...);
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ template <class _Xp>
+ static true_type __test(typename _Xp::template rebind<_Up>* = 0);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- static const bool value = decltype(__test<_Tp>(0))::value;
+ static const bool value = decltype(__test<_Tp>(0))::value;
};
template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
-struct __pointer_traits_rebind
-{
+struct __pointer_traits_rebind {
#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up> type;
+ typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up> type;
#else
- typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up>::other type;
+ typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up>::other type;
#endif
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
-struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
-{
+template <template <class, class...> class _Sp, class _Tp, class... _Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true> {
#ifndef _LIBCPP_CXX03_LANG
- typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
+ typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
#else
- typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
+ typedef _LIBCPP_NODEBUG typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
#endif
};
-template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
-struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
-{
- typedef _Sp<_Up, _Args...> type;
+template <template <class, class...> class _Sp, class _Tp, class... _Args, class _Up>
+struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false> {
+ typedef _Sp<_Up, _Args...> type;
};
template <class _Ptr, class = void>
@@ -121,42 +115,52 @@ struct __pointer_traits_impl<_Ptr, __void_t<typename __pointer_traits_element_ty
typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
#ifndef _LIBCPP_CXX03_LANG
- template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
+ template <class _Up>
+ using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
#else
- template <class _Up> struct rebind
- {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
+ template <class _Up>
+ struct rebind {
+ typedef typename __pointer_traits_rebind<pointer, _Up>::type other;
+ };
#endif // _LIBCPP_CXX03_LANG
private:
- struct __nat {};
+ struct __nat {};
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r)
- {return pointer::pointer_to(__r);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) {
+ return pointer::pointer_to(__r);
+ }
};
template <class _Ptr>
struct _LIBCPP_TEMPLATE_VIS pointer_traits : __pointer_traits_impl<_Ptr> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>
-{
- typedef _Tp* pointer;
- typedef _Tp element_type;
- typedef ptrdiff_t difference_type;
+struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*> {
+ typedef _Tp* pointer;
+ typedef _Tp element_type;
+ typedef ptrdiff_t difference_type;
#ifndef _LIBCPP_CXX03_LANG
- template <class _Up> using rebind = _Up*;
+ template <class _Up>
+ using rebind = _Up*;
#else
- template <class _Up> struct rebind {typedef _Up* other;};
+ template <class _Up>
+ struct rebind {
+ typedef _Up* other;
+ };
#endif
private:
- struct __nat {};
+ struct __nat {};
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT
- {return std::addressof(__r);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
+ pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT {
+ return std::addressof(__r);
+ }
};
#ifndef _LIBCPP_CXX03_LANG
@@ -173,27 +177,23 @@ template <class _Pointer, class = void>
struct __to_address_helper;
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Tp* __to_address(_Tp* __p) _NOEXCEPT {
- static_assert(!is_function<_Tp>::value, "_Tp is a function type");
- return __p;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT {
+ static_assert(!is_function<_Tp>::value, "_Tp is a function type");
+ return __p;
}
template <class _Pointer, class = void>
struct _HasToAddress : false_type {};
template <class _Pointer>
-struct _HasToAddress<_Pointer,
- decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
-> : true_type {};
+struct _HasToAddress<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) >
+ : true_type {};
template <class _Pointer, class = void>
struct _HasArrow : false_type {};
template <class _Pointer>
-struct _HasArrow<_Pointer,
- decltype((void)std::declval<const _Pointer&>().operator->())
-> : true_type {};
+struct _HasArrow<_Pointer, decltype((void)std::declval<const _Pointer&>().operator->()) > : true_type {};
template <class _Pointer>
struct _IsFancyPointer {
@@ -201,44 +201,42 @@ struct _IsFancyPointer {
};
// enable_if is needed here to avoid instantiating checks for fancy pointers on raw pointers
-template <class _Pointer, class = __enable_if_t<
- _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value
-> >
+template <class _Pointer, class = __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
-__to_address(const _Pointer& __p) _NOEXCEPT {
- return __to_address_helper<_Pointer>::__call(__p);
+ __decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
+ __to_address(const _Pointer& __p) _NOEXCEPT {
+ return __to_address_helper<_Pointer>::__call(__p);
}
template <class _Pointer, class>
struct __to_address_helper {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- static decltype(std::__to_address(std::declval<const _Pointer&>().operator->()))
- __call(const _Pointer& __p) _NOEXCEPT {
- return std::__to_address(__p.operator->());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static decltype(std::__to_address(
+ std::declval<const _Pointer&>().operator->()))
+ __call(const _Pointer& __p) _NOEXCEPT {
+ return std::__to_address(__p.operator->());
+ }
};
template <class _Pointer>
-struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
- __call(const _Pointer& __p) _NOEXCEPT {
- return pointer_traits<_Pointer>::to_address(__p);
- }
+struct __to_address_helper<_Pointer,
+ decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static decltype(pointer_traits<_Pointer>::to_address(
+ std::declval<const _Pointer&>()))
+ __call(const _Pointer& __p) _NOEXCEPT {
+ return pointer_traits<_Pointer>::to_address(__p);
+ }
};
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-auto to_address(_Tp *__p) noexcept {
- return std::__to_address(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(_Tp* __p) noexcept {
+ return std::__to_address(__p);
}
template <class _Pointer>
-inline _LIBCPP_HIDE_FROM_ABI constexpr
-auto to_address(const _Pointer& __p) noexcept -> decltype(std::__to_address(__p)) {
- return std::__to_address(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(const _Pointer& __p) noexcept
+ -> decltype(std::__to_address(__p)) {
+ return std::__to_address(__p);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h b/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h
index b6008a7b7f03..f731e75e7bdc 100644
--- a/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h
+++ b/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h
@@ -41,11 +41,8 @@ namespace ranges {
namespace __construct_at {
struct __fn {
- template<class _Tp, class... _Args, class = decltype(
- ::new (std::declval<void*>()) _Tp(std::declval<_Args>()...)
- )>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp* operator()(_Tp* __location, _Args&& ...__args) const {
+ template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator()(_Tp* __location, _Args&&... __args) const {
return std::construct_at(__location, std::forward<_Args>(__args)...);
}
};
@@ -53,7 +50,7 @@ struct __fn {
} // namespace __construct_at
inline namespace __cpo {
- inline constexpr auto construct_at = __construct_at::__fn{};
+inline constexpr auto construct_at = __construct_at::__fn{};
} // namespace __cpo
// destroy_at
@@ -62,8 +59,7 @@ namespace __destroy_at {
struct __fn {
template <destructible _Tp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_Tp* __location) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp* __location) const noexcept {
std::destroy_at(__location);
}
};
@@ -71,7 +67,7 @@ struct __fn {
} // namespace __destroy_at
inline namespace __cpo {
- inline constexpr auto destroy_at = __destroy_at::__fn{};
+inline constexpr auto destroy_at = __destroy_at::__fn{};
} // namespace __cpo
// destroy
@@ -81,15 +77,13 @@ namespace __destroy {
struct __fn {
template <__nothrow_input_iterator _InputIterator, __nothrow_sentinel_for<_InputIterator> _Sentinel>
requires destructible<iter_value_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept {
return std::__destroy(std::move(__first), std::move(__last));
}
template <__nothrow_input_range _InputRange>
requires destructible<range_value_t<_InputRange>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr borrowed_iterator_t<_InputRange> operator()(_InputRange&& __range) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_InputRange> operator()(_InputRange&& __range) const noexcept {
return (*this)(ranges::begin(__range), ranges::end(__range));
}
};
@@ -97,7 +91,7 @@ struct __fn {
} // namespace __destroy
inline namespace __cpo {
- inline constexpr auto destroy = __destroy::__fn{};
+inline constexpr auto destroy = __destroy::__fn{};
} // namespace __cpo
// destroy_n
@@ -107,8 +101,8 @@ namespace __destroy_n {
struct __fn {
template <__nothrow_input_iterator _InputIterator>
requires destructible<iter_value_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _InputIterator operator()(_InputIterator __first, iter_difference_t<_InputIterator> __n) const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator
+ operator()(_InputIterator __first, iter_difference_t<_InputIterator> __n) const noexcept {
return std::destroy_n(std::move(__first), __n);
}
};
@@ -116,7 +110,7 @@ struct __fn {
} // namespace __destroy_n
inline namespace __cpo {
- inline constexpr auto destroy_n = __destroy_n::__fn{};
+inline constexpr auto destroy_n = __destroy_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h b/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h
index 513fcf70f154..d836d00820a6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h
+++ b/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h
@@ -42,13 +42,11 @@ namespace ranges {
namespace __uninitialized_default_construct {
struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator,
- __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
+ template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
requires default_initializable<iter_value_t<_ForwardIterator>>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_default_construct<_ValueType>(
- std::move(__first), std::move(__last));
+ return std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last));
}
template <__nothrow_forward_range _ForwardRange>
@@ -61,7 +59,7 @@ struct __fn {
} // namespace __uninitialized_default_construct
inline namespace __cpo {
- inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn{};
+inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn{};
} // namespace __cpo
// uninitialized_default_construct_n
@@ -71,8 +69,8 @@ namespace __uninitialized_default_construct_n {
struct __fn {
template <__nothrow_forward_iterator _ForwardIterator>
requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first,
- iter_difference_t<_ForwardIterator> __n) const {
+ _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+ operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
}
@@ -81,7 +79,7 @@ struct __fn {
} // namespace __uninitialized_default_construct_n
inline namespace __cpo {
- inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n::__fn{};
+inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n::__fn{};
} // namespace __cpo
// uninitialized_value_construct
@@ -89,13 +87,11 @@ inline namespace __cpo {
namespace __uninitialized_value_construct {
struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator,
- __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
+ template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
requires default_initializable<iter_value_t<_ForwardIterator>>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_value_construct<_ValueType>(
- std::move(__first), std::move(__last));
+ return std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last));
}
template <__nothrow_forward_range _ForwardRange>
@@ -108,7 +104,7 @@ struct __fn {
} // namespace __uninitialized_value_construct
inline namespace __cpo {
- inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct::__fn{};
+inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct::__fn{};
} // namespace __cpo
// uninitialized_value_construct_n
@@ -118,8 +114,8 @@ namespace __uninitialized_value_construct_n {
struct __fn {
template <__nothrow_forward_iterator _ForwardIterator>
requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first,
- iter_difference_t<_ForwardIterator> __n) const {
+ _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+ operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
}
@@ -128,7 +124,7 @@ struct __fn {
} // namespace __uninitialized_value_construct_n
inline namespace __cpo {
- inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n::__fn{};
+inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n::__fn{};
} // namespace __cpo
// uninitialized_fill
@@ -136,9 +132,7 @@ inline namespace __cpo {
namespace __uninitialized_fill {
struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator,
- __nothrow_sentinel_for<_ForwardIterator> _Sentinel,
- class _Tp>
+ template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp>
requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
_LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
@@ -155,7 +149,7 @@ struct __fn {
} // namespace __uninitialized_fill
inline namespace __cpo {
- inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn{};
+inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn{};
} // namespace __cpo
// uninitialized_fill_n
@@ -165,9 +159,8 @@ namespace __uninitialized_fill_n {
struct __fn {
template <__nothrow_forward_iterator _ForwardIterator, class _Tp>
requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first,
- iter_difference_t<_ForwardIterator> __n,
- const _Tp& __x) const {
+ _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+ operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n, const _Tp& __x) const {
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
return std::__uninitialized_fill_n<_ValueType>(std::move(__first), __n, __x);
}
@@ -176,7 +169,7 @@ struct __fn {
} // namespace __uninitialized_fill_n
inline namespace __cpo {
- inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{};
+inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{};
} // namespace __cpo
// uninitialized_copy
@@ -205,16 +198,16 @@ struct __fn {
template <input_range _InputRange, __nothrow_forward_range _OutputRange>
requires constructible_from<range_value_t<_OutputRange>, range_reference_t<_InputRange>>
_LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
- operator()( _InputRange&& __in_range, _OutputRange&& __out_range) const {
- return (*this)(ranges::begin(__in_range), ranges::end(__in_range),
- ranges::begin(__out_range), ranges::end(__out_range));
+ operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
+ return (*this)(
+ ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
}
};
} // namespace __uninitialized_copy
inline namespace __cpo {
- inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{};
+inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{};
} // namespace __cpo
// uninitialized_copy_n
@@ -226,13 +219,15 @@ namespace __uninitialized_copy_n {
struct __fn {
template <input_iterator _InputIterator,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel>
+ __nothrow_forward_iterator _OutputIterator,
+ __nothrow_sentinel_for<_OutputIterator> _Sentinel>
requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>>
_LIBCPP_HIDE_FROM_ABI uninitialized_copy_n_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst, iter_difference_t<_InputIterator> __n,
- _OutputIterator __ofirst, _Sentinel __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
+ operator()(_InputIterator __ifirst,
+ iter_difference_t<_InputIterator> __n,
+ _OutputIterator __ofirst,
+ _Sentinel __olast) const {
+ using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
auto __result =
std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying);
@@ -243,7 +238,7 @@ struct __fn {
} // namespace __uninitialized_copy_n
inline namespace __cpo {
- inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{};
+inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{};
} // namespace __cpo
// uninitialized_move
@@ -261,8 +256,8 @@ struct __fn {
requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
_LIBCPP_HIDE_FROM_ABI uninitialized_move_result<_InputIterator, _OutputIterator>
operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
- auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
+ using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
+ auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
auto __result = std::__uninitialized_move<_ValueType>(
std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_moving, __iter_move);
@@ -273,15 +268,15 @@ struct __fn {
requires constructible_from<range_value_t<_OutputRange>, range_rvalue_reference_t<_InputRange>>
_LIBCPP_HIDE_FROM_ABI uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
- return (*this)(ranges::begin(__in_range), ranges::end(__in_range),
- ranges::begin(__out_range), ranges::end(__out_range));
+ return (*this)(
+ ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
}
};
} // namespace __uninitialized_move
inline namespace __cpo {
- inline constexpr auto uninitialized_move = __uninitialized_move::__fn{};
+inline constexpr auto uninitialized_move = __uninitialized_move::__fn{};
} // namespace __cpo
// uninitialized_move_n
@@ -293,14 +288,16 @@ namespace __uninitialized_move_n {
struct __fn {
template <input_iterator _InputIterator,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel>
+ __nothrow_forward_iterator _OutputIterator,
+ __nothrow_sentinel_for<_OutputIterator> _Sentinel>
requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
_LIBCPP_HIDE_FROM_ABI uninitialized_move_n_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst, iter_difference_t<_InputIterator> __n,
- _OutputIterator __ofirst, _Sentinel __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
- auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
+ operator()(_InputIterator __ifirst,
+ iter_difference_t<_InputIterator> __n,
+ _OutputIterator __ofirst,
+ _Sentinel __olast) const {
+ using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
+ auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
auto __result = std::__uninitialized_move_n<_ValueType>(
std::move(__ifirst), __n, std::move(__ofirst), __stop_moving, __iter_move);
@@ -311,7 +308,7 @@ struct __fn {
} // namespace __uninitialized_move_n
inline namespace __cpo {
- inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{};
+inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h b/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h
index 7aa75dca350a..33790a397c84 100644
--- a/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h
@@ -29,38 +29,50 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _OutputIterator, class _Tp>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
-#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
+# if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
: public iterator<output_iterator_tag, void, void, void, void>
-#endif
+# endif
{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
private:
- _OutputIterator __x_;
+ _OutputIterator __x_;
+
public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
-#if _LIBCPP_STD_VER >= 20
- typedef ptrdiff_t difference_type;
-#else
- typedef void difference_type;
-#endif
- typedef void pointer;
- typedef void reference;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+# if _LIBCPP_STD_VER >= 20
+ typedef ptrdiff_t difference_type;
+# else
+ typedef void difference_type;
+# endif
+ typedef void pointer;
+ typedef void reference;
- _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() {return *this;}
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element)
- {::new ((void*)std::addressof(*__x_)) _Tp(__element); return *this;}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(_Tp&& __element)
- {::new ((void*)std::addressof(*__x_)) _Tp(std::move(__element)); return *this;}
-#endif
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() {++__x_; return *this;}
- _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int)
- {raw_storage_iterator __t(*this); ++__x_; return __t;}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
-#endif
+ _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() { return *this; }
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element) {
+ ::new ((void*)std::addressof(*__x_)) _Tp(__element);
+ return *this;
+ }
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(_Tp&& __element) {
+ ::new ((void*)std::addressof(*__x_)) _Tp(std::move(__element));
+ return *this;
+ }
+# endif
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() {
+ ++__x_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int) {
+ raw_storage_iterator __t(*this);
+ ++__x_;
+ return __t;
+ }
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; }
+# endif
};
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
diff --git a/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h b/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h
index 84db7998a147..a868093026c5 100644
--- a/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h
+++ b/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h
@@ -66,214 +66,175 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
// should be sufficient for thread safety.
// See https://llvm.org/PR22803
-#if defined(__clang__) && __has_builtin(__atomic_add_fetch) \
- && defined(__ATOMIC_RELAXED) \
- && defined(__ATOMIC_ACQ_REL)
-# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
+#if defined(__clang__) && __has_builtin(__atomic_add_fetch) && defined(__ATOMIC_RELAXED) && defined(__ATOMIC_ACQ_REL)
+# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
#elif defined(_LIBCPP_COMPILER_GCC)
-# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
+# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
#endif
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
-#if !defined(_LIBCPP_HAS_NO_THREADS) && \
- defined(__ATOMIC_RELAXED) && \
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
+#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__ATOMIC_RELAXED) && \
(__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
- return __atomic_load_n(__value, __ATOMIC_RELAXED);
+ return __atomic_load_n(__value, __ATOMIC_RELAXED);
#else
- return *__value;
+ return *__value;
#endif
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_acquire_load(_ValueType const* __value) {
-#if !defined(_LIBCPP_HAS_NO_THREADS) && \
- defined(__ATOMIC_ACQUIRE) && \
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) {
+#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__ATOMIC_ACQUIRE) && \
(__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
- return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
+ return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
#else
- return *__value;
+ return *__value;
#endif
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _Tp
-__libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT {
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
- return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
+ return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
#else
- return __t += 1;
+ return __t += 1;
#endif
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _Tp
-__libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT {
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
- return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
+ return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
#else
- return __t -= 1;
+ return __t -= 1;
#endif
}
-class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr
- : public std::exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr : public std::exception {
public:
- _LIBCPP_HIDE_FROM_ABI bad_weak_ptr() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_weak_ptr& operator=(const bad_weak_ptr&) _NOEXCEPT = default;
- ~bad_weak_ptr() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI bad_weak_ptr() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_weak_ptr& operator=(const bad_weak_ptr&) _NOEXCEPT = default;
+ ~bad_weak_ptr() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_weak_ptr()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_weak_ptr();
+ throw bad_weak_ptr();
#else
- _LIBCPP_VERBOSE_ABORT("bad_weak_ptr was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("bad_weak_ptr was thrown in -fno-exceptions mode");
#endif
}
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS weak_ptr;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS weak_ptr;
-class _LIBCPP_EXPORTED_FROM_ABI __shared_count
-{
- __shared_count(const __shared_count&);
- __shared_count& operator=(const __shared_count&);
+class _LIBCPP_EXPORTED_FROM_ABI __shared_count {
+ __shared_count(const __shared_count&);
+ __shared_count& operator=(const __shared_count&);
protected:
- long __shared_owners_;
- virtual ~__shared_count();
+ long __shared_owners_;
+ virtual ~__shared_count();
+
private:
- virtual void __on_zero_shared() _NOEXCEPT = 0;
+ virtual void __on_zero_shared() _NOEXCEPT = 0;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_count(long __refs = 0) _NOEXCEPT
- : __shared_owners_(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_count(long __refs = 0) _NOEXCEPT : __shared_owners_(__refs) {}
#if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS)
- void __add_shared() noexcept;
- bool __release_shared() noexcept;
+ void __add_shared() noexcept;
+ bool __release_shared() noexcept;
#else
- _LIBCPP_HIDE_FROM_ABI
- void __add_shared() _NOEXCEPT {
- __libcpp_atomic_refcount_increment(__shared_owners_);
- }
- _LIBCPP_HIDE_FROM_ABI
- bool __release_shared() _NOEXCEPT {
- if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) {
- __on_zero_shared();
- return true;
- }
- return false;
+ _LIBCPP_HIDE_FROM_ABI void __add_shared() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_owners_); }
+ _LIBCPP_HIDE_FROM_ABI bool __release_shared() _NOEXCEPT {
+ if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) {
+ __on_zero_shared();
+ return true;
}
+ return false;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT {
- return __libcpp_relaxed_load(&__shared_owners_) + 1;
- }
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __libcpp_relaxed_load(&__shared_owners_) + 1; }
};
-class _LIBCPP_EXPORTED_FROM_ABI __shared_weak_count
- : private __shared_count
-{
- long __shared_weak_owners_;
+class _LIBCPP_EXPORTED_FROM_ABI __shared_weak_count : private __shared_count {
+ long __shared_weak_owners_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_weak_count(long __refs = 0) _NOEXCEPT
- : __shared_count(__refs),
- __shared_weak_owners_(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_weak_count(long __refs = 0) _NOEXCEPT
+ : __shared_count(__refs),
+ __shared_weak_owners_(__refs) {}
+
protected:
- ~__shared_weak_count() override;
+ ~__shared_weak_count() override;
public:
#if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS)
- void __add_shared() noexcept;
- void __add_weak() noexcept;
- void __release_shared() noexcept;
+ void __add_shared() noexcept;
+ void __add_weak() noexcept;
+ void __release_shared() noexcept;
#else
- _LIBCPP_HIDE_FROM_ABI
- void __add_shared() _NOEXCEPT {
- __shared_count::__add_shared();
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_weak() _NOEXCEPT {
- __libcpp_atomic_refcount_increment(__shared_weak_owners_);
- }
- _LIBCPP_HIDE_FROM_ABI
- void __release_shared() _NOEXCEPT {
- if (__shared_count::__release_shared())
- __release_weak();
- }
+ _LIBCPP_HIDE_FROM_ABI void __add_shared() _NOEXCEPT { __shared_count::__add_shared(); }
+ _LIBCPP_HIDE_FROM_ABI void __add_weak() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_weak_owners_); }
+ _LIBCPP_HIDE_FROM_ABI void __release_shared() _NOEXCEPT {
+ if (__shared_count::__release_shared())
+ __release_weak();
+ }
#endif
- void __release_weak() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT {return __shared_count::use_count();}
- __shared_weak_count* lock() _NOEXCEPT;
+ void __release_weak() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __shared_count::use_count(); }
+ __shared_weak_count* lock() _NOEXCEPT;
+
+ virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
- virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
private:
- virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
+ virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
};
template <class _Tp, class _Dp, class _Alloc>
-class __shared_ptr_pointer
- : public __shared_weak_count
-{
- __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;
+class __shared_ptr_pointer : public __shared_weak_count {
+ __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
- : __data_(__compressed_pair<_Tp, _Dp>(__p, std::move(__d)), std::move(__a)) {}
+ _LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
+ : __data_(__compressed_pair<_Tp, _Dp>(__p, std::move(__d)), std::move(__a)) {}
#ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override;
#endif
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override;
};
#ifndef _LIBCPP_HAS_NO_RTTI
template <class _Tp, class _Dp, class _Alloc>
-const void*
-__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT
-{
- return __t == typeid(_Dp) ? std::addressof(__data_.first().second()) : nullptr;
+const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT {
+ return __t == typeid(_Dp) ? std::addressof(__data_.first().second()) : nullptr;
}
#endif // _LIBCPP_HAS_NO_RTTI
template <class _Tp, class _Dp, class _Alloc>
-void
-__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT
-{
- __data_.first().second()(__data_.first().first());
- __data_.first().second().~_Dp();
+void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT {
+ __data_.first().second()(__data_.first().first());
+ __data_.first().second().~_Dp();
}
template <class _Tp, class _Dp, class _Alloc>
-void
-__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
-{
- typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT {
+ typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__data_.second());
- __data_.second().~_Alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+ _Al __a(__data_.second());
+ __data_.second().~_Alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
// This tag is used to instantiate an allocator type. The various shared_ptr control blocks
@@ -282,110 +243,99 @@ __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
struct __for_overwrite_tag {};
template <class _Tp, class _Alloc>
-struct __shared_ptr_emplace
- : __shared_weak_count
-{
- template <class... _Args, class _Allocator = _Alloc, __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...)
- : __storage_(std::move(__a))
- {
- static_assert(sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite");
- ::new ((void*)__get_elem()) _Tp;
- }
-
- template <class... _Args, class _Allocator = _Alloc, __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
- : __storage_(std::move(__a))
- {
- using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
- _TpAlloc __tmp(*__get_alloc());
- allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); }
-
- _LIBCPP_HIDE_FROM_ABI
- _Tp* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); }
+struct __shared_ptr_emplace : __shared_weak_count {
+ template <class... _Args,
+ class _Allocator = _Alloc,
+ __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&...) : __storage_(std::move(__a)) {
+ static_assert(
+ sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite");
+ ::new ((void*)__get_elem()) _Tp;
+ }
+
+ template <class... _Args,
+ class _Allocator = _Alloc,
+ __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&... __args) : __storage_(std::move(__a)) {
+ using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
+ _TpAlloc __tmp(*__get_alloc());
+ allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); }
+
+ _LIBCPP_HIDE_FROM_ABI _Tp* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); }
private:
- template <class _Allocator = _Alloc, __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
- __get_elem()->~_Tp();
- }
-
- template <class _Allocator = _Alloc, __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
- using _TpAlloc = typename __allocator_traits_rebind<_Allocator, _Tp>::type;
- _TpAlloc __tmp(*__get_alloc());
- allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem());
+ template <class _Allocator = _Alloc,
+ __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
+ __get_elem()->~_Tp();
+ }
+
+ template <class _Allocator = _Alloc,
+ __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
+ using _TpAlloc = typename __allocator_traits_rebind<_Allocator, _Tp>::type;
+ _TpAlloc __tmp(*__get_alloc());
+ allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { __on_zero_shared_impl(); }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
+ using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type;
+ using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer;
+ _ControlBlockAlloc __tmp(*__get_alloc());
+ __storage_.~_Storage();
+ allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1);
+ }
+
+ // This class implements the control block for non-array shared pointers created
+ // through `std::allocate_shared` and `std::make_shared`.
+ //
+ // In previous versions of the library, we used a compressed pair to store
+ // both the _Alloc and the _Tp. This implies using EBO, which is incompatible
+ // with Allocator construction for _Tp. To allow implementing P0674 in C++20,
+ // we now use a properly aligned char buffer while making sure that we maintain
+ // the same layout that we had when we used a compressed pair.
+ using _CompressedPair = __compressed_pair<_Alloc, _Tp>;
+ struct _ALIGNAS_TYPE(_CompressedPair) _Storage {
+ char __blob_[sizeof(_CompressedPair)];
+
+ _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) { ::new ((void*)__get_alloc()) _Alloc(std::move(__a)); }
+ _LIBCPP_HIDE_FROM_ABI ~_Storage() { __get_alloc()->~_Alloc(); }
+ _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT {
+ _CompressedPair* __as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
+ typename _CompressedPair::_Base1* __first = _CompressedPair::__get_first_base(__as_pair);
+ _Alloc* __alloc = reinterpret_cast<_Alloc*>(__first);
+ return __alloc;
}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
- __on_zero_shared_impl();
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
- using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type;
- using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer;
- _ControlBlockAlloc __tmp(*__get_alloc());
- __storage_.~_Storage();
- allocator_traits<_ControlBlockAlloc>::deallocate(__tmp,
- pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Tp* __get_elem() _NOEXCEPT {
+ _CompressedPair* __as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
+ typename _CompressedPair::_Base2* __second = _CompressedPair::__get_second_base(__as_pair);
+ _Tp* __elem = reinterpret_cast<_Tp*>(__second);
+ return __elem;
}
+ };
- // This class implements the control block for non-array shared pointers created
- // through `std::allocate_shared` and `std::make_shared`.
- //
- // In previous versions of the library, we used a compressed pair to store
- // both the _Alloc and the _Tp. This implies using EBO, which is incompatible
- // with Allocator construction for _Tp. To allow implementing P0674 in C++20,
- // we now use a properly aligned char buffer while making sure that we maintain
- // the same layout that we had when we used a compressed pair.
- using _CompressedPair = __compressed_pair<_Alloc, _Tp>;
- struct _ALIGNAS_TYPE(_CompressedPair) _Storage {
- char __blob_[sizeof(_CompressedPair)];
-
- _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) {
- ::new ((void*)__get_alloc()) _Alloc(std::move(__a));
- }
- _LIBCPP_HIDE_FROM_ABI ~_Storage() {
- __get_alloc()->~_Alloc();
- }
- _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT {
- _CompressedPair *__as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
- typename _CompressedPair::_Base1* __first = _CompressedPair::__get_first_base(__as_pair);
- _Alloc *__alloc = reinterpret_cast<_Alloc*>(__first);
- return __alloc;
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Tp* __get_elem() _NOEXCEPT {
- _CompressedPair *__as_pair = reinterpret_cast<_CompressedPair*>(__blob_);
- typename _CompressedPair::_Base2* __second = _CompressedPair::__get_second_base(__as_pair);
- _Tp *__elem = reinterpret_cast<_Tp*>(__second);
- return __elem;
- }
- };
-
- static_assert(_LIBCPP_ALIGNOF(_Storage) == _LIBCPP_ALIGNOF(_CompressedPair), "");
- static_assert(sizeof(_Storage) == sizeof(_CompressedPair), "");
- _Storage __storage_;
+ static_assert(_LIBCPP_ALIGNOF(_Storage) == _LIBCPP_ALIGNOF(_CompressedPair), "");
+ static_assert(sizeof(_Storage) == sizeof(_CompressedPair), "");
+ _Storage __storage_;
};
struct __shared_ptr_dummy_rebind_allocator_type;
template <>
-class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
-{
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type> {
public:
- template <class _Other>
- struct rebind
- {
- typedef allocator<_Other> other;
- };
+ template <class _Other>
+ struct rebind {
+ typedef allocator<_Other> other;
+ };
};
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
// http://eel.is/c++draft/util.sharedptr#util.smartptr.shared.general-6
// A pointer type Y* is said to be compatible with a pointer type T*
@@ -395,19 +345,13 @@ template <class _Yp, class _Tp>
struct __bounded_convertible_to_unbounded : false_type {};
template <class _Up, std::size_t _Np, class _Tp>
-struct __bounded_convertible_to_unbounded<_Up[_Np], _Tp>
- : is_same<__remove_cv_t<_Tp>, _Up[]> {};
+struct __bounded_convertible_to_unbounded<_Up[_Np], _Tp> : is_same<__remove_cv_t<_Tp>, _Up[]> {};
template <class _Yp, class _Tp>
-struct __compatible_with
- : _Or<
- is_convertible<_Yp*, _Tp*>,
- __bounded_convertible_to_unbounded<_Yp, _Tp>
- > {};
+struct __compatible_with : _Or< is_convertible<_Yp*, _Tp*>, __bounded_convertible_to_unbounded<_Yp, _Tp> > {};
#else
template <class _Yp, class _Tp>
-struct __compatible_with
- : is_convertible<_Yp*, _Tp*> {};
+struct __compatible_with : is_convertible<_Yp*, _Tp*> {};
#endif // _LIBCPP_STD_VER >= 17
// Constructors that take raw pointers have a different set of "compatible" constraints
@@ -417,40 +361,32 @@ struct __compatible_with
// - If T is not an array type, then Y* is convertible to T*.
#if _LIBCPP_STD_VER >= 17
template <class _Yp, class _Tp, class = void>
-struct __raw_pointer_compatible_with : _And<
- _Not<is_array<_Tp>>,
- is_convertible<_Yp*, _Tp*>
- > {};
+struct __raw_pointer_compatible_with : _And< _Not<is_array<_Tp>>, is_convertible<_Yp*, _Tp*> > {};
template <class _Yp, class _Up, std::size_t _Np>
-struct __raw_pointer_compatible_with<_Yp, _Up[_Np], __enable_if_t<
- is_convertible<_Yp(*)[_Np], _Up(*)[_Np]>::value> >
- : true_type {};
+struct __raw_pointer_compatible_with<_Yp, _Up[_Np], __enable_if_t< is_convertible<_Yp (*)[_Np], _Up (*)[_Np]>::value> >
+ : true_type {};
template <class _Yp, class _Up>
-struct __raw_pointer_compatible_with<_Yp, _Up[], __enable_if_t<
- is_convertible<_Yp(*)[], _Up(*)[]>::value> >
- : true_type {};
+struct __raw_pointer_compatible_with<_Yp, _Up[], __enable_if_t< is_convertible<_Yp (*)[], _Up (*)[]>::value> >
+ : true_type {};
#else
template <class _Yp, class _Tp>
-struct __raw_pointer_compatible_with
- : is_convertible<_Yp*, _Tp*> {};
+struct __raw_pointer_compatible_with : is_convertible<_Yp*, _Tp*> {};
#endif // _LIBCPP_STD_VER >= 17
-
template <class _Ptr, class = void>
-struct __is_deletable : false_type { };
+struct __is_deletable : false_type {};
template <class _Ptr>
-struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type { };
+struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type {};
template <class _Ptr, class = void>
-struct __is_array_deletable : false_type { };
+struct __is_array_deletable : false_type {};
template <class _Ptr>
-struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type { };
+struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type {};
-template <class _Dp, class _Pt,
- class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))>
+template <class _Dp, class _Pt, class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))>
true_type __well_formed_deleter_test(int);
template <class, class>
@@ -459,12 +395,10 @@ false_type __well_formed_deleter_test(...);
template <class _Dp, class _Pt>
struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {};
-template<class _Dp, class _Yp, class _Tp>
-struct __shared_ptr_deleter_ctor_reqs
-{
- static const bool value = __raw_pointer_compatible_with<_Yp, _Tp>::value &&
- is_move_constructible<_Dp>::value &&
- __well_formed_deleter<_Dp, _Yp*>::value;
+template <class _Dp, class _Yp, class _Tp>
+struct __shared_ptr_deleter_ctor_reqs {
+ static const bool value = __raw_pointer_compatible_with<_Yp, _Tp>::value && is_move_constructible<_Dp>::value &&
+ __well_formed_deleter<_Dp, _Yp*>::value;
};
#if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI)
@@ -473,583 +407,437 @@ struct __shared_ptr_deleter_ctor_reqs
# define _LIBCPP_SHARED_PTR_TRIVIAL_ABI
#endif
-template<class _Tp>
-class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
-{
+template <class _Tp>
+class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
public:
#if _LIBCPP_STD_VER >= 17
- typedef weak_ptr<_Tp> weak_type;
- typedef remove_extent_t<_Tp> element_type;
+ typedef weak_ptr<_Tp> weak_type;
+ typedef remove_extent_t<_Tp> element_type;
#else
- typedef _Tp element_type;
+ typedef _Tp element_type;
#endif
private:
- element_type* __ptr_;
- __shared_weak_count* __cntrl_;
+ element_type* __ptr_;
+ __shared_weak_count* __cntrl_;
public:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
- { }
-
- template<class _Yp, class = __enable_if_t<
- _And<
- __raw_pointer_compatible_with<_Yp, _Tp>
- // In C++03 we get errors when trying to do SFINAE with the
- // delete operator, so we always pretend that it's deletable.
- // The same happens on GCC.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
+
+ template <class _Yp,
+ class = __enable_if_t< _And< __raw_pointer_compatible_with<_Yp, _Tp>
+ // In C++03 we get errors when trying to do SFINAE with the
+ // delete operator, so we always pretend that it's deletable.
+ // The same happens on GCC.
#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_COMPILER_GCC)
- , _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> >
+ ,
+ _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> >
#endif
- >::value
- > >
- _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) {
- unique_ptr<_Yp> __hold(__p);
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<_Yp*, __shared_ptr_default_delete<_Tp, _Yp>, _AllocT> _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, __shared_ptr_default_delete<_Tp, _Yp>(), _AllocT());
- __hold.release();
- __enable_weak_this(__p, __p);
- }
-
- template<class _Yp, class _Dp, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(_Yp* __p, _Dp __d)
- : __ptr_(__p)
- {
+ >::value > >
+ _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) {
+ unique_ptr<_Yp> __hold(__p);
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<_Yp*, __shared_ptr_default_delete<_Tp, _Yp>, _AllocT> _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__p, __shared_ptr_default_delete<_Tp, _Yp>(), _AllocT());
+ __hold.release();
+ __enable_weak_this(__p, __p);
+ }
+
+ template <class _Yp, class _Dp, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
- __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
#else
- __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
- __enable_weak_this(__p, __p);
+ __enable_weak_this(__p, __p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(_Yp* __p, _Dp __d, _Alloc __a)
- : __ptr_(__p)
- {
+ template <class _Yp,
+ class _Dp,
+ class _Alloc,
+ class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a2(__a);
- unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
- ::new ((void*)std::addressof(*__hold2.get()))
+ typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
+ typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a2(__a);
+ unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+ ::new ((void*)std::addressof(*__hold2.get()))
#ifndef _LIBCPP_CXX03_LANG
- _CntrlBlk(__p, std::move(__d), __a);
+ _CntrlBlk(__p, std::move(__d), __a);
#else
- _CntrlBlk(__p, __d, __a);
+ _CntrlBlk(__p, __d, __a);
#endif // not _LIBCPP_CXX03_LANG
- __cntrl_ = std::addressof(*__hold2.release());
- __enable_weak_this(__p, __p);
+ __cntrl_ = std::addressof(*__hold2.release());
+ __enable_weak_this(__p, __p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Dp>
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(nullptr_t __p, _Dp __d)
- : __ptr_(nullptr)
- {
+ template <class _Dp>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(nullptr_t __p, _Dp __d) : __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
- typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
+ typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+ typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
- __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT());
#else
- __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
+ __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Dp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
- : __ptr_(nullptr)
- {
+ template <class _Dp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) : __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
- typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a2(__a);
- unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
- ::new ((void*)std::addressof(*__hold2.get()))
+ typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
+ typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a2(__a);
+ unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
+ ::new ((void*)std::addressof(*__hold2.get()))
#ifndef _LIBCPP_CXX03_LANG
- _CntrlBlk(__p, std::move(__d), __a);
+ _CntrlBlk(__p, std::move(__d), __a);
#else
- _CntrlBlk(__p, __d, __a);
+ _CntrlBlk(__p, __d, __a);
#endif // not _LIBCPP_CXX03_LANG
- __cntrl_ = std::addressof(*__hold2.release());
+ __cntrl_ = std::addressof(*__hold2.release());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __d(__p);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __d(__p);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
- template<class _Yp>
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT
- : __ptr_(__p),
- __cntrl_(__r.__cntrl_)
- {
- if (__cntrl_)
- __cntrl_->__add_shared();
- }
+ template <class _Yp>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT
+ : __ptr_(__p),
+ __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_shared();
+ }
// LWG-2996
// We don't backport because it is an evolutionary change.
#if _LIBCPP_STD_VER >= 20
- template <class _Yp>
- _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r, element_type* __p) noexcept
- : __ptr_(__p),
- __cntrl_(__r.__cntrl_) {
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
- }
+ template <class _Yp>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r, element_type* __p) noexcept
+ : __ptr_(__p), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(const shared_ptr& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- if (__cntrl_)
- __cntrl_->__add_shared();
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_shared();
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- if (__cntrl_)
- __cntrl_->__add_shared();
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_shared();
+ }
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(shared_ptr&& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
- {
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- explicit shared_ptr(const weak_ptr<_Yp>& __r)
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_)
- {
- if (__cntrl_ == nullptr)
- __throw_bad_weak_ptr();
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r)
+ : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) {
+ if (__cntrl_ == nullptr)
+ __throw_bad_weak_ptr();
+ }
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template<class _Yp, class = __enable_if_t<is_convertible<_Yp*, element_type*>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(auto_ptr<_Yp>&& __r)
- : __ptr_(__r.get())
- {
- typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
- __enable_weak_this(__r.get(), __r.get());
- __r.release();
- }
+ template <class _Yp, class = __enable_if_t<is_convertible<_Yp*, element_type*>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(auto_ptr<_Yp>&& __r) : __ptr_(__r.get()) {
+ typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
+ __enable_weak_this(__r.get(), __r.get());
+ __r.release();
+ }
#endif
- template <class _Yp, class _Dp, class = __enable_if_t<
- !is_lvalue_reference<_Dp>::value &&
- __compatible_with<_Yp, _Tp>::value &&
- is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(unique_ptr<_Yp, _Dp>&& __r)
- : __ptr_(__r.get())
- {
+ template <class _Yp,
+ class _Dp,
+ class = __enable_if_t< !is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) {
#if _LIBCPP_STD_VER >= 14
- if (__ptr_ == nullptr)
- __cntrl_ = nullptr;
- else
+ if (__ptr_ == nullptr)
+ __cntrl_ = nullptr;
+ else
#endif
- {
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Dp, _AllocT> _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), std::move(__r.get_deleter()), _AllocT());
- __enable_weak_this(__r.get(), __r.get());
- }
- __r.release();
- }
-
- template <class _Yp, class _Dp, class = void, class = __enable_if_t<
- is_lvalue_reference<_Dp>::value &&
- __compatible_with<_Yp, _Tp>::value &&
- is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr(unique_ptr<_Yp, _Dp>&& __r)
- : __ptr_(__r.get())
{
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, _Dp, _AllocT> _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), std::move(__r.get_deleter()), _AllocT());
+ __enable_weak_this(__r.get(), __r.get());
+ }
+ __r.release();
+ }
+
+ template <class _Yp,
+ class _Dp,
+ class = void,
+ class = __enable_if_t< is_lvalue_reference<_Dp>::value && __compatible_with<_Yp, _Tp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) {
#if _LIBCPP_STD_VER >= 14
- if (__ptr_ == nullptr)
- __cntrl_ = nullptr;
- else
+ if (__ptr_ == nullptr)
+ __cntrl_ = nullptr;
+ else
#endif
- {
- typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
- typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer,
- reference_wrapper<__libcpp_remove_reference_t<_Dp> >,
- _AllocT> _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), std::ref(__r.get_deleter()), _AllocT());
- __enable_weak_this(__r.get(), __r.get());
- }
- __r.release();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ~shared_ptr()
{
- if (__cntrl_)
- __cntrl_->__release_shared();
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer,
+ reference_wrapper<__libcpp_remove_reference_t<_Dp> >,
+ _AllocT>
+ _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), std::ref(__r.get_deleter()), _AllocT());
+ __enable_weak_this(__r.get(), __r.get());
}
+ __r.release();
+ }
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(const shared_ptr& __r) _NOEXCEPT
- {
- shared_ptr(__r).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ~shared_ptr() {
+ if (__cntrl_)
+ __cntrl_->__release_shared();
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
- {
- shared_ptr(__r).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr& __r) _NOEXCEPT {
+ shared_ptr(__r).swap(*this);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(shared_ptr&& __r) _NOEXCEPT
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT {
+ shared_ptr(__r).swap(*this);
+ return *this;
+ }
- template<class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r)
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr&& __r) _NOEXCEPT {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
+
+ template <class _Yp, class = __enable_if_t<__compatible_with<_Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r) {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template<class _Yp, class = __enable_if_t<
- !is_array<_Yp>::value &&
- is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(auto_ptr<_Yp>&& __r)
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ template <class _Yp,
+ class = __enable_if_t< !is_array<_Yp>::value &&
+ is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value > >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(auto_ptr<_Yp>&& __r) {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
#endif
- template <class _Yp, class _Dp, class = __enable_if_t<_And<
- __compatible_with<_Yp, _Tp>,
- is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>
- >::value> >
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r)
- {
- shared_ptr(std::move(__r)).swap(*this);
- return *this;
- }
+ template <
+ class _Yp,
+ class _Dp,
+ class = __enable_if_t<_And< __compatible_with<_Yp, _Tp>,
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*> >::value> >
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) {
+ shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_ptr& __r) _NOEXCEPT
- {
- std::swap(__ptr_, __r.__ptr_);
- std::swap(__cntrl_, __r.__cntrl_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_ptr& __r) _NOEXCEPT {
+ std::swap(__ptr_, __r.__ptr_);
+ std::swap(__cntrl_, __r.__cntrl_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- void reset() _NOEXCEPT
- {
- shared_ptr().swap(*this);
- }
+ _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { shared_ptr().swap(*this); }
- template<class _Yp, class = __enable_if_t<
- __raw_pointer_compatible_with<_Yp, _Tp>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- void reset(_Yp* __p)
- {
- shared_ptr(__p).swap(*this);
- }
+ template <class _Yp, class = __enable_if_t< __raw_pointer_compatible_with<_Yp, _Tp>::value > >
+ _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p) {
+ shared_ptr(__p).swap(*this);
+ }
- template<class _Yp, class _Dp, class = __enable_if_t<
- __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- void reset(_Yp* __p, _Dp __d)
- {
- shared_ptr(__p, __d).swap(*this);
- }
+ template <class _Yp, class _Dp, class = __enable_if_t< __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d) {
+ shared_ptr(__p, __d).swap(*this);
+ }
- template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<
- __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- void reset(_Yp* __p, _Dp __d, _Alloc __a)
- {
- shared_ptr(__p, __d, __a).swap(*this);
- }
+ template <class _Yp,
+ class _Dp,
+ class _Alloc,
+ class = __enable_if_t< __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d, _Alloc __a) {
+ shared_ptr(__p, __d, __a).swap(*this);
+ }
- _LIBCPP_HIDE_FROM_ABI
- element_type* get() const _NOEXCEPT
- {
- return __ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI element_type* get() const _NOEXCEPT { return __ptr_; }
- _LIBCPP_HIDE_FROM_ABI
- __add_lvalue_reference_t<element_type> operator*() const _NOEXCEPT
- {
- return *__ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator*() const _NOEXCEPT { return *__ptr_; }
- _LIBCPP_HIDE_FROM_ABI
- element_type* operator->() const _NOEXCEPT
- {
- static_assert(!is_array<_Tp>::value,
- "std::shared_ptr<T>::operator-> is only valid when T is not an array type.");
- return __ptr_;
- }
+ _LIBCPP_HIDE_FROM_ABI element_type* operator->() const _NOEXCEPT {
+ static_assert(!is_array<_Tp>::value, "std::shared_ptr<T>::operator-> is only valid when T is not an array type.");
+ return __ptr_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT
- {
- return __cntrl_ ? __cntrl_->use_count() : 0;
- }
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __cntrl_ ? __cntrl_->use_count() : 0; }
- _LIBCPP_HIDE_FROM_ABI
- bool unique() const _NOEXCEPT
- {
- return use_count() == 1;
- }
+ _LIBCPP_HIDE_FROM_ABI bool unique() const _NOEXCEPT { return use_count() == 1; }
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const _NOEXCEPT
- {
- return get() != nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return get() != nullptr; }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT
- {
- return __cntrl_ < __p.__cntrl_;
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT {
+ return __cntrl_ < __p.__cntrl_;
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT
- {
- return __cntrl_ < __p.__cntrl_;
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT {
+ return __cntrl_ < __p.__cntrl_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- bool __owner_equivalent(const shared_ptr& __p) const
- {
- return __cntrl_ == __p.__cntrl_;
- }
+ _LIBCPP_HIDE_FROM_ABI bool __owner_equivalent(const shared_ptr& __p) const { return __cntrl_ == __p.__cntrl_; }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const
- {
- static_assert(is_array<_Tp>::value,
- "std::shared_ptr<T>::operator[] is only valid when T is an array type.");
- return __ptr_[__i];
- }
+ _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const {
+ static_assert(is_array<_Tp>::value, "std::shared_ptr<T>::operator[] is only valid when T is an array type.");
+ return __ptr_[__i];
+ }
#endif
#ifndef _LIBCPP_HAS_NO_RTTI
- template <class _Dp>
- _LIBCPP_HIDE_FROM_ABI
- _Dp* __get_deleter() const _NOEXCEPT
- {
- return static_cast<_Dp*>(__cntrl_
- ? const_cast<void *>(__cntrl_->__get_deleter(typeid(_Dp)))
- : nullptr);
- }
+ template <class _Dp>
+ _LIBCPP_HIDE_FROM_ABI _Dp* __get_deleter() const _NOEXCEPT {
+ return static_cast<_Dp*>(__cntrl_ ? const_cast<void*>(__cntrl_->__get_deleter(typeid(_Dp))) : nullptr);
+ }
#endif // _LIBCPP_HAS_NO_RTTI
- template<class _Yp, class _CntrlBlk>
- _LIBCPP_HIDE_FROM_ABI
- static shared_ptr<_Tp> __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl) _NOEXCEPT
- {
- shared_ptr<_Tp> __r;
- __r.__ptr_ = __p;
- __r.__cntrl_ = __cntrl;
- __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
- return __r;
- }
+ template <class _Yp, class _CntrlBlk>
+ _LIBCPP_HIDE_FROM_ABI static shared_ptr<_Tp> __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl) _NOEXCEPT {
+ shared_ptr<_Tp> __r;
+ __r.__ptr_ = __p;
+ __r.__cntrl_ = __cntrl;
+ __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
+ return __r;
+ }
private:
- template <class _Yp, bool = is_function<_Yp>::value>
- struct __shared_ptr_default_allocator
- {
- typedef allocator<_Yp> type;
- };
-
- template <class _Yp>
- struct __shared_ptr_default_allocator<_Yp, true>
- {
- typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
- };
-
- template <class _Yp, class _OrigPtr, class = __enable_if_t<
- is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>*>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- void __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT
- {
- typedef __remove_cv_t<_Yp> _RawYp;
- if (__e && __e->__weak_this_.expired())
- {
- __e->__weak_this_ = shared_ptr<_RawYp>(*this,
- const_cast<_RawYp*>(static_cast<const _Yp*>(__ptr)));
- }
+ template <class _Yp, bool = is_function<_Yp>::value>
+ struct __shared_ptr_default_allocator {
+ typedef allocator<_Yp> type;
+ };
+
+ template <class _Yp>
+ struct __shared_ptr_default_allocator<_Yp, true> {
+ typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+ };
+
+ template <class _Yp,
+ class _OrigPtr,
+ class = __enable_if_t< is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>*>::value > >
+ _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT {
+ typedef __remove_cv_t<_Yp> _RawYp;
+ if (__e && __e->__weak_this_.expired()) {
+ __e->__weak_this_ = shared_ptr<_RawYp>(*this, const_cast<_RawYp*>(static_cast<const _Yp*>(__ptr)));
}
+ }
- _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(...) _NOEXCEPT { }
+ _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(...) _NOEXCEPT {}
- template <class, class _Yp>
- struct __shared_ptr_default_delete
- : default_delete<_Yp>
- { };
+ template <class, class _Yp>
+ struct __shared_ptr_default_delete : default_delete<_Yp> {};
- template <class _Yp, class _Un, size_t _Sz>
- struct __shared_ptr_default_delete<_Yp[_Sz], _Un>
- : default_delete<_Yp[]>
- { };
+ template <class _Yp, class _Un, size_t _Sz>
+ struct __shared_ptr_default_delete<_Yp[_Sz], _Un> : default_delete<_Yp[]> {};
- template <class _Yp, class _Un>
- struct __shared_ptr_default_delete<_Yp[], _Un>
- : default_delete<_Yp[]>
- { };
+ template <class _Yp, class _Un>
+ struct __shared_ptr_default_delete<_Yp[], _Un> : default_delete<_Yp[]> {};
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
};
#if _LIBCPP_STD_VER >= 17
-template<class _Tp>
+template <class _Tp>
shared_ptr(weak_ptr<_Tp>) -> shared_ptr<_Tp>;
-template<class _Tp, class _Dp>
+template <class _Tp, class _Dp>
shared_ptr(unique_ptr<_Tp, _Dp>) -> shared_ptr<_Tp>;
#endif
//
// std::allocate_shared and std::make_shared
//
-template<class _Tp, class _Alloc, class ..._Args, class = __enable_if_t<!is_array<_Tp>::value> >
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args)
-{
- using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>;
- using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type;
- __allocation_guard<_ControlBlockAllocator> __guard(__a, 1);
- ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__a, std::forward<_Args>(__args)...);
- auto __control_block = __guard.__release_ptr();
- return shared_ptr<_Tp>::__create_with_control_block((*__control_block).__get_elem(), std::addressof(*__control_block));
+template <class _Tp, class _Alloc, class... _Args, class = __enable_if_t<!is_array<_Tp>::value> >
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) {
+ using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>;
+ using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type;
+ __allocation_guard<_ControlBlockAllocator> __guard(__a, 1);
+ ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__a, std::forward<_Args>(__args)...);
+ auto __control_block = __guard.__release_ptr();
+ return shared_ptr<_Tp>::__create_with_control_block(
+ (*__control_block).__get_elem(), std::addressof(*__control_block));
}
-template<class _Tp, class ..._Args, class = __enable_if_t<!is_array<_Tp>::value> >
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(_Args&& ...__args)
-{
- return std::allocate_shared<_Tp>(allocator<_Tp>(), std::forward<_Args>(__args)...);
+template <class _Tp, class... _Args, class = __enable_if_t<!is_array<_Tp>::value> >
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(_Args&&... __args) {
+ return std::allocate_shared<_Tp>(allocator<_Tp>(), std::forward<_Args>(__args)...);
}
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a)
-{
- using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
- _ForOverwriteAllocator __alloc(__a);
- return std::allocate_shared<_Tp>(__alloc);
+template <class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
+ using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
+ _ForOverwriteAllocator __alloc(__a);
+ return std::allocate_shared<_Tp>(__alloc);
}
-template<class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared_for_overwrite()
-{
- return std::allocate_shared_for_overwrite<_Tp>(allocator<_Tp>());
+template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
+ return std::allocate_shared_for_overwrite<_Tp>(allocator<_Tp>());
}
#endif // _LIBCPP_STD_VER >= 20
@@ -1058,191 +846,180 @@ shared_ptr<_Tp> make_shared_for_overwrite()
template <size_t _Alignment>
struct __sp_aligned_storage {
- alignas(_Alignment) char __storage[_Alignment];
+ alignas(_Alignment) char __storage[_Alignment];
};
template <class _Tp, class _Alloc>
struct __unbounded_array_control_block;
template <class _Tp, class _Alloc>
-struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count
-{
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Tp* __get_data() noexcept { return __data_; }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count, _Tp const& __arg)
- : __alloc_(__alloc), __count_(__count)
- {
- std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::begin(__data_), __count_, __arg);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count)
- : __alloc_(__alloc), __count_(__count)
- {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- // We are purposefully not using an allocator-aware default construction because the spec says so.
- // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
- std::uninitialized_default_construct_n(std::begin(__data_), __count_);
- } else {
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
- }
-#else
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
-#endif
- }
-
- // Returns the number of bytes required to store a control block followed by the given number
- // of elements of _Tp, with the whole storage being aligned to a multiple of _Tp's alignment.
- _LIBCPP_HIDE_FROM_ABI
- static constexpr size_t __bytes_for(size_t __elements) {
- // When there's 0 elements, the control block alone is enough since it holds one element.
- // Otherwise, we allocate one fewer element than requested because the control block already
- // holds one. Also, we use the bitwise formula below to ensure that we allocate enough bytes
- // for the whole allocation to be a multiple of _Tp's alignment. That formula is taken from [1].
- //
- // [1]: https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding
- size_t __bytes = __elements == 0 ? sizeof(__unbounded_array_control_block)
- : (__elements - 1) * sizeof(_Tp) + sizeof(__unbounded_array_control_block);
- constexpr size_t __align = alignof(_Tp);
- return (__bytes + __align - 1) & ~(__align - 1);
+struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp* __get_data() noexcept { return __data_; }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __unbounded_array_control_block(
+ _Alloc const& __alloc, size_t __count, _Tp const& __arg)
+ : __alloc_(__alloc), __count_(__count) {
+ std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::begin(__data_), __count_, __arg);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count)
+ : __alloc_(__alloc), __count_(__count) {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ // We are purposefully not using an allocator-aware default construction because the spec says so.
+ // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
+ std::uninitialized_default_construct_n(std::begin(__data_), __count_);
+ } else {
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
}
+# else
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_);
+# endif
+ }
+
+ // Returns the number of bytes required to store a control block followed by the given number
+ // of elements of _Tp, with the whole storage being aligned to a multiple of _Tp's alignment.
+ _LIBCPP_HIDE_FROM_ABI static constexpr size_t __bytes_for(size_t __elements) {
+ // When there's 0 elements, the control block alone is enough since it holds one element.
+ // Otherwise, we allocate one fewer element than requested because the control block already
+ // holds one. Also, we use the bitwise formula below to ensure that we allocate enough bytes
+ // for the whole allocation to be a multiple of _Tp's alignment. That formula is taken from [1].
+ //
+ // [1]: https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding
+ size_t __bytes = __elements == 0 ? sizeof(__unbounded_array_control_block)
+ : (__elements - 1) * sizeof(_Tp) + sizeof(__unbounded_array_control_block);
+ constexpr size_t __align = alignof(_Tp);
+ return (__bytes + __align - 1) & ~(__align - 1);
+ }
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- ~__unbounded_array_control_block() override { } // can't be `= default` because of the sometimes-non-trivial union member __data_
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ ~__unbounded_array_control_block() override {
+ } // can't be `= default` because of the sometimes-non-trivial union member __data_
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- std::__reverse_destroy(__data_, __data_ + __count_);
- } else {
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
- }
-#else
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
- using _AlignedStorage = __sp_aligned_storage<alignof(__unbounded_array_control_block)>;
- using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
- using _PointerTraits = pointer_traits<typename allocator_traits<_StorageAlloc>::pointer>;
-
- _StorageAlloc __tmp(__alloc_);
- __alloc_.~_Alloc();
- size_t __size = __unbounded_array_control_block::__bytes_for(__count_);
- _AlignedStorage* __storage = reinterpret_cast<_AlignedStorage*>(this);
- allocator_traits<_StorageAlloc>::deallocate(
- __tmp, _PointerTraits::pointer_to(*__storage), __size / sizeof(_AlignedStorage));
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ std::__reverse_destroy(__data_, __data_ + __count_);
+ } else {
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
}
-
- _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
- size_t __count_;
- union {
- _Tp __data_[1];
- };
+# else
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_);
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
+ using _AlignedStorage = __sp_aligned_storage<alignof(__unbounded_array_control_block)>;
+ using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
+ using _PointerTraits = pointer_traits<typename allocator_traits<_StorageAlloc>::pointer>;
+
+ _StorageAlloc __tmp(__alloc_);
+ __alloc_.~_Alloc();
+ size_t __size = __unbounded_array_control_block::__bytes_for(__count_);
+ _AlignedStorage* __storage = reinterpret_cast<_AlignedStorage*>(this);
+ allocator_traits<_StorageAlloc>::deallocate(
+ __tmp, _PointerTraits::pointer_to(*__storage), __size / sizeof(_AlignedStorage));
+ }
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
+ size_t __count_;
+ union {
+ _Tp __data_[1];
+ };
};
-template<class _Array, class _Alloc, class... _Arg>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Array> __allocate_shared_unbounded_array(const _Alloc& __a, size_t __n, _Arg&& ...__arg)
-{
- static_assert(__libcpp_is_unbounded_array<_Array>::value);
- // We compute the number of bytes necessary to hold the control block and the
- // array elements. Then, we allocate an array of properly-aligned dummy structs
- // large enough to hold the control block and array. This allows shifting the
- // burden of aligning memory properly from us to the allocator.
- using _ControlBlock = __unbounded_array_control_block<_Array, _Alloc>;
- using _AlignedStorage = __sp_aligned_storage<alignof(_ControlBlock)>;
- using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
- __allocation_guard<_StorageAlloc> __guard(__a, _ControlBlock::__bytes_for(__n) / sizeof(_AlignedStorage));
- _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
- std::__construct_at(__control_block, __a, __n, std::forward<_Arg>(__arg)...);
- __guard.__release_ptr();
- return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
+template <class _Array, class _Alloc, class... _Arg>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Array>
+__allocate_shared_unbounded_array(const _Alloc& __a, size_t __n, _Arg&&... __arg) {
+ static_assert(__libcpp_is_unbounded_array<_Array>::value);
+ // We compute the number of bytes necessary to hold the control block and the
+ // array elements. Then, we allocate an array of properly-aligned dummy structs
+ // large enough to hold the control block and array. This allows shifting the
+ // burden of aligning memory properly from us to the allocator.
+ using _ControlBlock = __unbounded_array_control_block<_Array, _Alloc>;
+ using _AlignedStorage = __sp_aligned_storage<alignof(_ControlBlock)>;
+ using _StorageAlloc = __allocator_traits_rebind_t<_Alloc, _AlignedStorage>;
+ __allocation_guard<_StorageAlloc> __guard(__a, _ControlBlock::__bytes_for(__n) / sizeof(_AlignedStorage));
+ _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
+ std::__construct_at(__control_block, __a, __n, std::forward<_Arg>(__arg)...);
+ __guard.__release_ptr();
+ return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
}
template <class _Tp, class _Alloc>
struct __bounded_array_control_block;
template <class _Tp, size_t _Count, class _Alloc>
-struct __bounded_array_control_block<_Tp[_Count], _Alloc>
- : __shared_weak_count
-{
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Tp* __get_data() noexcept { return __data_; }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __bounded_array_control_block(_Alloc const& __alloc, _Tp const& __arg) : __alloc_(__alloc) {
- std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count, __arg);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __bounded_array_control_block(_Alloc const& __alloc) : __alloc_(__alloc) {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- // We are purposefully not using an allocator-aware default construction because the spec says so.
- // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
- std::uninitialized_default_construct_n(std::addressof(__data_[0]), _Count);
- } else {
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
- }
-#else
- std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
-#endif
+struct __bounded_array_control_block<_Tp[_Count], _Alloc> : __shared_weak_count {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp* __get_data() noexcept { return __data_; }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __bounded_array_control_block(_Alloc const& __alloc, _Tp const& __arg)
+ : __alloc_(__alloc) {
+ std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count, __arg);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI explicit __bounded_array_control_block(_Alloc const& __alloc) : __alloc_(__alloc) {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ // We are purposefully not using an allocator-aware default construction because the spec says so.
+ // There's currently no way of expressing default initialization in an allocator-aware manner anyway.
+ std::uninitialized_default_construct_n(std::addressof(__data_[0]), _Count);
+ } else {
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
}
+# else
+ std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count);
+# endif
+ }
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- ~__bounded_array_control_block() override { } // can't be `= default` because of the sometimes-non-trivial union member __data_
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ ~__bounded_array_control_block() override {
+ } // can't be `= default` because of the sometimes-non-trivial union member __data_
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
-#if _LIBCPP_STD_VER >= 20
- if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
- std::__reverse_destroy(__data_, __data_ + _Count);
- } else {
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
- }
-#else
- __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
- std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
- using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, __bounded_array_control_block>;
- using _PointerTraits = pointer_traits<typename allocator_traits<_ControlBlockAlloc>::pointer>;
-
- _ControlBlockAlloc __tmp(__alloc_);
- __alloc_.~_Alloc();
- allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), 1);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
+# if _LIBCPP_STD_VER >= 20
+ if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) {
+ std::__reverse_destroy(__data_, __data_ + _Count);
+ } else {
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
}
-
- _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
- union {
- _Tp __data_[_Count];
- };
+# else
+ __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_);
+ std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count);
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
+ using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, __bounded_array_control_block>;
+ using _PointerTraits = pointer_traits<typename allocator_traits<_ControlBlockAlloc>::pointer>;
+
+ _ControlBlockAlloc __tmp(__alloc_);
+ __alloc_.~_Alloc();
+ allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), 1);
+ }
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
+ union {
+ _Tp __data_[_Count];
+ };
};
-template<class _Array, class _Alloc, class... _Arg>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&& ...__arg)
-{
- static_assert(__libcpp_is_bounded_array<_Array>::value);
- using _ControlBlock = __bounded_array_control_block<_Array, _Alloc>;
- using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, _ControlBlock>;
+template <class _Array, class _Alloc, class... _Arg>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&&... __arg) {
+ static_assert(__libcpp_is_bounded_array<_Array>::value);
+ using _ControlBlock = __bounded_array_control_block<_Array, _Alloc>;
+ using _ControlBlockAlloc = __allocator_traits_rebind_t<_Alloc, _ControlBlock>;
- __allocation_guard<_ControlBlockAlloc> __guard(__a, 1);
- _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
- std::__construct_at(__control_block, __a, std::forward<_Arg>(__arg)...);
- __guard.__release_ptr();
- return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
+ __allocation_guard<_ControlBlockAlloc> __guard(__a, 1);
+ _ControlBlock* __control_block = reinterpret_cast<_ControlBlock*>(std::addressof(*__guard.__get()));
+ std::__construct_at(__control_block, __a, std::forward<_Arg>(__arg)...);
+ __guard.__release_ptr();
+ return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block);
}
#endif // _LIBCPP_STD_VER >= 17
@@ -1250,289 +1027,198 @@ shared_ptr<_Array> __allocate_shared_bounded_array(const _Alloc& __a, _Arg&& ...
#if _LIBCPP_STD_VER >= 20
// bounded array variants
-template<class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a)
-{
- return std::__allocate_shared_bounded_array<_Tp>(__a);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a) {
+ return std::__allocate_shared_bounded_array<_Tp>(__a);
}
-template<class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_bounded_array<_Tp>(__a, __u);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_bounded_array<_Tp>(__a, __u);
}
-template<class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a)
-{
- using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
- _ForOverwriteAllocator __alloc(__a);
- return std::__allocate_shared_bounded_array<_Tp>(__alloc);
+template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
+ using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
+ _ForOverwriteAllocator __alloc(__a);
+ return std::__allocate_shared_bounded_array<_Tp>(__alloc);
}
-template<class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared()
-{
- return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>());
+template <class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared() {
+ return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>());
}
-template<class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __u);
+template <class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __u);
}
-template<class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared_for_overwrite()
-{
- return std::__allocate_shared_bounded_array<_Tp>(allocator<__for_overwrite_tag>());
+template <class _Tp, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
+ return std::__allocate_shared_bounded_array<_Tp>(allocator<__for_overwrite_tag>());
}
// unbounded array variants
-template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(__a, __n);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n) {
+ return std::__allocate_shared_unbounded_array<_Tp>(__a, __n);
}
-template<class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u);
+template <class _Tp, class _Alloc, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, size_t __n, const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __u);
}
-template<class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n)
-{
- using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
- _ForOverwriteAllocator __alloc(__a);
- return std::__allocate_shared_unbounded_array<_Tp>(__alloc, __n);
+template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n) {
+ using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
+ _ForOverwriteAllocator __alloc(__a);
+ return std::__allocate_shared_unbounded_array<_Tp>(__alloc, __n);
}
-template<class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(size_t __n)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n);
+template <class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n) {
+ return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n);
}
-template<class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __u);
+template <class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(size_t __n, const remove_extent_t<_Tp>& __u) {
+ return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __u);
}
-template<class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp> make_shared_for_overwrite(size_t __n)
-{
- return std::__allocate_shared_unbounded_array<_Tp>(allocator<__for_overwrite_tag>(), __n);
+template <class _Tp, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite(size_t __n) {
+ return std::__allocate_shared_unbounded_array<_Tp>(allocator<__for_overwrite_tag>(), __n);
}
#endif // _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return __x.get() == __y.get();
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return __x.get() == __y.get();
}
#if _LIBCPP_STD_VER <= 17
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return !(__x == __y);
-}
-
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
-#if _LIBCPP_STD_VER <= 11
- typedef typename common_type<_Tp*, _Up*>::type _Vp;
- return less<_Vp>()(__x.get(), __y.get());
-#else
- return less<>()(__x.get(), __y.get());
-#endif
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return !(__x == __y);
+}
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+# if _LIBCPP_STD_VER <= 11
+ typedef typename common_type<_Tp*, _Up*>::type _Vp;
+ return less<_Vp>()(__x.get(), __y.get());
+# else
+ return less<>()(__x.get(), __y.get());
+# endif
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return __y < __x;
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return __y < __x;
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return !(__y < __x);
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return !(__y < __x);
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
-{
- return !(__x < __y);
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT {
+ return !(__x < __y);
}
#endif // _LIBCPP_STD_VER <= 17
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI strong_ordering
-operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept
-{
- return compare_three_way()(__x.get(), __y.get());
+template <class _Tp, class _Up>
+_LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept {
+ return compare_three_way()(__x.get(), __y.get());
}
#endif
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return !__x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return !__x;
}
#if _LIBCPP_STD_VER <= 17
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return !__x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return !__x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return less<_Tp*>()(__x.get(), nullptr);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return less<_Tp*>()(__x.get(), nullptr);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return less<_Tp*>()(nullptr, __x.get());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return less<_Tp*>()(nullptr, __x.get());
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return nullptr < __x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return nullptr < __x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return __x < nullptr;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return __x < nullptr;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return !(nullptr < __x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return !(nullptr < __x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return !(__x < nullptr);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return !(__x < nullptr);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
-{
- return !(__x < nullptr);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT {
+ return !(__x < nullptr);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
-{
- return !(nullptr < __x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT {
+ return !(nullptr < __x);
}
#endif // _LIBCPP_STD_VER <= 17
#if _LIBCPP_STD_VER >= 20
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI strong_ordering
-operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept
-{
- return compare_three_way()(__x.get(), static_cast<typename shared_ptr<_Tp>::element_type*>(nullptr));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept {
+ return compare_three_way()(__x.get(), static_cast<typename shared_ptr<_Tp>::element_type*>(nullptr));
}
#endif
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI void swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- return shared_ptr<_Tp>(__r,
- static_cast<
- typename shared_ptr<_Tp>::element_type*>(__r.get()));
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ return shared_ptr<_Tp>(__r, static_cast< typename shared_ptr<_Tp>::element_type*>(__r.get()));
}
// LWG-2996
@@ -1544,14 +1230,11 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(shared_ptr<_Up>&& __r)
}
#endif
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- typedef typename shared_ptr<_Tp>::element_type _ET;
- _ET* __p = dynamic_cast<_ET*>(__r.get());
- return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>();
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ typedef typename shared_ptr<_Tp>::element_type _ET;
+ _ET* __p = dynamic_cast<_ET*>(__r.get());
+ return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>();
}
// LWG-2996
@@ -1564,12 +1247,10 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(shared_ptr<_Up>&& __r
}
#endif
-template<class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- typedef typename shared_ptr<_Tp>::element_type _RTp;
- return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));
+template <class _Tp, class _Up>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ typedef typename shared_ptr<_Tp>::element_type _RTp;
+ return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));
}
// LWG-2996
@@ -1581,13 +1262,9 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> const_pointer_cast(shared_ptr<_Up>&& __r)
}
#endif
-template<class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
-{
- return shared_ptr<_Tp>(__r,
- reinterpret_cast<
- typename shared_ptr<_Tp>::element_type*>(__r.get()));
+template <class _Tp, class _Up>
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT {
+ return shared_ptr<_Tp>(__r, reinterpret_cast< typename shared_ptr<_Tp>::element_type*>(__r.get()));
}
// LWG-2996
@@ -1601,500 +1278,382 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(shared_ptr<_Up>&&
#ifndef _LIBCPP_HAS_NO_RTTI
-template<class _Dp, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Dp*
-get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT
-{
- return __p.template __get_deleter<_Dp>();
+template <class _Dp, class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _Dp* get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT {
+ return __p.template __get_deleter<_Dp>();
}
#endif // _LIBCPP_HAS_NO_RTTI
-template<class _Tp>
-class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr
-{
+template <class _Tp>
+class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr {
public:
#if _LIBCPP_STD_VER >= 17
- typedef remove_extent_t<_Tp> element_type;
+ typedef remove_extent_t<_Tp> element_type;
#else
- typedef _Tp element_type;
+ typedef _Tp element_type;
#endif
private:
- element_type* __ptr_;
- __shared_weak_count* __cntrl_;
+ element_type* __ptr_;
+ __shared_weak_count* __cntrl_;
public:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr(weak_ptr const& __r) _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr(weak_ptr&& __r) _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI ~weak_ptr();
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr&
- operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr&
- operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
-
- template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI weak_ptr&
- operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(weak_ptr& __r) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void reset() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- long use_count() const _NOEXCEPT
- {return __cntrl_ ? __cntrl_->use_count() : 0;}
- _LIBCPP_HIDE_FROM_ABI
- bool expired() const _NOEXCEPT
- {return __cntrl_ == nullptr || __cntrl_->use_count() == 0;}
- _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT;
- template<class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT
- {return __cntrl_ < __r.__cntrl_;}
- template<class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT
- {return __cntrl_ < __r.__cntrl_;}
-
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
- template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr const& __r) _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr&& __r) _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI ~weak_ptr();
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
+
+ template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __cntrl_ ? __cntrl_->use_count() : 0; }
+ _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT { return __cntrl_ == nullptr || __cntrl_->use_count() == 0; }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT;
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {
+ return __cntrl_ < __r.__cntrl_;
+ }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT {
+ return __cntrl_ < __r.__cntrl_;
+ }
+
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
+ template <class _Up>
+ friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
};
#if _LIBCPP_STD_VER >= 17
-template<class _Tp>
+template <class _Tp>
weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>;
#endif
-template<class _Tp>
-inline
-_LIBCPP_CONSTEXPR
-weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
-{
-}
-
-template<class _Tp>
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
-{
- if (__cntrl_)
- __cntrl_->__add_weak();
+template <class _Tp>
+inline _LIBCPP_CONSTEXPR weak_ptr<_Tp>::weak_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
+
+template <class _Tp>
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_weak();
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r)
- _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
-{
- if (__cntrl_)
- __cntrl_->__add_weak();
-}
-
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r)
- _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
-{
- shared_ptr<_Yp> __s = __r.lock();
- *this = weak_ptr<_Tp>(__s);
-}
-
-template<class _Tp>
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
- : __ptr_(__r.__ptr_),
- __cntrl_(__r.__cntrl_)
-{
- __r.__ptr_ = nullptr;
- __r.__cntrl_ = nullptr;
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ if (__cntrl_)
+ __cntrl_->__add_weak();
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r)
- _NOEXCEPT
- : __ptr_(nullptr),
- __cntrl_(nullptr)
-{
- shared_ptr<_Yp> __s = __r.lock();
- *this = weak_ptr<_Tp>(__s);
- __r.reset();
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
+ shared_ptr<_Yp> __s = __r.lock();
+ *this = weak_ptr<_Tp>(__s);
}
-template<class _Tp>
-weak_ptr<_Tp>::~weak_ptr()
-{
- if (__cntrl_)
- __cntrl_->__release_weak();
+template <class _Tp>
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
+ __r.__ptr_ = nullptr;
+ __r.__cntrl_ = nullptr;
}
-template<class _Tp>
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
-{
- weak_ptr(__r).swap(*this);
- return *this;
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
+ shared_ptr<_Yp> __s = __r.lock();
+ *this = weak_ptr<_Tp>(__s);
+ __r.reset();
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
-{
- weak_ptr(__r).swap(*this);
- return *this;
+template <class _Tp>
+weak_ptr<_Tp>::~weak_ptr() {
+ if (__cntrl_)
+ __cntrl_->__release_weak();
}
-template<class _Tp>
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
-{
- weak_ptr(std::move(__r)).swap(*this);
- return *this;
+template <class _Tp>
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT {
+ weak_ptr(__r).swap(*this);
+ return *this;
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
-{
- weak_ptr(std::move(__r)).swap(*this);
- return *this;
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT {
+ weak_ptr(__r).swap(*this);
+ return *this;
}
-template<class _Tp>
-template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
-inline
-weak_ptr<_Tp>&
-weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
-{
- weak_ptr(__r).swap(*this);
- return *this;
+template <class _Tp>
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT {
+ weak_ptr(std::move(__r)).swap(*this);
+ return *this;
}
-template<class _Tp>
-inline
-void
-weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT
-{
- std::swap(__ptr_, __r.__ptr_);
- std::swap(__cntrl_, __r.__cntrl_);
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT {
+ weak_ptr(std::move(__r)).swap(*this);
+ return *this;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+template <class _Tp>
+template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
+inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT {
+ weak_ptr(__r).swap(*this);
+ return *this;
}
-template<class _Tp>
-inline
-void
-weak_ptr<_Tp>::reset() _NOEXCEPT
-{
- weak_ptr().swap(*this);
+template <class _Tp>
+inline void weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT {
+ std::swap(__ptr_, __r.__ptr_);
+ std::swap(__cntrl_, __r.__cntrl_);
}
-template<class _Tp>
-shared_ptr<_Tp>
-weak_ptr<_Tp>::lock() const _NOEXCEPT
-{
- shared_ptr<_Tp> __r;
- __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_;
- if (__r.__cntrl_)
- __r.__ptr_ = __ptr_;
- return __r;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT {
+ __x.swap(__y);
+}
+
+template <class _Tp>
+inline void weak_ptr<_Tp>::reset() _NOEXCEPT {
+ weak_ptr().swap(*this);
+}
+
+template <class _Tp>
+shared_ptr<_Tp> weak_ptr<_Tp>::lock() const _NOEXCEPT {
+ shared_ptr<_Tp> __r;
+ __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_;
+ if (__r.__cntrl_)
+ __r.__ptr_ = __ptr_;
+ return __r;
}
#if _LIBCPP_STD_VER >= 17
-template <class _Tp = void> struct owner_less;
+template <class _Tp = void>
+struct owner_less;
#else
-template <class _Tp> struct owner_less;
+template <class _Tp>
+struct owner_less;
#endif
-
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> >
- : __binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
-{
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
+struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> > : __binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool> {
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> >
- : __binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
-{
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
+struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> > : __binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool> {
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
};
#if _LIBCPP_STD_VER >= 17
template <>
-struct _LIBCPP_TEMPLATE_VIS owner_less<void>
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
- {return __x.owner_before(__y);}
- typedef void is_transparent;
+struct _LIBCPP_TEMPLATE_VIS owner_less<void> {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {
+ return __x.owner_before(__y);
+ }
+ typedef void is_transparent;
};
#endif
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS enable_shared_from_this
-{
- mutable weak_ptr<_Tp> __weak_this_;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS enable_shared_from_this {
+ mutable weak_ptr<_Tp> __weak_this_;
+
protected:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- enable_shared_from_this() _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI
- enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI
- enable_shared_from_this& operator=(enable_shared_from_this const&) _NOEXCEPT
- {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- ~enable_shared_from_this() {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR enable_shared_from_this() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI enable_shared_from_this& operator=(enable_shared_from_this const&) _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ~enable_shared_from_this() {}
+
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp> shared_from_this()
- {return shared_ptr<_Tp>(__weak_this_);}
- _LIBCPP_HIDE_FROM_ABI
- shared_ptr<_Tp const> shared_from_this() const
- {return shared_ptr<const _Tp>(__weak_this_);}
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> shared_from_this() { return shared_ptr<_Tp>(__weak_this_); }
+ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp const> shared_from_this() const { return shared_ptr<const _Tp>(__weak_this_); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr<_Tp> weak_from_this() _NOEXCEPT
- { return __weak_this_; }
+ _LIBCPP_HIDE_FROM_ABI weak_ptr<_Tp> weak_from_this() _NOEXCEPT { return __weak_this_; }
- _LIBCPP_HIDE_FROM_ABI
- weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT
- { return __weak_this_; }
+ _LIBCPP_HIDE_FROM_ABI weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT { return __weak_this_; }
#endif // _LIBCPP_STD_VER >= 17
- template <class _Up> friend class shared_ptr;
+ template <class _Up>
+ friend class shared_ptr;
};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash;
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> >
-{
+struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> > {
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef shared_ptr<_Tp> argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef shared_ptr<_Tp> argument_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT
- {
- return hash<typename shared_ptr<_Tp>::element_type*>()(__ptr.get());
- }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT {
+ return hash<typename shared_ptr<_Tp>::element_type*>()(__ptr.get());
+ }
};
-template<class _CharT, class _Traits, class _Yp>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
+template <class _CharT, class _Traits, class _Yp>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
-
#if !defined(_LIBCPP_HAS_NO_THREADS)
-class _LIBCPP_EXPORTED_FROM_ABI __sp_mut
-{
- void* __lx_;
+class _LIBCPP_EXPORTED_FROM_ABI __sp_mut {
+ void* __lx_;
+
public:
- void lock() _NOEXCEPT;
- void unlock() _NOEXCEPT;
+ void lock() _NOEXCEPT;
+ void unlock() _NOEXCEPT;
private:
- _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT;
- __sp_mut(const __sp_mut&);
- __sp_mut& operator=(const __sp_mut&);
+ _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT;
+ __sp_mut(const __sp_mut&);
+ __sp_mut& operator=(const __sp_mut&);
- friend _LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*);
+ friend _LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*);
};
_LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*);
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_is_lock_free(const shared_ptr<_Tp>*)
-{
- return false;
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const shared_ptr<_Tp>*) {
+ return false;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-atomic_load(const shared_ptr<_Tp>* __p)
-{
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- shared_ptr<_Tp> __q = *__p;
- __m.unlock();
- return __q;
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) {
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ shared_ptr<_Tp> __q = *__p;
+ __m.unlock();
+ return __q;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
-{
- return std::atomic_load(__p);
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) {
+ return std::atomic_load(__p);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI void
-atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
-{
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- __p->swap(__r);
- __m.unlock();
+_LIBCPP_HIDE_FROM_ABI void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) {
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ __p->swap(__r);
+ __m.unlock();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
-{
- std::atomic_store(__p, __r);
+inline _LIBCPP_HIDE_FROM_ABI void atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) {
+ std::atomic_store(__p, __r);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
-atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
-{
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- __p->swap(__r);
- __m.unlock();
- return __r;
+_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) {
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ __p->swap(__r);
+ __m.unlock();
+ return __r;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-shared_ptr<_Tp>
-atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
-{
- return std::atomic_exchange(__p, __r);
+inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
+atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) {
+ return std::atomic_exchange(__p, __r);
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI bool
-atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
-{
- shared_ptr<_Tp> __temp;
- __sp_mut& __m = std::__get_sp_mut(__p);
- __m.lock();
- if (__p->__owner_equivalent(*__v))
- {
- std::swap(__temp, *__p);
- *__p = __w;
- __m.unlock();
- return true;
- }
- std::swap(__temp, *__v);
- *__v = *__p;
+atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) {
+ shared_ptr<_Tp> __temp;
+ __sp_mut& __m = std::__get_sp_mut(__p);
+ __m.lock();
+ if (__p->__owner_equivalent(*__v)) {
+ std::swap(__temp, *__p);
+ *__p = __w;
__m.unlock();
- return false;
+ return true;
+ }
+ std::swap(__temp, *__v);
+ *__v = *__p;
+ __m.unlock();
+ return false;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
-{
- return std::atomic_compare_exchange_strong(__p, __v, __w);
+inline _LIBCPP_HIDE_FROM_ABI bool
+atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) {
+ return std::atomic_compare_exchange_strong(__p, __v, __w);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
- shared_ptr<_Tp> __w, memory_order, memory_order)
-{
- return std::atomic_compare_exchange_strong(__p, __v, __w);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(
+ shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) {
+ return std::atomic_compare_exchange_strong(__p, __v, __w);
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
- shared_ptr<_Tp> __w, memory_order, memory_order)
-{
- return std::atomic_compare_exchange_weak(__p, __v, __w);
+inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
+ shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) {
+ return std::atomic_compare_exchange_weak(__p, __v, __w);
}
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
diff --git a/contrib/llvm-project/libcxx/include/__memory/temp_value.h b/contrib/llvm-project/libcxx/include/__memory/temp_value.h
index 3ce8b4bcbb37..4a133b3fbcf6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/temp_value.h
+++ b/contrib/llvm-project/libcxx/include/__memory/temp_value.h
@@ -23,32 +23,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Alloc>
struct __temp_value {
- typedef allocator_traits<_Alloc> _Traits;
+ typedef allocator_traits<_Alloc> _Traits;
#ifdef _LIBCPP_CXX03_LANG
- typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v;
+ typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v;
#else
- union { _Tp __v; };
+ union {
+ _Tp __v;
+ };
#endif
- _Alloc &__a;
+ _Alloc& __a;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp *__addr() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* __addr() {
#ifdef _LIBCPP_CXX03_LANG
- return reinterpret_cast<_Tp*>(std::addressof(__v));
+ return reinterpret_cast<_Tp*>(std::addressof(__v));
#else
- return std::addressof(__v);
+ return std::addressof(__v);
#endif
- }
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp & get() { return *__addr(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& get() { return *__addr(); }
- template<class... _Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) {
- _Traits::construct(__a, __addr(), std::forward<_Args>(__args)...);
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_CONSTEXPR_SINCE_CXX20 __temp_value(_Alloc& __alloc, _Args&&... __args)
+ : __a(__alloc) {
+ _Traits::construct(__a, __addr(), std::forward<_Args>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__temp_value() { _Traits::destroy(__a, __addr()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__temp_value() { _Traits::destroy(__a, __addr()); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h b/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h
index 28ef5d028bec..d46bda382152 100644
--- a/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h
+++ b/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h
@@ -23,62 +23,52 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17
-pair<_Tp*, ptrdiff_t>
-get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
-{
- pair<_Tp*, ptrdiff_t> __r(0, 0);
- const ptrdiff_t __m = (~ptrdiff_t(0) ^
- ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1)))
- / sizeof(_Tp);
- if (__n > __m)
- __n = __m;
- while (__n > 0)
- {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t>
+get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT {
+ pair<_Tp*, ptrdiff_t> __r(0, 0);
+ const ptrdiff_t __m =
+ (~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1))) / sizeof(_Tp);
+ if (__n > __m)
+ __n = __m;
+ while (__n > 0) {
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
- if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp)))
- {
- align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp));
- __r.first = static_cast<_Tp*>(::operator new(
- __n * sizeof(_Tp), __al, nothrow));
- } else {
- __r.first = static_cast<_Tp*>(::operator new(
- __n * sizeof(_Tp), nothrow));
- }
+ if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
+ align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp));
+ __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), __al, nothrow));
+ } else {
+ __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
+ }
#else
- if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp)))
- {
- // Since aligned operator new is unavailable, return an empty
- // buffer rather than one with invalid alignment.
- return __r;
- }
+ if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
+ // Since aligned operator new is unavailable, return an empty
+ // buffer rather than one with invalid alignment.
+ return __r;
+ }
- __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
+ __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
#endif
- if (__r.first)
- {
- __r.second = __n;
- break;
- }
- __n /= 2;
+ if (__r.first) {
+ __r.second = __n;
+ break;
}
- return __r;
+ __n /= 2;
+ }
+ return __r;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17
-void return_temporary_buffer(_Tp* __p) _NOEXCEPT
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 void return_temporary_buffer(_Tp* __p) _NOEXCEPT {
std::__libcpp_deallocate_unsized((void*)__p, _LIBCPP_ALIGNOF(_Tp));
}
-struct __return_temporary_buffer
-{
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) const {std::return_temporary_buffer(__p);}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+struct __return_temporary_buffer {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) const {
+ std::return_temporary_buffer(__p);
+ }
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h
index b0eb7001598b..2a4ecf655be2 100644
--- a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h
+++ b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h
@@ -73,9 +73,8 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
}
template <class _InputIterator, class _ForwardIterator>
-_LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast,
- _ForwardIterator __ofirst) {
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) {
typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
auto __result = std::__uninitialized_copy<_ValueType>(
std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false());
@@ -85,8 +84,8 @@ _ForwardIterator uninitialized_copy(_InputIterator __ifirst, _InputIterator __il
// uninitialized_copy_n
template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate>
-inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy_n(
- _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
+inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
+__uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
_ForwardIterator __idx = __ofirst;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
@@ -104,8 +103,8 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
}
template <class _InputIterator, class _Size, class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_copy_n(_InputIterator __ifirst, _Size __n,
- _ForwardIterator __ofirst) {
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) {
typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
auto __result =
std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __always_false());
@@ -115,67 +114,57 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_copy_n(_InputIterato
// uninitialized_fill
template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x)
-{
- _ForwardIterator __idx = __first;
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) {
+ _ForwardIterator __idx = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- for (; __idx != __last; ++__idx)
- ::new (std::__voidify(*__idx)) _ValueType(__x);
+ for (; __idx != __last; ++__idx)
+ ::new (std::__voidify(*__idx)) _ValueType(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- std::__destroy(__first, __idx);
- throw;
- }
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
#endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
- (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x);
+inline _LIBCPP_HIDE_FROM_ABI void
+uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
+ (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x);
}
// uninitialized_fill_n
template <class _ValueType, class _ForwardIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
-{
- _ForwardIterator __idx = __first;
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
+ _ForwardIterator __idx = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- for (; __n > 0; ++__idx, (void) --__n)
- ::new (std::__voidify(*__idx)) _ValueType(__x);
+ for (; __n > 0; ++__idx, (void)--__n)
+ ::new (std::__voidify(*__idx)) _ValueType(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- std::__destroy(__first, __idx);
- throw;
- }
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
#endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
-{
- typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
- return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x);
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
+ return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x);
}
#if _LIBCPP_STD_VER >= 17
@@ -183,115 +172,107 @@ _ForwardIterator uninitialized_fill_n(_ForwardIterator __first, _Size __n, const
// uninitialized_default_construct
template <class _ValueType, class _ForwardIterator, class _Sentinel>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
for (; __idx != __last; ++__idx)
- ::new (std::__voidify(*__idx)) _ValueType;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+ ::new (std::__voidify(*__idx)) _ValueType;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- (void)std::__uninitialized_default_construct<_ValueType>(
- std::move(__first), std::move(__last));
+inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ (void)std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last));
}
// uninitialized_default_construct_n
template <class _ValueType, class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
- for (; __n > 0; ++__idx, (void) --__n)
- ::new (std::__voidify(*__idx)) _ValueType;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
+ for (; __n > 0; ++__idx, (void)--__n)
+ ::new (std::__voidify(*__idx)) _ValueType;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
}
// uninitialized_value_construct
template <class _ValueType, class _ForwardIterator, class _Sentinel>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+__uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
for (; __idx != __last; ++__idx)
- ::new (std::__voidify(*__idx)) _ValueType();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+ ::new (std::__voidify(*__idx)) _ValueType();
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI
-void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- (void)std::__uninitialized_value_construct<_ValueType>(
- std::move(__first), std::move(__last));
+inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ (void)std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last));
}
// uninitialized_value_construct_n
template <class _ValueType, class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
- auto __idx = __first;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
- for (; __n > 0; ++__idx, (void) --__n)
- ::new (std::__voidify(*__idx)) _ValueType();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- std::__destroy(__first, __idx);
- throw;
- }
-#endif
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
+ auto __idx = __first;
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
+ for (; __n > 0; ++__idx, (void)--__n)
+ ::new (std::__voidify(*__idx)) _ValueType();
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ std::__destroy(__first, __idx);
+ throw;
+ }
+# endif
- return __idx;
+ return __idx;
}
template <class _ForwardIterator, class _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
- using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
+ return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
}
// uninitialized_move
@@ -309,25 +290,25 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
_EndPredicate __stop_moving,
_IterMove __iter_move) {
auto __idx = __ofirst;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-#endif
+# endif
for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) {
::new (std::__voidify(*__idx)) _ValueType(__iter_move(__ifirst));
}
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
}
-#endif
+# endif
return {std::move(__ifirst), std::move(__idx)};
}
template <class _InputIterator, class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast,
- _ForwardIterator __ofirst) {
+inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
+uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) {
using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); };
@@ -347,17 +328,17 @@ template <class _ValueType,
inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move_n(
_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) {
auto __idx = __ofirst;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-#endif
+# endif
for (; __n > 0 && !__stop_moving(__idx); ++__idx, (void)++__ifirst, --__n)
::new (std::__voidify(*__idx)) _ValueType(__iter_move(__ifirst));
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
}
-#endif
+# endif
return {std::move(__ifirst), std::move(__idx)};
}
@@ -379,35 +360,35 @@ uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofir
//
// This function assumes that destructors do not throw, and that the allocator is bound to
// the correct type.
-template<class _Alloc, class _BidirIter, class = __enable_if_t<
- __has_bidirectional_iterator_category<_BidirIter>::value
->>
-_LIBCPP_HIDE_FROM_ABI
-constexpr void __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept {
- using _ValueType = typename iterator_traits<_BidirIter>::value_type;
- static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>,
- "The allocator should already be rebound to the correct type");
-
- if (__first == __last)
- return;
-
- if constexpr (is_array_v<_ValueType>) {
- static_assert(!__libcpp_is_unbounded_array<_ValueType>::value,
- "arrays of unbounded arrays don't exist, but if they did we would mess up here");
-
- using _Element = remove_extent_t<_ValueType>;
- __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
- do {
- --__last;
- decltype(auto) __array = *__last;
- std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>);
- } while (__last != __first);
- } else {
- do {
- --__last;
- allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last));
- } while (__last != __first);
- }
+template <class _Alloc,
+ class _BidirIter,
+ class = __enable_if_t< __has_bidirectional_iterator_category<_BidirIter>::value >>
+_LIBCPP_HIDE_FROM_ABI constexpr void
+__allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept {
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
+ static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>,
+ "The allocator should already be rebound to the correct type");
+
+ if (__first == __last)
+ return;
+
+ if constexpr (is_array_v<_ValueType>) {
+ static_assert(!__libcpp_is_unbounded_array<_ValueType>::value,
+ "arrays of unbounded arrays don't exist, but if they did we would mess up here");
+
+ using _Element = remove_extent_t<_ValueType>;
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
+ do {
+ --__last;
+ decltype(auto) __array = *__last;
+ std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>);
+ } while (__last != __first);
+ } else {
+ do {
+ --__last;
+ allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last));
+ } while (__last != __first);
+ }
}
// Constructs the object at the given location using the allocator's construct method.
@@ -417,30 +398,29 @@ constexpr void __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter
// elements are destroyed in reverse order of initialization using allocator destruction.
//
// This function assumes that the allocator is bound to the correct type.
-template<class _Alloc, class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) {
- static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
- "The allocator should already be rebound to the correct type");
-
- if constexpr (is_array_v<_Tp>) {
- using _Element = remove_extent_t<_Tp>;
- __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
- size_t __i = 0;
- _Tp& __array = *__loc;
-
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() {
- std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
- });
-
- for (; __i != extent_v<_Tp>; ++__i) {
- std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]));
- }
- __guard.__complete();
- } else {
- allocator_traits<_Alloc>::construct(__alloc, __loc);
+template <class _Alloc, class _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) {
+ static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
+ "The allocator should already be rebound to the correct type");
+
+ if constexpr (is_array_v<_Tp>) {
+ using _Element = remove_extent_t<_Tp>;
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
+ size_t __i = 0;
+ _Tp& __array = *__loc;
+
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard = std::__make_exception_guard([&]() {
+ std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
+ });
+
+ for (; __i != extent_v<_Tp>; ++__i) {
+ std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]));
}
+ __guard.__complete();
+ } else {
+ allocator_traits<_Alloc>::construct(__alloc, __loc);
+ }
}
// Constructs the object at the given location using the allocator's construct method, passing along
@@ -453,33 +433,33 @@ constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* _
// destruction.
//
// This function assumes that the allocator is bound to the correct type.
-template<class _Alloc, class _Tp, class _Arg>
-_LIBCPP_HIDE_FROM_ABI
-constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) {
- static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
- "The allocator should already be rebound to the correct type");
-
- if constexpr (is_array_v<_Tp>) {
- static_assert(is_array_v<_Arg>,
- "Provided non-array initialization argument to __allocator_construct_at_multidimensional when "
- "trying to construct an array.");
-
- using _Element = remove_extent_t<_Tp>;
- __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
- size_t __i = 0;
- _Tp& __array = *__loc;
-
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() {
- std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
- });
- for (; __i != extent_v<_Tp>; ++__i) {
- std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]);
- }
- __guard.__complete();
- } else {
- allocator_traits<_Alloc>::construct(__alloc, __loc, __arg);
+template <class _Alloc, class _Tp, class _Arg>
+_LIBCPP_HIDE_FROM_ABI constexpr void
+__allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) {
+ static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
+ "The allocator should already be rebound to the correct type");
+
+ if constexpr (is_array_v<_Tp>) {
+ static_assert(is_array_v<_Arg>,
+ "Provided non-array initialization argument to __allocator_construct_at_multidimensional when "
+ "trying to construct an array.");
+
+ using _Element = remove_extent_t<_Tp>;
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
+ size_t __i = 0;
+ _Tp& __array = *__loc;
+
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard = std::__make_exception_guard([&]() {
+ std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
+ });
+ for (; __i != extent_v<_Tp>; ++__i) {
+ std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]);
}
+ __guard.__complete();
+ } else {
+ allocator_traits<_Alloc>::construct(__alloc, __loc, __arg);
+ }
}
// Given a range starting at it and containing n elements, initializes each element in the
@@ -489,19 +469,23 @@ constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* _
// If an exception is thrown, the initialized elements are destroyed in reverse order of
// initialization using allocator_traits destruction. If the elements in the range are C-style
// arrays, they are initialized element-wise using allocator construction, and recursively so.
-template<class _Alloc, class _BidirIter, class _Tp, class _Size = typename iterator_traits<_BidirIter>::difference_type>
+template <class _Alloc,
+ class _BidirIter,
+ class _Tp,
+ class _Size = typename iterator_traits<_BidirIter>::difference_type>
_LIBCPP_HIDE_FROM_ABI constexpr void
__uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) {
- using _ValueType = typename iterator_traits<_BidirIter>::value_type;
- __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
- _BidirIter __begin = __it;
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
+ __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
+ _BidirIter __begin = __it;
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
- for (; __n != 0; --__n, ++__it) {
- std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value);
- }
- __guard.__complete();
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard =
+ std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
+ for (; __n != 0; --__n, ++__it) {
+ std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value);
+ }
+ __guard.__complete();
}
// Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument
@@ -509,16 +493,17 @@ __uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __
template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type>
_LIBCPP_HIDE_FROM_ABI constexpr void
__uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n) {
- using _ValueType = typename iterator_traits<_BidirIter>::value_type;
- __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
- _BidirIter __begin = __it;
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
+ __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
+ _BidirIter __begin = __it;
- // If an exception is thrown, destroy what we have constructed so far in reverse order.
- auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
- for (; __n != 0; --__n, ++__it) {
- std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it));
- }
- __guard.__complete();
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
+ auto __guard =
+ std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
+ for (; __n != 0; --__n, ++__it) {
+ std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it));
+ }
+ __guard.__complete();
}
#endif // _LIBCPP_STD_VER >= 17
@@ -528,7 +513,7 @@ template <class _Alloc, class _Iter, class _Sent>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__allocator_destroy(_Alloc& __alloc, _Iter __first, _Sent __last) {
for (; __first != __last; ++__first)
- allocator_traits<_Alloc>::destroy(__alloc, std::__to_address(__first));
+ allocator_traits<_Alloc>::destroy(__alloc, std::__to_address(__first));
}
template <class _Alloc, class _Iter>
@@ -598,10 +583,12 @@ __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out*
}
template <class _Alloc, class _Iter1, class _Sent1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 __uninitialized_allocator_copy(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
- auto __unwrapped_range = std::__unwrap_range(__first1, __last1);
- auto __result = std::__uninitialized_allocator_copy_impl(__alloc, __unwrapped_range.first, __unwrapped_range.second, std::__unwrap_iter(__first2));
- return std::__rewrap_iter(__first2, __result);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2
+__uninitialized_allocator_copy(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
+ auto __unwrapped_range = std::__unwrap_range(__first1, __last1);
+ auto __result = std::__uninitialized_allocator_copy_impl(
+ __alloc, __unwrapped_range.first, __unwrapped_range.second, std::__unwrap_iter(__first2));
+ return std::__rewrap_iter(__first2, __result);
}
// Move-construct the elements [__first1, __last1) into [__first2, __first2 + N)
@@ -610,8 +597,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 __uninitialized_alloc
// Otherwise try to copy all elements. If an exception is thrown the already copied
// elements are destroyed in reverse order of their construction.
template <class _Alloc, class _Iter1, class _Sent1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2 __uninitialized_allocator_move_if_noexcept(
- _Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter2
+__uninitialized_allocator_move_if_noexcept(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
static_assert(__is_cpp17_move_insertable<_Alloc>::value,
"The specified type does not meet the requirements of Cpp17MoveInsertable");
auto __destruct_first = __first2;
diff --git a/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h b/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h
index 32e4942a834c..7bf5e3c5e4e6 100644
--- a/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h
+++ b/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h
@@ -51,16 +51,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS default_delete {
- static_assert(!is_function<_Tp>::value,
- "default_delete cannot be instantiated for function types");
+ static_assert(!is_function<_Tp>::value, "default_delete cannot be instantiated for function types");
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI constexpr default_delete() _NOEXCEPT = default;
#else
_LIBCPP_HIDE_FROM_ABI default_delete() {}
#endif
template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete(
- const default_delete<_Up>&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete(const default_delete<_Up>&) _NOEXCEPT {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) const _NOEXCEPT {
static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
@@ -73,8 +71,7 @@ template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> {
private:
template <class _Up>
- struct _EnableIfConvertible
- : enable_if<is_convertible<_Up(*)[], _Tp(*)[]>::value> {};
+ struct _EnableIfConvertible : enable_if<is_convertible<_Up (*)[], _Tp (*)[]>::value> {};
public:
#ifndef _LIBCPP_CXX03_LANG
@@ -130,65 +127,52 @@ public:
typedef _Dp deleter_type;
typedef _LIBCPP_NODEBUG typename __pointer<_Tp, deleter_type>::type pointer;
- static_assert(!is_rvalue_reference<deleter_type>::value,
- "the specified deleter type cannot be an rvalue reference");
+ static_assert(!is_rvalue_reference<deleter_type>::value, "the specified deleter type cannot be an rvalue reference");
private:
__compressed_pair<pointer, deleter_type> __ptr_;
- struct __nat { int __for_bool_; };
+ struct __nat {
+ int __for_bool_;
+ };
typedef _LIBCPP_NODEBUG __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
template <bool _Dummy>
- using _LValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
+ using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
template <bool _Dummy>
- using _GoodRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
+ using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
template <bool _Dummy>
- using _BadRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
+ using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
- template <bool _Dummy, class _Deleter = typename __dependent_type<
- __type_identity<deleter_type>, _Dummy>::type>
+ template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_default_constructible<_Deleter>::value &&
- !is_pointer<_Deleter>::value>;
+ __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;
template <class _ArgType>
- using _EnableIfDeleterConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
+ using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
template <class _UPtr, class _Up>
- using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t<
- is_convertible<typename _UPtr::pointer, pointer>::value &&
- !is_array<_Up>::value
- >;
+ using _EnableIfMoveConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value >;
template <class _UDel>
- using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t<
- (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
- (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
- >;
+ using _EnableIfDeleterConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
+ (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >;
template <class _UDel>
- using _EnableIfDeleterAssignable = __enable_if_t<
- is_assignable<_Dp&, _UDel&&>::value
- >;
+ using _EnableIfDeleterAssignable = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >;
public:
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
+ : __ptr_(__value_init_tag(), __value_init_tag()) {}
template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT
@@ -199,16 +183,13 @@ public:
: __ptr_(__p, __d) {}
template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(__p, std::move(__d)) {
- static_assert(!is_reference<deleter_type>::value,
- "rvalue deleter bound to reference");
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
+ : __ptr_(__p, std::move(__d)) {
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}
- template <bool _Dummy = true,
- class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
+ template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
+ _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
: __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {}
@@ -221,11 +202,9 @@ public:
: __ptr_(__u.release(), std::forward<_Ep>(__u.get_deleter())) {}
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value &&
- is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr(auto_ptr<_Up>&& __p) _NOEXCEPT
- : __ptr_(__p.release(), __value_init_tag()) {}
+ template <class _Up,
+ __enable_if_t<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI unique_ptr(auto_ptr<_Up>&& __p) _NOEXCEPT : __ptr_(__p.release(), __value_init_tag()) {}
#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
@@ -245,18 +224,16 @@ public:
}
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
- template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value &&
- is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr&
- operator=(auto_ptr<_Up> __p) {
+ template <class _Up,
+ __enable_if_t<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI unique_ptr& operator=(auto_ptr<_Up> __p) {
reset(__p.release());
return *this;
}
#endif
#ifdef _LIBCPP_CXX03_LANG
- unique_ptr(unique_ptr const&) = delete;
+ unique_ptr(unique_ptr const&) = delete;
unique_ptr& operator=(unique_ptr const&) = delete;
#endif
@@ -270,13 +247,9 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const {
return *__ptr_.first();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT {
- return __ptr_.first();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { return __ptr_.first(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT {
- return __ptr_.second();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT {
return __ptr_.second();
}
@@ -285,24 +258,21 @@ public:
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT {
- pointer __t = __ptr_.first();
+ pointer __t = __ptr_.first();
__ptr_.first() = pointer();
return __t;
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(pointer __p = pointer()) _NOEXCEPT {
- pointer __tmp = __ptr_.first();
+ pointer __tmp = __ptr_.first();
__ptr_.first() = __p;
if (__tmp)
__ptr_.second()(__tmp);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT {
- __ptr_.swap(__u.__ptr_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); }
};
-
template <class _Tp, class _Dp>
class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> {
public:
@@ -319,71 +289,52 @@ private:
template <class _FromElem>
struct _CheckArrayPointerConversion<_FromElem*>
: integral_constant<bool,
- is_same<_FromElem*, pointer>::value ||
- (is_same<pointer, element_type*>::value &&
- is_convertible<_FromElem(*)[], element_type(*)[]>::value)
- >
- {};
+ is_same<_FromElem*, pointer>::value ||
+ (is_same<pointer, element_type*>::value &&
+ is_convertible<_FromElem (*)[], element_type (*)[]>::value) > {};
typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
template <bool _Dummy>
- using _LValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
+ using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
template <bool _Dummy>
- using _GoodRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
+ using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
template <bool _Dummy>
- using _BadRValRefType _LIBCPP_NODEBUG =
- typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
+ using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
- template <bool _Dummy, class _Deleter = typename __dependent_type<
- __type_identity<deleter_type>, _Dummy>::type>
+ template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_default_constructible<_Deleter>::value &&
- !is_pointer<_Deleter>::value>;
+ __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;
template <class _ArgType>
- using _EnableIfDeleterConstructible _LIBCPP_NODEBUG =
- __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
+ using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
template <class _Pp>
- using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t<
- _CheckArrayPointerConversion<_Pp>::value
- >;
-
- template <class _UPtr, class _Up,
- class _ElemT = typename _UPtr::element_type>
- using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t<
- is_array<_Up>::value &&
- is_same<pointer, element_type*>::value &&
- is_same<typename _UPtr::pointer, _ElemT*>::value &&
- is_convertible<_ElemT(*)[], element_type(*)[]>::value
- >;
+ using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t< _CheckArrayPointerConversion<_Pp>::value >;
+
+ template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type>
+ using _EnableIfMoveConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< is_array<_Up>::value && is_same<pointer, element_type*>::value &&
+ is_same<typename _UPtr::pointer, _ElemT*>::value &&
+ is_convertible<_ElemT (*)[], element_type (*)[]>::value >;
template <class _UDel>
- using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t<
- (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
- (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
- >;
+ using _EnableIfDeleterConvertible _LIBCPP_NODEBUG =
+ __enable_if_t< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
+ (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >;
template <class _UDel>
- using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t<
- is_assignable<_Dp&, _UDel&&>::value
- >;
+ using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >;
public:
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
- template <bool _Dummy = true,
- class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
+ : __ptr_(__value_init_tag(), __value_init_tag()) {}
template <class _Pp,
bool _Dummy = true,
@@ -409,22 +360,20 @@ public:
class = _EnableIfPointerConvertible<_Pp> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
: __ptr_(__p, std::move(__d)) {
- static_assert(!is_reference<deleter_type>::value,
- "rvalue deleter bound to reference");
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}
template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
: __ptr_(nullptr, std::move(__d)) {
- static_assert(!is_reference<deleter_type>::value,
- "rvalue deleter bound to reference");
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
}
- template <class _Pp, bool _Dummy = true,
- class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
- class = _EnableIfPointerConvertible<_Pp> >
- _LIBCPP_HIDE_FROM_ABI
- unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
+ template <class _Pp,
+ bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
+ class = _EnableIfPointerConvertible<_Pp> >
+ _LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
: __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {}
@@ -453,9 +402,10 @@ public:
}
#ifdef _LIBCPP_CXX03_LANG
- unique_ptr(unique_ptr const&) = delete;
+ unique_ptr(unique_ptr const&) = delete;
unique_ptr& operator=(unique_ptr const&) = delete;
#endif
+
public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
@@ -464,15 +414,12 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp>
- operator[](size_t __i) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator[](size_t __i) const {
return __ptr_.first()[__i];
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT {
- return __ptr_.second();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT {
return __ptr_.second();
@@ -482,36 +429,32 @@ public:
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT {
- pointer __t = __ptr_.first();
+ pointer __t = __ptr_.first();
__ptr_.first() = pointer();
return __t;
}
template <class _Pp, __enable_if_t<_CheckArrayPointerConversion<_Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void reset(_Pp __p) _NOEXCEPT {
- pointer __tmp = __ptr_.first();
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(_Pp __p) _NOEXCEPT {
+ pointer __tmp = __ptr_.first();
__ptr_.first() = __p;
if (__tmp)
__ptr_.second()(__tmp);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(nullptr_t = nullptr) _NOEXCEPT {
- pointer __tmp = __ptr_.first();
+ pointer __tmp = __ptr_.first();
__ptr_.first() = nullptr;
if (__tmp)
__ptr_.second()(__tmp);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT {
- __ptr_.swap(__u.__ptr_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); }
};
template <class _Tp, class _Dp, __enable_if_t<__is_swappable<_Dp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void
- swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {
__x.swap(__y);
}
@@ -523,47 +466,41 @@ operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
#if _LIBCPP_STD_VER <= 17
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return !(__x == __y);
+}
#endif
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
-{
- typedef typename unique_ptr<_T1, _D1>::pointer _P1;
- typedef typename unique_ptr<_T2, _D2>::pointer _P2;
- typedef typename common_type<_P1, _P2>::type _Vp;
- return less<_Vp>()(__x.get(), __y.get());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+ typedef typename unique_ptr<_T2, _D2>::pointer _P2;
+ typedef typename common_type<_P1, _P2>::type _Vp;
+ return less<_Vp>()(__x.get(), __y.get());
}
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __y < __x;}
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return __y < __x;
+}
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__y < __x);}
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return !(__y < __x);
+}
template <class _T1, class _D1, class _T2, class _D2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);}
-
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return !(__x < __y);
+}
#if _LIBCPP_STD_VER >= 20
template <class _T1, class _D1, class _T2, class _D2>
-requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer,
- typename unique_ptr<_T2, _D2>::pointer>
+ requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
_LIBCPP_HIDE_FROM_ABI
-compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer,
- typename unique_ptr<_T2, _D2>::pointer>
-operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
- return compare_three_way()(__x.get(), __y.get());
+ compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
+ operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+ return compare_three_way()(__x.get(), __y.get());
}
#endif
@@ -575,108 +512,87 @@ operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT {
#if _LIBCPP_STD_VER <= 17
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
-{
- return !__x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT {
+ return !__x;
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
-{
- return static_cast<bool>(__x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT {
+ return static_cast<bool>(__x);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
typedef typename unique_ptr<_T1, _D1>::pointer _P1;
return less<_P1>()(__x.get(), nullptr);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
typedef typename unique_ptr<_T1, _D1>::pointer _P1;
return less<_P1>()(nullptr, __x.get());
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
return nullptr < __x;
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
return __x < nullptr;
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
return !(nullptr < __x);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
return !(__x < nullptr);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
return !(__x < nullptr);
}
template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) {
return !(nullptr < __x);
}
#if _LIBCPP_STD_VER >= 20
template <class _T1, class _D1>
- requires three_way_comparable<
- typename unique_ptr<_T1, _D1>::pointer> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer>
+ requires three_way_comparable< typename unique_ptr<_T1, _D1>::pointer>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer>
operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
- return compare_three_way()(__x.get(), static_cast<typename unique_ptr<_T1, _D1>::pointer>(nullptr));
+ return compare_three_way()(__x.get(), static_cast<typename unique_ptr<_T1, _D1>::pointer>(nullptr));
}
#endif
#if _LIBCPP_STD_VER >= 14
-template<class _Tp>
-struct __unique_if
-{
- typedef unique_ptr<_Tp> __unique_single;
+template <class _Tp>
+struct __unique_if {
+ typedef unique_ptr<_Tp> __unique_single;
};
-template<class _Tp>
-struct __unique_if<_Tp[]>
-{
- typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;
+template <class _Tp>
+struct __unique_if<_Tp[]> {
+ typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;
};
-template<class _Tp, size_t _Np>
-struct __unique_if<_Tp[_Np]>
-{
- typedef void __unique_array_known_bound;
+template <class _Tp, size_t _Np>
+struct __unique_if<_Tp[_Np]> {
+ typedef void __unique_array_known_bound;
};
template <class _Tp, class... _Args>
@@ -692,9 +608,8 @@ make_unique(size_t __n) {
return unique_ptr<_Tp>(new _Up[__n]());
}
-template<class _Tp, class... _Args>
- typename __unique_if<_Tp>::__unique_array_known_bound
- make_unique(_Args&&...) = delete;
+template <class _Tp, class... _Args>
+typename __unique_if<_Tp>::__unique_array_known_bound make_unique(_Args&&...) = delete;
#endif // _LIBCPP_STD_VER >= 14
@@ -712,32 +627,30 @@ make_unique_for_overwrite(size_t __n) {
return unique_ptr<_Tp>(new __remove_extent_t<_Tp>[__n]);
}
-template<class _Tp, class... _Args>
+template <class _Tp, class... _Args>
typename __unique_if<_Tp>::__unique_array_known_bound make_unique_for_overwrite(_Args&&...) = delete;
#endif // _LIBCPP_STD_VER >= 20
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash;
template <class _Tp, class _Dp>
#ifdef _LIBCPP_CXX03_LANG
struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >
#else
-struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<
- unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
+struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
#endif
{
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef unique_ptr<_Tp, _Dp> argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef unique_ptr<_Tp, _Dp> argument_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const
- {
- typedef typename unique_ptr<_Tp, _Dp>::pointer pointer;
- return hash<pointer>()(__ptr.get());
- }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const {
+ typedef typename unique_ptr<_Tp, _Dp>::pointer pointer;
+ return hash<pointer>()(__ptr.get());
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h b/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h
index f82ac1796383..84310c3fa567 100644
--- a/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/uses_allocator.h
@@ -21,33 +21,26 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __has_allocator_type
-{
+struct __has_allocator_type {
private:
- template <class _Up> static false_type __test(...);
- template <class _Up> static true_type __test(typename _Up::allocator_type* = 0);
+ template <class _Up>
+ static false_type __test(...);
+ template <class _Up>
+ static true_type __test(typename _Up::allocator_type* = 0);
+
public:
- static const bool value = decltype(__test<_Tp>(0))::value;
+ static const bool value = decltype(__test<_Tp>(0))::value;
};
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
-struct __uses_allocator
- : public integral_constant<bool,
- is_convertible<_Alloc, typename _Tp::allocator_type>::value>
-{
+struct __uses_allocator : public integral_constant<bool, is_convertible<_Alloc, typename _Tp::allocator_type>::value> {
};
template <class _Tp, class _Alloc>
-struct __uses_allocator<_Tp, _Alloc, false>
- : public false_type
-{
-};
+struct __uses_allocator<_Tp, _Alloc, false> : public false_type {};
template <class _Tp, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator
- : public __uses_allocator<_Tp, _Alloc>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS uses_allocator : public __uses_allocator<_Tp, _Alloc> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Alloc>
diff --git a/contrib/llvm-project/libcxx/include/__node_handle b/contrib/llvm-project/libcxx/include/__node_handle
index e680fe542c6d..24d2624c3739 100644
--- a/contrib/llvm-project/libcxx/include/__node_handle
+++ b/contrib/llvm-project/libcxx/include/__node_handle
@@ -79,175 +79,125 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _NodeType, class _Alloc>
struct __generic_container_node_destructor;
-template <class _NodeType, class _Alloc,
- template <class, class> class _MapOrSetSpecifics>
+template <class _NodeType, class _Alloc, template <class, class> class _MapOrSetSpecifics>
class _LIBCPP_TEMPLATE_VIS __basic_node_handle
- : public _MapOrSetSpecifics<
- _NodeType,
- __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>
-{
- template <class _Tp, class _Compare, class _Allocator>
- friend class __tree;
- template <class _Tp, class _Hash, class _Equal, class _Allocator>
- friend class __hash_table;
- friend struct _MapOrSetSpecifics<
- _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>;
-
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_pointer_t<typename __alloc_traits::void_pointer,
- _NodeType>
- __node_pointer_type;
+ : public _MapOrSetSpecifics< _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>> {
+ template <class _Tp, class _Compare, class _Allocator>
+ friend class __tree;
+ template <class _Tp, class _Hash, class _Equal, class _Allocator>
+ friend class __hash_table;
+ friend struct _MapOrSetSpecifics< _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>;
+
+ typedef allocator_traits<_Alloc> __alloc_traits;
+ typedef __rebind_pointer_t<typename __alloc_traits::void_pointer, _NodeType> __node_pointer_type;
public:
- typedef _Alloc allocator_type;
+ typedef _Alloc allocator_type;
private:
- __node_pointer_type __ptr_ = nullptr;
- optional<allocator_type> __alloc_;
-
- _LIBCPP_HIDE_FROM_ABI
- void __release_ptr()
- {
- __ptr_ = nullptr;
- __alloc_ = std::nullopt;
- }
+ __node_pointer_type __ptr_ = nullptr;
+ optional<allocator_type> __alloc_;
- _LIBCPP_HIDE_FROM_ABI
- void __destroy_node_pointer()
- {
- if (__ptr_ != nullptr)
- {
- typedef typename __allocator_traits_rebind<
- allocator_type, _NodeType>::type __node_alloc_type;
- __node_alloc_type __alloc(*__alloc_);
- __generic_container_node_destructor<_NodeType, __node_alloc_type>(
- __alloc, true)(__ptr_);
- __ptr_ = nullptr;
- }
- }
+ _LIBCPP_HIDE_FROM_ABI void __release_ptr() {
+ __ptr_ = nullptr;
+ __alloc_ = std::nullopt;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle(__node_pointer_type __ptr,
- allocator_type const& __alloc)
- : __ptr_(__ptr), __alloc_(__alloc)
- {
+ _LIBCPP_HIDE_FROM_ABI void __destroy_node_pointer() {
+ if (__ptr_ != nullptr) {
+ typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type;
+ __node_alloc_type __alloc(*__alloc_);
+ __generic_container_node_destructor<_NodeType, __node_alloc_type>(__alloc, true)(__ptr_);
+ __ptr_ = nullptr;
}
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
+ : __ptr_(__ptr), __alloc_(__alloc) {}
public:
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle(__basic_node_handle&& __other) noexcept
- : __ptr_(__other.__ptr_),
- __alloc_(std::move(__other.__alloc_))
- {
- __other.__ptr_ = nullptr;
- __other.__alloc_ = std::nullopt;
- }
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle() = default;
- _LIBCPP_HIDE_FROM_ABI
- __basic_node_handle& operator=(__basic_node_handle&& __other)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
- __alloc_ == std::nullopt ||
- __alloc_traits::propagate_on_container_move_assignment::value ||
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__basic_node_handle&& __other) noexcept
+ : __ptr_(__other.__ptr_), __alloc_(std::move(__other.__alloc_)) {
+ __other.__ptr_ = nullptr;
+ __other.__alloc_ = std::nullopt;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __basic_node_handle& operator=(__basic_node_handle&& __other) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value ||
__alloc_ == __other.__alloc_,
- "node_type with incompatible allocator passed to "
- "node_type::operator=(node_type&&)");
+ "node_type with incompatible allocator passed to "
+ "node_type::operator=(node_type&&)");
- __destroy_node_pointer();
- __ptr_ = __other.__ptr_;
+ __destroy_node_pointer();
+ __ptr_ = __other.__ptr_;
- if (__alloc_traits::propagate_on_container_move_assignment::value ||
- __alloc_ == std::nullopt)
- __alloc_ = std::move(__other.__alloc_);
+ if (__alloc_traits::propagate_on_container_move_assignment::value || __alloc_ == std::nullopt)
+ __alloc_ = std::move(__other.__alloc_);
- __other.__ptr_ = nullptr;
- __other.__alloc_ = std::nullopt;
+ __other.__ptr_ = nullptr;
+ __other.__alloc_ = std::nullopt;
- return *this;
- }
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const { return *__alloc_; }
-
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const { return __ptr_ != nullptr; }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const { return __ptr_ == nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(__basic_node_handle& __other) noexcept(
- __alloc_traits::propagate_on_container_swap::value ||
- __alloc_traits::is_always_equal::value)
- {
- using std::swap;
- swap(__ptr_, __other.__ptr_);
- if (__alloc_traits::propagate_on_container_swap::value ||
- __alloc_ == std::nullopt || __other.__alloc_ == std::nullopt)
- swap(__alloc_, __other.__alloc_);
- }
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return *__alloc_; }
- _LIBCPP_HIDE_FROM_ABI
- friend void swap(__basic_node_handle& __a, __basic_node_handle& __b)
- noexcept(noexcept(__a.swap(__b))) { __a.swap(__b); }
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ptr_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- ~__basic_node_handle()
- {
- __destroy_node_pointer();
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return __ptr_ == nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(__basic_node_handle& __other) noexcept(
+ __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) {
+ using std::swap;
+ swap(__ptr_, __other.__ptr_);
+ if (__alloc_traits::propagate_on_container_swap::value || __alloc_ == std::nullopt ||
+ __other.__alloc_ == std::nullopt)
+ swap(__alloc_, __other.__alloc_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend void
+ swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) {
+ __a.swap(__b);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ~__basic_node_handle() { __destroy_node_pointer(); }
};
template <class _NodeType, class _Derived>
-struct __set_node_handle_specifics
-{
- typedef typename _NodeType::__node_value_type value_type;
-
- _LIBCPP_HIDE_FROM_ABI
- value_type& value() const
- {
- return static_cast<_Derived const*>(this)->__ptr_->__get_value();
- }
+struct __set_node_handle_specifics {
+ typedef typename _NodeType::__node_value_type value_type;
+
+ _LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
};
template <class _NodeType, class _Derived>
-struct __map_node_handle_specifics
-{
- typedef typename _NodeType::__node_value_type::key_type key_type;
- typedef typename _NodeType::__node_value_type::mapped_type mapped_type;
-
- _LIBCPP_HIDE_FROM_ABI
- key_type& key() const
- {
- return static_cast<_Derived const*>(this)->
- __ptr_->__get_value().__ref().first;
- }
+struct __map_node_handle_specifics {
+ typedef typename _NodeType::__node_value_type::key_type key_type;
+ typedef typename _NodeType::__node_value_type::mapped_type mapped_type;
- _LIBCPP_HIDE_FROM_ABI
- mapped_type& mapped() const
- {
- return static_cast<_Derived const*>(this)->
- __ptr_->__get_value().__ref().second;
- }
+ _LIBCPP_HIDE_FROM_ABI key_type& key() const {
+ return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().first;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI mapped_type& mapped() const {
+ return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().second;
+ }
};
template <class _NodeType, class _Alloc>
-using __set_node_handle =
- __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>;
+using __set_node_handle = __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>;
template <class _NodeType, class _Alloc>
-using __map_node_handle =
- __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
+using __map_node_handle = __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
template <class _Iterator, class _NodeType>
-struct _LIBCPP_TEMPLATE_VIS __insert_return_type
-{
- _Iterator position;
- bool inserted;
- _NodeType node;
+struct _LIBCPP_TEMPLATE_VIS __insert_return_type {
+ _Iterator position;
+ bool inserted;
+ _NodeType node;
};
#endif // _LIBCPP_STD_VER >= 17
@@ -256,4 +206,4 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // _LIBCPP___NODE_HANDLE
+#endif // _LIBCPP___NODE_HANDLE
diff --git a/contrib/llvm-project/libcxx/include/__numeric/accumulate.h b/contrib/llvm-project/libcxx/include/__numeric/accumulate.h
index 1ab6c4b616db..fedc1c46dfd0 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/accumulate.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/accumulate.h
@@ -23,31 +23,27 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
-{
- for (; __first != __last; ++__first)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) {
+ for (; __first != __last; ++__first)
#if _LIBCPP_STD_VER >= 20
- __init = std::move(__init) + *__first;
+ __init = std::move(__init) + *__first;
#else
- __init = __init + *__first;
+ __init = __init + *__first;
#endif
- return __init;
+ return __init;
}
template <class _InputIterator, class _Tp, class _BinaryOperation>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
-{
- for (; __first != __last; ++__first)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) {
+ for (; __first != __last; ++__first)
#if _LIBCPP_STD_VER >= 20
- __init = __binary_op(std::move(__init), *__first);
+ __init = __binary_op(std::move(__init), *__first);
#else
- __init = __binary_op(__init, *__first);
+ __init = __binary_op(__init, *__first);
#endif
- return __init;
+ return __init;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h b/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h
index 31ffe9c04a1d..62b53342d9a4 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/adjacent_difference.h
@@ -24,50 +24,41 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __acc(*__first);
- *__result = __acc;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
- typename iterator_traits<_InputIterator>::value_type __val(*__first);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __acc(*__first);
+ *__result = __acc;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
+ typename iterator_traits<_InputIterator>::value_type __val(*__first);
#if _LIBCPP_STD_VER >= 20
- *__result = __val - std::move(__acc);
+ *__result = __val - std::move(__acc);
#else
- *__result = __val - __acc;
+ *__result = __val - __acc;
#endif
- __acc = std::move(__val);
- }
+ __acc = std::move(__val);
}
- return __result;
+ }
+ return __result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- _BinaryOperation __binary_op)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __acc(*__first);
- *__result = __acc;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
- typename iterator_traits<_InputIterator>::value_type __val(*__first);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator adjacent_difference(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __acc(*__first);
+ *__result = __acc;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
+ typename iterator_traits<_InputIterator>::value_type __val(*__first);
#if _LIBCPP_STD_VER >= 20
- *__result = __binary_op(__val, std::move(__acc));
+ *__result = __binary_op(__val, std::move(__acc));
#else
- *__result = __binary_op(__val, __acc);
+ *__result = __binary_op(__val, __acc);
#endif
- __acc = std::move(__val);
- }
+ __acc = std::move(__val);
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h
index 8b4a5c820dd9..af85b477dfe6 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/exclusive_scan.h
@@ -37,7 +37,7 @@ exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __
if (__first == __last)
break;
__init = std::move(__tmp);
- __tmp = __b(__init, *__first);
+ __tmp = __b(__init, *__first);
}
}
return __result;
diff --git a/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h b/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
index 693be704af29..3e9c244f25c2 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
@@ -30,65 +30,55 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs;
+template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value>
+struct __ct_abs;
template <typename _Result, typename _Source>
struct __ct_abs<_Result, _Source, true> {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- _Result operator()(_Source __t) const noexcept
- {
- if (__t >= 0) return __t;
- if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t);
- return -__t;
- }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept {
+ if (__t >= 0)
+ return __t;
+ if (__t == numeric_limits<_Source>::min())
+ return -static_cast<_Result>(__t);
+ return -__t;
+ }
};
template <typename _Result, typename _Source>
struct __ct_abs<_Result, _Source, false> {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- _Result operator()(_Source __t) const noexcept { return __t; }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept { return __t; }
};
-
-template<class _Tp>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
-_Tp __gcd(_Tp __m, _Tp __n)
-{
- static_assert((!is_signed<_Tp>::value), "");
- return __n == 0 ? __m : std::__gcd<_Tp>(__n, __m % __n);
+template <class _Tp>
+_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN _Tp __gcd(_Tp __m, _Tp __n) {
+ static_assert((!is_signed<_Tp>::value), "");
+ return __n == 0 ? __m : std::__gcd<_Tp>(__n, __m % __n);
}
-template<class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
-common_type_t<_Tp,_Up>
-gcd(_Tp __m, _Up __n)
-{
- static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
- static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to gcd cannot be bool" );
- static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to gcd cannot be bool" );
- using _Rp = common_type_t<_Tp,_Up>;
- using _Wp = make_unsigned_t<_Rp>;
- return static_cast<_Rp>(std::__gcd(
- static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)),
- static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
+template <class _Tp, class _Up>
+_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
+ static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
+ static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to gcd cannot be bool");
+ static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to gcd cannot be bool");
+ using _Rp = common_type_t<_Tp, _Up>;
+ using _Wp = make_unsigned_t<_Rp>;
+ return static_cast<_Rp>(
+ std::__gcd(static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)), static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
}
-template<class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
-common_type_t<_Tp,_Up>
-lcm(_Tp __m, _Up __n)
-{
- static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
- static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to lcm cannot be bool" );
- static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to lcm cannot be bool" );
- if (__m == 0 || __n == 0)
- return 0;
-
- using _Rp = common_type_t<_Tp,_Up>;
- _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
- _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
- _LIBCPP_ASSERT_UNCATEGORIZED((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
- return __val1 * __val2;
+template <class _Tp, class _Up>
+_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
+ static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
+ static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to lcm cannot be bool");
+ static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to lcm cannot be bool");
+ if (__m == 0 || __n == 0)
+ return 0;
+
+ using _Rp = common_type_t<_Tp, _Up>;
+ _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
+ _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
+ _LIBCPP_ASSERT_UNCATEGORIZED((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
+ return __val1 * __val2;
}
#endif // _LIBCPP_STD_VER
diff --git a/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h
index 162b9e688433..d714f102d74e 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/inclusive_scan.h
@@ -27,7 +27,7 @@ template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryO
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _Tp __init) {
for (; __first != __last; ++__first, (void)++__result) {
- __init = __b(__init, *__first);
+ __init = __b(__init, *__first);
*__result = __init;
}
return __result;
@@ -38,7 +38,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b) {
if (__first != __last) {
typename iterator_traits<_InputIterator>::value_type __init = *__first;
- *__result++ = __init;
+ *__result++ = __init;
if (++__first != __last)
return std::inclusive_scan(__first, __last, __result, __b, __init);
}
@@ -47,9 +47,8 @@ inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __
}
template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator inclusive_scan(_InputIterator __first,
- _InputIterator __last,
- _OutputIterator __result) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
return std::inclusive_scan(__first, __last, __result, std::plus<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__numeric/inner_product.h b/contrib/llvm-project/libcxx/include/__numeric/inner_product.h
index 48f2ea348987..0deab3d421b7 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/inner_product.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/inner_product.h
@@ -23,32 +23,32 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator1, class _InputIterator2, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
-{
- for (; __first1 != __last1; ++__first1, (void) ++__first2)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) {
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
#if _LIBCPP_STD_VER >= 20
- __init = std::move(__init) + *__first1 * *__first2;
+ __init = std::move(__init) + *__first1 * *__first2;
#else
- __init = __init + *__first1 * *__first2;
+ __init = __init + *__first1 * *__first2;
#endif
- return __init;
+ return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
- _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
-{
- for (; __first1 != __last1; ++__first1, (void) ++__first2)
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp inner_product(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _Tp __init,
+ _BinaryOperation1 __binary_op1,
+ _BinaryOperation2 __binary_op2) {
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
#if _LIBCPP_STD_VER >= 20
- __init = __binary_op1(std::move(__init), __binary_op2(*__first1, *__first2));
+ __init = __binary_op1(std::move(__init), __binary_op2(*__first1, *__first2));
#else
- __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
+ __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
#endif
- return __init;
+ return __init;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/iota.h b/contrib/llvm-project/libcxx/include/__numeric/iota.h
index 473ca969d8ec..27bd84e395a3 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/iota.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/iota.h
@@ -19,12 +19,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
-{
- for (; __first != __last; ++__first, (void) ++__value)
- *__first = __value;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) {
+ for (; __first != __last; ++__first, (void)++__value)
+ *__first = __value;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/midpoint.h b/contrib/llvm-project/libcxx/include/__numeric/midpoint.h
index c92e450767c9..5d715c21d8ea 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/midpoint.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/midpoint.h
@@ -35,55 +35,46 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
-midpoint(_Tp __a, _Tp __b) noexcept
-_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- using _Up = make_unsigned_t<_Tp>;
- constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
+midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ using _Up = make_unsigned_t<_Tp>;
+ constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1;
- _Up __diff = _Up(__b) - _Up(__a);
- _Up __sign_bit = __b < __a;
+ _Up __diff = _Up(__b) - _Up(__a);
+ _Up __sign_bit = __b < __a;
- _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff);
+ _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff);
- return __a + __half_diff;
+ return __a + __half_diff;
}
-
-template <class _TPtr>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<is_pointer_v<_TPtr>
- && is_object_v<remove_pointer_t<_TPtr>>
- && ! is_void_v<remove_pointer_t<_TPtr>>
- && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr>
-midpoint(_TPtr __a, _TPtr __b) noexcept
-{
- return __a + std::midpoint(ptrdiff_t(0), __b - __a);
+template <class _Tp, enable_if_t<is_object_v<_Tp> && !is_void_v<_Tp> && (sizeof(_Tp) > 0), int> = 0>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept {
+ return __a + std::midpoint(ptrdiff_t(0), __b - __a);
}
-
template <typename _Tp>
_LIBCPP_HIDE_FROM_ABI constexpr int __sign(_Tp __val) {
- return (_Tp(0) < __val) - (__val < _Tp(0));
+ return (_Tp(0) < __val) - (__val < _Tp(0));
}
template <typename _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; }
+_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) {
+ return __f >= 0 ? __f : -__f;
+}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<is_floating_point_v<_Fp>, _Fp>
-midpoint(_Fp __a, _Fp __b) noexcept
-{
- constexpr _Fp __lo = numeric_limits<_Fp>::min()*2;
- constexpr _Fp __hi = numeric_limits<_Fp>::max()/2;
- return std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi ? // typical case: overflow is impossible
- (__a + __b)/2 : // always correctly rounded
- std::__fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a
- std::__fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b
- __a/2 + __b/2; // otherwise correctly rounded
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_floating_point_v<_Fp>, _Fp> midpoint(_Fp __a, _Fp __b) noexcept {
+ constexpr _Fp __lo = numeric_limits<_Fp>::min() * 2;
+ constexpr _Fp __hi = numeric_limits<_Fp>::max() / 2;
+ return std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi
+ ? // typical case: overflow is impossible
+ (__a + __b) / 2
+ : // always correctly rounded
+ std::__fp_abs(__a) < __lo ? __a + __b / 2 : // not safe to halve a
+ std::__fp_abs(__b) < __lo ? __a / 2 + __b
+ : // not safe to halve b
+ __a / 2 + __b / 2; // otherwise correctly rounded
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h b/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h
index 49afcbb746f5..7c3cf7fb20b0 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/partial_sum.h
@@ -24,48 +24,39 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __t(*__first);
- *__result = __t;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __t(*__first);
+ *__result = __t;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
#if _LIBCPP_STD_VER >= 20
- __t = std::move(__t) + *__first;
+ __t = std::move(__t) + *__first;
#else
- __t = __t + *__first;
+ __t = __t + *__first;
#endif
- *__result = __t;
- }
+ *__result = __t;
}
- return __result;
+ }
+ return __result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
- _BinaryOperation __binary_op)
-{
- if (__first != __last)
- {
- typename iterator_traits<_InputIterator>::value_type __t(*__first);
- *__result = __t;
- for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
- {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __t(*__first);
+ *__result = __t;
+ for (++__first, (void)++__result; __first != __last; ++__first, (void)++__result) {
#if _LIBCPP_STD_VER >= 20
- __t = __binary_op(std::move(__t), *__first);
+ __t = __binary_op(std::move(__t), *__first);
#else
- __t = __binary_op(__t, *__first);
+ __t = __binary_op(__t, *__first);
#endif
- *__result = __t;
- }
+ *__result = __t;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__numeric/reduce.h b/contrib/llvm-project/libcxx/include/__numeric/reduce.h
index eb53053c26a6..1aeefce132b2 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/reduce.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/reduce.h
@@ -23,16 +23,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _Tp, class _BinaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last,
- _Tp __init, _BinaryOp __b) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) {
for (; __first != __last; ++__first)
__init = __b(std::move(__init), *__first);
return __init;
}
template <class _InputIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last,
- _Tp __init) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+reduce(_InputIterator __first, _InputIterator __last, _Tp __init) {
return std::reduce(__first, __last, __init, std::plus<>());
}
diff --git a/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h
index b8d7bd2c4463..fb88aa52cd10 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h
@@ -20,26 +20,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _InputIterator, class _OutputIterator, class _Tp,
- class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform_exclusive_scan(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Tp __init,
- _BinaryOp __b, _UnaryOp __u)
-{
- if (__first != __last)
- {
- _Tp __saved = __init;
- do
- {
- __init = __b(__init, __u(*__first));
- *__result = __saved;
- __saved = __init;
- ++__result;
- } while (++__first != __last);
- }
- return __result;
+template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_exclusive_scan(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
+ if (__first != __last) {
+ _Tp __saved = __init;
+ do {
+ __init = __b(__init, __u(*__first));
+ *__result = __saved;
+ __saved = __init;
+ ++__result;
+ } while (++__first != __last);
+ }
+ return __result;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h b/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h
index e1b818ca58e0..2eab1a142439 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h
@@ -22,33 +22,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init)
-{
- for (; __first != __last; ++__first, (void) ++__result) {
- __init = __b(__init, __u(*__first));
- *__result = __init;
- }
-
- return __result;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) {
+ for (; __first != __last; ++__first, (void)++__result) {
+ __init = __b(__init, __u(*__first));
+ *__result = __init;
+ }
+
+ return __result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _BinaryOp __b, _UnaryOp __u)
-{
- if (__first != __last) {
- typename iterator_traits<_InputIterator>::value_type __init = __u(*__first);
- *__result++ = __init;
- if (++__first != __last)
- return std::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
- }
-
- return __result;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan(
+ _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) {
+ if (__first != __last) {
+ typename iterator_traits<_InputIterator>::value_type __init = __u(*__first);
+ *__result++ = __init;
+ if (++__first != __last)
+ return std::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
+ }
+
+ return __result;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h b/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h
index 04d02b6c6a6b..6c0a81e5e4b0 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/transform_reduce.h
@@ -22,30 +22,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator __first,
- _InputIterator __last, _Tp __init,
- _BinaryOp __b, _UnaryOp __u) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
for (; __first != __last; ++__first)
__init = __b(std::move(__init), __u(*__first));
return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator1 __first1,
- _InputIterator1 __last1,
- _InputIterator2 __first2, _Tp __init,
- _BinaryOp1 __b1, _BinaryOp2 __b2) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(
+ _InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _Tp __init,
+ _BinaryOp1 __b1,
+ _BinaryOp2 __b2) {
for (; __first1 != __last1; ++__first1, (void)++__first2)
__init = __b1(std::move(__init), __b2(*__first1, *__first2));
return __init;
}
template <class _InputIterator1, class _InputIterator2, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator1 __first1,
- _InputIterator1 __last1,
- _InputIterator2 __first2, _Tp __init) {
- return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(),
- std::multiplies<>());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
+transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) {
+ return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(), std::multiplies<>());
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h b/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h
index 565dc0369387..4f33dca132d1 100644
--- a/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/bernoulli_distribution.h
@@ -23,119 +23,97 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_TEMPLATE_VIS bernoulli_distribution
-{
+class _LIBCPP_TEMPLATE_VIS bernoulli_distribution {
public:
- // types
- typedef bool result_type;
+ // types
+ typedef bool result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- double __p_;
- public:
- typedef bernoulli_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ double __p_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(double __p = 0.5) : __p_(__p) {}
+ public:
+ typedef bernoulli_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- bernoulli_distribution() : bernoulli_distribution(0.5) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit bernoulli_distribution(double __p) : __p_(param_type(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI bernoulli_distribution() : bernoulli_distribution(0.5) {}
+ _LIBCPP_HIDE_FROM_ABI explicit bernoulli_distribution(double __p) : __p_(param_type(__p)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit bernoulli_distribution(double __p = 0.5) : __p_(param_type(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit bernoulli_distribution(double __p = 0.5) : __p_(param_type(__p)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit bernoulli_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG> _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return false;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return true;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const bernoulli_distribution& __x,
- const bernoulli_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const bernoulli_distribution& __x,
- const bernoulli_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit bernoulli_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return false; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return true; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const bernoulli_distribution& __x, const bernoulli_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const bernoulli_distribution& __x, const bernoulli_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _URNG>
-inline
-bernoulli_distribution::result_type
-bernoulli_distribution::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- uniform_real_distribution<double> __gen;
- return __gen(__g) < __p.p();
+template <class _URNG>
+inline bernoulli_distribution::result_type bernoulli_distribution::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ uniform_real_distribution<double> __gen;
+ return __gen(__g) < __p.p();
}
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.p();
}
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
-{
- typedef bernoulli_distribution _Eng;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- double __p;
- __is >> __p;
- if (!__is.fail())
- __x.param(param_type(__p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) {
+ typedef bernoulli_distribution _Eng;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ double __p;
+ __is >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h b/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h
index 03661b19bebf..e8774bb8d67e 100644
--- a/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/binomial_distribution.h
@@ -24,98 +24,81 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS binomial_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS binomial_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __t_;
- double __p_;
- double __pr_;
- double __odds_ratio_;
- result_type __r0_;
- public:
- typedef binomial_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __t = 1, double __p = 0.5);
-
- _LIBCPP_HIDE_FROM_ABI
- result_type t() const {return __t_;}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
-
- friend class binomial_distribution;
- };
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __t_;
+ double __p_;
+ double __pr_;
+ double __odds_ratio_;
+ result_type __r0_;
+
+ public:
+ typedef binomial_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __t = 1, double __p = 0.5);
+
+ _LIBCPP_HIDE_FROM_ABI result_type t() const { return __t_; }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+
+ friend class binomial_distribution;
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- binomial_distribution() : binomial_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit binomial_distribution(result_type __t, double __p = 0.5)
- : __p_(param_type(__t, __p)) {}
+ _LIBCPP_HIDE_FROM_ABI binomial_distribution() : binomial_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit binomial_distribution(result_type __t, double __p = 0.5)
+ : __p_(param_type(__t, __p)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit binomial_distribution(result_type __t = 1, double __p = 0.5)
- : __p_(param_type(__t, __p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit binomial_distribution(result_type __t = 1, double __p = 0.5)
+ : __p_(param_type(__t, __p)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit binomial_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type t() const {return __p_.t();}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return t();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const binomial_distribution& __x,
- const binomial_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const binomial_distribution& __x,
- const binomial_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit binomial_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type t() const { return __p_.t(); }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return t(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const binomial_distribution& __x, const binomial_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const binomial_distribution& __x, const binomial_distribution& __y) {
+ return !(__x == __y);
+ }
};
#ifndef _LIBCPP_MSVCRT_LIKE
-extern "C" double lgamma_r(double, int *);
+extern "C" double lgamma_r(double, int*);
#endif
inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
@@ -127,99 +110,85 @@ inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
#endif
}
-template<class _IntType>
-binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p)
- : __t_(__t), __p_(__p)
-{
- if (0 < __p_ && __p_ < 1)
- {
- __r0_ = static_cast<result_type>((__t_ + 1) * __p_);
- __pr_ = std::exp(std::__libcpp_lgamma(__t_ + 1.) -
- std::__libcpp_lgamma(__r0_ + 1.) -
- std::__libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * std::log(__p_) +
- (__t_ - __r0_) * std::log(1 - __p_));
- __odds_ratio_ = __p_ / (1 - __p_);
- }
+template <class _IntType>
+binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p) : __t_(__t), __p_(__p) {
+ if (0 < __p_ && __p_ < 1) {
+ __r0_ = static_cast<result_type>((__t_ + 1) * __p_);
+ __pr_ = std::exp(
+ std::__libcpp_lgamma(__t_ + 1.) - std::__libcpp_lgamma(__r0_ + 1.) - std::__libcpp_lgamma(__t_ - __r0_ + 1.) +
+ __r0_ * std::log(__p_) + (__t_ - __r0_) * std::log(1 - __p_));
+ __odds_ratio_ = __p_ / (1 - __p_);
+ }
}
// Reference: Kemp, C.D. (1986). `A modal method for generating binomial
// variables', Commun. Statist. - Theor. Meth. 15(3), 805-813.
-template<class _IntType>
-template<class _URNG>
-_IntType
-binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- if (__pr.__t_ == 0 || __pr.__p_ == 0)
- return 0;
- if (__pr.__p_ == 1)
- return __pr.__t_;
- uniform_real_distribution<double> __gen;
- double __u = __gen(__g) - __pr.__pr_;
- if (__u < 0)
- return __pr.__r0_;
- double __pu = __pr.__pr_;
- double __pd = __pu;
- result_type __ru = __pr.__r0_;
- result_type __rd = __ru;
- while (true)
- {
- bool __break = true;
- if (__rd >= 1)
- {
- __pd *= __rd / (__pr.__odds_ratio_ * (__pr.__t_ - __rd + 1));
- __u -= __pd;
- __break = false;
- if (__u < 0)
- return __rd - 1;
- }
- if ( __rd != 0 )
- --__rd;
- ++__ru;
- if (__ru <= __pr.__t_)
- {
- __pu *= (__pr.__t_ - __ru + 1) * __pr.__odds_ratio_ / __ru;
- __u -= __pu;
- __break = false;
- if (__u < 0)
- return __ru;
- }
- if (__break)
- return 0;
+template <class _IntType>
+template <class _URNG>
+_IntType binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ if (__pr.__t_ == 0 || __pr.__p_ == 0)
+ return 0;
+ if (__pr.__p_ == 1)
+ return __pr.__t_;
+ uniform_real_distribution<double> __gen;
+ double __u = __gen(__g) - __pr.__pr_;
+ if (__u < 0)
+ return __pr.__r0_;
+ double __pu = __pr.__pr_;
+ double __pd = __pu;
+ result_type __ru = __pr.__r0_;
+ result_type __rd = __ru;
+ while (true) {
+ bool __break = true;
+ if (__rd >= 1) {
+ __pd *= __rd / (__pr.__odds_ratio_ * (__pr.__t_ - __rd + 1));
+ __u -= __pd;
+ __break = false;
+ if (__u < 0)
+ return __rd - 1;
+ }
+ if (__rd != 0)
+ --__rd;
+ ++__ru;
+ if (__ru <= __pr.__t_) {
+ __pu *= (__pr.__t_ - __ru + 1) * __pr.__odds_ratio_ / __ru;
+ __u -= __pu;
+ __break = false;
+ if (__u < 0)
+ return __ru;
}
+ if (__break)
+ return 0;
+ }
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const binomial_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.t() << __sp << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const binomial_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.t() << __sp << __x.p();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- binomial_distribution<_IntType>& __x)
-{
- typedef binomial_distribution<_IntType> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __t;
- double __p;
- __is >> __t >> __p;
- if (!__is.fail())
- __x.param(param_type(__t, __p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, binomial_distribution<_IntType>& __x) {
+ typedef binomial_distribution<_IntType> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __t;
+ double __p;
+ __is >> __t >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__t, __p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h b/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h
index 44d7e0e27c14..bd341427a152 100644
--- a/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/cauchy_distribution.h
@@ -25,139 +25,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS cauchy_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS cauchy_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef cauchy_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 0, result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef cauchy_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- cauchy_distribution() : cauchy_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit cauchy_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI cauchy_distribution() : cauchy_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit cauchy_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit cauchy_distribution(result_type __a = 0, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit cauchy_distribution(result_type __a = 0, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit cauchy_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG> _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const cauchy_distribution& __x,
- const cauchy_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const cauchy_distribution& __x,
- const cauchy_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit cauchy_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const cauchy_distribution& __x, const cauchy_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const cauchy_distribution& __x, const cauchy_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-inline
-_RealType
-cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- uniform_real_distribution<result_type> __gen;
- // purposefully let tan arg get as close to pi/2 as it wants, tan will return a finite
- return __p.a() + __p.b() * std::tan(3.1415926535897932384626433832795 * __gen(__g));
+template <class _URNG>
+inline _RealType cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ uniform_real_distribution<result_type> __gen;
+ // purposefully let tan arg get as close to pi/2 as it wants, tan will return a finite
+ return __p.a() + __p.b() * std::tan(3.1415926535897932384626433832795 * __gen(__g));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const cauchy_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.a() << __sp << __x.b();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const cauchy_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.a() << __sp << __x.b();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- cauchy_distribution<_RT>& __x)
-{
- typedef cauchy_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, cauchy_distribution<_RT>& __x) {
+ typedef cauchy_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h b/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h
index ce17a283d495..efa96dcdaafb 100644
--- a/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/chi_squared_distribution.h
@@ -24,121 +24,98 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS chi_squared_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS chi_squared_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
+ // types
+ typedef _RealType result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __n_;
- public:
- typedef chi_squared_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __n_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __n = 1) : __n_(__n) {}
+ public:
+ typedef chi_squared_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __n_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__n_ == __y.__n_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__n_ == __y.__n_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- chi_squared_distribution() : chi_squared_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit chi_squared_distribution(result_type __n)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI chi_squared_distribution() : chi_squared_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit chi_squared_distribution(result_type __n) : __p_(param_type(__n)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit chi_squared_distribution(result_type __n = 1)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit chi_squared_distribution(result_type __n = 1) : __p_(param_type(__n)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit chi_squared_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {return gamma_distribution<result_type>(__p.n() / 2, 2)(__g);}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __p_.n();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const chi_squared_distribution& __x,
- const chi_squared_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const chi_squared_distribution& __x,
- const chi_squared_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit chi_squared_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ return gamma_distribution<result_type>(__p.n() / 2, 2)(__g);
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const chi_squared_distribution& __x, const chi_squared_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const chi_squared_distribution& __x, const chi_squared_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const chi_squared_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- __os << __x.n();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const chi_squared_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ __os << __x.n();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- chi_squared_distribution<_RT>& __x)
-{
- typedef chi_squared_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __n;
- __is >> __n;
- if (!__is.fail())
- __x.param(param_type(__n));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, chi_squared_distribution<_RT>& __x) {
+ typedef chi_squared_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __n;
+ __is >> __n;
+ if (!__is.fail())
+ __x.param(param_type(__n));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h b/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h
index 07515e871a63..d9bfd31b7f01 100644
--- a/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h
+++ b/contrib/llvm-project/libcxx/include/__random/clamp_to_integral.h
@@ -22,17 +22,18 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _IntT, class _FloatT,
- bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
- int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
+template <class _IntT,
+ class _FloatT,
+ bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
+ int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
static_assert(is_floating_point<_FloatT>::value, "must be a floating point type");
static_assert(is_integral<_IntT>::value, "must be an integral type");
static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
- static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value
- || _IsSame<_FloatT,long double>::value), "unsupported floating point type");
- return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
+ static_assert(
+ (_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value || _IsSame<_FloatT, long double>::value),
+ "unsupported floating point type");
+ return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
}
// Convert a floating point number to the specified integral type after
@@ -40,9 +41,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
//
// The behavior is undefined if `__r` is NaN.
template <class _IntT, class _RealT>
-_LIBCPP_HIDE_FROM_ABI
-_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
- using _Lim = numeric_limits<_IntT>;
+_LIBCPP_HIDE_FROM_ABI _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
+ using _Lim = numeric_limits<_IntT>;
const _IntT __max_val = __max_representable_int_for_float<_IntT, _RealT>();
if (__r >= ::nextafter(static_cast<_RealT>(__max_val), INFINITY)) {
return _Lim::max();
diff --git a/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h b/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h
index 8ce5a1cf2cb2..9279fb66f694 100644
--- a/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/discard_block_engine.h
@@ -27,172 +27,142 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Engine, size_t __p, size_t __r>
-class _LIBCPP_TEMPLATE_VIS discard_block_engine
-{
- _Engine __e_;
- int __n_;
-
- static_assert( 0 < __r, "discard_block_engine invalid parameters");
- static_assert(__r <= __p, "discard_block_engine invalid parameters");
+template <class _Engine, size_t __p, size_t __r>
+class _LIBCPP_TEMPLATE_VIS discard_block_engine {
+ _Engine __e_;
+ int __n_;
+
+ static_assert(0 < __r, "discard_block_engine invalid parameters");
+ static_assert(__r <= __p, "discard_block_engine invalid parameters");
#ifndef _LIBCPP_CXX03_LANG // numeric_limits::max() is not constexpr in C++03
- static_assert(__r <= numeric_limits<int>::max(), "discard_block_engine invalid parameters");
+ static_assert(__r <= numeric_limits<int>::max(), "discard_block_engine invalid parameters");
#endif
+
public:
- // types
- typedef typename _Engine::result_type result_type;
+ // types
+ typedef typename _Engine::result_type result_type;
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t block_size = __p;
- static _LIBCPP_CONSTEXPR const size_t used_block = __r;
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t block_size = __p;
+ static _LIBCPP_CONSTEXPR const size_t used_block = __r;
#ifdef _LIBCPP_CXX03_LANG
- static const result_type _Min = _Engine::_Min;
- static const result_type _Max = _Engine::_Max;
+ static const result_type _Min = _Engine::_Min;
+ static const result_type _Max = _Engine::_Max;
#else
- static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
- static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
+ static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
+ static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
#endif
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); }
-
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI
- discard_block_engine() : __n_(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(const _Engine& __e)
- : __e_(__e), __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); }
+
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI discard_block_engine() : __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(const _Engine& __e) : __e_(__e), __n_(0) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(_Engine&& __e)
- : __e_(std::move(__e)), __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Engine&& __e) : __e_(std::move(__e)), __n_(0) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value &&
- !is_convertible<_Sseq, _Engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit discard_block_engine(_Sseq& __q)
- : __e_(__q), __n_(0) {}
- _LIBCPP_HIDE_FROM_ABI
- void seed() {__e_.seed(); __n_ = 0;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd) {__e_.seed(__sd); __n_ = 0;}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()();
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- const _Engine& base() const _NOEXCEPT {return __e_;}
-
- template<class _Eng, size_t _Pp, size_t _Rp>
- friend
- bool
- operator==(
- const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y);
-
- template<class _Eng, size_t _Pp, size_t _Rp>
- friend
- bool
- operator!=(
- const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discard_block_engine<_Eng, _Pp, _Rp>& __x);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- discard_block_engine<_Eng, _Pp, _Rp>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
+ template <
+ class _Sseq,
+ __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value && !is_convertible<_Sseq, _Engine>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Sseq& __q) : __e_(__q), __n_(0) {}
+ _LIBCPP_HIDE_FROM_ABI void seed() {
+ __e_.seed();
+ __n_ = 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) {
+ __e_.seed(__sd);
+ __n_ = 0;
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __e_.seed(__q);
+ __n_ = 0;
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()();
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
+
+ template <class _Eng, size_t _Pp, size_t _Rp>
+ friend bool
+ operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y);
+
+ template <class _Eng, size_t _Pp, size_t _Rp>
+ friend bool
+ operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const discard_block_engine<_Eng, _Pp, _Rp>& __x);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, discard_block_engine<_Eng, _Pp, _Rp>& __x);
};
-template<class _Engine, size_t __p, size_t __r>
- _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size;
-
-template<class _Engine, size_t __p, size_t __r>
- _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block;
-
-template<class _Engine, size_t __p, size_t __r>
-typename discard_block_engine<_Engine, __p, __r>::result_type
-discard_block_engine<_Engine, __p, __r>::operator()()
-{
- if (__n_ >= static_cast<int>(__r))
- {
- __e_.discard(__p - __r);
- __n_ = 0;
- }
- ++__n_;
- return __e_();
+template <class _Engine, size_t __p, size_t __r>
+_LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size;
+
+template <class _Engine, size_t __p, size_t __r>
+_LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block;
+
+template <class _Engine, size_t __p, size_t __r>
+typename discard_block_engine<_Engine, __p, __r>::result_type discard_block_engine<_Engine, __p, __r>::operator()() {
+ if (__n_ >= static_cast<int>(__r)) {
+ __e_.discard(__p - __r);
+ __n_ = 0;
+ }
+ ++__n_;
+ return __e_();
}
-template<class _Eng, size_t _Pp, size_t _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y)
-{
- return __x.__n_ == __y.__n_ && __x.__e_ == __y.__e_;
+template <class _Eng, size_t _Pp, size_t _Rp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y) {
+ return __x.__n_ == __y.__n_ && __x.__e_ == __y.__e_;
}
-template<class _Eng, size_t _Pp, size_t _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
- const discard_block_engine<_Eng, _Pp, _Rp>& __y)
-{
- return !(__x == __y);
+template <class _Eng, size_t _Pp, size_t _Rp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x, const discard_block_engine<_Eng, _Pp, _Rp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
+template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discard_block_engine<_Eng, _Pp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.__e_ << __sp << __x.__n_;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const discard_block_engine<_Eng, _Pp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.__e_ << __sp << __x.__n_;
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Pp, size_t _Rp>
+template <class _CharT, class _Traits, class _Eng, size_t _Pp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- discard_block_engine<_Eng, _Pp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _Eng __e;
- int __n;
- __is >> __e >> __n;
- if (!__is.fail())
- {
- __x.__e_ = __e;
- __x.__n_ = __n;
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, discard_block_engine<_Eng, _Pp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _Eng __e;
+ int __n;
+ __is >> __e >> __n;
+ if (!__is.fail()) {
+ __x.__e_ = __e;
+ __x.__n_ = __n;
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h b/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h
index 9f0bc3591439..bb72dd6cb507 100644
--- a/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/discrete_distribution.h
@@ -27,234 +27,182 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS discrete_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS discrete_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- vector<double> __p_;
- public:
- typedef discrete_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- param_type() {}
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- param_type(_InputIterator __f, _InputIterator __l)
- : __p_(__f, __l) {__init();}
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ vector<double> __p_;
+
+ public:
+ typedef discrete_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI param_type() {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI param_type(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {
+ __init();
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- param_type(initializer_list<double> __wl)
- : __p_(__wl.begin(), __wl.end()) {__init();}
+ _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<double> __wl) : __p_(__wl.begin(), __wl.end()) { __init(); }
#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, double __xmin, double __xmax,
- _UnaryOperation __fw);
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw);
- _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const;
+ _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const;
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
- private:
- _LIBCPP_HIDE_FROM_ABI void __init();
+ private:
+ _LIBCPP_HIDE_FROM_ABI void __init();
- friend class discrete_distribution;
+ friend class discrete_distribution;
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discrete_distribution<_IT>& __x);
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IT>& __x);
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- discrete_distribution<_IT>& __x);
- };
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, discrete_distribution<_IT>& __x);
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution() {}
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution(_InputIterator __f, _InputIterator __l)
- : __p_(__f, __l) {}
+ // constructor and reset functions
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution() {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution(initializer_list<double> __wl)
- : __p_(__wl) {}
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution(initializer_list<double> __wl) : __p_(__wl) {}
#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- discrete_distribution(size_t __nw, double __xmin, double __xmax,
- _UnaryOperation __fw)
- : __p_(__nw, __xmin, __xmax, __fw) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit discrete_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- vector<double> probabilities() const {return __p_.probabilities();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return __p_.__p_.size();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const discrete_distribution& __x,
- const discrete_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const discrete_distribution& __x,
- const discrete_distribution& __y)
- {return !(__x == __y);}
-
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discrete_distribution<_IT>& __x);
-
- template <class _CharT, class _Traits, class _IT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- discrete_distribution<_IT>& __x);
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI discrete_distribution(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw)
+ : __p_(__nw, __xmin, __xmax, __fw) {}
+ _LIBCPP_HIDE_FROM_ABI explicit discrete_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const { return __p_.probabilities(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__p_.size(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const discrete_distribution& __x, const discrete_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const discrete_distribution& __x, const discrete_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IT>& __x);
+
+ template <class _CharT, class _Traits, class _IT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, discrete_distribution<_IT>& __x);
};
-template<class _IntType>
-template<class _UnaryOperation>
-discrete_distribution<_IntType>::param_type::param_type(size_t __nw,
- double __xmin,
- double __xmax,
- _UnaryOperation __fw)
-{
- if (__nw > 1)
- {
- __p_.reserve(__nw - 1);
- double __d = (__xmax - __xmin) / __nw;
- double __d2 = __d / 2;
- for (size_t __k = 0; __k < __nw; ++__k)
- __p_.push_back(__fw(__xmin + __k * __d + __d2));
- __init();
- }
+template <class _IntType>
+template <class _UnaryOperation>
+discrete_distribution<_IntType>::param_type::param_type(
+ size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw) {
+ if (__nw > 1) {
+ __p_.reserve(__nw - 1);
+ double __d = (__xmax - __xmin) / __nw;
+ double __d2 = __d / 2;
+ for (size_t __k = 0; __k < __nw; ++__k)
+ __p_.push_back(__fw(__xmin + __k * __d + __d2));
+ __init();
+ }
}
-template<class _IntType>
-void
-discrete_distribution<_IntType>::param_type::__init()
-{
- if (!__p_.empty())
- {
- if (__p_.size() > 1)
- {
- double __s = std::accumulate(__p_.begin(), __p_.end(), 0.0);
- for (vector<double>::iterator __i = __p_.begin(), __e = __p_.end(); __i < __e; ++__i)
- *__i /= __s;
- vector<double> __t(__p_.size() - 1);
- std::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin());
- swap(__p_, __t);
- }
- else
- {
- __p_.clear();
- __p_.shrink_to_fit();
- }
+template <class _IntType>
+void discrete_distribution<_IntType>::param_type::__init() {
+ if (!__p_.empty()) {
+ if (__p_.size() > 1) {
+ double __s = std::accumulate(__p_.begin(), __p_.end(), 0.0);
+ for (vector<double>::iterator __i = __p_.begin(), __e = __p_.end(); __i < __e; ++__i)
+ *__i /= __s;
+ vector<double> __t(__p_.size() - 1);
+ std::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin());
+ swap(__p_, __t);
+ } else {
+ __p_.clear();
+ __p_.shrink_to_fit();
}
+ }
}
-template<class _IntType>
-vector<double>
-discrete_distribution<_IntType>::param_type::probabilities() const
-{
- size_t __n = __p_.size();
- vector<double> __p(__n+1);
- std::adjacent_difference(__p_.begin(), __p_.end(), __p.begin());
- if (__n > 0)
- __p[__n] = 1 - __p_[__n-1];
- else
- __p[0] = 1;
- return __p;
+template <class _IntType>
+vector<double> discrete_distribution<_IntType>::param_type::probabilities() const {
+ size_t __n = __p_.size();
+ vector<double> __p(__n + 1);
+ std::adjacent_difference(__p_.begin(), __p_.end(), __p.begin());
+ if (__n > 0)
+ __p[__n] = 1 - __p_[__n - 1];
+ else
+ __p[0] = 1;
+ return __p;
}
-template<class _IntType>
-template<class _URNG>
-_IntType
-discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- uniform_real_distribution<double> __gen;
- return static_cast<_IntType>(
- std::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) -
- __p.__p_.begin());
+template <class _IntType>
+template <class _URNG>
+_IntType discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ uniform_real_distribution<double> __gen;
+ return static_cast<_IntType>(std::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) - __p.__p_.begin());
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discrete_distribution<_IT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- size_t __n = __x.__p_.__p_.size();
- __os << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__p_[__i];
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ size_t __n = __x.__p_.__p_.size();
+ __os << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__p_[__i];
+ return __os;
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- discrete_distribution<_IT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- size_t __n;
- __is >> __n;
- vector<double> __p(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __p[__i];
- if (!__is.fail())
- swap(__x.__p_.__p_, __p);
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, discrete_distribution<_IT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ size_t __n;
+ __is >> __n;
+ vector<double> __p(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __p[__i];
+ if (!__is.fail())
+ swap(__x.__p_.__p_, __p);
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h b/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h
index e9df4de90e74..e0e38841172f 100644
--- a/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/exponential_distribution.h
@@ -26,132 +26,103 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS exponential_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS exponential_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
+ // types
+ typedef _RealType result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __lambda_;
- public:
- typedef exponential_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __lambda_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {}
+ public:
+ typedef exponential_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- result_type lambda() const {return __lambda_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__lambda_ == __y.__lambda_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __lambda_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__lambda_ == __y.__lambda_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- exponential_distribution() : exponential_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit exponential_distribution(result_type __lambda)
- : __p_(param_type(__lambda)) {}
+ _LIBCPP_HIDE_FROM_ABI exponential_distribution() : exponential_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit exponential_distribution(result_type __lambda) : __p_(param_type(__lambda)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit exponential_distribution(result_type __lambda = 1)
- : __p_(param_type(__lambda)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit exponential_distribution(result_type __lambda = 1) : __p_(param_type(__lambda)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit exponential_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type lambda() const {return __p_.lambda();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const exponential_distribution& __x,
- const exponential_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const exponential_distribution& __x,
- const exponential_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit exponential_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __p_.lambda(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const exponential_distribution& __x, const exponential_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const exponential_distribution& __x, const exponential_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- return -std::log
- (
- result_type(1) -
- std::generate_canonical<result_type,
- numeric_limits<result_type>::digits>(__g)
- )
- / __p.lambda();
+template <class _URNG>
+_RealType exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ return -std::log(result_type(1) - std::generate_canonical<result_type, numeric_limits<result_type>::digits>(__g)) /
+ __p.lambda();
}
template <class _CharT, class _Traits, class _RealType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const exponential_distribution<_RealType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- return __os << __x.lambda();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const exponential_distribution<_RealType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ return __os << __x.lambda();
}
template <class _CharT, class _Traits, class _RealType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- exponential_distribution<_RealType>& __x)
-{
- typedef exponential_distribution<_RealType> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __lambda;
- __is >> __lambda;
- if (!__is.fail())
- __x.param(param_type(__lambda));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, exponential_distribution<_RealType>& __x) {
+ typedef exponential_distribution<_RealType> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __lambda;
+ __is >> __lambda;
+ if (!__is.fail())
+ __x.param(param_type(__lambda));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h b/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h
index f8f18ebf7896..5505f93274f5 100644
--- a/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/extreme_value_distribution.h
@@ -25,139 +25,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS extreme_value_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS extreme_value_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef extreme_value_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 0, result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef extreme_value_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- extreme_value_distribution() : extreme_value_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit extreme_value_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI extreme_value_distribution() : extreme_value_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit extreme_value_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit extreme_value_distribution(result_type __a = 0,
- result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit extreme_value_distribution(result_type __a = 0, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit extreme_value_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const extreme_value_distribution& __x,
- const extreme_value_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const extreme_value_distribution& __x,
- const extreme_value_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit extreme_value_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const extreme_value_distribution& __x, const extreme_value_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const extreme_value_distribution& __x, const extreme_value_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _RealType>
-template<class _URNG>
-_RealType
-extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- return __p.a() - __p.b() *
- std::log(-std::log(1-uniform_real_distribution<result_type>()(__g)));
+template <class _RealType>
+template <class _URNG>
+_RealType extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ return __p.a() - __p.b() * std::log(-std::log(1 - uniform_real_distribution<result_type>()(__g)));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const extreme_value_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.a() << __sp << __x.b();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const extreme_value_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.a() << __sp << __x.b();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- extreme_value_distribution<_RT>& __x)
-{
- typedef extreme_value_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, extreme_value_distribution<_RT>& __x) {
+ typedef extreme_value_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h b/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h
index 8da689a3b0f4..cd170b3af388 100644
--- a/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/fisher_f_distribution.h
@@ -24,139 +24,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS fisher_f_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS fisher_f_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __m_;
- result_type __n_;
- public:
- typedef fisher_f_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __m = 1, result_type __n = 1)
- : __m_(__m), __n_(__n) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __m_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __n_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __m_;
+ result_type __n_;
+
+ public:
+ typedef fisher_f_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 1, result_type __n = 1) : __m_(__m), __n_(__n) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- fisher_f_distribution() : fisher_f_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit fisher_f_distribution(result_type __m, result_type __n = 1)
- : __p_(param_type(__m, __n)) {}
+ _LIBCPP_HIDE_FROM_ABI fisher_f_distribution() : fisher_f_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit fisher_f_distribution(result_type __m, result_type __n = 1)
+ : __p_(param_type(__m, __n)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1)
- : __p_(param_type(__m, __n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1)
+ : __p_(param_type(__m, __n)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit fisher_f_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __p_.m();}
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __p_.n();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const fisher_f_distribution& __x,
- const fisher_f_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const fisher_f_distribution& __x,
- const fisher_f_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit fisher_f_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __p_.m(); }
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const fisher_f_distribution& __x, const fisher_f_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const fisher_f_distribution& __x, const fisher_f_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- gamma_distribution<result_type> __gdm(__p.m() * result_type(.5));
- gamma_distribution<result_type> __gdn(__p.n() * result_type(.5));
- return __p.n() * __gdm(__g) / (__p.m() * __gdn(__g));
+template <class _URNG>
+_RealType fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ gamma_distribution<result_type> __gdm(__p.m() * result_type(.5));
+ gamma_distribution<result_type> __gdn(__p.n() * result_type(.5));
+ return __p.n() * __gdm(__g) / (__p.m() * __gdn(__g));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const fisher_f_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.m() << __sp << __x.n();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const fisher_f_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.m() << __sp << __x.n();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- fisher_f_distribution<_RT>& __x)
-{
- typedef fisher_f_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __m;
- result_type __n;
- __is >> __m >> __n;
- if (!__is.fail())
- __x.param(param_type(__m, __n));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, fisher_f_distribution<_RT>& __x) {
+ typedef fisher_f_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __m;
+ result_type __n;
+ __is >> __m >> __n;
+ if (!__is.fail())
+ __x.param(param_type(__m, __n));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h b/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h
index bdf8e141ece7..986e42c1c7f5 100644
--- a/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/gamma_distribution.h
@@ -26,190 +26,152 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS gamma_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS gamma_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __alpha_;
- result_type __beta_;
- public:
- typedef gamma_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __alpha = 1, result_type __beta = 1)
- : __alpha_(__alpha), __beta_(__beta) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type alpha() const {return __alpha_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type beta() const {return __beta_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __alpha_;
+ result_type __beta_;
+
+ public:
+ typedef gamma_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __alpha = 1, result_type __beta = 1)
+ : __alpha_(__alpha), __beta_(__beta) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __alpha_; }
+ _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __beta_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- gamma_distribution() : gamma_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit gamma_distribution(result_type __alpha, result_type __beta = 1)
- : __p_(param_type(__alpha, __beta)) {}
+ _LIBCPP_HIDE_FROM_ABI gamma_distribution() : gamma_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit gamma_distribution(result_type __alpha, result_type __beta = 1)
+ : __p_(param_type(__alpha, __beta)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit gamma_distribution(result_type __alpha = 1,
- result_type __beta = 1)
- : __p_(param_type(__alpha, __beta)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit gamma_distribution(result_type __alpha = 1, result_type __beta = 1)
+ : __p_(param_type(__alpha, __beta)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit gamma_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type alpha() const {return __p_.alpha();}
- _LIBCPP_HIDE_FROM_ABI
- result_type beta() const {return __p_.beta();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const gamma_distribution& __x,
- const gamma_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const gamma_distribution& __x,
- const gamma_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit gamma_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __p_.alpha(); }
+ _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __p_.beta(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const gamma_distribution& __x, const gamma_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const gamma_distribution& __x, const gamma_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- result_type __a = __p.alpha();
- uniform_real_distribution<result_type> __gen(0, 1);
- exponential_distribution<result_type> __egen;
- result_type __x;
- if (__a == 1)
- __x = __egen(__g);
- else if (__a > 1)
- {
- const result_type __b = __a - 1;
- const result_type __c = 3 * __a - result_type(0.75);
- while (true)
- {
- const result_type __u = __gen(__g);
- const result_type __v = __gen(__g);
- const result_type __w = __u * (1 - __u);
- if (__w != 0)
- {
- const result_type __y = std::sqrt(__c / __w) *
- (__u - result_type(0.5));
- __x = __b + __y;
- if (__x >= 0)
- {
- const result_type __z = 64 * __w * __w * __w * __v * __v;
- if (__z <= 1 - 2 * __y * __y / __x)
- break;
- if (std::log(__z) <= 2 * (__b * std::log(__x / __b) - __y))
- break;
- }
- }
+template <class _URNG>
+_RealType gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ result_type __a = __p.alpha();
+ uniform_real_distribution<result_type> __gen(0, 1);
+ exponential_distribution<result_type> __egen;
+ result_type __x;
+ if (__a == 1)
+ __x = __egen(__g);
+ else if (__a > 1) {
+ const result_type __b = __a - 1;
+ const result_type __c = 3 * __a - result_type(0.75);
+ while (true) {
+ const result_type __u = __gen(__g);
+ const result_type __v = __gen(__g);
+ const result_type __w = __u * (1 - __u);
+ if (__w != 0) {
+ const result_type __y = std::sqrt(__c / __w) * (__u - result_type(0.5));
+ __x = __b + __y;
+ if (__x >= 0) {
+ const result_type __z = 64 * __w * __w * __w * __v * __v;
+ if (__z <= 1 - 2 * __y * __y / __x)
+ break;
+ if (std::log(__z) <= 2 * (__b * std::log(__x / __b) - __y))
+ break;
}
+ }
}
- else // __a < 1
- {
- while (true)
- {
- const result_type __u = __gen(__g);
- const result_type __es = __egen(__g);
- if (__u <= 1 - __a)
- {
- __x = std::pow(__u, 1 / __a);
- if (__x <= __es)
- break;
- }
- else
- {
- const result_type __e = -std::log((1-__u)/__a);
- __x = std::pow(1 - __a + __a * __e, 1 / __a);
- if (__x <= __e + __es)
- break;
- }
- }
+ } else // __a < 1
+ {
+ while (true) {
+ const result_type __u = __gen(__g);
+ const result_type __es = __egen(__g);
+ if (__u <= 1 - __a) {
+ __x = std::pow(__u, 1 / __a);
+ if (__x <= __es)
+ break;
+ } else {
+ const result_type __e = -std::log((1 - __u) / __a);
+ __x = std::pow(1 - __a + __a * __e, 1 / __a);
+ if (__x <= __e + __es)
+ break;
+ }
}
- return __x * __p.beta();
+ }
+ return __x * __p.beta();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const gamma_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.alpha() << __sp << __x.beta();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const gamma_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.alpha() << __sp << __x.beta();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- gamma_distribution<_RT>& __x)
-{
- typedef gamma_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __alpha;
- result_type __beta;
- __is >> __alpha >> __beta;
- if (!__is.fail())
- __x.param(param_type(__alpha, __beta));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, gamma_distribution<_RT>& __x) {
+ typedef gamma_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __alpha;
+ result_type __beta;
+ __is >> __alpha >> __beta;
+ if (!__is.fail())
+ __x.param(param_type(__alpha, __beta));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/generate_canonical.h b/contrib/llvm-project/libcxx/include/__random/generate_canonical.h
index 5f0aa6fd850b..738de1517e28 100644
--- a/contrib/llvm-project/libcxx/include/__random/generate_canonical.h
+++ b/contrib/llvm-project/libcxx/include/__random/generate_canonical.h
@@ -26,24 +26,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// generate_canonical
-template<class _RealType, size_t __bits, class _URNG>
-_LIBCPP_HIDE_FROM_ABI _RealType
-generate_canonical(_URNG& __g)
-{
- const size_t __dt = numeric_limits<_RealType>::digits;
- const size_t __b = __dt < __bits ? __dt : __bits;
+template <class _RealType, size_t __bits, class _URNG>
+_LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) {
+ const size_t __dt = numeric_limits<_RealType>::digits;
+ const size_t __b = __dt < __bits ? __dt : __bits;
#ifdef _LIBCPP_CXX03_LANG
- const size_t __log_r = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
+ const size_t __log_r = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
#else
- const size_t __log_r = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
+ const size_t __log_r = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
#endif
- const size_t __k = __b / __log_r + (__b % __log_r != 0) + (__b == 0);
- const _RealType __rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
- _RealType __base = __rp;
- _RealType __sp = __g() - _URNG::min();
- for (size_t __i = 1; __i < __k; ++__i, __base *= __rp)
- __sp += (__g() - _URNG::min()) * __base;
- return __sp / __base;
+ const size_t __k = __b / __log_r + (__b % __log_r != 0) + (__b == 0);
+ const _RealType __rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
+ _RealType __base = __rp;
+ _RealType __sp = __g() - _URNG::min();
+ for (size_t __i = 1; __i < __k; ++__i, __base *= __rp)
+ __sp += (__g() - _URNG::min()) * __base;
+ return __sp / __base;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h b/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h
index 263193aebed6..cecd7e57cfa6 100644
--- a/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/geometric_distribution.h
@@ -24,116 +24,93 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS geometric_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS geometric_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ double __p_;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- double __p_;
- public:
- typedef geometric_distribution distribution_type;
+ public:
+ typedef geometric_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(double __p = 0.5) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- geometric_distribution() : geometric_distribution(0.5) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit geometric_distribution(double __p)
- : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI geometric_distribution() : geometric_distribution(0.5) {}
+ _LIBCPP_HIDE_FROM_ABI explicit geometric_distribution(double __p) : __p_(__p) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit geometric_distribution(double __p = 0.5)
- : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit geometric_distribution(double __p = 0.5) : __p_(__p) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit geometric_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {return negative_binomial_distribution<result_type>(1, __p.p())(__g);}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::max();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const geometric_distribution& __x,
- const geometric_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const geometric_distribution& __x,
- const geometric_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit geometric_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ return negative_binomial_distribution<result_type>(1, __p.p())(__g);
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const geometric_distribution& __x, const geometric_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const geometric_distribution& __x, const geometric_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const geometric_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- return __os << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const geometric_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ return __os << __x.p();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- geometric_distribution<_IntType>& __x)
-{
- typedef geometric_distribution<_IntType> _Eng;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- double __p;
- __is >> __p;
- if (!__is.fail())
- __x.param(param_type(__p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, geometric_distribution<_IntType>& __x) {
+ typedef geometric_distribution<_IntType> _Eng;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ double __p;
+ __is >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h b/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h
index b81fa49d3bde..0f4a7b82b98f 100644
--- a/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/independent_bits_engine.h
@@ -30,225 +30,172 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Engine, size_t __w, class _UIntType>
-class _LIBCPP_TEMPLATE_VIS independent_bits_engine
-{
- template <class _UInt, _UInt _R0, size_t _Wp, size_t _Mp>
- class __get_n
- {
- static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits;
- static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0);
- static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np;
- static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
- public:
- static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np;
- };
+template <class _Engine, size_t __w, class _UIntType>
+class _LIBCPP_TEMPLATE_VIS independent_bits_engine {
+ template <class _UInt, _UInt _R0, size_t _Wp, size_t _Mp>
+ class __get_n {
+ static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0);
+ static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np;
+ static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
+
+ public:
+ static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np;
+ };
+
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- _Engine __e_;
+ _Engine __e_;
- static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
- static_assert( 0 < __w, "independent_bits_engine invalid parameters");
- static_assert(__w <= _Dt, "independent_bits_engine invalid parameters");
+ static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+ static_assert(0 < __w, "independent_bits_engine invalid parameters");
+ static_assert(__w <= _Dt, "independent_bits_engine invalid parameters");
- typedef typename _Engine::result_type _Engine_result_type;
- typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
- _Working_result_type;
+ typedef typename _Engine::result_type _Engine_result_type;
+ typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
+ _Working_result_type;
#ifdef _LIBCPP_CXX03_LANG
- static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
- + _Working_result_type(1);
+ static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1);
#else
- static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
- + _Working_result_type(1);
+ static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min() + _Working_result_type(1);
#endif
- static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
- static _LIBCPP_CONSTEXPR const size_t __n = __get_n<_Working_result_type, _Rp, __w, __m>::value;
- static _LIBCPP_CONSTEXPR const size_t __w0 = __w / __n;
- static _LIBCPP_CONSTEXPR const size_t __n0 = __n - __w % __n;
- static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
- static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
- static _LIBCPP_CONSTEXPR const _Working_result_type __y0 = __w0 >= _WDt ? 0 :
- (_Rp >> __w0) << __w0;
- static _LIBCPP_CONSTEXPR const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 :
- (_Rp >> (__w0+1)) << (__w0+1);
- static _LIBCPP_CONSTEXPR const _Engine_result_type __mask0 = __w0 > 0 ?
- _Engine_result_type(~0) >> (_EDt - __w0) :
- _Engine_result_type(0);
- static _LIBCPP_CONSTEXPR const _Engine_result_type __mask1 = __w0 < _EDt - 1 ?
- _Engine_result_type(~0) >> (_EDt - (__w0 + 1)) :
- _Engine_result_type(~0);
+ static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
+ static _LIBCPP_CONSTEXPR const size_t __n = __get_n<_Working_result_type, _Rp, __w, __m>::value;
+ static _LIBCPP_CONSTEXPR const size_t __w0 = __w / __n;
+ static _LIBCPP_CONSTEXPR const size_t __n0 = __n - __w % __n;
+ static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const _Working_result_type __y0 = __w0 >= _WDt ? 0 : (_Rp >> __w0) << __w0;
+ static _LIBCPP_CONSTEXPR const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 : (_Rp >> (__w0 + 1)) << (__w0 + 1);
+ static _LIBCPP_CONSTEXPR const
+ _Engine_result_type __mask0 = __w0 > 0 ? _Engine_result_type(~0) >> (_EDt - __w0) : _Engine_result_type(0);
+ static _LIBCPP_CONSTEXPR const _Engine_result_type __mask1 =
+ __w0 < _EDt - 1 ? _Engine_result_type(~0) >> (_EDt - (__w0 + 1)) : _Engine_result_type(~0);
+
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
- (result_type(1) << __w) - result_type(1);
- static_assert(_Min < _Max, "independent_bits_engine invalid parameters");
-
- // engine characteristics
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
-
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI
- independent_bits_engine() {}
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(const _Engine& __e)
- : __e_(__e) {}
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max =
+ __w == _Dt ? result_type(~0) : (result_type(1) << __w) - result_type(1);
+ static_assert(_Min < _Max, "independent_bits_engine invalid parameters");
+
+ // engine characteristics
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI independent_bits_engine() {}
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(const _Engine& __e) : __e_(__e) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(_Engine&& __e)
- : __e_(std::move(__e)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(_Engine&& __e) : __e_(std::move(__e)) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
- !is_convertible<_Sseq, _Engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit independent_bits_engine(_Sseq& __q)
- : __e_(__q) {}
- _LIBCPP_HIDE_FROM_ABI
- void seed() {__e_.seed();}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd) {__e_.seed(__sd);}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q) {__e_.seed(__q);}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- const _Engine& base() const _NOEXCEPT {return __e_;}
-
- template<class _Eng, size_t _Wp, class _UInt>
- friend
- bool
- operator==(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
-
- template<class _Eng, size_t _Wp, class _UInt>
- friend
- bool
- operator!=(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _Wp, _UInt>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
+ template <
+ class _Sseq,
+ __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value && !is_convertible<_Sseq, _Engine>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(_Sseq& __q) : __e_(__q) {}
+ _LIBCPP_HIDE_FROM_ABI void seed() { __e_.seed(); }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) { __e_.seed(__sd); }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __e_.seed(__q);
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
+
+ template <class _Eng, size_t _Wp, class _UInt>
+ friend bool operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
+
+ template <class _Eng, size_t _Wp, class _UInt>
+ friend bool operator!=(const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const independent_bits_engine<_Eng, _Wp, _UInt>& __x);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, independent_bits_engine<_Eng, _Wp, _UInt>& __x);
private:
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval(false_type);
- _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
-
- template <size_t __count, __enable_if_t<__count < _Dt, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type __x) {return __x << __count;}
-
- template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type) {return result_type(0);}
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type);
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
+
+ template <size_t __count,
+ __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
+ return __x << __count;
+ }
+
+ template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type) {
+ return result_type(0);
+ }
};
-template<class _Engine, size_t __w, class _UIntType>
-inline
-_UIntType
-independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type)
-{
- return static_cast<result_type>(__e_() & __mask0);
+template <class _Engine, size_t __w, class _UIntType>
+inline _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type) {
+ return static_cast<result_type>(__e_() & __mask0);
}
-template<class _Engine, size_t __w, class _UIntType>
-_UIntType
-independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
-{
- result_type __sp = 0;
- for (size_t __k = 0; __k < __n0; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y0);
- __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0));
- }
- for (size_t __k = __n0; __k < __n; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y1);
- __sp = static_cast<result_type>(__lshift<__w0+1>(__sp) + (__u & __mask1));
- }
- return __sp;
+template <class _Engine, size_t __w, class _UIntType>
+_UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) {
+ result_type __sp = 0;
+ for (size_t __k = 0; __k < __n0; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y0);
+ __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0));
+ }
+ for (size_t __k = __n0; __k < __n; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y1);
+ __sp = static_cast<result_type>(__lshift<__w0 + 1>(__sp) + (__u & __mask1));
+ }
+ return __sp;
}
-template<class _Eng, size_t _Wp, class _UInt>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y)
-{
- return __x.base() == __y.base();
+template <class _Eng, size_t _Wp, class _UInt>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, const independent_bits_engine<_Eng, _Wp, _UInt>& __y) {
+ return __x.base() == __y.base();
}
-template<class _Eng, size_t _Wp, class _UInt>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __y)
-{
- return !(__x == __y);
+template <class _Eng, size_t _Wp, class _UInt>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, const independent_bits_engine<_Eng, _Wp, _UInt>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
+template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _Wp, _UInt>& __x)
-{
- return __os << __x.base();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const independent_bits_engine<_Eng, _Wp, _UInt>& __x) {
+ return __os << __x.base();
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UInt>
+template <class _CharT, class _Traits, class _Eng, size_t _Wp, class _UInt>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _Wp, _UInt>& __x)
-{
- _Eng __e;
- __is >> __e;
- if (!__is.fail())
- __x.__e_ = __e;
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, independent_bits_engine<_Eng, _Wp, _UInt>& __x) {
+ _Eng __e;
+ __is >> __e;
+ if (!__is.fail())
+ __x.__e_ = __e;
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h b/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h
index 06621c3cee0d..c7171cff2eda 100644
--- a/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h
+++ b/contrib/llvm-project/libcxx/include/__random/is_seed_sequence.h
@@ -21,11 +21,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Sseq, class _Engine>
-struct __is_seed_sequence
-{
- static _LIBCPP_CONSTEXPR const bool value =
- !is_convertible<_Sseq, typename _Engine::result_type>::value &&
- !is_same<__remove_cv_t<_Sseq>, _Engine>::value;
+struct __is_seed_sequence {
+ static _LIBCPP_CONSTEXPR const bool value =
+ !is_convertible<_Sseq, typename _Engine::result_type>::value && !is_same<__remove_cv_t<_Sseq>, _Engine>::value;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/is_valid.h b/contrib/llvm-project/libcxx/include/__random/is_valid.h
index bde4733099d6..a3e0f143ae86 100644
--- a/contrib/llvm-project/libcxx/include/__random/is_valid.h
+++ b/contrib/llvm-project/libcxx/include/__random/is_valid.h
@@ -43,22 +43,35 @@ struct __libcpp_random_is_valid_realtype<long double> : true_type {};
// cv-unqualified and is one of short, int, long, long long, unsigned short,
// unsigned int, unsigned long, or unsigned long long.
-template<class> struct __libcpp_random_is_valid_inttype : false_type {};
-template<> struct __libcpp_random_is_valid_inttype<int8_t> : true_type {}; // extension
-template<> struct __libcpp_random_is_valid_inttype<short> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<int> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<long> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<long long> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<uint8_t> : true_type {}; // extension
-template<> struct __libcpp_random_is_valid_inttype<unsigned short> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<unsigned int> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<unsigned long> : true_type {};
-template<> struct __libcpp_random_is_valid_inttype<unsigned long long> : true_type {};
+template <class>
+struct __libcpp_random_is_valid_inttype : false_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<int8_t> : true_type {}; // extension
+template <>
+struct __libcpp_random_is_valid_inttype<short> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<int> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<long> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<long long> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<uint8_t> : true_type {}; // extension
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned short> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned int> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned long> : true_type {};
+template <>
+struct __libcpp_random_is_valid_inttype<unsigned long long> : true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
-template<> struct __libcpp_random_is_valid_inttype<__int128_t> : true_type {}; // extension
-template<> struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {}; // extension
-#endif // _LIBCPP_HAS_NO_INT128
+template <>
+struct __libcpp_random_is_valid_inttype<__int128_t> : true_type {}; // extension
+template <>
+struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {}; // extension
+#endif // _LIBCPP_HAS_NO_INT128
// [rand.req.urng]/3:
// A class G meets the uniform random bit generator requirements if G models
@@ -68,11 +81,13 @@ template<> struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {};
// (In particular, reject URNGs with signed result_types; our distributions cannot
// handle such generator types.)
-template<class, class = void> struct __libcpp_random_is_valid_urng : false_type {};
-template<class _Gp> struct __libcpp_random_is_valid_urng<_Gp, __enable_if_t<
- is_unsigned<typename _Gp::result_type>::value &&
- _IsSame<decltype(std::declval<_Gp&>()()), typename _Gp::result_type>::value
-> > : true_type {};
+template <class, class = void>
+struct __libcpp_random_is_valid_urng : false_type {};
+template <class _Gp>
+struct __libcpp_random_is_valid_urng<
+ _Gp,
+ __enable_if_t< is_unsigned<typename _Gp::result_type>::value &&
+ _IsSame<decltype(std::declval<_Gp&>()()), typename _Gp::result_type>::value > > : true_type {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h b/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h
index 9a4013ec8550..51f6b248d8f9 100644
--- a/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/linear_congruential_engine.h
@@ -26,367 +26,298 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <unsigned long long __a, unsigned long long __c,
- unsigned long long __m, unsigned long long _Mp,
- bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a),
- bool _OverflowOK = ((__m | (__m-1)) > __m), // m = 2^n
- bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
-struct __lce_alg_picker
-{
- static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK,
- "The current values of a, c, and m cannot generate a number "
- "within bounds of linear_congruential_engine.");
-
- static _LIBCPP_CONSTEXPR const bool __use_schrage = _MightOverflow &&
- !_OverflowOK &&
- _SchrageOK;
+template <unsigned long long __a,
+ unsigned long long __c,
+ unsigned long long __m,
+ unsigned long long _Mp,
+ bool _MightOverflow = (__a != 0 && __m != 0 && __m - 1 > (_Mp - __c) / __a),
+ bool _OverflowOK = ((__m | (__m - 1)) > __m), // m = 2^n
+ bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
+struct __lce_alg_picker {
+ static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK,
+ "The current values of a, c, and m cannot generate a number "
+ "within bounds of linear_congruential_engine.");
+
+ static _LIBCPP_CONSTEXPR const bool __use_schrage = _MightOverflow && !_OverflowOK && _SchrageOK;
};
-template <unsigned long long __a, unsigned long long __c,
- unsigned long long __m, unsigned long long _Mp,
+template <unsigned long long __a,
+ unsigned long long __c,
+ unsigned long long __m,
+ unsigned long long _Mp,
bool _UseSchrage = __lce_alg_picker<__a, __c, __m, _Mp>::__use_schrage>
struct __lce_ta;
// 64
template <unsigned long long __a, unsigned long long __c, unsigned long long __m>
-struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), true>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- __x += __c - (__x >= __m - __c) * __m;
- return __x;
- }
+struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), true> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ __x += __c - (__x >= __m - __c) * __m;
+ return __x;
+ }
};
template <unsigned long long __a, unsigned long long __m>
-struct __lce_ta<__a, 0, __m, (unsigned long long)(~0), true>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- return __x;
- }
+struct __lce_ta<__a, 0, __m, (unsigned long long)(~0), true> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ return __x;
+ }
};
template <unsigned long long __a, unsigned long long __c, unsigned long long __m>
-struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), false>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- return (__a * __x + __c) % __m;
- }
+struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), false> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) { return (__a * __x + __c) % __m; }
};
template <unsigned long long __a, unsigned long long __c>
-struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false>
-{
- typedef unsigned long long result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- return __a * __x + __c;
- }
+struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false> {
+ typedef unsigned long long result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) { return __a * __x + __c; }
};
// 32
template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
-struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), true>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __c = static_cast<result_type>(_Cp);
- const result_type __m = static_cast<result_type>(_Mp);
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- __x += __c - (__x >= __m - __c) * __m;
- return __x;
- }
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), true> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ const result_type __m = static_cast<result_type>(_Mp);
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ __x += __c - (__x >= __m - __c) * __m;
+ return __x;
+ }
};
template <unsigned long long _Ap, unsigned long long _Mp>
-struct __lce_ta<_Ap, 0, _Mp, unsigned(~0), true>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __m = static_cast<result_type>(_Mp);
- // Schrage's algorithm
- const result_type __q = __m / __a;
- const result_type __r = __m % __a;
- const result_type __t0 = __a * (__x % __q);
- const result_type __t1 = __r * (__x / __q);
- __x = __t0 + (__t0 < __t1) * __m - __t1;
- return __x;
- }
+struct __lce_ta<_Ap, 0, _Mp, unsigned(~0), true> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __m = static_cast<result_type>(_Mp);
+ // Schrage's algorithm
+ const result_type __q = __m / __a;
+ const result_type __r = __m % __a;
+ const result_type __t0 = __a * (__x % __q);
+ const result_type __t1 = __r * (__x / __q);
+ __x = __t0 + (__t0 < __t1) * __m - __t1;
+ return __x;
+ }
};
template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
-struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), false>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __c = static_cast<result_type>(_Cp);
- const result_type __m = static_cast<result_type>(_Mp);
- return (__a * __x + __c) % __m;
- }
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), false> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ const result_type __m = static_cast<result_type>(_Mp);
+ return (__a * __x + __c) % __m;
+ }
};
template <unsigned long long _Ap, unsigned long long _Cp>
-struct __lce_ta<_Ap, _Cp, 0, unsigned(~0), false>
-{
- typedef unsigned result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- const result_type __a = static_cast<result_type>(_Ap);
- const result_type __c = static_cast<result_type>(_Cp);
- return __a * __x + __c;
- }
+struct __lce_ta<_Ap, _Cp, 0, unsigned(~0), false> {
+ typedef unsigned result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ return __a * __x + __c;
+ }
};
// 16
template <unsigned long long __a, unsigned long long __c, unsigned long long __m, bool __b>
-struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b>
-{
- typedef unsigned short result_type;
- _LIBCPP_HIDE_FROM_ABI
- static result_type next(result_type __x)
- {
- return static_cast<result_type>(__lce_ta<__a, __c, __m, unsigned(~0)>::next(__x));
- }
+struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b> {
+ typedef unsigned short result_type;
+ _LIBCPP_HIDE_FROM_ABI static result_type next(result_type __x) {
+ return static_cast<result_type>(__lce_ta<__a, __c, __m, unsigned(~0)>::next(__x));
+ }
};
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class _LIBCPP_TEMPLATE_VIS linear_congruential_engine;
-template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
-_LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
+template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
-template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
+operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-class _LIBCPP_TEMPLATE_VIS linear_congruential_engine
-{
+class _LIBCPP_TEMPLATE_VIS linear_congruential_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- result_type __x_;
+ result_type __x_;
- static _LIBCPP_CONSTEXPR const result_type _Mp = result_type(~0);
+ static _LIBCPP_CONSTEXPR const result_type _Mp = result_type(~0);
+
+ static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
+ static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
+ static_assert(is_unsigned<_UIntType>::value, "_UIntType must be unsigned type");
- static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
- static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
- static_assert(is_unsigned<_UIntType>::value, "_UIntType must be unsigned type");
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u : 0u;
- static _LIBCPP_CONSTEXPR const result_type _Max = __m - _UIntType(1u);
- static_assert(_Min < _Max, "linear_congruential_engine invalid parameters");
-
- // engine characteristics
- static _LIBCPP_CONSTEXPR const result_type multiplier = __a;
- static _LIBCPP_CONSTEXPR const result_type increment = __c;
- static _LIBCPP_CONSTEXPR const result_type modulus = __m;
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() {return _Max;}
- static _LIBCPP_CONSTEXPR const result_type default_seed = 1u;
-
- // constructors and seeding functions
+ static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u : 0u;
+ static _LIBCPP_CONSTEXPR const result_type _Max = __m - _UIntType(1u);
+ static_assert(_Min < _Max, "linear_congruential_engine invalid parameters");
+
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const result_type multiplier = __a;
+ static _LIBCPP_CONSTEXPR const result_type increment = __c;
+ static _LIBCPP_CONSTEXPR const result_type modulus = __m;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+ static _LIBCPP_CONSTEXPR const result_type default_seed = 1u;
+
+ // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- linear_congruential_engine() : linear_congruential_engine(default_seed) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit linear_congruential_engine(result_type __s) { seed(__s); }
+ _LIBCPP_HIDE_FROM_ABI linear_congruential_engine() : linear_congruential_engine(default_seed) {}
+ _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(result_type __s) { seed(__s); }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit linear_congruential_engine(result_type __s = default_seed) {
- seed(__s);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(result_type __s = default_seed) { seed(__s); }
#endif
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit linear_congruential_engine(_Sseq& __q)
- {seed(__q);}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __s = default_seed)
- {seed(integral_constant<bool, __m == 0>(),
- integral_constant<bool, __c == 0>(), __s);}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q)
- {__seed(__q, integral_constant<unsigned,
- 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1)/32
- : (__m > 0x100000000ull))>());}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()()
- {return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_));}
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const linear_congruential_engine& __x,
- const linear_congruential_engine& __y)
- {return __x.__x_ == __y.__x_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const linear_congruential_engine& __x,
- const linear_congruential_engine& __y)
- {return !(__x == __y);}
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(_Sseq& __q) {
+ seed(__q);
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __s = default_seed) {
+ seed(integral_constant<bool, __m == 0>(), integral_constant<bool, __c == 0>(), __s);
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __seed(
+ __q,
+ integral_constant<unsigned,
+ 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1) / 32 : (__m > 0x100000000ull))>());
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() {
+ return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_));
+ }
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const linear_congruential_engine& __x, const linear_congruential_engine& __y) {
+ return __x.__x_ == __y.__x_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const linear_congruential_engine& __x, const linear_congruential_engine& __y) {
+ return !(__x == __y);
+ }
private:
-
- _LIBCPP_HIDE_FROM_ABI
- void seed(true_type, true_type, result_type __s) {__x_ = __s == 0 ? 1 : __s;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(true_type, false_type, result_type __s) {__x_ = __s;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(false_type, true_type, result_type __s) {__x_ = __s % __m == 0 ?
- 1 : __s % __m;}
- _LIBCPP_HIDE_FROM_ABI
- void seed(false_type, false_type, result_type __s) {__x_ = __s % __m;}
-
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
-
- template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
-
- template <class _CharT, class _Traits,
- class _Up, _Up _Ap, _Up _Cp, _Up _Np>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
+ _LIBCPP_HIDE_FROM_ABI void seed(true_type, true_type, result_type __s) { __x_ = __s == 0 ? 1 : __s; }
+ _LIBCPP_HIDE_FROM_ABI void seed(true_type, false_type, result_type __s) { __x_ = __s; }
+ _LIBCPP_HIDE_FROM_ABI void seed(false_type, true_type, result_type __s) { __x_ = __s % __m == 0 ? 1 : __s % __m; }
+ _LIBCPP_HIDE_FROM_ABI void seed(false_type, false_type, result_type __s) { __x_ = __s % __m; }
+
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+
+ template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
+
+ template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
};
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
- _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
+_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-template<class _Sseq>
-void
-linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q,
- integral_constant<unsigned, 1>)
-{
- const unsigned __k = 1;
- uint32_t __ar[__k+3];
- __q.generate(__ar, __ar + __k + 3);
- result_type __s = static_cast<result_type>(__ar[3] % __m);
- __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
+template <class _Sseq>
+void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) {
+ const unsigned __k = 1;
+ uint32_t __ar[__k + 3];
+ __q.generate(__ar, __ar + __k + 3);
+ result_type __s = static_cast<result_type>(__ar[3] % __m);
+ __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
}
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-template<class _Sseq>
-void
-linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q,
- integral_constant<unsigned, 2>)
-{
- const unsigned __k = 2;
- uint32_t __ar[__k+3];
- __q.generate(__ar, __ar + __k + 3);
- result_type __s = static_cast<result_type>((__ar[3] +
- ((uint64_t)__ar[4] << 32)) % __m);
- __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
+template <class _Sseq>
+void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) {
+ const unsigned __k = 2;
+ uint32_t __ar[__k + 3];
+ __q.generate(__ar, __ar + __k + 3);
+ result_type __s = static_cast<result_type>((__ar[3] + ((uint64_t)__ar[4] << 32)) % __m);
+ __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
}
-template <class _CharT, class _Traits,
- class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- __os.fill(__os.widen(' '));
- return __os << __x.__x_;
+template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ __os.fill(__os.widen(' '));
+ return __os << __x.__x_;
}
-template <class _CharT, class _Traits,
- class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _UIntType __t;
- __is >> __t;
- if (!__is.fail())
- __x.__x_ = __t;
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_UIntType, __a, __c, __m>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _UIntType __t;
+ __is >> __t;
+ if (!__is.fail())
+ __x.__x_ = __t;
+ return __is;
}
-typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647>
- minstd_rand0;
-typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647>
- minstd_rand;
+typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647> minstd_rand0;
+typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647> minstd_rand;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/log2.h b/contrib/llvm-project/libcxx/include/__random/log2.h
index 4ccd1ddc9bf2..74b4889c6402 100644
--- a/contrib/llvm-project/libcxx/include/__random/log2.h
+++ b/contrib/llvm-project/libcxx/include/__random/log2.h
@@ -23,47 +23,42 @@ template <class _UIntType, _UIntType _Xp, size_t _Rp>
struct __log2_imp;
template <unsigned long long _Xp, size_t _Rp>
-struct __log2_imp<unsigned long long, _Xp, _Rp>
-{
- static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp
- : __log2_imp<unsigned long long, _Xp, _Rp - 1>::value;
+struct __log2_imp<unsigned long long, _Xp, _Rp> {
+ static const size_t value =
+ _Xp & ((unsigned long long)(1) << _Rp) ? _Rp : __log2_imp<unsigned long long, _Xp, _Rp - 1>::value;
};
template <unsigned long long _Xp>
-struct __log2_imp<unsigned long long, _Xp, 0>
-{
- static const size_t value = 0;
+struct __log2_imp<unsigned long long, _Xp, 0> {
+ static const size_t value = 0;
};
template <size_t _Rp>
-struct __log2_imp<unsigned long long, 0, _Rp>
-{
- static const size_t value = _Rp + 1;
+struct __log2_imp<unsigned long long, 0, _Rp> {
+ static const size_t value = _Rp + 1;
};
#ifndef _LIBCPP_HAS_NO_INT128
template <__uint128_t _Xp, size_t _Rp>
-struct __log2_imp<__uint128_t, _Xp, _Rp>
-{
- static const size_t value = (_Xp >> 64)
- ? (64 + __log2_imp<unsigned long long, (_Xp >> 64), 63>::value)
- : __log2_imp<unsigned long long, _Xp, 63>::value;
+struct __log2_imp<__uint128_t, _Xp, _Rp> {
+ static const size_t value =
+ (_Xp >> 64) ? (64 + __log2_imp<unsigned long long, (_Xp >> 64), 63>::value)
+ : __log2_imp<unsigned long long, _Xp, 63>::value;
};
#endif // _LIBCPP_HAS_NO_INT128
template <class _UIntType, _UIntType _Xp>
-struct __log2
-{
- static const size_t value = __log2_imp<
+struct __log2 {
+ static const size_t value = __log2_imp<
#ifndef _LIBCPP_HAS_NO_INT128
- __conditional_t<sizeof(_UIntType) <= sizeof(unsigned long long), unsigned long long, __uint128_t>,
+ __conditional_t<sizeof(_UIntType) <= sizeof(unsigned long long), unsigned long long, __uint128_t>,
#else
- unsigned long long,
+ unsigned long long,
#endif // _LIBCPP_HAS_NO_INT128
- _Xp,
- sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
+ _Xp,
+ sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h b/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h
index 47db56ee4529..d8724f8bc5ce 100644
--- a/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/lognormal_distribution.h
@@ -25,137 +25,98 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS lognormal_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS lognormal_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __m_;
- result_type __s_;
- public:
- typedef lognormal_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __m = 0, result_type __s = 1)
- : __m_(__m), __s_(__s) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __m_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type s() const {return __s_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__m_ == __y.__m_ && __x.__s_ == __y.__s_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __m_;
+ result_type __s_;
+
+ public:
+ typedef lognormal_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 0, result_type __s = 1) : __m_(__m), __s_(__s) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI result_type s() const { return __s_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__m_ == __y.__m_ && __x.__s_ == __y.__s_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- normal_distribution<result_type> __nd_;
+ normal_distribution<result_type> __nd_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- lognormal_distribution() : lognormal_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit lognormal_distribution(result_type __m, result_type __s = 1)
- : __nd_(__m, __s) {}
+ _LIBCPP_HIDE_FROM_ABI lognormal_distribution() : lognormal_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit lognormal_distribution(result_type __m, result_type __s = 1) : __nd_(__m, __s) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit lognormal_distribution(result_type __m = 0,
- result_type __s = 1)
- : __nd_(__m, __s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit lognormal_distribution(result_type __m = 0, result_type __s = 1) : __nd_(__m, __s) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit lognormal_distribution(const param_type& __p)
- : __nd_(__p.m(), __p.s()) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {__nd_.reset();}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {
- return std::exp(__nd_(__g));
- }
-
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {
- typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
- return std::exp(__nd_(__g, __pn));
- }
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type m() const {return __nd_.mean();}
- _LIBCPP_HIDE_FROM_ABI
- result_type s() const {return __nd_.stddev();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return param_type(__nd_.mean(), __nd_.stddev());}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p)
- {
- typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
- __nd_.param(__pn);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const lognormal_distribution& __x,
- const lognormal_distribution& __y)
- {return __x.__nd_ == __y.__nd_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const lognormal_distribution& __x,
- const lognormal_distribution& __y)
- {return !(__x == __y);}
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const lognormal_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- lognormal_distribution<_RT>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit lognormal_distribution(const param_type& __p) : __nd_(__p.m(), __p.s()) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() { __nd_.reset(); }
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return std::exp(__nd_(__g));
+ }
+
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
+ return std::exp(__nd_(__g, __pn));
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type m() const { return __nd_.mean(); }
+ _LIBCPP_HIDE_FROM_ABI result_type s() const { return __nd_.stddev(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return param_type(__nd_.mean(), __nd_.stddev()); }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) {
+ typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
+ __nd_.param(__pn);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const lognormal_distribution& __x, const lognormal_distribution& __y) {
+ return __x.__nd_ == __y.__nd_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const lognormal_distribution& __x, const lognormal_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const lognormal_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, lognormal_distribution<_RT>& __x);
};
template <class _CharT, class _Traits, class _RT>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const lognormal_distribution<_RT>& __x)
-{
- return __os << __x.__nd_;
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const lognormal_distribution<_RT>& __x) {
+ return __os << __x.__nd_;
}
template <class _CharT, class _Traits, class _RT>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- lognormal_distribution<_RT>& __x)
-{
- return __is >> __x.__nd_;
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, lognormal_distribution<_RT>& __x) {
+ return __is >> __x.__nd_;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h b/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h
index abc5ec255bc6..65280d7c5505 100644
--- a/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/mersenne_twister_engine.h
@@ -27,483 +27,885 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine;
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+_LIBCPP_HIDE_FROM_ABI bool
+operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine
-{
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- result_type __x_[__n];
- size_t __i_;
-
- static_assert( 0 < __m, "mersenne_twister_engine invalid parameters");
- static_assert(__m <= __n, "mersenne_twister_engine invalid parameters");
- static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
- static_assert(__w <= _Dt, "mersenne_twister_engine invalid parameters");
- static_assert( 2 <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__r <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__u <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__s <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__t <= __w, "mersenne_twister_engine invalid parameters");
- static_assert(__l <= __w, "mersenne_twister_engine invalid parameters");
+ result_type __x_[__n];
+ size_t __i_;
+
+ static_assert(0 < __m, "mersenne_twister_engine invalid parameters");
+ static_assert(__m <= __n, "mersenne_twister_engine invalid parameters");
+ static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+ static_assert(__w <= _Dt, "mersenne_twister_engine invalid parameters");
+ static_assert(2 <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__r <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__u <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__s <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__t <= __w, "mersenne_twister_engine invalid parameters");
+ static_assert(__l <= __w, "mersenne_twister_engine invalid parameters");
+
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
- (result_type(1) << __w) - result_type(1);
- static_assert(_Min < _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__a <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__b <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__c <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__d <= _Max, "mersenne_twister_engine invalid parameters");
- static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters");
-
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t word_size = __w;
- static _LIBCPP_CONSTEXPR const size_t state_size = __n;
- static _LIBCPP_CONSTEXPR const size_t shift_size = __m;
- static _LIBCPP_CONSTEXPR const size_t mask_bits = __r;
- static _LIBCPP_CONSTEXPR const result_type xor_mask = __a;
- static _LIBCPP_CONSTEXPR const size_t tempering_u = __u;
- static _LIBCPP_CONSTEXPR const result_type tempering_d = __d;
- static _LIBCPP_CONSTEXPR const size_t tempering_s = __s;
- static _LIBCPP_CONSTEXPR const result_type tempering_b = __b;
- static _LIBCPP_CONSTEXPR const size_t tempering_t = __t;
- static _LIBCPP_CONSTEXPR const result_type tempering_c = __c;
- static _LIBCPP_CONSTEXPR const size_t tempering_l = __l;
- static _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f;
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
- static _LIBCPP_CONSTEXPR const result_type default_seed = 5489u;
-
- // constructors and seeding functions
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max =
+ __w == _Dt ? result_type(~0) : (result_type(1) << __w) - result_type(1);
+ static_assert(_Min < _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__a <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__b <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__c <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__d <= _Max, "mersenne_twister_engine invalid parameters");
+ static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters");
+
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t word_size = __w;
+ static _LIBCPP_CONSTEXPR const size_t state_size = __n;
+ static _LIBCPP_CONSTEXPR const size_t shift_size = __m;
+ static _LIBCPP_CONSTEXPR const size_t mask_bits = __r;
+ static _LIBCPP_CONSTEXPR const result_type xor_mask = __a;
+ static _LIBCPP_CONSTEXPR const size_t tempering_u = __u;
+ static _LIBCPP_CONSTEXPR const result_type tempering_d = __d;
+ static _LIBCPP_CONSTEXPR const size_t tempering_s = __s;
+ static _LIBCPP_CONSTEXPR const result_type tempering_b = __b;
+ static _LIBCPP_CONSTEXPR const size_t tempering_t = __t;
+ static _LIBCPP_CONSTEXPR const result_type tempering_c = __c;
+ static _LIBCPP_CONSTEXPR const size_t tempering_l = __l;
+ static _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+ static _LIBCPP_CONSTEXPR const result_type default_seed = 5489u;
+
+ // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- mersenne_twister_engine() : mersenne_twister_engine(default_seed) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit mersenne_twister_engine(result_type __sd) { seed(__sd); }
+ _LIBCPP_HIDE_FROM_ABI mersenne_twister_engine() : mersenne_twister_engine(default_seed) {}
+ _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(result_type __sd) { seed(__sd); }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit mersenne_twister_engine(result_type __sd = default_seed) {
- seed(__sd);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(result_type __sd = default_seed) { seed(__sd); }
#endif
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit mersenne_twister_engine(_Sseq& __q)
- {seed(__q);}
- _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed);
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q)
- {__seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()();
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- bool
- operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
- template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- bool
- operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
-private:
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(_Sseq& __q) {
+ seed(__q);
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed);
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()();
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend bool operator==(
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+ template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend bool operator!=(
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+ template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend basic_ostream<_CharT, _Traits>& operator<<(
+ basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
+
+ template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
-
- template <size_t __count, __enable_if_t<__count < __w, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type __x) {return (__x << __count) & _Max;}
-
- template <size_t __count, __enable_if_t<(__count >= __w), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __lshift(result_type) {return result_type(0);}
-
- template <size_t __count, __enable_if_t<__count < _Dt, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __rshift(result_type __x) {return __x >> __count;}
-
- template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static
- result_type
- __rshift(result_type) {return result_type(0);}
+private:
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+
+ template <size_t __count,
+ __enable_if_t<__count< __w, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
+ return (__x << __count) & _Max;
+ }
+
+ template <size_t __count, __enable_if_t<(__count >= __w), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type) {
+ return result_type(0);
+ }
+
+ template <size_t __count,
+ __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type __x) {
+ return __x >> __count;
+ }
+
+ template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type) {
+ return result_type(0);
+ }
};
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::word_size;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::xor_mask;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_d;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_b;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_c;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const size_t
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
- mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::initialization_multiplier;
-
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
- _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
+ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::
+ initialization_multiplier;
+
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
+ _UIntType,
+ __w,
+ __n,
+ __m,
+ __r,
+ __a,
+ __u,
+ __d,
+ __s,
+ __b,
+ __t,
+ __c,
+ __l,
+ __f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::default_seed;
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-void
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::seed(result_type __sd)
- _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{ // __w >= 2
- __x_[0] = __sd & _Max;
- for (size_t __i = 1; __i < __n; ++__i)
- __x_[__i] = (__f * (__x_[__i-1] ^ __rshift<__w - 2>(__x_[__i-1])) + __i) & _Max;
- __i_ = 0;
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::seed(
+ result_type __sd) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { // __w >= 2
+ __x_[0] = __sd & _Max;
+ for (size_t __i = 1; __i < __n; ++__i)
+ __x_[__i] = (__f * (__x_[__i - 1] ^ __rshift<__w - 2>(__x_[__i - 1])) + __i) & _Max;
+ __i_ = 0;
}
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-template<class _Sseq>
-void
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::__seed(_Sseq& __q, integral_constant<unsigned, 1>)
-{
- const unsigned __k = 1;
- uint32_t __ar[__n * __k];
- __q.generate(__ar, __ar + __n * __k);
- for (size_t __i = 0; __i < __n; ++__i)
- __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
- const result_type __mask = __r == _Dt ? result_type(~0) :
- (result_type(1) << __r) - result_type(1);
- __i_ = 0;
- if ((__x_[0] & ~__mask) == 0)
- {
- for (size_t __i = 1; __i < __n; ++__i)
- if (__x_[__i] != 0)
- return;
- __x_[0] = result_type(1) << (__w - 1);
- }
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+template <class _Sseq>
+void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::__seed(
+ _Sseq& __q, integral_constant<unsigned, 1>) {
+ const unsigned __k = 1;
+ uint32_t __ar[__n * __k];
+ __q.generate(__ar, __ar + __n * __k);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
+ const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
+ __i_ = 0;
+ if ((__x_[0] & ~__mask) == 0) {
+ for (size_t __i = 1; __i < __n; ++__i)
+ if (__x_[__i] != 0)
+ return;
+ __x_[0] = result_type(1) << (__w - 1);
+ }
}
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-template<class _Sseq>
-void
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::__seed(_Sseq& __q, integral_constant<unsigned, 2>)
-{
- const unsigned __k = 2;
- uint32_t __ar[__n * __k];
- __q.generate(__ar, __ar + __n * __k);
- for (size_t __i = 0; __i < __n; ++__i)
- __x_[__i] = static_cast<result_type>(
- (__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
- const result_type __mask = __r == _Dt ? result_type(~0) :
- (result_type(1) << __r) - result_type(1);
- __i_ = 0;
- if ((__x_[0] & ~__mask) == 0)
- {
- for (size_t __i = 1; __i < __n; ++__i)
- if (__x_[__i] != 0)
- return;
- __x_[0] = result_type(1) << (__w - 1);
- }
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
+template <class _Sseq>
+void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::__seed(
+ _Sseq& __q, integral_constant<unsigned, 2>) {
+ const unsigned __k = 2;
+ uint32_t __ar[__n * __k];
+ __q.generate(__ar, __ar + __n * __k);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
+ const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
+ __i_ = 0;
+ if ((__x_[0] & ~__mask) == 0) {
+ for (size_t __i = 1; __i < __n; ++__i)
+ if (__x_[__i] != 0)
+ return;
+ __x_[0] = result_type(1) << (__w - 1);
+ }
}
-template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
- _UIntType __a, size_t __u, _UIntType __d, size_t __s,
- _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
+template <class _UIntType,
+ size_t __w,
+ size_t __n,
+ size_t __m,
+ size_t __r,
+ _UIntType __a,
+ size_t __u,
+ _UIntType __d,
+ size_t __s,
+ _UIntType __b,
+ size_t __t,
+ _UIntType __c,
+ size_t __l,
+ _UIntType __f>
_UIntType
-mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
- __t, __c, __l, __f>::operator()()
-{
- const size_t __j = (__i_ + 1) % __n;
- const result_type __mask = __r == _Dt ? result_type(~0) :
- (result_type(1) << __r) - result_type(1);
- const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
- const size_t __k = (__i_ + __m) % __n;
- __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
- result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
- __i_ = __j;
- __z ^= __lshift<__s>(__z) & __b;
- __z ^= __lshift<__t>(__z) & __c;
- return __z ^ __rshift<__l>(__z);
+mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::operator()() {
+ const size_t __j = (__i_ + 1) % __n;
+ const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
+ const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
+ const size_t __k = (__i_ + __m) % __n;
+ __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
+ result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
+ __i_ = __j;
+ __z ^= __lshift<__s>(__z) & __b;
+ __z ^= __lshift<__t>(__z) & __c;
+ return __z ^ __rshift<__l>(__z);
}
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
-{
- if (__x.__i_ == __y.__i_)
- return std::equal(__x.__x_, __x.__x_ + _Np, __y.__x_);
- if (__x.__i_ == 0 || __y.__i_ == 0)
- {
- size_t __j = std::min(_Np - __x.__i_, _Np - __y.__i_);
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
- __y.__x_ + __y.__i_))
- return false;
- if (__x.__i_ == 0)
- return std::equal(__x.__x_ + __j, __x.__x_ + _Np, __y.__x_);
- return std::equal(__x.__x_, __x.__x_ + (_Np - __j), __y.__x_ + __j);
- }
- if (__x.__i_ < __y.__i_)
- {
- size_t __j = _Np - __y.__i_;
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
- __y.__x_ + __y.__i_))
- return false;
- if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Np,
- __y.__x_))
- return false;
- return std::equal(__x.__x_, __x.__x_ + __x.__i_,
- __y.__x_ + (_Np - (__x.__i_ + __j)));
- }
- size_t __j = _Np - __x.__i_;
- if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
- __x.__x_ + __x.__i_))
- return false;
- if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Np,
- __x.__x_))
- return false;
- return std::equal(__y.__x_, __y.__x_ + __y.__i_,
- __x.__x_ + (_Np - (__y.__i_ + __j)));
+operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) {
+ if (__x.__i_ == __y.__i_)
+ return std::equal(__x.__x_, __x.__x_ + _Np, __y.__x_);
+ if (__x.__i_ == 0 || __y.__i_ == 0) {
+ size_t __j = std::min(_Np - __x.__i_, _Np - __y.__i_);
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_))
+ return false;
+ if (__x.__i_ == 0)
+ return std::equal(__x.__x_ + __j, __x.__x_ + _Np, __y.__x_);
+ return std::equal(__x.__x_, __x.__x_ + (_Np - __j), __y.__x_ + __j);
+ }
+ if (__x.__i_ < __y.__i_) {
+ size_t __j = _Np - __y.__i_;
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_))
+ return false;
+ if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Np, __y.__x_))
+ return false;
+ return std::equal(__x.__x_, __x.__x_ + __x.__i_, __y.__x_ + (_Np - (__x.__i_ + __j)));
+ }
+ size_t __j = _Np - __x.__i_;
+ if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_))
+ return false;
+ if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Np, __x.__x_))
+ return false;
+ return std::equal(__y.__x_, __y.__x_ + __y.__i_, __x.__x_ + (_Np - (__y.__i_ + __j)));
}
-template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
-{
- return !(__x == __y);
+template <class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.__x_[__x.__i_];
- for (size_t __j = __x.__i_ + 1; __j < _Np; ++__j)
- __os << __sp << __x.__x_[__j];
- for (size_t __j = 0; __j < __x.__i_; ++__j)
- __os << __sp << __x.__x_[__j];
- return __os;
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.__x_[__x.__i_];
+ for (size_t __j = __x.__i_ + 1; __j < _Np; ++__j)
+ __os << __sp << __x.__x_[__j];
+ for (size_t __j = 0; __j < __x.__i_; ++__j)
+ __os << __sp << __x.__x_[__j];
+ return __os;
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
- _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
+template <class _CharT,
+ class _Traits,
+ class _UInt,
+ size_t _Wp,
+ size_t _Np,
+ size_t _Mp,
+ size_t _Rp,
+ _UInt _Ap,
+ size_t _Up,
+ _UInt _Dp,
+ size_t _Sp,
+ _UInt _Bp,
+ size_t _Tp,
+ _UInt _Cp,
+ size_t _Lp,
+ _UInt _Fp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
- _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _UInt __t[_Np];
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _UInt __t[_Np];
+ for (size_t __i = 0; __i < _Np; ++__i)
+ __is >> __t[__i];
+ if (!__is.fail()) {
for (size_t __i = 0; __i < _Np; ++__i)
- __is >> __t[__i];
- if (!__is.fail())
- {
- for (size_t __i = 0; __i < _Np; ++__i)
- __x.__x_[__i] = __t[__i];
- __x.__i_ = 0;
- }
- return __is;
+ __x.__x_[__i] = __t[__i];
+ __x.__i_ = 0;
+ }
+ return __is;
}
-typedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31,
- 0x9908b0df, 11, 0xffffffff,
- 7, 0x9d2c5680,
- 15, 0xefc60000,
- 18, 1812433253> mt19937;
-typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
- 0xb5026f5aa96619e9ULL, 29, 0x5555555555555555ULL,
- 17, 0x71d67fffeda60000ULL,
- 37, 0xfff7eee000000000ULL,
- 43, 6364136223846793005ULL> mt19937_64;
+typedef mersenne_twister_engine<
+ uint_fast32_t,
+ 32,
+ 624,
+ 397,
+ 31,
+ 0x9908b0df,
+ 11,
+ 0xffffffff,
+ 7,
+ 0x9d2c5680,
+ 15,
+ 0xefc60000,
+ 18,
+ 1812433253>
+ mt19937;
+typedef mersenne_twister_engine<
+ uint_fast64_t,
+ 64,
+ 312,
+ 156,
+ 31,
+ 0xb5026f5aa96619e9ULL,
+ 29,
+ 0x5555555555555555ULL,
+ 17,
+ 0x71d67fffeda60000ULL,
+ 37,
+ 0xfff7eee000000000ULL,
+ 43,
+ 6364136223846793005ULL>
+ mt19937_64;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h b/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h
index 57b7a71de21e..580c74d46440 100644
--- a/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/negative_binomial_distribution.h
@@ -26,156 +26,128 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS negative_binomial_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS negative_binomial_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __k_;
- double __p_;
- public:
- typedef negative_binomial_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __k = 1, double __p = 0.5)
- : __k_(__k), __p_(__p) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type k() const {return __k_;}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __k_;
+ double __p_;
+
+ public:
+ typedef negative_binomial_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __k = 1, double __p = 0.5) : __k_(__k), __p_(__p) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type k() const { return __k_; }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- negative_binomial_distribution() : negative_binomial_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit negative_binomial_distribution(result_type __k, double __p = 0.5)
- : __p_(__k, __p) {}
+ _LIBCPP_HIDE_FROM_ABI negative_binomial_distribution() : negative_binomial_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit negative_binomial_distribution(result_type __k, double __p = 0.5) : __p_(__k, __p) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit negative_binomial_distribution(result_type __k = 1,
- double __p = 0.5)
- : __p_(__k, __p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit negative_binomial_distribution(result_type __k = 1, double __p = 0.5)
+ : __p_(__k, __p) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit negative_binomial_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type k() const {return __p_.k();}
- _LIBCPP_HIDE_FROM_ABI
- double p() const {return __p_.p();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::max();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const negative_binomial_distribution& __x,
- const negative_binomial_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const negative_binomial_distribution& __x,
- const negative_binomial_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit negative_binomial_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type k() const { return __p_.k(); }
+ _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const negative_binomial_distribution& __x, const negative_binomial_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const negative_binomial_distribution& __x, const negative_binomial_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _IntType>
-template<class _URNG>
-_IntType
-negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- result_type __k = __pr.k();
- double __p = __pr.p();
- // When the number of bits in _IntType is small, we are too likely to
- // overflow __f below to use this technique.
- if (__k <= 21 * __p && sizeof(_IntType) > 1)
- {
- bernoulli_distribution __gen(__p);
- result_type __f = 0;
- result_type __s = 0;
- while (__s < __k)
- {
- if (__gen(__urng))
- ++__s;
- else
- ++__f;
- }
- _LIBCPP_ASSERT_UNCATEGORIZED(__f >= 0,
- "std::negative_binomial_distribution should never produce negative values. "
- "This is almost certainly a signed integer overflow issue on __f.");
- return __f;
+template <class _URNG>
+_IntType negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ result_type __k = __pr.k();
+ double __p = __pr.p();
+ // When the number of bits in _IntType is small, we are too likely to
+ // overflow __f below to use this technique.
+ if (__k <= 21 * __p && sizeof(_IntType) > 1) {
+ bernoulli_distribution __gen(__p);
+ result_type __f = 0;
+ result_type __s = 0;
+ while (__s < __k) {
+ if (__gen(__urng))
+ ++__s;
+ else
+ ++__f;
}
- return poisson_distribution<result_type>(gamma_distribution<double>
- (__k, (1-__p)/__p)(__urng))(__urng);
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __f >= 0,
+ "std::negative_binomial_distribution should never produce negative values. "
+ "This is almost certainly a signed integer overflow issue on __f.");
+ return __f;
+ }
+ return poisson_distribution<result_type>(gamma_distribution<double>(__k, (1 - __p) / __p)(__urng))(__urng);
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const negative_binomial_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.k() << __sp << __x.p();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const negative_binomial_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.k() << __sp << __x.p();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- negative_binomial_distribution<_IntType>& __x)
-{
- typedef negative_binomial_distribution<_IntType> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __k;
- double __p;
- __is >> __k >> __p;
- if (!__is.fail())
- __x.param(param_type(__k, __p));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, negative_binomial_distribution<_IntType>& __x) {
+ typedef negative_binomial_distribution<_IntType> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __k;
+ double __p;
+ __is >> __k >> __p;
+ if (!__is.fail())
+ __x.param(param_type(__k, __p));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/normal_distribution.h b/contrib/llvm-project/libcxx/include/__random/normal_distribution.h
index 9d68ea6118fd..889f189e4161 100644
--- a/contrib/llvm-project/libcxx/include/__random/normal_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/normal_distribution.h
@@ -25,186 +25,148 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS normal_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS normal_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __mean_;
- result_type __stddev_;
- public:
- typedef normal_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __mean = 0, result_type __stddev = 1)
- : __mean_(__mean), __stddev_(__stddev) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type mean() const {return __mean_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type stddev() const {return __stddev_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __mean_;
+ result_type __stddev_;
+
+ public:
+ typedef normal_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __mean = 0, result_type __stddev = 1)
+ : __mean_(__mean), __stddev_(__stddev) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __mean_; }
+ _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __stddev_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
- result_type __v_;
- bool __v_hot_;
+ param_type __p_;
+ result_type __v_;
+ bool __v_hot_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- normal_distribution() : normal_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit normal_distribution(result_type __mean, result_type __stddev = 1)
- : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
+ _LIBCPP_HIDE_FROM_ABI normal_distribution() : normal_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit normal_distribution(result_type __mean, result_type __stddev = 1)
+ : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit normal_distribution(result_type __mean = 0,
- result_type __stddev = 1)
- : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
+ _LIBCPP_HIDE_FROM_ABI explicit normal_distribution(result_type __mean = 0, result_type __stddev = 1)
+ : __p_(param_type(__mean, __stddev)), __v_hot_(false) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit normal_distribution(const param_type& __p)
- : __p_(__p), __v_hot_(false) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {__v_hot_ = false;}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type mean() const {return __p_.mean();}
- _LIBCPP_HIDE_FROM_ABI
- result_type stddev() const {return __p_.stddev();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const normal_distribution& __x,
- const normal_distribution& __y)
- {return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ &&
- (!__x.__v_hot_ || __x.__v_ == __y.__v_);}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const normal_distribution& __x,
- const normal_distribution& __y)
- {return !(__x == __y);}
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const normal_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- normal_distribution<_RT>& __x);
+ _LIBCPP_HIDE_FROM_ABI explicit normal_distribution(const param_type& __p) : __p_(__p), __v_hot_(false) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() { __v_hot_ = false; }
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __p_.mean(); }
+ _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __p_.stddev(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const normal_distribution& __x, const normal_distribution& __y) {
+ return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ && (!__x.__v_hot_ || __x.__v_ == __y.__v_);
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const normal_distribution& __x, const normal_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, normal_distribution<_RT>& __x);
};
template <class _RealType>
-template<class _URNG>
-_RealType
-normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- result_type __up;
- if (__v_hot_)
- {
- __v_hot_ = false;
- __up = __v_;
- }
- else
- {
- uniform_real_distribution<result_type> __uni(-1, 1);
- result_type __u;
- result_type __v;
- result_type __s;
- do
- {
- __u = __uni(__g);
- __v = __uni(__g);
- __s = __u * __u + __v * __v;
- } while (__s > 1 || __s == 0);
- result_type __fp = std::sqrt(-2 * std::log(__s) / __s);
- __v_ = __v * __fp;
- __v_hot_ = true;
- __up = __u * __fp;
- }
- return __up * __p.stddev() + __p.mean();
+template <class _URNG>
+_RealType normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ result_type __up;
+ if (__v_hot_) {
+ __v_hot_ = false;
+ __up = __v_;
+ } else {
+ uniform_real_distribution<result_type> __uni(-1, 1);
+ result_type __u;
+ result_type __v;
+ result_type __s;
+ do {
+ __u = __uni(__g);
+ __v = __uni(__g);
+ __s = __u * __u + __v * __v;
+ } while (__s > 1 || __s == 0);
+ result_type __fp = std::sqrt(-2 * std::log(__s) / __s);
+ __v_ = __v * __fp;
+ __v_hot_ = true;
+ __up = __u * __fp;
+ }
+ return __up * __p.stddev() + __p.mean();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const normal_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.mean() << __sp << __x.stddev() << __sp << __x.__v_hot_;
- if (__x.__v_hot_)
- __os << __sp << __x.__v_;
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.mean() << __sp << __x.stddev() << __sp << __x.__v_hot_;
+ if (__x.__v_hot_)
+ __os << __sp << __x.__v_;
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- normal_distribution<_RT>& __x)
-{
- typedef normal_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __mean;
- result_type __stddev;
- result_type __vp = 0;
- bool __v_hot = false;
- __is >> __mean >> __stddev >> __v_hot;
- if (__v_hot)
- __is >> __vp;
- if (!__is.fail())
- {
- __x.param(param_type(__mean, __stddev));
- __x.__v_hot_ = __v_hot;
- __x.__v_ = __vp;
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, normal_distribution<_RT>& __x) {
+ typedef normal_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __mean;
+ result_type __stddev;
+ result_type __vp = 0;
+ bool __v_hot = false;
+ __is >> __mean >> __stddev >> __v_hot;
+ if (__v_hot)
+ __is >> __vp;
+ if (!__is.fail()) {
+ __x.param(param_type(__mean, __stddev));
+ __x.__v_hot_ = __v_hot;
+ __x.__v_ = __vp;
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h b/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h
index 3a60e5533d77..e19380f97c35 100644
--- a/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/piecewise_constant_distribution.h
@@ -26,333 +26,273 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS piecewise_constant_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS piecewise_constant_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- vector<result_type> __b_;
- vector<result_type> __densities_;
- vector<result_type> __areas_;
- public:
- typedef piecewise_constant_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI param_type();
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b,
- _InputIteratorW __f_w);
-#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
-#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax,
- _UnaryOperation __fw);
- _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
- _LIBCPP_HIDE_FROM_ABI param_type & operator=(const param_type& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __b_;}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __densities_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
-
- private:
- _LIBCPP_HIDE_FROM_ABI void __init();
-
- friend class piecewise_constant_distribution;
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_constant_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_constant_distribution<_RT>& __x);
- };
+ // types
+ typedef _RealType result_type;
-private:
- param_type __p_;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ vector<result_type> __b_;
+ vector<result_type> __densities_;
+ vector<result_type> __areas_;
-public:
- // constructor and reset functions
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution() {}
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution(_InputIteratorB __f_b,
- _InputIteratorB __l_b,
- _InputIteratorW __f_w)
- : __p_(__f_b, __l_b, __f_w) {}
+ public:
+ typedef piecewise_constant_distribution distribution_type;
+ _LIBCPP_HIDE_FROM_ABI param_type();
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w);
#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution(initializer_list<result_type> __bl,
- _UnaryOperation __fw)
- : __p_(__bl, __fw) {}
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
#endif // _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw);
+ _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
+ _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs);
+
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_constant_distribution(size_t __nw, result_type __xmin,
- result_type __xmax, _UnaryOperation __fw)
- : __p_(__nw, __xmin, __xmax, __fw) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit piecewise_constant_distribution(const param_type& __p)
- : __p_(__p) {}
-
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __p_.intervals();}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __p_.densities();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return __p_.__b_.front();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return __p_.__b_.back();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const piecewise_constant_distribution& __x,
- const piecewise_constant_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const piecewise_constant_distribution& __x,
- const piecewise_constant_distribution& __y)
- {return !(__x == __y);}
+ private:
+ _LIBCPP_HIDE_FROM_ABI void __init();
+
+ friend class piecewise_constant_distribution;
template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_constant_distribution<_RT>& __x);
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RT>& __x);
template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_constant_distribution<_RT>& __x);
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_constant_distribution<_RT>& __x);
+ };
+
+private:
+ param_type __p_;
+
+public:
+ // constructor and reset functions
+ _LIBCPP_HIDE_FROM_ABI piecewise_constant_distribution() {}
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_constant_distribution(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __p_(__f_b, __l_b, __f_w) {}
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI piecewise_constant_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __p_(__bl, __fw) {}
+#endif // _LIBCPP_CXX03_LANG
+
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_constant_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __p_(__nw, __xmin, __xmax, __fw) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit piecewise_constant_distribution(const param_type& __p) : __p_(__p) {}
+
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_constant_distribution<_RT>& __x);
};
-template<class _RealType>
-typename piecewise_constant_distribution<_RealType>::param_type &
-piecewise_constant_distribution<_RealType>::param_type::operator=
- (const param_type& __rhs)
-{
-// These can throw
- __b_.reserve (__rhs.__b_.size ());
- __densities_.reserve(__rhs.__densities_.size());
- __areas_.reserve (__rhs.__areas_.size());
-
-// These can not throw
- __b_ = __rhs.__b_;
- __densities_ = __rhs.__densities_;
- __areas_ = __rhs.__areas_;
- return *this;
+template <class _RealType>
+typename piecewise_constant_distribution<_RealType>::param_type&
+piecewise_constant_distribution<_RealType>::param_type::operator=(const param_type& __rhs) {
+ // These can throw
+ __b_.reserve(__rhs.__b_.size());
+ __densities_.reserve(__rhs.__densities_.size());
+ __areas_.reserve(__rhs.__areas_.size());
+
+ // These can not throw
+ __b_ = __rhs.__b_;
+ __densities_ = __rhs.__densities_;
+ __areas_ = __rhs.__areas_;
+ return *this;
}
-template<class _RealType>
-void
-piecewise_constant_distribution<_RealType>::param_type::__init()
-{
- // __densities_ contains non-normalized areas
- result_type __total_area = std::accumulate(__densities_.begin(),
- __densities_.end(),
- result_type());
- for (size_t __i = 0; __i < __densities_.size(); ++__i)
- __densities_[__i] /= __total_area;
- // __densities_ contains normalized areas
- __areas_.assign(__densities_.size(), result_type());
- std::partial_sum(__densities_.begin(), __densities_.end() - 1,
- __areas_.begin() + 1);
- // __areas_ contains partial sums of normalized areas: [0, __densities_ - 1]
- __densities_.back() = 1 - __areas_.back(); // correct round off error
- for (size_t __i = 0; __i < __densities_.size(); ++__i)
- __densities_[__i] /= (__b_[__i+1] - __b_[__i]);
- // __densities_ now contains __densities_
+template <class _RealType>
+void piecewise_constant_distribution<_RealType>::param_type::__init() {
+ // __densities_ contains non-normalized areas
+ result_type __total_area = std::accumulate(__densities_.begin(), __densities_.end(), result_type());
+ for (size_t __i = 0; __i < __densities_.size(); ++__i)
+ __densities_[__i] /= __total_area;
+ // __densities_ contains normalized areas
+ __areas_.assign(__densities_.size(), result_type());
+ std::partial_sum(__densities_.begin(), __densities_.end() - 1, __areas_.begin() + 1);
+ // __areas_ contains partial sums of normalized areas: [0, __densities_ - 1]
+ __densities_.back() = 1 - __areas_.back(); // correct round off error
+ for (size_t __i = 0; __i < __densities_.size(); ++__i)
+ __densities_[__i] /= (__b_[__i + 1] - __b_[__i]);
+ // __densities_ now contains __densities_
}
-template<class _RealType>
-piecewise_constant_distribution<_RealType>::param_type::param_type()
- : __b_(2),
- __densities_(1, 1.0),
- __areas_(1, 0.0)
-{
- __b_[1] = 1;
+template <class _RealType>
+piecewise_constant_distribution<_RealType>::param_type::param_type() : __b_(2), __densities_(1, 1.0), __areas_(1, 0.0) {
+ __b_[1] = 1;
}
-template<class _RealType>
-template<class _InputIteratorB, class _InputIteratorW>
+template <class _RealType>
+template <class _InputIteratorB, class _InputIteratorW>
piecewise_constant_distribution<_RealType>::param_type::param_type(
- _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
- : __b_(__f_b, __l_b)
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(1, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size() - 1);
- for (size_t __i = 0; __i < __b_.size() - 1; ++__i, ++__f_w)
- __densities_.push_back(*__f_w);
- __init();
- }
+ _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __b_(__f_b, __l_b) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(1, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size() - 1);
+ for (size_t __i = 0; __i < __b_.size() - 1; ++__i, ++__f_w)
+ __densities_.push_back(*__f_w);
+ __init();
+ }
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_constant_distribution<_RealType>::param_type::param_type(
- initializer_list<result_type> __bl, _UnaryOperation __fw)
- : __b_(__bl.begin(), __bl.end())
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(1, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size() - 1);
- for (size_t __i = 0; __i < __b_.size() - 1; ++__i)
- __densities_.push_back(__fw((__b_[__i+1] + __b_[__i])*.5));
- __init();
- }
+ initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __b_(__bl.begin(), __bl.end()) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(1, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size() - 1);
+ for (size_t __i = 0; __i < __b_.size() - 1; ++__i)
+ __densities_.push_back(__fw((__b_[__i + 1] + __b_[__i]) * .5));
+ __init();
+ }
}
#endif // _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_constant_distribution<_RealType>::param_type::param_type(
- size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
- : __b_(__nw == 0 ? 2 : __nw + 1)
-{
- size_t __n = __b_.size() - 1;
- result_type __d = (__xmax - __xmin) / __n;
- __densities_.reserve(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- {
- __b_[__i] = __xmin + __i * __d;
- __densities_.push_back(__fw(__b_[__i] + __d*.5));
- }
- __b_[__n] = __xmax;
- __init();
+ size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __b_(__nw == 0 ? 2 : __nw + 1) {
+ size_t __n = __b_.size() - 1;
+ result_type __d = (__xmax - __xmin) / __n;
+ __densities_.reserve(__n);
+ for (size_t __i = 0; __i < __n; ++__i) {
+ __b_[__i] = __xmin + __i * __d;
+ __densities_.push_back(__fw(__b_[__i] + __d * .5));
+ }
+ __b_[__n] = __xmax;
+ __init();
}
-template<class _RealType>
-template<class _URNG>
-_RealType
-piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- typedef uniform_real_distribution<result_type> _Gen;
- result_type __u = _Gen()(__g);
- ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
- __u) - __p.__areas_.begin() - 1;
- return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k];
+template <class _RealType>
+template <class _URNG>
+_RealType piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ typedef uniform_real_distribution<result_type> _Gen;
+ result_type __u = _Gen()(__g);
+ ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), __u) - __p.__areas_.begin() - 1;
+ return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k];
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_constant_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- size_t __n = __x.__p_.__b_.size();
- __os << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__b_[__i];
- __n = __x.__p_.__densities_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__densities_[__i];
- __n = __x.__p_.__areas_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__areas_[__i];
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ size_t __n = __x.__p_.__b_.size();
+ __os << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__b_[__i];
+ __n = __x.__p_.__densities_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__densities_[__i];
+ __n = __x.__p_.__areas_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__areas_[__i];
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_constant_distribution<_RT>& __x)
-{
- typedef piecewise_constant_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- size_t __n;
- __is >> __n;
- vector<result_type> __b(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __b[__i];
- __is >> __n;
- vector<result_type> __densities(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __densities[__i];
- __is >> __n;
- vector<result_type> __areas(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __areas[__i];
- if (!__is.fail())
- {
- swap(__x.__p_.__b_, __b);
- swap(__x.__p_.__densities_, __densities);
- swap(__x.__p_.__areas_, __areas);
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_constant_distribution<_RT>& __x) {
+ typedef piecewise_constant_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ size_t __n;
+ __is >> __n;
+ vector<result_type> __b(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __b[__i];
+ __is >> __n;
+ vector<result_type> __densities(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __densities[__i];
+ __is >> __n;
+ vector<result_type> __areas(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __areas[__i];
+ if (!__is.fail()) {
+ swap(__x.__p_.__b_, __b);
+ swap(__x.__p_.__densities_, __densities);
+ swap(__x.__p_.__areas_, __areas);
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h b/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h
index 895f0f2dfe94..43769dc825e6 100644
--- a/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h
@@ -26,349 +26,286 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS piecewise_linear_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS piecewise_linear_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- vector<result_type> __b_;
- vector<result_type> __densities_;
- vector<result_type> __areas_;
- public:
- typedef piecewise_linear_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI param_type();
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b,
- _InputIteratorW __f_w);
-#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
-#endif // _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax,
- _UnaryOperation __fw);
- _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
- _LIBCPP_HIDE_FROM_ABI param_type & operator=(const param_type& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __b_;}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __densities_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
-
- private:
- _LIBCPP_HIDE_FROM_ABI void __init();
-
- friend class piecewise_linear_distribution;
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_linear_distribution<_RT>& __x);
-
- template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_linear_distribution<_RT>& __x);
- };
+ // types
+ typedef _RealType result_type;
-private:
- param_type __p_;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ vector<result_type> __b_;
+ vector<result_type> __densities_;
+ vector<result_type> __areas_;
-public:
- // constructor and reset functions
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution() {}
- template<class _InputIteratorB, class _InputIteratorW>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution(_InputIteratorB __f_b,
- _InputIteratorB __l_b,
- _InputIteratorW __f_w)
- : __p_(__f_b, __l_b, __f_w) {}
+ public:
+ typedef piecewise_linear_distribution distribution_type;
+ _LIBCPP_HIDE_FROM_ABI param_type();
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI param_type(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w);
#ifndef _LIBCPP_CXX03_LANG
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution(initializer_list<result_type> __bl,
- _UnaryOperation __fw)
- : __p_(__bl, __fw) {}
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
#endif // _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw);
+ _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
+ _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs);
- template<class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI
- piecewise_linear_distribution(size_t __nw, result_type __xmin,
- result_type __xmax, _UnaryOperation __fw)
- : __p_(__nw, __xmin, __xmax, __fw) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit piecewise_linear_distribution(const param_type& __p)
- : __p_(__p) {}
-
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> intervals() const {return __p_.intervals();}
- _LIBCPP_HIDE_FROM_ABI
- vector<result_type> densities() const {return __p_.densities();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return __p_.__b_.front();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return __p_.__b_.back();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const piecewise_linear_distribution& __x,
- const piecewise_linear_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const piecewise_linear_distribution& __x,
- const piecewise_linear_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+
+ private:
+ _LIBCPP_HIDE_FROM_ABI void __init();
+
+ friend class piecewise_linear_distribution;
template <class _CharT, class _Traits, class _RT>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_linear_distribution<_RT>& __x);
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RT>& __x);
template <class _CharT, class _Traits, class _RT>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_linear_distribution<_RT>& __x);
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_linear_distribution<_RT>& __x);
+ };
+
+private:
+ param_type __p_;
+
+public:
+ // constructor and reset functions
+ _LIBCPP_HIDE_FROM_ABI piecewise_linear_distribution() {}
+ template <class _InputIteratorB, class _InputIteratorW>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_linear_distribution(_InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __p_(__f_b, __l_b, __f_w) {}
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI piecewise_linear_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __p_(__bl, __fw) {}
+#endif // _LIBCPP_CXX03_LANG
+
+ template <class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI
+ piecewise_linear_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __p_(__nw, __xmin, __xmax, __fw) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit piecewise_linear_distribution(const param_type& __p) : __p_(__p) {}
+
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
+ _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const piecewise_linear_distribution& __x, const piecewise_linear_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const piecewise_linear_distribution& __x, const piecewise_linear_distribution& __y) {
+ return !(__x == __y);
+ }
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RT>& __x);
+
+ template <class _CharT, class _Traits, class _RT>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_linear_distribution<_RT>& __x);
};
-template<class _RealType>
-typename piecewise_linear_distribution<_RealType>::param_type &
-piecewise_linear_distribution<_RealType>::param_type::operator=
- (const param_type& __rhs)
-{
-// These can throw
- __b_.reserve (__rhs.__b_.size ());
- __densities_.reserve(__rhs.__densities_.size());
- __areas_.reserve (__rhs.__areas_.size());
-
-// These can not throw
- __b_ = __rhs.__b_;
- __densities_ = __rhs.__densities_;
- __areas_ = __rhs.__areas_;
- return *this;
+template <class _RealType>
+typename piecewise_linear_distribution<_RealType>::param_type&
+piecewise_linear_distribution<_RealType>::param_type::operator=(const param_type& __rhs) {
+ // These can throw
+ __b_.reserve(__rhs.__b_.size());
+ __densities_.reserve(__rhs.__densities_.size());
+ __areas_.reserve(__rhs.__areas_.size());
+
+ // These can not throw
+ __b_ = __rhs.__b_;
+ __densities_ = __rhs.__densities_;
+ __areas_ = __rhs.__areas_;
+ return *this;
}
-
-template<class _RealType>
-void
-piecewise_linear_distribution<_RealType>::param_type::__init()
-{
- __areas_.assign(__densities_.size() - 1, result_type());
- result_type __sp = 0;
- for (size_t __i = 0; __i < __areas_.size(); ++__i)
- {
- __areas_[__i] = (__densities_[__i+1] + __densities_[__i]) *
- (__b_[__i+1] - __b_[__i]) * .5;
- __sp += __areas_[__i];
- }
- for (size_t __i = __areas_.size(); __i > 1;)
- {
- --__i;
- __areas_[__i] = __areas_[__i-1] / __sp;
- }
- __areas_[0] = 0;
- for (size_t __i = 1; __i < __areas_.size(); ++__i)
- __areas_[__i] += __areas_[__i-1];
- for (size_t __i = 0; __i < __densities_.size(); ++__i)
- __densities_[__i] /= __sp;
+template <class _RealType>
+void piecewise_linear_distribution<_RealType>::param_type::__init() {
+ __areas_.assign(__densities_.size() - 1, result_type());
+ result_type __sp = 0;
+ for (size_t __i = 0; __i < __areas_.size(); ++__i) {
+ __areas_[__i] = (__densities_[__i + 1] + __densities_[__i]) * (__b_[__i + 1] - __b_[__i]) * .5;
+ __sp += __areas_[__i];
+ }
+ for (size_t __i = __areas_.size(); __i > 1;) {
+ --__i;
+ __areas_[__i] = __areas_[__i - 1] / __sp;
+ }
+ __areas_[0] = 0;
+ for (size_t __i = 1; __i < __areas_.size(); ++__i)
+ __areas_[__i] += __areas_[__i - 1];
+ for (size_t __i = 0; __i < __densities_.size(); ++__i)
+ __densities_[__i] /= __sp;
}
-template<class _RealType>
-piecewise_linear_distribution<_RealType>::param_type::param_type()
- : __b_(2),
- __densities_(2, 1.0),
- __areas_(1, 0.0)
-{
- __b_[1] = 1;
+template <class _RealType>
+piecewise_linear_distribution<_RealType>::param_type::param_type() : __b_(2), __densities_(2, 1.0), __areas_(1, 0.0) {
+ __b_[1] = 1;
}
-template<class _RealType>
-template<class _InputIteratorB, class _InputIteratorW>
+template <class _RealType>
+template <class _InputIteratorB, class _InputIteratorW>
piecewise_linear_distribution<_RealType>::param_type::param_type(
- _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
- : __b_(__f_b, __l_b)
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(2, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size());
- for (size_t __i = 0; __i < __b_.size(); ++__i, ++__f_w)
- __densities_.push_back(*__f_w);
- __init();
- }
+ _InputIteratorB __f_b, _InputIteratorB __l_b, _InputIteratorW __f_w)
+ : __b_(__f_b, __l_b) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(2, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size());
+ for (size_t __i = 0; __i < __b_.size(); ++__i, ++__f_w)
+ __densities_.push_back(*__f_w);
+ __init();
+ }
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_linear_distribution<_RealType>::param_type::param_type(
- initializer_list<result_type> __bl, _UnaryOperation __fw)
- : __b_(__bl.begin(), __bl.end())
-{
- if (__b_.size() < 2)
- {
- __b_.resize(2);
- __b_[0] = 0;
- __b_[1] = 1;
- __densities_.assign(2, 1.0);
- __areas_.assign(1, 0.0);
- }
- else
- {
- __densities_.reserve(__b_.size());
- for (size_t __i = 0; __i < __b_.size(); ++__i)
- __densities_.push_back(__fw(__b_[__i]));
- __init();
- }
+ initializer_list<result_type> __bl, _UnaryOperation __fw)
+ : __b_(__bl.begin(), __bl.end()) {
+ if (__b_.size() < 2) {
+ __b_.resize(2);
+ __b_[0] = 0;
+ __b_[1] = 1;
+ __densities_.assign(2, 1.0);
+ __areas_.assign(1, 0.0);
+ } else {
+ __densities_.reserve(__b_.size());
+ for (size_t __i = 0; __i < __b_.size(); ++__i)
+ __densities_.push_back(__fw(__b_[__i]));
+ __init();
+ }
}
#endif // _LIBCPP_CXX03_LANG
-template<class _RealType>
-template<class _UnaryOperation>
+template <class _RealType>
+template <class _UnaryOperation>
piecewise_linear_distribution<_RealType>::param_type::param_type(
- size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
- : __b_(__nw == 0 ? 2 : __nw + 1)
-{
- size_t __n = __b_.size() - 1;
- result_type __d = (__xmax - __xmin) / __n;
- __densities_.reserve(__b_.size());
- for (size_t __i = 0; __i < __n; ++__i)
- {
- __b_[__i] = __xmin + __i * __d;
- __densities_.push_back(__fw(__b_[__i]));
- }
- __b_[__n] = __xmax;
- __densities_.push_back(__fw(__b_[__n]));
- __init();
+ size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw)
+ : __b_(__nw == 0 ? 2 : __nw + 1) {
+ size_t __n = __b_.size() - 1;
+ result_type __d = (__xmax - __xmin) / __n;
+ __densities_.reserve(__b_.size());
+ for (size_t __i = 0; __i < __n; ++__i) {
+ __b_[__i] = __xmin + __i * __d;
+ __densities_.push_back(__fw(__b_[__i]));
+ }
+ __b_[__n] = __xmax;
+ __densities_.push_back(__fw(__b_[__n]));
+ __init();
}
-template<class _RealType>
-template<class _URNG>
-_RealType
-piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- typedef uniform_real_distribution<result_type> _Gen;
- result_type __u = _Gen()(__g);
- ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
- __u) - __p.__areas_.begin() - 1;
- __u -= __p.__areas_[__k];
- const result_type __dk = __p.__densities_[__k];
- const result_type __dk1 = __p.__densities_[__k+1];
- const result_type __deltad = __dk1 - __dk;
- const result_type __bk = __p.__b_[__k];
- if (__deltad == 0)
- return __u / __dk + __bk;
- const result_type __bk1 = __p.__b_[__k+1];
- const result_type __deltab = __bk1 - __bk;
- return (__bk * __dk1 - __bk1 * __dk +
- std::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) /
- __deltad;
+template <class _RealType>
+template <class _URNG>
+_RealType piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ typedef uniform_real_distribution<result_type> _Gen;
+ result_type __u = _Gen()(__g);
+ ptrdiff_t __k = std::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), __u) - __p.__areas_.begin() - 1;
+ __u -= __p.__areas_[__k];
+ const result_type __dk = __p.__densities_[__k];
+ const result_type __dk1 = __p.__densities_[__k + 1];
+ const result_type __deltad = __dk1 - __dk;
+ const result_type __bk = __p.__b_[__k];
+ if (__deltad == 0)
+ return __u / __dk + __bk;
+ const result_type __bk1 = __p.__b_[__k + 1];
+ const result_type __deltab = __bk1 - __bk;
+ return (__bk * __dk1 - __bk1 * __dk + std::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) / __deltad;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const piecewise_linear_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- size_t __n = __x.__p_.__b_.size();
- __os << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__b_[__i];
- __n = __x.__p_.__densities_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__densities_[__i];
- __n = __x.__p_.__areas_.size();
- __os << __sp << __n;
- for (size_t __i = 0; __i < __n; ++__i)
- __os << __sp << __x.__p_.__areas_[__i];
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ size_t __n = __x.__p_.__b_.size();
+ __os << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__b_[__i];
+ __n = __x.__p_.__densities_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__densities_[__i];
+ __n = __x.__p_.__areas_.size();
+ __os << __sp << __n;
+ for (size_t __i = 0; __i < __n; ++__i)
+ __os << __sp << __x.__p_.__areas_[__i];
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- piecewise_linear_distribution<_RT>& __x)
-{
- typedef piecewise_linear_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- size_t __n;
- __is >> __n;
- vector<result_type> __b(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __b[__i];
- __is >> __n;
- vector<result_type> __densities(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __densities[__i];
- __is >> __n;
- vector<result_type> __areas(__n);
- for (size_t __i = 0; __i < __n; ++__i)
- __is >> __areas[__i];
- if (!__is.fail())
- {
- swap(__x.__p_.__b_, __b);
- swap(__x.__p_.__densities_, __densities);
- swap(__x.__p_.__areas_, __areas);
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, piecewise_linear_distribution<_RT>& __x) {
+ typedef piecewise_linear_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ size_t __n;
+ __is >> __n;
+ vector<result_type> __b(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __b[__i];
+ __is >> __n;
+ vector<result_type> __densities(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __densities[__i];
+ __is >> __n;
+ vector<result_type> __areas(__n);
+ for (size_t __i = 0; __i < __n; ++__i)
+ __is >> __areas[__i];
+ if (!__is.fail()) {
+ swap(__x.__p_.__b_, __b);
+ swap(__x.__p_.__densities_, __densities);
+ swap(__x.__p_.__areas_, __areas);
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h b/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h
index 12641addf494..61a092ef9dd4 100644
--- a/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/poisson_distribution.h
@@ -28,250 +28,210 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _IntType = int>
-class _LIBCPP_TEMPLATE_VIS poisson_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
-public:
- // types
- typedef _IntType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- double __mean_;
- double __s_;
- double __d_;
- double __l_;
- double __omega_;
- double __c0_;
- double __c1_;
- double __c2_;
- double __c3_;
- double __c_;
-
- public:
- typedef poisson_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit param_type(double __mean = 1.0);
+template <class _IntType = int>
+class _LIBCPP_TEMPLATE_VIS poisson_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
- _LIBCPP_HIDE_FROM_ABI
- double mean() const {return __mean_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__mean_ == __y.__mean_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
+public:
+ // types
+ typedef _IntType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ double __mean_;
+ double __s_;
+ double __d_;
+ double __l_;
+ double __omega_;
+ double __c0_;
+ double __c1_;
+ double __c2_;
+ double __c3_;
+ double __c_;
+
+ public:
+ typedef poisson_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(double __mean = 1.0);
+
+ _LIBCPP_HIDE_FROM_ABI double mean() const { return __mean_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__mean_ == __y.__mean_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
- friend class poisson_distribution;
- };
+ friend class poisson_distribution;
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- poisson_distribution() : poisson_distribution(1.0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit poisson_distribution(double __mean)
- : __p_(__mean) {}
+ _LIBCPP_HIDE_FROM_ABI poisson_distribution() : poisson_distribution(1.0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit poisson_distribution(double __mean) : __p_(__mean) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit poisson_distribution(double __mean = 1.0)
- : __p_(__mean) {}
+ _LIBCPP_HIDE_FROM_ABI explicit poisson_distribution(double __mean = 1.0) : __p_(__mean) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit poisson_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- double mean() const {return __p_.mean();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::max();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const poisson_distribution& __x,
- const poisson_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const poisson_distribution& __x,
- const poisson_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit poisson_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI double mean() const { return __p_.mean(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const poisson_distribution& __x, const poisson_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const poisson_distribution& __x, const poisson_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _IntType>
+template <class _IntType>
poisson_distribution<_IntType>::param_type::param_type(double __mean)
// According to the standard `inf` is a valid input, but it causes the
// distribution to hang, so we replace it with the maximum representable
// mean.
- : __mean_(isinf(__mean) ? numeric_limits<double>::max() : __mean)
-{
- if (__mean_ < 10)
- {
- __s_ = 0;
- __d_ = 0;
- __l_ = std::exp(-__mean_);
- __omega_ = 0;
- __c3_ = 0;
- __c2_ = 0;
- __c1_ = 0;
- __c0_ = 0;
- __c_ = 0;
- }
- else
- {
- __s_ = std::sqrt(__mean_);
- __d_ = 6 * __mean_ * __mean_;
- __l_ = std::trunc(__mean_ - 1.1484);
- __omega_ = .3989423 / __s_;
- double __b1 = .4166667E-1 / __mean_;
- double __b2 = .3 * __b1 * __b1;
- __c3_ = .1428571 * __b1 * __b2;
- __c2_ = __b2 - 15. * __c3_;
- __c1_ = __b1 - 6. * __b2 + 45. * __c3_;
- __c0_ = 1. - __b1 + 3. * __b2 - 15. * __c3_;
- __c_ = .1069 / __mean_;
- }
+ : __mean_(isinf(__mean) ? numeric_limits<double>::max() : __mean) {
+ if (__mean_ < 10) {
+ __s_ = 0;
+ __d_ = 0;
+ __l_ = std::exp(-__mean_);
+ __omega_ = 0;
+ __c3_ = 0;
+ __c2_ = 0;
+ __c1_ = 0;
+ __c0_ = 0;
+ __c_ = 0;
+ } else {
+ __s_ = std::sqrt(__mean_);
+ __d_ = 6 * __mean_ * __mean_;
+ __l_ = std::trunc(__mean_ - 1.1484);
+ __omega_ = .3989423 / __s_;
+ double __b1 = .4166667E-1 / __mean_;
+ double __b2 = .3 * __b1 * __b1;
+ __c3_ = .1428571 * __b1 * __b2;
+ __c2_ = __b2 - 15. * __c3_;
+ __c1_ = __b1 - 6. * __b2 + 45. * __c3_;
+ __c0_ = 1. - __b1 + 3. * __b2 - 15. * __c3_;
+ __c_ = .1069 / __mean_;
+ }
}
template <class _IntType>
-template<class _URNG>
-_IntType
-poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- double __tx;
- uniform_real_distribution<double> __urd;
- if (__pr.__mean_ < 10)
- {
- __tx = 0;
- for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx)
- __p *= __urd(__urng);
+template <class _URNG>
+_IntType poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ double __tx;
+ uniform_real_distribution<double> __urd;
+ if (__pr.__mean_ < 10) {
+ __tx = 0;
+ for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx)
+ __p *= __urd(__urng);
+ } else {
+ double __difmuk;
+ double __g = __pr.__mean_ + __pr.__s_ * normal_distribution<double>()(__urng);
+ double __u;
+ if (__g > 0) {
+ __tx = std::trunc(__g);
+ if (__tx >= __pr.__l_)
+ return std::__clamp_to_integral<result_type>(__tx);
+ __difmuk = __pr.__mean_ - __tx;
+ __u = __urd(__urng);
+ if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
+ return std::__clamp_to_integral<result_type>(__tx);
}
- else
- {
- double __difmuk;
- double __g = __pr.__mean_ + __pr.__s_ * normal_distribution<double>()(__urng);
- double __u;
- if (__g > 0)
- {
- __tx = std::trunc(__g);
- if (__tx >= __pr.__l_)
- return std::__clamp_to_integral<result_type>(__tx);
- __difmuk = __pr.__mean_ - __tx;
- __u = __urd(__urng);
- if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
- return std::__clamp_to_integral<result_type>(__tx);
- }
- exponential_distribution<double> __edist;
- for (bool __using_exp_dist = false; true; __using_exp_dist = true)
- {
- double __e;
- if (__using_exp_dist || __g <= 0)
- {
- double __t;
- do
- {
- __e = __edist(__urng);
- __u = __urd(__urng);
- __u += __u - 1;
- __t = 1.8 + (__u < 0 ? -__e : __e);
- } while (__t <= -.6744);
- __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
- __difmuk = __pr.__mean_ - __tx;
- __using_exp_dist = true;
- }
- double __px;
- double __py;
- if (__tx < 10 && __tx >= 0)
- {
- const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
- 40320, 362880};
- __px = -__pr.__mean_;
- __py = std::pow(__pr.__mean_, (double)__tx) / __fac[static_cast<int>(__tx)];
- }
- else
- {
- double __del = .8333333E-1 / __tx;
- __del -= 4.8 * __del * __del * __del;
- double __v = __difmuk / __tx;
- if (std::abs(__v) > 0.25)
- __px = __tx * std::log(1 + __v) - __difmuk - __del;
- else
- __px = __tx * __v * __v * (((((((.1250060 * __v + -.1384794) *
- __v + .1421878) * __v + -.1661269) * __v + .2000118) *
- __v + -.2500068) * __v + .3333333) * __v + -.5) - __del;
- __py = .3989423 / std::sqrt(__tx);
- }
- double __r = (0.5 - __difmuk) / __pr.__s_;
- double __r2 = __r * __r;
- double __fx = -0.5 * __r2;
- double __fy = __pr.__omega_ * (((__pr.__c3_ * __r2 + __pr.__c2_) *
- __r2 + __pr.__c1_) * __r2 + __pr.__c0_);
- if (__using_exp_dist)
- {
- if (__pr.__c_ * std::abs(__u) <= __py * std::exp(__px + __e) -
- __fy * std::exp(__fx + __e))
- break;
- }
- else
- {
- if (__fy - __u * __fy <= __py * std::exp(__px - __fx))
- break;
- }
- }
+ exponential_distribution<double> __edist;
+ for (bool __using_exp_dist = false; true; __using_exp_dist = true) {
+ double __e;
+ if (__using_exp_dist || __g <= 0) {
+ double __t;
+ do {
+ __e = __edist(__urng);
+ __u = __urd(__urng);
+ __u += __u - 1;
+ __t = 1.8 + (__u < 0 ? -__e : __e);
+ } while (__t <= -.6744);
+ __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
+ __difmuk = __pr.__mean_ - __tx;
+ __using_exp_dist = true;
+ }
+ double __px;
+ double __py;
+ if (__tx < 10 && __tx >= 0) {
+ const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880};
+ __px = -__pr.__mean_;
+ __py = std::pow(__pr.__mean_, (double)__tx) / __fac[static_cast<int>(__tx)];
+ } else {
+ double __del = .8333333E-1 / __tx;
+ __del -= 4.8 * __del * __del * __del;
+ double __v = __difmuk / __tx;
+ if (std::abs(__v) > 0.25)
+ __px = __tx * std::log(1 + __v) - __difmuk - __del;
+ else
+ __px = __tx * __v * __v *
+ (((((((.1250060 * __v + -.1384794) * __v + .1421878) * __v + -.1661269) * __v + .2000118) * __v +
+ -.2500068) *
+ __v +
+ .3333333) *
+ __v +
+ -.5) -
+ __del;
+ __py = .3989423 / std::sqrt(__tx);
+ }
+ double __r = (0.5 - __difmuk) / __pr.__s_;
+ double __r2 = __r * __r;
+ double __fx = -0.5 * __r2;
+ double __fy = __pr.__omega_ * (((__pr.__c3_ * __r2 + __pr.__c2_) * __r2 + __pr.__c1_) * __r2 + __pr.__c0_);
+ if (__using_exp_dist) {
+ if (__pr.__c_ * std::abs(__u) <= __py * std::exp(__px + __e) - __fy * std::exp(__fx + __e))
+ break;
+ } else {
+ if (__fy - __u * __fy <= __py * std::exp(__px - __fx))
+ break;
+ }
}
- return std::__clamp_to_integral<result_type>(__tx);
+ }
+ return std::__clamp_to_integral<result_type>(__tx);
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const poisson_distribution<_IntType>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- return __os << __x.mean();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const poisson_distribution<_IntType>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ return __os << __x.mean();
}
template <class _CharT, class _Traits, class _IntType>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- poisson_distribution<_IntType>& __x)
-{
- typedef poisson_distribution<_IntType> _Eng;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- double __mean;
- __is >> __mean;
- if (!__is.fail())
- __x.param(param_type(__mean));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, poisson_distribution<_IntType>& __x) {
+ typedef poisson_distribution<_IntType> _Eng;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ double __mean;
+ __is >> __mean;
+ if (!__is.fail())
+ __x.param(param_type(__mean));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/random_device.h b/contrib/llvm-project/libcxx/include/__random/random_device.h
index ad75165b7474..52407943d2ec 100644
--- a/contrib/llvm-project/libcxx/include/__random/random_device.h
+++ b/contrib/llvm-project/libcxx/include/__random/random_device.h
@@ -23,56 +23,53 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RANDOM_DEVICE)
-class _LIBCPP_EXPORTED_FROM_ABI random_device
-{
-#ifdef _LIBCPP_USING_DEV_RANDOM
- int __f_;
-#elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT)
- _LIBCPP_DIAGNOSTIC_PUSH
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
-
- // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now
- // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we
- // retain the same layout as before.
-# if defined(__APPLE__)
- int __padding_; // padding to fake the `__f_` field above
-# endif
-
- // ... vendors can add workarounds here if they switch to a different representation ...
-
- _LIBCPP_DIAGNOSTIC_POP
-#endif
+class _LIBCPP_EXPORTED_FROM_ABI random_device {
+# ifdef _LIBCPP_USING_DEV_RANDOM
+ int __f_;
+# elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT)
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
+
+ // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now
+ // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we
+ // retain the same layout as before.
+# if defined(__APPLE__)
+ int __padding_; // padding to fake the `__f_` field above
+# endif
+
+ // ... vendors can add workarounds here if they switch to a different representation ...
+
+ _LIBCPP_DIAGNOSTIC_POP
+# endif
public:
- // types
- typedef unsigned result_type;
-
- // generator characteristics
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu;
-
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min;}
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max;}
-
- // constructors
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI random_device() : random_device("/dev/urandom") {}
- explicit random_device(const string& __token);
-#else
- explicit random_device(const string& __token = "/dev/urandom");
-#endif
- ~random_device();
+ // types
+ typedef unsigned result_type;
+
+ // generator characteristics
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu;
+
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+ // constructors
+# ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI random_device() : random_device("/dev/urandom") {}
+ explicit random_device(const string& __token);
+# else
+ explicit random_device(const string& __token = "/dev/urandom");
+# endif
+ ~random_device();
- // generating functions
- result_type operator()();
+ // generating functions
+ result_type operator()();
- // property functions
- double entropy() const _NOEXCEPT;
+ // property functions
+ double entropy() const _NOEXCEPT;
- random_device(const random_device&) = delete;
- void operator=(const random_device&) = delete;
+ random_device(const random_device&) = delete;
+ void operator=(const random_device&) = delete;
};
#endif // !_LIBCPP_HAS_NO_RANDOM_DEVICE
diff --git a/contrib/llvm-project/libcxx/include/__random/ranlux.h b/contrib/llvm-project/libcxx/include/__random/ranlux.h
index e44cece39dfc..952afde91b10 100644
--- a/contrib/llvm-project/libcxx/include/__random/ranlux.h
+++ b/contrib/llvm-project/libcxx/include/__random/ranlux.h
@@ -21,7 +21,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24> ranlux24_base;
-typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base;
+typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base;
typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24;
typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
diff --git a/contrib/llvm-project/libcxx/include/__random/seed_seq.h b/contrib/llvm-project/libcxx/include/__random/seed_seq.h
index 7ae9f492c8af..17a7de02fbd3 100644
--- a/contrib/llvm-project/libcxx/include/__random/seed_seq.h
+++ b/contrib/llvm-project/libcxx/include/__random/seed_seq.h
@@ -27,149 +27,130 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_TEMPLATE_VIS seed_seq
-{
+class _LIBCPP_TEMPLATE_VIS seed_seq {
public:
- // types
- typedef uint32_t result_type;
+ // types
+ typedef uint32_t result_type;
- // constructors
- _LIBCPP_HIDE_FROM_ABI
- seed_seq() _NOEXCEPT {}
+ // constructors
+ _LIBCPP_HIDE_FROM_ABI seed_seq() _NOEXCEPT {}
#ifndef _LIBCPP_CXX03_LANG
- template<class _Tp, __enable_if_t<is_integral<_Tp>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- seed_seq(initializer_list<_Tp> __il) {
- __init(__il.begin(), __il.end());
- }
+ template <class _Tp, __enable_if_t<is_integral<_Tp>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI seed_seq(initializer_list<_Tp> __il) {
+ __init(__il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- seed_seq(_InputIterator __first, _InputIterator __last) {
- static_assert(is_integral<typename iterator_traits<_InputIterator>::value_type>::value,
- "Mandates: iterator_traits<InputIterator>::value_type is an integer type");
- __init(__first, __last);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI seed_seq(_InputIterator __first, _InputIterator __last) {
+ static_assert(is_integral<typename iterator_traits<_InputIterator>::value_type>::value,
+ "Mandates: iterator_traits<InputIterator>::value_type is an integer type");
+ __init(__first, __last);
+ }
- // generating functions
- template<class _RandomAccessIterator>
- _LIBCPP_HIDE_FROM_ABI void generate(_RandomAccessIterator __first, _RandomAccessIterator __last);
+ // generating functions
+ template <class _RandomAccessIterator>
+ _LIBCPP_HIDE_FROM_ABI void generate(_RandomAccessIterator __first, _RandomAccessIterator __last);
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const _NOEXCEPT {return __v_.size();}
- template<class _OutputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void param(_OutputIterator __dest) const
- {std::copy(__v_.begin(), __v_.end(), __dest);}
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI size_t size() const _NOEXCEPT { return __v_.size(); }
+ template <class _OutputIterator>
+ _LIBCPP_HIDE_FROM_ABI void param(_OutputIterator __dest) const {
+ std::copy(__v_.begin(), __v_.end(), __dest);
+ }
- seed_seq(const seed_seq&) = delete;
- void operator=(const seed_seq&) = delete;
+ seed_seq(const seed_seq&) = delete;
+ void operator=(const seed_seq&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- static result_type _Tp(result_type __x) {return __x ^ (__x >> 27);}
+ _LIBCPP_HIDE_FROM_ABI static result_type _Tp(result_type __x) { return __x ^ (__x >> 27); }
private:
- template<class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __init(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __init(_InputIterator __first, _InputIterator __last);
- vector<result_type> __v_;
+ vector<result_type> __v_;
};
-template<class _InputIterator>
-void
-seed_seq::__init(_InputIterator __first, _InputIterator __last)
-{
- for (_InputIterator __s = __first; __s != __last; ++__s)
- __v_.push_back(*__s & 0xFFFFFFFF);
+template <class _InputIterator>
+void seed_seq::__init(_InputIterator __first, _InputIterator __last) {
+ for (_InputIterator __s = __first; __s != __last; ++__s)
+ __v_.push_back(*__s & 0xFFFFFFFF);
}
-template<class _RandomAccessIterator>
-void
-seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- if (__first != __last)
+template <class _RandomAccessIterator>
+void seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) {
+ if (__first != __last) {
+ std::fill(__first, __last, 0x8b8b8b8b);
+ const size_t __n = static_cast<size_t>(__last - __first);
+ const size_t __s = __v_.size();
+ const size_t __t = (__n >= 623) ? 11 : (__n >= 68) ? 7 : (__n >= 39) ? 5 : (__n >= 7) ? 3 : (__n - 1) / 2;
+ const size_t __p = (__n - __t) / 2;
+ const size_t __q = __p + __t;
+ const size_t __m = std::max(__s + 1, __n);
+ // __k = 0;
{
- std::fill(__first, __last, 0x8b8b8b8b);
- const size_t __n = static_cast<size_t>(__last - __first);
- const size_t __s = __v_.size();
- const size_t __t = (__n >= 623) ? 11
- : (__n >= 68) ? 7
- : (__n >= 39) ? 5
- : (__n >= 7) ? 3
- : (__n - 1) / 2;
- const size_t __p = (__n - __t) / 2;
- const size_t __q = __p + __t;
- const size_t __m = std::max(__s + 1, __n);
- // __k = 0;
- {
- result_type __r = 1664525 * _Tp(__first[0] ^ __first[__p]
- ^ __first[__n - 1]);
- __first[__p] += __r;
- __r += __s;
- __first[__q] += __r;
- __first[0] = __r;
- }
- // Initialize indexing terms used with if statements as an optimization to
- // avoid calculating modulo n on every loop iteration for each term.
- size_t __kmodn = 0; // __k % __n
- size_t __k1modn = __n - 1; // (__k - 1) % __n
- size_t __kpmodn = __p % __n; // (__k + __p) % __n
- size_t __kqmodn = __q % __n; // (__k + __q) % __n
-
- for (size_t __k = 1; __k <= __s; ++__k)
- {
- if (++__kmodn == __n)
- __kmodn = 0;
- if (++__k1modn == __n)
- __k1modn = 0;
- if (++__kpmodn == __n)
- __kpmodn = 0;
- if (++__kqmodn == __n)
- __kqmodn = 0;
-
- result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
- __first[__kpmodn] += __r;
- __r += __kmodn + __v_[__k - 1];
- __first[__kqmodn] += __r;
- __first[__kmodn] = __r;
- }
- for (size_t __k = __s + 1; __k < __m; ++__k)
- {
- if (++__kmodn == __n)
- __kmodn = 0;
- if (++__k1modn == __n)
- __k1modn = 0;
- if (++__kpmodn == __n)
- __kpmodn = 0;
- if (++__kqmodn == __n)
- __kqmodn = 0;
-
- result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
- __first[__kpmodn] += __r;
- __r += __kmodn;
- __first[__kqmodn] += __r;
- __first[__kmodn] = __r;
- }
- for (size_t __k = __m; __k < __m + __n; ++__k)
- {
- if (++__kmodn == __n)
- __kmodn = 0;
- if (++__k1modn == __n)
- __k1modn = 0;
- if (++__kpmodn == __n)
- __kpmodn = 0;
- if (++__kqmodn == __n)
- __kqmodn = 0;
-
- result_type __r = 1566083941 * _Tp(__first[__kmodn] + __first[__kpmodn] + __first[__k1modn]);
- __first[__kpmodn] ^= __r;
- __r -= __kmodn;
- __first[__kqmodn] ^= __r;
- __first[__kmodn] = __r;
- }
+ result_type __r = 1664525 * _Tp(__first[0] ^ __first[__p] ^ __first[__n - 1]);
+ __first[__p] += __r;
+ __r += __s;
+ __first[__q] += __r;
+ __first[0] = __r;
+ }
+ // Initialize indexing terms used with if statements as an optimization to
+ // avoid calculating modulo n on every loop iteration for each term.
+ size_t __kmodn = 0; // __k % __n
+ size_t __k1modn = __n - 1; // (__k - 1) % __n
+ size_t __kpmodn = __p % __n; // (__k + __p) % __n
+ size_t __kqmodn = __q % __n; // (__k + __q) % __n
+
+ for (size_t __k = 1; __k <= __s; ++__k) {
+ if (++__kmodn == __n)
+ __kmodn = 0;
+ if (++__k1modn == __n)
+ __k1modn = 0;
+ if (++__kpmodn == __n)
+ __kpmodn = 0;
+ if (++__kqmodn == __n)
+ __kqmodn = 0;
+
+ result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
+ __first[__kpmodn] += __r;
+ __r += __kmodn + __v_[__k - 1];
+ __first[__kqmodn] += __r;
+ __first[__kmodn] = __r;
+ }
+ for (size_t __k = __s + 1; __k < __m; ++__k) {
+ if (++__kmodn == __n)
+ __kmodn = 0;
+ if (++__k1modn == __n)
+ __k1modn = 0;
+ if (++__kpmodn == __n)
+ __kpmodn = 0;
+ if (++__kqmodn == __n)
+ __kqmodn = 0;
+
+ result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]);
+ __first[__kpmodn] += __r;
+ __r += __kmodn;
+ __first[__kqmodn] += __r;
+ __first[__kmodn] = __r;
+ }
+ for (size_t __k = __m; __k < __m + __n; ++__k) {
+ if (++__kmodn == __n)
+ __kmodn = 0;
+ if (++__k1modn == __n)
+ __k1modn = 0;
+ if (++__kpmodn == __n)
+ __kpmodn = 0;
+ if (++__kqmodn == __n)
+ __kqmodn = 0;
+
+ result_type __r = 1566083941 * _Tp(__first[__kmodn] + __first[__kpmodn] + __first[__k1modn]);
+ __first[__kpmodn] ^= __r;
+ __r -= __kmodn;
+ __first[__kqmodn] ^= __r;
+ __first[__kmodn] = __r;
}
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h b/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h
index 4836dee48926..f54ed17e3838 100644
--- a/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/shuffle_order_engine.h
@@ -30,240 +30,197 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <uint64_t _Xp, uint64_t _Yp>
-struct __ugcd
-{
- static _LIBCPP_CONSTEXPR const uint64_t value = __ugcd<_Yp, _Xp % _Yp>::value;
+struct __ugcd {
+ static _LIBCPP_CONSTEXPR const uint64_t value = __ugcd<_Yp, _Xp % _Yp>::value;
};
template <uint64_t _Xp>
-struct __ugcd<_Xp, 0>
-{
- static _LIBCPP_CONSTEXPR const uint64_t value = _Xp;
+struct __ugcd<_Xp, 0> {
+ static _LIBCPP_CONSTEXPR const uint64_t value = _Xp;
};
template <uint64_t _Np, uint64_t _Dp>
-class __uratio
-{
- static_assert(_Dp != 0, "__uratio divide by 0");
- static _LIBCPP_CONSTEXPR const uint64_t __gcd = __ugcd<_Np, _Dp>::value;
+class __uratio {
+ static_assert(_Dp != 0, "__uratio divide by 0");
+ static _LIBCPP_CONSTEXPR const uint64_t __gcd = __ugcd<_Np, _Dp>::value;
+
public:
- static _LIBCPP_CONSTEXPR const uint64_t num = _Np / __gcd;
- static _LIBCPP_CONSTEXPR const uint64_t den = _Dp / __gcd;
+ static _LIBCPP_CONSTEXPR const uint64_t num = _Np / __gcd;
+ static _LIBCPP_CONSTEXPR const uint64_t den = _Dp / __gcd;
- typedef __uratio<num, den> type;
+ typedef __uratio<num, den> type;
};
-template<class _Engine, size_t __k>
-class _LIBCPP_TEMPLATE_VIS shuffle_order_engine
-{
- static_assert(0 < __k, "shuffle_order_engine invalid parameters");
+template <class _Engine, size_t __k>
+class _LIBCPP_TEMPLATE_VIS shuffle_order_engine {
+ static_assert(0 < __k, "shuffle_order_engine invalid parameters");
+
public:
- // types
- typedef typename _Engine::result_type result_type;
+ // types
+ typedef typename _Engine::result_type result_type;
private:
- _Engine __e_;
- result_type __v_[__k];
- result_type __y_;
+ _Engine __e_;
+ result_type __v_[__k];
+ result_type __y_;
public:
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t table_size = __k;
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t table_size = __k;
#ifdef _LIBCPP_CXX03_LANG
- static const result_type _Min = _Engine::_Min;
- static const result_type _Max = _Engine::_Max;
+ static const result_type _Min = _Engine::_Min;
+ static const result_type _Max = _Engine::_Max;
#else
- static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
- static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
+ static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
+ static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
#endif
- static_assert(_Min < _Max, "shuffle_order_engine invalid parameters");
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
-
- static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull;
-
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI
- shuffle_order_engine() {__init();}
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(const _Engine& __e)
- : __e_(__e) {__init();}
+ static_assert(_Min < _Max, "shuffle_order_engine invalid parameters");
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+
+ static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull;
+
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI shuffle_order_engine() { __init(); }
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(const _Engine& __e) : __e_(__e) { __init(); }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(_Engine&& __e)
- : __e_(std::move(__e)) {__init();}
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Engine&& __e) : __e_(std::move(__e)) { __init(); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
- !is_convertible<_Sseq, _Engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit shuffle_order_engine(_Sseq& __q)
- : __e_(__q) {__init();}
- _LIBCPP_HIDE_FROM_ABI
- void seed() {__e_.seed(); __init();}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd) {__e_.seed(__sd); __init();}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q) {__e_.seed(__q); __init();}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- const _Engine& base() const _NOEXCEPT {return __e_;}
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(result_type __sd) : __e_(__sd) { __init(); }
+ template <
+ class _Sseq,
+ __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value && !is_convertible<_Sseq, _Engine>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Sseq& __q) : __e_(__q) {
+ __init();
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed() {
+ __e_.seed();
+ __init();
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) {
+ __e_.seed(__sd);
+ __init();
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __e_.seed(__q);
+ __init();
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
private:
- template<class _Eng, size_t _Kp>
- friend
- bool
- operator==(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y);
-
- template<class _Eng, size_t _Kp>
- friend
- bool
- operator!=(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const shuffle_order_engine<_Eng, _Kp>& __x);
-
- template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- shuffle_order_engine<_Eng, _Kp>& __x);
-
- _LIBCPP_HIDE_FROM_ABI
- void __init()
- {
- for (size_t __i = 0; __i < __k; ++__i)
- __v_[__i] = __e_();
- __y_ = __e_();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval(false_type) {return __eval2(integral_constant<bool, __k & 1>());}
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval(true_type) {return __eval(__uratio<__k, _Rp>());}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval2(false_type) {return __eval(__uratio<__k/2, 0x8000000000000000ull>());}
- _LIBCPP_HIDE_FROM_ABI
- result_type __eval2(true_type) {return __evalf<__k, 0>();}
-
- template <uint64_t _Np, uint64_t _Dp, __enable_if_t<(__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- result_type
- __eval(__uratio<_Np, _Dp>)
- {return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();}
-
- template <uint64_t _Np, uint64_t _Dp, __enable_if_t<__uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- result_type
- __eval(__uratio<_Np, _Dp>)
- {
- const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (__y_ - _Min)
- / __uratio<_Np, _Dp>::den);
- __y_ = __v_[__j];
- __v_[__j] = __e_();
- return __y_;
- }
-
- template <uint64_t __n, uint64_t __d>
- _LIBCPP_HIDE_FROM_ABI
- result_type __evalf()
- {
- const double __fp = __d == 0 ?
- __n / (2. * 0x8000000000000000ull) :
- __n / (double)__d;
- const size_t __j = static_cast<size_t>(__fp * (__y_ - _Min));
- __y_ = __v_[__j];
- __v_[__j] = __e_();
- return __y_;
- }
+ template <class _Eng, size_t _Kp>
+ friend bool operator==(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y);
+
+ template <class _Eng, size_t _Kp>
+ friend bool operator!=(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Kp>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const shuffle_order_engine<_Eng, _Kp>& __x);
+
+ template <class _CharT, class _Traits, class _Eng, size_t _Kp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, shuffle_order_engine<_Eng, _Kp>& __x);
+
+ _LIBCPP_HIDE_FROM_ABI void __init() {
+ for (size_t __i = 0; __i < __k; ++__i)
+ __v_[__i] = __e_();
+ __y_ = __e_();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type) { return __eval2(integral_constant<bool, __k & 1>()); }
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type) { return __eval(__uratio<__k, _Rp>()); }
+
+ _LIBCPP_HIDE_FROM_ABI result_type __eval2(false_type) { return __eval(__uratio<__k / 2, 0x8000000000000000ull>()); }
+ _LIBCPP_HIDE_FROM_ABI result_type __eval2(true_type) { return __evalf<__k, 0>(); }
+
+ template <uint64_t _Np,
+ uint64_t _Dp,
+ __enable_if_t<(__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) {
+ return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();
+ }
+
+ template <uint64_t _Np,
+ uint64_t _Dp,
+ __enable_if_t<__uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) {
+ const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (__y_ - _Min) / __uratio<_Np, _Dp>::den);
+ __y_ = __v_[__j];
+ __v_[__j] = __e_();
+ return __y_;
+ }
+
+ template <uint64_t __n, uint64_t __d>
+ _LIBCPP_HIDE_FROM_ABI result_type __evalf() {
+ const double __fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d;
+ const size_t __j = static_cast<size_t>(__fp * (__y_ - _Min));
+ __y_ = __v_[__j];
+ __v_[__j] = __e_();
+ return __y_;
+ }
};
-template<class _Engine, size_t __k>
- _LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size;
+template <class _Engine, size_t __k>
+_LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size;
-template<class _Eng, size_t _Kp>
+template <class _Eng, size_t _Kp>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y)
-{
- return __x.__y_ == __y.__y_ && std::equal(__x.__v_, __x.__v_ + _Kp, __y.__v_) &&
- __x.__e_ == __y.__e_;
+operator==(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y) {
+ return __x.__y_ == __y.__y_ && std::equal(__x.__v_, __x.__v_ + _Kp, __y.__v_) && __x.__e_ == __y.__e_;
}
-template<class _Eng, size_t _Kp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const shuffle_order_engine<_Eng, _Kp>& __x,
- const shuffle_order_engine<_Eng, _Kp>& __y)
-{
- return !(__x == __y);
+template <class _Eng, size_t _Kp>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
+template <class _CharT, class _Traits, class _Eng, size_t _Kp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const shuffle_order_engine<_Eng, _Kp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.__e_ << __sp << __x.__v_[0];
- for (size_t __i = 1; __i < _Kp; ++__i)
- __os << __sp << __x.__v_[__i];
- return __os << __sp << __x.__y_;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const shuffle_order_engine<_Eng, _Kp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.__e_ << __sp << __x.__v_[0];
+ for (size_t __i = 1; __i < _Kp; ++__i)
+ __os << __sp << __x.__v_[__i];
+ return __os << __sp << __x.__y_;
}
-template <class _CharT, class _Traits,
- class _Eng, size_t _Kp>
+template <class _CharT, class _Traits, class _Eng, size_t _Kp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- shuffle_order_engine<_Eng, _Kp>& __x)
-{
- typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _Eng __e;
- result_type __vp[_Kp+1];
- __is >> __e;
- for (size_t __i = 0; __i < _Kp+1; ++__i)
- __is >> __vp[__i];
- if (!__is.fail())
- {
- __x.__e_ = __e;
- for (size_t __i = 0; __i < _Kp; ++__i)
- __x.__v_[__i] = __vp[__i];
- __x.__y_ = __vp[_Kp];
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, shuffle_order_engine<_Eng, _Kp>& __x) {
+ typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _Eng __e;
+ result_type __vp[_Kp + 1];
+ __is >> __e;
+ for (size_t __i = 0; __i < _Kp + 1; ++__i)
+ __is >> __vp[__i];
+ if (!__is.fail()) {
+ __x.__e_ = __e;
+ for (size_t __i = 0; __i < _Kp; ++__i)
+ __x.__v_[__i] = __vp[__i];
+ __x.__y_ = __vp[_Kp];
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h b/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h
index 0879a411c0c5..110a856ee658 100644
--- a/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/student_t_distribution.h
@@ -26,130 +26,103 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS student_t_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS student_t_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
+ // types
+ typedef _RealType result_type;
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __n_;
- public:
- typedef student_t_distribution distribution_type;
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __n_;
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __n = 1) : __n_(__n) {}
+ public:
+ typedef student_t_distribution distribution_type;
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __n_;}
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__n_ == __y.__n_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__n_ == __y.__n_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
- normal_distribution<result_type> __nd_;
+ param_type __p_;
+ normal_distribution<result_type> __nd_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- student_t_distribution() : student_t_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit student_t_distribution(result_type __n)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI student_t_distribution() : student_t_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit student_t_distribution(result_type __n) : __p_(param_type(__n)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit student_t_distribution(result_type __n = 1)
- : __p_(param_type(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit student_t_distribution(result_type __n = 1) : __p_(param_type(__n)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit student_t_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {__nd_.reset();}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type n() const {return __p_.n();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return -numeric_limits<result_type>::infinity();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const student_t_distribution& __x,
- const student_t_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const student_t_distribution& __x,
- const student_t_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit student_t_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() { __nd_.reset(); }
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const student_t_distribution& __x, const student_t_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const student_t_distribution& __x, const student_t_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _RealType>
-template<class _URNG>
-_RealType
-student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- gamma_distribution<result_type> __gd(__p.n() * .5, 2);
- return __nd_(__g) * std::sqrt(__p.n()/__gd(__g));
+template <class _URNG>
+_RealType student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ gamma_distribution<result_type> __gd(__p.n() * .5, 2);
+ return __nd_(__g) * std::sqrt(__p.n() / __gd(__g));
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const student_t_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- __os << __x.n();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const student_t_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ __os << __x.n();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- student_t_distribution<_RT>& __x)
-{
- typedef student_t_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __n;
- __is >> __n;
- if (!__is.fail())
- __x.param(param_type(__n));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, student_t_distribution<_RT>& __x) {
+ typedef student_t_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __n;
+ __is >> __n;
+ if (!__is.fail())
+ __x.param(param_type(__n));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h b/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h
index fe2a66800adc..ec25fed49f94 100644
--- a/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h
+++ b/contrib/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h
@@ -28,315 +28,245 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine;
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_HIDE_FROM_ABI bool operator==(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_HIDE_FROM_ABI bool operator!=(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+operator<<(basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine
-{
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- result_type __x_[__r];
- result_type __c_;
- size_t __i_;
-
- static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
- static_assert( 0 < __w, "subtract_with_carry_engine invalid parameters");
- static_assert(__w <= _Dt, "subtract_with_carry_engine invalid parameters");
- static_assert( 0 < __s, "subtract_with_carry_engine invalid parameters");
- static_assert(__s < __r, "subtract_with_carry_engine invalid parameters");
+ result_type __x_[__r];
+ result_type __c_;
+ size_t __i_;
+
+ static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits<result_type>::digits;
+ static_assert(0 < __w, "subtract_with_carry_engine invalid parameters");
+ static_assert(__w <= _Dt, "subtract_with_carry_engine invalid parameters");
+ static_assert(0 < __s, "subtract_with_carry_engine invalid parameters");
+ static_assert(__s < __r, "subtract_with_carry_engine invalid parameters");
+
public:
- static _LIBCPP_CONSTEXPR const result_type _Min = 0;
- static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) :
- (result_type(1) << __w) - result_type(1);
- static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters");
-
- // engine characteristics
- static _LIBCPP_CONSTEXPR const size_t word_size = __w;
- static _LIBCPP_CONSTEXPR const size_t short_lag = __s;
- static _LIBCPP_CONSTEXPR const size_t long_lag = __r;
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
- static _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u;
-
- // constructors and seeding functions
+ static _LIBCPP_CONSTEXPR const result_type _Min = 0;
+ static _LIBCPP_CONSTEXPR const result_type _Max =
+ __w == _Dt ? result_type(~0) : (result_type(1) << __w) - result_type(1);
+ static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters");
+
+ // engine characteristics
+ static _LIBCPP_CONSTEXPR const size_t word_size = __w;
+ static _LIBCPP_CONSTEXPR const size_t short_lag = __s;
+ static _LIBCPP_CONSTEXPR const size_t long_lag = __r;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
+ static _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u;
+
+ // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit subtract_with_carry_engine(result_type __sd) { seed(__sd); }
+ _LIBCPP_HIDE_FROM_ABI subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
+ _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(result_type __sd) { seed(__sd); }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit subtract_with_carry_engine(result_type __sd = default_seed) {
- seed(__sd);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(result_type __sd = default_seed) { seed(__sd); }
#endif
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit subtract_with_carry_engine(_Sseq& __q)
- {seed(__q);}
- _LIBCPP_HIDE_FROM_ABI
- void seed(result_type __sd = default_seed)
- {seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
- template<class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void
- seed(_Sseq& __q)
- {__seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());}
-
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()();
- _LIBCPP_HIDE_FROM_ABI
- void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
-
- template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- bool
- operator==(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
- template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- bool
- operator!=(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
-
- template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(_Sseq& __q) {
+ seed(__q);
+ }
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed) {
+ seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());
+ }
+ template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
+ __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());
+ }
+
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()();
+ _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
+ for (; __z; --__z)
+ operator()();
+ }
+
+ template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend bool operator==(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+ template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend bool operator!=(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
+
+ template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
+
+ template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
private:
-
- _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 1>);
- _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 2>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
- template<class _Sseq>
- _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 1>);
+ _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 2>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
+ template <class _Sseq>
+ _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
};
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
- _LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type
subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
- integral_constant<unsigned, 1>)
-{
- linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
- __e(__sd == 0u ? default_seed : __sd);
- for (size_t __i = 0; __i < __r; ++__i)
- __x_[__i] = static_cast<result_type>(__e() & _Max);
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 1>) {
+ linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);
+ for (size_t __i = 0; __i < __r; ++__i)
+ __x_[__i] = static_cast<result_type>(__e() & _Max);
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
- integral_constant<unsigned, 2>)
-{
- linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
- __e(__sd == 0u ? default_seed : __sd);
- for (size_t __i = 0; __i < __r; ++__i)
- {
- result_type __e0 = __e();
- __x_[__i] = static_cast<result_type>(
- (__e0 + ((uint64_t)__e() << 32)) & _Max);
- }
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 2>) {
+ linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);
+ for (size_t __i = 0; __i < __r; ++__i) {
+ result_type __e0 = __e();
+ __x_[__i] = static_cast<result_type>((__e0 + ((uint64_t)__e() << 32)) & _Max);
+ }
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-template<class _Sseq>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q,
- integral_constant<unsigned, 1>)
-{
- const unsigned __k = 1;
- uint32_t __ar[__r * __k];
- __q.generate(__ar, __ar + __r * __k);
- for (size_t __i = 0; __i < __r; ++__i)
- __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+template <class _Sseq>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) {
+ const unsigned __k = 1;
+ uint32_t __ar[__r * __k];
+ __q.generate(__ar, __ar + __r * __k);
+ for (size_t __i = 0; __i < __r; ++__i)
+ __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-template<class _Sseq>
-void
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q,
- integral_constant<unsigned, 2>)
-{
- const unsigned __k = 2;
- uint32_t __ar[__r * __k];
- __q.generate(__ar, __ar + __r * __k);
- for (size_t __i = 0; __i < __r; ++__i)
- __x_[__i] = static_cast<result_type>(
- (__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
- __c_ = __x_[__r-1] == 0;
- __i_ = 0;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+template <class _Sseq>
+void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) {
+ const unsigned __k = 2;
+ uint32_t __ar[__r * __k];
+ __q.generate(__ar, __ar + __r * __k);
+ for (size_t __i = 0; __i < __r; ++__i)
+ __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
+ __c_ = __x_[__r - 1] == 0;
+ __i_ = 0;
}
-template<class _UIntType, size_t __w, size_t __s, size_t __r>
-_UIntType
-subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()()
-{
- const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r];
- result_type& __xr = __x_[__i_];
- result_type __new_c = __c_ == 0 ? __xs < __xr : __xs != 0 ? __xs <= __xr : 1;
- __xr = (__xs - __xr - __c_) & _Max;
- __c_ = __new_c;
- __i_ = (__i_ + 1) % __r;
- return __xr;
+template <class _UIntType, size_t __w, size_t __s, size_t __r>
+_UIntType subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() {
+ const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r];
+ result_type& __xr = __x_[__i_];
+ result_type __new_c = __c_ == 0 ? __xs < __xr : __xs != 0 ? __xs <= __xr : 1;
+ __xr = (__xs - __xr - __c_) & _Max;
+ __c_ = __new_c;
+ __i_ = (__i_ + 1) % __r;
+ return __xr;
}
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y)
-{
- if (__x.__c_ != __y.__c_)
- return false;
- if (__x.__i_ == __y.__i_)
- return std::equal(__x.__x_, __x.__x_ + _Rp, __y.__x_);
- if (__x.__i_ == 0 || __y.__i_ == 0)
- {
- size_t __j = std::min(_Rp - __x.__i_, _Rp - __y.__i_);
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
- __y.__x_ + __y.__i_))
- return false;
- if (__x.__i_ == 0)
- return std::equal(__x.__x_ + __j, __x.__x_ + _Rp, __y.__x_);
- return std::equal(__x.__x_, __x.__x_ + (_Rp - __j), __y.__x_ + __j);
- }
- if (__x.__i_ < __y.__i_)
- {
- size_t __j = _Rp - __y.__i_;
- if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
- __y.__x_ + __y.__i_))
- return false;
- if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Rp,
- __y.__x_))
- return false;
- return std::equal(__x.__x_, __x.__x_ + __x.__i_,
- __y.__x_ + (_Rp - (__x.__i_ + __j)));
- }
- size_t __j = _Rp - __x.__i_;
- if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
- __x.__x_ + __x.__i_))
- return false;
- if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Rp,
- __x.__x_))
- return false;
- return std::equal(__y.__x_, __y.__x_ + __y.__i_,
- __x.__x_ + (_Rp - (__y.__i_ + __j)));
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_HIDE_FROM_ABI bool operator==(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) {
+ if (__x.__c_ != __y.__c_)
+ return false;
+ if (__x.__i_ == __y.__i_)
+ return std::equal(__x.__x_, __x.__x_ + _Rp, __y.__x_);
+ if (__x.__i_ == 0 || __y.__i_ == 0) {
+ size_t __j = std::min(_Rp - __x.__i_, _Rp - __y.__i_);
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_))
+ return false;
+ if (__x.__i_ == 0)
+ return std::equal(__x.__x_ + __j, __x.__x_ + _Rp, __y.__x_);
+ return std::equal(__x.__x_, __x.__x_ + (_Rp - __j), __y.__x_ + __j);
+ }
+ if (__x.__i_ < __y.__i_) {
+ size_t __j = _Rp - __y.__i_;
+ if (!std::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_))
+ return false;
+ if (!std::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Rp, __y.__x_))
+ return false;
+ return std::equal(__x.__x_, __x.__x_ + __x.__i_, __y.__x_ + (_Rp - (__x.__i_ + __j)));
+ }
+ size_t __j = _Rp - __x.__i_;
+ if (!std::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_))
+ return false;
+ if (!std::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Rp, __x.__x_))
+ return false;
+ return std::equal(__y.__x_, __y.__x_ + __y.__i_, __x.__x_ + (_Rp - (__y.__i_ + __j)));
}
-template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y)
-{
- return !(__x == __y);
+template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) {
+ return !(__x == __y);
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.__x_[__x.__i_];
- for (size_t __j = __x.__i_ + 1; __j < _Rp; ++__j)
- __os << __sp << __x.__x_[__j];
- for (size_t __j = 0; __j < __x.__i_; ++__j)
- __os << __sp << __x.__x_[__j];
- __os << __sp << __x.__c_;
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.__x_[__x.__i_];
+ for (size_t __j = __x.__i_ + 1; __j < _Rp; ++__j)
+ __os << __sp << __x.__x_[__j];
+ for (size_t __j = 0; __j < __x.__i_; ++__j)
+ __os << __sp << __x.__x_[__j];
+ __os << __sp << __x.__c_;
+ return __os;
}
-template <class _CharT, class _Traits,
- class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
+template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- _UInt __t[_Rp+1];
- for (size_t __i = 0; __i < _Rp+1; ++__i)
- __is >> __t[__i];
- if (!__is.fail())
- {
- for (size_t __i = 0; __i < _Rp; ++__i)
- __x.__x_[__i] = __t[__i];
- __x.__c_ = __t[_Rp];
- __x.__i_ = 0;
- }
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ _UInt __t[_Rp + 1];
+ for (size_t __i = 0; __i < _Rp + 1; ++__i)
+ __is >> __t[__i];
+ if (!__is.fail()) {
+ for (size_t __i = 0; __i < _Rp; ++__i)
+ __x.__x_[__i] = __t[__i];
+ __x.__c_ = __t[_Rp];
+ __x.__i_ = 0;
+ }
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h b/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h
index 3a2b95c035b3..4e3ca3efe568 100644
--- a/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/uniform_int_distribution.h
@@ -29,263 +29,232 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Engine, class _UIntType>
-class __independent_bits_engine
-{
+template <class _Engine, class _UIntType>
+class __independent_bits_engine {
public:
- // types
- typedef _UIntType result_type;
+ // types
+ typedef _UIntType result_type;
private:
- typedef typename _Engine::result_type _Engine_result_type;
- typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
- _Working_result_type;
-
- _Engine& __e_;
- size_t __w_;
- size_t __w0_;
- size_t __n_;
- size_t __n0_;
- _Working_result_type __y0_;
- _Working_result_type __y1_;
- _Engine_result_type __mask0_;
- _Engine_result_type __mask1_;
+ typedef typename _Engine::result_type _Engine_result_type;
+ typedef __conditional_t<sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type>
+ _Working_result_type;
+
+ _Engine& __e_;
+ size_t __w_;
+ size_t __w0_;
+ size_t __n_;
+ size_t __n0_;
+ _Working_result_type __y0_;
+ _Working_result_type __y1_;
+ _Engine_result_type __mask0_;
+ _Engine_result_type __mask1_;
#ifdef _LIBCPP_CXX03_LANG
- static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
- + _Working_result_type(1);
+ static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1);
#else
- static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
- + _Working_result_type(1);
+ static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min() + _Working_result_type(1);
#endif
- static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
- static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
- static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
+ static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
public:
- // constructors and seeding functions
- _LIBCPP_HIDE_FROM_ABI __independent_bits_engine(_Engine& __e, size_t __w);
+ // constructors and seeding functions
+ _LIBCPP_HIDE_FROM_ABI __independent_bits_engine(_Engine& __e, size_t __w);
- // generating functions
- _LIBCPP_HIDE_FROM_ABI result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
+ // generating functions
+ _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
private:
- _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type);
- _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type);
+ _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
};
-template<class _Engine, class _UIntType>
-__independent_bits_engine<_Engine, _UIntType>
- ::__independent_bits_engine(_Engine& __e, size_t __w)
- : __e_(__e),
- __w_(__w)
-{
- __n_ = __w_ / __m + (__w_ % __m != 0);
+template <class _Engine, class _UIntType>
+__independent_bits_engine<_Engine, _UIntType>::__independent_bits_engine(_Engine& __e, size_t __w)
+ : __e_(__e), __w_(__w) {
+ __n_ = __w_ / __m + (__w_ % __m != 0);
+ __w0_ = __w_ / __n_;
+ if (_Rp == 0)
+ __y0_ = _Rp;
+ else if (__w0_ < _WDt)
+ __y0_ = (_Rp >> __w0_) << __w0_;
+ else
+ __y0_ = 0;
+ if (_Rp - __y0_ > __y0_ / __n_) {
+ ++__n_;
__w0_ = __w_ / __n_;
- if (_Rp == 0)
- __y0_ = _Rp;
- else if (__w0_ < _WDt)
- __y0_ = (_Rp >> __w0_) << __w0_;
+ if (__w0_ < _WDt)
+ __y0_ = (_Rp >> __w0_) << __w0_;
else
- __y0_ = 0;
- if (_Rp - __y0_ > __y0_ / __n_)
- {
- ++__n_;
- __w0_ = __w_ / __n_;
- if (__w0_ < _WDt)
- __y0_ = (_Rp >> __w0_) << __w0_;
- else
- __y0_ = 0;
- }
- __n0_ = __n_ - __w_ % __n_;
- if (__w0_ < _WDt - 1)
- __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1);
- else
- __y1_ = 0;
- __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) :
- _Engine_result_type(0);
- __mask1_ = __w0_ < _EDt - 1 ?
- _Engine_result_type(~0) >> (_EDt - (__w0_ + 1)) :
- _Engine_result_type(~0);
+ __y0_ = 0;
+ }
+ __n0_ = __n_ - __w_ % __n_;
+ if (__w0_ < _WDt - 1)
+ __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1);
+ else
+ __y1_ = 0;
+ __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) : _Engine_result_type(0);
+ __mask1_ = __w0_ < _EDt - 1 ? _Engine_result_type(~0) >> (_EDt - (__w0_ + 1)) : _Engine_result_type(~0);
}
-template<class _Engine, class _UIntType>
-inline
-_UIntType
-__independent_bits_engine<_Engine, _UIntType>::__eval(false_type)
-{
- return static_cast<result_type>(__e_() & __mask0_);
+template <class _Engine, class _UIntType>
+inline _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(false_type) {
+ return static_cast<result_type>(__e_() & __mask0_);
}
-template<class _Engine, class _UIntType>
-_UIntType
-__independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
-{
- const size_t __w_rt = numeric_limits<result_type>::digits;
- result_type __sp = 0;
- for (size_t __k = 0; __k < __n0_; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y0_);
- if (__w0_ < __w_rt)
- __sp <<= __w0_;
- else
- __sp = 0;
- __sp += __u & __mask0_;
- }
- for (size_t __k = __n0_; __k < __n_; ++__k)
- {
- _Engine_result_type __u;
- do
- {
- __u = __e_() - _Engine::min();
- } while (__u >= __y1_);
- if (__w0_ < __w_rt - 1)
- __sp <<= __w0_ + 1;
- else
- __sp = 0;
- __sp += __u & __mask1_;
- }
- return __sp;
+template <class _Engine, class _UIntType>
+_UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) {
+ const size_t __w_rt = numeric_limits<result_type>::digits;
+ result_type __sp = 0;
+ for (size_t __k = 0; __k < __n0_; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y0_);
+ if (__w0_ < __w_rt)
+ __sp <<= __w0_;
+ else
+ __sp = 0;
+ __sp += __u & __mask0_;
+ }
+ for (size_t __k = __n0_; __k < __n_; ++__k) {
+ _Engine_result_type __u;
+ do {
+ __u = __e_() - _Engine::min();
+ } while (__u >= __y1_);
+ if (__w0_ < __w_rt - 1)
+ __sp <<= __w0_ + 1;
+ else
+ __sp = 0;
+ __sp += __u & __mask1_;
+ }
+ return __sp;
}
-template<class _IntType = int>
-class uniform_int_distribution
-{
- static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+template <class _IntType = int>
+class uniform_int_distribution {
+ static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
+
public:
- // types
- typedef _IntType result_type;
-
- class param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef uniform_int_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0,
- result_type __b = numeric_limits<result_type>::max())
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI result_type b() const {return __b_;}
-
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _IntType result_type;
+
+ class param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef uniform_int_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = numeric_limits<result_type>::max())
+ : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ _LIBCPP_HIDE_FROM_ABI friend bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI uniform_int_distribution() : uniform_int_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(
- result_type __a, result_type __b = numeric_limits<result_type>::max())
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI uniform_int_distribution() : uniform_int_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(
+ result_type __a, result_type __b = numeric_limits<result_type>::max())
+ : __p_(param_type(__a, __b)) {}
#else
- explicit uniform_int_distribution(
- result_type __a = 0,
- result_type __b = numeric_limits<result_type>::max())
- : __p_(param_type(__a, __b)) {}
+ explicit uniform_int_distribution(result_type __a = 0, result_type __b = numeric_limits<result_type>::max())
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI result_type min() const {return a();}
- _LIBCPP_HIDE_FROM_ABI result_type max() const {return b();}
-
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator==(const uniform_int_distribution& __x,
- const uniform_int_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- _LIBCPP_HIDE_FROM_ABI
- friend bool operator!=(const uniform_int_distribution& __x,
- const uniform_int_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_int_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool
+ operator==(const uniform_int_distribution& __x, const uniform_int_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ _LIBCPP_HIDE_FROM_ABI friend bool
+ operator!=(const uniform_int_distribution& __x, const uniform_int_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _IntType>
-template<class _URNG>
-typename uniform_int_distribution<_IntType>::result_type
-uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
-_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> >
- _UIntType;
- const _UIntType __rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
- if (__rp == 1)
- return __p.a();
- const size_t __dt = numeric_limits<_UIntType>::digits;
- typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
- if (__rp == 0)
- return static_cast<result_type>(_Eng(__g, __dt)());
- size_t __w = __dt - std::__countl_zero(__rp) - 1;
- if ((__rp & (numeric_limits<_UIntType>::max() >> (__dt - __w))) != 0)
- ++__w;
- _Eng __e(__g, __w);
- _UIntType __u;
- do
- {
- __u = __e();
- } while (__u >= __rp);
- return static_cast<result_type>(__u + __p.a());
+template <class _IntType>
+template <class _URNG>
+typename uniform_int_distribution<_IntType>::result_type uniform_int_distribution<_IntType>::operator()(
+ _URNG& __g, const param_type& __p) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> > _UIntType;
+ const _UIntType __rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
+ if (__rp == 1)
+ return __p.a();
+ const size_t __dt = numeric_limits<_UIntType>::digits;
+ typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
+ if (__rp == 0)
+ return static_cast<result_type>(_Eng(__g, __dt)());
+ size_t __w = __dt - std::__countl_zero(__rp) - 1;
+ if ((__rp & (numeric_limits<_UIntType>::max() >> (__dt - __w))) != 0)
+ ++__w;
+ _Eng __e(__g, __w);
+ _UIntType __u;
+ do {
+ __u = __e();
+ } while (__u >= __rp);
+ return static_cast<result_type>(__u + __p.a());
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const uniform_int_distribution<_IT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _Ostream;
- __os.flags(_Ostream::dec | _Ostream::left);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.a() << __sp << __x.b();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const uniform_int_distribution<_IT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _Ostream;
+ __os.flags(_Ostream::dec | _Ostream::left);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.a() << __sp << __x.b();
}
template <class _CharT, class _Traits, class _IT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- uniform_int_distribution<_IT>& __x)
-{
- typedef uniform_int_distribution<_IT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, uniform_int_distribution<_IT>& __x) {
+ typedef uniform_int_distribution<_IT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h b/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h
index ddb3158eead9..4076f19b2cb2 100644
--- a/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h
+++ b/contrib/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h
@@ -28,14 +28,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [rand.req.urng]
-template<class _Gen>
-concept uniform_random_bit_generator =
- invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> &&
- requires {
- { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
- { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
- requires bool_constant<(_Gen::min() < _Gen::max())>::value;
- };
+template <class _Gen>
+concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> && requires {
+ { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
+ { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
+ requires bool_constant<(_Gen::min() < _Gen::max())>::value;
+};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h b/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h
index 28b6e9181c5f..250cb8bab58c 100644
--- a/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/uniform_real_distribution.h
@@ -24,137 +24,111 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS uniform_real_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS uniform_real_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef uniform_real_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 0,
- result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef uniform_real_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructors and reset functions
+ // constructors and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- uniform_real_distribution() : uniform_real_distribution(0) {}
- _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI uniform_real_distribution() : uniform_real_distribution(0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit uniform_real_distribution(result_type __a = 0, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(result_type __a = 0, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit uniform_real_distribution(const param_type& __p) : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG> _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return b();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const uniform_real_distribution& __x,
- const uniform_real_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const uniform_real_distribution& __x,
- const uniform_real_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit uniform_real_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const uniform_real_distribution& __x, const uniform_real_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const uniform_real_distribution& __x, const uniform_real_distribution& __y) {
+ return !(__x == __y);
+ }
};
-template<class _RealType>
-template<class _URNG>
-inline
-typename uniform_real_distribution<_RealType>::result_type
-uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
-{
- static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
- return (__p.b() - __p.a())
- * std::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g)
- + __p.a();
+template <class _RealType>
+template <class _URNG>
+inline typename uniform_real_distribution<_RealType>::result_type
+uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) {
+ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
+ return (__p.b() - __p.a()) * std::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g) + __p.a();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const uniform_real_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- return __os << __x.a() << __sp << __x.b();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const uniform_real_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ return __os << __x.a() << __sp << __x.b();
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- uniform_real_distribution<_RT>& __x)
-{
- typedef uniform_real_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, uniform_real_distribution<_RT>& __x) {
+ typedef uniform_real_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h b/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h
index 996799281031..aa3d63c8e866 100644
--- a/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h
+++ b/contrib/llvm-project/libcxx/include/__random/weibull_distribution.h
@@ -25,131 +25,104 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _RealType = double>
-class _LIBCPP_TEMPLATE_VIS weibull_distribution
-{
+template <class _RealType = double>
+class _LIBCPP_TEMPLATE_VIS weibull_distribution {
static_assert(__libcpp_random_is_valid_realtype<_RealType>::value,
"RealType must be a supported floating-point type");
public:
- // types
- typedef _RealType result_type;
-
- class _LIBCPP_TEMPLATE_VIS param_type
- {
- result_type __a_;
- result_type __b_;
- public:
- typedef weibull_distribution distribution_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit param_type(result_type __a = 1, result_type __b = 1)
- : __a_(__a), __b_(__b) {}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __a_;}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __b_;}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const param_type& __x, const param_type& __y)
- {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const param_type& __x, const param_type& __y)
- {return !(__x == __y);}
- };
+ // types
+ typedef _RealType result_type;
+
+ class _LIBCPP_TEMPLATE_VIS param_type {
+ result_type __a_;
+ result_type __b_;
+
+ public:
+ typedef weibull_distribution distribution_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 1, result_type __b = 1) : __a_(__a), __b_(__b) {}
+
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
+ return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const param_type& __x, const param_type& __y) { return !(__x == __y); }
+ };
private:
- param_type __p_;
+ param_type __p_;
public:
- // constructor and reset functions
+ // constructor and reset functions
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- weibull_distribution() : weibull_distribution(1) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit weibull_distribution(result_type __a, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI weibull_distribution() : weibull_distribution(1) {}
+ _LIBCPP_HIDE_FROM_ABI explicit weibull_distribution(result_type __a, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit weibull_distribution(result_type __a = 1, result_type __b = 1)
- : __p_(param_type(__a, __b)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit weibull_distribution(result_type __a = 1, result_type __b = 1)
+ : __p_(param_type(__a, __b)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit weibull_distribution(const param_type& __p)
- : __p_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- void reset() {}
-
- // generating functions
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g)
- {return (*this)(__g, __p_);}
- template<class _URNG>
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(_URNG& __g, const param_type& __p)
- {return __p.b() *
- std::pow(exponential_distribution<result_type>()(__g), 1/__p.a());}
-
- // property functions
- _LIBCPP_HIDE_FROM_ABI
- result_type a() const {return __p_.a();}
- _LIBCPP_HIDE_FROM_ABI
- result_type b() const {return __p_.b();}
-
- _LIBCPP_HIDE_FROM_ABI
- param_type param() const {return __p_;}
- _LIBCPP_HIDE_FROM_ABI
- void param(const param_type& __p) {__p_ = __p;}
-
- _LIBCPP_HIDE_FROM_ABI
- result_type min() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI
- result_type max() const {return numeric_limits<result_type>::infinity();}
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const weibull_distribution& __x,
- const weibull_distribution& __y)
- {return __x.__p_ == __y.__p_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const weibull_distribution& __x,
- const weibull_distribution& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI explicit weibull_distribution(const param_type& __p) : __p_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI void reset() {}
+
+ // generating functions
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
+ return (*this)(__g, __p_);
+ }
+ template <class _URNG>
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
+ return __p.b() * std::pow(exponential_distribution<result_type>()(__g), 1 / __p.a());
+ }
+
+ // property functions
+ _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
+ _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
+
+ _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
+ _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
+
+ _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const weibull_distribution& __x, const weibull_distribution& __y) {
+ return __x.__p_ == __y.__p_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const weibull_distribution& __x, const weibull_distribution& __y) {
+ return !(__x == __y);
+ }
};
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const weibull_distribution<_RT>& __x)
-{
- __save_flags<_CharT, _Traits> __lx(__os);
- typedef basic_ostream<_CharT, _Traits> _OStream;
- __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
- _OStream::scientific);
- _CharT __sp = __os.widen(' ');
- __os.fill(__sp);
- __os << __x.a() << __sp << __x.b();
- return __os;
+operator<<(basic_ostream<_CharT, _Traits>& __os, const weibull_distribution<_RT>& __x) {
+ __save_flags<_CharT, _Traits> __lx(__os);
+ typedef basic_ostream<_CharT, _Traits> _OStream;
+ __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | _OStream::scientific);
+ _CharT __sp = __os.widen(' ');
+ __os.fill(__sp);
+ __os << __x.a() << __sp << __x.b();
+ return __os;
}
template <class _CharT, class _Traits, class _RT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- weibull_distribution<_RT>& __x)
-{
- typedef weibull_distribution<_RT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> __lx(__is);
- typedef basic_istream<_CharT, _Traits> _Istream;
- __is.flags(_Istream::dec | _Istream::skipws);
- result_type __a;
- result_type __b;
- __is >> __a >> __b;
- if (!__is.fail())
- __x.param(param_type(__a, __b));
- return __is;
+operator>>(basic_istream<_CharT, _Traits>& __is, weibull_distribution<_RT>& __x) {
+ typedef weibull_distribution<_RT> _Eng;
+ typedef typename _Eng::result_type result_type;
+ typedef typename _Eng::param_type param_type;
+ __save_flags<_CharT, _Traits> __lx(__is);
+ typedef basic_istream<_CharT, _Traits> _Istream;
+ __is.flags(_Istream::dec | _Istream::skipws);
+ result_type __a;
+ result_type __b;
+ __is >> __a >> __b;
+ if (!__is.fail())
+ __x.param(param_type(__a, __b));
+ return __is;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__ranges/access.h b/contrib/llvm-project/libcxx/include/__ranges/access.h
index 502bd5e951c4..263fdd637fd9 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/access.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/access.h
@@ -32,138 +32,121 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template <class _Tp>
- concept __can_borrow =
- is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>;
+template <class _Tp>
+concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>;
} // namespace ranges
// [range.access.begin]
namespace ranges {
namespace __begin {
- template <class _Tp>
- concept __member_begin =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator;
- };
+template <class _Tp>
+concept __member_begin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator;
+};
- void begin(auto&) = delete;
- void begin(const auto&) = delete;
+void begin(auto&) = delete;
+void begin(const auto&) = delete;
- template <class _Tp>
- concept __unqualified_begin =
- !__member_begin<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp && __t) {
+template <class _Tp>
+concept __unqualified_begin =
+ !__member_begin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
{ _LIBCPP_AUTO_CAST(begin(__t)) } -> input_or_output_iterator;
};
- struct __fn {
- template <class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
-
- template <class _Tp, size_t _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
-
- template <class _Tp>
- requires __member_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin())))
- {
- return _LIBCPP_AUTO_CAST(__t.begin());
- }
-
- template <class _Tp>
- requires __unqualified_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t))))
- {
- return _LIBCPP_AUTO_CAST(begin(__t));
- }
-
- void operator()(auto&&) const = delete;
- };
+struct __fn {
+ template <class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + 0;
+ }
+
+ template <class _Tp, size_t _Np>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + 0;
+ }
+
+ template <class _Tp>
+ requires __member_begin<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin()))) {
+ return _LIBCPP_AUTO_CAST(__t.begin());
+ }
+
+ template <class _Tp>
+ requires __unqualified_begin<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t)))) {
+ return _LIBCPP_AUTO_CAST(begin(__t));
+ }
+
+ void operator()(auto&&) const = delete;
+};
} // namespace __begin
inline namespace __cpo {
- inline constexpr auto begin = __begin::__fn{};
+inline constexpr auto begin = __begin::__fn{};
} // namespace __cpo
} // namespace ranges
// [range.range]
namespace ranges {
- template <class _Tp>
- using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
+template <class _Tp>
+using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
} // namespace ranges
// [range.access.end]
namespace ranges {
namespace __end {
- template <class _Tp>
- concept __member_end =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
+template <class _Tp>
+concept __member_end = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ typename iterator_t<_Tp>;
+ { _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>;
+};
+
+void end(auto&) = delete;
+void end(const auto&) = delete;
+
+template <class _Tp>
+concept __unqualified_end =
+ !__member_end<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
typename iterator_t<_Tp>;
- { _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>;
+ { _LIBCPP_AUTO_CAST(end(__t)) } -> sentinel_for<iterator_t<_Tp>>;
};
- void end(auto&) = delete;
- void end(const auto&) = delete;
+struct __fn {
+ template <class _Tp, size_t _Np>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + _Np;
+ }
template <class _Tp>
- concept __unqualified_end =
- !__member_end<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp && __t) {
- typename iterator_t<_Tp>;
- { _LIBCPP_AUTO_CAST(end(__t)) } -> sentinel_for<iterator_t<_Tp>>;
- };
+ requires __member_end<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end()))) {
+ return _LIBCPP_AUTO_CAST(__t.end());
+ }
- struct __fn {
- template <class _Tp, size_t _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + _Np;
- }
-
- template <class _Tp>
- requires __member_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end())))
- {
- return _LIBCPP_AUTO_CAST(__t.end());
- }
-
- template <class _Tp>
- requires __unqualified_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t))))
- {
- return _LIBCPP_AUTO_CAST(end(__t));
- }
-
- void operator()(auto&&) const = delete;
- };
+ template <class _Tp>
+ requires __unqualified_end<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t)))) {
+ return _LIBCPP_AUTO_CAST(end(__t));
+ }
+
+ void operator()(auto&&) const = delete;
+};
} // namespace __end
inline namespace __cpo {
- inline constexpr auto end = __end::__fn{};
+inline constexpr auto end = __end::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -171,27 +154,27 @@ inline namespace __cpo {
namespace ranges {
namespace __cbegin {
- struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn {
+ template <class _Tp>
+ requires is_lvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ -> decltype(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+ template <class _Tp>
+ requires is_rvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::begin(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::begin(static_cast<const _Tp&&>(__t)))
- { return ranges::begin(static_cast<const _Tp&&>(__t)); }
- };
+ -> decltype(ranges::begin(static_cast<const _Tp&&>(__t))) {
+ return ranges::begin(static_cast<const _Tp&&>(__t));
+ }
+};
} // namespace __cbegin
inline namespace __cpo {
- inline constexpr auto cbegin = __cbegin::__fn{};
+inline constexpr auto cbegin = __cbegin::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -199,27 +182,27 @@ inline namespace __cpo {
namespace ranges {
namespace __cend {
- struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn {
+ template <class _Tp>
+ requires is_lvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ -> decltype(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+ template <class _Tp>
+ requires is_rvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::end(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::end(static_cast<const _Tp&&>(__t)))
- { return ranges::end(static_cast<const _Tp&&>(__t)); }
- };
+ -> decltype(ranges::end(static_cast<const _Tp&&>(__t))) {
+ return ranges::end(static_cast<const _Tp&&>(__t));
+ }
+};
} // namespace __cend
inline namespace __cpo {
- inline constexpr auto cend = __cend::__fn{};
+inline constexpr auto cend = __cend::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/all.h b/contrib/llvm-project/libcxx/include/__ranges/all.h
index 2c88f51b6644..b735bdc7166c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/all.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/all.h
@@ -36,45 +36,38 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges::views {
namespace __all {
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Tp>
- requires ranges::view<decay_t<_Tp>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn : __range_adaptor_closure<__fn> {
+ template <class _Tp>
+ requires ranges::view<decay_t<_Tp>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))))
- -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))
- {
- return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
- }
+ -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) {
+ return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
+ }
- template<class _Tp>
- requires (!ranges::view<decay_t<_Tp>>) &&
- requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)}))
- {
- return ranges::ref_view{std::forward<_Tp>(__t)};
- }
+ template <class _Tp>
+ requires(!ranges::view<decay_t<_Tp>>) && requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) {
+ return ranges::ref_view{std::forward<_Tp>(__t)};
+ }
- template<class _Tp>
- requires (!ranges::view<decay_t<_Tp>> &&
- !requires (_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&
- requires (_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)}))
- {
- return ranges::owning_view{std::forward<_Tp>(__t)};
- }
- };
+ template <class _Tp>
+ requires(
+ !ranges::view<decay_t<_Tp>> && !requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&
+ requires(_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) {
+ return ranges::owning_view{std::forward<_Tp>(__t)};
+ }
+};
} // namespace __all
inline namespace __cpo {
- inline constexpr auto all = __all::__fn{};
+inline constexpr auto all = __all::__fn{};
} // namespace __cpo
-template<ranges::viewable_range _Range>
+template <ranges::viewable_range _Range>
using all_t = decltype(views::all(std::declval<_Range>()));
} // namespace ranges::views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/common_view.h b/contrib/llvm-project/libcxx/include/__ranges/common_view.h
index f4cd18074904..4b5b04c9894b 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/common_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/common_view.h
@@ -38,96 +38,99 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<view _View>
- requires (!common_range<_View> && copyable<iterator_t<_View>>)
+template <view _View>
+ requires(!common_range<_View> && copyable<iterator_t<_View>>)
class common_view : public view_interface<common_view<_View>> {
_View __base_ = _View();
public:
- _LIBCPP_HIDE_FROM_ABI
- common_view() requires default_initializable<_View> = default;
+ _LIBCPP_HIDE_FROM_ABI common_view()
+ requires default_initializable<_View>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit common_view(_View __v) : __base_(std::move(__v)) { }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit common_view(_View __v) : __base_(std::move(__v)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
if constexpr (random_access_range<_View> && sized_range<_View>)
return ranges::begin(__base_);
else
return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::begin(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires range<const _View>
+ {
if constexpr (random_access_range<const _View> && sized_range<const _View>)
return ranges::begin(__base_);
else
return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::begin(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
if constexpr (random_access_range<_View> && sized_range<_View>)
return ranges::begin(__base_) + ranges::size(__base_);
else
return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _View>
+ {
if constexpr (random_access_range<const _View> && sized_range<const _View>)
return ranges::begin(__base_) + ranges::size(__base_);
else
return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
return ranges::size(__base_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
return ranges::size(__base_);
}
};
-template<class _Range>
-common_view(_Range&&)
- -> common_view<views::all_t<_Range>>;
+template <class _Range>
+common_view(_Range&&) -> common_view<views::all_t<_Range>>;
-template<class _View>
+template <class _View>
inline constexpr bool enable_borrowed_range<common_view<_View>> = enable_borrowed_range<_View>;
namespace views {
namespace __common {
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- requires common_range<_Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
+struct __fn : __range_adaptor_closure<__fn> {
+ template <class _Range>
+ requires common_range<_Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
noexcept(noexcept(views::all(std::forward<_Range>(__range))))
- -> decltype( views::all(std::forward<_Range>(__range)))
- { return views::all(std::forward<_Range>(__range)); }
+ -> decltype(views::all(std::forward<_Range>(__range))) {
+ return views::all(std::forward<_Range>(__range));
+ }
- template<class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
+ template <class _Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
noexcept(noexcept(common_view{std::forward<_Range>(__range)}))
- -> decltype( common_view{std::forward<_Range>(__range)})
- { return common_view{std::forward<_Range>(__range)}; }
- };
+ -> decltype(common_view{std::forward<_Range>(__range)}) {
+ return common_view{std::forward<_Range>(__range)};
+ }
+};
} // namespace __common
inline namespace __cpo {
- inline constexpr auto common = __common::__fn{};
+inline constexpr auto common = __common::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/concepts.h b/contrib/llvm-project/libcxx/include/__ranges/concepts.h
index b87a71460610..674a3f359ff9 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/concepts.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/concepts.h
@@ -41,100 +41,92 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
- // [range.range]
+// [range.range]
- template <class _Tp>
- concept range = requires(_Tp& __t) {
- ranges::begin(__t); // sometimes equality-preserving
- ranges::end(__t);
- };
+template <class _Tp>
+concept range = requires(_Tp& __t) {
+ ranges::begin(__t); // sometimes equality-preserving
+ ranges::end(__t);
+};
- template <class _Tp>
- concept input_range = range<_Tp> && input_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept input_range = range<_Tp> && input_iterator<iterator_t<_Tp>>;
- template<class _Range>
- concept borrowed_range = range<_Range> &&
- (is_lvalue_reference_v<_Range> || enable_borrowed_range<remove_cvref_t<_Range>>);
+template <class _Range>
+concept borrowed_range =
+ range<_Range> && (is_lvalue_reference_v<_Range> || enable_borrowed_range<remove_cvref_t<_Range>>);
- // `iterator_t` defined in <__ranges/access.h>
+// `iterator_t` defined in <__ranges/access.h>
- template <range _Rp>
- using sentinel_t = decltype(ranges::end(std::declval<_Rp&>()));
+template <range _Rp>
+using sentinel_t = decltype(ranges::end(std::declval<_Rp&>()));
- template <range _Rp>
- using range_difference_t = iter_difference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_difference_t = iter_difference_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_value_t = iter_value_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_value_t = iter_value_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_reference_t = iter_reference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_reference_t = iter_reference_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rp>>;
- template <range _Rp>
- using range_common_reference_t = iter_common_reference_t<iterator_t<_Rp>>;
+template <range _Rp>
+using range_common_reference_t = iter_common_reference_t<iterator_t<_Rp>>;
- // [range.sized]
- template <class _Tp>
- concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); };
+// [range.sized]
+template <class _Tp>
+concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); };
- template<sized_range _Rp>
- using range_size_t = decltype(ranges::size(std::declval<_Rp&>()));
+template <sized_range _Rp>
+using range_size_t = decltype(ranges::size(std::declval<_Rp&>()));
- // `disable_sized_range` defined in `<__ranges/size.h>`
+// `disable_sized_range` defined in `<__ranges/size.h>`
- // [range.view], views
+// [range.view], views
- // `enable_view` defined in <__ranges/enable_view.h>
- // `view_base` defined in <__ranges/enable_view.h>
+// `enable_view` defined in <__ranges/enable_view.h>
+// `view_base` defined in <__ranges/enable_view.h>
- template <class _Tp>
- concept view =
- range<_Tp> &&
- movable<_Tp> &&
- enable_view<_Tp>;
+template <class _Tp>
+concept view = range<_Tp> && movable<_Tp> && enable_view<_Tp>;
- template <class _Range>
- concept __simple_view =
- view<_Range> && range<const _Range> &&
- same_as<iterator_t<_Range>, iterator_t<const _Range>> &&
+template <class _Range>
+concept __simple_view =
+ view<_Range> && range<const _Range> && same_as<iterator_t<_Range>, iterator_t<const _Range>> &&
same_as<sentinel_t<_Range>, sentinel_t<const _Range>>;
- // [range.refinements], other range refinements
- template <class _Rp, class _Tp>
- concept output_range = range<_Rp> && output_iterator<iterator_t<_Rp>, _Tp>;
+// [range.refinements], other range refinements
+template <class _Rp, class _Tp>
+concept output_range = range<_Rp> && output_iterator<iterator_t<_Rp>, _Tp>;
- template <class _Tp>
- concept forward_range = input_range<_Tp> && forward_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept forward_range = input_range<_Tp> && forward_iterator<iterator_t<_Tp>>;
- template <class _Tp>
- concept bidirectional_range = forward_range<_Tp> && bidirectional_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept bidirectional_range = forward_range<_Tp> && bidirectional_iterator<iterator_t<_Tp>>;
- template <class _Tp>
- concept random_access_range =
- bidirectional_range<_Tp> && random_access_iterator<iterator_t<_Tp>>;
+template <class _Tp>
+concept random_access_range = bidirectional_range<_Tp> && random_access_iterator<iterator_t<_Tp>>;
- template<class _Tp>
- concept contiguous_range =
- random_access_range<_Tp> &&
- contiguous_iterator<iterator_t<_Tp>> &&
- requires(_Tp& __t) {
- { ranges::data(__t) } -> same_as<add_pointer_t<range_reference_t<_Tp>>>;
- };
+template <class _Tp>
+concept contiguous_range = random_access_range<_Tp> && contiguous_iterator<iterator_t<_Tp>> && requires(_Tp& __t) {
+ { ranges::data(__t) } -> same_as<add_pointer_t<range_reference_t<_Tp>>>;
+};
- template <class _Tp>
- concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>;
+template <class _Tp>
+concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>;
- template <class _Tp>
- inline constexpr bool __is_std_initializer_list = false;
+template <class _Tp>
+inline constexpr bool __is_std_initializer_list = false;
- template <class _Ep>
- inline constexpr bool __is_std_initializer_list<initializer_list<_Ep>> = true;
+template <class _Ep>
+inline constexpr bool __is_std_initializer_list<initializer_list<_Ep>> = true;
- template <class _Tp>
- concept viewable_range =
+template <class _Tp>
+concept viewable_range =
range<_Tp> &&
((view<remove_cvref_t<_Tp>> && constructible_from<remove_cvref_t<_Tp>, _Tp>) ||
(!view<remove_cvref_t<_Tp>> &&
diff --git a/contrib/llvm-project/libcxx/include/__ranges/counted.h b/contrib/llvm-project/libcxx/include/__ranges/counted.h
index 882f90b1ed82..337634895766 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/counted.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/counted.h
@@ -37,41 +37,43 @@ namespace ranges::views {
namespace __counted {
- struct __fn {
- template<contiguous_iterator _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count))))
- // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
- { return span(std::to_address(__it), static_cast<size_t>(__count)); }
-
- template<random_access_iterator _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(subrange(__it, __it + __count)))
- -> decltype( subrange(__it, __it + __count))
- { return subrange(__it, __it + __count); }
-
- template<class _It>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
- noexcept(noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel)))
- -> decltype( subrange(counted_iterator(std::move(__it), __count), default_sentinel))
- { return subrange(counted_iterator(std::move(__it), __count), default_sentinel); }
-
- template<class _It, convertible_to<iter_difference_t<_It>> _Diff>
- requires input_or_output_iterator<decay_t<_It>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_It&& __it, _Diff&& __count) const
+struct __fn {
+ template <contiguous_iterator _It>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_It __it,
+ iter_difference_t<_It> __count) noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count))))
+ // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
+ {
+ return span(std::to_address(__it), static_cast<size_t>(__count));
+ }
+
+ template <random_access_iterator _It>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __go(_It __it, iter_difference_t<_It> __count) noexcept(noexcept(subrange(__it, __it + __count)))
+ -> decltype(subrange(__it, __it + __count)) {
+ return subrange(__it, __it + __count);
+ }
+
+ template <class _It>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(
+ noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel)))
+ -> decltype(subrange(counted_iterator(std::move(__it), __count), default_sentinel)) {
+ return subrange(counted_iterator(std::move(__it), __count), default_sentinel);
+ }
+
+ template <class _It, convertible_to<iter_difference_t<_It>> _Diff>
+ requires input_or_output_iterator<decay_t<_It>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_It&& __it, _Diff&& __count) const
noexcept(noexcept(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))))
- -> decltype( __go(std::forward<_It>(__it), std::forward<_Diff>(__count)))
- { return __go(std::forward<_It>(__it), std::forward<_Diff>(__count)); }
- };
+ -> decltype(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))) {
+ return __go(std::forward<_It>(__it), std::forward<_Diff>(__count));
+ }
+};
} // namespace __counted
inline namespace __cpo {
- inline constexpr auto counted = __counted::__fn{};
+inline constexpr auto counted = __counted::__fn{};
} // namespace __cpo
} // namespace ranges::views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/data.h b/contrib/llvm-project/libcxx/include/__ranges/data.h
index 6c099085af34..18002bb52cc8 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/data.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/data.h
@@ -36,44 +36,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __data {
- template <class _Tp>
- concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
-
- template <class _Tp>
- concept __member_data =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
- };
-
- template <class _Tp>
- concept __ranges_begin_invocable =
- !__member_data<_Tp> &&
- __can_borrow<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> contiguous_iterator;
- };
-
- struct __fn {
- template <__member_data _Tp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(__t.data())) {
- return __t.data();
- }
-
- template<__ranges_begin_invocable _Tp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(std::to_address(ranges::begin(__t)))) {
- return std::to_address(ranges::begin(__t));
- }
- };
+template <class _Tp>
+concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
+
+template <class _Tp>
+concept __member_data = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
+};
+
+template <class _Tp>
+concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> contiguous_iterator;
+};
+
+struct __fn {
+ template <__member_data _Tp>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) {
+ return __t.data();
+ }
+
+ template <__ranges_begin_invocable _Tp>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(std::to_address(ranges::begin(__t)))) {
+ return std::to_address(ranges::begin(__t));
+ }
+};
} // namespace __data
inline namespace __cpo {
- inline constexpr auto data = __data::__fn{};
+inline constexpr auto data = __data::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -81,27 +72,27 @@ inline namespace __cpo {
namespace ranges {
namespace __cdata {
- struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+struct __fn {
+ template <class _Tp>
+ requires is_lvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ -> decltype(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
+ template <class _Tp>
+ requires is_rvalue_reference_v<_Tp&&>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
noexcept(noexcept(ranges::data(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::data(static_cast<const _Tp&&>(__t)))
- { return ranges::data(static_cast<const _Tp&&>(__t)); }
- };
+ -> decltype(ranges::data(static_cast<const _Tp&&>(__t))) {
+ return ranges::data(static_cast<const _Tp&&>(__t));
+ }
+};
} // namespace __cdata
inline namespace __cpo {
- inline constexpr auto cdata = __cdata::__fn{};
+inline constexpr auto cdata = __cdata::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/drop_view.h b/contrib/llvm-project/libcxx/include/__ranges/drop_view.h
index f10476f0011e..2b89c6877a78 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/drop_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/drop_view.h
@@ -56,89 +56,91 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<view _View>
- class drop_view
- : public view_interface<drop_view<_View>>
- {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method. If this is an input_range, then we cannot cache
- // begin because begin is not equality preserving.
- // Note: drop_view<input-range>::begin() is still trivially amortized O(1) because
- // one can't call begin() on it more than once.
- static constexpr bool _UseCache = forward_range<_View> && !(random_access_range<_View> && sized_range<_View>);
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- range_difference_t<_View> __count_ = 0;
- _View __base_ = _View();
+template <view _View>
+class drop_view : public view_interface<drop_view<_View>> {
+ // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
+ // amortized O(1) begin() method. If this is an input_range, then we cannot cache
+ // begin because begin is not equality preserving.
+ // Note: drop_view<input-range>::begin() is still trivially amortized O(1) because
+ // one can't call begin() on it more than once.
+ static constexpr bool _UseCache = forward_range<_View> && !(random_access_range<_View> && sized_range<_View>);
+ using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
+ range_difference_t<_View> __count_ = 0;
+ _View __base_ = _View();
public:
- _LIBCPP_HIDE_FROM_ABI drop_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_view(_View __base, range_difference_t<_View> __count)
- : __count_(__count)
- , __base_(std::move(__base))
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin()
- requires (!(__simple_view<_View> &&
- random_access_range<const _View> && sized_range<const _View>))
- {
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires random_access_range<const _View> && sized_range<const _View>
- {
- return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end()
- requires (!__simple_view<_View>)
- { return ranges::end(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires range<const _View>
- { return ranges::end(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __size(auto& __self) {
- const auto __s = ranges::size(__self.__base_);
- const auto __c = static_cast<decltype(__s)>(__self.__count_);
- return __s < __c ? 0 : __s - __c;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
- requires sized_range<_View>
- { return __size(*this); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires sized_range<const _View>
- { return __size(*this); }
- };
-
-template<class _Range>
+ _LIBCPP_HIDE_FROM_ABI drop_view()
+ requires default_initializable<_View>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+ drop_view(_View __base, range_difference_t<_View> __count)
+ : __count_(__count), __base_(std::move(__base)) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+ requires(!(__simple_view<_View> && random_access_range<const _View> && sized_range<const _View>))
+ {
+ if constexpr (_UseCache)
+ if (__cached_begin_.__has_value())
+ return *__cached_begin_;
+
+ auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
+ if constexpr (_UseCache)
+ __cached_begin_.__emplace(__tmp);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires random_access_range<const _View> && sized_range<const _View>
+ {
+ return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires(!__simple_view<_View>)
+ {
+ return ranges::end(__base_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _View>
+ {
+ return ranges::end(__base_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __size(auto& __self) {
+ const auto __s = ranges::size(__self.__base_);
+ const auto __c = static_cast<decltype(__s)>(__self.__count_);
+ return __s < __c ? 0 : __s - __c;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
+ return __size(*this);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
+ return __size(*this);
+ }
+};
+
+template <class _Range>
drop_view(_Range&&, range_difference_t<_Range>) -> drop_view<views::all_t<_Range>>;
-template<class _Tp>
+template <class _Tp>
inline constexpr bool enable_borrowed_range<drop_view<_Tp>> = enable_borrowed_range<_Tp>;
namespace views {
@@ -203,72 +205,55 @@ struct __fn {
// [range.drop.overview]: the `empty_view` case.
template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
- -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
- { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
+ -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) {
+ return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range));
+ }
// [range.drop.overview]: the `span | basic_string_view | iota_view | subrange (StoreSize == false)` case.
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (!__is_empty_view<_RawRange> &&
- random_access_range<_RawRange> &&
- sized_range<_RawRange> &&
- __is_passthrough_specialization<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(__passthrough_type_t<_RawRange>(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng)
- )))
- -> decltype( __passthrough_type_t<_RawRange>(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng)
- ))
- { return __passthrough_type_t<_RawRange>(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng)
- ); }
+ class _Dist = range_difference_t<_Range>>
+ requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
+ __is_passthrough_specialization<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const
+ noexcept(noexcept(__passthrough_type_t<_RawRange>(
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), ranges::end(__rng))))
+ -> decltype(__passthrough_type_t<_RawRange>(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng))) {
+ return __passthrough_type_t<_RawRange>(
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), ranges::end(__rng));
+ }
// [range.drop.overview]: the `subrange (StoreSize == true)` case.
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (!__is_empty_view<_RawRange> &&
- random_access_range<_RawRange> &&
- sized_range<_RawRange> &&
- __is_subrange_specialization_with_store_size<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(_RawRange(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng),
- std::__to_unsigned_like(ranges::distance(__rng) -
- std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
- )))
- -> decltype( _RawRange(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng),
- std::__to_unsigned_like(ranges::distance(__rng) -
- std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
- ))
- {
- // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the
- // expression used in the `noexcept` clause and the return statement).
- auto __dist = ranges::distance(__rng);
- auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n));
- return _RawRange(
- ranges::begin(__rng) + __clamped,
- ranges::end(__rng),
- std::__to_unsigned_like(__dist - __clamped)
- );}
-// clang-format off
+ class _Dist = range_difference_t<_Range>>
+ requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
+ __is_subrange_specialization_with_store_size<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(
+ _RawRange(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng),
+ std::__to_unsigned_like(ranges::distance(__rng) -
+ std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))))
+ -> decltype(_RawRange(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng),
+ std::__to_unsigned_like(ranges::distance(__rng) -
+ std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))) {
+ // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the
+ // expression used in the `noexcept` clause and the return statement).
+ auto __dist = ranges::distance(__rng);
+ auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n));
+ return _RawRange(ranges::begin(__rng) + __clamped, ranges::end(__rng), std::__to_unsigned_like(__dist - __clamped));
+ }
+ // clang-format off
#if _LIBCPP_STD_VER >= 23
// [range.drop.overview]: the `repeat_view` "_RawRange models sized_range" case.
template <class _Range,
@@ -293,42 +278,38 @@ struct __fn {
-> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
{ return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
#endif
-// clang-format on
+ // clang-format on
// [range.drop.overview]: the "otherwise" case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>>
- // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
- // overloads.
- requires (!(__is_empty_view<_RawRange> ||
-#if _LIBCPP_STD_VER >= 23
- __is_repeat_specialization<_RawRange> ||
-#endif
- (__is_subrange_specialization_with_store_size<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>) ||
- (__is_passthrough_specialization<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>)
- ))
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
- -> decltype( drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))
- { return drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); }
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>>
+ // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
+ // overloads.
+ requires(
+ !(__is_empty_view<_RawRange> ||
+# if _LIBCPP_STD_VER >= 23
+ __is_repeat_specialization<_RawRange> ||
+# endif
+ (__is_subrange_specialization_with_store_size<_RawRange> && sized_range<_RawRange> &&
+ random_access_range<_RawRange>) ||
+ (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>)))
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
+ noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
+ -> decltype(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) {
+ return drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n));
+ }
template <class _Np>
requires constructible_from<decay_t<_Np>, _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Np&& __n) const
- noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n))); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
+ }
};
} // namespace __drop
inline namespace __cpo {
- inline constexpr auto drop = __drop::__fn{};
+inline constexpr auto drop = __drop::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/empty.h b/contrib/llvm-project/libcxx/include/__ranges/empty.h
index 64996f4a6f7b..acd55dae224c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/empty.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/empty.h
@@ -28,50 +28,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __empty {
- template <class _Tp>
- concept __member_empty =
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- bool(__t.empty());
- };
-
- template<class _Tp>
- concept __can_invoke_size =
- !__member_empty<_Tp> &&
- requires(_Tp&& __t) { ranges::size(__t); };
-
- template <class _Tp>
- concept __can_compare_begin_end =
- !__member_empty<_Tp> &&
- !__can_invoke_size<_Tp> &&
- requires(_Tp&& __t) {
- bool(ranges::begin(__t) == ranges::end(__t));
- { ranges::begin(__t) } -> forward_iterator;
- };
-
- struct __fn {
- template <__member_empty _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(bool(__t.empty()))) {
- return bool(__t.empty());
- }
-
- template <__can_invoke_size _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::size(__t))) {
- return ranges::size(__t) == 0;
- }
-
- template<__can_compare_begin_end _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) {
- return ranges::begin(__t) == ranges::end(__t);
- }
- };
+template <class _Tp>
+concept __member_empty = __workaround_52970<_Tp> && requires(_Tp&& __t) { bool(__t.empty()); };
+
+template <class _Tp>
+concept __can_invoke_size = !__member_empty<_Tp> && requires(_Tp&& __t) { ranges::size(__t); };
+
+template <class _Tp>
+concept __can_compare_begin_end = !__member_empty<_Tp> && !__can_invoke_size<_Tp> && requires(_Tp&& __t) {
+ bool(ranges::begin(__t) == ranges::end(__t));
+ { ranges::begin(__t) } -> forward_iterator;
+};
+
+struct __fn {
+ template <__member_empty _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(bool(__t.empty()))) {
+ return bool(__t.empty());
+ }
+
+ template <__can_invoke_size _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(ranges::size(__t))) {
+ return ranges::size(__t) == 0;
+ }
+
+ template <__can_compare_begin_end _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
+ noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) {
+ return ranges::begin(__t) == ranges::end(__t);
+ }
+};
} // namespace __empty
inline namespace __cpo {
- inline constexpr auto empty = __empty::__fn{};
+inline constexpr auto empty = __empty::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/empty_view.h b/contrib/llvm-project/libcxx/include/__ranges/empty_view.h
index bb445b4e6f94..6c04b0200c35 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/empty_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/empty_view.h
@@ -25,26 +25,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class _Tp>
- requires is_object_v<_Tp>
- class empty_view : public view_interface<empty_view<_Tp>> {
- public:
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
- };
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
-
- namespace views {
-
- template <class _Tp>
- inline constexpr empty_view<_Tp> empty{};
-
- } // namespace views
+template <class _Tp>
+ requires is_object_v<_Tp>
+class empty_view : public view_interface<empty_view<_Tp>> {
+public:
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
+};
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
+
+namespace views {
+
+template <class _Tp>
+inline constexpr empty_view<_Tp> empty{};
+
+} // namespace views
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/enable_view.h b/contrib/llvm-project/libcxx/include/__ranges/enable_view.h
index 0c1dff3821ea..f570926eb67c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/enable_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/enable_view.h
@@ -27,19 +27,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-struct view_base { };
+struct view_base {};
-template<class _Derived>
+template <class _Derived>
requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>>
class view_interface;
-template<class _Op, class _Yp>
+template <class _Op, class _Yp>
requires is_convertible_v<_Op*, view_interface<_Yp>*>
void __is_derived_from_view_interface(const _Op*, const view_interface<_Yp>*);
template <class _Tp>
-inline constexpr bool enable_view = derived_from<_Tp, view_base> ||
- requires { ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr); };
+inline constexpr bool enable_view = derived_from<_Tp, view_base> || requires {
+ ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr);
+};
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/filter_view.h b/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
index 1cef94ca6744..08d50ab01104 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
@@ -49,212 +49,199 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
- class filter_view : public view_interface<filter_view<_View, _Pred>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
-
- // We cache the result of begin() to allow providing an amortized O(1) begin() whenever
- // the underlying range is at least a forward_range.
- static constexpr bool _UseCache = forward_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
-
- class __iterator;
- class __sentinel;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- filter_view() requires default_initializable<_View> && default_initializable<_Pred> = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred)
- : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
-
- template<class _Vp = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_Vp> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Pred const& pred() const { return *__pred_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator begin() {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __pred_.__has_value(),
- "Trying to call begin() on a filter_view that does not have a valid predicate.");
- if constexpr (_UseCache) {
- if (!__cached_begin_.__has_value()) {
- __cached_begin_.__emplace(ranges::find_if(__base_, std::ref(*__pred_)));
- }
- return {*this, *__cached_begin_};
- } else {
- return {*this, ranges::find_if(__base_, std::ref(*__pred_))};
+template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
+ requires view<_View> && is_object_v<_Pred>
+class filter_view : public view_interface<filter_view<_View, _Pred>> {
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+ _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
+
+ // We cache the result of begin() to allow providing an amortized O(1) begin() whenever
+ // the underlying range is at least a forward_range.
+ static constexpr bool _UseCache = forward_range<_View>;
+ using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
+
+ class __iterator;
+ class __sentinel;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI filter_view()
+ requires default_initializable<_View> && default_initializable<_Pred>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred)
+ : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
+
+ template <class _Vp = _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_Vp>
+ {
+ return __base_;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Pred const& pred() const { return *__pred_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __pred_.__has_value(), "Trying to call begin() on a filter_view that does not have a valid predicate.");
+ if constexpr (_UseCache) {
+ if (!__cached_begin_.__has_value()) {
+ __cached_begin_.__emplace(ranges::find_if(__base_, std::ref(*__pred_)));
}
+ return {*this, *__cached_begin_};
+ } else {
+ return {*this, ranges::find_if(__base_, std::ref(*__pred_))};
}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
- if constexpr (common_range<_View>)
- return __iterator{*this, ranges::end(__base_)};
- else
- return __sentinel{*this};
- }
- };
-
- template<class _Range, class _Pred>
- filter_view(_Range&&, _Pred) -> filter_view<views::all_t<_Range>, _Pred>;
-
- template<class _View>
- struct __filter_iterator_category { };
-
- template<forward_range _View>
- struct __filter_iterator_category<_View> {
- using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using iterator_category =
- _If<derived_from<_Cat, bidirectional_iterator_tag>, bidirectional_iterator_tag,
- _If<derived_from<_Cat, forward_iterator_tag>, forward_iterator_tag,
- /* else */ _Cat
- >>;
- };
-
- template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
- class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category<_View> {
-
- public:
- _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>();
- _LIBCPP_NO_UNIQUE_ADDRESS filter_view* __parent_ = nullptr;
-
- using iterator_concept =
- _If<bidirectional_range<_View>, bidirectional_iterator_tag,
- _If<forward_range<_View>, forward_iterator_tag,
- /* else */ input_iterator_tag
- >>;
- // using iterator_category = inherited;
- using value_type = range_value_t<_View>;
- using difference_type = range_difference_t<_View>;
-
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<iterator_t<_View>> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(filter_view& __parent, iterator_t<_View> __current)
- : __current_(std::move(__current)), __parent_(std::addressof(__parent))
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_View> const& base() const& noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_View> base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr range_reference_t<_View> operator*() const { return *__current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_View> operator->() const
- requires __has_arrow<iterator_t<_View>> && copyable<iterator_t<_View>>
- {
- return __current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- __current_ = ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_),
- std::ref(*__parent_->__pred_));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++*this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int) requires forward_range<_View> {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--() requires bidirectional_range<_View> {
- do {
- --__current_;
- } while (!std::invoke(*__parent_->__pred_, *__current_));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int) requires bidirectional_range<_View> {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(__iterator const& __x, __iterator const& __y)
- requires equality_comparable<iterator_t<_View>>
- {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_rvalue_reference_t<_View> iter_move(__iterator const& __it)
- noexcept(noexcept(ranges::iter_move(__it.__current_)))
- {
- return ranges::iter_move(__it.__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(__iterator const& __x, __iterator const& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
- requires indirectly_swappable<iterator_t<_View>>
- {
- return ranges::iter_swap(__x.__current_, __y.__current_);
- }
- };
-
- template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
- class filter_view<_View, _Pred>::__sentinel {
- public:
- sentinel_t<_View> __end_ = sentinel_t<_View>();
-
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(filter_view& __parent)
- : __end_(ranges::end(__parent.__base_))
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_View> base() const { return __end_; }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(__iterator const& __x, __sentinel const& __y) {
- return __x.__current_ == __y.__end_;
- }
- };
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
+ if constexpr (common_range<_View>)
+ return __iterator{*this, ranges::end(__base_)};
+ else
+ return __sentinel{*this};
+ }
+};
+
+template <class _Range, class _Pred>
+filter_view(_Range&&, _Pred) -> filter_view<views::all_t<_Range>, _Pred>;
+
+template <class _View>
+struct __filter_iterator_category {};
+
+template <forward_range _View>
+struct __filter_iterator_category<_View> {
+ using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
+ using iterator_category =
+ _If<derived_from<_Cat, bidirectional_iterator_tag>,
+ bidirectional_iterator_tag,
+ _If<derived_from<_Cat, forward_iterator_tag>,
+ forward_iterator_tag,
+ /* else */ _Cat >>;
+};
+
+template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
+ requires view<_View> && is_object_v<_Pred>
+class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category<_View> {
+public:
+ _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>();
+ _LIBCPP_NO_UNIQUE_ADDRESS filter_view* __parent_ = nullptr;
+
+ using iterator_concept =
+ _If<bidirectional_range<_View>,
+ bidirectional_iterator_tag,
+ _If<forward_range<_View>,
+ forward_iterator_tag,
+ /* else */ input_iterator_tag >>;
+ // using iterator_category = inherited;
+ using value_type = range_value_t<_View>;
+ using difference_type = range_difference_t<_View>;
+
+ _LIBCPP_HIDE_FROM_ABI __iterator()
+ requires default_initializable<iterator_t<_View>>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(filter_view& __parent, iterator_t<_View> __current)
+ : __current_(std::move(__current)), __parent_(std::addressof(__parent)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> const& base() const& noexcept { return __current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() && { return std::move(__current_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr range_reference_t<_View> operator*() const { return *__current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> operator->() const
+ requires __has_arrow<iterator_t<_View>> && copyable<iterator_t<_View>>
+ {
+ return __current_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ __current_ =
+ ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_), std::ref(*__parent_->__pred_));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires forward_range<_View>
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires bidirectional_range<_View>
+ {
+ do {
+ --__current_;
+ } while (!std::invoke(*__parent_->__pred_, *__current_));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires bidirectional_range<_View>
+ {
+ auto __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __iterator const& __y)
+ requires equality_comparable<iterator_t<_View>>
+ {
+ return __x.__current_ == __y.__current_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_View>
+ iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) {
+ return ranges::iter_move(__it.__current_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(__iterator const& __x,
+ __iterator const& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
+ requires indirectly_swappable<iterator_t<_View>>
+ {
+ return ranges::iter_swap(__x.__current_, __y.__current_);
+ }
+};
+
+template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
+ requires view<_View> && is_object_v<_Pred>
+class filter_view<_View, _Pred>::__sentinel {
+public:
+ sentinel_t<_View> __end_ = sentinel_t<_View>();
+
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(filter_view& __parent) : __end_(ranges::end(__parent.__base_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_View> base() const { return __end_; }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __sentinel const& __y) {
+ return __x.__current_ == __y.__end_;
+ }
+};
namespace views {
namespace __filter {
- struct __fn {
- template<class _Range, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
+struct __fn {
+ template <class _Range, class _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
noexcept(noexcept(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))))
- -> decltype( filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)))
- { return filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred)); }
-
- template<class _Pred>
- requires constructible_from<decay_t<_Pred>, _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Pred&& __pred) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred))); }
- };
+ -> decltype(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) {
+ return filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred));
+ }
+
+ template <class _Pred>
+ requires constructible_from<decay_t<_Pred>, _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
+ }
+};
} // namespace __filter
inline namespace __cpo {
- inline constexpr auto filter = __filter::__fn{};
+inline constexpr auto filter = __filter::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/iota_view.h b/contrib/llvm-project/libcxx/include/__ranges/iota_view.h
index ccf0c7a8e8d5..c6c9618cfe6c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/iota_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/iota_view.h
@@ -46,36 +46,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class _Int>
- struct __get_wider_signed {
- consteval static auto __call() {
- if constexpr (sizeof(_Int) < sizeof(short)) return type_identity<short>{};
- else if constexpr (sizeof(_Int) < sizeof(int)) return type_identity<int>{};
- else if constexpr (sizeof(_Int) < sizeof(long)) return type_identity<long>{};
- else return type_identity<long long>{};
-
- static_assert(sizeof(_Int) <= sizeof(long long),
- "Found integer-like type that is bigger than largest integer like type.");
- }
-
- using type = typename decltype(__call())::type;
- };
-
- template<class _Start>
- using _IotaDiffT = typename _If<
- (!integral<_Start> || sizeof(iter_difference_t<_Start>) > sizeof(_Start)),
- type_identity<iter_difference_t<_Start>>,
- __get_wider_signed<_Start>
- >::type;
-
- template<class _Iter>
- concept __decrementable = incrementable<_Iter> && requires(_Iter __i) {
- { --__i } -> same_as<_Iter&>;
- { __i-- } -> same_as<_Iter>;
- };
-
- template<class _Iter>
- concept __advanceable =
+template <class _Int>
+struct __get_wider_signed {
+ consteval static auto __call() {
+ if constexpr (sizeof(_Int) < sizeof(short))
+ return type_identity<short>{};
+ else if constexpr (sizeof(_Int) < sizeof(int))
+ return type_identity<int>{};
+ else if constexpr (sizeof(_Int) < sizeof(long))
+ return type_identity<long>{};
+ else
+ return type_identity<long long>{};
+
+ static_assert(
+ sizeof(_Int) <= sizeof(long long), "Found integer-like type that is bigger than largest integer like type.");
+ }
+
+ using type = typename decltype(__call())::type;
+};
+
+template <class _Start>
+using _IotaDiffT =
+ typename _If< (!integral<_Start> || sizeof(iter_difference_t<_Start>) > sizeof(_Start)),
+ type_identity<iter_difference_t<_Start>>,
+ __get_wider_signed<_Start> >::type;
+
+template <class _Iter>
+concept __decrementable = incrementable<_Iter> && requires(_Iter __i) {
+ { --__i } -> same_as<_Iter&>;
+ { __i-- } -> same_as<_Iter>;
+};
+
+template <class _Iter>
+concept __advanceable =
__decrementable<_Iter> && totally_ordered<_Iter> &&
requires(_Iter __i, const _Iter __j, const _IotaDiffT<_Iter> __n) {
{ __i += __n } -> same_as<_Iter&>;
@@ -86,322 +89,304 @@ namespace ranges {
{ __j - __j } -> convertible_to<_IotaDiffT<_Iter>>;
};
- template<class>
- struct __iota_iterator_category {};
+template <class>
+struct __iota_iterator_category {};
- template<incrementable _Tp>
- struct __iota_iterator_category<_Tp> {
- using iterator_category = input_iterator_tag;
- };
+template <incrementable _Tp>
+struct __iota_iterator_category<_Tp> {
+ using iterator_category = input_iterator_tag;
+};
- template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t>
- requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start>
- class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
- struct __iterator : public __iota_iterator_category<_Start> {
- friend class iota_view;
+template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t>
+ requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start>
+class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
+ struct __iterator : public __iota_iterator_category<_Start> {
+ friend class iota_view;
- using iterator_concept =
- _If<__advanceable<_Start>, random_access_iterator_tag,
- _If<__decrementable<_Start>, bidirectional_iterator_tag,
- _If<incrementable<_Start>, forward_iterator_tag,
- /*Else*/ input_iterator_tag>>>;
+ using iterator_concept =
+ _If<__advanceable<_Start>,
+ random_access_iterator_tag,
+ _If<__decrementable<_Start>,
+ bidirectional_iterator_tag,
+ _If<incrementable<_Start>,
+ forward_iterator_tag,
+ /*Else*/ input_iterator_tag>>>;
- using value_type = _Start;
- using difference_type = _IotaDiffT<_Start>;
+ using value_type = _Start;
+ using difference_type = _IotaDiffT<_Start>;
- _Start __value_ = _Start();
+ _Start __value_ = _Start();
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<_Start> = default;
+ _LIBCPP_HIDE_FROM_ABI __iterator()
+ requires default_initializable<_Start>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) {
- return __value_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) {
+ return __value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- ++__value_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ ++__value_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++*this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int) requires incrementable<_Start> {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires incrementable<_Start>
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--() requires __decrementable<_Start> {
- --__value_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires __decrementable<_Start>
+ {
+ --__value_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int) requires __decrementable<_Start> {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires __decrementable<_Start>
+ {
+ auto __tmp = *this;
+ --*this;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ += static_cast<_Start>(__n);
- } else {
- __value_ -= static_cast<_Start>(-__n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
+ requires __advanceable<_Start>
+ {
+ if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
+ if (__n >= difference_type(0)) {
+ __value_ += static_cast<_Start>(__n);
} else {
- __value_ += __n;
+ __value_ -= static_cast<_Start>(-__n);
}
- return *this;
+ } else {
+ __value_ += __n;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ -= static_cast<_Start>(__n);
- } else {
- __value_ += static_cast<_Start>(-__n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
+ requires __advanceable<_Start>
+ {
+ if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
+ if (__n >= difference_type(0)) {
+ __value_ -= static_cast<_Start>(__n);
} else {
- __value_ -= __n;
+ __value_ += static_cast<_Start>(-__n);
}
- return *this;
+ } else {
+ __value_ -= __n;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Start operator[](difference_type __n) const
- requires __advanceable<_Start>
- {
- return _Start(__value_ + __n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Start operator[](difference_type __n) const
+ requires __advanceable<_Start>
+ {
+ return _Start(__value_ + __n);
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires equality_comparable<_Start>
- {
- return __x.__value_ == __y.__value_;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ requires equality_comparable<_Start>
+ {
+ return __x.__value_ == __y.__value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __x.__value_ < __y.__value_;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return __x.__value_ < __y.__value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __y < __x;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return __y < __x;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__y < __x);
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return !(__y < __x);
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__x < __y);
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start>
+ {
+ return !(__x < __y);
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start> && three_way_comparable<_Start>
- {
- return __x.__value_ <=> __y.__value_;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
+ requires totally_ordered<_Start> && three_way_comparable<_Start>
+ {
+ return __x.__value_ <=> __y.__value_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i += __n;
- return __i;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
+ requires __advanceable<_Start>
+ {
+ __i += __n;
+ return __i;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, __iterator __i)
- requires __advanceable<_Start>
- {
- return __i + __n;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
+ requires __advanceable<_Start>
+ {
+ return __i + __n;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i -= __n;
- return __i;
- }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
+ requires __advanceable<_Start>
+ {
+ __i -= __n;
+ return __i;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start>) {
- if constexpr (__signed_integer_like<_Start>) {
- return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_));
- }
- if (__y.__value_ > __x.__value_) {
- return difference_type(-difference_type(__y.__value_ - __x.__value_));
- }
- return difference_type(__x.__value_ - __y.__value_);
+ _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
+ requires __advanceable<_Start>
+ {
+ if constexpr (__integer_like<_Start>) {
+ if constexpr (__signed_integer_like<_Start>) {
+ return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_));
}
- return __x.__value_ - __y.__value_;
- }
- };
-
- struct __sentinel {
- friend class iota_view;
-
- private:
- _BoundSentinel __bound_sentinel_ = _BoundSentinel();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_BoundSentinel __bound_sentinel)
- : __bound_sentinel_(std::move(__bound_sentinel)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
- return __x.__value_ == __y.__bound_sentinel_;
+ if (__y.__value_ > __x.__value_) {
+ return difference_type(-difference_type(__y.__value_ - __x.__value_));
+ }
+ return difference_type(__x.__value_ - __y.__value_);
}
+ return __x.__value_ - __y.__value_;
+ }
+ };
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y)
- requires sized_sentinel_for<_BoundSentinel, _Start>
- {
- return __x.__value_ - __y.__bound_sentinel_;
- }
+ struct __sentinel {
+ friend class iota_view;
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y)
- requires sized_sentinel_for<_BoundSentinel, _Start>
- {
- return -(__y - __x);
- }
- };
-
- _Start __value_ = _Start();
+ private:
_BoundSentinel __bound_sentinel_ = _BoundSentinel();
public:
- _LIBCPP_HIDE_FROM_ABI
- iota_view() requires default_initializable<_Start> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
- : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
- // Validate the precondition if possible.
- if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
- _LIBCPP_ASSERT_UNCATEGORIZED(ranges::less_equal()(__value_, __bound_sentinel_),
- "Precondition violated: value is greater than bound.");
- }
- }
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_BoundSentinel __bound_sentinel)
+ : __bound_sentinel_(std::move(__bound_sentinel)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last)
- requires same_as<_Start, _BoundSentinel>
- : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last)
- requires same_as<_BoundSentinel, unreachable_sentinel_t>
- : iota_view(std::move(__first.__value_), std::move(__last)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
- requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
- : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator begin() const { return __iterator{__value_}; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const {
- if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>)
- return unreachable_sentinel;
- else
- return __sentinel{__bound_sentinel_};
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
+ return __x.__value_ == __y.__bound_sentinel_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator end() const
- requires same_as<_Start, _BoundSentinel>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
+ operator-(const __iterator& __x, const __sentinel& __y)
+ requires sized_sentinel_for<_BoundSentinel, _Start>
{
- return __iterator{__bound_sentinel_};
+ return __x.__value_ - __y.__bound_sentinel_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
- (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
+ operator-(const __sentinel& __x, const __iterator& __y)
+ requires sized_sentinel_for<_BoundSentinel, _Start>
{
- if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) {
- return (__value_ < 0)
- ? ((__bound_sentinel_ < 0)
- ? std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_sentinel_)
- : std::__to_unsigned_like(__bound_sentinel_) + std::__to_unsigned_like(-__value_))
- : std::__to_unsigned_like(__bound_sentinel_) - std::__to_unsigned_like(__value_);
- } else {
- return std::__to_unsigned_like(__bound_sentinel_ - __value_);
- }
+ return -(__y - __x);
}
};
- template <class _Start, class _BoundSentinel>
- requires(!__integer_like<_Start> || !__integer_like<_BoundSentinel> ||
- (__signed_integer_like<_Start> == __signed_integer_like<_BoundSentinel>))
- iota_view(_Start, _BoundSentinel) -> iota_view<_Start, _BoundSentinel>;
+ _Start __value_ = _Start();
+ _BoundSentinel __bound_sentinel_ = _BoundSentinel();
- template <class _Start, class _BoundSentinel>
- inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true;
-
- namespace views {
- namespace __iota {
- struct __fn {
- template<class _Start>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Start&& __start) const
+public:
+ _LIBCPP_HIDE_FROM_ABI iota_view()
+ requires default_initializable<_Start>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+ iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
+ : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
+ // Validate the precondition if possible.
+ if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ ranges::less_equal()(__value_, __bound_sentinel_), "Precondition violated: value is greater than bound.");
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last)
+ requires same_as<_Start, _BoundSentinel>
+ : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last)
+ requires same_as<_BoundSentinel, unreachable_sentinel_t>
+ : iota_view(std::move(__first.__value_), std::move(__last)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
+ requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
+ : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__value_}; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
+ if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>)
+ return unreachable_sentinel;
+ else
+ return __sentinel{__bound_sentinel_};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
+ requires same_as<_Start, _BoundSentinel>
+ {
+ return __iterator{__bound_sentinel_};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
+ (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
+ {
+ if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) {
+ return (__value_ < 0)
+ ? ((__bound_sentinel_ < 0)
+ ? std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_sentinel_)
+ : std::__to_unsigned_like(__bound_sentinel_) + std::__to_unsigned_like(-__value_))
+ : std::__to_unsigned_like(__bound_sentinel_) - std::__to_unsigned_like(__value_);
+ } else {
+ return std::__to_unsigned_like(__bound_sentinel_ - __value_);
+ }
+ }
+};
+
+template <class _Start, class _BoundSentinel>
+ requires(!__integer_like<_Start> || !__integer_like<_BoundSentinel> ||
+ (__signed_integer_like<_Start> == __signed_integer_like<_BoundSentinel>))
+iota_view(_Start, _BoundSentinel) -> iota_view<_Start, _BoundSentinel>;
+
+template <class _Start, class _BoundSentinel>
+inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true;
+
+namespace views {
+namespace __iota {
+struct __fn {
+ template <class _Start>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start) const
noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start))))
- -> decltype( ranges::iota_view(std::forward<_Start>(__start)))
- { return ranges::iota_view(std::forward<_Start>(__start)); }
-
- template <class _Start, class _BoundSentinel>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const
- noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))))
- -> decltype( ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)))
- { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)); }
- };
+ -> decltype(ranges::iota_view(std::forward<_Start>(__start))) {
+ return ranges::iota_view(std::forward<_Start>(__start));
+ }
+
+ template <class _Start, class _BoundSentinel>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const noexcept(
+ noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))))
+ -> decltype(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))) {
+ return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel));
+ }
+};
} // namespace __iota
inline namespace __cpo {
- inline constexpr auto iota = __iota::__fn{};
+inline constexpr auto iota = __iota::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/istream_view.h b/contrib/llvm-project/libcxx/include/__ranges/istream_view.h
index 71af102c3320..cd7096d35c2c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/istream_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/istream_view.h
@@ -66,8 +66,7 @@ public:
using difference_type = ptrdiff_t;
using value_type = _Val;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(
- basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept
: __parent_(std::addressof(__parent)) {}
__iterator(const __iterator&) = delete;
diff --git a/contrib/llvm-project/libcxx/include/__ranges/join_view.h b/contrib/llvm-project/libcxx/include/__ranges/join_view.h
index f80beda33b11..22473059133f 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/join_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/join_view.h
@@ -46,389 +46,334 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class>
- struct __join_view_iterator_category {};
-
- template<class _View>
- requires is_reference_v<range_reference_t<_View>> &&
- forward_range<_View> &&
- forward_range<range_reference_t<_View>>
- struct __join_view_iterator_category<_View> {
- using _OuterC = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using _InnerC = typename iterator_traits<iterator_t<range_reference_t<_View>>>::iterator_category;
-
- using iterator_category = _If<
- derived_from<_OuterC, bidirectional_iterator_tag> && derived_from<_InnerC, bidirectional_iterator_tag> &&
- common_range<range_reference_t<_View>>,
- bidirectional_iterator_tag,
- _If<
- derived_from<_OuterC, forward_iterator_tag> && derived_from<_InnerC, forward_iterator_tag>,
- forward_iterator_tag,
- input_iterator_tag
- >
- >;
- };
-
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- class join_view
- : public view_interface<join_view<_View>> {
- private:
- using _InnerRange = range_reference_t<_View>;
-
- template<bool> struct __iterator;
-
- template<bool> struct __sentinel;
-
- template <class>
- friend struct std::__segmented_iterator_traits;
-
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
- static constexpr bool _UseOuterCache = !forward_range<_View>;
- using _OuterCache = _If<_UseOuterCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _OuterCache __outer_;
-
- static constexpr bool _UseInnerCache = !is_reference_v<_InnerRange>;
- using _InnerCache = _If<_UseInnerCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _InnerCache __inner_;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- join_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit join_view(_View __base)
- : __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
- if constexpr (forward_range<_View>) {
- constexpr bool __use_const = __simple_view<_View> &&
- is_reference_v<range_reference_t<_View>>;
- return __iterator<__use_const>{*this, ranges::begin(__base_)};
- } else {
- __outer_.__emplace(ranges::begin(__base_));
- return __iterator<false>{*this};
- }
- }
+template <class>
+struct __join_view_iterator_category {};
+
+template <class _View>
+ requires is_reference_v<range_reference_t<_View>> && forward_range<_View> && forward_range<range_reference_t<_View>>
+struct __join_view_iterator_category<_View> {
+ using _OuterC = typename iterator_traits<iterator_t<_View>>::iterator_category;
+ using _InnerC = typename iterator_traits<iterator_t<range_reference_t<_View>>>::iterator_category;
+
+ using iterator_category =
+ _If< derived_from<_OuterC, bidirectional_iterator_tag> && derived_from<_InnerC, bidirectional_iterator_tag> &&
+ common_range<range_reference_t<_View>>,
+ bidirectional_iterator_tag,
+ _If< derived_from<_OuterC, forward_iterator_tag> && derived_from<_InnerC, forward_iterator_tag>,
+ forward_iterator_tag,
+ input_iterator_tag > >;
+};
- template<class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires forward_range<const _V2> &&
- is_reference_v<range_reference_t<const _V2>> &&
- input_range<range_reference_t<const _V2>>
- {
- return __iterator<true>{*this, ranges::begin(__base_)};
- }
+template <input_range _View>
+ requires view<_View> && input_range<range_reference_t<_View>>
+class join_view : public view_interface<join_view<_View>> {
+private:
+ using _InnerRange = range_reference_t<_View>;
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() {
- if constexpr (forward_range<_View> &&
- is_reference_v<_InnerRange> &&
- forward_range<_InnerRange> &&
- common_range<_View> &&
- common_range<_InnerRange>)
- return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)};
- else
- return __sentinel<__simple_view<_View>>{*this};
+ template <bool>
+ struct __iterator;
+
+ template <bool>
+ struct __sentinel;
+
+ template <class>
+ friend struct std::__segmented_iterator_traits;
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+
+ static constexpr bool _UseOuterCache = !forward_range<_View>;
+ using _OuterCache = _If<_UseOuterCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _OuterCache __outer_;
+
+ static constexpr bool _UseInnerCache = !is_reference_v<_InnerRange>;
+ using _InnerCache = _If<_UseInnerCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _InnerCache __inner_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI join_view()
+ requires default_initializable<_View>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
+ if constexpr (forward_range<_View>) {
+ constexpr bool __use_const = __simple_view<_View> && is_reference_v<range_reference_t<_View>>;
+ return __iterator<__use_const>{*this, ranges::begin(__base_)};
+ } else {
+ __outer_.__emplace(ranges::begin(__base_));
+ return __iterator<false>{*this};
}
+ }
+
+ template <class _V2 = _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
+ input_range<range_reference_t<const _V2>>
+ {
+ return __iterator<true>{*this, ranges::begin(__base_)};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
+ if constexpr (forward_range<_View> && is_reference_v<_InnerRange> && forward_range<_InnerRange> &&
+ common_range<_View> && common_range<_InnerRange>)
+ return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)};
+ else
+ return __sentinel<__simple_view<_View>>{*this};
+ }
- template<class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires forward_range<const _V2> &&
- is_reference_v<range_reference_t<const _V2>> &&
- input_range<range_reference_t<const _V2>>
- {
- using _ConstInnerRange = range_reference_t<const _View>;
- if constexpr (forward_range<_ConstInnerRange> &&
- common_range<const _View> &&
- common_range<_ConstInnerRange>) {
- return __iterator<true>{*this, ranges::end(__base_)};
- } else {
- return __sentinel<true>{*this};
- }
+ template <class _V2 = _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
+ input_range<range_reference_t<const _V2>>
+ {
+ using _ConstInnerRange = range_reference_t<const _View>;
+ if constexpr (forward_range<_ConstInnerRange> && common_range<const _View> && common_range<_ConstInnerRange>) {
+ return __iterator<true>{*this, ranges::end(__base_)};
+ } else {
+ return __sentinel<true>{*this};
}
- };
-
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- template<bool _Const>
- struct join_view<_View>::__sentinel {
- private:
- template <bool>
- friend struct __sentinel;
-
- using _Parent = __maybe_const<_Const, join_view>;
- using _Base = __maybe_const<_Const, _View>;
- sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(_Parent& __parent)
- : __end_(ranges::end(__parent.__base_)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __s)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
+ }
+};
+
+template <input_range _View>
+ requires view<_View> && input_range<range_reference_t<_View>>
+template <bool _Const>
+struct join_view<_View>::__sentinel {
+private:
+ template <bool>
+ friend struct __sentinel;
+
+ using _Parent = __maybe_const<_Const, join_view>;
+ using _Base = __maybe_const<_Const, _View>;
+ sentinel_t<_Base> __end_ = sentinel_t<_Base>();
+
+public:
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_Parent& __parent) : __end_(ranges::end(__parent.__base_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s)
+ requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
: __end_(std::move(__s.__end_)) {}
- template<bool _OtherConst>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__get_outer() == __y.__end_;
- }
- };
-
- // https://reviews.llvm.org/D142811#inline-1383022
- // To simplify the segmented iterator traits specialization,
- // make the iterator `final`
- template<input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
- template<bool _Const>
- struct join_view<_View>::__iterator final
- : public __join_view_iterator_category<__maybe_const<_Const, _View>> {
- friend join_view;
-
- template <class>
- friend struct std::__segmented_iterator_traits;
-
- static constexpr bool __is_join_view_iterator = true;
-
- private:
- using _Parent = __maybe_const<_Const, join_view<_View>>;
- using _Base = __maybe_const<_Const, _View>;
- using _Outer = iterator_t<_Base>;
- using _Inner = iterator_t<range_reference_t<_Base>>;
- using _InnerRange = range_reference_t<_View>;
-
- static_assert(!_Const || forward_range<_Base>, "Const can only be true when Base models forward_range.");
-
- static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>;
-
- static constexpr bool _OuterPresent = forward_range<_Base>;
- using _OuterType = _If<_OuterPresent, _Outer, std::__empty>;
- _LIBCPP_NO_UNIQUE_ADDRESS _OuterType __outer_ = _OuterType();
-
- optional<_Inner> __inner_;
- _Parent* __parent_ = nullptr;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr void __satisfy() {
- for (; __get_outer() != ranges::end(__parent_->__base_); ++__get_outer()) {
- auto&& __inner = [this]() -> auto&& {
- if constexpr (__ref_is_glvalue)
- return *__get_outer();
- else
- return __parent_->__inner_.__emplace_from([&]() -> decltype(auto) { return *__get_outer(); });
- }();
- __inner_ = ranges::begin(__inner);
- if (*__inner_ != ranges::end(__inner))
- return;
- }
+ template <bool _OtherConst>
+ requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
+ return __x.__get_outer() == __y.__end_;
+ }
+};
- if constexpr (__ref_is_glvalue)
- __inner_.reset();
- }
+// https://reviews.llvm.org/D142811#inline-1383022
+// To simplify the segmented iterator traits specialization,
+// make the iterator `final`
+template <input_range _View>
+ requires view<_View> && input_range<range_reference_t<_View>>
+template <bool _Const>
+struct join_view<_View>::__iterator final : public __join_view_iterator_category<__maybe_const<_Const, _View>> {
+ friend join_view;
- _LIBCPP_HIDE_FROM_ABI constexpr _Outer& __get_outer() {
- if constexpr (forward_range<_Base>) {
- return __outer_;
- } else {
- return *__parent_->__outer_;
- }
- }
+ template <class>
+ friend struct std::__segmented_iterator_traits;
- _LIBCPP_HIDE_FROM_ABI constexpr const _Outer& __get_outer() const {
- if constexpr (forward_range<_Base>) {
- return __outer_;
- } else {
- return *__parent_->__outer_;
- }
- }
+ static constexpr bool __is_join_view_iterator = true;
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer)
- requires forward_range<_Base>
- : __outer_(std::move(__outer)), __parent_(std::addressof(__parent)) {
- __satisfy();
- }
+private:
+ using _Parent = __maybe_const<_Const, join_view<_View>>;
+ using _Base = __maybe_const<_Const, _View>;
+ using _Outer = iterator_t<_Base>;
+ using _Inner = iterator_t<range_reference_t<_Base>>;
+ using _InnerRange = range_reference_t<_View>;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Parent& __parent)
- requires(!forward_range<_Base>)
- : __parent_(std::addressof(__parent)) {
- __satisfy();
- }
+ static_assert(!_Const || forward_range<_Base>, "Const can only be true when Base models forward_range.");
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner)
- requires forward_range<_Base>
- : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {}
-
- public:
- using iterator_concept = _If<
- __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>,
- bidirectional_iterator_tag,
- _If<
- __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>,
- forward_iterator_tag,
- input_iterator_tag
- >
- >;
-
- using value_type = range_value_t<range_reference_t<_Base>>;
-
- using difference_type = common_type_t<
- range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
- requires _Const &&
- convertible_to<iterator_t<_View>, _Outer> &&
- convertible_to<iterator_t<_InnerRange>, _Inner>
- : __outer_(std::move(__i.__outer_))
- , __inner_(std::move(__i.__inner_))
- , __parent_(__i.__parent_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const {
- return **__inner_;
- }
+ static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>;
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Inner operator->() const
- requires __has_arrow<_Inner> && copyable<_Inner>
- {
- return *__inner_;
- }
+ static constexpr bool _OuterPresent = forward_range<_Base>;
+ using _OuterType = _If<_OuterPresent, _Outer, std::__empty>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _OuterType __outer_ = _OuterType();
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
- auto __get_inner_range = [&]() -> decltype(auto) {
+ optional<_Inner> __inner_;
+ _Parent* __parent_ = nullptr;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __satisfy() {
+ for (; __get_outer() != ranges::end(__parent_->__base_); ++__get_outer()) {
+ auto&& __inner = [this]() -> auto&& {
if constexpr (__ref_is_glvalue)
return *__get_outer();
else
- return *__parent_->__inner_;
- };
- if (++*__inner_ == ranges::end(std::__as_lvalue(__get_inner_range()))) {
- ++__get_outer();
- __satisfy();
- }
- return *this;
+ return __parent_->__inner_.__emplace_from([&]() -> decltype(auto) { return *__get_outer(); });
+ }();
+ __inner_ = ranges::begin(__inner);
+ if (*__inner_ != ranges::end(__inner))
+ return;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) {
- ++*this;
- }
+ if constexpr (__ref_is_glvalue)
+ __inner_.reset();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
- requires __ref_is_glvalue &&
- forward_range<_Base> &&
- forward_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
+ _LIBCPP_HIDE_FROM_ABI constexpr _Outer& __get_outer() {
+ if constexpr (forward_range<_Base>) {
+ return __outer_;
+ } else {
+ return *__parent_->__outer_;
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
- requires __ref_is_glvalue &&
- bidirectional_range<_Base> &&
- bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- if (__outer_ == ranges::end(__parent_->__base_))
- __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
-
- // Skip empty inner ranges when going backwards.
- while (*__inner_ == ranges::begin(std::__as_lvalue(*__outer_))) {
- __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
- }
-
- --*__inner_;
- return *this;
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Outer& __get_outer() const {
+ if constexpr (forward_range<_Base>) {
+ return __outer_;
+ } else {
+ return *__parent_->__outer_;
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
- requires __ref_is_glvalue &&
- bidirectional_range<_Base> &&
- bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer)
+ requires forward_range<_Base>
+ : __outer_(std::move(__outer)), __parent_(std::addressof(__parent)) {
+ __satisfy();
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires __ref_is_glvalue &&
- forward_range<_Base> &&
- equality_comparable<iterator_t<range_reference_t<_Base>>>
- {
- return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Parent& __parent)
+ requires(!forward_range<_Base>)
+ : __parent_(std::addressof(__parent)) {
+ __satisfy();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner)
+ requires forward_range<_Base>
+ : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __iterator& __i)
- noexcept(noexcept(ranges::iter_move(*__i.__inner_)))
- {
- return ranges::iter_move(*__i.__inner_);
+public:
+ using iterator_concept =
+ _If< __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
+ common_range<range_reference_t<_Base>>,
+ bidirectional_iterator_tag,
+ _If< __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>,
+ forward_iterator_tag,
+ input_iterator_tag > >;
+
+ using value_type = range_value_t<range_reference_t<_Base>>;
+
+ using difference_type = common_type_t< range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>;
+
+ _LIBCPP_HIDE_FROM_ABI __iterator() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
+ requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner>
+ : __outer_(std::move(__i.__outer_)), __inner_(std::move(__i.__inner_)), __parent_(__i.__parent_) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Inner operator->() const
+ requires __has_arrow<_Inner> && copyable<_Inner>
+ {
+ return *__inner_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ auto __get_inner_range = [&]() -> decltype(auto) {
+ if constexpr (__ref_is_glvalue)
+ return *__get_outer();
+ else
+ return *__parent_->__inner_;
+ };
+ if (++*__inner_ == ranges::end(std::__as_lvalue(__get_inner_range()))) {
+ ++__get_outer();
+ __satisfy();
}
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y)
- noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_)))
- requires indirectly_swappable<_Inner>
- {
- return ranges::iter_swap(*__x.__inner_, *__y.__inner_);
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
+ common_range<range_reference_t<_Base>>
+ {
+ if (__outer_ == ranges::end(__parent_->__base_))
+ __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
+
+ // Skip empty inner ranges when going backwards.
+ while (*__inner_ == ranges::begin(std::__as_lvalue(*__outer_))) {
+ __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
}
- };
- template<class _Range>
- explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>;
+ --*__inner_;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
+ common_range<range_reference_t<_Base>>
+ {
+ auto __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ requires __ref_is_glvalue && forward_range<_Base> && equality_comparable<iterator_t<range_reference_t<_Base>>>
+ {
+ return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
+ iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) {
+ return ranges::iter_move(*__i.__inner_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void
+ iter_swap(const __iterator& __x,
+ const __iterator& __y) noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_)))
+ requires indirectly_swappable<_Inner>
+ {
+ return ranges::iter_swap(*__x.__inner_, *__y.__inner_);
+ }
+};
+
+template <class _Range>
+explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>;
namespace views {
namespace __join_view {
struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))))
- -> decltype( join_view<all_t<_Range&&>>(std::forward<_Range>(__range)))
- { return join_view<all_t<_Range&&>>(std::forward<_Range>(__range)); }
+ template <class _Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))))
+ -> decltype(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))) {
+ return join_view<all_t<_Range&&>>(std::forward<_Range>(__range));
+ }
};
} // namespace __join_view
inline namespace __cpo {
- inline constexpr auto join = __join_view::__fn{};
+inline constexpr auto join = __join_view::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
template <class _JoinViewIterator>
- requires(_JoinViewIterator::__is_join_view_iterator &&
- ranges::common_range<typename _JoinViewIterator::_Parent> &&
+ requires(_JoinViewIterator::__is_join_view_iterator && ranges::common_range<typename _JoinViewIterator::_Parent> &&
__has_random_access_iterator_category<typename _JoinViewIterator::_Outer>::value &&
__has_random_access_iterator_category<typename _JoinViewIterator::_Inner>::value)
struct __segmented_iterator_traits<_JoinViewIterator> {
-
using __segment_iterator =
_LIBCPP_NODEBUG __iterator_with_data<typename _JoinViewIterator::_Outer, typename _JoinViewIterator::_Parent*>;
using __local_iterator = typename _JoinViewIterator::_Inner;
@@ -436,33 +381,33 @@ struct __segmented_iterator_traits<_JoinViewIterator> {
// TODO: Would it make sense to enable the optimization for other iterator types?
static constexpr _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_JoinViewIterator __iter) {
- if (ranges::empty(__iter.__parent_->__base_))
- return {};
- if (!__iter.__inner_.has_value())
- return __segment_iterator(--__iter.__outer_, __iter.__parent_);
- return __segment_iterator(__iter.__outer_, __iter.__parent_);
+ if (ranges::empty(__iter.__parent_->__base_))
+ return {};
+ if (!__iter.__inner_.has_value())
+ return __segment_iterator(--__iter.__outer_, __iter.__parent_);
+ return __segment_iterator(__iter.__outer_, __iter.__parent_);
}
static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_JoinViewIterator __iter) {
- if (ranges::empty(__iter.__parent_->__base_))
- return {};
- if (!__iter.__inner_.has_value())
- return ranges::end(*--__iter.__outer_);
- return *__iter.__inner_;
+ if (ranges::empty(__iter.__parent_->__base_))
+ return {};
+ if (!__iter.__inner_.has_value())
+ return ranges::end(*--__iter.__outer_);
+ return *__iter.__inner_;
}
static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) {
- return ranges::begin(*__iter.__get_iter());
+ return ranges::begin(*__iter.__get_iter());
}
static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) {
- return ranges::end(*__iter.__get_iter());
+ return ranges::end(*__iter.__get_iter());
}
static constexpr _LIBCPP_HIDE_FROM_ABI _JoinViewIterator
__compose(__segment_iterator __seg_iter, __local_iterator __local_iter) {
- return _JoinViewIterator(
- std::move(__seg_iter).__get_data(), std::move(__seg_iter).__get_iter(), std::move(__local_iter));
+ return _JoinViewIterator(
+ std::move(__seg_iter).__get_data(), std::move(__seg_iter).__get_iter(), std::move(__local_iter));
}
};
diff --git a/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h b/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h
index 8ed4bcfdeb56..e96398b14b58 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/lazy_split_view.h
@@ -53,73 +53,73 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template <auto> struct __require_constant;
+template <auto>
+struct __require_constant;
template <class _Range>
-concept __tiny_range =
- sized_range<_Range> &&
- requires { typename __require_constant<remove_reference_t<_Range>::size()>; } &&
- (remove_reference_t<_Range>::size() <= 1);
+concept __tiny_range = sized_range<_Range> && requires {
+ typename __require_constant<remove_reference_t<_Range>::size()>;
+} && (remove_reference_t<_Range>::size() <= 1);
template <input_range _View, forward_range _Pattern>
requires view<_View> && view<_Pattern> &&
indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to> &&
(forward_range<_View> || __tiny_range<_Pattern>)
class lazy_split_view : public view_interface<lazy_split_view<_View, _Pattern>> {
-
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
_LIBCPP_NO_UNIQUE_ADDRESS _Pattern __pattern_ = _Pattern();
using _MaybeCurrent = _If<!forward_range<_View>, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
_LIBCPP_NO_UNIQUE_ADDRESS _MaybeCurrent __current_ = _MaybeCurrent();
- template <bool> struct __outer_iterator;
- template <bool> struct __inner_iterator;
+ template <bool>
+ struct __outer_iterator;
+ template <bool>
+ struct __inner_iterator;
public:
- _LIBCPP_HIDE_FROM_ABI
- lazy_split_view()
- requires default_initializable<_View> && default_initializable<_Pattern> = default;
+ _LIBCPP_HIDE_FROM_ABI lazy_split_view()
+ requires default_initializable<_View> && default_initializable<_Pattern>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern)
- : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern)
+ : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {}
template <input_range _Range>
requires constructible_from<_View, views::all_t<_Range>> &&
- constructible_from<_Pattern, single_view<range_value_t<_Range>>>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
- : __base_(views::all(std::forward<_Range>(__r)))
- , __pattern_(views::single(std::move(__e))) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() {
+ constructible_from<_Pattern, single_view<range_value_t<_Range>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
+ : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
if constexpr (forward_range<_View>) {
- return __outer_iterator<__simple_view<_View> && __simple_view<_Pattern>>{*this, ranges::begin(__base_)};
+ return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::begin(__base_)};
} else {
__current_.__emplace(ranges::begin(__base_));
return __outer_iterator<false>{*this};
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires forward_range<_View> && forward_range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires forward_range<_View> && forward_range<const _View>
+ {
return __outer_iterator<true>{*this, ranges::begin(__base_)};
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() requires forward_range<_View> && common_range<_View> {
- return __outer_iterator<__simple_view<_View> && __simple_view<_Pattern>>{*this, ranges::end(__base_)};
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires forward_range<_View> && common_range<_View>
+ {
+ return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::end(__base_)};
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
if constexpr (forward_range<_View> && forward_range<const _View> && common_range<const _View>) {
return __outer_iterator<true>{*this, ranges::end(__base_)};
} else {
@@ -128,7 +128,6 @@ public:
}
private:
-
template <class>
struct __outer_iterator_category {};
@@ -145,15 +144,14 @@ private:
friend __outer_iterator<true>;
using _Parent = __maybe_const<_Const, lazy_split_view>;
- using _Base = __maybe_const<_Const, _View>;
+ using _Base = __maybe_const<_Const, _View>;
- _Parent* __parent_ = nullptr;
- using _MaybeCurrent = _If<forward_range<_View>, iterator_t<_Base>, __empty_cache>;
+ _Parent* __parent_ = nullptr;
+ using _MaybeCurrent = _If<forward_range<_View>, iterator_t<_Base>, __empty_cache>;
_LIBCPP_NO_UNIQUE_ADDRESS _MaybeCurrent __current_ = _MaybeCurrent();
- bool __trailing_empty_ = false;
+ bool __trailing_empty_ = false;
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto& __current() noexcept {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __current() noexcept {
if constexpr (forward_range<_View>) {
return __current_;
} else {
@@ -161,8 +159,7 @@ private:
}
}
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr const auto& __current() const noexcept {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __current() const noexcept {
if constexpr (forward_range<_View>) {
return __current_;
} else {
@@ -172,56 +169,42 @@ private:
// Workaround for the GCC issue that doesn't allow calling `__parent_->__base_` from friend functions (because
// `__base_` is private).
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto& __parent_base() const noexcept {
- return __parent_->__base_;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __parent_base() const noexcept { return __parent_->__base_; }
public:
// using iterator_category = inherited;
using iterator_concept = conditional_t<forward_range<_Base>, forward_iterator_tag, input_iterator_tag>;
- using difference_type = range_difference_t<_Base>;
+ using difference_type = range_difference_t<_Base>;
struct value_type : view_interface<value_type> {
private:
__outer_iterator __i_ = __outer_iterator();
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit value_type(__outer_iterator __i)
- : __i_(std::move(__i)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
+ _LIBCPP_HIDE_FROM_ABI value_type() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
};
- _LIBCPP_HIDE_FROM_ABI
- __outer_iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI __outer_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __outer_iterator(_Parent& __parent)
- requires (!forward_range<_Base>)
- : __parent_(std::addressof(__parent)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __outer_iterator(_Parent& __parent)
+ requires(!forward_range<_Base>)
+ : __parent_(std::addressof(__parent)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __outer_iterator(_Parent& __parent, iterator_t<_Base> __current)
+ _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(_Parent& __parent, iterator_t<_Base> __current)
requires forward_range<_Base>
- : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
+ : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __outer_iterator(__outer_iterator<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(__outer_iterator<!_Const> __i)
requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
+ : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type operator*() const { return value_type{*this}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __outer_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator& operator++() {
const auto __end = ranges::end(__parent_->__base_);
if (__current() == __end) {
__trailing_empty_ = false;
@@ -260,8 +243,7 @@ private:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
if constexpr (forward_range<_Base>) {
auto __tmp = *this;
++*this;
@@ -272,14 +254,13 @@ private:
}
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __outer_iterator& __x, const __outer_iterator& __y)
- requires forward_range<_Base> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, const __outer_iterator& __y)
+ requires forward_range<_Base>
+ {
return __x.__current_ == __y.__current_ && __x.__trailing_empty_ == __y.__trailing_empty_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) {
_LIBCPP_ASSERT_NON_NULL(__x.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator.");
return __x.__current() == ranges::end(__x.__parent_base()) && !__x.__trailing_empty_;
}
@@ -290,11 +271,10 @@ private:
template <forward_range _Tp>
struct __inner_iterator_category<_Tp> {
- using iterator_category = _If<
- derived_from<typename iterator_traits<iterator_t<_Tp>>::iterator_category, forward_iterator_tag>,
- forward_iterator_tag,
- typename iterator_traits<iterator_t<_Tp>>::iterator_category
- >;
+ using iterator_category =
+ _If< derived_from<typename iterator_traits<iterator_t<_Tp>>::iterator_category, forward_iterator_tag>,
+ forward_iterator_tag,
+ typename iterator_traits<iterator_t<_Tp>>::iterator_category >;
};
template <bool _Const>
@@ -303,18 +283,17 @@ private:
using _Base = __maybe_const<_Const, _View>;
// Workaround for a GCC issue.
static constexpr bool _OuterConst = _Const;
- __outer_iterator<_Const> __i_ = __outer_iterator<_OuterConst>();
- bool __incremented_ = false;
+ __outer_iterator<_Const> __i_ = __outer_iterator<_OuterConst>();
+ bool __incremented_ = false;
// Note: these private functions are necessary because GCC doesn't allow calls to private members of `__i_` from
// free functions that are friends of `inner-iterator`.
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool __is_done() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_done() const {
_LIBCPP_ASSERT_NON_NULL(__i_.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator.");
auto [__pcur, __pend] = ranges::subrange{__i_.__parent_->__pattern_};
- auto __end = ranges::end(__i_.__parent_->__base_);
+ auto __end = ranges::end(__i_.__parent_->__base_);
if constexpr (__tiny_range<_Pattern>) {
const auto& __cur = __i_.__current();
@@ -343,40 +322,32 @@ private:
}
}
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto& __outer_current() noexcept {
- return __i_.__current();
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __outer_current() noexcept { return __i_.__current(); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr const auto& __outer_current() const noexcept {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __outer_current() const noexcept {
return __i_.__current();
}
public:
// using iterator_category = inherited;
using iterator_concept = typename __outer_iterator<_Const>::iterator_concept;
- using value_type = range_value_t<_Base>;
- using difference_type = range_difference_t<_Base>;
+ using value_type = range_value_t<_Base>;
+ using difference_type = range_difference_t<_Base>;
- _LIBCPP_HIDE_FROM_ABI
- __inner_iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI __inner_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __inner_iterator(__outer_iterator<_Const> __i)
- : __i_(std::move(__i)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_Base> base() &&
- requires forward_range<_View> { return std::move(__i_.__current()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() &&
+ requires forward_range<_View>
+ {
+ return std::move(__i_.__current());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const { return *__i_.__current(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __inner_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator& operator++() {
__incremented_ = true;
if constexpr (!forward_range<_Base>) {
@@ -389,8 +360,7 @@ private:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
if constexpr (forward_range<_Base>) {
auto __tmp = *this;
++*this;
@@ -401,31 +371,29 @@ private:
}
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __inner_iterator& __x, const __inner_iterator& __y)
- requires forward_range<_Base> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, const __inner_iterator& __y)
+ requires forward_range<_Base>
+ {
return __x.__outer_current() == __y.__outer_current();
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __inner_iterator& __x, default_sentinel_t) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, default_sentinel_t) {
return __x.__is_done();
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __inner_iterator& __i)
- noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
+ iter_move(const __inner_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) {
return ranges::iter_move(__i.__outer_current());
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const __inner_iterator& __x, const __inner_iterator& __y)
- noexcept(noexcept(ranges::iter_swap(__x.__outer_current(), __y.__outer_current())))
- requires indirectly_swappable<iterator_t<_Base>> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(
+ const __inner_iterator& __x,
+ const __inner_iterator& __y) noexcept(noexcept(ranges::iter_swap(__x.__outer_current(), __y.__outer_current())))
+ requires indirectly_swappable<iterator_t<_Base>>
+ {
ranges::iter_swap(__x.__outer_current(), __y.__outer_current());
}
};
-
};
template <class _Range, class _Pattern>
@@ -433,22 +401,21 @@ lazy_split_view(_Range&&, _Pattern&&) -> lazy_split_view<views::all_t<_Range>, v
template <input_range _Range>
lazy_split_view(_Range&&, range_value_t<_Range>)
- -> lazy_split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
+ -> lazy_split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
namespace views {
namespace __lazy_split_view {
struct __fn {
template <class _Range, class _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const
- noexcept(noexcept(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))))
- -> decltype( lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)))
- { return lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const
+ noexcept(noexcept(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))))
+ -> decltype(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))) {
+ return lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern));
+ }
template <class _Pattern>
requires constructible_from<decay_t<_Pattern>, _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Pattern&& __pattern) const
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
}
@@ -456,7 +423,7 @@ struct __fn {
} // namespace __lazy_split_view
inline namespace __cpo {
- inline constexpr auto lazy_split = __lazy_split_view::__fn{};
+inline constexpr auto lazy_split = __lazy_split_view::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h b/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h
index f5223962049c..b2de2d2ae1cb 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/non_propagating_cache.h
@@ -26,85 +26,74 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- // __non_propagating_cache is a helper type that allows storing an optional value in it,
- // but which does not copy the source's value when it is copy constructed/assigned to,
- // and which resets the source's value when it is moved-from.
- //
- // This type is used as an implementation detail of some views that need to cache the
- // result of `begin()` in order to provide an amortized O(1) begin() method. Typically,
- // we don't want to propagate the value of the cache upon copy because the cached iterator
- // may refer to internal details of the source view.
- template<class _Tp>
- requires is_object_v<_Tp>
- class _LIBCPP_TEMPLATE_VIS __non_propagating_cache {
- struct __from_tag { };
- struct __forward_tag { };
-
- // This helper class is needed to perform copy and move elision when
- // constructing the contained type from an iterator.
- struct __wrapper {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__forward_tag, _Args&&... __args)
- : __t_(std::forward<_Args>(__args)...) {}
- template <class _Fn>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) {}
- _Tp __t_;
- };
-
- optional<__wrapper> __value_ = nullopt;
-
- public:
- _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept
- : __value_(nullopt)
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept
- : __value_(nullopt)
- {
- __other.__value_.reset();
- }
+// __non_propagating_cache is a helper type that allows storing an optional value in it,
+// but which does not copy the source's value when it is copy constructed/assigned to,
+// and which resets the source's value when it is moved-from.
+//
+// This type is used as an implementation detail of some views that need to cache the
+// result of `begin()` in order to provide an amortized O(1) begin() method. Typically,
+// we don't want to propagate the value of the cache upon copy because the cached iterator
+// may refer to internal details of the source view.
+template <class _Tp>
+ requires is_object_v<_Tp>
+class _LIBCPP_TEMPLATE_VIS __non_propagating_cache {
+ struct __from_tag {};
+ struct __forward_tag {};
+
+ // This helper class is needed to perform copy and move elision when
+ // constructing the contained type from an iterator.
+ struct __wrapper {
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__forward_tag, _Args&&... __args)
+ : __t_(std::forward<_Args>(__args)...) {}
+ template <class _Fn>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) {}
+ _Tp __t_;
+ };
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept {
- if (this != std::addressof(__other)) {
- __value_.reset();
- }
- return *this;
- }
+ optional<__wrapper> __value_ = nullopt;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept
+ : __value_(nullopt) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept
+ : __value_(nullopt) {
+ __other.__value_.reset();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept {
+ if (this != std::addressof(__other)) {
__value_.reset();
- __other.__value_.reset();
- return *this;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& operator*() { return __value_->__t_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp const& operator*() const { return __value_->__t_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept {
+ __value_.reset();
+ __other.__value_.reset();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool __has_value() const { return __value_.has_value(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() { return __value_->__t_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const { return __value_->__t_; }
- template<class _Fn>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& __emplace_from(_Fn const& __f) {
- return __value_.emplace(__from_tag{}, __f).__t_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const { return __value_.has_value(); }
- template<class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Tp& __emplace(_Args&& ...__args) {
- return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_;
- }
- };
+ template <class _Fn>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace_from(_Fn const& __f) {
+ return __value_.emplace(__from_tag{}, __f).__t_;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace(_Args&&... __args) {
+ return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_;
+ }
+};
- struct __empty_cache { };
+struct __empty_cache {};
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/owning_view.h b/contrib/llvm-project/libcxx/include/__ranges/owning_view.h
index c846de899b3f..254bdb432911 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/owning_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/owning_view.h
@@ -35,47 +35,75 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<range _Rp>
- requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>)
- class owning_view : public view_interface<owning_view<_Rp>> {
- _Rp __r_ = _Rp();
+template <range _Rp>
+ requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>)
+class owning_view : public view_interface<owning_view<_Rp>> {
+ _Rp __r_ = _Rp();
public:
- _LIBCPP_HIDE_FROM_ABI owning_view() requires default_initializable<_Rp> = default;
- _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {}
-
- _LIBCPP_HIDE_FROM_ABI owning_view(owning_view&&) = default;
- _LIBCPP_HIDE_FROM_ABI owning_view& operator=(owning_view&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const requires range<const _Rp> { return ranges::begin(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const requires range<const _Rp> { return ranges::end(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() requires requires { ranges::empty(__r_); }
- { return ranges::empty(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const requires requires { ranges::empty(__r_); }
- { return ranges::empty(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() requires sized_range<_Rp>
- { return ranges::size(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const requires sized_range<const _Rp>
- { return ranges::size(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() requires contiguous_range<_Rp>
- { return ranges::data(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() const requires contiguous_range<const _Rp>
- { return ranges::data(__r_); }
- };
- _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(owning_view);
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>;
+ _LIBCPP_HIDE_FROM_ABI owning_view()
+ requires default_initializable<_Rp>
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {}
+
+ _LIBCPP_HIDE_FROM_ABI owning_view(owning_view&&) = default;
+ _LIBCPP_HIDE_FROM_ABI owning_view& operator=(owning_view&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires range<const _Rp>
+ {
+ return ranges::begin(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _Rp>
+ {
+ return ranges::end(__r_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
+ requires requires { ranges::empty(__r_); }
+ {
+ return ranges::empty(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
+ requires requires { ranges::empty(__r_); }
+ {
+ return ranges::empty(__r_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_Rp>
+ {
+ return ranges::size(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _Rp>
+ {
+ return ranges::size(__r_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data()
+ requires contiguous_range<_Rp>
+ {
+ return ranges::data(__r_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
+ requires contiguous_range<const _Rp>
+ {
+ return ranges::data(__r_);
+ }
+};
+_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(owning_view);
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>;
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h b/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h
index 2688e4cd0437..726b7eda019e 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/range_adaptor.h
@@ -47,7 +47,7 @@ struct __range_adaptor_closure;
// i.e. something that can be called via the `x | f` notation.
template <class _Fn>
struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) { }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) {}
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__range_adaptor_closure_t);
@@ -56,23 +56,21 @@ concept _RangeAdaptorClosure = derived_from<remove_cvref_t<_Tp>, __range_adaptor
template <class _Tp>
struct __range_adaptor_closure {
- template <ranges::viewable_range _View, _RangeAdaptorClosure _Closure>
- requires same_as<_Tp, remove_cvref_t<_Closure>> &&
- invocable<_Closure, _View>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) operator|(_View&& __view, _Closure&& __closure)
- noexcept(is_nothrow_invocable_v<_Closure, _View>)
- { return std::invoke(std::forward<_Closure>(__closure), std::forward<_View>(__view)); }
+ template <ranges::viewable_range _View, _RangeAdaptorClosure _Closure>
+ requires same_as<_Tp, remove_cvref_t<_Closure>> && invocable<_Closure, _View>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
+ operator|(_View&& __view, _Closure&& __closure) noexcept(is_nothrow_invocable_v<_Closure, _View>) {
+ return std::invoke(std::forward<_Closure>(__closure), std::forward<_View>(__view));
+ }
- template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
- requires same_as<_Tp, remove_cvref_t<_Closure>> &&
- constructible_from<decay_t<_Closure>, _Closure> &&
- constructible_from<decay_t<_OtherClosure>, _OtherClosure>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2)
- noexcept(is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
- is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>)
- { return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); }
+ template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
+ requires same_as<_Tp, remove_cvref_t<_Closure>> && constructible_from<decay_t<_Closure>, _Closure> &&
+ constructible_from<decay_t<_OtherClosure>, _OtherClosure>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept(
+ is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
+ is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>) {
+ return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1)));
+ }
};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/rbegin.h b/contrib/llvm-project/libcxx/include/__ranges/rbegin.h
index 1ceb1116d695..7111201ae7d6 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/rbegin.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/rbegin.h
@@ -36,57 +36,44 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __rbegin {
template <class _Tp>
-concept __member_rbegin =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
- };
-
-void rbegin(auto&) = delete;
+concept __member_rbegin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
+};
+
+void rbegin(auto&) = delete;
void rbegin(const auto&) = delete;
template <class _Tp>
concept __unqualified_rbegin =
- !__member_rbegin<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator;
- };
+ !__member_rbegin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator;
+ };
template <class _Tp>
concept __can_reverse =
- __can_borrow<_Tp> &&
- !__member_rbegin<_Tp> &&
- !__unqualified_rbegin<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
- };
+ __can_borrow<_Tp> && !__member_rbegin<_Tp> && !__unqualified_rbegin<_Tp> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
+ { ranges::begin(__t) } -> bidirectional_iterator;
+ };
struct __fn {
template <class _Tp>
requires __member_rbegin<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin())))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin()))) {
return _LIBCPP_AUTO_CAST(__t.rbegin());
}
template <class _Tp>
requires __unqualified_rbegin<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t))))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t)))) {
return _LIBCPP_AUTO_CAST(rbegin(__t));
}
template <class _Tp>
requires __can_reverse<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::end(__t)))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::end(__t))) {
return std::make_reverse_iterator(ranges::end(__t));
}
@@ -95,7 +82,7 @@ struct __fn {
} // namespace __rbegin
inline namespace __cpo {
- inline constexpr auto rbegin = __rbegin::__fn{};
+inline constexpr auto rbegin = __rbegin::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -106,24 +93,24 @@ namespace __crbegin {
struct __fn {
template <class _Tp>
requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))))
+ -> decltype(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
template <class _Tp>
requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::rbegin(static_cast<const _Tp&&>(__t)))
- { return ranges::rbegin(static_cast<const _Tp&&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rbegin(static_cast<const _Tp&&>(__t))))
+ -> decltype(ranges::rbegin(static_cast<const _Tp&&>(__t))) {
+ return ranges::rbegin(static_cast<const _Tp&&>(__t));
+ }
};
} // namespace __crbegin
inline namespace __cpo {
- inline constexpr auto crbegin = __crbegin::__fn{};
+inline constexpr auto crbegin = __crbegin::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/ref_view.h b/contrib/llvm-project/libcxx/include/__ranges/ref_view.h
index be32b8124202..6213332a542a 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/ref_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/ref_view.h
@@ -37,49 +37,49 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<range _Range>
- requires is_object_v<_Range>
- class ref_view : public view_interface<ref_view<_Range>> {
- _Range *__range_;
+template <range _Range>
+ requires is_object_v<_Range>
+class ref_view : public view_interface<ref_view<_Range>> {
+ _Range* __range_;
- static void __fun(_Range&);
- static void __fun(_Range&&) = delete;
+ static void __fun(_Range&);
+ static void __fun(_Range&&) = delete;
public:
- template<class _Tp>
- requires __different_from<_Tp, ref_view> &&
- convertible_to<_Tp, _Range&> && requires { __fun(std::declval<_Tp>()); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr ref_view(_Tp&& __t)
- : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t))))
- {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool empty() const
- requires requires { ranges::empty(*__range_); }
- { return ranges::empty(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires sized_range<_Range>
- { return ranges::size(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data() const
- requires contiguous_range<_Range>
- { return ranges::data(*__range_); }
- };
-
- template<class _Range>
- ref_view(_Range&) -> ref_view<_Range>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
+ template <class _Tp>
+ requires __different_from<_Tp, ref_view> && convertible_to<_Tp, _Range&> && requires { __fun(std::declval<_Tp>()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr ref_view(_Tp&& __t)
+ : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
+ requires requires { ranges::empty(*__range_); }
+ {
+ return ranges::empty(*__range_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<_Range>
+ {
+ return ranges::size(*__range_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
+ requires contiguous_range<_Range>
+ {
+ return ranges::data(*__range_);
+ }
+};
+
+template <class _Range>
+ref_view(_Range&) -> ref_view<_Range>;
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/rend.h b/contrib/llvm-project/libcxx/include/__ranges/rend.h
index 7ee574ccfa67..58d98aafd264 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/rend.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/rend.h
@@ -37,60 +37,47 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __rend {
template <class _Tp>
-concept __member_rend =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
- };
-
-void rend(auto&) = delete;
+concept __member_rend = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ ranges::rbegin(__t);
+ { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
+};
+
+void rend(auto&) = delete;
void rend(const auto&) = delete;
template <class _Tp>
concept __unqualified_rend =
- !__member_rend<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
- };
+ !__member_rend<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ ranges::rbegin(__t);
+ { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
+ };
template <class _Tp>
-concept __can_reverse =
- __can_borrow<_Tp> &&
- !__member_rend<_Tp> &&
- !__unqualified_rend<_Tp> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
- };
+concept __can_reverse = __can_borrow<_Tp> && !__member_rend<_Tp> && !__unqualified_rend<_Tp> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
+ { ranges::begin(__t) } -> bidirectional_iterator;
+};
class __fn {
public:
template <class _Tp>
requires __member_rend<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend())))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend()))) {
return _LIBCPP_AUTO_CAST(__t.rend());
}
template <class _Tp>
requires __unqualified_rend<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t))))
- {
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t)))) {
return _LIBCPP_AUTO_CAST(rend(__t));
}
template <class _Tp>
requires __can_reverse<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::begin(__t)))
- {
+ noexcept(noexcept(ranges::begin(__t))) {
return std::make_reverse_iterator(ranges::begin(__t));
}
@@ -99,7 +86,7 @@ public:
} // namespace __rend
inline namespace __cpo {
- inline constexpr auto rend = __rend::__fn{};
+inline constexpr auto rend = __rend::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -110,24 +97,24 @@ namespace __crend {
struct __fn {
template <class _Tp>
requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype( ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)))
- { return ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))))
+ -> decltype(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))) {
+ return ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t));
+ }
template <class _Tp>
requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t))))
- -> decltype( ranges::rend(static_cast<const _Tp&&>(__t)))
- { return ranges::rend(static_cast<const _Tp&&>(__t)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t))))
+ -> decltype(ranges::rend(static_cast<const _Tp&&>(__t))) {
+ return ranges::rend(static_cast<const _Tp&&>(__t));
+ }
};
} // namespace __crend
inline namespace __cpo {
- inline constexpr auto crend = __crend::__fn{};
+inline constexpr auto crend = __crend::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h b/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h
index 01d1b97b3ce2..f7846259810c 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/reverse_view.h
@@ -38,151 +38,158 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<view _View>
- requires bidirectional_range<_View>
- class reverse_view : public view_interface<reverse_view<_View>> {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method.
- static constexpr bool _UseCache = !random_access_range<_View> && !common_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<reverse_iterator<iterator_t<_View>>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- reverse_view() requires default_initializable<_View> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> begin() {
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_)));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> begin() requires common_range<_View> {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires common_range<const _View> {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr reverse_iterator<iterator_t<_View>> end() {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires common_range<const _View> {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
- return ranges::size(__base_);
- }
- };
-
- template<class _Range>
- reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>;
-
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<reverse_view<_Tp>> = enable_borrowed_range<_Tp>;
-
- namespace views {
- namespace __reverse {
- template<class _Tp>
- inline constexpr bool __is_reverse_view = false;
-
- template<class _Tp>
- inline constexpr bool __is_reverse_view<reverse_view<_Tp>> = true;
-
- template<class _Tp>
- inline constexpr bool __is_sized_reverse_subrange = false;
-
- template<class _Iter>
- inline constexpr bool __is_sized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, subrange_kind::sized>> = true;
-
- template<class _Tp>
- inline constexpr bool __is_unsized_reverse_subrange = false;
-
- template<class _Iter, subrange_kind _Kind>
- inline constexpr bool __is_unsized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> = _Kind == subrange_kind::unsized;
-
- template<class _Tp>
- struct __unwrapped_reverse_subrange {
- using type = void; // avoid SFINAE-ing out the overload below -- let the concept requirements do it for better diagnostics
- };
-
- template<class _Iter, subrange_kind _Kind>
- struct __unwrapped_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> {
- using type = subrange<_Iter, _Iter, _Kind>;
- };
-
- struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- requires __is_reverse_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(std::forward<_Range>(__range).base()))
- -> decltype( std::forward<_Range>(__range).base())
- { return std::forward<_Range>(__range).base(); }
-
- template<class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_sized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())))
- -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()))
- { return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size()); }
-
- template<class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_unsized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base())))
- -> decltype( _UnwrappedSubrange(__range.end().base(), __range.begin().base()))
- { return _UnwrappedSubrange(__range.end().base(), __range.begin().base()); }
-
- template<class _Range>
- requires (!__is_reverse_view<remove_cvref_t<_Range>> &&
- !__is_sized_reverse_subrange<remove_cvref_t<_Range>> &&
- !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(reverse_view{std::forward<_Range>(__range)}))
- -> decltype( reverse_view{std::forward<_Range>(__range)})
- { return reverse_view{std::forward<_Range>(__range)}; }
- };
- } // namespace __reverse
-
- inline namespace __cpo {
- inline constexpr auto reverse = __reverse::__fn{};
- } // namespace __cpo
- } // namespace views
+template <view _View>
+ requires bidirectional_range<_View>
+class reverse_view : public view_interface<reverse_view<_View>> {
+ // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
+ // amortized O(1) begin() method.
+ static constexpr bool _UseCache = !random_access_range<_View> && !common_range<_View>;
+ using _Cache = _If<_UseCache, __non_propagating_cache<reverse_iterator<iterator_t<_View>>>, __empty_cache>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
+ _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
+
+public:
+ _LIBCPP_HIDE_FROM_ABI reverse_view()
+ requires default_initializable<_View>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() {
+ if constexpr (_UseCache)
+ if (__cached_begin_.__has_value())
+ return *__cached_begin_;
+
+ auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_)));
+ if constexpr (_UseCache)
+ __cached_begin_.__emplace(__tmp);
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin()
+ requires common_range<_View>
+ {
+ return std::make_reverse_iterator(ranges::end(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires common_range<const _View>
+ {
+ return std::make_reverse_iterator(ranges::end(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() {
+ return std::make_reverse_iterator(ranges::begin(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires common_range<const _View>
+ {
+ return std::make_reverse_iterator(ranges::begin(__base_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
+ return ranges::size(__base_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
+ return ranges::size(__base_);
+ }
+};
+
+template <class _Range>
+reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>;
+
+template <class _Tp>
+inline constexpr bool enable_borrowed_range<reverse_view<_Tp>> = enable_borrowed_range<_Tp>;
+
+namespace views {
+namespace __reverse {
+template <class _Tp>
+inline constexpr bool __is_reverse_view = false;
+
+template <class _Tp>
+inline constexpr bool __is_reverse_view<reverse_view<_Tp>> = true;
+
+template <class _Tp>
+inline constexpr bool __is_sized_reverse_subrange = false;
+
+template <class _Iter>
+inline constexpr bool
+ __is_sized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, subrange_kind::sized>> =
+ true;
+
+template <class _Tp>
+inline constexpr bool __is_unsized_reverse_subrange = false;
+
+template <class _Iter, subrange_kind _Kind>
+inline constexpr bool __is_unsized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> =
+ _Kind == subrange_kind::unsized;
+
+template <class _Tp>
+struct __unwrapped_reverse_subrange {
+ using type =
+ void; // avoid SFINAE-ing out the overload below -- let the concept requirements do it for better diagnostics
+};
+
+template <class _Iter, subrange_kind _Kind>
+struct __unwrapped_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> {
+ using type = subrange<_Iter, _Iter, _Kind>;
+};
+
+struct __fn : __range_adaptor_closure<__fn> {
+ template <class _Range>
+ requires __is_reverse_view<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(std::forward<_Range>(__range).base())) -> decltype(std::forward<_Range>(__range).base()) {
+ return std::forward<_Range>(__range).base();
+ }
+
+ template <class _Range,
+ class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
+ requires __is_sized_reverse_subrange<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())))
+ -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())) {
+ return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size());
+ }
+
+ template <class _Range,
+ class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
+ requires __is_unsized_reverse_subrange<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base())))
+ -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base())) {
+ return _UnwrappedSubrange(__range.end().base(), __range.begin().base());
+ }
+
+ template <class _Range>
+ requires(!__is_reverse_view<remove_cvref_t<_Range>> && !__is_sized_reverse_subrange<remove_cvref_t<_Range>> &&
+ !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(reverse_view{std::forward<_Range>(__range)}))
+ -> decltype(reverse_view{std::forward<_Range>(__range)}) {
+ return reverse_view{std::forward<_Range>(__range)};
+ }
+};
+} // namespace __reverse
+
+inline namespace __cpo {
+inline constexpr auto reverse = __reverse::__fn{};
+} // namespace __cpo
+} // namespace views
} // namespace ranges
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__ranges/single_view.h b/contrib/llvm-project/libcxx/include/__ranges/single_view.h
index 5724e2d1b6d5..b0b2c1d9f3c0 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/single_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/single_view.h
@@ -74,24 +74,24 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp* data() const noexcept { return __value_.operator->(); }
};
-template<class _Tp>
+template <class _Tp>
single_view(_Tp) -> single_view<_Tp>;
namespace views {
namespace __single_view {
struct __fn : __range_adaptor_closure<__fn> {
- template<class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))))
- -> decltype( single_view<decay_t<_Range&&>>(std::forward<_Range>(__range)))
- { return single_view<decay_t<_Range&&>>(std::forward<_Range>(__range)); }
+ template <class _Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))))
+ -> decltype(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))) {
+ return single_view<decay_t<_Range&&>>(std::forward<_Range>(__range));
+ }
};
} // namespace __single_view
inline namespace __cpo {
- inline constexpr auto single = __single_view::__fn{};
+inline constexpr auto single = __single_view::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/size.h b/contrib/llvm-project/libcxx/include/__ranges/size.h
index f22dd1ff7b79..14e21aae6bf1 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/size.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/size.h
@@ -33,49 +33,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class>
- inline constexpr bool disable_sized_range = false;
+template <class>
+inline constexpr bool disable_sized_range = false;
} // namespace ranges
// [range.prim.size]
namespace ranges {
namespace __size {
-void size(auto&) = delete;
+void size(auto&) = delete;
void size(const auto&) = delete;
template <class _Tp>
concept __size_enabled = !disable_sized_range<remove_cvref_t<_Tp>>;
template <class _Tp>
-concept __member_size =
- __size_enabled<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like;
- };
+concept __member_size = __size_enabled<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like;
+};
template <class _Tp>
concept __unqualified_size =
- __size_enabled<_Tp> &&
- !__member_size<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(size(__t)) } -> __integer_like;
- };
+ __size_enabled<_Tp> && !__member_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { _LIBCPP_AUTO_CAST(size(__t)) } -> __integer_like;
+ };
template <class _Tp>
concept __difference =
- !__member_size<_Tp> &&
- !__unqualified_size<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { ranges::begin(__t) } -> forward_iterator;
- { ranges::end(__t) } -> sized_sentinel_for<decltype(ranges::begin(std::declval<_Tp>()))>;
- };
+ !__member_size<_Tp> && !__unqualified_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { ranges::begin(__t) } -> forward_iterator;
+ { ranges::end(__t) } -> sized_sentinel_for<decltype(ranges::begin(std::declval<_Tp>()))>;
+ };
struct __fn {
-
// `[range.prim.size]`: the array case (for rvalues).
template <class _Tp, size_t _Sz>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t operator()(_Tp (&&)[_Sz]) const noexcept {
@@ -105,16 +95,16 @@ struct __fn {
// [range.prim.size]: the `to-unsigned-like` case.
template <__difference _Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))))
- -> decltype( std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t)))
- { return std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t));
+ noexcept(noexcept(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))))
+ -> decltype(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))) {
+ return std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t));
}
};
} // namespace __size
inline namespace __cpo {
- inline constexpr auto size = __size::__fn{};
+inline constexpr auto size = __size::__fn{};
} // namespace __cpo
} // namespace ranges
@@ -123,10 +113,10 @@ inline namespace __cpo {
namespace ranges {
namespace __ssize {
struct __fn {
- template<class _Tp>
- requires requires (_Tp&& __t) { ranges::size(__t); }
+ template <class _Tp>
+ requires requires(_Tp&& __t) { ranges::size(__t); }
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr integral auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::size(__t))) {
+ noexcept(noexcept(ranges::size(__t))) {
using _Signed = make_signed_t<decltype(ranges::size(__t))>;
if constexpr (sizeof(ptrdiff_t) > sizeof(_Signed))
return static_cast<ptrdiff_t>(ranges::size(__t));
@@ -137,7 +127,7 @@ struct __fn {
} // namespace __ssize
inline namespace __cpo {
- inline constexpr auto ssize = __ssize::__fn{};
+inline constexpr auto ssize = __ssize::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/subrange.h b/contrib/llvm-project/libcxx/include/__ranges/subrange.h
index 75f9284a582f..a41978275b78 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/subrange.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/subrange.h
@@ -54,208 +54,188 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
namespace ranges {
- template<class _From, class _To>
- concept __uses_nonqualification_pointer_conversion =
+template <class _From, class _To>
+concept __uses_nonqualification_pointer_conversion =
is_pointer_v<_From> && is_pointer_v<_To> &&
- !convertible_to<remove_pointer_t<_From>(*)[], remove_pointer_t<_To>(*)[]>;
-
- template<class _From, class _To>
- concept __convertible_to_non_slicing =
- convertible_to<_From, _To> &&
- !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>;
-
- template<class _Pair, class _Iter, class _Sent>
- concept __pair_like_convertible_from =
- !range<_Pair> && __pair_like<_Pair> &&
- constructible_from<_Pair, _Iter, _Sent> &&
- __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> &&
- convertible_to<_Sent, tuple_element_t<1, _Pair>>;
-
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent = _Iter,
- subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter>
- ? subrange_kind::sized
- : subrange_kind::unsized>
- requires (_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
- class _LIBCPP_TEMPLATE_VIS subrange
- : public view_interface<subrange<_Iter, _Sent, _Kind>>
- {
- public:
- // Note: this is an internal implementation detail that is public only for internal usage.
- static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>);
-
- private:
- static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics
- struct _Empty { _LIBCPP_HIDE_FROM_ABI constexpr _Empty(auto) noexcept { } };
- using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter();
- _LIBCPP_NO_UNIQUE_ADDRESS _Sent __end_ = _Sent();
- _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0;
-
- public:
- _LIBCPP_HIDE_FROM_ABI
- subrange() requires default_initializable<_Iter> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent)
- requires _MustProvideSizeAtConstruction
- : __begin_(std::move(__iter)), __end_(std::move(__sent))
- { }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent,
- make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires (_Kind == subrange_kind::sized)
- : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n)
- {
- if constexpr (sized_sentinel_for<_Sent, _Iter>)
- _LIBCPP_ASSERT_UNCATEGORIZED((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n),
- "std::ranges::subrange was passed an invalid size hint");
- }
+ !convertible_to<remove_pointer_t<_From> (*)[], remove_pointer_t<_To> (*)[]>;
+
+template <class _From, class _To>
+concept __convertible_to_non_slicing =
+ convertible_to<_From, _To> && !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>;
+
+template <class _Pair, class _Iter, class _Sent>
+concept __pair_like_convertible_from =
+ !range<_Pair> && __pair_like<_Pair> && constructible_from<_Pair, _Iter, _Sent> &&
+ __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> && convertible_to<_Sent, tuple_element_t<1, _Pair>>;
+
+template <input_or_output_iterator _Iter,
+ sentinel_for<_Iter> _Sent = _Iter,
+ subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter> ? subrange_kind::sized : subrange_kind::unsized>
+ requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
+class _LIBCPP_TEMPLATE_VIS subrange : public view_interface<subrange<_Iter, _Sent, _Kind>> {
+public:
+ // Note: this is an internal implementation detail that is public only for internal usage.
+ static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>);
+
+private:
+ static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics
+ struct _Empty {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Empty(auto) noexcept {}
+ };
+ using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter();
+ _LIBCPP_NO_UNIQUE_ADDRESS _Sent __end_ = _Sent();
+ _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI subrange()
+ requires default_initializable<_Iter>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent)
+ requires _MustProvideSizeAtConstruction
+ : __begin_(std::move(__iter)), __end_(std::move(__sent)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(
+ __convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent, make_unsigned_t<iter_difference_t<_Iter>> __n)
+ requires(_Kind == subrange_kind::sized)
+ : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) {
+ if constexpr (sized_sentinel_for<_Sent, _Iter>)
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n),
+ "std::ranges::subrange was passed an invalid size hint");
+ }
- template<__different_from<subrange> _Range>
- requires borrowed_range<_Range> &&
- __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range)
- requires (!_StoreSize)
- : subrange(ranges::begin(__range), ranges::end(__range))
- { }
-
- template<__different_from<subrange> _Range>
- requires borrowed_range<_Range> &&
- __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range)
- requires _StoreSize && sized_range<_Range>
- : subrange(__range, ranges::size(__range))
- { }
-
- template<borrowed_range _Range>
- requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange(_Range&& __range, make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires (_Kind == subrange_kind::sized)
- : subrange(ranges::begin(__range), ranges::end(__range), __n)
- { }
-
- template<__different_from<subrange> _Pair>
- requires __pair_like_convertible_from<_Pair, const _Iter&, const _Sent&>
- _LIBCPP_HIDE_FROM_ABI
- constexpr operator _Pair() const {
- return _Pair(__begin_, __end_);
- }
+ template <__different_from<subrange> _Range>
+ requires borrowed_range<_Range> && __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
+ convertible_to<sentinel_t<_Range>, _Sent>
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range)
+ requires(!_StoreSize)
+ : subrange(ranges::begin(__range), ranges::end(__range)) {}
+
+ template <__different_from<subrange> _Range>
+ requires borrowed_range<_Range> && __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
+ convertible_to<sentinel_t<_Range>, _Sent>
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range)
+ requires _StoreSize && sized_range<_Range>
+ : subrange(__range, ranges::size(__range)) {}
+
+ template <borrowed_range _Range>
+ requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
+ convertible_to<sentinel_t<_Range>, _Sent>
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range, make_unsigned_t<iter_difference_t<_Iter>> __n)
+ requires(_Kind == subrange_kind::sized)
+ : subrange(ranges::begin(__range), ranges::end(__range), __n) {}
+
+ template <__different_from<subrange> _Pair>
+ requires __pair_like_convertible_from<_Pair, const _Iter&, const _Sent&>
+ _LIBCPP_HIDE_FROM_ABI constexpr operator _Pair() const {
+ return _Pair(__begin_, __end_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Iter begin() const requires copyable<_Iter> {
- return __begin_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const
+ requires copyable<_Iter>
+ {
+ return __begin_;
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() requires (!copyable<_Iter>) {
- return std::move(__begin_);
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin()
+ requires(!copyable<_Iter>)
+ {
+ return std::move(__begin_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Sent end() const {
- return __end_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const {
- return __begin_ == __end_;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __begin_ == __end_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
- requires (_Kind == subrange_kind::sized)
- {
- if constexpr (_StoreSize)
- return __size_;
- else
- return std::__to_unsigned_like(__end_ - __begin_);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
+ requires(_Kind == subrange_kind::sized)
+ {
+ if constexpr (_StoreSize)
+ return __size_;
+ else
+ return std::__to_unsigned_like(__end_ - __begin_);
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const&
- requires forward_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(__n);
- return __tmp;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const&
+ requires forward_iterator<_Iter>
+ {
+ auto __tmp = *this;
+ __tmp.advance(__n);
+ return __tmp;
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && {
- advance(__n);
- return std::move(*this);
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && {
+ advance(__n);
+ return std::move(*this);
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const
- requires bidirectional_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(-__n);
- return __tmp;
- }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const
+ requires bidirectional_iterator<_Iter>
+ {
+ auto __tmp = *this;
+ __tmp.advance(-__n);
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr subrange& advance(iter_difference_t<_Iter> __n) {
- if constexpr (bidirectional_iterator<_Iter>) {
- if (__n < 0) {
- ranges::advance(__begin_, __n);
- if constexpr (_StoreSize)
- __size_ += std::__to_unsigned_like(-__n);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange& advance(iter_difference_t<_Iter> __n) {
+ if constexpr (bidirectional_iterator<_Iter>) {
+ if (__n < 0) {
+ ranges::advance(__begin_, __n);
+ if constexpr (_StoreSize)
+ __size_ += std::__to_unsigned_like(-__n);
+ return *this;
}
-
- auto __d = __n - ranges::advance(__begin_, __n, __end_);
- if constexpr (_StoreSize)
- __size_ -= std::__to_unsigned_like(__d);
- return *this;
}
- };
-
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- subrange(_Iter, _Sent) -> subrange<_Iter, _Sent>;
- template<input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>)
- -> subrange<_Iter, _Sent, subrange_kind::sized>;
+ auto __d = __n - ranges::advance(__begin_, __n, __end_);
+ if constexpr (_StoreSize)
+ __size_ -= std::__to_unsigned_like(__d);
+ return *this;
+ }
+};
- template<borrowed_range _Range>
- subrange(_Range&&) -> subrange<iterator_t<_Range>, sentinel_t<_Range>,
- (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
- ? subrange_kind::sized : subrange_kind::unsized>;
+template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
+subrange(_Iter, _Sent) -> subrange<_Iter, _Sent>;
- template<borrowed_range _Range>
- subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
- -> subrange<iterator_t<_Range>, sentinel_t<_Range>, subrange_kind::sized>;
+template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
+subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) -> subrange<_Iter, _Sent, subrange_kind::sized>;
- template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires ((_Index == 0 && copyable<_Iter>) || _Index == 1)
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
- }
+template <borrowed_range _Range>
+subrange(_Range&&)
+ -> subrange<iterator_t<_Range>,
+ sentinel_t<_Range>,
+ (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
+ ? subrange_kind::sized
+ : subrange_kind::unsized>;
- template<size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires (_Index < 2)
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
- }
-
- template<class _Ip, class _Sp, subrange_kind _Kp>
- inline constexpr bool enable_borrowed_range<subrange<_Ip, _Sp, _Kp>> = true;
+template <borrowed_range _Range>
+subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
+ -> subrange<iterator_t<_Range>, sentinel_t<_Range>, subrange_kind::sized>;
- template<range _Rp>
- using borrowed_subrange_t = _If<borrowed_range<_Rp>, subrange<iterator_t<_Rp>>, dangling>;
+template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
+ requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
+_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
+ if constexpr (_Index == 0)
+ return __subrange.begin();
+ else
+ return __subrange.end();
+}
+
+template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
+ requires(_Index < 2)
+_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
+ if constexpr (_Index == 0)
+ return __subrange.begin();
+ else
+ return __subrange.end();
+}
+
+template <class _Ip, class _Sp, subrange_kind _Kp>
+inline constexpr bool enable_borrowed_range<subrange<_Ip, _Sp, _Kp>> = true;
+
+template <range _Rp>
+using borrowed_subrange_t = _If<borrowed_range<_Rp>, subrange<iterator_t<_Rp>>, dangling>;
} // namespace ranges
// [range.subrange.general]
@@ -264,25 +244,25 @@ using ranges::get;
// [ranges.syn]
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_size<ranges::subrange<_Ip, _Sp, _Kp>> : integral_constant<size_t, 2> {};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<0, ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Ip;
};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<1, ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Sp;
};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<0, const ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Ip;
};
-template<class _Ip, class _Sp, ranges::subrange_kind _Kp>
+template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> {
using type = _Sp;
};
diff --git a/contrib/llvm-project/libcxx/include/__ranges/take_view.h b/contrib/llvm-project/libcxx/include/__ranges/take_view.h
index 518375d684ab..83ed5ca0ebd3 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/take_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/take_view.h
@@ -57,37 +57,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<view _View>
+template <view _View>
class take_view : public view_interface<take_view<_View>> {
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- range_difference_t<_View> __count_ = 0;
+ range_difference_t<_View> __count_ = 0;
- template<bool> class __sentinel;
+ template <bool>
+ class __sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- take_view() requires default_initializable<_View> = default;
+ _LIBCPP_HIDE_FROM_ABI take_view()
+ requires default_initializable<_View>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_view(_View __base, range_difference_t<_View> __count)
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+ take_view(_View __base, range_difference_t<_View> __count)
: __base_(std::move(__base)), __count_(__count) {
_LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero");
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() requires (!__simple_view<_View>) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+ requires(!__simple_view<_View>)
+ {
if constexpr (sized_range<_View>) {
if constexpr (random_access_range<_View>) {
return ranges::begin(__base_);
} else {
using _DifferenceT = range_difference_t<_View>;
- auto __size = size();
+ auto __size = size();
return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
}
} else {
@@ -95,14 +100,15 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires range<const _View>
+ {
if constexpr (sized_range<const _View>) {
if constexpr (random_access_range<const _View>) {
return ranges::begin(__base_);
} else {
using _DifferenceT = range_difference_t<const _View>;
- auto __size = size();
+ auto __size = size();
return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
}
} else {
@@ -110,8 +116,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() requires (!__simple_view<_View>) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires(!__simple_view<_View>)
+ {
if constexpr (sized_range<_View>) {
if constexpr (random_access_range<_View>) {
return ranges::begin(__base_) + size();
@@ -123,8 +130,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const requires range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _View>
+ {
if constexpr (sized_range<const _View>) {
if constexpr (random_access_range<const _View>) {
return ranges::begin(__base_) + size();
@@ -136,47 +144,44 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
auto __n = ranges::size(__base_);
return ranges::min(__n, static_cast<decltype(__n)>(__count_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
auto __n = ranges::size(__base_);
return ranges::min(__n, static_cast<decltype(__n)>(__count_));
}
};
-template<view _View>
-template<bool _Const>
+template <view _View>
+template <bool _Const>
class take_view<_View>::__sentinel {
using _Base = __maybe_const<_Const, _View>;
- template<bool _OtherConst>
- using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>;
+ template <bool _OtherConst>
+ using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>;
_LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>();
- template<bool>
+ template <bool>
friend class take_view<_View>::__sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __s)
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s)
requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__s.__end_)) {}
+ : __end_(std::move(__s.__end_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_Base> base() const { return __end_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
return __lhs.count() == 0 || __lhs.base() == __rhs.__end_;
}
@@ -187,10 +192,10 @@ public:
}
};
-template<class _Range>
+template <class _Range>
take_view(_Range&&, range_difference_t<_Range>) -> take_view<views::all_t<_Range>>;
-template<class _Tp>
+template <class _Tp>
inline constexpr bool enable_borrowed_range<take_view<_Tp>> = enable_borrowed_range<_Tp>;
namespace views {
@@ -234,7 +239,7 @@ struct __passthrough_type<basic_string_view<_CharT, _Traits>> {
};
template <class _Iter, class _Sent, subrange_kind _Kind>
- requires requires{typename subrange<_Iter>;}
+ requires requires { typename subrange<_Iter>; }
struct __passthrough_type<subrange<_Iter, _Sent, _Kind>> {
using type = subrange<_Iter>;
};
@@ -246,42 +251,36 @@ struct __fn {
// [range.take.overview]: the `empty_view` case.
template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
- -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
- { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
+ -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) {
+ return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range));
+ }
// [range.take.overview]: the `span | basic_string_view | subrange` case.
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (!__is_empty_view<_RawRange> &&
- random_access_range<_RawRange> &&
- sized_range<_RawRange> &&
- __is_passthrough_specialization<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(__passthrough_type_t<_RawRange>(
- ranges::begin(__rng),
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
- )))
- -> decltype( __passthrough_type_t<_RawRange>(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng),
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
- ))
- { return __passthrough_type_t<_RawRange>(
- ranges::begin(__rng),
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
- ); }
+ class _Dist = range_difference_t<_Range>>
+ requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
+ __is_passthrough_specialization<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
+ operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(__passthrough_type_t<_RawRange>(
+ ranges::begin(__rng), ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))))
+ -> decltype(__passthrough_type_t<_RawRange>(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng),
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))) {
+ return __passthrough_type_t<_RawRange>(
+ ranges::begin(__rng), ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)));
+ }
// [range.take.overview]: the `iota_view` case.
+ // clang-format off
template <class _Range,
convertible_to<range_difference_t<_Range>> _Np,
class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
+ class _Dist = range_difference_t<_Range>>
requires (!__is_empty_view<_RawRange> &&
random_access_range<_RawRange> &&
sized_range<_RawRange> &&
@@ -290,18 +289,18 @@ struct __fn {
constexpr auto operator()(_Range&& __rng, _Np&& __n) const
noexcept(noexcept(ranges::iota_view(
*ranges::begin(__rng),
- *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
)))
-> decltype( ranges::iota_view(
// Note: deliberately not forwarding `__rng` to guard against double moves.
*ranges::begin(__rng),
- *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
))
{ return ranges::iota_view(
*ranges::begin(__rng),
- *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
); }
-// clang-format off
+
#if _LIBCPP_STD_VER >= 23
// [range.take.overview]: the `repeat_view` "_RawRange models sized_range" case.
template <class _Range,
@@ -325,42 +324,37 @@ struct __fn {
-> decltype( views::repeat(*__range.__value_, static_cast<_Dist>(__n)))
{ return views::repeat(*__range.__value_, static_cast<_Dist>(__n)); }
#endif
-// clang-format on
+ // clang-format on
// [range.take.overview]: the "otherwise" case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>>
- // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
- // overloads.
- requires (!(__is_empty_view<_RawRange> ||
-#if _LIBCPP_STD_VER >= 23
- __is_repeat_specialization<_RawRange> ||
-#endif
- (__is_iota_specialization<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>) ||
- (__is_passthrough_specialization<_RawRange> &&
- sized_range<_RawRange> &&
- random_access_range<_RawRange>)
- ))
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
- -> decltype( take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))
- { return take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); }
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>>
+ // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
+ // overloads.
+ requires(!(__is_empty_view<_RawRange> ||
+# if _LIBCPP_STD_VER >= 23
+ __is_repeat_specialization<_RawRange> ||
+# endif
+ (__is_iota_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>) ||
+ (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> &&
+ random_access_range<_RawRange>)))
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
+ noexcept(noexcept(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
+ -> decltype(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) {
+ return take_view(std::forward<_Range>(__range), std::forward<_Np>(__n));
+ }
template <class _Np>
requires constructible_from<decay_t<_Np>, _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Np&& __n) const
- noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n))); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
+ }
};
} // namespace __take
inline namespace __cpo {
- inline constexpr auto take = __take::__fn{};
+inline constexpr auto take = __take::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/transform_view.h b/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
index 3678f9d64f7b..55c6ce587bd6 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
@@ -53,15 +53,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _Fn, class _View>
-concept __regular_invocable_with_range_ref =
- regular_invocable<_Fn, range_reference_t<_View>>;
+template <class _Fn, class _View>
+concept __regular_invocable_with_range_ref = regular_invocable<_Fn, range_reference_t<_View>>;
-template<class _View, class _Fn>
+template <class _View, class _Fn>
concept __transform_view_constraints =
- view<_View> && is_object_v<_Fn> &&
- regular_invocable<_Fn&, range_reference_t<_View>> &&
- __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>;
+ view<_View> && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_View>> &&
+ __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>;
# if _LIBCPP_STD_VER >= 23
template <input_range _View, move_constructible _Fn>
@@ -70,100 +68,99 @@ template <input_range _View, copy_constructible _Fn>
# endif
requires __transform_view_constraints<_View, _Fn>
class transform_view : public view_interface<transform_view<_View, _Fn>> {
- template<bool> class __iterator;
- template<bool> class __sentinel;
+ template <bool>
+ class __iterator;
+ template <bool>
+ class __sentinel;
_LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Fn> __func_;
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
public:
- _LIBCPP_HIDE_FROM_ABI
- transform_view()
- requires default_initializable<_View> && default_initializable<_Fn> = default;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func)
- : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<false> begin() {
- return __iterator<false>{*this, ranges::begin(__base_)};
+ _LIBCPP_HIDE_FROM_ABI transform_view()
+ requires default_initializable<_View> && default_initializable<_Fn>
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func)
+ : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
+ requires copy_constructible<_View>
+ {
+ return __base_;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<true> begin() const
- requires range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() { return __iterator<false>{*this, ranges::begin(__base_)}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const
+ requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
{
return __iterator<true>(*this, ranges::begin(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel<false> end() {
- return __sentinel<false>(ranges::end(__base_));
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<false> end()
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<false> end() { return __sentinel<false>(ranges::end(__base_)); }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> end()
requires common_range<_View>
{
return __iterator<false>(*this, ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel<true> end() const
- requires range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const
+ requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
{
return __sentinel<true>(ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator<true> end() const
- requires common_range<const _View> &&
- __regular_invocable_with_range_ref<const _Fn&, const _View>
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const
+ requires common_range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
{
return __iterator<true>(*this, ranges::end(__base_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() requires sized_range<_View> { return ranges::size(__base_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const requires sized_range<const _View> { return ranges::size(__base_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_View>
+ {
+ return ranges::size(__base_);
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _View>
+ {
+ return ranges::size(__base_);
+ }
};
-template<class _Range, class _Fn>
+template <class _Range, class _Fn>
transform_view(_Range&&, _Fn) -> transform_view<views::all_t<_Range>, _Fn>;
-template<class _View>
-struct __transform_view_iterator_concept { using type = input_iterator_tag; };
+template <class _View>
+struct __transform_view_iterator_concept {
+ using type = input_iterator_tag;
+};
-template<random_access_range _View>
-struct __transform_view_iterator_concept<_View> { using type = random_access_iterator_tag; };
+template <random_access_range _View>
+struct __transform_view_iterator_concept<_View> {
+ using type = random_access_iterator_tag;
+};
-template<bidirectional_range _View>
-struct __transform_view_iterator_concept<_View> { using type = bidirectional_iterator_tag; };
+template <bidirectional_range _View>
+struct __transform_view_iterator_concept<_View> {
+ using type = bidirectional_iterator_tag;
+};
-template<forward_range _View>
-struct __transform_view_iterator_concept<_View> { using type = forward_iterator_tag; };
+template <forward_range _View>
+struct __transform_view_iterator_concept<_View> {
+ using type = forward_iterator_tag;
+};
-template<class, class>
+template <class, class>
struct __transform_view_iterator_category_base {};
-template<forward_range _View, class _Fn>
+template <forward_range _View, class _Fn>
struct __transform_view_iterator_category_base<_View, _Fn> {
using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using iterator_category = conditional_t<
- is_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>,
- conditional_t<
- derived_from<_Cat, contiguous_iterator_tag>,
- random_access_iterator_tag,
- _Cat
- >,
- input_iterator_tag
- >;
+ using iterator_category =
+ conditional_t< is_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>,
+ conditional_t< derived_from<_Cat, contiguous_iterator_tag>, random_access_iterator_tag, _Cat >,
+ input_iterator_tag >;
};
# if _LIBCPP_STD_VER >= 23
@@ -176,66 +173,54 @@ template <bool _Const>
class transform_view<_View, _Fn>::__iterator : public __transform_view_iterator_category_base<_View, _Fn> {
using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
+ using _Base = __maybe_const<_Const, _View>;
- _Parent *__parent_ = nullptr;
+ _Parent* __parent_ = nullptr;
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__iterator;
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__sentinel;
public:
iterator_t<_Base> __current_ = iterator_t<_Base>();
using iterator_concept = typename __transform_view_iterator_concept<_View>::type;
- using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>;
- using difference_type = range_difference_t<_Base>;
+ using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>;
+ using difference_type = range_difference_t<_Base>;
- _LIBCPP_HIDE_FROM_ABI
- __iterator() requires default_initializable<iterator_t<_Base>> = default;
+ _LIBCPP_HIDE_FROM_ABI __iterator()
+ requires default_initializable<iterator_t<_Base>>
+ = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current)
- : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current)
+ : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
// Note: `__i` should always be `__iterator<false>`, but directly using
// `__iterator<false>` is ill-formed when `_Const` is false
// (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
+ : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr const iterator_t<_Base>& base() const& noexcept {
- return __current_;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator_t<_Base> base() && {
- return std::move(__current_);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator*() const
- noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_)))
- {
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
+ noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) {
return std::invoke(*__parent_->__func_, *__current_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
++__current_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++__current_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
requires forward_range<_Base>
{
auto __tmp = *this;
@@ -243,16 +228,14 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
requires bidirectional_range<_Base>
{
--__current_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
requires bidirectional_range<_Base>
{
auto __tmp = *this;
@@ -260,104 +243,88 @@ public:
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
requires random_access_range<_Base>
{
__current_ += __n;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
requires random_access_range<_Base>
{
__current_ -= __n;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](difference_type __n) const
- noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n])))
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
+ noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n])))
requires random_access_range<_Base>
{
return std::invoke(*__parent_->__func_, __current_[__n]);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
requires equality_comparable<iterator_t<_Base>>
{
return __x.__current_ == __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ < __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ > __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ <= __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base>
{
return __x.__current_ >= __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
{
return __x.__current_ <=> __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(__iterator __i, difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
requires random_access_range<_Base>
{
return __iterator{*__i.__parent_, __i.__current_ + __n};
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, __iterator __i)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
requires random_access_range<_Base>
{
return __iterator{*__i.__parent_, __i.__current_ + __n};
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(__iterator __i, difference_type __n)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
requires random_access_range<_Base>
{
return __iterator{*__i.__parent_, __i.__current_ - __n};
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
{
return __x.__current_ - __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr decltype(auto) iter_move(const __iterator& __i)
- noexcept(noexcept(*__i))
- {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) iter_move(const __iterator& __i) noexcept(noexcept(*__i)) {
if constexpr (is_lvalue_reference_v<decltype(*__i)>)
return std::move(*__i);
else
@@ -374,53 +341,46 @@ template <input_range _View, copy_constructible _Fn>
template <bool _Const>
class transform_view<_View, _Fn>::__sentinel {
using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
+ using _Base = __maybe_const<_Const, _View>;
sentinel_t<_Base> __end_ = sentinel_t<_Base>();
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__iterator;
- template<bool>
+ template <bool>
friend class transform_view<_View, _Fn>::__sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {}
// Note: `__i` should always be `__sentinel<false>`, but directly using
// `__sentinel<false>` is ill-formed when `_Const` is false
// (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__i.__end_)) {}
+ : __end_(std::move(__i.__end_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr sentinel_t<_Base> base() const { return __end_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
- template<bool _OtherConst>
+ template <bool _OtherConst>
requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
return __x.__current_ == __y.__end_;
}
- template<bool _OtherConst>
+ template <bool _OtherConst>
requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
return __x.__current_ - __y.__end_;
}
- template<bool _OtherConst>
+ template <bool _OtherConst>
requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
return __x.__end_ - __y.__current_;
}
@@ -428,25 +388,25 @@ public:
namespace views {
namespace __transform {
- struct __fn {
- template<class _Range, class _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Fn&& __f) const
+struct __fn {
+ template <class _Range, class _Fn>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Fn&& __f) const
noexcept(noexcept(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))))
- -> decltype( transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)))
- { return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f)); }
-
- template<class _Fn>
- requires constructible_from<decay_t<_Fn>, _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Fn&& __f) const
- noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>)
- { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f))); }
- };
+ -> decltype(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))) {
+ return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f));
+ }
+
+ template <class _Fn>
+ requires constructible_from<decay_t<_Fn>, _Fn>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) {
+ return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f)));
+ }
+};
} // namespace __transform
inline namespace __cpo {
- inline constexpr auto transform = __transform::__fn{};
+inline constexpr auto transform = __transform::__fn{};
} // namespace __cpo
} // namespace views
diff --git a/contrib/llvm-project/libcxx/include/__ranges/view_interface.h b/contrib/llvm-project/libcxx/include/__ranges/view_interface.h
index e548355d29a4..84dd1c316de3 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/view_interface.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/view_interface.h
@@ -35,135 +35,119 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _Derived>
+template <class _Derived>
requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>>
class view_interface {
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Derived& __derived() noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Derived& __derived() noexcept {
static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
return static_cast<_Derived&>(*this);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Derived const& __derived() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Derived const& __derived() const noexcept {
static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
return static_cast<_Derived const&>(*this);
}
public:
- template<class _D2 = _Derived>
+ template <class _D2 = _Derived>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
requires forward_range<_D2>
{
return ranges::begin(__derived()) == ranges::end(__derived());
}
- template<class _D2 = _Derived>
+ template <class _D2 = _Derived>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
requires forward_range<const _D2>
{
return ranges::begin(__derived()) == ranges::end(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool()
- requires requires (_D2& __t) { ranges::empty(__t); }
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool()
+ requires requires(_D2& __t) { ranges::empty(__t); }
{
return !ranges::empty(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const
- requires requires (const _D2& __t) { ranges::empty(__t); }
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const
+ requires requires(const _D2& __t) { ranges::empty(__t); }
{
return !ranges::empty(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data()
requires contiguous_iterator<iterator_t<_D2>>
{
return std::to_address(ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto data() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
requires range<const _D2> && contiguous_iterator<iterator_t<const _D2>>
{
return std::to_address(ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
requires forward_range<_D2> && sized_sentinel_for<sentinel_t<_D2>, iterator_t<_D2>>
{
return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
requires forward_range<const _D2> && sized_sentinel_for<sentinel_t<const _D2>, iterator_t<const _D2>>
{
return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) front()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front()
requires forward_range<_D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
return *ranges::begin(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) front() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front() const
requires forward_range<const _D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
return *ranges::begin(__derived());
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) back()
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back()
requires bidirectional_range<_D2> && common_range<_D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
return *ranges::prev(ranges::end(__derived()));
}
- template<class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) back() const
+ template <class _D2 = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back() const
requires bidirectional_range<const _D2> && common_range<const _D2>
{
- _LIBCPP_ASSERT_UNCATEGORIZED(!empty(),
- "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
return *ranges::prev(ranges::end(__derived()));
}
- template<random_access_range _RARange = _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](range_difference_t<_RARange> __index)
- {
+ template <random_access_range _RARange = _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) {
return ranges::begin(__derived())[__index];
}
- template<random_access_range _RARange = const _Derived>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const
- {
+ template <random_access_range _RARange = const _Derived>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const {
return ranges::begin(__derived())[__index];
}
};
diff --git a/contrib/llvm-project/libcxx/include/__ranges/views.h b/contrib/llvm-project/libcxx/include/__ranges/views.h
index 906c4e46c343..a4de2a5e52a9 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/views.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/views.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-namespace views { }
+namespace views {}
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__ranges/zip_view.h b/contrib/llvm-project/libcxx/include/__ranges/zip_view.h
index 2fd1fb30475a..4898c0afc87a 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/zip_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/zip_view.h
@@ -52,9 +52,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class... _Ranges>
-concept __zip_is_common = (sizeof...(_Ranges) == 1 && (common_range<_Ranges> && ...)) ||
- (!(bidirectional_range<_Ranges> && ...) && (common_range<_Ranges> && ...)) ||
- ((random_access_range<_Ranges> && ...) && (sized_range<_Ranges> && ...));
+concept __zip_is_common =
+ (sizeof...(_Ranges) == 1 && (common_range<_Ranges> && ...)) ||
+ (!(bidirectional_range<_Ranges> && ...) && (common_range<_Ranges> && ...)) ||
+ ((random_access_range<_Ranges> && ...) && (sized_range<_Ranges> && ...));
template <typename _Tp, typename _Up>
auto __tuple_or_pair_test() -> pair<_Tp, _Up>;
@@ -87,31 +88,39 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __tuple_for_each(_Fun&& __f, _Tuple&& __tup
template <class _Fun, class _Tuple1, class _Tuple2, size_t... _Indices>
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_or_pair<
- invoke_result_t<_Fun&, typename tuple_element<_Indices, remove_cvref_t<_Tuple1>>::type,
+ invoke_result_t<_Fun&,
+ typename tuple_element<_Indices, remove_cvref_t<_Tuple1>>::type,
typename tuple_element<_Indices, remove_cvref_t<_Tuple2>>::type>...>
__tuple_zip_transform(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2, index_sequence<_Indices...>) {
- return {std::invoke(__f, std::get<_Indices>(std::forward<_Tuple1>(__tuple1)),
+ return {std::invoke(__f,
+ std::get<_Indices>(std::forward<_Tuple1>(__tuple1)),
std::get<_Indices>(std::forward<_Tuple2>(__tuple2)))...};
}
template <class _Fun, class _Tuple1, class _Tuple2>
_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_zip_transform(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2) {
- return ranges::__tuple_zip_transform(__f, std::forward<_Tuple1>(__tuple1), std::forward<_Tuple2>(__tuple2),
- std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
+ return ranges::__tuple_zip_transform(
+ __f,
+ std::forward<_Tuple1>(__tuple1),
+ std::forward<_Tuple2>(__tuple2),
+ std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
}
template <class _Fun, class _Tuple1, class _Tuple2, size_t... _Indices>
-_LIBCPP_HIDE_FROM_ABI constexpr void __tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2,
- index_sequence<_Indices...>) {
- (std::invoke(__f, std::get<_Indices>(std::forward<_Tuple1>(__tuple1)),
- std::get<_Indices>(std::forward<_Tuple2>(__tuple2))),
+_LIBCPP_HIDE_FROM_ABI constexpr void
+__tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2, index_sequence<_Indices...>) {
+ (std::invoke(
+ __f, std::get<_Indices>(std::forward<_Tuple1>(__tuple1)), std::get<_Indices>(std::forward<_Tuple2>(__tuple2))),
...);
}
template <class _Fun, class _Tuple1, class _Tuple2>
_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2) {
- return ranges::__tuple_zip_for_each(__f, std::forward<_Tuple1>(__tuple1), std::forward<_Tuple2>(__tuple2),
- std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
+ return ranges::__tuple_zip_for_each(
+ __f,
+ std::forward<_Tuple1>(__tuple1),
+ std::forward<_Tuple2>(__tuple2),
+ std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
}
template <class _Tuple1, class _Tuple2>
@@ -130,7 +139,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __abs(_Tp __t) {
template <input_range... _Views>
requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
class zip_view : public view_interface<zip_view<_Views...>> {
-
_LIBCPP_NO_UNIQUE_ADDRESS tuple<_Views...> __views_;
template <bool>
@@ -140,27 +148,25 @@ class zip_view : public view_interface<zip_view<_Views...>> {
class __sentinel;
public:
- _LIBCPP_HIDE_FROM_ABI
- zip_view() = default;
+ _LIBCPP_HIDE_FROM_ABI zip_view() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin()
- requires(!(__simple_view<_Views> && ...)) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
+ requires(!(__simple_view<_Views> && ...))
+ {
return __iterator<false>(ranges::__tuple_transform(ranges::begin, __views_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto begin() const
- requires(range<const _Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires(range<const _Views> && ...)
+ {
return __iterator<true>(ranges::__tuple_transform(ranges::begin, __views_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end()
- requires(!(__simple_view<_Views> && ...)) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end()
+ requires(!(__simple_view<_Views> && ...))
+ {
if constexpr (!__zip_is_common<_Views...>) {
return __sentinel<false>(ranges::__tuple_transform(ranges::end, __views_));
} else if constexpr ((random_access_range<_Views> && ...)) {
@@ -170,9 +176,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto end() const
- requires(range<const _Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires(range<const _Views> && ...)
+ {
if constexpr (!__zip_is_common<const _Views...>) {
return __sentinel<true>(ranges::__tuple_transform(ranges::end, __views_));
} else if constexpr ((random_access_range<const _Views> && ...)) {
@@ -182,9 +188,9 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size()
- requires(sized_range<_Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires(sized_range<_Views> && ...)
+ {
return std::apply(
[](auto... __sizes) {
using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
@@ -193,9 +199,9 @@ public:
ranges::__tuple_transform(ranges::size, __views_));
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto size() const
- requires(sized_range<const _Views> && ...) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires(sized_range<const _Views> && ...)
+ {
return std::apply(
[](auto... __sizes) {
using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
@@ -243,11 +249,10 @@ template <input_range... _Views>
requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
template <bool _Const>
class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base<_Const, _Views...> {
-
__tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current_;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __iterator(__tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current)
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(
+ __tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current)
: __current_(std::move(__current)) {}
template <bool>
@@ -260,78 +265,73 @@ class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base
public:
using iterator_concept = decltype(__get_zip_view_iterator_tag<_Const, _Views...>());
- using value_type = __tuple_or_pair<range_value_t<__maybe_const<_Const, _Views>>...>;
- using difference_type = common_type_t<range_difference_t<__maybe_const<_Const, _Views>>...>;
+ using value_type = __tuple_or_pair<range_value_t<__maybe_const<_Const, _Views>>...>;
+ using difference_type = common_type_t<range_difference_t<__maybe_const<_Const, _Views>>...>;
- _LIBCPP_HIDE_FROM_ABI
- __iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI __iterator() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator(__iterator<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<__maybe_const<_Const, _Views>>> && ...)
- : __current_(std::move(__i.__current_)) {}
+ : __current_(std::move(__i.__current_)) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator*() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
return ranges::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
ranges::__tuple_for_each([](auto& __i) { ++__i; }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator++(int) { ++*this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator++(int)
- requires __zip_all_forward<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires __zip_all_forward<_Const, _Views...>
+ {
auto __tmp = *this;
++*this;
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator--()
- requires __zip_all_bidirectional<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires __zip_all_bidirectional<_Const, _Views...>
+ {
ranges::__tuple_for_each([](auto& __i) { --__i; }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator operator--(int)
- requires __zip_all_bidirectional<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires __zip_all_bidirectional<_Const, _Views...>
+ {
auto __tmp = *this;
--*this;
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator+=(difference_type __x)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __x)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
ranges::__tuple_for_each([&]<class _Iter>(_Iter& __i) { __i += iter_difference_t<_Iter>(__x); }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __iterator& operator-=(difference_type __x)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __x)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
ranges::__tuple_for_each([&]<class _Iter>(_Iter& __i) { __i -= iter_difference_t<_Iter>(__x); }, __current_);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator[](difference_type __n) const
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return ranges::__tuple_transform(
[&]<class _Iter>(_Iter& __i) -> decltype(auto) { return __i[iter_difference_t<_Iter>(__n)]; }, __current_);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires(equality_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ requires(equality_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
+ {
if constexpr (__zip_all_bidirectional<_Const, _Views...>) {
return __x.__current_ == __y.__current_;
} else {
@@ -339,85 +339,85 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return __x.__current_ < __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return __y < __x;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return !(__y < __x);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return !(__x < __y);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
requires __zip_all_random_access<_Const, _Views...> &&
- (three_way_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...) {
+ (three_way_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
+ {
return __x.__current_ <=> __y.__current_;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
auto __r = __i;
__r += __n;
return __r;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
return __i + __n;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
- requires __zip_all_random_access<_Const, _Views...> {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
+ requires __zip_all_random_access<_Const, _Views...>
+ {
auto __r = __i;
__r -= __n;
return __r;
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
+ _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
requires(sized_sentinel_for<iterator_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> &&
- ...) {
+ ...)
+ {
const auto __diffs = ranges::__tuple_zip_transform(minus<>(), __x.__current_, __y.__current_);
return std::apply(
[](auto... __ds) {
- return ranges::min({difference_type(__ds)...},
- [](auto __a, auto __b) { return ranges::__abs(__a) < ranges::__abs(__b); });
+ return ranges::min({difference_type(__ds)...}, [](auto __a, auto __b) {
+ return ranges::__abs(__a) < ranges::__abs(__b);
+ });
},
__diffs);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr auto iter_move(const __iterator& __i) noexcept(
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
(noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) &&
(is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) {
return ranges::__tuple_transform(ranges::iter_move, __i.__current_);
}
- _LIBCPP_HIDE_FROM_ABI
- friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept(
+ _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept(
(noexcept(ranges::iter_swap(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>(),
std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) &&
...))
- requires(indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>> && ...) {
+ requires(indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
+ {
ranges::__tuple_zip_for_each(ranges::iter_swap, __l.__current_, __r.__current_);
}
};
@@ -426,11 +426,11 @@ template <input_range... _Views>
requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
template <bool _Const>
class zip_view<_Views...>::__sentinel {
-
__tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end_;
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __sentinel(__tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end) : __end_(__end) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(
+ __tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end)
+ : __end_(__end) {}
friend class zip_view<_Views...>;
@@ -442,13 +442,11 @@ class zip_view<_Views...>::__sentinel {
}
public:
- _LIBCPP_HIDE_FROM_ABI
- __sentinel() = default;
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __sentinel(__sentinel<!_Const> __i)
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
requires _Const && (convertible_to<sentinel_t<_Views>, sentinel_t<__maybe_const<_Const, _Views>>> && ...)
- : __end_(std::move(__i.__end_)) {}
+ : __end_(std::move(__i.__end_)) {}
template <bool _OtherConst>
requires(sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> &&
@@ -467,8 +465,9 @@ public:
return std::apply(
[](auto... __ds) {
using _Diff = common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...>;
- return ranges::min({_Diff(__ds)...},
- [](auto __a, auto __b) { return ranges::__abs(__a) < ranges::__abs(__b); });
+ return ranges::min({_Diff(__ds)...}, [](auto __a, auto __b) {
+ return ranges::__abs(__a) < ranges::__abs(__b);
+ });
},
__diffs);
}
@@ -502,7 +501,7 @@ struct __fn {
} // namespace __zip
inline namespace __cpo {
- inline constexpr auto zip = __zip::__fn{};
+inline constexpr auto zip = __zip::__fn{};
} // namespace __cpo
} // namespace views
} // namespace ranges
diff --git a/contrib/llvm-project/libcxx/include/__split_buffer b/contrib/llvm-project/libcxx/include/__split_buffer
index 07dedba5e801..aaf955685d2d 100644
--- a/contrib/llvm-project/libcxx/include/__split_buffer
+++ b/contrib/llvm-project/libcxx/include/__split_buffer
@@ -43,7 +43,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
// __split_buffer allocates a contiguous chunk of memory and stores objects in the range [__begin_, __end_).
@@ -51,8 +50,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// it to grow both in the front and back without having to move the data.
template <class _Tp, class _Allocator = allocator<_Tp> >
-struct __split_buffer
-{
+struct __split_buffer {
public:
using value_type = _Tp;
using allocator_type = _Allocator;
@@ -75,7 +73,7 @@ public:
using __alloc_ref = __add_lvalue_reference_t<allocator_type>;
using __alloc_const_ref = __add_lvalue_reference_t<allocator_type>;
- __split_buffer(const __split_buffer&) = delete;
+ __split_buffer(const __split_buffer&) = delete;
__split_buffer& operator=(const __split_buffer&) = delete;
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer()
@@ -161,20 +159,19 @@ public:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x);
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(_InputIter __first, _InputIter __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(_InputIter __first, _InputIter __last);
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last);
template <class _Iterator>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end_with_size(_Iterator __first, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end_with_size(_Iterator __first, size_type __n);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_begin(pointer __new_begin) {
__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());
@@ -221,29 +218,23 @@ private:
};
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-__split_buffer<_Tp, _Allocator>::__invariants() const
-{
- if (__first_ == nullptr)
- {
- if (__begin_ != nullptr)
- return false;
- if (__end_ != nullptr)
- return false;
- if (__end_cap() != nullptr)
- return false;
- }
- else
- {
- if (__begin_ < __first_)
- return false;
- if (__end_ < __begin_)
- return false;
- if (__end_cap() < __end_)
- return false;
- }
- return true;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 bool __split_buffer<_Tp, _Allocator>::__invariants() const {
+ if (__first_ == nullptr) {
+ if (__begin_ != nullptr)
+ return false;
+ if (__end_ != nullptr)
+ return false;
+ if (__end_cap() != nullptr)
+ return false;
+ } else {
+ if (__begin_ < __first_)
+ return false;
+ if (__end_ < __begin_)
+ return false;
+ if (__end_cap() < __end_)
+ return false;
+ }
+ return true;
}
// Default constructs __n objects starting at __end_
@@ -252,14 +243,11 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
-{
- _ConstructTransaction __tx(&this->__end_, __n);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_));
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) {
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_));
+ }
}
// Copy constructs __n objects starting at __end_ from __x
@@ -269,413 +257,315 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
-{
- _ConstructTransaction __tx(&this->__end_, __n);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(this->__alloc(),
- std::__to_address(__tx.__pos_), __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) {
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_), __x);
+ }
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) {
__construct_at_end_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
- __alloc_rr& __a = this->__alloc();
- for (; __first != __last; ++__first)
- {
- if (__end_ == __end_cap())
- {
- size_type __old_cap = __end_cap() - __first_;
- size_type __new_cap = std::max<size_type>(2 * __old_cap, 8);
- __split_buffer __buf(__new_cap, 0, __a);
- for (pointer __p = __begin_; __p != __end_; ++__p, (void) ++__buf.__end_)
- __alloc_traits::construct(__buf.__alloc(),
- std::__to_address(__buf.__end_), std::move(*__p));
- swap(__buf);
- }
- __alloc_traits::construct(__a, std::__to_address(this->__end_), *__first);
- ++this->__end_;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
+ __alloc_rr& __a = this->__alloc();
+ for (; __first != __last; ++__first) {
+ if (__end_ == __end_cap()) {
+ size_type __old_cap = __end_cap() - __first_;
+ size_type __new_cap = std::max<size_type>(2 * __old_cap, 8);
+ __split_buffer __buf(__new_cap, 0, __a);
+ for (pointer __p = __begin_; __p != __end_; ++__p, (void)++__buf.__end_)
+ __alloc_traits::construct(__buf.__alloc(), std::__to_address(__buf.__end_), std::move(*__p));
+ swap(__buf);
}
+ __alloc_traits::construct(__a, std::__to_address(this->__end_), *__first);
+ ++this->__end_;
+ }
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) {
__construct_at_end_with_size(__first, std::distance(__first, __last));
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void __split_buffer<_Tp, _Allocator>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) {
- _ConstructTransaction __tx(&this->__end_, __n);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void) ++__first) {
- __alloc_traits::construct(this->__alloc(),
- std::__to_address(__tx.__pos_), *__first);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__split_buffer<_Tp, _Allocator>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) {
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__first) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_), *__first);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
-{
- while (__begin_ != __new_begin)
- __alloc_traits::destroy(__alloc(), std::__to_address(__begin_++));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
+__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) {
+ while (__begin_ != __new_begin)
+ __alloc_traits::destroy(__alloc(), std::__to_address(__begin_++));
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
-{
- __begin_ = __new_begin;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
+__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) {
+ __begin_ = __new_begin;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
-{
- while (__new_last != __end_)
- __alloc_traits::destroy(__alloc(), std::__to_address(--__end_));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT {
+ while (__new_last != __end_)
+ __alloc_traits::destroy(__alloc(), std::__to_address(--__end_));
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
-{
- __end_ = __new_last;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT {
+ __end_ = __new_last;
}
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
- : __end_cap_(nullptr, __a)
-{
- if (__cap == 0) {
- __first_ = nullptr;
- } else {
- auto __allocation = std::__allocate_at_least(__alloc(), __cap);
- __first_ = __allocation.ptr;
- __cap = __allocation.count;
- }
- __begin_ = __end_ = __first_ + __start;
- __end_cap() = __first_ + __cap;
+ : __end_cap_(nullptr, __a) {
+ if (__cap == 0) {
+ __first_ = nullptr;
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __cap);
+ __first_ = __allocation.ptr;
+ __cap = __allocation.count;
+ }
+ __begin_ = __end_ = __first_ + __start;
+ __end_cap() = __first_ + __cap;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-__split_buffer<_Tp, _Allocator>::~__split_buffer()
-{
- clear();
- if (__first_)
- __alloc_traits::deallocate(__alloc(), __first_, capacity());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::~__split_buffer() {
+ clear();
+ if (__first_)
+ __alloc_traits::deallocate(__alloc(), __first_, capacity());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __first_(std::move(__c.__first_)),
__begin_(std::move(__c.__begin_)),
__end_(std::move(__c.__end_)),
- __end_cap_(std::move(__c.__end_cap_))
-{
- __c.__first_ = nullptr;
- __c.__begin_ = nullptr;
- __c.__end_ = nullptr;
- __c.__end_cap() = nullptr;
+ __end_cap_(std::move(__c.__end_cap_)) {
+ __c.__first_ = nullptr;
+ __c.__begin_ = nullptr;
+ __c.__end_ = nullptr;
+ __c.__end_cap() = nullptr;
}
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
- : __end_cap_(nullptr, __a)
-{
- if (__a == __c.__alloc())
- {
- __first_ = __c.__first_;
- __begin_ = __c.__begin_;
- __end_ = __c.__end_;
- __end_cap() = __c.__end_cap();
- __c.__first_ = nullptr;
- __c.__begin_ = nullptr;
- __c.__end_ = nullptr;
- __c.__end_cap() = nullptr;
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __c.size());
- __first_ = __allocation.ptr;
- __begin_ = __end_ = __first_;
- __end_cap() = __first_ + __allocation.count;
- typedef move_iterator<iterator> _Ip;
- __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
- }
+ : __end_cap_(nullptr, __a) {
+ if (__a == __c.__alloc()) {
+ __first_ = __c.__first_;
+ __begin_ = __c.__begin_;
+ __end_ = __c.__end_;
+ __end_cap() = __c.__end_cap();
+ __c.__first_ = nullptr;
+ __c.__begin_ = nullptr;
+ __c.__end_ = nullptr;
+ __c.__end_cap() = nullptr;
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __c.size());
+ __first_ = __allocation.ptr;
+ __begin_ = __end_ = __first_;
+ __end_cap() = __first_ + __allocation.count;
+ typedef move_iterator<iterator> _Ip;
+ __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-__split_buffer<_Tp, _Allocator>&
+_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>&
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
- !__alloc_traits::propagate_on_container_move_assignment::value)
-{
- clear();
- shrink_to_fit();
- __first_ = __c.__first_;
- __begin_ = __c.__begin_;
- __end_ = __c.__end_;
- __end_cap() = __c.__end_cap();
- __move_assign_alloc(__c,
- integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());
- __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
- return *this;
+ !__alloc_traits::propagate_on_container_move_assignment::value) {
+ clear();
+ shrink_to_fit();
+ __first_ = __c.__first_;
+ __begin_ = __c.__begin_;
+ __end_ = __c.__end_;
+ __end_cap() = __c.__end_cap();
+ __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
+ return *this;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
- __is_nothrow_swappable<__alloc_rr>::value)
-{
- std::swap(__first_, __x.__first_);
- std::swap(__begin_, __x.__begin_);
- std::swap(__end_, __x.__end_);
- std::swap(__end_cap(), __x.__end_cap());
- std::__swap_allocator(__alloc(), __x.__alloc());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__alloc_rr>::value) {
+ std::swap(__first_, __x.__first_);
+ std::swap(__begin_, __x.__begin_);
+ std::swap(__end_, __x.__end_);
+ std::swap(__end_cap(), __x.__end_cap());
+ std::__swap_allocator(__alloc(), __x.__alloc());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::reserve(size_type __n)
-{
- if (__n < capacity())
- {
- __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::reserve(size_type __n) {
+ if (__n < capacity()) {
+ __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- if (capacity() > size())
- {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ if (capacity() > size()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- __t.__end_ = __t.__begin_ + (__end_ - __begin_);
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
+ __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ __t.__end_ = __t.__begin_ + (__end_ - __begin_);
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
-{
- if (__begin_ == __first_)
- {
- if (__end_ < __end_cap())
- {
- difference_type __d = __end_cap() - __end_;
- __d = (__d + 1) / 2;
- __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
- __end_ += __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) {
+ if (__begin_ == __first_) {
+ if (__end_ < __end_cap()) {
+ difference_type __d = __end_cap() - __end_;
+ __d = (__d + 1) / 2;
+ __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
+ __end_ += __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__begin_-1), __x);
- --__begin_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__begin_ - 1), __x);
+ --__begin_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
-{
- if (__begin_ == __first_)
- {
- if (__end_ < __end_cap())
- {
- difference_type __d = __end_cap() - __end_;
- __d = (__d + 1) / 2;
- __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
- __end_ += __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) {
+ if (__begin_ == __first_) {
+ if (__end_ < __end_cap()) {
+ difference_type __d = __end_cap() - __end_;
+ __d = (__d + 1) / 2;
+ __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
+ __end_ += __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__begin_-1),
- std::move(__x));
- --__begin_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__begin_ - 1), std::move(__x));
+ --__begin_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
-{
- if (__end_ == __end_cap())
- {
- if (__begin_ > __first_)
- {
- difference_type __d = __begin_ - __first_;
- __d = (__d + 1) / 2;
- __end_ = std::move(__begin_, __end_, __begin_ - __d);
- __begin_ -= __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+__split_buffer<_Tp, _Allocator>::push_back(const_reference __x) {
+ if (__end_ == __end_cap()) {
+ if (__begin_ > __first_) {
+ difference_type __d = __begin_ - __first_;
+ __d = (__d + 1) / 2;
+ __end_ = std::move(__begin_, __end_, __begin_ - __d);
+ __begin_ -= __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__end_), __x);
- ++__end_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__end_), __x);
+ ++__end_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
-{
- if (__end_ == __end_cap())
- {
- if (__begin_ > __first_)
- {
- difference_type __d = __begin_ - __first_;
- __d = (__d + 1) / 2;
- __end_ = std::move(__begin_, __end_, __begin_ - __d);
- __begin_ -= __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) {
+ if (__end_ == __end_cap()) {
+ if (__begin_ > __first_) {
+ difference_type __d = __begin_ - __first_;
+ __d = (__d + 1) / 2;
+ __end_ = std::move(__begin_, __end_, __begin_ - __d);
+ __begin_ -= __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__end_),
- std::move(__x));
- ++__end_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__end_), std::move(__x));
+ ++__end_;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
-{
- if (__end_ == __end_cap())
- {
- if (__begin_ > __first_)
- {
- difference_type __d = __begin_ - __first_;
- __d = (__d + 1) / 2;
- __end_ = std::move(__begin_, __end_, __begin_ - __d);
- __begin_ -= __d;
- }
- else
- {
- size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
- __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
- __t.__construct_at_end(move_iterator<pointer>(__begin_),
- move_iterator<pointer>(__end_));
- std::swap(__first_, __t.__first_);
- std::swap(__begin_, __t.__begin_);
- std::swap(__end_, __t.__end_);
- std::swap(__end_cap(), __t.__end_cap());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
+ if (__end_ == __end_cap()) {
+ if (__begin_ > __first_) {
+ difference_type __d = __begin_ - __first_;
+ __d = (__d + 1) / 2;
+ __end_ = std::move(__begin_, __end_, __begin_ - __d);
+ __begin_ -= __d;
+ } else {
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
+ __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
+ std::swap(__first_, __t.__first_);
+ std::swap(__begin_, __t.__begin_);
+ std::swap(__end_, __t.__end_);
+ std::swap(__end_cap(), __t.__end_cap());
}
- __alloc_traits::construct(__alloc(), std::__to_address(__end_),
- std::forward<_Args>(__args)...);
- ++__end_;
+ }
+ __alloc_traits::construct(__alloc(), std::__to_address(__end_), std::forward<_Args>(__args)...);
+ ++__end_;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__string/char_traits.h b/contrib/llvm-project/libcxx/include/__string/char_traits.h
index 9ec78dc3936d..e3563c57fea0 100644
--- a/contrib/llvm-project/libcxx/include/__string/char_traits.h
+++ b/contrib/llvm-project/libcxx/include/__string/char_traits.h
@@ -27,7 +27,7 @@
#include <iosfwd>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-# include <cwchar> // for wmemcpy
+# include <cwchar> // for wmemcpy
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -78,210 +78,220 @@ exposition-only to document what members a char_traits specialization should pro
//
#if !defined(_LIBCPP_CHAR_TRAITS_REMOVE_BASE_SPECIALIZATION)
template <class _CharT>
-struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 19, so please migrate off of it.")
- char_traits
-{
- using char_type = _CharT;
- using int_type = int;
- using off_type = streamoff;
- using pos_type = streampos;
- using state_type = mbstate_t;
-
- static inline void _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
-
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- int compare(const char_type* __s1, const char_type* __s2, size_t __n) {
- for (; __n; --__n, ++__s1, ++__s2)
- {
- if (lt(*__s1, *__s2))
- return -1;
- if (lt(*__s2, *__s1))
- return 1;
- }
- return 0;
- }
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- size_t length(const char_type* __s) {
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
- }
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) {
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+struct _LIBCPP_DEPRECATED_(
+ "char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided "
+ "for a temporary period. It will be removed in LLVM 19, so please migrate off of it.") char_traits {
+ using char_type = _CharT;
+ using int_type = int;
+ using off_type = streamoff;
+ using pos_type = streampos;
+ using state_type = mbstate_t;
+
+ static inline void _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
+
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n) {
+ for (; __n; --__n, ++__s1, ++__s2) {
+ if (lt(*__s1, *__s2))
+ return -1;
+ if (lt(*__s2, *__s1))
+ return 1;
}
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) {
- if (__n == 0) return __s1;
- char_type* __r = __s1;
- if (__s1 < __s2)
- {
- for (; __n; --__n, ++__s1, ++__s2)
- assign(*__s1, *__s2);
- }
- else if (__s2 < __s1)
- {
- __s1 += __n;
- __s2 += __n;
- for (; __n; --__n)
- assign(*--__s1, *--__s2);
- }
- return __r;
+ return 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
}
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- char_type* __r = __s1;
+ return nullptr;
+ }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) {
+ if (__n == 0)
+ return __s1;
+ char_type* __r = __s1;
+ if (__s1 < __s2) {
for (; __n; --__n, ++__s1, ++__s2)
assign(*__s1, *__s2);
- return __r;
- }
- _LIBCPP_HIDE_FROM_ABI
- static _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) {
- char_type* __r = __s;
- for (; __n; --__n, ++__s)
- assign(*__s, __a);
- return __r;
+ } else if (__s2 < __s1) {
+ __s1 += __n;
+ __s2 += __n;
+ for (; __n; --__n)
+ assign(*--__s1, *--__s2);
}
+ return __r;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ char_type* __r = __s1;
+ for (; __n; --__n, ++__s1, ++__s2)
+ assign(*__s1, *__s2);
+ return __r;
+ }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) {
+ char_type* __r = __s;
+ for (; __n; --__n, ++__s)
+ assign(*__s, __a);
+ return __r;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(EOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(EOF); }
};
#endif // !defined(_LIBCPP_CHAR_TRAITS_REMOVE_BASE_SPECIALIZATION)
// char_traits<char>
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char>
-{
- using char_type = char;
- using int_type = int;
- using off_type = streamoff;
- using pos_type = streampos;
- using state_type = mbstate_t;
+struct _LIBCPP_TEMPLATE_VIS char_traits<char> {
+ using char_type = char;
+ using int_type = int;
+ using off_type = streamoff;
+ using pos_type = streampos;
+ using state_type = mbstate_t;
#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
+ using comparison_category = strong_ordering;
#endif
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- static inline _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return (unsigned char)__c1 < (unsigned char)__c2;}
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ static inline _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return (unsigned char)__c1 < (unsigned char)__c2;
+ }
- // __constexpr_memcmp requires a trivially lexicographically comparable type, but char is not when char is a signed type
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
- compare(const char_type* __lhs, const char_type* __rhs, size_t __count) _NOEXCEPT {
- if (__libcpp_is_constant_evaluated()) {
+ // __constexpr_memcmp requires a trivially lexicographically comparable type, but char is not when char is a signed
+ // type
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __lhs, const char_type* __rhs, size_t __count) _NOEXCEPT {
+ if (__libcpp_is_constant_evaluated()) {
#ifdef _LIBCPP_COMPILER_CLANG_BASED
- return __builtin_memcmp(__lhs, __rhs, __count);
+ return __builtin_memcmp(__lhs, __rhs, __count);
#else
- while (__count != 0) {
- if (lt(*__lhs, *__rhs))
- return -1;
- if (lt(*__rhs, *__lhs))
- return 1;
-
- __count -= sizeof(char_type);
- ++__lhs;
- ++__rhs;
- }
- return 0;
-#endif // _LIBCPP_COMPILER_CLANG_BASED
- } else {
- return __builtin_memcmp(__lhs, __rhs, __count);
+ while (__count != 0) {
+ if (lt(*__lhs, *__rhs))
+ return -1;
+ if (lt(*__rhs, *__lhs))
+ return 1;
+
+ __count -= sizeof(char_type);
+ ++__lhs;
+ ++__rhs;
}
+ return 0;
+#endif // _LIBCPP_COMPILER_CLANG_BASED
+ } else {
+ return __builtin_memcmp(__lhs, __rhs, __count);
}
+ }
- static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT {
- return std::__constexpr_strlen(__s);
- }
+ static inline _LIBCPP_HIDE_FROM_ABI size_t _LIBCPP_CONSTEXPR_SINCE_CXX17 length(const char_type* __s) _NOEXCEPT {
+ return std::__constexpr_strlen(__s);
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
- if (__n == 0)
- return nullptr;
- return std::__constexpr_memchr(__s, __a, __n);
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ if (__n == 0)
+ return nullptr;
+ return std::__constexpr_memchr(__s, __a, __n);
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type((unsigned char)__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(EOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type((unsigned char)__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(EOF); }
};
// char_traits<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
-{
- using char_type = wchar_t;
- using int_type = wint_t;
- using off_type = streamoff;
- using pos_type = streampos;
- using state_type = mbstate_t;
-#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
-#endif
-
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
+struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> {
+ using char_type = wchar_t;
+ using int_type = wint_t;
+ using off_type = streamoff;
+ using pos_type = streampos;
+ using state_type = mbstate_t;
+# if _LIBCPP_STD_VER >= 20
+ using comparison_category = strong_ordering;
+# endif
+
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 int
compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
@@ -294,341 +304,325 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
return std::__constexpr_wcslen(__s);
}
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
if (__n == 0)
- return nullptr;
+ return nullptr;
return std::__constexpr_wmemchr(__s, __a, __n);
}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(WEOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(WEOF); }
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
-{
- using char_type = char8_t;
- using int_type = unsigned int;
- using off_type = streamoff;
- using pos_type = u8streampos;
- using state_type = mbstate_t;
-#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
-#endif
-
- static inline _LIBCPP_HIDE_FROM_ABI constexpr void assign(char_type& __c1, const char_type& __c2) noexcept
- {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq(char_type __c1, char_type __c2) noexcept
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr bool lt(char_type __c1, char_type __c2) noexcept
- {return __c1 < __c2;}
+struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> {
+ using char_type = char8_t;
+ using int_type = unsigned int;
+ using off_type = streamoff;
+ using pos_type = u8streampos;
+ using state_type = mbstate_t;
+# if _LIBCPP_STD_VER >= 20
+ using comparison_category = strong_ordering;
+# endif
+
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr void assign(char_type& __c1, const char_type& __c2) noexcept {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq(char_type __c1, char_type __c2) noexcept {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr bool lt(char_type __c1, char_type __c2) noexcept { return __c1 < __c2; }
static _LIBCPP_HIDE_FROM_ABI constexpr int
compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memcmp(__s1, __s2, __element_count(__n));
+ return std::__constexpr_memcmp(__s1, __s2, __element_count(__n));
}
- static _LIBCPP_HIDE_FROM_ABI constexpr
- size_t length(const char_type* __s) _NOEXCEPT;
+ static _LIBCPP_HIDE_FROM_ABI constexpr size_t length(const char_type* __s) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static constexpr
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static constexpr const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type not_eof(int_type __c) noexcept
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr char_type to_char_type(int_type __c) noexcept
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type to_int_type(char_type __c) noexcept
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type eof() noexcept
- {return int_type(EOF);}
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type not_eof(int_type __c) noexcept {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr char_type to_char_type(int_type __c) noexcept { return char_type(__c); }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type to_int_type(char_type __c) noexcept { return int_type(__c); }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI constexpr int_type eof() noexcept { return int_type(EOF); }
};
// TODO use '__builtin_strlen' if it ever supports char8_t ??
-inline constexpr
-size_t
-char_traits<char8_t>::length(const char_type* __s) _NOEXCEPT
-{
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
+inline constexpr size_t char_traits<char8_t>::length(const char_type* __s) _NOEXCEPT {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
}
// TODO use '__builtin_char_memchr' if it ever supports char8_t ??
-inline constexpr
-const char8_t*
-char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
-{
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+inline constexpr const char8_t*
+char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
+ }
+ return nullptr;
}
#endif // _LIBCPP_HAS_NO_CHAR8_T
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>
-{
- using char_type = char16_t;
- using int_type = uint_least16_t;
- using off_type = streamoff;
- using pos_type = u16streampos;
- using state_type = mbstate_t;
+struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> {
+ using char_type = char16_t;
+ using int_type = uint_least16_t;
+ using off_type = streamoff;
+ using pos_type = u16streampos;
+ using state_type = mbstate_t;
#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
+ using comparison_category = strong_ordering;
#endif
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
-
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- size_t length(const char_type* __s) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
- "char_traits::copy: source and destination ranges overlap");
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
+ "char_traits::copy: source and destination ranges overlap");
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(0xFFFF);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
+
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(0xFFFF); }
};
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-int
-char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
-{
- for (; __n; --__n, ++__s1, ++__s2)
- {
- if (lt(*__s1, *__s2))
- return -1;
- if (lt(*__s2, *__s1))
- return 1;
- }
- return 0;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ for (; __n; --__n, ++__s1, ++__s2) {
+ if (lt(*__s1, *__s2))
+ return -1;
+ if (lt(*__s2, *__s1))
+ return 1;
+ }
+ return 0;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-size_t
-char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT
-{
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-const char16_t*
-char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
-{
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 const char16_t*
+char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
+ }
+ return nullptr;
}
template <>
-struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t>
-{
- using char_type = char32_t;
- using int_type = uint_least32_t;
- using off_type = streamoff;
- using pos_type = u32streampos;
- using state_type = mbstate_t;
+struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> {
+ using char_type = char32_t;
+ using int_type = uint_least32_t;
+ using off_type = streamoff;
+ using pos_type = u32streampos;
+ using state_type = mbstate_t;
#if _LIBCPP_STD_VER >= 20
- using comparison_category = strong_ordering;
+ using comparison_category = strong_ordering;
#endif
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
- {return __c1 < __c2;}
-
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- size_t length(const char_type* __s) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17
- const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
- }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void
+ assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {
+ __c1 = __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {
+ return __c1 < __c2;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
- std::copy_n(__s2, __n, __s1);
- return __s1;
- }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t length(const char_type* __s) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
- std::fill_n(__s, __n, __a);
- return __s;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ std::copy_n(__s2, __n, __s1);
+ return __s1;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type*
+ assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
- {return eq_int_type(__c, eof()) ? ~eof() : __c;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
- {return char_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
- {return int_type(__c);}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
- {return __c1 == __c2;}
- static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(0xFFFFFFFF);}
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {
+ return eq_int_type(__c, eof()) ? ~eof() : __c;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {
+ return char_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {
+ return int_type(__c);
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {
+ return __c1 == __c2;
+ }
+ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT { return int_type(0xFFFFFFFF); }
};
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-int
-char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
-{
- for (; __n; --__n, ++__s1, ++__s2)
- {
- if (lt(*__s1, *__s2))
- return -1;
- if (lt(*__s2, *__s1))
- return 1;
- }
- return 0;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 int
+char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ for (; __n; --__n, ++__s1, ++__s2) {
+ if (lt(*__s1, *__s2))
+ return -1;
+ if (lt(*__s2, *__s1))
+ return 1;
+ }
+ return 0;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-size_t
-char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT
-{
- size_t __len = 0;
- for (; !eq(*__s, char_type(0)); ++__s)
- ++__len;
- return __len;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 size_t char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT {
+ size_t __len = 0;
+ for (; !eq(*__s, char_type(0)); ++__s)
+ ++__len;
+ return __len;
}
-inline _LIBCPP_CONSTEXPR_SINCE_CXX17
-const char32_t*
-char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
-{
- for (; __n; --__n)
- {
- if (eq(*__s, __a))
- return __s;
- ++__s;
- }
- return nullptr;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX17 const char32_t*
+char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ for (; __n; --__n) {
+ if (eq(*__s, __a))
+ return __s;
+ ++__s;
+ }
+ return nullptr;
}
// helper fns for basic_string and string_view
// __str_find
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__pos >= __sz)
- return __npos;
- const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
- if (__r == nullptr)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+__str_find(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__pos >= __sz)
+ return __npos;
+ const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
+ if (__r == nullptr)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const _CharT *
-__search_substring(const _CharT *__first1, const _CharT *__last1,
- const _CharT *__first2, const _CharT *__last2) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const _CharT* __search_substring(
+ const _CharT* __first1, const _CharT* __last1, const _CharT* __first2, const _CharT* __last2) _NOEXCEPT {
// Take advantage of knowing source and pattern lengths.
// Stop short when source is smaller than pattern.
const ptrdiff_t __len2 = __last2 - __first2;
@@ -664,173 +658,140 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
}
}
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos > __sz)
- return __npos;
+__str_find(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos > __sz)
+ return __npos;
- if (__n == 0) // There is nothing to search, just return __pos.
- return __pos;
+ if (__n == 0) // There is nothing to search, just return __pos.
+ return __pos;
- const _CharT *__r = std::__search_substring<_CharT, _Traits>(
- __p + __pos, __p + __sz, __s, __s + __n);
+ const _CharT* __r = std::__search_substring<_CharT, _Traits>(__p + __pos, __p + __sz, __s, __s + __n);
- if (__r == __p + __sz)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+ if (__r == __p + __sz)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
-
// __str_rfind
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_rfind(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__sz < 1)
- return __npos;
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- {
- if (_Traits::eq(*--__ps, __c))
- return static_cast<_SizeT>(__ps - __p);
- }
+__str_rfind(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__sz < 1)
return __npos;
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;) {
+ if (_Traits::eq(*--__ps, __c))
+ return static_cast<_SizeT>(__ps - __p);
+ }
+ return __npos;
}
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_rfind(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- __pos = std::min(__pos, __sz);
- if (__n < __sz - __pos)
- __pos += __n;
- else
- __pos = __sz;
- const _CharT* __r = std::__find_end_classic(__p, __p + __pos, __s, __s + __n, _Traits::eq);
- if (__n > 0 && __r == __p + __pos)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+__str_rfind(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ __pos = std::min(__pos, __sz);
+ if (__n < __sz - __pos)
+ __pos += __n;
+ else
+ __pos = __sz;
+ const _CharT* __r = std::__find_end_classic(__p, __p + __pos, __s, __s + __n, _Traits::eq);
+ if (__n > 0 && __r == __p + __pos)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
// __str_find_first_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_first_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos >= __sz || __n == 0)
- return __npos;
- const _CharT* __r = std::__find_first_of_ce
- (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq );
- if (__r == __p + __sz)
- return __npos;
- return static_cast<_SizeT>(__r - __p);
+__str_find_first_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos >= __sz || __n == 0)
+ return __npos;
+ const _CharT* __r = std::__find_first_of_ce(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq);
+ if (__r == __p + __sz)
+ return __npos;
+ return static_cast<_SizeT>(__r - __p);
}
-
// __str_find_last_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_last_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
- {
- if (__n != 0)
- {
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- {
- const _CharT* __r = _Traits::find(__s, __n, *--__ps);
- if (__r)
- return static_cast<_SizeT>(__ps - __p);
- }
+__str_find_last_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__n != 0) {
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;) {
+ const _CharT* __r = _Traits::find(__s, __n, *--__ps);
+ if (__r)
+ return static_cast<_SizeT>(__ps - __p);
}
- return __npos;
+ }
+ return __npos;
}
-
// __str_find_first_not_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos < __sz)
- {
- const _CharT* __pe = __p + __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
- if (_Traits::find(__s, __n, *__ps) == nullptr)
- return static_cast<_SizeT>(__ps - __p);
- }
- return __npos;
+__str_find_first_not_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos < __sz) {
+ const _CharT* __pe = __p + __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
+ if (_Traits::find(__s, __n, *__ps) == nullptr)
+ return static_cast<_SizeT>(__ps - __p);
+ }
+ return __npos;
}
-
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__pos < __sz)
- {
- const _CharT* __pe = __p + __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
- if (!_Traits::eq(*__ps, __c))
- return static_cast<_SizeT>(__ps - __p);
- }
- return __npos;
+__str_find_first_not_of(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__pos < __sz) {
+ const _CharT* __pe = __p + __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
+ if (!_Traits::eq(*__ps, __c))
+ return static_cast<_SizeT>(__ps - __p);
+ }
+ return __npos;
}
-
// __str_find_last_not_of
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
- const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
-{
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- if (_Traits::find(__s, __n, *--__ps) == nullptr)
- return static_cast<_SizeT>(__ps - __p);
- return __npos;
+__str_find_last_not_of(const _CharT* __p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT {
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
+ if (_Traits::find(__s, __n, *--__ps) == nullptr)
+ return static_cast<_SizeT>(__ps - __p);
+ return __npos;
}
-
-template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
+template <class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
- _CharT __c, _SizeT __pos) _NOEXCEPT
-{
- if (__pos < __sz)
- ++__pos;
- else
- __pos = __sz;
- for (const _CharT* __ps = __p + __pos; __ps != __p;)
- if (!_Traits::eq(*--__ps, __c))
- return static_cast<_SizeT>(__ps - __p);
- return __npos;
+__str_find_last_not_of(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT {
+ if (__pos < __sz)
+ ++__pos;
+ else
+ __pos = __sz;
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
+ if (!_Traits::eq(*--__ps, __c))
+ return static_cast<_SizeT>(__ps - __p);
+ return __npos;
}
-template<class _Ptr>
-inline _LIBCPP_HIDE_FROM_ABI
-size_t __do_string_hash(_Ptr __p, _Ptr __e)
-{
- typedef typename iterator_traits<_Ptr>::value_type value_type;
- return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
+template <class _Ptr>
+inline _LIBCPP_HIDE_FROM_ABI size_t __do_string_hash(_Ptr __p, _Ptr __e) {
+ typedef typename iterator_traits<_Ptr>::value_type value_type;
+ return __murmur2_or_cityhash<size_t>()(__p, (__e - __p) * sizeof(value_type));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__system_error/errc.h b/contrib/llvm-project/libcxx/include/__system_error/errc.h
index f939c99f7ed6..a14ec56070c4 100644
--- a/contrib/llvm-project/libcxx/include/__system_error/errc.h
+++ b/contrib/llvm-project/libcxx/include/__system_error/errc.h
@@ -113,107 +113,105 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Some error codes are not present on all platforms, so we provide equivalents
// for them:
-//enum class errc
-_LIBCPP_DECLARE_STRONG_ENUM(errc)
-{
- address_family_not_supported = EAFNOSUPPORT,
- address_in_use = EADDRINUSE,
- address_not_available = EADDRNOTAVAIL,
- already_connected = EISCONN,
- argument_list_too_long = E2BIG,
- argument_out_of_domain = EDOM,
- bad_address = EFAULT,
- bad_file_descriptor = EBADF,
- bad_message = EBADMSG,
- broken_pipe = EPIPE,
- connection_aborted = ECONNABORTED,
- connection_already_in_progress = EALREADY,
- connection_refused = ECONNREFUSED,
- connection_reset = ECONNRESET,
- cross_device_link = EXDEV,
- destination_address_required = EDESTADDRREQ,
- device_or_resource_busy = EBUSY,
- directory_not_empty = ENOTEMPTY,
- executable_format_error = ENOEXEC,
- file_exists = EEXIST,
- file_too_large = EFBIG,
- filename_too_long = ENAMETOOLONG,
- function_not_supported = ENOSYS,
- host_unreachable = EHOSTUNREACH,
- identifier_removed = EIDRM,
- illegal_byte_sequence = EILSEQ,
- inappropriate_io_control_operation = ENOTTY,
+// enum class errc
+_LIBCPP_DECLARE_STRONG_ENUM(errc){
+ address_family_not_supported = EAFNOSUPPORT,
+ address_in_use = EADDRINUSE,
+ address_not_available = EADDRNOTAVAIL,
+ already_connected = EISCONN,
+ argument_list_too_long = E2BIG,
+ argument_out_of_domain = EDOM,
+ bad_address = EFAULT,
+ bad_file_descriptor = EBADF,
+ bad_message = EBADMSG,
+ broken_pipe = EPIPE,
+ connection_aborted = ECONNABORTED,
+ connection_already_in_progress = EALREADY,
+ connection_refused = ECONNREFUSED,
+ connection_reset = ECONNRESET,
+ cross_device_link = EXDEV,
+ destination_address_required = EDESTADDRREQ,
+ device_or_resource_busy = EBUSY,
+ directory_not_empty = ENOTEMPTY,
+ executable_format_error = ENOEXEC,
+ file_exists = EEXIST,
+ file_too_large = EFBIG,
+ filename_too_long = ENAMETOOLONG,
+ function_not_supported = ENOSYS,
+ host_unreachable = EHOSTUNREACH,
+ identifier_removed = EIDRM,
+ illegal_byte_sequence = EILSEQ,
+ inappropriate_io_control_operation = ENOTTY,
#ifdef EINTEGRITY
- integrity_check_failed = EINTEGRITY,
+ integrity_check_failed = EINTEGRITY,
#endif
- interrupted = EINTR,
- invalid_argument = EINVAL,
- invalid_seek = ESPIPE,
- io_error = EIO,
- is_a_directory = EISDIR,
- message_size = EMSGSIZE,
- network_down = ENETDOWN,
- network_reset = ENETRESET,
- network_unreachable = ENETUNREACH,
- no_buffer_space = ENOBUFS,
- no_child_process = ECHILD,
- no_link = ENOLINK,
- no_lock_available = ENOLCK,
+ interrupted = EINTR,
+ invalid_argument = EINVAL,
+ invalid_seek = ESPIPE,
+ io_error = EIO,
+ is_a_directory = EISDIR,
+ message_size = EMSGSIZE,
+ network_down = ENETDOWN,
+ network_reset = ENETRESET,
+ network_unreachable = ENETUNREACH,
+ no_buffer_space = ENOBUFS,
+ no_child_process = ECHILD,
+ no_link = ENOLINK,
+ no_lock_available = ENOLCK,
#ifdef ENODATA
- no_message_available = ENODATA,
+ no_message_available = ENODATA,
#else
- no_message_available = ENOMSG,
+ no_message_available = ENOMSG,
#endif
- no_message = ENOMSG,
- no_protocol_option = ENOPROTOOPT,
- no_space_on_device = ENOSPC,
+ no_message = ENOMSG,
+ no_protocol_option = ENOPROTOOPT,
+ no_space_on_device = ENOSPC,
#ifdef ENOSR
- no_stream_resources = ENOSR,
+ no_stream_resources = ENOSR,
#else
- no_stream_resources = ENOMEM,
+ no_stream_resources = ENOMEM,
#endif
- no_such_device_or_address = ENXIO,
- no_such_device = ENODEV,
- no_such_file_or_directory = ENOENT,
- no_such_process = ESRCH,
- not_a_directory = ENOTDIR,
- not_a_socket = ENOTSOCK,
+ no_such_device_or_address = ENXIO,
+ no_such_device = ENODEV,
+ no_such_file_or_directory = ENOENT,
+ no_such_process = ESRCH,
+ not_a_directory = ENOTDIR,
+ not_a_socket = ENOTSOCK,
#ifdef ENOSTR
- not_a_stream = ENOSTR,
+ not_a_stream = ENOSTR,
#else
- not_a_stream = EINVAL,
+ not_a_stream = EINVAL,
#endif
- not_connected = ENOTCONN,
- not_enough_memory = ENOMEM,
- not_supported = ENOTSUP,
- operation_canceled = ECANCELED,
- operation_in_progress = EINPROGRESS,
- operation_not_permitted = EPERM,
- operation_not_supported = EOPNOTSUPP,
- operation_would_block = EWOULDBLOCK,
- owner_dead = EOWNERDEAD,
- permission_denied = EACCES,
- protocol_error = EPROTO,
- protocol_not_supported = EPROTONOSUPPORT,
- read_only_file_system = EROFS,
- resource_deadlock_would_occur = EDEADLK,
- resource_unavailable_try_again = EAGAIN,
- result_out_of_range = ERANGE,
- state_not_recoverable = ENOTRECOVERABLE,
+ not_connected = ENOTCONN,
+ not_enough_memory = ENOMEM,
+ not_supported = ENOTSUP,
+ operation_canceled = ECANCELED,
+ operation_in_progress = EINPROGRESS,
+ operation_not_permitted = EPERM,
+ operation_not_supported = EOPNOTSUPP,
+ operation_would_block = EWOULDBLOCK,
+ owner_dead = EOWNERDEAD,
+ permission_denied = EACCES,
+ protocol_error = EPROTO,
+ protocol_not_supported = EPROTONOSUPPORT,
+ read_only_file_system = EROFS,
+ resource_deadlock_would_occur = EDEADLK,
+ resource_unavailable_try_again = EAGAIN,
+ result_out_of_range = ERANGE,
+ state_not_recoverable = ENOTRECOVERABLE,
#ifdef ETIME
- stream_timeout = ETIME,
+ stream_timeout = ETIME,
#else
- stream_timeout = ETIMEDOUT,
+ stream_timeout = ETIMEDOUT,
#endif
- text_file_busy = ETXTBSY,
- timed_out = ETIMEDOUT,
- too_many_files_open_in_system = ENFILE,
- too_many_files_open = EMFILE,
- too_many_links = EMLINK,
- too_many_symbolic_link_levels = ELOOP,
- value_too_large = EOVERFLOW,
- wrong_protocol_type = EPROTOTYPE
-};
+ text_file_busy = ETXTBSY,
+ timed_out = ETIMEDOUT,
+ too_many_files_open_in_system = ENFILE,
+ too_many_files_open = EMFILE,
+ too_many_links = EMLINK,
+ too_many_symbolic_link_levels = ELOOP,
+ value_too_large = EOVERFLOW,
+ wrong_protocol_type = EPROTOTYPE};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/formatter.h b/contrib/llvm-project/libcxx/include/__thread/formatter.h
index 0e3a11c514e1..0454864ce939 100644
--- a/contrib/llvm-project/libcxx/include/__thread/formatter.h
+++ b/contrib/llvm-project/libcxx/include/__thread/formatter.h
@@ -31,47 +31,47 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifndef _LIBCPP_HAS_NO_THREADS
+# ifndef _LIBCPP_HAS_NO_THREADS
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<__thread_id, _CharT> {
- public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __parser_.__parse(__ctx, __format_spec::__fields_fill_align_width);
- }
+public:
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return __parser_.__parse(__ctx, __format_spec::__fields_fill_align_width);
+ }
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(__thread_id __id, _FormatContext& __ctx) const {
- // In __threading_support __libcpp_thread_id is either a
- // unsigned long long or a pthread_t.
- //
- // The type of pthread_t is left unspecified in POSIX so it can be any
- // type. The most logical types are an integral or pointer.
- // On Linux systems pthread_t is an unsigned long long.
- // On Apple systems pthread_t is a pointer type.
- //
- // Note the output should match what the stream operator does. Since
- // the ostream operator has been shipped years before this formatter
- // was added to the Standard, this formatter does what the stream
- // operator does. This may require platform specific changes.
+ template <class _FormatContext>
+ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(__thread_id __id, _FormatContext& __ctx) const {
+ // In __threading_support __libcpp_thread_id is either a
+ // unsigned long long or a pthread_t.
+ //
+ // The type of pthread_t is left unspecified in POSIX so it can be any
+ // type. The most logical types are an integral or pointer.
+ // On Linux systems pthread_t is an unsigned long long.
+ // On Apple systems pthread_t is a pointer type.
+ //
+ // Note the output should match what the stream operator does. Since
+ // the ostream operator has been shipped years before this formatter
+ // was added to the Standard, this formatter does what the stream
+ // operator does. This may require platform specific changes.
- using _Tp = decltype(__get_underlying_id(__id));
- using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>;
- static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report");
+ using _Tp = decltype(__get_underlying_id(__id));
+ using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>;
+ static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report");
- __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
- if constexpr (is_pointer_v<_Tp>) {
- __specs.__std_.__alternate_form_ = true;
- __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case;
- }
- return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs);
+ __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
+ if constexpr (is_pointer_v<_Tp>) {
+ __specs.__std_.__alternate_form_ = true;
+ __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case;
}
+ return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs);
+ }
- __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right};
+ __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right};
};
-#endif // !_LIBCPP_HAS_NO_THREADS
+# endif // !_LIBCPP_HAS_NO_THREADS
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h b/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h
index d027a2779d8e..0a2eef9a52d2 100644
--- a/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h
+++ b/contrib/llvm-project/libcxx/include/__thread/poll_with_backoff.h
@@ -34,23 +34,23 @@ static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
//
// - __max_elapsed is the maximum duration to try polling for. If the maximum duration is exceeded,
// the polling loop will return false to report a timeout.
-template<class _Fn, class _BFn>
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
-bool __libcpp_thread_poll_with_backoff(_Fn&& __f, _BFn&& __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) {
- auto const __start = chrono::high_resolution_clock::now();
- for (int __count = 0;;) {
- if (__f())
- return true; // _Fn completion means success
- if (__count < __libcpp_polling_count) {
- __count += 1;
- continue;
- }
- chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now() - __start;
- if (__max_elapsed != chrono::nanoseconds::zero() && __max_elapsed < __elapsed)
- return false; // timeout failure
- if (__bf(__elapsed))
- return false; // _BFn completion means failure
+template <class _Fn, class _BFn>
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_poll_with_backoff(
+ _Fn&& __f, _BFn&& __bf, chrono::nanoseconds __max_elapsed = chrono::nanoseconds::zero()) {
+ auto const __start = chrono::high_resolution_clock::now();
+ for (int __count = 0;;) {
+ if (__f())
+ return true; // _Fn completion means success
+ if (__count < __libcpp_polling_count) {
+ __count += 1;
+ continue;
}
+ chrono::nanoseconds const __elapsed = chrono::high_resolution_clock::now() - __start;
+ if (__max_elapsed != chrono::nanoseconds::zero() && __max_elapsed < __elapsed)
+ return false; // timeout failure
+ if (__bf(__elapsed))
+ return false; // _BFn completion means failure
+ }
}
// A trivial backoff policy that always immediately returns the control to
@@ -60,10 +60,7 @@ bool __libcpp_thread_poll_with_backoff(_Fn&& __f, _BFn&& __bf, chrono::nanosecon
// so this should most likely only be used on single-threaded systems where there
// are no other threads to compete with.
struct __spinning_backoff_policy {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool operator()(chrono::nanoseconds const&) const {
- return false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(chrono::nanoseconds const&) const { return false; }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/this_thread.h b/contrib/llvm-project/libcxx/include/__thread/this_thread.h
index 6b79aee9531f..6fb42533aab7 100644
--- a/contrib/llvm-project/libcxx/include/__thread/this_thread.h
+++ b/contrib/llvm-project/libcxx/include/__thread/this_thread.h
@@ -27,56 +27,43 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace this_thread
-{
+namespace this_thread {
_LIBCPP_EXPORTED_FROM_ABI void sleep_for(const chrono::nanoseconds& __ns);
template <class _Rep, class _Period>
-_LIBCPP_HIDE_FROM_ABI void
-sleep_for(const chrono::duration<_Rep, _Period>& __d)
-{
- if (__d > chrono::duration<_Rep, _Period>::zero())
- {
- // The standard guarantees a 64bit signed integer resolution for nanoseconds,
- // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid <climits>
- // and issues with long double folding on PowerPC with GCC.
- _LIBCPP_CONSTEXPR chrono::duration<long double> __max =
- chrono::duration<long double>(9223372036.0L);
- chrono::nanoseconds __ns;
- if (__d < __max)
- {
- __ns = chrono::duration_cast<chrono::nanoseconds>(__d);
- if (__ns < __d)
- ++__ns;
- }
- else
- __ns = chrono::nanoseconds::max();
- this_thread::sleep_for(__ns);
- }
+_LIBCPP_HIDE_FROM_ABI void sleep_for(const chrono::duration<_Rep, _Period>& __d) {
+ if (__d > chrono::duration<_Rep, _Period>::zero()) {
+ // The standard guarantees a 64bit signed integer resolution for nanoseconds,
+ // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid <climits>
+ // and issues with long double folding on PowerPC with GCC.
+ _LIBCPP_CONSTEXPR chrono::duration<long double> __max = chrono::duration<long double>(9223372036.0L);
+ chrono::nanoseconds __ns;
+ if (__d < __max) {
+ __ns = chrono::duration_cast<chrono::nanoseconds>(__d);
+ if (__ns < __d)
+ ++__ns;
+ } else
+ __ns = chrono::nanoseconds::max();
+ this_thread::sleep_for(__ns);
+ }
}
template <class _Clock, class _Duration>
-_LIBCPP_HIDE_FROM_ABI void
-sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
-{
- mutex __mut;
- condition_variable __cv;
- unique_lock<mutex> __lk(__mut);
- while (_Clock::now() < __t)
- __cv.wait_until(__lk, __t);
+_LIBCPP_HIDE_FROM_ABI void sleep_until(const chrono::time_point<_Clock, _Duration>& __t) {
+ mutex __mut;
+ condition_variable __cv;
+ unique_lock<mutex> __lk(__mut);
+ while (_Clock::now() < __t)
+ __cv.wait_until(__lk, __t);
}
template <class _Duration>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
-{
- this_thread::sleep_for(__t - chrono::steady_clock::now());
+inline _LIBCPP_HIDE_FROM_ABI void sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t) {
+ this_thread::sleep_for(__t - chrono::steady_clock::now());
}
-inline _LIBCPP_HIDE_FROM_ABI
-void yield() _NOEXCEPT {__libcpp_thread_yield();}
+inline _LIBCPP_HIDE_FROM_ABI void yield() _NOEXCEPT { __libcpp_thread_yield(); }
} // namespace this_thread
diff --git a/contrib/llvm-project/libcxx/include/__thread/thread.h b/contrib/llvm-project/libcxx/include/__thread/thread.h
index ee37a0320d69..f3300752ac9e 100644
--- a/contrib/llvm-project/libcxx/include/__thread/thread.h
+++ b/contrib/llvm-project/libcxx/include/__thread/thread.h
@@ -34,262 +34,220 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> class __thread_specific_ptr;
+template <class _Tp>
+class __thread_specific_ptr;
class _LIBCPP_EXPORTED_FROM_ABI __thread_struct;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __assoc_sub_state;
_LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
-class _LIBCPP_EXPORTED_FROM_ABI __thread_struct
-{
- __thread_struct_imp* __p_;
+class _LIBCPP_EXPORTED_FROM_ABI __thread_struct {
+ __thread_struct_imp* __p_;
+
+ __thread_struct(const __thread_struct&);
+ __thread_struct& operator=(const __thread_struct&);
- __thread_struct(const __thread_struct&);
- __thread_struct& operator=(const __thread_struct&);
public:
- __thread_struct();
- ~__thread_struct();
+ __thread_struct();
+ ~__thread_struct();
- void notify_all_at_thread_exit(condition_variable*, mutex*);
- void __make_ready_at_thread_exit(__assoc_sub_state*);
+ void notify_all_at_thread_exit(condition_variable*, mutex*);
+ void __make_ready_at_thread_exit(__assoc_sub_state*);
};
template <class _Tp>
-class __thread_specific_ptr
-{
- __libcpp_tls_key __key_;
+class __thread_specific_ptr {
+ __libcpp_tls_key __key_;
- // Only __thread_local_data() may construct a __thread_specific_ptr
- // and only with _Tp == __thread_struct.
- static_assert((is_same<_Tp, __thread_struct>::value), "");
- __thread_specific_ptr();
- friend _LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
+ // Only __thread_local_data() may construct a __thread_specific_ptr
+ // and only with _Tp == __thread_struct.
+ static_assert((is_same<_Tp, __thread_struct>::value), "");
+ __thread_specific_ptr();
+ friend _LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
- __thread_specific_ptr(const __thread_specific_ptr&);
- __thread_specific_ptr& operator=(const __thread_specific_ptr&);
+ __thread_specific_ptr(const __thread_specific_ptr&);
+ __thread_specific_ptr& operator=(const __thread_specific_ptr&);
- _LIBCPP_HIDDEN static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
+ _LIBCPP_HIDDEN static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
public:
- typedef _Tp* pointer;
+ typedef _Tp* pointer;
- ~__thread_specific_ptr();
+ ~__thread_specific_ptr();
- _LIBCPP_HIDE_FROM_ABI
- pointer get() const {return static_cast<_Tp*>(__libcpp_tls_get(__key_));}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator*() const {return *get();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return get();}
- void set_pointer(pointer __p);
+ _LIBCPP_HIDE_FROM_ABI pointer get() const { return static_cast<_Tp*>(__libcpp_tls_get(__key_)); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator*() const { return *get(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return get(); }
+ void set_pointer(pointer __p);
};
template <class _Tp>
-void _LIBCPP_TLS_DESTRUCTOR_CC
-__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
-{
- delete static_cast<pointer>(__p);
+void _LIBCPP_TLS_DESTRUCTOR_CC __thread_specific_ptr<_Tp>::__at_thread_exit(void* __p) {
+ delete static_cast<pointer>(__p);
}
template <class _Tp>
-__thread_specific_ptr<_Tp>::__thread_specific_ptr()
-{
- int __ec =
- __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
+__thread_specific_ptr<_Tp>::__thread_specific_ptr() {
+ int __ec = __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
if (__ec)
__throw_system_error(__ec, "__thread_specific_ptr construction failed");
}
template <class _Tp>
-__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
-{
- // __thread_specific_ptr is only created with a static storage duration
- // so this destructor is only invoked during program termination. Invoking
- // pthread_key_delete(__key_) may prevent other threads from deleting their
- // thread local data. For this reason we leak the key.
+__thread_specific_ptr<_Tp>::~__thread_specific_ptr() {
+ // __thread_specific_ptr is only created with a static storage duration
+ // so this destructor is only invoked during program termination. Invoking
+ // pthread_key_delete(__key_) may prevent other threads from deleting their
+ // thread local data. For this reason we leak the key.
}
template <class _Tp>
-void
-__thread_specific_ptr<_Tp>::set_pointer(pointer __p)
-{
- _LIBCPP_ASSERT_UNCATEGORIZED(get() == nullptr,
- "Attempting to overwrite thread local data");
- std::__libcpp_tls_set(__key_, __p);
+void __thread_specific_ptr<_Tp>::set_pointer(pointer __p) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(get() == nullptr, "Attempting to overwrite thread local data");
+ std::__libcpp_tls_set(__key_, __p);
}
-template<>
-struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
- : public __unary_function<__thread_id, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(__thread_id __v) const _NOEXCEPT
- {
- return hash<__libcpp_thread_id>()(__v.__id_);
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public __unary_function<__thread_id, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(__thread_id __v) const _NOEXCEPT {
+ return hash<__libcpp_thread_id>()(__v.__id_);
+ }
};
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
- // [thread.thread.id]/9
- // Effects: Inserts the text representation for charT of id into out.
- //
- // [thread.thread.id]/2
- // The text representation for the character type charT of an
- // object of type thread::id is an unspecified sequence of charT
- // such that, for two objects of type thread::id x and y, if
- // x == y is true, the thread::id objects have the same text
- // representation, and if x != y is true, the thread::id objects
- // have distinct text representations.
- //
- // Since various flags in the output stream can affect how the
- // thread id is represented (e.g. numpunct or showbase), we
- // use a temporary stream instead and just output the thread
- // id representation as a string.
-
- basic_ostringstream<_CharT, _Traits> __sstr;
- __sstr.imbue(locale::classic());
- __sstr << __id.__id_;
- return __os << __sstr.str();
+ // [thread.thread.id]/9
+ // Effects: Inserts the text representation for charT of id into out.
+ //
+ // [thread.thread.id]/2
+ // The text representation for the character type charT of an
+ // object of type thread::id is an unspecified sequence of charT
+ // such that, for two objects of type thread::id x and y, if
+ // x == y is true, the thread::id objects have the same text
+ // representation, and if x != y is true, the thread::id objects
+ // have distinct text representations.
+ //
+ // Since various flags in the output stream can affect how the
+ // thread id is represented (e.g. numpunct or showbase), we
+ // use a temporary stream instead and just output the thread
+ // id representation as a string.
+
+ basic_ostringstream<_CharT, _Traits> __sstr;
+ __sstr.imbue(locale::classic());
+ __sstr << __id.__id_;
+ return __os << __sstr.str();
}
#endif // _LIBCPP_HAS_NO_LOCALIZATION
-class _LIBCPP_EXPORTED_FROM_ABI thread
-{
- __libcpp_thread_t __t_;
+class _LIBCPP_EXPORTED_FROM_ABI thread {
+ __libcpp_thread_t __t_;
+
+ thread(const thread&);
+ thread& operator=(const thread&);
- thread(const thread&);
- thread& operator=(const thread&);
public:
- typedef __thread_id id;
- typedef __libcpp_thread_t native_handle_type;
+ typedef __thread_id id;
+ typedef __libcpp_thread_t native_handle_type;
- _LIBCPP_HIDE_FROM_ABI
- thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
+ _LIBCPP_HIDE_FROM_ABI thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
#ifndef _LIBCPP_CXX03_LANG
- template <class _Fp, class ..._Args,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value> >
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- explicit thread(_Fp&& __f, _Args&&... __args);
-#else // _LIBCPP_CXX03_LANG
- template <class _Fp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- explicit thread(_Fp __f);
+ template <class _Fp, class... _Args, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value> >
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args);
+#else // _LIBCPP_CXX03_LANG
+ template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp __f);
#endif
- ~thread();
-
- _LIBCPP_HIDE_FROM_ABI
- thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {
- __t.__t_ = _LIBCPP_NULL_THREAD;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- thread& operator=(thread&& __t) _NOEXCEPT {
- if (!__libcpp_thread_isnull(&__t_))
- terminate();
- __t_ = __t.__t_;
- __t.__t_ = _LIBCPP_NULL_THREAD;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(thread& __t) _NOEXCEPT {std::swap(__t_, __t.__t_);}
-
- _LIBCPP_HIDE_FROM_ABI
- bool joinable() const _NOEXCEPT {return !__libcpp_thread_isnull(&__t_);}
- void join();
- void detach();
- _LIBCPP_HIDE_FROM_ABI
- id get_id() const _NOEXCEPT {return __libcpp_thread_get_id(&__t_);}
- _LIBCPP_HIDE_FROM_ABI
- native_handle_type native_handle() _NOEXCEPT {return __t_;}
-
- static unsigned hardware_concurrency() _NOEXCEPT;
+ ~thread();
+
+ _LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) { __t.__t_ = _LIBCPP_NULL_THREAD; }
+
+ _LIBCPP_HIDE_FROM_ABI thread& operator=(thread&& __t) _NOEXCEPT {
+ if (!__libcpp_thread_isnull(&__t_))
+ terminate();
+ __t_ = __t.__t_;
+ __t.__t_ = _LIBCPP_NULL_THREAD;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(thread& __t) _NOEXCEPT { std::swap(__t_, __t.__t_); }
+
+ _LIBCPP_HIDE_FROM_ABI bool joinable() const _NOEXCEPT { return !__libcpp_thread_isnull(&__t_); }
+ void join();
+ void detach();
+ _LIBCPP_HIDE_FROM_ABI id get_id() const _NOEXCEPT { return __libcpp_thread_get_id(&__t_); }
+ _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() _NOEXCEPT { return __t_; }
+
+ static unsigned hardware_concurrency() _NOEXCEPT;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _TSp, class _Fp, class ..._Args, size_t ..._Indices>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)
-{
- std::__invoke(std::move(std::get<1>(__t)), std::move(std::get<_Indices>(__t))...);
+template <class _TSp, class _Fp, class... _Args, size_t... _Indices>
+inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) {
+ std::__invoke(std::move(std::get<1>(__t)), std::move(std::get<_Indices>(__t))...);
}
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI
-void* __thread_proxy(void* __vp)
-{
- // _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...>
- unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
- __thread_local_data().set_pointer(std::get<0>(*__p.get()).release());
- typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
- std::__thread_execute(*__p.get(), _Index());
- return nullptr;
+_LIBCPP_HIDE_FROM_ABI void* __thread_proxy(void* __vp) {
+ // _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...>
+ unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
+ __thread_local_data().set_pointer(std::get<0>(*__p.get()).release());
+ typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
+ std::__thread_execute(*__p.get(), _Index());
+ return nullptr;
}
-template <class _Fp, class ..._Args,
- class
- >
-thread::thread(_Fp&& __f, _Args&&... __args)
-{
- typedef unique_ptr<__thread_struct> _TSPtr;
- _TSPtr __tsp(new __thread_struct);
- typedef tuple<_TSPtr, __decay_t<_Fp>, __decay_t<_Args>...> _Gp;
- unique_ptr<_Gp> __p(
- new _Gp(std::move(__tsp),
- std::forward<_Fp>(__f),
- std::forward<_Args>(__args)...));
- int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
- if (__ec == 0)
- __p.release();
- else
- __throw_system_error(__ec, "thread constructor failed");
+template <class _Fp, class... _Args, class >
+thread::thread(_Fp&& __f, _Args&&... __args) {
+ typedef unique_ptr<__thread_struct> _TSPtr;
+ _TSPtr __tsp(new __thread_struct);
+ typedef tuple<_TSPtr, __decay_t<_Fp>, __decay_t<_Args>...> _Gp;
+ unique_ptr<_Gp> __p(new _Gp(std::move(__tsp), std::forward<_Fp>(__f), std::forward<_Args>(__args)...));
+ int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
+ if (__ec == 0)
+ __p.release();
+ else
+ __throw_system_error(__ec, "thread constructor failed");
}
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _Fp>
struct __thread_invoke_pair {
- // This type is used to pass memory for thread local storage and a functor
- // to a newly created thread because std::pair doesn't work with
- // std::unique_ptr in C++03.
- _LIBCPP_HIDE_FROM_ABI __thread_invoke_pair(_Fp& __f) : __tsp_(new __thread_struct), __fn_(__f) {}
- unique_ptr<__thread_struct> __tsp_;
- _Fp __fn_;
+ // This type is used to pass memory for thread local storage and a functor
+ // to a newly created thread because std::pair doesn't work with
+ // std::unique_ptr in C++03.
+ _LIBCPP_HIDE_FROM_ABI __thread_invoke_pair(_Fp& __f) : __tsp_(new __thread_struct), __fn_(__f) {}
+ unique_ptr<__thread_struct> __tsp_;
+ _Fp __fn_;
};
template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI void* __thread_proxy_cxx03(void* __vp)
-{
- unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
- __thread_local_data().set_pointer(__p->__tsp_.release());
- (__p->__fn_)();
- return nullptr;
+_LIBCPP_HIDE_FROM_ABI void* __thread_proxy_cxx03(void* __vp) {
+ unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
+ __thread_local_data().set_pointer(__p->__tsp_.release());
+ (__p->__fn_)();
+ return nullptr;
}
template <class _Fp>
-thread::thread(_Fp __f)
-{
-
- typedef __thread_invoke_pair<_Fp> _InvokePair;
- typedef unique_ptr<_InvokePair> _PairPtr;
- _PairPtr __pp(new _InvokePair(__f));
- int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get());
- if (__ec == 0)
- __pp.release();
- else
- __throw_system_error(__ec, "thread constructor failed");
+thread::thread(_Fp __f) {
+ typedef __thread_invoke_pair<_Fp> _InvokePair;
+ typedef unique_ptr<_InvokePair> _PairPtr;
+ _PairPtr __pp(new _InvokePair(__f));
+ int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get());
+ if (__ec == 0)
+ __pp.release();
+ else
+ __throw_system_error(__ec, "thread constructor failed");
}
#endif // _LIBCPP_CXX03_LANG
-inline _LIBCPP_HIDE_FROM_ABI
-void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
+inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x.swap(__y); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h b/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h
index 456cfcc3d986..525f52b34914 100644
--- a/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h
+++ b/contrib/llvm-project/libcxx/include/__thread/timed_backoff_policy.h
@@ -17,25 +17,23 @@
# include <__chrono/duration.h>
# include <__threading_support>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
_LIBCPP_BEGIN_NAMESPACE_STD
struct __libcpp_timed_backoff_policy {
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(chrono::nanoseconds __elapsed) const
- {
- if(__elapsed > chrono::milliseconds(128))
- __libcpp_thread_sleep_for(chrono::milliseconds(8));
- else if(__elapsed > chrono::microseconds(64))
- __libcpp_thread_sleep_for(__elapsed / 2);
- else if(__elapsed > chrono::microseconds(4))
- __libcpp_thread_yield();
- else
- {} // poll
- return false;
+ _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const {
+ if (__elapsed > chrono::milliseconds(128))
+ __libcpp_thread_sleep_for(chrono::milliseconds(8));
+ else if (__elapsed > chrono::microseconds(64))
+ __libcpp_thread_sleep_for(__elapsed / 2);
+ else if (__elapsed > chrono::microseconds(4))
+ __libcpp_thread_yield();
+ else {
+ } // poll
+ return false;
}
};
diff --git a/contrib/llvm-project/libcxx/include/__threading_support b/contrib/llvm-project/libcxx/include/__threading_support
index 3af1a778ecf7..ea6db4a3d59c 100644
--- a/contrib/llvm-project/libcxx/include/__threading_support
+++ b/contrib/llvm-project/libcxx/include/__threading_support
@@ -19,7 +19,7 @@
#include <errno.h>
#ifdef __MVS__
-# include <__support/ibm/nanosleep.h>
+# include <__support/ibm/nanosleep.h>
#endif
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
@@ -27,29 +27,29 @@
#endif
#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-# include <__external_threading>
+# include <__external_threading>
#elif !defined(_LIBCPP_HAS_NO_THREADS)
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
// Some platforms require <bits/atomic_wide_counter.h> in order for
// PTHREAD_COND_INITIALIZER to be expanded. Normally that would come
// in via <pthread.h>, but it's a non-modular header on those platforms,
// so libc++'s <math.h> usually absorbs atomic_wide_counter.h into the
// module with <math.h> and makes atomic_wide_counter.h invisible.
// Include <math.h> here to work around that.
-# include <math.h>
+# include <math.h>
-# include <pthread.h>
-# include <sched.h>
-#elif defined(_LIBCPP_HAS_THREAD_API_C11)
-# include <threads.h>
-#endif
+# include <pthread.h>
+# include <sched.h>
+# elif defined(_LIBCPP_HAS_THREAD_API_C11)
+# include <threads.h>
+# endif
-#if defined(_LIBCPP_HAS_THREAD_API_WIN32)
-#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_EXPORTED_FROM_ABI
-#else
-#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_HIDE_FROM_ABI
-#endif
+# if defined(_LIBCPP_HAS_THREAD_API_WIN32)
+# define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_EXPORTED_FROM_ABI
+# else
+# define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_HIDE_FROM_ABI
+# endif
typedef ::timespec __libcpp_timespec_t;
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
@@ -58,128 +58,127 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_THREADS)
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
// Mutex
typedef pthread_mutex_t __libcpp_mutex_t;
-#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+# define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
typedef pthread_mutex_t __libcpp_recursive_mutex_t;
// Condition Variable
typedef pthread_cond_t __libcpp_condvar_t;
-#define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
+# define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
// Execute once
typedef pthread_once_t __libcpp_exec_once_flag;
-#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
+# define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
// Thread id
-#if defined(__MVS__)
- typedef unsigned long long __libcpp_thread_id;
-#else
- typedef pthread_t __libcpp_thread_id;
-#endif
+# if defined(__MVS__)
+typedef unsigned long long __libcpp_thread_id;
+# else
+typedef pthread_t __libcpp_thread_id;
+# endif
// Thread
-#define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
+# define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
typedef pthread_t __libcpp_thread_t;
// Thread Local Storage
typedef pthread_key_t __libcpp_tls_key;
-#define _LIBCPP_TLS_DESTRUCTOR_CC
-#elif defined(_LIBCPP_HAS_THREAD_API_C11)
+# define _LIBCPP_TLS_DESTRUCTOR_CC
+# elif defined(_LIBCPP_HAS_THREAD_API_C11)
// Mutex
typedef mtx_t __libcpp_mutex_t;
// mtx_t is a struct so using {} for initialization is valid.
-#define _LIBCPP_MUTEX_INITIALIZER {}
+# define _LIBCPP_MUTEX_INITIALIZER \
+ {}
typedef mtx_t __libcpp_recursive_mutex_t;
// Condition Variable
typedef cnd_t __libcpp_condvar_t;
// cnd_t is a struct so using {} for initialization is valid.
-#define _LIBCPP_CONDVAR_INITIALIZER {}
+# define _LIBCPP_CONDVAR_INITIALIZER \
+ {}
// Execute once
typedef ::once_flag __libcpp_exec_once_flag;
-#define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT
+# define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT
// Thread id
typedef thrd_t __libcpp_thread_id;
// Thread
-#define _LIBCPP_NULL_THREAD 0U
+# define _LIBCPP_NULL_THREAD 0U
typedef thrd_t __libcpp_thread_t;
// Thread Local Storage
typedef tss_t __libcpp_tls_key;
-#define _LIBCPP_TLS_DESTRUCTOR_CC
-#elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# define _LIBCPP_TLS_DESTRUCTOR_CC
+# elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
// Mutex
typedef void* __libcpp_mutex_t;
-#define _LIBCPP_MUTEX_INITIALIZER 0
+# define _LIBCPP_MUTEX_INITIALIZER 0
-#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
+# if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
typedef void* __libcpp_recursive_mutex_t[6];
-#elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
+# elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
typedef void* __libcpp_recursive_mutex_t[5];
-#else
-# error Unsupported architecture
-#endif
+# else
+# error Unsupported architecture
+# endif
// Condition Variable
typedef void* __libcpp_condvar_t;
-#define _LIBCPP_CONDVAR_INITIALIZER 0
+# define _LIBCPP_CONDVAR_INITIALIZER 0
// Execute Once
typedef void* __libcpp_exec_once_flag;
-#define _LIBCPP_EXEC_ONCE_INITIALIZER 0
+# define _LIBCPP_EXEC_ONCE_INITIALIZER 0
// Thread ID
typedef long __libcpp_thread_id;
// Thread
-#define _LIBCPP_NULL_THREAD 0U
+# define _LIBCPP_NULL_THREAD 0U
typedef void* __libcpp_thread_t;
// Thread Local Storage
typedef long __libcpp_tls_key;
-#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
-#endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
+# endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
// Mutex
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool
+__libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m);
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t* __m);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_mutex_destroy(__libcpp_mutex_t *__m);
+int __libcpp_mutex_destroy(__libcpp_mutex_t* __m);
// Condition variable
_LIBCPP_THREAD_ABI_VISIBILITY
@@ -188,20 +187,18 @@ int __libcpp_condvar_signal(__libcpp_condvar_t* __cv);
_LIBCPP_THREAD_ABI_VISIBILITY
int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
-_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
- __libcpp_timespec_t *__ts);
+_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int
+__libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts);
_LIBCPP_THREAD_ABI_VISIBILITY
int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
// Execute once
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_execute_once(__libcpp_exec_once_flag *__flag,
- void (*__init_routine)());
+int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)());
// Thread id
_LIBCPP_THREAD_ABI_VISIBILITY
@@ -212,23 +209,22 @@ bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2);
// Thread
_LIBCPP_THREAD_ABI_VISIBILITY
-bool __libcpp_thread_isnull(const __libcpp_thread_t *__t);
+bool __libcpp_thread_isnull(const __libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
- void *__arg);
+int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg);
_LIBCPP_THREAD_ABI_VISIBILITY
__libcpp_thread_id __libcpp_thread_get_current_id();
_LIBCPP_THREAD_ABI_VISIBILITY
-__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t);
+__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_thread_join(__libcpp_thread_t *__t);
+int __libcpp_thread_join(__libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_thread_detach(__libcpp_thread_t *__t);
+int __libcpp_thread_detach(__libcpp_thread_t* __t);
_LIBCPP_THREAD_ABI_VISIBILITY
void __libcpp_thread_yield();
@@ -238,21 +234,19 @@ void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
// Thread local storage
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_tls_create(__libcpp_tls_key* __key,
- void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*));
+int __libcpp_tls_create(__libcpp_tls_key* __key, void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*));
_LIBCPP_THREAD_ABI_VISIBILITY
-void *__libcpp_tls_get(__libcpp_tls_key __key);
+void* __libcpp_tls_get(__libcpp_tls_key __key);
_LIBCPP_THREAD_ABI_VISIBILITY
-int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
+int __libcpp_tls_set(__libcpp_tls_key __key, void* __p);
-#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
-int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) {
pthread_mutexattr_t __attr;
int __ec = pthread_mutexattr_init(&__attr);
if (__ec)
@@ -275,313 +269,185 @@ int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
return 0;
}
-int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_lock(__m);
-}
+int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_lock(__m); }
-bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_trylock(__m) == 0;
-}
+bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_trylock(__m) == 0; }
-int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_unlock(__m);
-}
+int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_unlock(__m); }
-int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
-{
- return pthread_mutex_destroy(__m);
-}
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) { return pthread_mutex_destroy(__m); }
-int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_lock(__m);
-}
+int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { return pthread_mutex_lock(__m); }
-bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_trylock(__m) == 0;
-}
+bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { return pthread_mutex_trylock(__m) == 0; }
-int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_unlock(__m);
-}
+int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { return pthread_mutex_unlock(__m); }
-int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
-{
- return pthread_mutex_destroy(__m);
-}
+int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) { return pthread_mutex_destroy(__m); }
// Condition Variable
-int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
-{
- return pthread_cond_signal(__cv);
-}
+int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { return pthread_cond_signal(__cv); }
-int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
-{
- return pthread_cond_broadcast(__cv);
-}
+int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { return pthread_cond_broadcast(__cv); }
-int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
-{
- return pthread_cond_wait(__cv, __m);
-}
+int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) { return pthread_cond_wait(__cv, __m); }
-int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
- __libcpp_timespec_t *__ts)
-{
+int __libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, __libcpp_timespec_t* __ts) {
return pthread_cond_timedwait(__cv, __m, __ts);
}
-int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
-{
- return pthread_cond_destroy(__cv);
-}
+int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) { return pthread_cond_destroy(__cv); }
// Execute once
-int __libcpp_execute_once(__libcpp_exec_once_flag *__flag,
- void (*__init_routine)()) {
+int __libcpp_execute_once(__libcpp_exec_once_flag* __flag, void (*__init_routine)()) {
return pthread_once(__flag, __init_routine);
}
// Thread id
// Returns non-zero if the thread ids are equal, otherwise 0
-bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2)
-{
- return __t1 == __t2;
-}
+bool __libcpp_thread_id_equal(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { return __t1 == __t2; }
// Returns non-zero if t1 < t2, otherwise 0
-bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2)
-{
- return __t1 < __t2;
-}
+bool __libcpp_thread_id_less(__libcpp_thread_id __t1, __libcpp_thread_id __t2) { return __t1 < __t2; }
// Thread
-bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
- return __libcpp_thread_get_id(__t) == 0;
-}
+bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { return __libcpp_thread_get_id(__t) == 0; }
-int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
- void *__arg)
-{
+int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) {
return pthread_create(__t, nullptr, __func, __arg);
}
-__libcpp_thread_id __libcpp_thread_get_current_id()
-{
+__libcpp_thread_id __libcpp_thread_get_current_id() {
const __libcpp_thread_t __current_thread = pthread_self();
return __libcpp_thread_get_id(&__current_thread);
}
-__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
-{
-#if defined(__MVS__)
+__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) {
+# if defined(__MVS__)
return __t->__;
-#else
+# else
return *__t;
-#endif
+# endif
}
-int __libcpp_thread_join(__libcpp_thread_t *__t)
-{
- return pthread_join(*__t, nullptr);
-}
+int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, nullptr); }
-int __libcpp_thread_detach(__libcpp_thread_t *__t)
-{
- return pthread_detach(*__t);
-}
+int __libcpp_thread_detach(__libcpp_thread_t* __t) { return pthread_detach(*__t); }
-void __libcpp_thread_yield()
-{
- sched_yield();
-}
+void __libcpp_thread_yield() { sched_yield(); }
-void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
-{
- __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
- while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) {
+ __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
+ while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
+ ;
}
// Thread local storage
-int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
-{
+int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) {
return pthread_key_create(__key, __at_exit);
}
-void *__libcpp_tls_get(__libcpp_tls_key __key)
-{
- return pthread_getspecific(__key);
-}
+void* __libcpp_tls_get(__libcpp_tls_key __key) { return pthread_getspecific(__key); }
-int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
-{
- return pthread_setspecific(__key, __p);
-}
+int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { return pthread_setspecific(__key, __p); }
-#elif defined(_LIBCPP_HAS_THREAD_API_C11)
+# elif defined(_LIBCPP_HAS_THREAD_API_C11)
-int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t* __m) {
return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL;
}
-int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t* __m) {
return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
}
-bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
-{
- return mtx_trylock(__m) == thrd_success;
-}
+bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t* __m) { return mtx_trylock(__m) == thrd_success; }
-int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t* __m) {
return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
}
-int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
-{
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t* __m) {
mtx_destroy(__m);
return 0;
}
-int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
-{
- return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_mutex_lock(__libcpp_mutex_t* __m) { return mtx_lock(__m) == thrd_success ? 0 : EINVAL; }
-bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
-{
- return mtx_trylock(__m) == thrd_success;
-}
+bool __libcpp_mutex_trylock(__libcpp_mutex_t* __m) { return mtx_trylock(__m) == thrd_success; }
-int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
-{
- return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_mutex_unlock(__libcpp_mutex_t* __m) { return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; }
-int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
-{
+int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) {
mtx_destroy(__m);
return 0;
}
// Condition Variable
-int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
-{
- return cnd_signal(__cv) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_condvar_signal(__libcpp_condvar_t* __cv) { return cnd_signal(__cv) == thrd_success ? 0 : EINVAL; }
-int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
-{
- return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv) { return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL; }
-int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
-{
+int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) {
return cnd_wait(__cv, __m) == thrd_success ? 0 : EINVAL;
}
-int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
- timespec *__ts)
-{
+int __libcpp_condvar_timedwait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m, timespec* __ts) {
int __ec = cnd_timedwait(__cv, __m, __ts);
return __ec == thrd_timedout ? ETIMEDOUT : __ec;
}
-int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
-{
+int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv) {
cnd_destroy(__cv);
return 0;
}
// Execute once
-int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
- void (*init_routine)(void)) {
+int __libcpp_execute_once(__libcpp_exec_once_flag* flag, void (*init_routine)(void)) {
::call_once(flag, init_routine);
return 0;
}
// Thread id
// Returns non-zero if the thread ids are equal, otherwise 0
-bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
-{
- return thrd_equal(t1, t2) != 0;
-}
+bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) { return thrd_equal(t1, t2) != 0; }
// Returns non-zero if t1 < t2, otherwise 0
-bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
-{
- return t1 < t2;
-}
+bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) { return t1 < t2; }
// Thread
-bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
- return __libcpp_thread_get_id(__t) == 0;
-}
+bool __libcpp_thread_isnull(const __libcpp_thread_t* __t) { return __libcpp_thread_get_id(__t) == 0; }
-int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
- void *__arg)
-{
+int __libcpp_thread_create(__libcpp_thread_t* __t, void* (*__func)(void*), void* __arg) {
int __ec = thrd_create(__t, reinterpret_cast<thrd_start_t>(__func), __arg);
return __ec == thrd_nomem ? ENOMEM : __ec;
}
-__libcpp_thread_id __libcpp_thread_get_current_id()
-{
- return thrd_current();
-}
+__libcpp_thread_id __libcpp_thread_get_current_id() { return thrd_current(); }
-__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
-{
- return *__t;
-}
+__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) { return *__t; }
-int __libcpp_thread_join(__libcpp_thread_t *__t)
-{
- return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_thread_join(__libcpp_thread_t* __t) { return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL; }
-int __libcpp_thread_detach(__libcpp_thread_t *__t)
-{
- return thrd_detach(*__t) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_thread_detach(__libcpp_thread_t* __t) { return thrd_detach(*__t) == thrd_success ? 0 : EINVAL; }
-void __libcpp_thread_yield()
-{
- thrd_yield();
-}
+void __libcpp_thread_yield() { thrd_yield(); }
-void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
-{
- __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) {
+ __libcpp_timespec_t __ts = std::__convert_to_timespec<__libcpp_timespec_t>(__ns);
thrd_sleep(&__ts, nullptr);
}
// Thread local storage
-int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
-{
+int __libcpp_tls_create(__libcpp_tls_key* __key, void (*__at_exit)(void*)) {
return tss_create(__key, __at_exit) == thrd_success ? 0 : EINVAL;
}
-void *__libcpp_tls_get(__libcpp_tls_key __key)
-{
- return tss_get(__key);
-}
+void* __libcpp_tls_get(__libcpp_tls_key __key) { return tss_get(__key); }
-int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
-{
- return tss_set(__key, __p) == thrd_success ? 0 : EINVAL;
-}
+int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) { return tss_set(__key, __p) == thrd_success ? 0 : EINVAL; }
-#endif
+# endif
#endif // !_LIBCPP_HAS_NO_THREADS
diff --git a/contrib/llvm-project/libcxx/include/__tree b/contrib/llvm-project/libcxx/include/__tree
index d76cccb21c18..2dcc3c614d36 100644
--- a/contrib/llvm-project/libcxx/include/__tree
+++ b/contrib/llvm-project/libcxx/include/__tree
@@ -49,30 +49,40 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS map;
-template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS multimap;
-template <class, class, class> class _LIBCPP_TEMPLATE_VIS set;
-template <class, class, class> class _LIBCPP_TEMPLATE_VIS multiset;
+template <class, class, class, class>
+class _LIBCPP_TEMPLATE_VIS map;
+template <class, class, class, class>
+class _LIBCPP_TEMPLATE_VIS multimap;
+template <class, class, class>
+class _LIBCPP_TEMPLATE_VIS set;
+template <class, class, class>
+class _LIBCPP_TEMPLATE_VIS multiset;
-template <class _Tp, class _Compare, class _Allocator> class __tree;
+template <class _Tp, class _Compare, class _Allocator>
+class __tree;
template <class _Tp, class _NodePtr, class _DiffType>
- class _LIBCPP_TEMPLATE_VIS __tree_iterator;
+class _LIBCPP_TEMPLATE_VIS __tree_iterator;
template <class _Tp, class _ConstNodePtr, class _DiffType>
- class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
+class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
-template <class _Pointer> class __tree_end_node;
-template <class _VoidPtr> class __tree_node_base;
-template <class _Tp, class _VoidPtr> class __tree_node;
+template <class _Pointer>
+class __tree_end_node;
+template <class _VoidPtr>
+class __tree_node_base;
+template <class _Tp, class _VoidPtr>
+class __tree_node;
template <class _Key, class _Value>
struct __value_type;
-template <class _Allocator> class __map_node_destructor;
-template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_iterator;
-template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
+template <class _Allocator>
+class __map_node_destructor;
+template <class _TreeIterator>
+class _LIBCPP_TEMPLATE_VIS __map_iterator;
+template <class _TreeIterator>
+class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
/*
@@ -98,198 +108,167 @@ __root, have a non-null __parent_ field.
// Returns: true if __x is a left child of its parent, else false
// Precondition: __x != nullptr.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-__tree_is_left_child(_NodePtr __x) _NOEXCEPT
-{
- return __x == __x->__parent_->__left_;
+inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
+ return __x == __x->__parent_->__left_;
}
// Determines if the subtree rooted at __x is a proper red black subtree. If
// __x is a proper subtree, returns the black height (null counts as 1). If
// __x is an improper subtree, returns 0.
template <class _NodePtr>
-unsigned
-__tree_sub_invariant(_NodePtr __x)
-{
- if (__x == nullptr)
- return 1;
- // parent consistency checked by caller
- // check __x->__left_ consistency
- if (__x->__left_ != nullptr && __x->__left_->__parent_ != __x)
- return 0;
- // check __x->__right_ consistency
- if (__x->__right_ != nullptr && __x->__right_->__parent_ != __x)
- return 0;
- // check __x->__left_ != __x->__right_ unless both are nullptr
- if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr)
- return 0;
- // If this is red, neither child can be red
- if (!__x->__is_black_)
- {
- if (__x->__left_ && !__x->__left_->__is_black_)
- return 0;
- if (__x->__right_ && !__x->__right_->__is_black_)
- return 0;
- }
- unsigned __h = std::__tree_sub_invariant(__x->__left_);
- if (__h == 0)
- return 0; // invalid left subtree
- if (__h != std::__tree_sub_invariant(__x->__right_))
- return 0; // invalid or different height right subtree
- return __h + __x->__is_black_; // return black height of this node
+unsigned __tree_sub_invariant(_NodePtr __x) {
+ if (__x == nullptr)
+ return 1;
+ // parent consistency checked by caller
+ // check __x->__left_ consistency
+ if (__x->__left_ != nullptr && __x->__left_->__parent_ != __x)
+ return 0;
+ // check __x->__right_ consistency
+ if (__x->__right_ != nullptr && __x->__right_->__parent_ != __x)
+ return 0;
+ // check __x->__left_ != __x->__right_ unless both are nullptr
+ if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr)
+ return 0;
+ // If this is red, neither child can be red
+ if (!__x->__is_black_) {
+ if (__x->__left_ && !__x->__left_->__is_black_)
+ return 0;
+ if (__x->__right_ && !__x->__right_->__is_black_)
+ return 0;
+ }
+ unsigned __h = std::__tree_sub_invariant(__x->__left_);
+ if (__h == 0)
+ return 0; // invalid left subtree
+ if (__h != std::__tree_sub_invariant(__x->__right_))
+ return 0; // invalid or different height right subtree
+ return __h + __x->__is_black_; // return black height of this node
}
// Determines if the red black tree rooted at __root is a proper red black tree.
// __root == nullptr is a proper tree. Returns true is __root is a proper
// red black tree, else returns false.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI bool
-__tree_invariant(_NodePtr __root)
-{
- if (__root == nullptr)
- return true;
- // check __x->__parent_ consistency
- if (__root->__parent_ == nullptr)
- return false;
- if (!std::__tree_is_left_child(__root))
- return false;
- // root must be black
- if (!__root->__is_black_)
- return false;
- // do normal node checks
- return std::__tree_sub_invariant(__root) != 0;
+_LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) {
+ if (__root == nullptr)
+ return true;
+ // check __x->__parent_ consistency
+ if (__root->__parent_ == nullptr)
+ return false;
+ if (!std::__tree_is_left_child(__root))
+ return false;
+ // root must be black
+ if (!__root->__is_black_)
+ return false;
+ // do normal node checks
+ return std::__tree_sub_invariant(__root) != 0;
}
// Returns: pointer to the left-most node under __x.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_NodePtr
-__tree_min(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
- while (__x->__left_ != nullptr)
- __x = __x->__left_;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
+ while (__x->__left_ != nullptr)
+ __x = __x->__left_;
+ return __x;
}
// Returns: pointer to the right-most node under __x.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_NodePtr
-__tree_max(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
- while (__x->__right_ != nullptr)
- __x = __x->__right_;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
+ while (__x->__right_ != nullptr)
+ __x = __x->__right_;
+ return __x;
}
// Returns: pointer to the next in-order node after __x.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI _NodePtr
-__tree_next(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- if (__x->__right_ != nullptr)
- return std::__tree_min(__x->__right_);
- while (!std::__tree_is_left_child(__x))
- __x = __x->__parent_unsafe();
- return __x->__parent_unsafe();
+_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ if (__x->__right_ != nullptr)
+ return std::__tree_min(__x->__right_);
+ while (!std::__tree_is_left_child(__x))
+ __x = __x->__parent_unsafe();
+ return __x->__parent_unsafe();
}
template <class _EndNodePtr, class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_EndNodePtr
-__tree_next_iter(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- if (__x->__right_ != nullptr)
- return static_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
- while (!std::__tree_is_left_child(__x))
- __x = __x->__parent_unsafe();
- return static_cast<_EndNodePtr>(__x->__parent_);
+inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ if (__x->__right_ != nullptr)
+ return static_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
+ while (!std::__tree_is_left_child(__x))
+ __x = __x->__parent_unsafe();
+ return static_cast<_EndNodePtr>(__x->__parent_);
}
// Returns: pointer to the previous in-order node before __x.
// Note: __x may be the end node.
template <class _NodePtr, class _EndNodePtr>
-inline _LIBCPP_HIDE_FROM_ABI
-_NodePtr
-__tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- if (__x->__left_ != nullptr)
- return std::__tree_max(__x->__left_);
- _NodePtr __xx = static_cast<_NodePtr>(__x);
- while (std::__tree_is_left_child(__xx))
- __xx = __xx->__parent_unsafe();
- return __xx->__parent_unsafe();
+inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ if (__x->__left_ != nullptr)
+ return std::__tree_max(__x->__left_);
+ _NodePtr __xx = static_cast<_NodePtr>(__x);
+ while (std::__tree_is_left_child(__xx))
+ __xx = __xx->__parent_unsafe();
+ return __xx->__parent_unsafe();
}
// Returns: pointer to a node which has no children
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI _NodePtr
-__tree_leaf(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- while (true)
- {
- if (__x->__left_ != nullptr)
- {
- __x = __x->__left_;
- continue;
- }
- if (__x->__right_ != nullptr)
- {
- __x = __x->__right_;
- continue;
- }
- break;
- }
- return __x;
+_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ while (true) {
+ if (__x->__left_ != nullptr) {
+ __x = __x->__left_;
+ continue;
+ }
+ if (__x->__right_ != nullptr) {
+ __x = __x->__right_;
+ continue;
+ }
+ break;
+ }
+ return __x;
}
// Effects: Makes __x->__right_ the subtree root with __x as its left child
// while preserving in-order order.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_left_rotate(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- _LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child");
- _NodePtr __y = __x->__right_;
- __x->__right_ = __y->__left_;
- if (__x->__right_ != nullptr)
- __x->__right_->__set_parent(__x);
- __y->__parent_ = __x->__parent_;
- if (std::__tree_is_left_child(__x))
- __x->__parent_->__left_ = __y;
- else
- __x->__parent_unsafe()->__right_ = __y;
- __y->__left_ = __x;
- __x->__set_parent(__y);
+_LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ _LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child");
+ _NodePtr __y = __x->__right_;
+ __x->__right_ = __y->__left_;
+ if (__x->__right_ != nullptr)
+ __x->__right_->__set_parent(__x);
+ __y->__parent_ = __x->__parent_;
+ if (std::__tree_is_left_child(__x))
+ __x->__parent_->__left_ = __y;
+ else
+ __x->__parent_unsafe()->__right_ = __y;
+ __y->__left_ = __x;
+ __x->__set_parent(__y);
}
// Effects: Makes __x->__left_ the subtree root with __x as its right child
// while preserving in-order order.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_right_rotate(_NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
- _LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child");
- _NodePtr __y = __x->__left_;
- __x->__left_ = __y->__right_;
- if (__x->__left_ != nullptr)
- __x->__left_->__set_parent(__x);
- __y->__parent_ = __x->__parent_;
- if (std::__tree_is_left_child(__x))
- __x->__parent_->__left_ = __y;
- else
- __x->__parent_unsafe()->__right_ = __y;
- __y->__right_ = __x;
- __x->__set_parent(__y);
+_LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
+ _LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child");
+ _NodePtr __y = __x->__left_;
+ __x->__left_ = __y->__right_;
+ if (__x->__left_ != nullptr)
+ __x->__left_->__set_parent(__x);
+ __y->__parent_ = __x->__parent_;
+ if (std::__tree_is_left_child(__x))
+ __x->__parent_->__left_ = __y;
+ else
+ __x->__parent_unsafe()->__right_ = __y;
+ __y->__right_ = __x;
+ __x->__set_parent(__y);
}
// Effects: Rebalances __root after attaching __x to a leaf.
@@ -300,68 +279,54 @@ __tree_right_rotate(_NodePtr __x) _NOEXCEPT
// Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_
// may be different than the value passed in as __root.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
- _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf");
- __x->__is_black_ = __x == __root;
- while (__x != __root && !__x->__parent_unsafe()->__is_black_)
- {
- // __x->__parent_ != __root because __x->__parent_->__is_black == false
- if (std::__tree_is_left_child(__x->__parent_unsafe()))
- {
- _NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_;
- if (__y != nullptr && !__y->__is_black_)
- {
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = __x == __root;
- __y->__is_black_ = true;
- }
- else
- {
- if (!std::__tree_is_left_child(__x))
- {
- __x = __x->__parent_unsafe();
- std::__tree_left_rotate(__x);
- }
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = false;
- std::__tree_right_rotate(__x);
- break;
- }
+_LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
+ _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf");
+ __x->__is_black_ = __x == __root;
+ while (__x != __root && !__x->__parent_unsafe()->__is_black_) {
+ // __x->__parent_ != __root because __x->__parent_->__is_black == false
+ if (std::__tree_is_left_child(__x->__parent_unsafe())) {
+ _NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_;
+ if (__y != nullptr && !__y->__is_black_) {
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = __x == __root;
+ __y->__is_black_ = true;
+ } else {
+ if (!std::__tree_is_left_child(__x)) {
+ __x = __x->__parent_unsafe();
+ std::__tree_left_rotate(__x);
}
- else
- {
- _NodePtr __y = __x->__parent_unsafe()->__parent_->__left_;
- if (__y != nullptr && !__y->__is_black_)
- {
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = __x == __root;
- __y->__is_black_ = true;
- }
- else
- {
- if (std::__tree_is_left_child(__x))
- {
- __x = __x->__parent_unsafe();
- std::__tree_right_rotate(__x);
- }
- __x = __x->__parent_unsafe();
- __x->__is_black_ = true;
- __x = __x->__parent_unsafe();
- __x->__is_black_ = false;
- std::__tree_left_rotate(__x);
- break;
- }
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = false;
+ std::__tree_right_rotate(__x);
+ break;
+ }
+ } else {
+ _NodePtr __y = __x->__parent_unsafe()->__parent_->__left_;
+ if (__y != nullptr && !__y->__is_black_) {
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = __x == __root;
+ __y->__is_black_ = true;
+ } else {
+ if (std::__tree_is_left_child(__x)) {
+ __x = __x->__parent_unsafe();
+ std::__tree_right_rotate(__x);
}
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = true;
+ __x = __x->__parent_unsafe();
+ __x->__is_black_ = false;
+ std::__tree_left_rotate(__x);
+ break;
+ }
}
+ }
}
// Precondition: __z == __root or == a direct or indirect child of __root.
@@ -370,205 +335,178 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
// nor any of its children refer to __z. end_node->__left_
// may be different than the value passed in as __root.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
-{
- _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null");
- _LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null");
- _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold");
- // __z will be removed from the tree. Client still needs to destruct/deallocate it
- // __y is either __z, or if __z has two children, __tree_next(__z).
- // __y will have at most one child.
- // __y will be the initial hole in the tree (make the hole at a leaf)
- _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ?
- __z : std::__tree_next(__z);
- // __x is __y's possibly null single child
- _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_;
- // __w is __x's possibly null uncle (will become __x's sibling)
- _NodePtr __w = nullptr;
- // link __x to __y's parent, and find __w
- if (__x != nullptr)
- __x->__parent_ = __y->__parent_;
- if (std::__tree_is_left_child(__y))
- {
- __y->__parent_->__left_ = __x;
- if (__y != __root)
- __w = __y->__parent_unsafe()->__right_;
- else
- __root = __x; // __w == nullptr
- }
+_LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null");
+ _LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null");
+ _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold");
+ // __z will be removed from the tree. Client still needs to destruct/deallocate it
+ // __y is either __z, or if __z has two children, __tree_next(__z).
+ // __y will have at most one child.
+ // __y will be the initial hole in the tree (make the hole at a leaf)
+ _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ? __z : std::__tree_next(__z);
+ // __x is __y's possibly null single child
+ _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_;
+ // __w is __x's possibly null uncle (will become __x's sibling)
+ _NodePtr __w = nullptr;
+ // link __x to __y's parent, and find __w
+ if (__x != nullptr)
+ __x->__parent_ = __y->__parent_;
+ if (std::__tree_is_left_child(__y)) {
+ __y->__parent_->__left_ = __x;
+ if (__y != __root)
+ __w = __y->__parent_unsafe()->__right_;
else
- {
- __y->__parent_unsafe()->__right_ = __x;
- // __y can't be root if it is a right child
- __w = __y->__parent_->__left_;
- }
- bool __removed_black = __y->__is_black_;
- // If we didn't remove __z, do so now by splicing in __y for __z,
- // but copy __z's color. This does not impact __x or __w.
- if (__y != __z)
- {
- // __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
- __y->__parent_ = __z->__parent_;
- if (std::__tree_is_left_child(__z))
- __y->__parent_->__left_ = __y;
- else
- __y->__parent_unsafe()->__right_ = __y;
- __y->__left_ = __z->__left_;
- __y->__left_->__set_parent(__y);
- __y->__right_ = __z->__right_;
- if (__y->__right_ != nullptr)
- __y->__right_->__set_parent(__y);
- __y->__is_black_ = __z->__is_black_;
- if (__root == __z)
- __root = __y;
- }
- // There is no need to rebalance if we removed a red, or if we removed
- // the last node.
- if (__removed_black && __root != nullptr)
- {
- // Rebalance:
- // __x has an implicit black color (transferred from the removed __y)
- // associated with it, no matter what its color is.
- // If __x is __root (in which case it can't be null), it is supposed
- // to be black anyway, and if it is doubly black, then the double
- // can just be ignored.
- // If __x is red (in which case it can't be null), then it can absorb
- // the implicit black just by setting its color to black.
- // Since __y was black and only had one child (which __x points to), __x
- // is either red with no children, else null, otherwise __y would have
- // different black heights under left and right pointers.
- // if (__x == __root || __x != nullptr && !__x->__is_black_)
- if (__x != nullptr)
- __x->__is_black_ = true;
- else
+ __root = __x; // __w == nullptr
+ } else {
+ __y->__parent_unsafe()->__right_ = __x;
+ // __y can't be root if it is a right child
+ __w = __y->__parent_->__left_;
+ }
+ bool __removed_black = __y->__is_black_;
+ // If we didn't remove __z, do so now by splicing in __y for __z,
+ // but copy __z's color. This does not impact __x or __w.
+ if (__y != __z) {
+ // __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
+ __y->__parent_ = __z->__parent_;
+ if (std::__tree_is_left_child(__z))
+ __y->__parent_->__left_ = __y;
+ else
+ __y->__parent_unsafe()->__right_ = __y;
+ __y->__left_ = __z->__left_;
+ __y->__left_->__set_parent(__y);
+ __y->__right_ = __z->__right_;
+ if (__y->__right_ != nullptr)
+ __y->__right_->__set_parent(__y);
+ __y->__is_black_ = __z->__is_black_;
+ if (__root == __z)
+ __root = __y;
+ }
+ // There is no need to rebalance if we removed a red, or if we removed
+ // the last node.
+ if (__removed_black && __root != nullptr) {
+ // Rebalance:
+ // __x has an implicit black color (transferred from the removed __y)
+ // associated with it, no matter what its color is.
+ // If __x is __root (in which case it can't be null), it is supposed
+ // to be black anyway, and if it is doubly black, then the double
+ // can just be ignored.
+ // If __x is red (in which case it can't be null), then it can absorb
+ // the implicit black just by setting its color to black.
+ // Since __y was black and only had one child (which __x points to), __x
+ // is either red with no children, else null, otherwise __y would have
+ // different black heights under left and right pointers.
+ // if (__x == __root || __x != nullptr && !__x->__is_black_)
+ if (__x != nullptr)
+ __x->__is_black_ = true;
+ else {
+ // Else __x isn't root, and is "doubly black", even though it may
+ // be null. __w can not be null here, else the parent would
+ // see a black height >= 2 on the __x side and a black height
+ // of 1 on the __w side (__w must be a non-null black or a red
+ // with a non-null black child).
+ while (true) {
+ if (!std::__tree_is_left_child(__w)) // if x is left child
{
- // Else __x isn't root, and is "doubly black", even though it may
- // be null. __w can not be null here, else the parent would
- // see a black height >= 2 on the __x side and a black height
- // of 1 on the __w side (__w must be a non-null black or a red
- // with a non-null black child).
- while (true)
- {
- if (!std::__tree_is_left_child(__w)) // if x is left child
- {
- if (!__w->__is_black_)
- {
- __w->__is_black_ = true;
- __w->__parent_unsafe()->__is_black_ = false;
- std::__tree_left_rotate(__w->__parent_unsafe());
- // __x is still valid
- // reset __root only if necessary
- if (__root == __w->__left_)
- __root = __w;
- // reset sibling, and it still can't be null
- __w = __w->__left_->__right_;
- }
- // __w->__is_black_ is now true, __w may have null children
- if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
- (__w->__right_ == nullptr || __w->__right_->__is_black_))
- {
- __w->__is_black_ = false;
- __x = __w->__parent_unsafe();
- // __x can no longer be null
- if (__x == __root || !__x->__is_black_)
- {
- __x->__is_black_ = true;
- break;
- }
- // reset sibling, and it still can't be null
- __w = std::__tree_is_left_child(__x) ?
- __x->__parent_unsafe()->__right_ :
- __x->__parent_->__left_;
- // continue;
- }
- else // __w has a red child
- {
- if (__w->__right_ == nullptr || __w->__right_->__is_black_)
- {
- // __w left child is non-null and red
- __w->__left_->__is_black_ = true;
- __w->__is_black_ = false;
- std::__tree_right_rotate(__w);
- // __w is known not to be root, so root hasn't changed
- // reset sibling, and it still can't be null
- __w = __w->__parent_unsafe();
- }
- // __w has a right red child, left child may be null
- __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
- __w->__parent_unsafe()->__is_black_ = true;
- __w->__right_->__is_black_ = true;
- std::__tree_left_rotate(__w->__parent_unsafe());
- break;
- }
- }
- else
- {
- if (!__w->__is_black_)
- {
- __w->__is_black_ = true;
- __w->__parent_unsafe()->__is_black_ = false;
- std::__tree_right_rotate(__w->__parent_unsafe());
- // __x is still valid
- // reset __root only if necessary
- if (__root == __w->__right_)
- __root = __w;
- // reset sibling, and it still can't be null
- __w = __w->__right_->__left_;
- }
- // __w->__is_black_ is now true, __w may have null children
- if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
- (__w->__right_ == nullptr || __w->__right_->__is_black_))
- {
- __w->__is_black_ = false;
- __x = __w->__parent_unsafe();
- // __x can no longer be null
- if (!__x->__is_black_ || __x == __root)
- {
- __x->__is_black_ = true;
- break;
- }
- // reset sibling, and it still can't be null
- __w = std::__tree_is_left_child(__x) ?
- __x->__parent_unsafe()->__right_ :
- __x->__parent_->__left_;
- // continue;
- }
- else // __w has a red child
- {
- if (__w->__left_ == nullptr || __w->__left_->__is_black_)
- {
- // __w right child is non-null and red
- __w->__right_->__is_black_ = true;
- __w->__is_black_ = false;
- std::__tree_left_rotate(__w);
- // __w is known not to be root, so root hasn't changed
- // reset sibling, and it still can't be null
- __w = __w->__parent_unsafe();
- }
- // __w has a left red child, right child may be null
- __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
- __w->__parent_unsafe()->__is_black_ = true;
- __w->__left_->__is_black_ = true;
- std::__tree_right_rotate(__w->__parent_unsafe());
- break;
- }
- }
+ if (!__w->__is_black_) {
+ __w->__is_black_ = true;
+ __w->__parent_unsafe()->__is_black_ = false;
+ std::__tree_left_rotate(__w->__parent_unsafe());
+ // __x is still valid
+ // reset __root only if necessary
+ if (__root == __w->__left_)
+ __root = __w;
+ // reset sibling, and it still can't be null
+ __w = __w->__left_->__right_;
+ }
+ // __w->__is_black_ is now true, __w may have null children
+ if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
+ (__w->__right_ == nullptr || __w->__right_->__is_black_)) {
+ __w->__is_black_ = false;
+ __x = __w->__parent_unsafe();
+ // __x can no longer be null
+ if (__x == __root || !__x->__is_black_) {
+ __x->__is_black_ = true;
+ break;
}
+ // reset sibling, and it still can't be null
+ __w = std::__tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_;
+ // continue;
+ } else // __w has a red child
+ {
+ if (__w->__right_ == nullptr || __w->__right_->__is_black_) {
+ // __w left child is non-null and red
+ __w->__left_->__is_black_ = true;
+ __w->__is_black_ = false;
+ std::__tree_right_rotate(__w);
+ // __w is known not to be root, so root hasn't changed
+ // reset sibling, and it still can't be null
+ __w = __w->__parent_unsafe();
+ }
+ // __w has a right red child, left child may be null
+ __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
+ __w->__parent_unsafe()->__is_black_ = true;
+ __w->__right_->__is_black_ = true;
+ std::__tree_left_rotate(__w->__parent_unsafe());
+ break;
+ }
+ } else {
+ if (!__w->__is_black_) {
+ __w->__is_black_ = true;
+ __w->__parent_unsafe()->__is_black_ = false;
+ std::__tree_right_rotate(__w->__parent_unsafe());
+ // __x is still valid
+ // reset __root only if necessary
+ if (__root == __w->__right_)
+ __root = __w;
+ // reset sibling, and it still can't be null
+ __w = __w->__right_->__left_;
+ }
+ // __w->__is_black_ is now true, __w may have null children
+ if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
+ (__w->__right_ == nullptr || __w->__right_->__is_black_)) {
+ __w->__is_black_ = false;
+ __x = __w->__parent_unsafe();
+ // __x can no longer be null
+ if (!__x->__is_black_ || __x == __root) {
+ __x->__is_black_ = true;
+ break;
+ }
+ // reset sibling, and it still can't be null
+ __w = std::__tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_;
+ // continue;
+ } else // __w has a red child
+ {
+ if (__w->__left_ == nullptr || __w->__left_->__is_black_) {
+ // __w right child is non-null and red
+ __w->__right_->__is_black_ = true;
+ __w->__is_black_ = false;
+ std::__tree_left_rotate(__w);
+ // __w is known not to be root, so root hasn't changed
+ // reset sibling, and it still can't be null
+ __w = __w->__parent_unsafe();
+ }
+ // __w has a left red child, right child may be null
+ __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
+ __w->__parent_unsafe()->__is_black_ = true;
+ __w->__left_->__is_black_ = true;
+ std::__tree_right_rotate(__w->__parent_unsafe());
+ break;
+ }
}
+ }
}
+ }
}
// node traits
-
template <class _Tp>
struct __is_tree_value_type_imp : false_type {};
template <class _Key, class _Value>
struct __is_tree_value_type_imp<__value_type<_Key, _Value> > : true_type {};
-template <class ..._Args>
+template <class... _Args>
struct __is_tree_value_type : false_type {};
template <class _One>
@@ -581,81 +519,57 @@ struct __tree_key_value_types {
typedef _Tp __container_value_type;
static const bool __is_map = false;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const& __get_key(_Tp const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const& __get_value(__node_value_type const& __v) {
- return __v;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
- return std::addressof(__n);
- }
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type&& __move(__node_value_type& __v) {
- return std::move(__v);
- }
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(_Tp const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(__node_value_type const& __v) { return __v; }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) { return std::addressof(__n); }
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type&& __move(__node_value_type& __v) { return std::move(__v); }
};
template <class _Key, class _Tp>
struct __tree_key_value_types<__value_type<_Key, _Tp> > {
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __value_type<_Key, _Tp> __node_value_type;
- typedef pair<const _Key, _Tp> __container_value_type;
- typedef __container_value_type __map_value_type;
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __value_type<_Key, _Tp> __node_value_type;
+ typedef pair<const _Key, _Tp> __container_value_type;
+ typedef __container_value_type __map_value_type;
static const bool __is_map = true;
- _LIBCPP_HIDE_FROM_ABI
- static key_type const&
- __get_key(__node_value_type const& __t) {
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(__node_value_type const& __t) {
return __t.__get_value().first;
}
template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- static key_type const&
- __get_key(_Up& __t) {
+ _LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(_Up& __t) {
return __t.first;
}
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type const&
- __get_value(__node_value_type const& __t) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(__node_value_type const& __t) {
return __t.__get_value();
}
template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, __container_value_type const&>
+ _LIBCPP_HIDE_FROM_ABI static __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value,
+ __container_value_type const&>
__get_value(_Up& __t) {
return __t;
}
- _LIBCPP_HIDE_FROM_ABI
- static __container_value_type* __get_ptr(__node_value_type& __n) {
+ _LIBCPP_HIDE_FROM_ABI static __container_value_type* __get_ptr(__node_value_type& __n) {
return std::addressof(__n.__get_value());
}
- _LIBCPP_HIDE_FROM_ABI
- static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
- return __v.__move();
- }
+ _LIBCPP_HIDE_FROM_ABI static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { return __v.__move(); }
};
template <class _VoidPtr>
struct __tree_node_base_types {
- typedef _VoidPtr __void_pointer;
+ typedef _VoidPtr __void_pointer;
- typedef __tree_node_base<__void_pointer> __node_base_type;
- typedef __rebind_pointer_t<_VoidPtr, __node_base_type>
- __node_base_pointer;
+ typedef __tree_node_base<__void_pointer> __node_base_type;
+ typedef __rebind_pointer_t<_VoidPtr, __node_base_type> __node_base_pointer;
- typedef __tree_end_node<__node_base_pointer> __end_node_type;
- typedef __rebind_pointer_t<_VoidPtr, __end_node_type>
- __end_node_pointer;
+ typedef __tree_end_node<__node_base_pointer> __end_node_type;
+ typedef __rebind_pointer_t<_VoidPtr, __end_node_type> __end_node_pointer;
#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB)
typedef __end_node_pointer __parent_pointer;
#else
@@ -665,20 +579,17 @@ struct __tree_node_base_types {
private:
static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
- "_VoidPtr does not point to unqualified void type");
+ "_VoidPtr does not point to unqualified void type");
};
-template <class _Tp, class _AllocPtr, class _KVTypes = __tree_key_value_types<_Tp>,
- bool = _KVTypes::__is_map>
+template <class _Tp, class _AllocPtr, class _KVTypes = __tree_key_value_types<_Tp>, bool = _KVTypes::__is_map>
struct __tree_map_pointer_types {};
template <class _Tp, class _AllocPtr, class _KVTypes>
struct __tree_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> {
- typedef typename _KVTypes::__map_value_type _Mv;
- typedef __rebind_pointer_t<_AllocPtr, _Mv>
- __map_value_type_pointer;
- typedef __rebind_pointer_t<_AllocPtr, const _Mv>
- __const_map_value_type_pointer;
+ typedef typename _KVTypes::__map_value_type _Mv;
+ typedef __rebind_pointer_t<_AllocPtr, _Mv> __map_value_type_pointer;
+ typedef __rebind_pointer_t<_AllocPtr, const _Mv> __const_map_value_type_pointer;
};
template <class _NodePtr, class _NodeT = typename pointer_traits<_NodePtr>::element_type>
@@ -686,911 +597,773 @@ struct __tree_node_types;
template <class _NodePtr, class _Tp, class _VoidPtr>
struct __tree_node_types<_NodePtr, __tree_node<_Tp, _VoidPtr> >
- : public __tree_node_base_types<_VoidPtr>,
- __tree_key_value_types<_Tp>,
- __tree_map_pointer_types<_Tp, _VoidPtr>
-{
+ : public __tree_node_base_types<_VoidPtr>, __tree_key_value_types<_Tp>, __tree_map_pointer_types<_Tp, _VoidPtr> {
typedef __tree_node_base_types<_VoidPtr> __base;
- typedef __tree_key_value_types<_Tp> __key_base;
+ typedef __tree_key_value_types<_Tp> __key_base;
typedef __tree_map_pointer_types<_Tp, _VoidPtr> __map_pointer_base;
-public:
- typedef typename pointer_traits<_NodePtr>::element_type __node_type;
- typedef _NodePtr __node_pointer;
+public:
+ typedef typename pointer_traits<_NodePtr>::element_type __node_type;
+ typedef _NodePtr __node_pointer;
- typedef _Tp __node_value_type;
- typedef __rebind_pointer_t<_VoidPtr, __node_value_type>
- __node_value_type_pointer;
- typedef __rebind_pointer_t<_VoidPtr, const __node_value_type>
- __const_node_value_type_pointer;
+ typedef _Tp __node_value_type;
+ typedef __rebind_pointer_t<_VoidPtr, __node_value_type> __node_value_type_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> __const_node_value_type_pointer;
#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB)
typedef typename __base::__end_node_pointer __iter_pointer;
#else
typedef __conditional_t< is_pointer<__node_pointer>::value, typename __base::__end_node_pointer, __node_pointer>
__iter_pointer;
#endif
+
private:
- static_assert(!is_const<__node_type>::value,
- "_NodePtr should never be a pointer to const");
- static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>,
- _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr.");
+ static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
+ static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value),
+ "_VoidPtr does not rebind to _NodePtr.");
};
template <class _ValueTp, class _VoidPtr>
struct __make_tree_node_types {
- typedef __rebind_pointer_t<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> >
- _NodePtr;
+ typedef __rebind_pointer_t<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> > _NodePtr;
typedef __tree_node_types<_NodePtr> type;
};
// node
template <class _Pointer>
-class __tree_end_node
-{
+class __tree_end_node {
public:
- typedef _Pointer pointer;
- pointer __left_;
+ typedef _Pointer pointer;
+ pointer __left_;
- _LIBCPP_HIDE_FROM_ABI
- __tree_end_node() _NOEXCEPT : __left_() {}
+ _LIBCPP_HIDE_FROM_ABI __tree_end_node() _NOEXCEPT : __left_() {}
};
template <class _VoidPtr>
-class _LIBCPP_STANDALONE_DEBUG __tree_node_base
- : public __tree_node_base_types<_VoidPtr>::__end_node_type
-{
- typedef __tree_node_base_types<_VoidPtr> _NodeBaseTypes;
+class _LIBCPP_STANDALONE_DEBUG __tree_node_base : public __tree_node_base_types<_VoidPtr>::__end_node_type {
+ typedef __tree_node_base_types<_VoidPtr> _NodeBaseTypes;
public:
- typedef typename _NodeBaseTypes::__node_base_pointer pointer;
- typedef typename _NodeBaseTypes::__parent_pointer __parent_pointer;
+ typedef typename _NodeBaseTypes::__node_base_pointer pointer;
+ typedef typename _NodeBaseTypes::__parent_pointer __parent_pointer;
- pointer __right_;
- __parent_pointer __parent_;
- bool __is_black_;
+ pointer __right_;
+ __parent_pointer __parent_;
+ bool __is_black_;
- _LIBCPP_HIDE_FROM_ABI
- pointer __parent_unsafe() const { return static_cast<pointer>(__parent_);}
+ _LIBCPP_HIDE_FROM_ABI pointer __parent_unsafe() const { return static_cast<pointer>(__parent_); }
- _LIBCPP_HIDE_FROM_ABI
- void __set_parent(pointer __p) {
- __parent_ = static_cast<__parent_pointer>(__p);
- }
+ _LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); }
private:
- ~__tree_node_base() = delete;
- __tree_node_base(__tree_node_base const&) = delete;
+ ~__tree_node_base() = delete;
+ __tree_node_base(__tree_node_base const&) = delete;
__tree_node_base& operator=(__tree_node_base const&) = delete;
};
template <class _Tp, class _VoidPtr>
-class _LIBCPP_STANDALONE_DEBUG __tree_node
- : public __tree_node_base<_VoidPtr>
-{
+class _LIBCPP_STANDALONE_DEBUG __tree_node : public __tree_node_base<_VoidPtr> {
public:
- typedef _Tp __node_value_type;
+ typedef _Tp __node_value_type;
- __node_value_type __value_;
+ __node_value_type __value_;
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
private:
- ~__tree_node() = delete;
- __tree_node(__tree_node const&) = delete;
+ ~__tree_node() = delete;
+ __tree_node(__tree_node const&) = delete;
__tree_node& operator=(__tree_node const&) = delete;
};
-
template <class _Allocator>
-class __tree_node_destructor
-{
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __tree_node_destructor {
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
- typedef typename __alloc_traits::pointer pointer;
-private:
- typedef __tree_node_types<pointer> _NodeTypes;
- allocator_type& __na_;
+ typedef typename __alloc_traits::pointer pointer;
+private:
+ typedef __tree_node_types<pointer> _NodeTypes;
+ allocator_type& __na_;
public:
- bool __value_constructed;
+ bool __value_constructed;
+ _LIBCPP_HIDE_FROM_ABI __tree_node_destructor(const __tree_node_destructor&) = default;
+ __tree_node_destructor& operator=(const __tree_node_destructor&) = delete;
- _LIBCPP_HIDE_FROM_ABI __tree_node_destructor(const __tree_node_destructor &) = default;
- __tree_node_destructor& operator=(const __tree_node_destructor&) = delete;
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
+ : __na_(__na),
+ __value_constructed(__val) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
- : __na_(__na),
- __value_constructed(__val)
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__value_constructed)
- __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__value_constructed)
+ __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
- template <class> friend class __map_node_destructor;
+ template <class>
+ friend class __map_node_destructor;
};
#if _LIBCPP_STD_VER >= 17
template <class _NodeType, class _Alloc>
struct __generic_container_node_destructor;
template <class _Tp, class _VoidPtr, class _Alloc>
-struct __generic_container_node_destructor<__tree_node<_Tp, _VoidPtr>, _Alloc>
- : __tree_node_destructor<_Alloc>
-{
- using __tree_node_destructor<_Alloc>::__tree_node_destructor;
+struct __generic_container_node_destructor<__tree_node<_Tp, _VoidPtr>, _Alloc> : __tree_node_destructor<_Alloc> {
+ using __tree_node_destructor<_Alloc>::__tree_node_destructor;
};
#endif
template <class _Tp, class _NodePtr, class _DiffType>
-class _LIBCPP_TEMPLATE_VIS __tree_iterator
-{
- typedef __tree_node_types<_NodePtr> _NodeTypes;
- typedef _NodePtr __node_pointer;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
- typedef typename _NodeTypes::__iter_pointer __iter_pointer;
- typedef pointer_traits<__node_pointer> __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __tree_iterator {
+ typedef __tree_node_types<_NodePtr> _NodeTypes;
+ typedef _NodePtr __node_pointer;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
+ typedef typename _NodeTypes::__iter_pointer __iter_pointer;
+ typedef pointer_traits<__node_pointer> __pointer_traits;
- __iter_pointer __ptr_;
+ __iter_pointer __ptr_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _DiffType difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__node_value_type_pointer pointer;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _DiffType difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER >= 14
- : __ptr_(nullptr)
+ : __ptr_(nullptr)
#endif
- {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const
- {return __get_np()->__value_;}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const
- {return pointer_traits<pointer>::pointer_to(__get_np()->__value_);}
-
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator& operator++() {
- __ptr_ = static_cast<__iter_pointer>(
- std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator operator++(int)
- {__tree_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator& operator--() {
- __ptr_ = static_cast<__iter_pointer>(std::__tree_prev_iter<__node_base_pointer>(
- static_cast<__end_node_pointer>(__ptr_)));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __tree_iterator operator--(int)
- {__tree_iterator __t(*this); --(*this); return __t;}
+ {
+ }
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__value_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__get_np()->__value_); }
+
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator++() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator operator++(int) {
+ __tree_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator--() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_prev_iter<__node_base_pointer>(static_cast<__end_node_pointer>(__ptr_)));
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator operator--(int) {
+ __tree_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_iterator& __x, const __tree_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y) {
+ return !(__x == __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
- template <class, class, class> friend class __tree;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __map_iterator;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS set;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS multiset;
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
+ template <class, class, class>
+ friend class __tree;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __map_iterator;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
};
template <class _Tp, class _NodePtr, class _DiffType>
-class _LIBCPP_TEMPLATE_VIS __tree_const_iterator
-{
- typedef __tree_node_types<_NodePtr> _NodeTypes;
- typedef typename _NodeTypes::__node_pointer __node_pointer;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
- typedef typename _NodeTypes::__iter_pointer __iter_pointer;
- typedef pointer_traits<__node_pointer> __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __tree_const_iterator {
+ typedef __tree_node_types<_NodePtr> _NodeTypes;
+ typedef typename _NodeTypes::__node_pointer __node_pointer;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__end_node_pointer __end_node_pointer;
+ typedef typename _NodeTypes::__iter_pointer __iter_pointer;
+ typedef pointer_traits<__node_pointer> __pointer_traits;
- __iter_pointer __ptr_;
+ __iter_pointer __ptr_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _DiffType difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _DiffType difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_node_value_type_pointer pointer;
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER >= 14
- : __ptr_(nullptr)
+ : __ptr_(nullptr)
#endif
- {}
+ {
+ }
private:
- typedef __tree_iterator<value_type, __node_pointer, difference_type>
- __non_const_iterator;
+ typedef __tree_iterator<value_type, __node_pointer, difference_type> __non_const_iterator;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
- : __ptr_(__p.__ptr_) {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const
- {return __get_np()->__value_;}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const
- {return pointer_traits<pointer>::pointer_to(__get_np()->__value_);}
-
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator& operator++() {
- __ptr_ = static_cast<__iter_pointer>(
- std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator operator++(int)
- {__tree_const_iterator __t(*this); ++(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__value_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__get_np()->__value_); }
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator& operator--() {
- __ptr_ = static_cast<__iter_pointer>(std::__tree_prev_iter<__node_base_pointer>(
- static_cast<__end_node_pointer>(__ptr_)));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator++() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_)));
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __tree_const_iterator operator--(int)
- {__tree_const_iterator __t(*this); --(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator++(int) {
+ __tree_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator--() {
+ __ptr_ = static_cast<__iter_pointer>(
+ std::__tree_prev_iter<__node_base_pointer>(static_cast<__end_node_pointer>(__ptr_)));
+ return *this;
+ }
-private:
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT
- : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
-
- template <class, class, class> friend class __tree;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS set;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS multiset;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator--(int) {
+ __tree_const_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
+ return !(__x == __y);
+ }
+private:
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
+
+ template <class, class, class>
+ friend class __tree;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
};
-template<class _Tp, class _Compare>
+template <class _Tp, class _Compare>
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
- "the specified comparator type does not provide a viable const call operator")
+_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
+ "the specified comparator type does not provide a viable const call operator")
#endif
int __diagnose_non_const_comparator();
template <class _Tp, class _Compare, class _Allocator>
-class __tree
-{
+class __tree {
public:
- typedef _Tp value_type;
- typedef _Compare value_compare;
- typedef _Allocator allocator_type;
+ typedef _Tp value_type;
+ typedef _Compare value_compare;
+ typedef _Allocator allocator_type;
private:
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __make_tree_node_types<value_type,
- typename __alloc_traits::void_pointer>::type
- _NodeTypes;
- typedef typename _NodeTypes::key_type key_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __make_tree_node_types<value_type, typename __alloc_traits::void_pointer>::type _NodeTypes;
+ typedef typename _NodeTypes::key_type key_type;
+
public:
- typedef typename _NodeTypes::__node_value_type __node_value_type;
- typedef typename _NodeTypes::__container_value_type __container_value_type;
+ typedef typename _NodeTypes::__node_value_type __node_value_type;
+ typedef typename _NodeTypes::__container_value_type __container_value_type;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
public:
- typedef typename _NodeTypes::__void_pointer __void_pointer;
+ typedef typename _NodeTypes::__void_pointer __void_pointer;
- typedef typename _NodeTypes::__node_type __node;
- typedef typename _NodeTypes::__node_pointer __node_pointer;
+ typedef typename _NodeTypes::__node_type __node;
+ typedef typename _NodeTypes::__node_pointer __node_pointer;
- typedef typename _NodeTypes::__node_base_type __node_base;
- typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
+ typedef typename _NodeTypes::__node_base_type __node_base;
+ typedef typename _NodeTypes::__node_base_pointer __node_base_pointer;
- typedef typename _NodeTypes::__end_node_type __end_node_t;
- typedef typename _NodeTypes::__end_node_pointer __end_node_ptr;
+ typedef typename _NodeTypes::__end_node_type __end_node_t;
+ typedef typename _NodeTypes::__end_node_pointer __end_node_ptr;
- typedef typename _NodeTypes::__parent_pointer __parent_pointer;
- typedef typename _NodeTypes::__iter_pointer __iter_pointer;
+ typedef typename _NodeTypes::__parent_pointer __parent_pointer;
+ typedef typename _NodeTypes::__iter_pointer __iter_pointer;
- typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_traits;
+ typedef __rebind_alloc<__alloc_traits, __node> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_traits;
private:
- // check for sane allocator pointer rebinding semantics. Rebinding the
- // allocator for a new pointer type should be exactly the same as rebinding
- // the pointer using 'pointer_traits'.
- static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
- typedef __rebind_alloc<__node_traits, __node_base> __node_base_allocator;
- typedef allocator_traits<__node_base_allocator> __node_base_traits;
- static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
- "Allocator does not rebind pointers in a sane manner.");
+ // check for sane allocator pointer rebinding semantics. Rebinding the
+ // allocator for a new pointer type should be exactly the same as rebinding
+ // the pointer using 'pointer_traits'.
+ static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
+ typedef __rebind_alloc<__node_traits, __node_base> __node_base_allocator;
+ typedef allocator_traits<__node_base_allocator> __node_base_traits;
+ static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
+ "Allocator does not rebind pointers in a sane manner.");
private:
- __iter_pointer __begin_node_;
- __compressed_pair<__end_node_t, __node_allocator> __pair1_;
- __compressed_pair<size_type, value_compare> __pair3_;
+ __iter_pointer __begin_node_;
+ __compressed_pair<__end_node_t, __node_allocator> __pair1_;
+ __compressed_pair<size_type, value_compare> __pair3_;
public:
- _LIBCPP_HIDE_FROM_ABI
- __iter_pointer __end_node() _NOEXCEPT
- {
- return static_cast<__iter_pointer>(
- pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first())
- );
- }
- _LIBCPP_HIDE_FROM_ABI
- __iter_pointer __end_node() const _NOEXCEPT
- {
- return static_cast<__iter_pointer>(
- pointer_traits<__end_node_ptr>::pointer_to(
- const_cast<__end_node_t&>(__pair1_.first())
- )
- );
- }
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __node_alloc() _NOEXCEPT {return __pair1_.second();}
+ _LIBCPP_HIDE_FROM_ABI __iter_pointer __end_node() _NOEXCEPT {
+ return static_cast<__iter_pointer>(pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first()));
+ }
+ _LIBCPP_HIDE_FROM_ABI __iter_pointer __end_node() const _NOEXCEPT {
+ return static_cast<__iter_pointer>(
+ pointer_traits<__end_node_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first())));
+ }
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __pair1_.second(); }
+
private:
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __node_alloc() const _NOEXCEPT
- {return __pair1_.second();}
- _LIBCPP_HIDE_FROM_ABI
- __iter_pointer& __begin_node() _NOEXCEPT {return __begin_node_;}
- _LIBCPP_HIDE_FROM_ABI
- const __iter_pointer& __begin_node() const _NOEXCEPT {return __begin_node_;}
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __pair1_.second(); }
+ _LIBCPP_HIDE_FROM_ABI __iter_pointer& __begin_node() _NOEXCEPT { return __begin_node_; }
+ _LIBCPP_HIDE_FROM_ABI const __iter_pointer& __begin_node() const _NOEXCEPT { return __begin_node_; }
+
public:
- _LIBCPP_HIDE_FROM_ABI
- allocator_type __alloc() const _NOEXCEPT
- {return allocator_type(__node_alloc());}
+ _LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); }
+
private:
- _LIBCPP_HIDE_FROM_ABI
- size_type& size() _NOEXCEPT {return __pair3_.first();}
+ _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __pair3_.first(); }
+
public:
- _LIBCPP_HIDE_FROM_ABI
- const size_type& size() const _NOEXCEPT {return __pair3_.first();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare& value_comp() _NOEXCEPT {return __pair3_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const value_compare& value_comp() const _NOEXCEPT
- {return __pair3_.second();}
+ _LIBCPP_HIDE_FROM_ABI const size_type& size() const _NOEXCEPT { return __pair3_.first(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __pair3_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __pair3_.second(); }
+
public:
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT {
+ return static_cast<__node_pointer>(__end_node()->__left_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __root() const _NOEXCEPT
- {return static_cast<__node_pointer>(__end_node()->__left_);}
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT {
+ return std::addressof(__end_node()->__left_);
+ }
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT {
- return std::addressof(__end_node()->__left_);
- }
+ typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
+ typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value);
+ _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t);
+ _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t);
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t) _NOEXCEPT_(
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value);
+ _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<value_compare>::value&&
+ is_nothrow_move_assignable<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI ~__tree();
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__begin_node()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__begin_node()); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_node()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_node()); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
- typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
- typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_copy_constructible<value_compare>::value);
- _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t);
- _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t);
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
- _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<value_compare>::value);
- _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<value_compare>::value &&
- is_nothrow_move_assignable<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI ~__tree();
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return iterator(__begin_node());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return const_iterator(__begin_node());}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return iterator(__end_node());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return const_iterator(__end_node());}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {return std::min<size_type>(
- __node_traits::max_size(__node_alloc()),
- numeric_limits<difference_type >::max());}
-
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI void swap(__tree& __t)
+ _LIBCPP_HIDE_FROM_ABI void swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<value_compare>::value
- && (!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
- );
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value &&
+ (!__node_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value));
#else
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
#endif
- template <class _Key, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool>
- __emplace_unique_key_args(_Key const&, _Args&&... __args);
- template <class _Key, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool>
- __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
+ template <class _Key, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args&&... __args);
+ template <class _Key, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique_impl(const_iterator __p, _Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_impl(_Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique_impl(const_iterator __p, _Args&&... __args);
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Pp&& __x) {
- return __emplace_unique_extract_key(std::forward<_Pp>(__x),
- __can_extract_key<_Pp, key_type>());
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
- template <class _First, class _Second,
- __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique(_First&& __f, _Second&& __s) {
- return __emplace_unique_key_args(__f, std::forward<_First>(__f),
- std::forward<_Second>(__s));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Pp&& __x) {
+ return __emplace_unique_extract_key(std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __emplace_unique(_Args&&... __args) {
- return __emplace_unique_impl(std::forward<_Args>(__args)...);
- }
+ template <class _First,
+ class _Second,
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_First&& __f, _Second&& __s) {
+ return __emplace_unique_key_args(__f, std::forward<_First>(__f), std::forward<_Second>(__s));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
- return __emplace_unique_impl(std::forward<_Pp>(__x));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
+ return __emplace_unique_impl(std::forward<_Args>(__args)...);
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
- return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
+ return __emplace_unique_impl(std::forward<_Pp>(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
- return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
+ return __emplace_unique_key_args(__x, std::forward<_Pp>(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_hint_unique(const_iterator __p, _Pp&& __x) {
- return __emplace_hint_unique_extract_key(__p, std::forward<_Pp>(__x),
- __can_extract_key<_Pp, key_type>());
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
+ return __emplace_unique_key_args(__x.first, std::forward<_Pp>(__x));
+ }
- template <class _First, class _Second,
- __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
- return __emplace_hint_unique_key_args(__p, __f,
- std::forward<_First>(__f),
- std::forward<_Second>(__s)).first;
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _Pp&& __x) {
+ return __emplace_hint_unique_extract_key(__p, std::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>());
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
- return __emplace_hint_unique_impl(__p, std::forward<_Args>(__args)...);
- }
+ template <class _First,
+ class _Second,
+ __enable_if_t<__can_extract_map_key<_First, key_type, __container_value_type>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
+ return __emplace_hint_unique_key_args(__p, __f, std::forward<_First>(__f), std::forward<_Second>(__s)).first;
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_fail_tag) {
- return __emplace_hint_unique_impl(__p, std::forward<_Pp>(__x));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
+ return __emplace_hint_unique_impl(__p, std::forward<_Args>(__args)...);
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) {
- return __emplace_hint_unique_key_args(__p, __x, std::forward<_Pp>(__x)).first;
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_fail_tag) {
+ return __emplace_hint_unique_impl(__p, std::forward<_Pp>(__x));
+ }
- template <class _Pp>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) {
- return __emplace_hint_unique_key_args(__p, __x.first, std::forward<_Pp>(__x)).first;
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) {
+ return __emplace_hint_unique_key_args(__p, __x, std::forward<_Pp>(__x)).first;
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(const __container_value_type& __v) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v);
- }
+ template <class _Pp>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) {
+ return __emplace_hint_unique_key_args(__p, __x.first, std::forward<_Pp>(__x)).first;
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_unique(const_iterator __p, const __container_value_type& __v) {
- return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first;
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(const __container_value_type& __v) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(__container_value_type&& __v) {
- return __emplace_unique_key_args(_NodeTypes::__get_key(__v), std::move(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_unique(const_iterator __p, const __container_value_type& __v) {
+ return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first;
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_unique(const_iterator __p, __container_value_type&& __v) {
- return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), std::move(__v)).first;
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(__container_value_type&& __v) {
+ return __emplace_unique_key_args(_NodeTypes::__get_key(__v), std::move(__v));
+ }
- template <class _Vp,
- class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __insert_unique(_Vp&& __v) {
- return __emplace_unique(std::forward<_Vp>(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_unique(const_iterator __p, __container_value_type&& __v) {
+ return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), std::move(__v)).first;
+ }
- template <class _Vp,
- class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_unique(const_iterator __p, _Vp&& __v) {
- return __emplace_hint_unique(__p, std::forward<_Vp>(__v));
- }
+ template <class _Vp, class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(_Vp&& __v) {
+ return __emplace_unique(std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(__container_value_type&& __v) {
- return __emplace_multi(std::move(__v));
- }
+ template <class _Vp, class = __enable_if_t<!is_same<__remove_const_ref_t<_Vp>, __container_value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_unique(const_iterator __p, _Vp&& __v) {
+ return __emplace_hint_unique(__p, std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(const_iterator __p, __container_value_type&& __v) {
- return __emplace_hint_multi(__p, std::move(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(__container_value_type&& __v) {
+ return __emplace_multi(std::move(__v));
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(_Vp&& __v) {
- return __emplace_multi(std::forward<_Vp>(__v));
- }
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(const_iterator __p, __container_value_type&& __v) {
+ return __emplace_hint_multi(__p, std::move(__v));
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_multi(const_iterator __p, _Vp&& __v) {
- return __emplace_hint_multi(__p, std::forward<_Vp>(__v));
- }
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(_Vp&& __v) {
+ return __emplace_multi(std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_multi(const_iterator __p, _Vp&& __v) {
+ return __emplace_hint_multi(__p, std::forward<_Vp>(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(__node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool>
+ __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(__node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI iterator
- __remove_node_pointer(__node_pointer) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI iterator __remove_node_pointer(__node_pointer) _NOEXCEPT;
#if _LIBCPP_STD_VER >= 17
- template <class _NodeHandle, class _InsertReturnType>
- _LIBCPP_HIDE_FROM_ABI
- _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&);
- template <class _Tree>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_unique(_Tree& __source);
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(_NodeHandle&&);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&);
- template <class _Tree>
- _LIBCPP_HIDE_FROM_ABI
- void __node_handle_merge_multi(_Tree& __source);
-
-
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(key_type const&);
- template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI
- _NodeHandle __node_handle_extract(const_iterator);
+ template <class _NodeHandle, class _InsertReturnType>
+ _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&);
+ template <class _Tree>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(_Tree& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&&);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&);
+ template <class _Tree>
+ _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(_Tree& __source);
+
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const&);
+ template <class _NodeHandle>
+ _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator);
#endif
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
-
- _LIBCPP_HIDE_FROM_ABI void __insert_node_at(__parent_pointer __parent,
- __node_base_pointer& __child,
- __node_base_pointer __new_node) _NOEXCEPT;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __v);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __v) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const _Key& __v)
- {return __lower_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const _Key& __v) const
- {return __lower_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const _Key& __v)
- {return __upper_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const _Key& __v) const
- {return __upper_bound(__v, __root(), __end_node());}
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const;
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_unique(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_unique(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator>
- __equal_range_multi(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator>
- __equal_range_multi(const _Key& __k) const;
-
- typedef __tree_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
-
- _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
+
+ _LIBCPP_HIDE_FROM_ABI void
+ __insert_node_at(__parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __v);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __v) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _Key& __v) {
+ return __lower_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _Key& __v) const {
+ return __lower_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator
+ __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _Key& __v) {
+ return __upper_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI iterator __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _Key& __v) const {
+ return __upper_bound(__v, __root(), __end_node());
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI const_iterator
+ __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const;
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const;
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_multi(const _Key& __k);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const;
+
+ typedef __tree_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+
+ _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
+
private:
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_low(__parent_pointer& __parent, const key_type& __v);
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_high(__parent_pointer& __parent, const key_type& __v);
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
- __find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v);
- // FIXME: Make this function const qualified. Unfortunately doing so
- // breaks existing code which uses non-const callable comparators.
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
- __find_equal(__parent_pointer& __parent, const _Key& __v) const {
- return const_cast<__tree*>(this)->__find_equal(__parent, __v);
- }
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
- __find_equal(const_iterator __hint, __parent_pointer& __parent,
- __node_base_pointer& __dummy,
- const _Key& __v);
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_low(__parent_pointer& __parent, const key_type& __v);
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_high(__parent_pointer& __parent, const key_type& __v);
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
+ __find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v);
+ // FIXME: Make this function const qualified. Unfortunately doing so
+ // breaks existing code which uses non-const callable comparators.
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v);
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v) const {
+ return const_cast<__tree*>(this)->__find_equal(__parent, __v);
+ }
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
+ __find_equal(const_iterator __hint, __parent_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v);
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&& ...__args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT;
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __tree& __t)
- {__copy_assign_alloc(__t, integral_constant<bool,
- __node_traits::propagate_on_container_copy_assignment::value>());}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t) {
+ __copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __tree& __t, true_type)
- {
- if (__node_alloc() != __t.__node_alloc())
- clear();
- __node_alloc() = __t.__node_alloc();
- }
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __tree&, false_type) {}
-
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
- is_nothrow_move_assignable<__node_allocator>::value);
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__tree& __t)
- _NOEXCEPT_(
- !__node_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__t, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__tree& __t, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {__node_alloc() = std::move(__t.__node_alloc());}
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
-
- struct _DetachedTreeCache {
- _LIBCPP_HIDE_FROM_ABI
- explicit _DetachedTreeCache(__tree *__t) _NOEXCEPT : __t_(__t),
- __cache_root_(__detach_from_tree(__t)) {
- __advance();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t, true_type) {
+ if (__node_alloc() != __t.__node_alloc())
+ clear();
+ __node_alloc() = __t.__node_alloc();
+ }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree&, false_type) {}
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get() const _NOEXCEPT {
- return __cache_elem_;
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type) _NOEXCEPT_(
+ is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- void __advance() _NOEXCEPT {
- __cache_elem_ = __cache_root_;
- if (__cache_root_) {
- __cache_root_ = __detach_next(__cache_root_);
- }
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- ~_DetachedTreeCache() {
- __t_->destroy(__cache_elem_);
- if (__cache_root_) {
- while (__cache_root_->__parent_ != nullptr)
- __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_);
- __t_->destroy(__cache_root_);
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ __node_alloc() = std::move(__t.__node_alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
+
+ struct _DetachedTreeCache {
+ _LIBCPP_HIDE_FROM_ABI explicit _DetachedTreeCache(__tree* __t) _NOEXCEPT
+ : __t_(__t),
+ __cache_root_(__detach_from_tree(__t)) {
+ __advance();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get() const _NOEXCEPT { return __cache_elem_; }
+
+ _LIBCPP_HIDE_FROM_ABI void __advance() _NOEXCEPT {
+ __cache_elem_ = __cache_root_;
+ if (__cache_root_) {
+ __cache_root_ = __detach_next(__cache_root_);
}
+ }
- _DetachedTreeCache(_DetachedTreeCache const&) = delete;
- _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
+ _LIBCPP_HIDE_FROM_ABI ~_DetachedTreeCache() {
+ __t_->destroy(__cache_elem_);
+ if (__cache_root_) {
+ while (__cache_root_->__parent_ != nullptr)
+ __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_);
+ __t_->destroy(__cache_root_);
+ }
+ }
- private:
- _LIBCPP_HIDE_FROM_ABI
- static __node_pointer __detach_from_tree(__tree *__t) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
+ _DetachedTreeCache(_DetachedTreeCache const&) = delete;
+ _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
- __tree *__t_;
- __node_pointer __cache_root_;
- __node_pointer __cache_elem_;
- };
+ private:
+ _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_from_tree(__tree* __t) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
+ __tree* __t_;
+ __node_pointer __cache_root_;
+ __node_pointer __cache_elem_;
+ };
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
};
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<__node_allocator>::value &&
- is_nothrow_copy_constructible<value_compare>::value)
- : __pair3_(0, __comp)
-{
- __begin_node() = __end_node();
+__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value)
+ : __pair3_(0, __comp) {
+ __begin_node() = __end_node();
}
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
: __begin_node_(__iter_pointer()),
__pair1_(__default_init_tag(), __node_allocator(__a)),
- __pair3_(0, __default_init_tag())
-{
- __begin_node() = __end_node();
+ __pair3_(0, __default_init_tag()) {
+ __begin_node() = __end_node();
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
- const allocator_type& __a)
- : __begin_node_(__iter_pointer()),
- __pair1_(__default_init_tag(), __node_allocator(__a)),
- __pair3_(0, __comp)
-{
- __begin_node() = __end_node();
+__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, const allocator_type& __a)
+ : __begin_node_(__iter_pointer()), __pair1_(__default_init_tag(), __node_allocator(__a)), __pair3_(0, __comp) {
+ __begin_node() = __end_node();
}
// Precondition: size() != 0
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
-__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree *__t) _NOEXCEPT
-{
- __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node());
- __t->__begin_node() = __t->__end_node();
- __t->__end_node()->__left_->__parent_ = nullptr;
- __t->__end_node()->__left_ = nullptr;
- __t->size() = 0;
- // __cache->__left_ == nullptr
- if (__cache->__right_ != nullptr)
- __cache = static_cast<__node_pointer>(__cache->__right_);
- // __cache->__left_ == nullptr
- // __cache->__right_ == nullptr
- return __cache;
+__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree* __t) _NOEXCEPT {
+ __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node());
+ __t->__begin_node() = __t->__end_node();
+ __t->__end_node()->__left_->__parent_ = nullptr;
+ __t->__end_node()->__left_ = nullptr;
+ __t->size() = 0;
+ // __cache->__left_ == nullptr
+ if (__cache->__right_ != nullptr)
+ __cache = static_cast<__node_pointer>(__cache->__right_);
+ // __cache->__left_ == nullptr
+ // __cache->__right_ == nullptr
+ return __cache;
}
// Precondition: __cache != nullptr
@@ -1599,259 +1372,214 @@ __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree
// This is no longer a red-black tree
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
-__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT
-{
- if (__cache->__parent_ == nullptr)
- return nullptr;
- if (std::__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
- {
- __cache->__parent_->__left_ = nullptr;
- __cache = static_cast<__node_pointer>(__cache->__parent_);
- if (__cache->__right_ == nullptr)
- return __cache;
- return static_cast<__node_pointer>(std::__tree_leaf(__cache->__right_));
- }
- // __cache is right child
- __cache->__parent_unsafe()->__right_ = nullptr;
- __cache = static_cast<__node_pointer>(__cache->__parent_);
- if (__cache->__left_ == nullptr)
- return __cache;
- return static_cast<__node_pointer>(std::__tree_leaf(__cache->__left_));
+__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT {
+ if (__cache->__parent_ == nullptr)
+ return nullptr;
+ if (std::__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) {
+ __cache->__parent_->__left_ = nullptr;
+ __cache = static_cast<__node_pointer>(__cache->__parent_);
+ if (__cache->__right_ == nullptr)
+ return __cache;
+ return static_cast<__node_pointer>(std::__tree_leaf(__cache->__right_));
+ }
+ // __cache is right child
+ __cache->__parent_unsafe()->__right_ = nullptr;
+ __cache = static_cast<__node_pointer>(__cache->__parent_);
+ if (__cache->__left_ == nullptr)
+ return __cache;
+ return static_cast<__node_pointer>(std::__tree_leaf(__cache->__left_));
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>&
-__tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t)
-{
- if (this != std::addressof(__t))
- {
- value_comp() = __t.value_comp();
- __copy_assign_alloc(__t);
- __assign_multi(__t.begin(), __t.end());
- }
- return *this;
+__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
+ if (this != std::addressof(__t)) {
+ value_comp() = __t.value_comp();
+ __copy_assign_alloc(__t);
+ __assign_multi(__t.begin(), __t.end());
+ }
+ return *this;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _ForwardIterator>
-void
-__tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last)
-{
- typedef iterator_traits<_ForwardIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value),
- "__assign_unique may only be called with the containers value type");
- static_assert(__has_forward_iterator_category<_ForwardIterator>::value,
- "__assign_unique requires a forward iterator");
- if (size() != 0)
- {
- _DetachedTreeCache __cache(this);
- for (; __cache.__get() != nullptr && __first != __last; ++__first) {
- if (__node_assign_unique(*__first, __cache.__get()).second)
- __cache.__advance();
- }
+void __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) {
+ typedef iterator_traits<_ForwardIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert((is_same<_ItValueType, __container_value_type>::value),
+ "__assign_unique may only be called with the containers value type");
+ static_assert(
+ __has_forward_iterator_category<_ForwardIterator>::value, "__assign_unique requires a forward iterator");
+ if (size() != 0) {
+ _DetachedTreeCache __cache(this);
+ for (; __cache.__get() != nullptr && __first != __last; ++__first) {
+ if (__node_assign_unique(*__first, __cache.__get()).second)
+ __cache.__advance();
}
- for (; __first != __last; ++__first)
- __insert_unique(*__first);
+ }
+ for (; __first != __last; ++__first)
+ __insert_unique(*__first);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _InputIterator>
-void
-__tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last)
-{
- typedef iterator_traits<_InputIterator> _ITraits;
- typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value ||
- is_same<_ItValueType, __node_value_type>::value),
- "__assign_multi may only be called with the containers value type"
- " or the nodes value type");
- if (size() != 0)
- {
- _DetachedTreeCache __cache(this);
- for (; __cache.__get() && __first != __last; ++__first) {
- __cache.__get()->__value_ = *__first;
- __node_insert_multi(__cache.__get());
- __cache.__advance();
- }
+void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last) {
+ typedef iterator_traits<_InputIterator> _ITraits;
+ typedef typename _ITraits::value_type _ItValueType;
+ static_assert(
+ (is_same<_ItValueType, __container_value_type>::value || is_same<_ItValueType, __node_value_type>::value),
+ "__assign_multi may only be called with the containers value type"
+ " or the nodes value type");
+ if (size() != 0) {
+ _DetachedTreeCache __cache(this);
+ for (; __cache.__get() && __first != __last; ++__first) {
+ __cache.__get()->__value_ = *__first;
+ __node_insert_multi(__cache.__get());
+ __cache.__advance();
}
- for (; __first != __last; ++__first)
- __insert_multi(_NodeTypes::__get_value(*__first));
+ }
+ for (; __first != __last; ++__first)
+ __insert_multi(_NodeTypes::__get_value(*__first));
}
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
: __begin_node_(__iter_pointer()),
__pair1_(__default_init_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
- __pair3_(0, __t.value_comp())
-{
- __begin_node() = __end_node();
+ __pair3_(0, __t.value_comp()) {
+ __begin_node() = __end_node();
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
- _NOEXCEPT_(
- is_nothrow_move_constructible<__node_allocator>::value &&
- is_nothrow_move_constructible<value_compare>::value)
+__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
+ is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value)
: __begin_node_(std::move(__t.__begin_node_)),
__pair1_(std::move(__t.__pair1_)),
- __pair3_(std::move(__t.__pair3_))
-{
- if (size() == 0)
- __begin_node() = __end_node();
- else
- {
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- __t.__begin_node() = __t.__end_node();
- __t.__end_node()->__left_ = nullptr;
- __t.size() = 0;
- }
+ __pair3_(std::move(__t.__pair3_)) {
+ if (size() == 0)
+ __begin_node() = __end_node();
+ else {
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ __t.__begin_node() = __t.__end_node();
+ __t.__end_node()->__left_ = nullptr;
+ __t.size() = 0;
+ }
}
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
- : __pair1_(__default_init_tag(), __node_allocator(__a)),
- __pair3_(0, std::move(__t.value_comp()))
-{
- if (__a == __t.__alloc())
- {
- if (__t.size() == 0)
- __begin_node() = __end_node();
- else
- {
- __begin_node() = __t.__begin_node();
- __end_node()->__left_ = __t.__end_node()->__left_;
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- size() = __t.size();
- __t.__begin_node() = __t.__end_node();
- __t.__end_node()->__left_ = nullptr;
- __t.size() = 0;
- }
- }
- else
- {
- __begin_node() = __end_node();
- }
+ : __pair1_(__default_init_tag(), __node_allocator(__a)), __pair3_(0, std::move(__t.value_comp())) {
+ if (__a == __t.__alloc()) {
+ if (__t.size() == 0)
+ __begin_node() = __end_node();
+ else {
+ __begin_node() = __t.__begin_node();
+ __end_node()->__left_ = __t.__end_node()->__left_;
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ size() = __t.size();
+ __t.__begin_node() = __t.__end_node();
+ __t.__end_node()->__left_ = nullptr;
+ __t.size() = 0;
+ }
+ } else {
+ __begin_node() = __end_node();
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
- is_nothrow_move_assignable<__node_allocator>::value)
-{
- destroy(static_cast<__node_pointer>(__end_node()->__left_));
- __begin_node_ = __t.__begin_node_;
- __pair1_.first() = __t.__pair1_.first();
- __move_assign_alloc(__t);
- __pair3_ = std::move(__t.__pair3_);
- if (size() == 0)
- __begin_node() = __end_node();
- else
- {
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- __t.__begin_node() = __t.__end_node();
- __t.__end_node()->__left_ = nullptr;
- __t.size() = 0;
- }
+void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value) {
+ destroy(static_cast<__node_pointer>(__end_node()->__left_));
+ __begin_node_ = __t.__begin_node_;
+ __pair1_.first() = __t.__pair1_.first();
+ __move_assign_alloc(__t);
+ __pair3_ = std::move(__t.__pair3_);
+ if (size() == 0)
+ __begin_node() = __end_node();
+ else {
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ __t.__begin_node() = __t.__end_node();
+ __t.__end_node()->__left_ = nullptr;
+ __t.size() = 0;
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
-{
- if (__node_alloc() == __t.__node_alloc())
- __move_assign(__t, true_type());
- else
- {
- value_comp() = std::move(__t.value_comp());
- const_iterator __e = end();
- if (size() != 0)
- {
- _DetachedTreeCache __cache(this);
- while (__cache.__get() != nullptr && __t.size() != 0) {
- __cache.__get()->__value_ = std::move(__t.remove(__t.begin())->__value_);
- __node_insert_multi(__cache.__get());
- __cache.__advance();
- }
- }
- while (__t.size() != 0)
- __insert_multi(__e, _NodeTypes::__move(__t.remove(__t.begin())->__value_));
+void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
+ if (__node_alloc() == __t.__node_alloc())
+ __move_assign(__t, true_type());
+ else {
+ value_comp() = std::move(__t.value_comp());
+ const_iterator __e = end();
+ if (size() != 0) {
+ _DetachedTreeCache __cache(this);
+ while (__cache.__get() != nullptr && __t.size() != 0) {
+ __cache.__get()->__value_ = std::move(__t.remove(__t.begin())->__value_);
+ __node_insert_multi(__cache.__get());
+ __cache.__advance();
+ }
}
+ while (__t.size() != 0)
+ __insert_multi(__e, _NodeTypes::__move(__t.remove(__t.begin())->__value_));
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>&
-__tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<value_compare>::value &&
+__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<value_compare>::value&&
is_nothrow_move_assignable<__node_allocator>::value)
{
- __move_assign(__t, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());
- return *this;
+ __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::~__tree()
-{
- static_assert((is_copy_constructible<value_compare>::value),
- "Comparator must be copy-constructible.");
+__tree<_Tp, _Compare, _Allocator>::~__tree() {
+ static_assert((is_copy_constructible<value_compare>::value), "Comparator must be copy-constructible.");
destroy(__root());
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
-{
- if (__nd != nullptr)
- {
- destroy(static_cast<__node_pointer>(__nd->__left_));
- destroy(static_cast<__node_pointer>(__nd->__right_));
- __node_allocator& __na = __node_alloc();
- __node_traits::destroy(__na, _NodeTypes::__get_ptr(__nd->__value_));
- __node_traits::deallocate(__na, __nd, 1);
- }
+void __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT {
+ if (__nd != nullptr) {
+ destroy(static_cast<__node_pointer>(__nd->__left_));
+ destroy(static_cast<__node_pointer>(__nd->__right_));
+ __node_allocator& __na = __node_alloc();
+ __node_traits::destroy(__na, _NodeTypes::__get_ptr(__nd->__value_));
+ __node_traits::deallocate(__na, __nd, 1);
+ }
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
+void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
- __is_nothrow_swappable<value_compare>::value
- && (!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
- )
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value))
#else
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value)
+ _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value)
#endif
{
- using std::swap;
- swap(__begin_node_, __t.__begin_node_);
- swap(__pair1_.first(), __t.__pair1_.first());
- std::__swap_allocator(__node_alloc(), __t.__node_alloc());
- __pair3_.swap(__t.__pair3_);
- if (size() == 0)
- __begin_node() = __end_node();
- else
- __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
- if (__t.size() == 0)
- __t.__begin_node() = __t.__end_node();
- else
- __t.__end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__t.__end_node());
+ using std::swap;
+ swap(__begin_node_, __t.__begin_node_);
+ swap(__pair1_.first(), __t.__pair1_.first());
+ std::__swap_allocator(__node_alloc(), __t.__node_alloc());
+ __pair3_.swap(__t.__pair3_);
+ if (size() == 0)
+ __begin_node() = __end_node();
+ else
+ __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node());
+ if (__t.size() == 0)
+ __t.__begin_node() = __t.__end_node();
+ else
+ __t.__end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__t.__end_node());
}
template <class _Tp, class _Compare, class _Allocator>
-void
-__tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT
-{
- destroy(__root());
- size() = 0;
- __begin_node() = __end_node();
- __end_node()->__left_ = nullptr;
+void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
+ destroy(__root());
+ size() = 0;
+ __begin_node() = __end_node();
+ __end_node()->__left_ = nullptr;
}
// Find lower_bound place to insert
@@ -1859,38 +1587,29 @@ __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent,
- const key_type& __v)
-{
- __node_pointer __nd = __root();
- if (__nd != nullptr)
- {
- while (true)
- {
- if (value_comp()(__nd->__value_, __v))
- {
- if (__nd->__right_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__right_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __nd->__right_;
- }
- }
- else
- {
- if (__nd->__left_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__left_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __parent->__left_;
- }
- }
+__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent, const key_type& __v) {
+ __node_pointer __nd = __root();
+ if (__nd != nullptr) {
+ while (true) {
+ if (value_comp()(__nd->__value_, __v)) {
+ if (__nd->__right_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__right_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __nd->__right_;
}
+ } else {
+ if (__nd->__left_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__left_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __parent->__left_;
+ }
+ }
}
- __parent = static_cast<__parent_pointer>(__end_node());
- return __parent->__left_;
+ }
+ __parent = static_cast<__parent_pointer>(__end_node());
+ return __parent->__left_;
}
// Find upper_bound place to insert
@@ -1898,38 +1617,29 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent,
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent,
- const key_type& __v)
-{
- __node_pointer __nd = __root();
- if (__nd != nullptr)
- {
- while (true)
- {
- if (value_comp()(__v, __nd->__value_))
- {
- if (__nd->__left_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__left_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __parent->__left_;
- }
- }
- else
- {
- if (__nd->__right_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__right_);
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return __nd->__right_;
- }
- }
+__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent, const key_type& __v) {
+ __node_pointer __nd = __root();
+ if (__nd != nullptr) {
+ while (true) {
+ if (value_comp()(__v, __nd->__value_)) {
+ if (__nd->__left_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__left_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __parent->__left_;
+ }
+ } else {
+ if (__nd->__right_ != nullptr)
+ __nd = static_cast<__node_pointer>(__nd->__right_);
+ else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __nd->__right_;
}
+ }
}
- __parent = static_cast<__parent_pointer>(__end_node());
- return __parent->__left_;
+ }
+ __parent = static_cast<__parent_pointer>(__end_node());
+ return __parent->__left_;
}
// Find leaf place to insert closest to __hint
@@ -1940,33 +1650,26 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent,
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
- __parent_pointer& __parent,
- const key_type& __v)
-{
- if (__hint == end() || !value_comp()(*__hint, __v)) // check before
- {
- // __v <= *__hint
- const_iterator __prior = __hint;
- if (__prior == begin() || !value_comp()(__v, *--__prior))
- {
- // *prev(__hint) <= __v <= *__hint
- if (__hint.__ptr_->__left_ == nullptr)
- {
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- return __parent->__left_;
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__prior.__ptr_);
- return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
- }
- }
- // __v < *prev(__hint)
- return __find_leaf_high(__parent, __v);
+__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v) {
+ if (__hint == end() || !value_comp()(*__hint, __v)) // check before
+ {
+ // __v <= *__hint
+ const_iterator __prior = __hint;
+ if (__prior == begin() || !value_comp()(__v, *--__prior)) {
+ // *prev(__hint) <= __v <= *__hint
+ if (__hint.__ptr_->__left_ == nullptr) {
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ return __parent->__left_;
+ } else {
+ __parent = static_cast<__parent_pointer>(__prior.__ptr_);
+ return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
+ }
}
- // else __v > *__hint
- return __find_leaf_low(__parent, __v);
+ // __v < *prev(__hint)
+ return __find_leaf_high(__parent, __v);
+ }
+ // else __v > *__hint
+ return __find_leaf_low(__parent, __v);
}
// Find place to insert if __v doesn't exist
@@ -1976,44 +1679,35 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent,
- const _Key& __v)
-{
- __node_pointer __nd = __root();
- __node_base_pointer* __nd_ptr = __root_ptr();
- if (__nd != nullptr)
- {
- while (true)
- {
- if (value_comp()(__v, __nd->__value_))
- {
- if (__nd->__left_ != nullptr) {
- __nd_ptr = std::addressof(__nd->__left_);
- __nd = static_cast<__node_pointer>(__nd->__left_);
- } else {
- __parent = static_cast<__parent_pointer>(__nd);
- return __parent->__left_;
- }
- }
- else if (value_comp()(__nd->__value_, __v))
- {
- if (__nd->__right_ != nullptr) {
- __nd_ptr = std::addressof(__nd->__right_);
- __nd = static_cast<__node_pointer>(__nd->__right_);
- } else {
- __parent = static_cast<__parent_pointer>(__nd);
- return __nd->__right_;
- }
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__nd);
- return *__nd_ptr;
- }
+__tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent, const _Key& __v) {
+ __node_pointer __nd = __root();
+ __node_base_pointer* __nd_ptr = __root_ptr();
+ if (__nd != nullptr) {
+ while (true) {
+ if (value_comp()(__v, __nd->__value_)) {
+ if (__nd->__left_ != nullptr) {
+ __nd_ptr = std::addressof(__nd->__left_);
+ __nd = static_cast<__node_pointer>(__nd->__left_);
+ } else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __parent->__left_;
+ }
+ } else if (value_comp()(__nd->__value_, __v)) {
+ if (__nd->__right_ != nullptr) {
+ __nd_ptr = std::addressof(__nd->__right_);
+ __nd = static_cast<__node_pointer>(__nd->__right_);
+ } else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return __nd->__right_;
}
+ } else {
+ __parent = static_cast<__parent_pointer>(__nd);
+ return *__nd_ptr;
+ }
}
- __parent = static_cast<__parent_pointer>(__end_node());
- return __parent->__left_;
+ }
+ __parent = static_cast<__parent_pointer>(__end_node());
+ return __parent->__left_;
}
// Find place to insert if __v doesn't exist
@@ -2025,731 +1719,584 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent,
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
-__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
- __parent_pointer& __parent,
- __node_base_pointer& __dummy,
- const _Key& __v)
-{
- if (__hint == end() || value_comp()(__v, *__hint)) // check before
- {
- // __v < *__hint
- const_iterator __prior = __hint;
- if (__prior == begin() || value_comp()(*--__prior, __v))
- {
- // *prev(__hint) < __v < *__hint
- if (__hint.__ptr_->__left_ == nullptr)
- {
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- return __parent->__left_;
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__prior.__ptr_);
- return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
- }
- }
- // __v <= *prev(__hint)
- return __find_equal(__parent, __v);
+typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_equal(
+ const_iterator __hint, __parent_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v) {
+ if (__hint == end() || value_comp()(__v, *__hint)) // check before
+ {
+ // __v < *__hint
+ const_iterator __prior = __hint;
+ if (__prior == begin() || value_comp()(*--__prior, __v)) {
+ // *prev(__hint) < __v < *__hint
+ if (__hint.__ptr_->__left_ == nullptr) {
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ return __parent->__left_;
+ } else {
+ __parent = static_cast<__parent_pointer>(__prior.__ptr_);
+ return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
+ }
}
- else if (value_comp()(*__hint, __v)) // check after
- {
- // *__hint < __v
- const_iterator __next = std::next(__hint);
- if (__next == end() || value_comp()(__v, *__next))
- {
- // *__hint < __v < *std::next(__hint)
- if (__hint.__get_np()->__right_ == nullptr)
- {
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_;
- }
- else
- {
- __parent = static_cast<__parent_pointer>(__next.__ptr_);
- return __parent->__left_;
- }
- }
- // *next(__hint) <= __v
- return __find_equal(__parent, __v);
+ // __v <= *prev(__hint)
+ return __find_equal(__parent, __v);
+ } else if (value_comp()(*__hint, __v)) // check after
+ {
+ // *__hint < __v
+ const_iterator __next = std::next(__hint);
+ if (__next == end() || value_comp()(__v, *__next)) {
+ // *__hint < __v < *std::next(__hint)
+ if (__hint.__get_np()->__right_ == nullptr) {
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_;
+ } else {
+ __parent = static_cast<__parent_pointer>(__next.__ptr_);
+ return __parent->__left_;
+ }
}
- // else __v == *__hint
- __parent = static_cast<__parent_pointer>(__hint.__ptr_);
- __dummy = static_cast<__node_base_pointer>(__hint.__ptr_);
- return __dummy;
+ // *next(__hint) <= __v
+ return __find_equal(__parent, __v);
+ }
+ // else __v == *__hint
+ __parent = static_cast<__parent_pointer>(__hint.__ptr_);
+ __dummy = static_cast<__node_base_pointer>(__hint.__ptr_);
+ return __dummy;
}
template <class _Tp, class _Compare, class _Allocator>
void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
- __parent_pointer __parent, __node_base_pointer& __child,
- __node_base_pointer __new_node) _NOEXCEPT
-{
- __new_node->__left_ = nullptr;
- __new_node->__right_ = nullptr;
- __new_node->__parent_ = __parent;
- // __new_node->__is_black_ is initialized in __tree_balance_after_insert
- __child = __new_node;
- if (__begin_node()->__left_ != nullptr)
- __begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_);
- std::__tree_balance_after_insert(__end_node()->__left_, __child);
- ++size();
+ __parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT {
+ __new_node->__left_ = nullptr;
+ __new_node->__right_ = nullptr;
+ __new_node->__parent_ = __parent;
+ // __new_node->__is_black_ is initialized in __tree_balance_after_insert
+ __child = __new_node;
+ if (__begin_node()->__left_ != nullptr)
+ __begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_);
+ std::__tree_balance_after_insert(__end_node()->__left_, __child);
+ ++size();
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key, class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
-__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent, __k);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, __k);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key, class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
- const_iterator __p, _Key const& __k, _Args&&... __args)
-{
- __parent_pointer __parent;
- __node_base_pointer __dummy;
- __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+ const_iterator __p, _Key const& __k, _Args&&... __args) {
+ __parent_pointer __parent;
+ __node_base_pointer __dummy;
+ __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
-template <class ..._Args>
+template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
-__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
-{
- static_assert(!__is_tree_value_type<_Args...>::value,
- "Cannot construct from __value_type");
- __node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), std::forward<_Args>(__args)...);
- __h.get_deleter().__value_constructed = true;
- return __h;
+__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
+ static_assert(!__is_tree_value_type<_Args...>::value, "Cannot construct from __value_type");
+ __node_allocator& __na = __node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), std::forward<_Args>(__args)...);
+ __h.get_deleter().__value_constructed = true;
+ return __h;
}
-
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
-__tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+__tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_impl(const_iterator __p, _Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer __dummy;
- __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __h->__value_);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- if (__child == nullptr)
- {
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- }
- return iterator(__r);
+__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_impl(const_iterator __p, _Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer __dummy;
+ __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __h->__value_);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ if (__child == nullptr) {
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ }
+ return iterator(__r);
}
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__h->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- return iterator(static_cast<__node_pointer>(__h.release()));
+__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__h->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ return iterator(static_cast<__node_pointer>(__h.release()));
}
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
- _Args&&... __args)
-{
- __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__h->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- return iterator(static_cast<__node_pointer>(__h.release()));
+__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) {
+ __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__h->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ return iterator(static_cast<__node_pointer>(__h.release()));
}
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
-__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v));
- __node_pointer __r = static_cast<__node_pointer>(__child);
- bool __inserted = false;
- if (__child == nullptr)
- {
- __nd->__value_ = __v;
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
- __r = __nd;
- __inserted = true;
- }
- return pair<iterator, bool>(iterator(__r), __inserted);
+__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v));
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ bool __inserted = false;
+ if (__child == nullptr) {
+ __nd->__value_ = __v;
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ __r = __nd;
+ __inserted = true;
+ }
+ return pair<iterator, bool>(iterator(__r), __inserted);
}
-
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__nd->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
- return iterator(__nd);
+__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__nd->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ return iterator(__nd);
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p,
- __node_pointer __nd)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__nd->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
- return iterator(__nd);
+__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p, __node_pointer __nd) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__nd->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ return iterator(__nd);
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT
-{
- iterator __r(__ptr);
- ++__r;
- if (__begin_node() == __ptr)
- __begin_node() = __r.__ptr_;
- --size();
- std::__tree_remove(__end_node()->__left_,
- static_cast<__node_base_pointer>(__ptr));
- return __r;
+__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT {
+ iterator __r(__ptr);
+ ++__r;
+ if (__begin_node() == __ptr)
+ __begin_node() = __r.__ptr_;
+ --size();
+ std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__ptr));
+ return __r;
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle, class _InsertReturnType>
-_LIBCPP_HIDE_FROM_ABI
-_InsertReturnType
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
- _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return _InsertReturnType{end(), false, _NodeHandle()};
+_LIBCPP_HIDE_FROM_ABI _InsertReturnType
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return _InsertReturnType{end(), false, _NodeHandle()};
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_equal(__parent,
- __ptr->__value_);
- if (__child != nullptr)
- return _InsertReturnType{
- iterator(static_cast<__node_pointer>(__child)),
- false, std::move(__nh)};
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, __ptr->__value_);
+ if (__child != nullptr)
+ return _InsertReturnType{iterator(static_cast<__node_pointer>(__child)), false, std::move(__nh)};
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__ptr));
- __nh.__release_ptr();
- return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __nh.__release_ptr();
+ return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
- const_iterator __hint, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
+_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer __dummy;
- __node_base_pointer& __child = __find_equal(__hint, __parent, __dummy,
- __ptr->__value_);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- if (__child == nullptr)
- {
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__ptr));
- __r = __ptr;
- __nh.__release_ptr();
- }
- return iterator(__r);
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer __dummy;
+ __node_base_pointer& __child = __find_equal(__hint, __parent, __dummy, __ptr->__value_);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ if (__child == nullptr) {
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __r = __ptr;
+ __nh.__release_ptr();
+ }
+ return iterator(__r);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key)
-{
- iterator __it = find(__key);
- if (__it == end())
- return _NodeHandle();
- return __node_handle_extract<_NodeHandle>(__it);
+_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) {
+ iterator __it = find(__key);
+ if (__it == end())
+ return _NodeHandle();
+ return __node_handle_extract<_NodeHandle>(__it);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-_NodeHandle
-__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p)
-{
- __node_pointer __np = __p.__get_np();
- __remove_node_pointer(__np);
- return _NodeHandle(__np, __alloc());
+_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) {
+ __node_pointer __np = __p.__get_np();
+ __remove_node_pointer(__np);
+ return _NodeHandle(__np, __alloc());
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Tree>
-_LIBCPP_HIDE_FROM_ABI
-void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source)
-{
- static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
-
- for (typename _Tree::iterator __i = __source.begin();
- __i != __source.end();)
- {
- __node_pointer __src_ptr = __i.__get_np();
- __parent_pointer __parent;
- __node_base_pointer& __child =
- __find_equal(__parent, _NodeTypes::__get_key(__src_ptr->__value_));
- ++__i;
- if (__child != nullptr)
- continue;
- __source.__remove_node_pointer(__src_ptr);
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__src_ptr));
- }
+_LIBCPP_HIDE_FROM_ABI void __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source) {
+ static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
+
+ for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
+ __node_pointer __src_ptr = __i.__get_np();
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__src_ptr->__value_));
+ ++__i;
+ if (__child != nullptr)
+ continue;
+ __source.__remove_node_pointer(__src_ptr);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr));
+ }
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(
- __parent, _NodeTypes::__get_key(__ptr->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
- __nh.__release_ptr();
- return iterator(__ptr);
+_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__ptr->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __nh.__release_ptr();
+ return iterator(__ptr);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(
- const_iterator __hint, _NodeHandle&& __nh)
-{
- if (__nh.empty())
- return end();
+_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) {
+ if (__nh.empty())
+ return end();
- __node_pointer __ptr = __nh.__ptr_;
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf(__hint, __parent,
- _NodeTypes::__get_key(__ptr->__value_));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
- __nh.__release_ptr();
- return iterator(__ptr);
+ __node_pointer __ptr = __nh.__ptr_;
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf(__hint, __parent, _NodeTypes::__get_key(__ptr->__value_));
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __nh.__release_ptr();
+ return iterator(__ptr);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Tree>
-_LIBCPP_HIDE_FROM_ABI
-void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source)
-{
- static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
-
- for (typename _Tree::iterator __i = __source.begin();
- __i != __source.end();)
- {
- __node_pointer __src_ptr = __i.__get_np();
- __parent_pointer __parent;
- __node_base_pointer& __child = __find_leaf_high(
- __parent, _NodeTypes::__get_key(__src_ptr->__value_));
- ++__i;
- __source.__remove_node_pointer(__src_ptr);
- __insert_node_at(__parent, __child,
- static_cast<__node_base_pointer>(__src_ptr));
- }
+_LIBCPP_HIDE_FROM_ABI void __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source) {
+ static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
+
+ for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
+ __node_pointer __src_ptr = __i.__get_np();
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__src_ptr->__value_));
+ ++__i;
+ __source.__remove_node_pointer(__src_ptr);
+ __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr));
+ }
}
#endif // _LIBCPP_STD_VER >= 17
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
-{
- __node_pointer __np = __p.__get_np();
- iterator __r = __remove_node_pointer(__np);
- __node_allocator& __na = __node_alloc();
- __node_traits::destroy(__na, _NodeTypes::__get_ptr(
- const_cast<__node_value_type&>(*__p)));
- __node_traits::deallocate(__na, __np, 1);
- return __r;
+typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) {
+ __node_pointer __np = __p.__get_np();
+ iterator __r = __remove_node_pointer(__np);
+ __node_allocator& __na = __node_alloc();
+ __node_traits::destroy(__na, _NodeTypes::__get_ptr(const_cast<__node_value_type&>(*__p)));
+ __node_traits::deallocate(__na, __np, 1);
+ return __r;
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
-{
- while (__f != __l)
- __f = erase(__f);
- return iterator(__l.__ptr_);
+__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) {
+ while (__f != __l)
+ __f = erase(__f);
+ return iterator(__l.__ptr_);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k)
-{
- iterator __i = find(__k);
- if (__i == end())
- return 0;
- erase(__i);
- return 1;
+__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) {
+ iterator __i = find(__k);
+ if (__i == end())
+ return 0;
+ erase(__i);
+ return 1;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k)
-{
- pair<iterator, iterator> __p = __equal_range_multi(__k);
- size_type __r = 0;
- for (; __p.first != __p.second; ++__r)
- __p.first = erase(__p.first);
- return __r;
+__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
+ pair<iterator, iterator> __p = __equal_range_multi(__k);
+ size_type __r = 0;
+ for (; __p.first != __p.second; ++__r)
+ __p.first = erase(__p.first);
+ return __r;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v)
-{
- iterator __p = __lower_bound(__v, __root(), __end_node());
- if (__p != end() && !value_comp()(__v, *__p))
- return __p;
- return end();
+typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) {
+ iterator __p = __lower_bound(__v, __root(), __end_node());
+ if (__p != end() && !value_comp()(__v, *__p))
+ return __p;
+ return end();
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const
-{
- const_iterator __p = __lower_bound(__v, __root(), __end_node());
- if (__p != end() && !value_comp()(__v, *__p))
- return __p;
- return end();
+__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const {
+ const_iterator __p = __lower_bound(__v, __root(), __end_node());
+ if (__p != end() && !value_comp()(__v, *__p))
+ return __p;
+ return end();
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const
-{
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return 1;
- }
- return 0;
+__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const {
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return 1;
+ }
+ return 0;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
-__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
-{
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return std::distance(
- __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)
- );
- }
- return 0;
+__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return std::distance(
+ __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ }
+ return 0;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result)
-{
- while (__root != nullptr)
- {
- if (!value_comp()(__root->__value_, __v))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return iterator(__result);
+__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) {
+ while (__root != nullptr) {
+ if (!value_comp()(__root->__value_, __v)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const
-{
- while (__root != nullptr)
- {
- if (!value_comp()(__root->__value_, __v))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return const_iterator(__result);
+typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound(
+ const _Key& __v, __node_pointer __root, __iter_pointer __result) const {
+ while (__root != nullptr) {
+ if (!value_comp()(__root->__value_, __v)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return const_iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result)
-{
- while (__root != nullptr)
- {
- if (value_comp()(__v, __root->__value_))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return iterator(__result);
+__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) {
+ while (__root != nullptr) {
+ if (value_comp()(__v, __root->__value_)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v,
- __node_pointer __root,
- __iter_pointer __result) const
-{
- while (__root != nullptr)
- {
- if (value_comp()(__v, __root->__value_))
- {
- __result = static_cast<__iter_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
- }
- else
- __root = static_cast<__node_pointer>(__root->__right_);
- }
- return const_iterator(__result);
+typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound(
+ const _Key& __v, __node_pointer __root, __iter_pointer __result) const {
+ while (__root != nullptr) {
+ if (value_comp()(__v, __root->__value_)) {
+ __result = static_cast<__iter_pointer>(__root);
+ __root = static_cast<__node_pointer>(__root->__left_);
+ } else
+ __root = static_cast<__node_pointer>(__root->__right_);
+ }
+ return const_iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
- typename __tree<_Tp, _Compare, _Allocator>::iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
-{
- typedef pair<iterator, iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(iterator(__rt),
- iterator(
- __rt->__right_ != nullptr ?
- static_cast<__iter_pointer>(std::__tree_min(__rt->__right_))
- : __result));
- }
- return _Pp(iterator(__result), iterator(__result));
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
+ typedef pair<iterator, iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(iterator(__rt),
+ iterator(__rt->__right_ != nullptr ? static_cast<__iter_pointer>(std::__tree_min(__rt->__right_))
+ : __result));
+ }
+ return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
-{
- typedef pair<const_iterator, const_iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(const_iterator(__rt),
- const_iterator(
- __rt->__right_ != nullptr ?
- static_cast<__iter_pointer>(std::__tree_min(__rt->__right_))
- : __result));
- }
- return _Pp(const_iterator(__result), const_iterator(__result));
+__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
+ typedef pair<const_iterator, const_iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(
+ const_iterator(__rt),
+ const_iterator(
+ __rt->__right_ != nullptr ? static_cast<__iter_pointer>(std::__tree_min(__rt->__right_)) : __result));
+ }
+ return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
- typename __tree<_Tp, _Compare, _Allocator>::iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
-{
- typedef pair<iterator, iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
- }
- return _Pp(iterator(__result), iterator(__result));
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
+__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
+ typedef pair<iterator, iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ }
+ return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
-{
- typedef pair<const_iterator, const_iterator> _Pp;
- __iter_pointer __result = __end_node();
- __node_pointer __rt = __root();
- while (__rt != nullptr)
- {
- if (value_comp()(__k, __rt->__value_))
- {
- __result = static_cast<__iter_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- }
- else if (value_comp()(__rt->__value_, __k))
- __rt = static_cast<__node_pointer>(__rt->__right_);
- else
- return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
- }
- return _Pp(const_iterator(__result), const_iterator(__result));
+__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
+ typedef pair<const_iterator, const_iterator> _Pp;
+ __iter_pointer __result = __end_node();
+ __node_pointer __rt = __root();
+ while (__rt != nullptr) {
+ if (value_comp()(__k, __rt->__value_)) {
+ __result = static_cast<__iter_pointer>(__rt);
+ __rt = static_cast<__node_pointer>(__rt->__left_);
+ } else if (value_comp()(__rt->__value_, __k))
+ __rt = static_cast<__node_pointer>(__rt->__right_);
+ else
+ return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ }
+ return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
-__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
-{
- __node_pointer __np = __p.__get_np();
- if (__begin_node() == __p.__ptr_)
- {
- if (__np->__right_ != nullptr)
- __begin_node() = static_cast<__iter_pointer>(__np->__right_);
- else
- __begin_node() = static_cast<__iter_pointer>(__np->__parent_);
- }
- --size();
- std::__tree_remove(__end_node()->__left_,
- static_cast<__node_base_pointer>(__np));
- return __node_holder(__np, _Dp(__node_alloc(), true));
+__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT {
+ __node_pointer __np = __p.__get_np();
+ if (__begin_node() == __p.__ptr_) {
+ if (__np->__right_ != nullptr)
+ __begin_node() = static_cast<__iter_pointer>(__np->__right_);
+ else
+ __begin_node() = static_cast<__iter_pointer>(__np->__parent_);
+ }
+ --size();
+ std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np));
+ return __node_holder(__np, _Dp(__node_alloc(), true));
}
template <class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__tree<_Tp, _Compare, _Allocator>& __x,
- __tree<_Tp, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h b/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h
index aee2bde89c7f..43161b17cfa3 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/make_tuple_types.h
@@ -37,14 +37,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _TupleTypes, class _TupleIndices>
struct __make_tuple_types_flat;
-template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx>
+template <template <class...> class _Tuple, class... _Types, size_t... _Idx>
struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
// Specialization for pair, tuple, and __tuple_types
template <class _Tp>
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__apply_cv_t<_Tp, __type_pack_element<_Idx, _Types...>>...>;
};
-template <class _Vt, size_t _Np, size_t ..._Idx>
+template <class _Vt, size_t _Np, size_t... _Idx>
struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
template <size_t>
using __value_type = _Vt;
@@ -52,23 +52,23 @@ struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
using __apply_quals = __tuple_types<__apply_cv_t<_Tp, __value_type<_Idx>>...>;
};
-template <class _Tp, size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value,
- size_t _Sp = 0,
+template <class _Tp,
+ size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value,
+ size_t _Sp = 0,
bool _SameSize = (_Ep == tuple_size<__libcpp_remove_reference_t<_Tp> >::value)>
-struct __make_tuple_types
-{
- static_assert(_Sp <= _Ep, "__make_tuple_types input error");
- using _RawTp = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
- using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>;
- using type = typename _Maker::template __apply_quals<_Tp>;
+struct __make_tuple_types {
+ static_assert(_Sp <= _Ep, "__make_tuple_types input error");
+ using _RawTp = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
+ using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>;
+ using type = typename _Maker::template __apply_quals<_Tp>;
};
-template <class ..._Types, size_t _Ep>
+template <class... _Types, size_t _Ep>
struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type;
};
-template <class ..._Types, size_t _Ep>
+template <class... _Types, size_t _Ep>
struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
typedef _LIBCPP_NODEBUG __tuple_types<_Types...> type;
};
diff --git a/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h b/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h
index 2fffac9efda1..b57f2a4c2e75 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/sfinae_helpers.h
@@ -34,17 +34,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
-template <bool ..._Preds>
+template <bool... _Preds>
struct __all_dummy;
-template <bool ..._Pred>
+template <bool... _Pred>
struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>> {};
struct __tuple_sfinae_base {
- template <template <class, class...> class _Trait,
- class ..._LArgs, class ..._RArgs>
+ template <template <class, class...> class _Trait, class... _LArgs, class... _RArgs>
static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>)
- -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
+ -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
template <template <class...> class>
static auto __do_test(...) -> false_type;
@@ -58,66 +57,63 @@ struct __tuple_sfinae_base {
// __tuple_convertible
-template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
- bool = __tuple_like_ext<_Up>::value>
-struct __tuple_convertible
- : public false_type {};
+template <class _Tp,
+ class _Up,
+ bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
+ bool = __tuple_like_ext<_Up>::value>
+struct __tuple_convertible : public false_type {};
template <class _Tp, class _Up>
struct __tuple_convertible<_Tp, _Up, true, true>
- : public __tuple_sfinae_base::__convertible<
- typename __make_tuple_types<_Tp>::type
- , typename __make_tuple_types<_Up>::type
- >
-{};
+ : public __tuple_sfinae_base::__convertible< typename __make_tuple_types<_Tp>::type,
+ typename __make_tuple_types<_Up>::type > {};
// __tuple_constructible
-template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
- bool = __tuple_like_ext<_Up>::value>
-struct __tuple_constructible
- : public false_type {};
+template <class _Tp,
+ class _Up,
+ bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
+ bool = __tuple_like_ext<_Up>::value>
+struct __tuple_constructible : public false_type {};
template <class _Tp, class _Up>
struct __tuple_constructible<_Tp, _Up, true, true>
- : public __tuple_sfinae_base::__constructible<
- typename __make_tuple_types<_Tp>::type
- , typename __make_tuple_types<_Up>::type
- >
-{};
+ : public __tuple_sfinae_base::__constructible< typename __make_tuple_types<_Tp>::type,
+ typename __make_tuple_types<_Up>::type > {};
// __tuple_assignable
-template <class _Tp, class _Up, bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
- bool = __tuple_like_ext<_Up>::value>
-struct __tuple_assignable
- : public false_type {};
+template <class _Tp,
+ class _Up,
+ bool = __tuple_like_ext<__libcpp_remove_reference_t<_Tp> >::value,
+ bool = __tuple_like_ext<_Up>::value>
+struct __tuple_assignable : public false_type {};
template <class _Tp, class _Up>
struct __tuple_assignable<_Tp, _Up, true, true>
- : public __tuple_sfinae_base::__assignable<
- typename __make_tuple_types<_Tp>::type
- , typename __make_tuple_types<_Up&>::type
- >
-{};
+ : public __tuple_sfinae_base::__assignable< typename __make_tuple_types<_Tp>::type,
+ typename __make_tuple_types<_Up&>::type > {};
-
-template <size_t _Ip, class ..._Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
+template <size_t _Ip, class... _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
};
struct _LIBCPP_EXPORTED_FROM_ABI __check_tuple_constructor_fail {
-
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; }
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; }
- template <class ...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() { return false; }
- template <class ...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() { return false; }
- template <class ...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_assign() { return false; }
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; }
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; }
+ template <class...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() {
+ return false;
+ }
+ template <class...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() {
+ return false;
+ }
+ template <class...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_assign() {
+ return false;
+ }
};
#endif // !defined(_LIBCPP_CXX03_LANG)
@@ -127,54 +123,54 @@ template <bool _CanCopy, bool _CanMove>
struct __sfinae_ctor_base {};
template <>
struct __sfinae_ctor_base<false, false> {
- __sfinae_ctor_base() = default;
- __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
- __sfinae_ctor_base(__sfinae_ctor_base &&) = delete;
+ __sfinae_ctor_base() = default;
+ __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
+ __sfinae_ctor_base(__sfinae_ctor_base&&) = delete;
__sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
+ __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
};
template <>
struct __sfinae_ctor_base<true, false> {
- __sfinae_ctor_base() = default;
- __sfinae_ctor_base(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base(__sfinae_ctor_base &&) = delete;
+ __sfinae_ctor_base() = default;
+ __sfinae_ctor_base(__sfinae_ctor_base const&) = default;
+ __sfinae_ctor_base(__sfinae_ctor_base&&) = delete;
__sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
+ __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
};
template <>
struct __sfinae_ctor_base<false, true> {
- __sfinae_ctor_base() = default;
- __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
- __sfinae_ctor_base(__sfinae_ctor_base &&) = default;
+ __sfinae_ctor_base() = default;
+ __sfinae_ctor_base(__sfinae_ctor_base const&) = delete;
+ __sfinae_ctor_base(__sfinae_ctor_base&&) = default;
__sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default;
- __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
+ __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default;
};
template <bool _CanCopy, bool _CanMove>
struct __sfinae_assign_base {};
template <>
struct __sfinae_assign_base<false, false> {
- __sfinae_assign_base() = default;
- __sfinae_assign_base(__sfinae_assign_base const&) = default;
- __sfinae_assign_base(__sfinae_assign_base &&) = default;
+ __sfinae_assign_base() = default;
+ __sfinae_assign_base(__sfinae_assign_base const&) = default;
+ __sfinae_assign_base(__sfinae_assign_base&&) = default;
__sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete;
- __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
+ __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
};
template <>
struct __sfinae_assign_base<true, false> {
- __sfinae_assign_base() = default;
- __sfinae_assign_base(__sfinae_assign_base const&) = default;
- __sfinae_assign_base(__sfinae_assign_base &&) = default;
+ __sfinae_assign_base() = default;
+ __sfinae_assign_base(__sfinae_assign_base const&) = default;
+ __sfinae_assign_base(__sfinae_assign_base&&) = default;
__sfinae_assign_base& operator=(__sfinae_assign_base const&) = default;
- __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
+ __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete;
};
template <>
struct __sfinae_assign_base<false, true> {
- __sfinae_assign_base() = default;
- __sfinae_assign_base(__sfinae_assign_base const&) = default;
- __sfinae_assign_base(__sfinae_assign_base &&) = default;
+ __sfinae_assign_base() = default;
+ __sfinae_assign_base(__sfinae_assign_base const&) = default;
+ __sfinae_assign_base(__sfinae_assign_base&&) = default;
__sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete;
- __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default;
+ __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default;
};
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h
index 478dd089d46c..2b9ac6696ca4 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h
@@ -23,68 +23,62 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element;
+template <size_t _Ip, class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_element;
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
-{
- typedef _LIBCPP_NODEBUG typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp> {
+ typedef _LIBCPP_NODEBUG typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
-{
- typedef _LIBCPP_NODEBUG typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp> {
+ typedef _LIBCPP_NODEBUG typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
-{
- typedef _LIBCPP_NODEBUG typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> {
+ typedef _LIBCPP_NODEBUG typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-#if !__has_builtin(__type_pack_element)
+# if !__has_builtin(__type_pack_element)
namespace __indexer_detail {
template <size_t _Idx, class _Tp>
-struct __indexed { using type _LIBCPP_NODEBUG = _Tp; };
+struct __indexed {
+ using type _LIBCPP_NODEBUG = _Tp;
+};
-template <class _Types, class _Indexes> struct __indexer;
+template <class _Types, class _Indexes>
+struct __indexer;
-template <class ..._Types, size_t ..._Idx>
-struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>>
- : __indexed<_Idx, _Types>...
-{};
+template <class... _Types, size_t... _Idx>
+struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> : __indexed<_Idx, _Types>... {};
template <size_t _Idx, class _Tp>
__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);
} // namespace __indexer_detail
-template <size_t _Idx, class ..._Types>
-using __type_pack_element _LIBCPP_NODEBUG = typename decltype(
- __indexer_detail::__at_index<_Idx>(
- __indexer_detail::__indexer<
- __tuple_types<_Types...>,
- typename __make_tuple_indices<sizeof...(_Types)>::type
- >{})
- )::type;
-#endif
+template <size_t _Idx, class... _Types>
+using __type_pack_element _LIBCPP_NODEBUG = typename decltype(__indexer_detail::__at_index<_Idx>(
+ __indexer_detail::__indexer< __tuple_types<_Types...>,
+ typename __make_tuple_indices<sizeof...(_Types)>::type >{}))::type;
+# endif
-template <size_t _Ip, class ..._Types>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> >
-{
- static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
- typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type;
+template <size_t _Ip, class... _Types>
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > {
+ static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
+ typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type;
};
-#if _LIBCPP_STD_VER >= 14
-template <size_t _Ip, class ..._Tp>
-using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element <_Ip, _Tp...>::type;
-#endif
+# if _LIBCPP_STD_VER >= 14
+template <size_t _Ip, class... _Tp>
+using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element<_Ip, _Tp...>::type;
+# endif
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h
index 18666d5948c9..501e711255ec 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_indices.h
@@ -21,13 +21,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t...> struct __tuple_indices {};
+template <size_t...>
+struct __tuple_indices {};
template <size_t _Ep, size_t _Sp = 0>
-struct __make_tuple_indices
-{
- static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
- typedef __make_indices_imp<_Ep, _Sp> type;
+struct __make_tuple_indices {
+ static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
+ typedef __make_indices_imp<_Ep, _Sp> type;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h
index 36f5c4896ffe..0cc21e0b75fd 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_like_ext.h
@@ -23,21 +23,29 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct __tuple_like_ext : false_type {};
+template <class _Tp>
+struct __tuple_like_ext : false_type {};
-template <class _Tp> struct __tuple_like_ext<const _Tp> : public __tuple_like_ext<_Tp> {};
-template <class _Tp> struct __tuple_like_ext<volatile _Tp> : public __tuple_like_ext<_Tp> {};
-template <class _Tp> struct __tuple_like_ext<const volatile _Tp> : public __tuple_like_ext<_Tp> {};
+template <class _Tp>
+struct __tuple_like_ext<const _Tp> : public __tuple_like_ext<_Tp> {};
+template <class _Tp>
+struct __tuple_like_ext<volatile _Tp> : public __tuple_like_ext<_Tp> {};
+template <class _Tp>
+struct __tuple_like_ext<const volatile _Tp> : public __tuple_like_ext<_Tp> {};
#ifndef _LIBCPP_CXX03_LANG
-template <class... _Tp> struct __tuple_like_ext<tuple<_Tp...> > : true_type {};
+template <class... _Tp>
+struct __tuple_like_ext<tuple<_Tp...> > : true_type {};
#endif
-template <class _T1, class _T2> struct __tuple_like_ext<pair<_T1, _T2> > : true_type {};
+template <class _T1, class _T2>
+struct __tuple_like_ext<pair<_T1, _T2> > : true_type {};
-template <class _Tp, size_t _Size> struct __tuple_like_ext<array<_Tp, _Size> > : true_type {};
+template <class _Tp, size_t _Size>
+struct __tuple_like_ext<array<_Tp, _Size> > : true_type {};
-template <class... _Tp> struct __tuple_like_ext<__tuple_types<_Tp...> > : true_type {};
+template <class... _Tp>
+struct __tuple_like_ext<__tuple_types<_Tp...> > : true_type {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h
index 26f9d9725d31..b8320106fb26 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_size.h
@@ -22,51 +22,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size;
#if !defined(_LIBCPP_CXX03_LANG)
template <class _Tp, class...>
using __enable_if_tuple_size_imp = _Tp;
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
- const _Tp,
- __enable_if_t<!is_volatile<_Tp>::value>,
- integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< const _Tp,
+ __enable_if_t<!is_volatile<_Tp>::value>,
+ integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
- volatile _Tp,
- __enable_if_t<!is_const<_Tp>::value>,
- integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< volatile _Tp,
+ __enable_if_t<!is_const<_Tp>::value>,
+ integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
- const volatile _Tp,
- integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+struct _LIBCPP_TEMPLATE_VIS
+ tuple_size<__enable_if_tuple_size_imp< const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
#endif
#ifndef _LIBCPP_CXX03_LANG
-template <class ..._Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> >
- : public integral_constant<size_t, sizeof...(_Tp)>
-{
-};
-
-template <class ..._Tp>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> >
- : public integral_constant<size_t, sizeof...(_Tp)>
-{
-};
+template <class... _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
+
+template <class... _Tp>
+struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> {};
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h
index c5be81cce801..7e1256cf8790 100644
--- a/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h
+++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_types.h
@@ -17,7 +17,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class ..._Tp> struct __tuple_types {};
+template <class... _Tp>
+struct __tuple_types {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h b/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h
index 5688e3293a69..3a8b15160107 100644
--- a/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h
+++ b/contrib/llvm-project/libcxx/include/__type_traits/datasizeof.h
@@ -28,13 +28,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct __libcpp_datasizeof {
-#if __has_cpp_attribute(__no_unique_address__)
+#if __has_extension(datasizeof)
+ static const size_t value = __datasizeof(_Tp);
+#else
+// NOLINTNEXTLINE(readability-redundant-preprocessor) This is https://llvm.org/PR64825
+# if __has_cpp_attribute(__no_unique_address__)
template <class = char>
struct _FirstPaddingByte {
[[__no_unique_address__]] _Tp __v_;
char __first_padding_byte_;
};
-#else
+# else
template <bool = __libcpp_is_final<_Tp>::value || !is_class<_Tp>::value>
struct _FirstPaddingByte : _Tp {
char __first_padding_byte_;
@@ -45,7 +49,7 @@ struct __libcpp_datasizeof {
_Tp __v_;
char __first_padding_byte_;
};
-#endif
+# endif // __has_cpp_attribute(__no_unique_address__)
// _FirstPaddingByte<> is sometimes non-standard layout. Using `offsetof` is UB in that case, but GCC and Clang allow
// the use as an extension.
@@ -53,6 +57,7 @@ struct __libcpp_datasizeof {
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-offsetof")
static const size_t value = offsetof(_FirstPaddingByte<>, __first_padding_byte_);
_LIBCPP_DIAGNOSTIC_POP
+#endif // __has_extension(datasizeof)
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__utility/as_const.h b/contrib/llvm-project/libcxx/include/__utility/as_const.h
index b5c6091ecfed..b7ad95125944 100644
--- a/contrib/llvm-project/libcxx/include/__utility/as_const.h
+++ b/contrib/llvm-project/libcxx/include/__utility/as_const.h
@@ -22,7 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept {
+ return __t;
+}
template <class _Tp>
void as_const(const _Tp&&) = delete;
diff --git a/contrib/llvm-project/libcxx/include/__utility/cmp.h b/contrib/llvm-project/libcxx/include/__utility/cmp.h
index 5c62d2bfa073..5f88f4b32703 100644
--- a/contrib/llvm-project/libcxx/include/__utility/cmp.h
+++ b/contrib/llvm-project/libcxx/include/__utility/cmp.h
@@ -29,24 +29,29 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class... _Up>
+template <class _Tp, class... _Up>
struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {};
-template<class _Tp>
-concept __is_safe_integral_cmp = is_integral_v<_Tp> &&
- !_IsSameAsAny<_Tp, bool, char, char16_t, char32_t
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
- , char8_t
-#endif
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- , wchar_t
-#endif
- >::value;
-
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_equal(_Tp __t, _Up __u) noexcept
-{
+template <class _Tp>
+concept __is_safe_integral_cmp =
+ is_integral_v<_Tp> &&
+ !_IsSameAsAny<_Tp,
+ bool,
+ char,
+ char16_t,
+ char32_t
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+ ,
+ char8_t
+# endif
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+ ,
+ wchar_t
+# endif
+ >::value;
+
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
return __t == __u;
else if constexpr (is_signed_v<_Tp>)
@@ -55,17 +60,13 @@ bool cmp_equal(_Tp __t, _Up __u) noexcept
return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_not_equal(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_equal(__t, __u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_less(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
return __t < __u;
else if constexpr (is_signed_v<_Tp>)
@@ -74,31 +75,23 @@ bool cmp_less(_Tp __t, _Up __u) noexcept
return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_greater(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept {
return std::cmp_less(__u, __t);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_less_equal(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_greater(__t, __u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool cmp_greater_equal(_Tp __t, _Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_less(__t, __u);
}
-template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool in_range(_Up __u) noexcept
-{
+template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+_LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept {
return std::cmp_less_equal(__u, numeric_limits<_Tp>::max()) &&
std::cmp_greater_equal(__u, numeric_limits<_Tp>::min());
}
diff --git a/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h b/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h
index 2f61db6112d1..f1fcdd98010c 100644
--- a/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h
+++ b/contrib/llvm-project/libcxx/include/__utility/convert_to_integral.h
@@ -21,51 +21,47 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-int __convert_to_integral(int __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __convert_to_integral(int __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-unsigned __convert_to_integral(unsigned __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned __convert_to_integral(unsigned __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-long __convert_to_integral(long __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long __convert_to_integral(long __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-unsigned long __convert_to_integral(unsigned long __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long __convert_to_integral(unsigned long __val) {
+ return __val;
+}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-long long __convert_to_integral(long long __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long long __convert_to_integral(long long __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long long __convert_to_integral(unsigned long long __val) {
+ return __val;
+}
-template<typename _Fp, __enable_if_t<is_floating_point<_Fp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-long long
- __convert_to_integral(_Fp __val) { return __val; }
+template <typename _Fp, __enable_if_t<is_floating_point<_Fp>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long long __convert_to_integral(_Fp __val) {
+ return __val;
+}
#ifndef _LIBCPP_HAS_NO_INT128
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__int128_t __convert_to_integral(__int128_t __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __int128_t __convert_to_integral(__int128_t __val) { return __val; }
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
#endif
template <class _Tp, bool = is_enum<_Tp>::value>
-struct __sfinae_underlying_type
-{
- typedef typename underlying_type<_Tp>::type type;
- typedef decltype(((type)1) + 0) __promoted_type;
+struct __sfinae_underlying_type {
+ typedef typename underlying_type<_Tp>::type type;
+ typedef decltype(((type)1) + 0) __promoted_type;
};
template <class _Tp>
struct __sfinae_underlying_type<_Tp, false> {};
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-typename __sfinae_underlying_type<_Tp>::__promoted_type
-__convert_to_integral(_Tp __val) { return __val; }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename __sfinae_underlying_type<_Tp>::__promoted_type
+__convert_to_integral(_Tp __val) {
+ return __val;
+}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__utility/exchange.h b/contrib/llvm-project/libcxx/include/__utility/exchange.h
index 819549a9dcb4..72312c06b588 100644
--- a/contrib/llvm-project/libcxx/include/__utility/exchange.h
+++ b/contrib/llvm-project/libcxx/include/__utility/exchange.h
@@ -25,14 +25,12 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 14
-template<class _T1, class _T2 = _T1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_T1 exchange(_T1& __obj, _T2&& __new_value)
- noexcept(is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value)
-{
- _T1 __old_value = std::move(__obj);
- __obj = std::forward<_T2>(__new_value);
- return __old_value;
+template <class _T1, class _T2 = _T1>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept(
+ is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) {
+ _T1 __old_value = std::move(__obj);
+ __obj = std::forward<_T2>(__new_value);
+ return __old_value;
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__utility/in_place.h b/contrib/llvm-project/libcxx/include/__utility/in_place.h
index 5b878529fb21..fa7a2f4bfd4a 100644
--- a/contrib/llvm-project/libcxx/include/__utility/in_place.h
+++ b/contrib/llvm-project/libcxx/include/__utility/in_place.h
@@ -40,14 +40,18 @@ struct _LIBCPP_TEMPLATE_VIS in_place_index_t {
template <size_t _Idx>
inline constexpr in_place_index_t<_Idx> in_place_index{};
-template <class _Tp> struct __is_inplace_type_imp : false_type {};
-template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
+template <class _Tp>
+struct __is_inplace_type_imp : false_type {};
+template <class _Tp>
+struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
template <class _Tp>
using __is_inplace_type = __is_inplace_type_imp<__remove_cvref_t<_Tp>>;
-template <class _Tp> struct __is_inplace_index_imp : false_type {};
-template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
+template <class _Tp>
+struct __is_inplace_index_imp : false_type {};
+template <size_t _Idx>
+struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
template <class _Tp>
using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>;
diff --git a/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h b/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h
index bae8c241ef5a..e63f3f265b7d 100644
--- a/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h
+++ b/contrib/llvm-project/libcxx/include/__utility/integer_sequence.h
@@ -19,7 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t...> struct __tuple_indices;
+template <size_t...>
+struct __tuple_indices;
template <class _IdxType, _IdxType... _Values>
struct __integer_sequence {
@@ -34,22 +35,28 @@ struct __integer_sequence {
namespace __detail {
-template<typename _Tp, size_t ..._Extra> struct __repeat;
-template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
- typedef _LIBCPP_NODEBUG __integer_sequence<_Tp,
- _Np...,
- sizeof...(_Np) + _Np...,
- 2 * sizeof...(_Np) + _Np...,
- 3 * sizeof...(_Np) + _Np...,
- 4 * sizeof...(_Np) + _Np...,
- 5 * sizeof...(_Np) + _Np...,
- 6 * sizeof...(_Np) + _Np...,
- 7 * sizeof...(_Np) + _Np...,
- _Extra...> type;
+template <typename _Tp, size_t... _Extra>
+struct __repeat;
+template <typename _Tp, _Tp... _Np, size_t... _Extra>
+struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
+ typedef _LIBCPP_NODEBUG __integer_sequence<
+ _Tp,
+ _Np...,
+ sizeof...(_Np) + _Np...,
+ 2 * sizeof...(_Np) + _Np...,
+ 3 * sizeof...(_Np) + _Np...,
+ 4 * sizeof...(_Np) + _Np...,
+ 5 * sizeof...(_Np) + _Np...,
+ 6 * sizeof...(_Np) + _Np...,
+ 7 * sizeof...(_Np) + _Np...,
+ _Extra...>
+ type;
};
-template<size_t _Np> struct __parity;
-template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
+template <size_t _Np>
+struct __parity;
+template <size_t _Np>
+struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
// clang-format off
template<> struct __make<0> { typedef __integer_sequence<size_t> type; };
@@ -71,80 +78,71 @@ template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<t
template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
// clang-format on
-} // namespace detail
+} // namespace __detail
#endif
#if __has_builtin(__make_integer_seq)
template <size_t _Ep, size_t _Sp>
using __make_indices_imp =
- typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template
- __to_tuple_indices<_Sp>;
+ typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>;
#else
template <size_t _Ep, size_t _Sp>
-using __make_indices_imp =
- typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>;
+using __make_indices_imp = typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>;
#endif
#if _LIBCPP_STD_VER >= 14
-template<class _Tp, _Tp... _Ip>
-struct _LIBCPP_TEMPLATE_VIS integer_sequence
-{
- typedef _Tp value_type;
- static_assert( is_integral<_Tp>::value,
- "std::integer_sequence can only be instantiated with an integral type" );
- static
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- size_t
- size() noexcept { return sizeof...(_Ip); }
+template <class _Tp, _Tp... _Ip>
+struct _LIBCPP_TEMPLATE_VIS integer_sequence {
+ typedef _Tp value_type;
+ static_assert(is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type");
+ static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return sizeof...(_Ip); }
};
-template<size_t... _Ip>
- using index_sequence = integer_sequence<size_t, _Ip...>;
+template <size_t... _Ip>
+using index_sequence = integer_sequence<size_t, _Ip...>;
-#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
+# if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
template <class _Tp, _Tp _Ep>
using __make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>;
-#else
+# else
-template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG =
- typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
+template <typename _Tp, _Tp _Np>
+using __make_integer_sequence_unchecked _LIBCPP_NODEBUG =
+ typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
template <class _Tp, _Tp _Ep>
-struct __make_integer_sequence_checked
-{
- static_assert(is_integral<_Tp>::value,
- "std::make_integer_sequence can only be instantiated with an integral type" );
- static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
- // Workaround GCC bug by preventing bad installations when 0 <= _Ep
- // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
- typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
+struct __make_integer_sequence_checked {
+ static_assert(is_integral<_Tp>::value, "std::make_integer_sequence can only be instantiated with an integral type");
+ static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
+ // Workaround GCC bug by preventing bad installations when 0 <= _Ep
+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
+ typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
};
template <class _Tp, _Tp _Ep>
using __make_integer_sequence _LIBCPP_NODEBUG = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
-#endif
+# endif
-template<class _Tp, _Tp _Np>
- using make_integer_sequence = __make_integer_sequence<_Tp, _Np>;
+template <class _Tp, _Tp _Np>
+using make_integer_sequence = __make_integer_sequence<_Tp, _Np>;
-template<size_t _Np>
- using make_index_sequence = make_integer_sequence<size_t, _Np>;
+template <size_t _Np>
+using make_index_sequence = make_integer_sequence<size_t, _Np>;
-template<class... _Tp>
- using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
+template <class... _Tp>
+using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
# if _LIBCPP_STD_VER >= 20
// Executes __func for every element in an index_sequence.
template <size_t... _Index, class _Function>
_LIBCPP_HIDE_FROM_ABI constexpr void __for_each_index_sequence(index_sequence<_Index...>, _Function __func) {
- (__func.template operator()<_Index>(), ...);
+ (__func.template operator()<_Index>(), ...);
}
# endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h b/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h
index e859562e7457..68cdfea6f945 100644
--- a/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h
+++ b/contrib/llvm-project/libcxx/include/__utility/is_pointer_in_range.h
@@ -35,7 +35,7 @@ template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable<const _T
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool __is_pointer_in_range(
const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
if (__libcpp_is_constant_evaluated()) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range");
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range");
// If this is not a constant during constant evaluation we know that __ptr is not part of the allocation where
// [__begin, __end) is.
diff --git a/contrib/llvm-project/libcxx/include/__utility/pair.h b/contrib/llvm-project/libcxx/include/__utility/pair.h
index 535344eb1e2d..2f4908ceddce 100644
--- a/contrib/llvm-project/libcxx/include/__utility/pair.h
+++ b/contrib/llvm-project/libcxx/include/__utility/pair.h
@@ -63,8 +63,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class, class>
struct __non_trivially_copyable_base {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- __non_trivially_copyable_base() _NOEXCEPT {}
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __non_trivially_copyable_base() _NOEXCEPT {}
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
__non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {}
};
@@ -80,799 +79,658 @@ struct __is_specialization_of_subrange<ranges::subrange<_Iter, _Sent, _Kind>> :
template <class _T1, class _T2>
struct _LIBCPP_TEMPLATE_VIS pair
#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
-: private __non_trivially_copyable_base<_T1, _T2>
+ : private __non_trivially_copyable_base<_T1, _T2>
#endif
{
- using first_type = _T1;
- using second_type = _T2;
+ using first_type = _T1;
+ using second_type = _T2;
- _T1 first;
- _T2 second;
+ _T1 first;
+ _T2 second;
- _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
- _LIBCPP_HIDE_FROM_ABI pair(pair&&) = default;
+ _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
+ _LIBCPP_HIDE_FROM_ABI pair(pair&&) = default;
#ifdef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair() : first(), second() {}
+ _LIBCPP_HIDE_FROM_ABI pair() : first(), second() {}
+
+ _LIBCPP_HIDE_FROM_ABI pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {}
+
+ template <class _U1, class _U2>
+ _LIBCPP_HIDE_FROM_ABI pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
+
+ _LIBCPP_HIDE_FROM_ABI pair& operator=(pair const& __p) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ // Extension: This is provided in C++03 because it allows properly handling the
+ // assignment to a pair containing references, which would be a hard
+ // error otherwise.
+ template <class _U1,
+ class _U2,
+ class = __enable_if_t< is_assignable<first_type&, _U1 const&>::value &&
+ is_assignable<second_type&, _U2 const&>::value > >
+ _LIBCPP_HIDE_FROM_ABI pair& operator=(pair<_U1, _U2> const& __p) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+#else
+ struct _CheckArgs {
+ template <int&...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() {
+ return is_default_constructible<_T1>::value && is_default_constructible<_T2>::value &&
+ !__enable_implicit_default<>();
+ }
- _LIBCPP_HIDE_FROM_ABI
- pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {}
+ template <int&...>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() {
+ return __is_implicitly_default_constructible<_T1>::value && __is_implicitly_default_constructible<_T2>::value;
+ }
template <class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI
- pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
-
- _LIBCPP_HIDE_FROM_ABI
- pair& operator=(pair const& __p) {
- first = __p.first;
- second = __p.second;
- return *this;
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_pair_constructible() {
+ return is_constructible<first_type, _U1>::value && is_constructible<second_type, _U2>::value;
}
- // Extension: This is provided in C++03 because it allows properly handling the
- // assignment to a pair containing references, which would be a hard
- // error otherwise.
- template <class _U1, class _U2, class = __enable_if_t<
- is_assignable<first_type&, _U1 const&>::value &&
- is_assignable<second_type&, _U2 const&>::value
- > >
- _LIBCPP_HIDE_FROM_ABI
- pair& operator=(pair<_U1, _U2> const& __p) {
- first = __p.first;
- second = __p.second;
- return *this;
+ template <class _U1, class _U2>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_implicit() {
+ return is_convertible<_U1, first_type>::value && is_convertible<_U2, second_type>::value;
}
-#else
- struct _CheckArgs {
- template <int&...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() {
- return is_default_constructible<_T1>::value
- && is_default_constructible<_T2>::value
- && !__enable_implicit_default<>();
- }
-
- template <int&...>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() {
- return __is_implicitly_default_constructible<_T1>::value
- && __is_implicitly_default_constructible<_T2>::value;
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_pair_constructible() {
- return is_constructible<first_type, _U1>::value
- && is_constructible<second_type, _U2>::value;
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_implicit() {
- return is_convertible<_U1, first_type>::value
- && is_convertible<_U2, second_type>::value;
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() {
- return __is_pair_constructible<_U1, _U2>() && !__is_implicit<_U1, _U2>();
- }
-
- template <class _U1, class _U2>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() {
- return __is_pair_constructible<_U1, _U2>() && __is_implicit<_U1, _U2>();
- }
- };
-
- template <bool _MaybeEnable>
- using _CheckArgsDep _LIBCPP_NODEBUG = typename conditional<
- _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
-
- template<bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_explicit_default(), int> = 0>
- explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
- is_nothrow_default_constructible<second_type>::value)
- : first(), second() {}
-
- template<bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_implicit_default(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
- is_nothrow_default_constructible<second_type>::value)
- : first(), second() {}
-
- template <bool _Dummy = true,
- __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(_T1 const& __t1, _T2 const& __t2)
- _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
- is_nothrow_copy_constructible<second_type>::value)
- : first(__t1), second(__t2) {}
-
- template<bool _Dummy = true,
- __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(_T1 const& __t1, _T2 const& __t2)
- _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
- is_nothrow_copy_constructible<second_type>::value)
- : first(__t1), second(__t2) {}
-
- template <
-#if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
- class _U1 = _T1, class _U2 = _T2,
-#else
- class _U1, class _U2,
-#endif
- __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(_U1&& __u1, _U2&& __u2)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
- is_nothrow_constructible<second_type, _U2>::value))
- : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {}
-
- template <
-#if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
- class _U1 = _T1, class _U2 = _T2,
-#else
- class _U1, class _U2,
-#endif
- __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(_U1&& __u1, _U2&& __u2)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
- is_nothrow_constructible<second_type, _U2>::value))
- : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {}
-
-#if _LIBCPP_STD_VER >= 23
- template<class _U1, class _U2, __enable_if_t<
- _CheckArgs::template __is_pair_constructible<_U1&, _U2&>()
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_CheckArgs::template __is_implicit<_U1&, _U2&>()) pair(pair<_U1, _U2>& __p)
- noexcept((is_nothrow_constructible<first_type, _U1&>::value &&
- is_nothrow_constructible<second_type, _U2&>::value))
- : first(__p.first), second(__p.second) {}
-#endif
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(pair<_U1, _U2> const& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
- is_nothrow_constructible<second_type, _U2 const&>::value))
- : first(__p.first), second(__p.second) {}
-
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(pair<_U1, _U2> const& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
- is_nothrow_constructible<second_type, _U2 const&>::value))
- : first(__p.first), second(__p.second) {}
-
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit pair(pair<_U1, _U2>&&__p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
- is_nothrow_constructible<second_type, _U2&&>::value))
- : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
-
- template<class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(pair<_U1, _U2>&& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
- is_nothrow_constructible<second_type, _U2&&>::value))
- : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
-
-#if _LIBCPP_STD_VER >= 23
- template<class _U1, class _U2, __enable_if_t<
- _CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>()
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_CheckArgs::template __is_implicit<const _U1&&, const _U2&&>())
- pair(const pair<_U1, _U2>&& __p)
- noexcept(is_nothrow_constructible<first_type, const _U1&&>::value &&
- is_nothrow_constructible<second_type, const _U2&&>::value)
- : first(std::move(__p.first)), second(std::move(__p.second)) {}
-#endif
+ template <class _U1, class _U2>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit() {
+ return __is_pair_constructible<_U1, _U2>() && !__is_implicit<_U1, _U2>();
+ }
-# if _LIBCPP_STD_VER >= 23
- // This is a workaround for http://llvm.org/PR60710. We should be able to remove it once Clang is fixed.
- template <class _PairLike>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __pair_like_explicit_wknd() {
- if constexpr (__pair_like<_PairLike>) {
- return !is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> ||
- !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>;
- }
- return false;
+ template <class _U1, class _U2>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit() {
+ return __is_pair_constructible<_U1, _U2>() && __is_implicit<_U1, _U2>();
}
+ };
+
+ template <bool _MaybeEnable>
+ using _CheckArgsDep _LIBCPP_NODEBUG =
+ typename conditional< _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
+
+ template <bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_explicit_default(), int> = 0>
+ explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(
+ is_nothrow_default_constructible<first_type>::value&& is_nothrow_default_constructible<second_type>::value)
+ : first(), second() {}
+
+ template <bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_implicit_default(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(
+ is_nothrow_default_constructible<first_type>::value&& is_nothrow_default_constructible<second_type>::value)
+ : first(), second() {}
+
+ template <bool _Dummy = true,
+ __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_T1 const& __t1, _T2 const& __t2)
+ _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value&& is_nothrow_copy_constructible<second_type>::value)
+ : first(__t1), second(__t2) {}
+
+ template <bool _Dummy = true,
+ __enable_if_t<_CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_T1 const& __t1, _T2 const& __t2)
+ _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value&& is_nothrow_copy_constructible<second_type>::value)
+ : first(__t1), second(__t2) {}
+
+ template <
+# if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
+ class _U1 = _T1,
+ class _U2 = _T2,
+# else
+ class _U1,
+ class _U2,
+# endif
+ __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0 >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_U1&& __u1, _U2&& __u2)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
+ is_nothrow_constructible<second_type, _U2>::value))
+ : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {
+ }
+
+ template <
+# if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951
+ class _U1 = _T1,
+ class _U2 = _T2,
+# else
+ class _U1,
+ class _U2,
+# endif
+ __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0 >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_U1&& __u1, _U2&& __u2)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
+ is_nothrow_constructible<second_type, _U2>::value))
+ : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {
+ }
- template <__pair_like _PairLike>
- requires(!__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
- is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike&&>()))> &&
- is_constructible_v<second_type, decltype(std::get<1>(std::declval<_PairLike&&>()))>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(__pair_like_explicit_wknd<_PairLike>())
- pair(_PairLike&& __p)
- : first(std::get<0>(std::forward<_PairLike>(__p))), second(std::get<1>(std::forward<_PairLike>(__p))) {}
+# if _LIBCPP_STD_VER >= 23
+ template <class _U1,
+ class _U2,
+ __enable_if_t< _CheckArgs::template __is_pair_constructible<_U1&, _U2&>() >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_CheckArgs::template __is_implicit<_U1&, _U2&>())
+ pair(pair<_U1, _U2>& __p) noexcept((is_nothrow_constructible<first_type, _U1&>::value &&
+ is_nothrow_constructible<second_type, _U2&>::value))
+ : first(__p.first), second(__p.second) {}
# endif
- template <class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair(piecewise_construct_t __pc,
- tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value &&
- is_nothrow_constructible<second_type, _Args2...>::value))
- : pair(__pc, __first_args, __second_args,
- typename __make_tuple_indices<sizeof...(_Args1)>::type(),
- typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(__conditional_t<
- is_copy_assignable<first_type>::value &&
- is_copy_assignable<second_type>::value,
- pair, __nat> const& __p)
- _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value &&
- is_nothrow_copy_assignable<second_type>::value)
- {
- first = __p.first;
- second = __p.second;
- return *this;
- }
+ template <class _U1,
+ class _U2,
+ __enable_if_t<_CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2> const& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
+ is_nothrow_constructible<second_type, _U2 const&>::value))
+ : first(__p.first), second(__p.second) {}
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t<_CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2> const& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
+ is_nothrow_constructible<second_type, _U2 const&>::value))
+ : first(__p.first), second(__p.second) {}
+
+ template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_explicit<_U1, _U2>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2>&& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
+ is_nothrow_constructible<second_type, _U2&&>::value))
+ : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
+
+ template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __enable_implicit<_U1, _U2>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2>&& __p)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
+ is_nothrow_constructible<second_type, _U2&&>::value))
+ : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(__conditional_t<
- is_move_assignable<first_type>::value &&
- is_move_assignable<second_type>::value,
- pair, __nat>&& __p)
- _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value &&
- is_nothrow_move_assignable<second_type>::value)
- {
- first = std::forward<first_type>(__p.first);
- second = std::forward<second_type>(__p.second);
- return *this;
- }
+# if _LIBCPP_STD_VER >= 23
+ template <class _U1,
+ class _U2,
+ __enable_if_t< _CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>() >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_CheckArgs::template __is_implicit<const _U1&&, const _U2&&>())
+ pair(const pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, const _U1&&>::value &&
+ is_nothrow_constructible<second_type, const _U2&&>::value)
+ : first(std::move(__p.first)), second(std::move(__p.second)) {}
+# endif
- template <class _U1, class _U2, __enable_if_t<
- is_assignable<first_type&, _U1 const&>::value &&
- is_assignable<second_type&, _U2 const&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(pair<_U1, _U2> const& __p) {
- first = __p.first;
- second = __p.second;
- return *this;
+# if _LIBCPP_STD_VER >= 23
+ // This is a workaround for http://llvm.org/PR60710. We should be able to remove it once Clang is fixed.
+ template <class _PairLike>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __pair_like_explicit_wknd() {
+ if constexpr (__pair_like<_PairLike>) {
+ return !is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> ||
+ !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>;
}
+ return false;
+ }
+
+ template <__pair_like _PairLike>
+ requires(!__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
+ is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike &&>()))> &&
+ is_constructible_v<second_type, decltype(std::get<1>(std::declval<_PairLike &&>()))>)
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(__pair_like_explicit_wknd<_PairLike>()) pair(_PairLike&& __p)
+ : first(std::get<0>(std::forward<_PairLike>(__p))), second(std::get<1>(std::forward<_PairLike>(__p))) {}
+# endif
- template <class _U1, class _U2, __enable_if_t<
- is_assignable<first_type&, _U1>::value &&
- is_assignable<second_type&, _U2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair& operator=(pair<_U1, _U2>&& __p) {
- first = std::forward<_U1>(__p.first);
- second = std::forward<_U2>(__p.second);
- return *this;
- }
+ template <class... _Args1, class... _Args2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
+ _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value &&
+ is_nothrow_constructible<second_type, _Args2...>::value))
+ : pair(__pc,
+ __first_args,
+ __second_args,
+ typename __make_tuple_indices<sizeof...(_Args1)>::type(),
+ typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
+ operator=(__conditional_t< is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
+ pair,
+ __nat> const& __p)
+ _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value&& is_nothrow_copy_assignable<second_type>::value) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(
+ __conditional_t< is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&&
+ __p)
+ _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value&& is_nothrow_move_assignable<second_type>::value) {
+ first = std::forward<first_type>(__p.first);
+ second = std::forward<second_type>(__p.second);
+ return *this;
+ }
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<first_type&, _U1 const&>::value &&
+ is_assignable<second_type&, _U2 const&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2> const& __p) {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<first_type&, _U1>::value && is_assignable<second_type&, _U2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2>&& __p) {
+ first = std::forward<_U1>(__p.first);
+ second = std::forward<_U2>(__p.second);
+ return *this;
+ }
# if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(pair const& __p) const
- noexcept(is_nothrow_copy_assignable_v<const first_type> &&
- is_nothrow_copy_assignable_v<const second_type>)
- requires(is_copy_assignable_v<const first_type> &&
- is_copy_assignable_v<const second_type>) {
- first = __p.first;
- second = __p.second;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(pair&& __p) const
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair const& __p) const
+ noexcept(is_nothrow_copy_assignable_v<const first_type> && is_nothrow_copy_assignable_v<const second_type>)
+ requires(is_copy_assignable_v<const first_type> && is_copy_assignable_v<const second_type>)
+ {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair&& __p) const
noexcept(is_nothrow_assignable_v<const first_type&, first_type> &&
is_nothrow_assignable_v<const second_type&, second_type>)
- requires(is_assignable_v<const first_type&, first_type> &&
- is_assignable_v<const second_type&, second_type>) {
- first = std::forward<first_type>(__p.first);
- second = std::forward<second_type>(__p.second);
- return *this;
- }
-
- template<class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(const pair<_U1, _U2>& __p) const
- requires(is_assignable_v<const first_type&, const _U1&> &&
- is_assignable_v<const second_type&, const _U2&>) {
- first = __p.first;
- second = __p.second;
- return *this;
- }
-
- template<class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const pair& operator=(pair<_U1, _U2>&& __p) const
- requires(is_assignable_v<const first_type&, _U1> &&
- is_assignable_v<const second_type&, _U2>) {
- first = std::forward<_U1>(__p.first);
- second = std::forward<_U2>(__p.second);
- return *this;
- }
-
- template <__pair_like _PairLike>
- requires(__different_from<_PairLike, pair> &&
- !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
- is_assignable_v<first_type&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
- is_assignable_v<second_type&, decltype(std::get<1>(std::declval<_PairLike>()))>)
- _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(_PairLike&& __p) {
- first = std::get<0>(std::forward<_PairLike>(__p));
- second = std::get<1>(std::forward<_PairLike>(__p));
- return *this;
- }
-
- template <__pair_like _PairLike>
- requires(__different_from<_PairLike, pair> &&
- !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
- is_assignable_v<first_type const&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
- is_assignable_v<second_type const&, decltype(std::get<1>(std::declval<_PairLike>()))>)
- _LIBCPP_HIDE_FROM_ABI constexpr pair const& operator=(_PairLike&& __p) const {
- first = std::get<0>(std::forward<_PairLike>(__p));
- second = std::get<1>(std::forward<_PairLike>(__p));
- return *this;
- }
+ requires(is_assignable_v<const first_type&, first_type> && is_assignable_v<const second_type&, second_type>)
+ {
+ first = std::forward<first_type>(__p.first);
+ second = std::forward<second_type>(__p.second);
+ return *this;
+ }
+
+ template <class _U1, class _U2>
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(const pair<_U1, _U2>& __p) const
+ requires(is_assignable_v<const first_type&, const _U1&> && is_assignable_v<const second_type&, const _U2&>)
+ {
+ first = __p.first;
+ second = __p.second;
+ return *this;
+ }
+
+ template <class _U1, class _U2>
+ _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair<_U1, _U2>&& __p) const
+ requires(is_assignable_v<const first_type&, _U1> && is_assignable_v<const second_type&, _U2>)
+ {
+ first = std::forward<_U1>(__p.first);
+ second = std::forward<_U2>(__p.second);
+ return *this;
+ }
+
+ template <__pair_like _PairLike>
+ requires(__different_from<_PairLike, pair> && !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
+ is_assignable_v<first_type&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
+ is_assignable_v<second_type&, decltype(std::get<1>(std::declval<_PairLike>()))>)
+ _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(_PairLike&& __p) {
+ first = std::get<0>(std::forward<_PairLike>(__p));
+ second = std::get<1>(std::forward<_PairLike>(__p));
+ return *this;
+ }
+
+ template <__pair_like _PairLike>
+ requires(__different_from<_PairLike, pair> && !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
+ is_assignable_v<first_type const&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
+ is_assignable_v<second_type const&, decltype(std::get<1>(std::declval<_PairLike>()))>)
+ _LIBCPP_HIDE_FROM_ABI constexpr pair const& operator=(_PairLike&& __p) const {
+ first = std::get<0>(std::forward<_PairLike>(__p));
+ second = std::get<1>(std::forward<_PairLike>(__p));
+ return *this;
+ }
# endif // _LIBCPP_STD_VER >= 23
- // Prior to C++23, we provide an approximation of constructors and assignment operators from
- // pair-like types. This was historically provided as an extension.
-#if _LIBCPP_STD_VER < 23
- // from std::tuple
- template<class _U1, class _U2, __enable_if_t<
- is_convertible<_U1 const&, _T1>::value &&
- is_convertible<_U2 const&, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(tuple<_U1, _U2> const& __p)
- : first(std::get<0>(__p)),
- second(std::get<1>(__p)) {}
-
- template<class _U1, class _U2, __enable_if_t<
- is_constructible<_T1, _U1 const&>::value &&
- is_constructible<_T2, _U2 const&>::value &&
- !(is_convertible<_U1 const&, _T1>::value &&
- is_convertible<_U2 const&, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(tuple<_U1, _U2> const& __p)
- : first(std::get<0>(__p)),
- second(std::get<1>(__p)) {}
-
- template<class _U1, class _U2, __enable_if_t<
- is_convertible<_U1, _T1>::value &&
- is_convertible<_U2, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(tuple<_U1, _U2>&& __p)
- : first(std::get<0>(std::move(__p))),
- second(std::get<1>(std::move(__p))) {}
-
- template<class _U1, class _U2, __enable_if_t<
- is_constructible<_T1, _U1>::value &&
- is_constructible<_T2, _U2>::value &&
- !(is_convertible<_U1, _T1>::value &&
- is_convertible<_U2, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(tuple<_U1, _U2>&& __p)
- : first(std::get<0>(std::move(__p))),
- second(std::get<1>(std::move(__p))) {}
-
-
- template<class _U1, class _U2, __enable_if_t<
- is_assignable<_T1&, _U1 const&>::value &&
- is_assignable<_T2&, _U2 const&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(tuple<_U1, _U2> const& __p) {
- first = std::get<0>(__p);
- second = std::get<1>(__p);
- return *this;
- }
-
- template<class _U1, class _U2, __enable_if_t<
- is_assignable<_T1&, _U1&&>::value &&
- is_assignable<_T2&, _U2&&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(tuple<_U1, _U2>&& __p) {
- first = std::get<0>(std::move(__p));
- second = std::get<1>(std::move(__p));
- return *this;
- }
-
- // from std::array
- template<class _Up, __enable_if_t<
- is_convertible<_Up const&, _T1>::value &&
- is_convertible<_Up const&, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(array<_Up, 2> const& __p)
- : first(__p[0]),
- second(__p[1]) {}
-
- template<class _Up, __enable_if_t<
- is_constructible<_T1, _Up const&>::value &&
- is_constructible<_T2, _Up const&>::value &&
- !(is_convertible<_Up const&, _T1>::value &&
- is_convertible<_Up const&, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(array<_Up, 2> const& __p)
- : first(__p[0]),
- second(__p[1]) {}
-
- template<class _Up, __enable_if_t<
- is_convertible<_Up, _T1>::value &&
- is_convertible<_Up, _T2>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair(array<_Up, 2>&& __p)
- : first(std::move(__p)[0]),
- second(std::move(__p)[1]) {}
-
- template<class _Up, __enable_if_t<
- is_constructible<_T1, _Up>::value &&
- is_constructible<_T2, _Up>::value &&
- !(is_convertible<_Up, _T1>::value &&
- is_convertible<_Up, _T2>::value)
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- pair(array<_Up, 2>&& __p)
- : first(std::move(__p)[0]),
- second(std::move(__p)[1]) {}
-
-
- template<class _Up, __enable_if_t<
- is_assignable<_T1&, _Up const&>::value &&
- is_assignable<_T2&, _Up const&>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(array<_Up, 2> const& __p) {
- first = std::get<0>(__p);
- second = std::get<1>(__p);
- return *this;
- }
-
- template<class _Up, __enable_if_t<
- is_assignable<_T1&, _Up>::value &&
- is_assignable<_T2&, _Up>::value
- >* = nullptr>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- pair& operator=(array<_Up, 2>&& __p) {
- first = std::get<0>(std::move(__p));
- second = std::get<1>(std::move(__p));
- return *this;
- }
-#endif // _LIBCPP_STD_VER < 23
-#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void
- swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
- __is_nothrow_swappable<second_type>::value)
- {
- using std::swap;
- swap(first, __p.first);
- swap(second, __p.second);
- }
+ // Prior to C++23, we provide an approximation of constructors and assignment operators from
+ // pair-like types. This was historically provided as an extension.
+# if _LIBCPP_STD_VER < 23
+ // from std::tuple
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2> const& __p)
+ : first(std::get<0>(__p)), second(std::get<1>(__p)) {}
+
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_constructible<_T1, _U1 const&>::value && is_constructible<_T2, _U2 const&>::value &&
+ !(is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2> const& __p)
+ : first(std::get<0>(__p)), second(std::get<1>(__p)) {}
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2>&& __p)
+ : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {}
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value &&
+ !(is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2>&& __p)
+ : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {}
+
+ template <
+ class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<_T1&, _U1 const&>::value && is_assignable<_T2&, _U2 const&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2> const& __p) {
+ first = std::get<0>(__p);
+ second = std::get<1>(__p);
+ return *this;
+ }
+
+ template <class _U1,
+ class _U2,
+ __enable_if_t< is_assignable<_T1&, _U1&&>::value && is_assignable<_T2&, _U2&&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2>&& __p) {
+ first = std::get<0>(std::move(__p));
+ second = std::get<1>(std::move(__p));
+ return *this;
+ }
+
+ // from std::array
+ template <
+ class _Up,
+ __enable_if_t< is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {}
+
+ template <
+ class _Up,
+ __enable_if_t< is_constructible<_T1, _Up const&>::value && is_constructible<_T2, _Up const&>::value &&
+ !(is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2> const& __p)
+ : first(__p[0]), second(__p[1]) {}
+
+ template <class _Up, __enable_if_t< is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2>&& __p)
+ : first(std::move(__p)[0]), second(std::move(__p)[1]) {}
+
+ template <class _Up,
+ __enable_if_t< is_constructible<_T1, _Up>::value && is_constructible<_T2, _Up>::value &&
+ !(is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value) >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2>&& __p)
+ : first(std::move(__p)[0]), second(std::move(__p)[1]) {}
+
+ template <
+ class _Up,
+ __enable_if_t< is_assignable<_T1&, _Up const&>::value && is_assignable<_T2&, _Up const&>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2> const& __p) {
+ first = std::get<0>(__p);
+ second = std::get<1>(__p);
+ return *this;
+ }
+
+ template <class _Up, __enable_if_t< is_assignable<_T1&, _Up>::value && is_assignable<_T2&, _Up>::value >* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2>&& __p) {
+ first = std::get<0>(std::move(__p));
+ second = std::get<1>(std::move(__p));
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER < 23
+#endif // _LIBCPP_CXX03_LANG
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p)
+ _NOEXCEPT_(__is_nothrow_swappable<first_type>::value&& __is_nothrow_swappable<second_type>::value) {
+ using std::swap;
+ swap(first, __p.first);
+ swap(second, __p.second);
+ }
#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- void swap(const pair& __p) const
- noexcept(__is_nothrow_swappable<const first_type>::value &&
- __is_nothrow_swappable<const second_type>::value)
- {
- using std::swap;
- swap(first, __p.first);
- swap(second, __p.second);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr void swap(const pair& __p) const
+ noexcept(__is_nothrow_swappable<const first_type>::value && __is_nothrow_swappable<const second_type>::value) {
+ using std::swap;
+ swap(first, __p.first);
+ swap(second, __p.second);
+ }
#endif
-private:
+private:
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair(piecewise_construct_t,
- tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
- __tuple_indices<_I1...>, __tuple_indices<_I2...>);
+ template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ pair(piecewise_construct_t,
+ tuple<_Args1...>& __first_args,
+ tuple<_Args2...>& __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>);
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _T1, class _T2>
+template <class _T1, class _T2>
pair(_T1, _T2) -> pair<_T1, _T2>;
#endif
// [pairs.spec], specialized algorithms
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return __x.first == __y.first && __x.second == __y.second;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return __x.first == __y.first && __x.second == __y.second;
}
#if _LIBCPP_STD_VER >= 20
template <class _T1, class _T2, class _U1, class _U2>
-_LIBCPP_HIDE_FROM_ABI constexpr
-common_comparison_category_t<
- __synth_three_way_result<_T1, _U1>,
- __synth_three_way_result<_T2, _U2> >
-operator<=>(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) {
- return __c;
- }
- return std::__synth_three_way(__x.second, __y.second);
+_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t< __synth_three_way_result<_T1, _U1>,
+ __synth_three_way_result<_T2, _U2> >
+operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) {
+ return __c;
+ }
+ return std::__synth_three_way(__x.second, __y.second);
}
#else // _LIBCPP_STD_VER >= 20
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return !(__x == __y);
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator< (const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second);
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator> (const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return __y < __x;
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return !(__x < __y);
}
template <class _T1, class _T2, class _U1, class _U2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 23
-template <class _T1, class _T2, class _U1, class _U2, template<class> class _TQual, template<class> class _UQual>
- requires requires { typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
- common_reference_t<_TQual<_T2>, _UQual<_U2>>>; }
+template <class _T1, class _T2, class _U1, class _U2, template <class> class _TQual, template <class> class _UQual>
+ requires requires {
+ typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>, common_reference_t<_TQual<_T2>, _UQual<_U2>>>;
+ }
struct basic_common_reference<pair<_T1, _T2>, pair<_U1, _U2>, _TQual, _UQual> {
- using type = pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
- common_reference_t<_TQual<_T2>, _UQual<_U2>>>;
+ using type = pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>, common_reference_t<_TQual<_T2>, _UQual<_U2>>>;
};
template <class _T1, class _T2, class _U1, class _U2>
- requires requires { typename pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; }
+ requires requires { typename pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; }
struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> {
- using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>;
+ using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>;
};
#endif // _LIBCPP_STD_VER >= 23
template <class _T1, class _T2, __enable_if_t<__is_swappable<_T1>::value && __is_swappable<_T2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
- _NOEXCEPT_((__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
+ _NOEXCEPT_((__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value)) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 23
template <class _T1, class _T2>
- requires (__is_swappable<const _T1>::value &&
- __is_swappable<const _T2>::value)
-_LIBCPP_HIDE_FROM_ABI constexpr
-void swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
- noexcept(noexcept(__x.swap(__y)))
-{
- __x.swap(__y);
+ requires(__is_swappable<const _T1>::value && __is_swappable<const _T2>::value)
+_LIBCPP_HIDE_FROM_ABI constexpr void
+swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) {
+ __x.swap(__y);
}
#endif
template <class _T1, class _T2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>
-make_pair(_T1&& __t1, _T2&& __t2)
-{
- return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>
- (std::forward<_T1>(__t1), std::forward<_T2>(__t2));
+ pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>
+ make_pair(_T1&& __t1, _T2&& __t2) {
+ return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type>(
+ std::forward<_T1>(__t1), std::forward<_T2>(__t2));
}
template <class _T1, class _T2>
- struct _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> >
- : public integral_constant<size_t, 2> {};
+struct _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
template <size_t _Ip, class _T1, class _T2>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >
-{
- static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> > {
+ static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");
};
template <class _T1, class _T2>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
-{
- using type _LIBCPP_NODEBUG = _T1;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > {
+ using type _LIBCPP_NODEBUG = _T1;
};
template <class _T1, class _T2>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> >
-{
- using type _LIBCPP_NODEBUG = _T2;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> > {
+ using type _LIBCPP_NODEBUG = _T2;
};
-template <size_t _Ip> struct __get_pair;
+template <size_t _Ip>
+struct __get_pair;
template <>
-struct __get_pair<0>
-{
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T1&
- get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T1&
- get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T1&&
- get(pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<_T1>(__p.first);}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T1&&
- get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<const _T1>(__p.first);}
+struct __get_pair<0> {
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.first;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.first;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<_T1>(__p.first);
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<const _T1>(__p.first);
+ }
};
template <>
-struct __get_pair<1>
-{
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T2&
- get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T2&
- get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- _T2&&
- get(pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<_T2>(__p.second);}
-
- template <class _T1, class _T2>
- static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _T2&&
- get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<const _T2>(__p.second);}
+struct __get_pair<1> {
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.second;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __p.second;
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<_T2>(__p.second);
+ }
+
+ template <class _T1, class _T2>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return std::forward<const _T2>(__p.second);
+ }
};
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&
-get(pair<_T1, _T2>& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(__p);
}
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
-get(const pair<_T1, _T2>& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
+get(const pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(__p);
}
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
-get(pair<_T1, _T2>&& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(std::move(__p));
}
template <size_t _Ip, class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
-get(const pair<_T1, _T2>&& __p) _NOEXCEPT
-{
- return __get_pair<_Ip>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return __get_pair<_Ip>::get(std::move(__p));
}
#if _LIBCPP_STD_VER >= 14
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
+ return __get_pair<0>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
+ return __get_pair<0>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
+ return __get_pair<0>::get(std::move(__p));
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT
-{
- return __get_pair<0>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
+ return __get_pair<0>::get(std::move(__p));
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T2, _T1>& __p) _NOEXCEPT {
+ return __get_pair<1>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(__p);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T2, _T1> const& __p) _NOEXCEPT {
+ return __get_pair<1>::get(__p);
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T2, _T1>&& __p) _NOEXCEPT {
+ return __get_pair<1>::get(std::move(__p));
}
template <class _T1, class _T2>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT
-{
- return __get_pair<1>::get(std::move(__p));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T2, _T1> const&& __p) _NOEXCEPT {
+ return __get_pair<1>::get(std::move(__p));
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h b/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h
index ad86badb66c8..52b19d791e10 100644
--- a/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h
+++ b/contrib/llvm-project/libcxx/include/__utility/piecewise_construct.h
@@ -17,7 +17,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; };
+struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t {
+ explicit piecewise_construct_t() = default;
+};
#if _LIBCPP_STD_VER >= 17
inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
diff --git a/contrib/llvm-project/libcxx/include/__utility/priority_tag.h b/contrib/llvm-project/libcxx/include/__utility/priority_tag.h
index e51ba6bfcc05..a159ce7f1afb 100644
--- a/contrib/llvm-project/libcxx/include/__utility/priority_tag.h
+++ b/contrib/llvm-project/libcxx/include/__utility/priority_tag.h
@@ -18,8 +18,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<size_t _Ip> struct __priority_tag : __priority_tag<_Ip - 1> {};
-template<> struct __priority_tag<0> {};
+template <size_t _Ip>
+struct __priority_tag : __priority_tag<_Ip - 1> {};
+template <>
+struct __priority_tag<0> {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__utility/rel_ops.h b/contrib/llvm-project/libcxx/include/__utility/rel_ops.h
index de9fb20b8d52..ee8657196d98 100644
--- a/contrib/llvm-project/libcxx/include/__utility/rel_ops.h
+++ b/contrib/llvm-project/libcxx/include/__utility/rel_ops.h
@@ -17,39 +17,26 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace rel_ops
-{
-
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const _Tp& __x, const _Tp& __y)
-{
- return !(__x == __y);
+namespace rel_ops {
+
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const _Tp& __x, const _Tp& __y) {
+ return !(__x == __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const _Tp& __x, const _Tp& __y)
-{
- return __y < __x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const _Tp& __x, const _Tp& __y) {
+ return __y < __x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const _Tp& __x, const _Tp& __y)
-{
- return !(__y < __x);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const _Tp& __x, const _Tp& __y) {
+ return !(__y < __x);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const _Tp& __x, const _Tp& __y)
-{
- return !(__x < __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const _Tp& __x, const _Tp& __y) {
+ return !(__x < __y);
}
} // namespace rel_ops
diff --git a/contrib/llvm-project/libcxx/include/__utility/to_underlying.h b/contrib/llvm-project/libcxx/include/__utility/to_underlying.h
index 114e088c1692..5fdf0f255e57 100644
--- a/contrib/llvm-project/libcxx/include/__utility/to_underlying.h
+++ b/contrib/llvm-project/libcxx/include/__utility/to_underlying.h
@@ -21,16 +21,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr typename underlying_type<_Tp>::type
-__to_underlying(_Tp __val) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr typename underlying_type<_Tp>::type __to_underlying(_Tp __val) noexcept {
return static_cast<typename underlying_type<_Tp>::type>(__val);
}
#endif // !_LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
template <class _Tp>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr underlying_type_t<_Tp>
-to_underlying(_Tp __val) noexcept {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr underlying_type_t<_Tp> to_underlying(_Tp __val) noexcept {
return std::__to_underlying(__val);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/__utility/unreachable.h b/contrib/llvm-project/libcxx/include/__utility/unreachable.h
index 4a21b74b1973..49334decc8f6 100644
--- a/contrib/llvm-project/libcxx/include/__utility/unreachable.h
+++ b/contrib/llvm-project/libcxx/include/__utility/unreachable.h
@@ -19,8 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() {
- _LIBCPP_ASSERT_UNCATEGORIZED(false, "std::unreachable() was reached");
- __builtin_unreachable();
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "std::unreachable() was reached");
+ __builtin_unreachable();
}
#if _LIBCPP_STD_VER >= 23
diff --git a/contrib/llvm-project/libcxx/include/__variant/monostate.h b/contrib/llvm-project/libcxx/include/__variant/monostate.h
index 2944e41ac704..16f156609eb7 100644
--- a/contrib/llvm-project/libcxx/include/__variant/monostate.h
+++ b/contrib/llvm-project/libcxx/include/__variant/monostate.h
@@ -50,7 +50,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(monostate, monostate) noe
template <>
struct _LIBCPP_TEMPLATE_VIS hash<monostate> {
using argument_type = monostate;
- using result_type = size_t;
+ using result_type = size_t;
inline _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type&) const _NOEXCEPT {
return 66740831; // return a fundamentally attractive random value.
diff --git a/contrib/llvm-project/libcxx/include/__verbose_abort b/contrib/llvm-project/libcxx/include/__verbose_abort
index 54c691670607..259c70dda8fe 100644
--- a/contrib/llvm-project/libcxx/include/__verbose_abort
+++ b/contrib/llvm-project/libcxx/include/__verbose_abort
@@ -21,8 +21,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// This function should never be called directly from the code -- it should only be called through
// the _LIBCPP_VERBOSE_ABORT macro.
-_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2)
-void __libcpp_verbose_abort(const char *__format, ...);
+_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
+ _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
// _LIBCPP_VERBOSE_ABORT(format, args...)
//
diff --git a/contrib/llvm-project/libcxx/include/algorithm b/contrib/llvm-project/libcxx/include/algorithm
index 627e7d20213f..1176602a2b69 100644
--- a/contrib/llvm-project/libcxx/include/algorithm
+++ b/contrib/llvm-project/libcxx/include/algorithm
@@ -42,6 +42,9 @@ namespace ranges {
template <class I>
struct in_found_result; // since C++20
+ template <class I, class T>
+ struct in_value_result; // since C++23
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
@@ -226,6 +229,14 @@ namespace ranges {
template<class I1, class I2>
using copy_backward_result = in_out_result<I1, I2>; // since C++20
+ template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
+ requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
+ constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
+
+ template<input_range R, class T, class Proj = identity>
+ requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
+ constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
+
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
requires indirectly_copyable<I, O>
constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
@@ -873,6 +884,23 @@ namespace ranges {
ranges::search_n(R&& r, range_difference_t<R> count,
const T& value, Pred pred = {}, Proj proj = {}); // since C++20
+ template<input_iterator I, sentinel_for<I> S, class T,
+ indirectly-binary-left-foldable<T, I> F>
+ constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
+
+ template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
+ constexpr auto fold_left(R&& r, T init, F f); // since C++23
+
+ template<class I, class T>
+ using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
+
+ template<input_iterator I, sentinel_for<I> S, class T,
+ indirectly-binary-left-foldable<T, I> F>
+ constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
+
+ template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
+ constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
+
template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
@@ -1778,6 +1806,7 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/find_first_of.h>
#include <__algorithm/find_if.h>
#include <__algorithm/find_if_not.h>
+#include <__algorithm/fold.h>
#include <__algorithm/for_each.h>
#include <__algorithm/for_each_n.h>
#include <__algorithm/generate.h>
@@ -1845,6 +1874,7 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/ranges_any_of.h>
#include <__algorithm/ranges_binary_search.h>
#include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
#include <__algorithm/ranges_copy.h>
#include <__algorithm/ranges_copy_backward.h>
#include <__algorithm/ranges_copy_if.h>
diff --git a/contrib/llvm-project/libcxx/include/any b/contrib/llvm-project/libcxx/include/any
index 7dcffc46a60d..b9e0a8d94550 100644
--- a/contrib/llvm-project/libcxx/include/any
+++ b/contrib/llvm-project/libcxx/include/any
@@ -118,10 +118,9 @@ _LIBCPP_PUSH_MACROS
#include <__undef_macros>
namespace std {
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast
-{
+class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast {
public:
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
} // namespace std
@@ -129,580 +128,465 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-void __throw_bad_any_cast()
-{
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_any_cast();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_any_cast();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
+# endif
}
// Forward declarations
class _LIBCPP_TEMPLATE_VIS any;
template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI
-add_pointer_t<add_const_t<_ValueType>>
-any_cast(any const *) _NOEXCEPT;
+_LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI
-add_pointer_t<_ValueType> any_cast(any *) _NOEXCEPT;
-
-namespace __any_imp
-{
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- using _Buffer = aligned_storage_t<3*sizeof(void*), alignof(void*)>;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
-
- template <class _Tp>
- using _IsSmallObject = integral_constant<bool
- , sizeof(_Tp) <= sizeof(_Buffer)
- && alignof(_Buffer) % alignof(_Tp) == 0
- && is_nothrow_move_constructible<_Tp>::value
- >;
-
- enum class _Action {
- _Destroy,
- _Copy,
- _Move,
- _Get,
- _TypeInfo
- };
+_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
- template <class _Tp> struct _SmallHandler;
- template <class _Tp> struct _LargeHandler;
+namespace __any_imp {
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+using _Buffer = aligned_storage_t<3 * sizeof(void*), alignof(void*)>;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
- template <class _Tp>
- struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo { static constexpr int __id = 0; };
- template <class _Tp> constexpr int __unique_typeinfo<_Tp>::__id;
+template <class _Tp>
+using _IsSmallObject =
+ integral_constant<bool,
+ sizeof(_Tp) <= sizeof(_Buffer) && alignof(_Buffer) % alignof(_Tp) == 0 &&
+ is_nothrow_move_constructible<_Tp>::value >;
- template <class _Tp>
- inline _LIBCPP_HIDE_FROM_ABI
- constexpr const void* __get_fallback_typeid() {
- return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id;
- }
+enum class _Action { _Destroy, _Copy, _Move, _Get, _TypeInfo };
- template <class _Tp>
- inline _LIBCPP_HIDE_FROM_ABI
- bool __compare_typeid(type_info const* __id, const void* __fallback_id)
- {
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- if (__id && *__id == typeid(_Tp))
- return true;
-#endif
- return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
- }
+template <class _Tp>
+struct _SmallHandler;
+template <class _Tp>
+struct _LargeHandler;
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo {
+ static constexpr int __id = 0;
+};
+template <class _Tp>
+constexpr int __unique_typeinfo<_Tp>::__id;
+
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() {
+ return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id;
+}
- template <class _Tp>
- using _Handler = conditional_t<
- _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI bool __compare_typeid(type_info const* __id, const void* __fallback_id) {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ if (__id && *__id == typeid(_Tp))
+ return true;
+# endif
+ return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
+}
+
+template <class _Tp>
+using _Handler = conditional_t< _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>;
} // namespace __any_imp
-class _LIBCPP_TEMPLATE_VIS any
-{
+class _LIBCPP_TEMPLATE_VIS any {
public:
// construct/destruct
- _LIBCPP_HIDE_FROM_ABI
- constexpr any() _NOEXCEPT : __h_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr any() _NOEXCEPT : __h_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- any(any const & __other) : __h_(nullptr)
- {
- if (__other.__h_) __other.__call(_Action::_Copy, this);
+ _LIBCPP_HIDE_FROM_ABI any(any const& __other) : __h_(nullptr) {
+ if (__other.__h_)
+ __other.__call(_Action::_Copy, this);
}
- _LIBCPP_HIDE_FROM_ABI
- any(any && __other) _NOEXCEPT : __h_(nullptr)
- {
- if (__other.__h_) __other.__call(_Action::_Move, this);
+ _LIBCPP_HIDE_FROM_ABI any(any&& __other) _NOEXCEPT : __h_(nullptr) {
+ if (__other.__h_)
+ __other.__call(_Action::_Move, this);
}
- template <
- class _ValueType
- , class _Tp = decay_t<_ValueType>
- , class = enable_if_t<
- !is_same<_Tp, any>::value &&
- !__is_inplace_type<_ValueType>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- any(_ValueType && __value);
-
- template <class _ValueType, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, _Args...>::value &&
- is_copy_constructible<_Tp>::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
-
- template <class _ValueType, class _Up, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args);
-
- _LIBCPP_HIDE_FROM_ABI
- ~any() { this->reset(); }
+ template < class _ValueType,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< !is_same<_Tp, any>::value && !__is_inplace_type<_ValueType>::value &&
+ is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI any(_ValueType&& __value);
+
+ template <class _ValueType,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value > >
+ _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
+
+ template <class _ValueType,
+ class _Up,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
+ is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args);
+
+ _LIBCPP_HIDE_FROM_ABI ~any() { this->reset(); }
// assignments
- _LIBCPP_HIDE_FROM_ABI
- any & operator=(any const & __rhs) {
+ _LIBCPP_HIDE_FROM_ABI any& operator=(any const& __rhs) {
any(__rhs).swap(*this);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI
- any & operator=(any && __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI any& operator=(any&& __rhs) _NOEXCEPT {
any(std::move(__rhs)).swap(*this);
return *this;
}
- template <
- class _ValueType
- , class _Tp = decay_t<_ValueType>
- , class = enable_if_t<
- !is_same<_Tp, any>::value
- && is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- any & operator=(_ValueType && __rhs);
-
- template <class _ValueType, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, _Args...>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(_Args&&...);
-
- template <class _ValueType, class _Up, class ..._Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t<
- is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(initializer_list<_Up>, _Args&&...);
+ template < class _ValueType,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< !is_same<_Tp, any>::value && is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI any& operator=(_ValueType&& __rhs);
+
+ template <class _ValueType,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&...);
+
+ template <class _ValueType,
+ class _Up,
+ class... _Args,
+ class _Tp = decay_t<_ValueType>,
+ class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
+ is_copy_constructible<_Tp>::value> >
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up>, _Args&&...);
// 6.3.3 any modifiers
- _LIBCPP_HIDE_FROM_ABI
- void reset() _NOEXCEPT { if (__h_) this->__call(_Action::_Destroy); }
+ _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT {
+ if (__h_)
+ this->__call(_Action::_Destroy);
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(any & __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void swap(any& __rhs) _NOEXCEPT;
// 6.3.4 any observers
- _LIBCPP_HIDE_FROM_ABI
- bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
+ _LIBCPP_HIDE_FROM_ABI bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- _LIBCPP_HIDE_FROM_ABI
- const type_info & type() const _NOEXCEPT {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ _LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT {
if (__h_) {
- return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
+ return *static_cast<type_info const*>(this->__call(_Action::_TypeInfo));
} else {
- return typeid(void);
+ return typeid(void);
}
}
-#endif
+# endif
private:
- typedef __any_imp::_Action _Action;
- using _HandleFuncPtr = void* (*)(_Action, any const *, any *, const type_info *,
- const void* __fallback_info);
-
- union _Storage {
- _LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {}
- void * __ptr;
- __any_imp::_Buffer __buf;
- };
-
- _LIBCPP_HIDE_FROM_ABI
- void * __call(_Action __a, any * __other = nullptr,
- type_info const * __info = nullptr,
- const void* __fallback_info = nullptr) const
- {
- return __h_(__a, this, __other, __info, __fallback_info);
- }
+ typedef __any_imp::_Action _Action;
+ using _HandleFuncPtr = void* (*)(_Action, any const*, any*, const type_info*, const void* __fallback_info);
- _LIBCPP_HIDE_FROM_ABI
- void * __call(_Action __a, any * __other = nullptr,
- type_info const * __info = nullptr,
- const void* __fallback_info = nullptr)
- {
- return __h_(__a, this, __other, __info, __fallback_info);
- }
+ union _Storage {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {}
+ void* __ptr;
+ __any_imp::_Buffer __buf;
+ };
- template <class>
- friend struct __any_imp::_SmallHandler;
- template <class>
- friend struct __any_imp::_LargeHandler;
+ _LIBCPP_HIDE_FROM_ABI void*
+ __call(_Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr)
+ const {
+ return __h_(__a, this, __other, __info, __fallback_info);
+ }
- template <class _ValueType>
- friend add_pointer_t<add_const_t<_ValueType>>
- any_cast(any const *) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void* __call(
+ _Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr) {
+ return __h_(__a, this, __other, __info, __fallback_info);
+ }
- template <class _ValueType>
- friend add_pointer_t<_ValueType>
- any_cast(any *) _NOEXCEPT;
+ template <class>
+ friend struct __any_imp::_SmallHandler;
+ template <class>
+ friend struct __any_imp::_LargeHandler;
- _HandleFuncPtr __h_ = nullptr;
- _Storage __s_;
-};
+ template <class _ValueType>
+ friend add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
-namespace __any_imp
-{
- template <class _Tp>
- struct _LIBCPP_TEMPLATE_VIS _SmallHandler
- {
- _LIBCPP_HIDE_FROM_ABI
- static void* __handle(_Action __act, any const * __this, any * __other,
- type_info const * __info, const void* __fallback_info)
- {
- switch (__act)
- {
- case _Action::_Destroy:
- __destroy(const_cast<any &>(*__this));
- return nullptr;
- case _Action::_Copy:
- __copy(*__this, *__other);
- return nullptr;
- case _Action::_Move:
- __move(const_cast<any &>(*__this), *__other);
- return nullptr;
- case _Action::_Get:
- return __get(const_cast<any &>(*__this), __info, __fallback_info);
- case _Action::_TypeInfo:
- return __type_info();
- }
- __libcpp_unreachable();
- }
+ template <class _ValueType>
+ friend add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- static _Tp& __create(any & __dest, _Args&&... __args) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s_.__buf));
- _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
- __dest.__h_ = &_SmallHandler::__handle;
- return *__ret;
- }
+ _HandleFuncPtr __h_ = nullptr;
+ _Storage __s_;
+};
- private:
- _LIBCPP_HIDE_FROM_ABI
- static void __destroy(any & __this) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s_.__buf));
- _ATraits::destroy(__a, __p);
- __this.__h_ = nullptr;
+namespace __any_imp {
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS _SmallHandler {
+ _LIBCPP_HIDE_FROM_ABI static void*
+ __handle(_Action __act, any const* __this, any* __other, type_info const* __info, const void* __fallback_info) {
+ switch (__act) {
+ case _Action::_Destroy:
+ __destroy(const_cast<any&>(*__this));
+ return nullptr;
+ case _Action::_Copy:
+ __copy(*__this, *__other);
+ return nullptr;
+ case _Action::_Move:
+ __move(const_cast<any&>(*__this), *__other);
+ return nullptr;
+ case _Action::_Get:
+ return __get(const_cast<any&>(*__this), __info, __fallback_info);
+ case _Action::_TypeInfo:
+ return __type_info();
}
+ __libcpp_unreachable();
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __copy(any const & __this, any & __dest) {
- _SmallHandler::__create(__dest, *static_cast<_Tp const *>(
- static_cast<void const *>(&__this.__s_.__buf)));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ _Alloc __a;
+ _Tp* __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s_.__buf));
+ _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
+ __dest.__h_ = &_SmallHandler::__handle;
+ return *__ret;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __move(any & __this, any & __dest) {
- _SmallHandler::__create(__dest, std::move(
- *static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf))));
- __destroy(__this);
- }
+private:
+ _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ _Alloc __a;
+ _Tp* __p = static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf));
+ _ATraits::destroy(__a, __p);
+ __this.__h_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __get(any & __this,
- type_info const * __info,
- const void* __fallback_id)
- {
- if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id))
- return static_cast<void*>(&__this.__s_.__buf);
- return nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) {
+ _SmallHandler::__create(__dest, *static_cast<_Tp const*>(static_cast<void const*>(&__this.__s_.__buf)));
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __type_info()
- {
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
-#else
- return nullptr;
-#endif
- }
- };
+ _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) {
+ _SmallHandler::__create(__dest, std::move(*static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf))));
+ __destroy(__this);
+ }
- template <class _Tp>
- struct _LIBCPP_TEMPLATE_VIS _LargeHandler
- {
- _LIBCPP_HIDE_FROM_ABI
- static void* __handle(_Action __act, any const * __this,
- any * __other, type_info const * __info,
- void const* __fallback_info)
- {
- switch (__act)
- {
- case _Action::_Destroy:
- __destroy(const_cast<any &>(*__this));
- return nullptr;
- case _Action::_Copy:
- __copy(*__this, *__other);
- return nullptr;
- case _Action::_Move:
- __move(const_cast<any &>(*__this), *__other);
- return nullptr;
- case _Action::_Get:
- return __get(const_cast<any &>(*__this), __info, __fallback_info);
- case _Action::_TypeInfo:
- return __type_info();
- }
- __libcpp_unreachable();
- }
+ _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, const void* __fallback_id) {
+ if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id))
+ return static_cast<void*>(&__this.__s_.__buf);
+ return nullptr;
+ }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- static _Tp& __create(any & __dest, _Args&&... __args) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- typedef __allocator_destructor<_Alloc> _Dp;
- _Alloc __a;
- unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
- _Tp * __ret = __hold.get();
- _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
- __dest.__s_.__ptr = __hold.release();
- __dest.__h_ = &_LargeHandler::__handle;
- return *__ret;
- }
+ _LIBCPP_HIDE_FROM_ABI static void* __type_info() {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
+# else
+ return nullptr;
+# endif
+ }
+};
- private:
-
- _LIBCPP_HIDE_FROM_ABI
- static void __destroy(any & __this){
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp * __p = static_cast<_Tp *>(__this.__s_.__ptr);
- _ATraits::destroy(__a, __p);
- _ATraits::deallocate(__a, __p, 1);
- __this.__h_ = nullptr;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS _LargeHandler {
+ _LIBCPP_HIDE_FROM_ABI static void*
+ __handle(_Action __act, any const* __this, any* __other, type_info const* __info, void const* __fallback_info) {
+ switch (__act) {
+ case _Action::_Destroy:
+ __destroy(const_cast<any&>(*__this));
+ return nullptr;
+ case _Action::_Copy:
+ __copy(*__this, *__other);
+ return nullptr;
+ case _Action::_Move:
+ __move(const_cast<any&>(*__this), *__other);
+ return nullptr;
+ case _Action::_Get:
+ return __get(const_cast<any&>(*__this), __info, __fallback_info);
+ case _Action::_TypeInfo:
+ return __type_info();
}
+ __libcpp_unreachable();
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __copy(any const & __this, any & __dest) {
- _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s_.__ptr));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ typedef __allocator_destructor<_Alloc> _Dp;
+ _Alloc __a;
+ unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
+ _Tp* __ret = __hold.get();
+ _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
+ __dest.__s_.__ptr = __hold.release();
+ __dest.__h_ = &_LargeHandler::__handle;
+ return *__ret;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void __move(any & __this, any & __dest) {
- __dest.__s_.__ptr = __this.__s_.__ptr;
- __dest.__h_ = &_LargeHandler::__handle;
- __this.__h_ = nullptr;
- }
+private:
+ _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
+ typedef allocator<_Tp> _Alloc;
+ typedef allocator_traits<_Alloc> _ATraits;
+ _Alloc __a;
+ _Tp* __p = static_cast<_Tp*>(__this.__s_.__ptr);
+ _ATraits::destroy(__a, __p);
+ _ATraits::deallocate(__a, __p, 1);
+ __this.__h_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __get(any & __this, type_info const * __info,
- void const* __fallback_info)
- {
- if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info))
- return static_cast<void*>(__this.__s_.__ptr);
- return nullptr;
+ _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) {
+ _LargeHandler::__create(__dest, *static_cast<_Tp const*>(__this.__s_.__ptr));
+ }
- }
+ _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) {
+ __dest.__s_.__ptr = __this.__s_.__ptr;
+ __dest.__h_ = &_LargeHandler::__handle;
+ __this.__h_ = nullptr;
+ }
- _LIBCPP_HIDE_FROM_ABI
- static void* __type_info()
- {
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
-#else
- return nullptr;
-#endif
- }
- };
+ _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, void const* __fallback_info) {
+ if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info))
+ return static_cast<void*>(__this.__s_.__ptr);
+ return nullptr;
+ }
-} // namespace __any_imp
+ _LIBCPP_HIDE_FROM_ABI static void* __type_info() {
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
+# else
+ return nullptr;
+# endif
+ }
+};
+} // namespace __any_imp
template <class _ValueType, class _Tp, class>
-any::any(_ValueType && __v) : __h_(nullptr)
-{
+any::any(_ValueType&& __v) : __h_(nullptr) {
__any_imp::_Handler<_Tp>::__create(*this, std::forward<_ValueType>(__v));
}
-template <class _ValueType, class ..._Args, class _Tp, class>
+template <class _ValueType, class... _Args, class _Tp, class>
any::any(in_place_type_t<_ValueType>, _Args&&... __args) {
__any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
}
-template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
+template <class _ValueType, class _Up, class... _Args, class _Tp, class>
any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
__any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
}
template <class _ValueType, class, class>
-inline _LIBCPP_HIDE_FROM_ABI
-any & any::operator=(_ValueType && __v)
-{
+inline _LIBCPP_HIDE_FROM_ABI any& any::operator=(_ValueType&& __v) {
any(std::forward<_ValueType>(__v)).swap(*this);
return *this;
}
-template <class _ValueType, class ..._Args, class _Tp, class>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp& any::emplace(_Args&&... __args) {
+template <class _ValueType, class... _Args, class _Tp, class>
+inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(_Args&&... __args) {
reset();
return __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
}
-template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
+template <class _ValueType, class _Up, class... _Args, class _Tp, class>
+inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
reset();
return __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
}
-inline _LIBCPP_HIDE_FROM_ABI
-void any::swap(any & __rhs) _NOEXCEPT
-{
- if (this == &__rhs)
- return;
- if (__h_ && __rhs.__h_) {
- any __tmp;
- __rhs.__call(_Action::_Move, &__tmp);
- this->__call(_Action::_Move, &__rhs);
- __tmp.__call(_Action::_Move, this);
- }
- else if (__h_) {
- this->__call(_Action::_Move, &__rhs);
- }
- else if (__rhs.__h_) {
- __rhs.__call(_Action::_Move, this);
- }
+inline _LIBCPP_HIDE_FROM_ABI void any::swap(any& __rhs) _NOEXCEPT {
+ if (this == &__rhs)
+ return;
+ if (__h_ && __rhs.__h_) {
+ any __tmp;
+ __rhs.__call(_Action::_Move, &__tmp);
+ this->__call(_Action::_Move, &__rhs);
+ __tmp.__call(_Action::_Move, this);
+ } else if (__h_) {
+ this->__call(_Action::_Move, &__rhs);
+ } else if (__rhs.__h_) {
+ __rhs.__call(_Action::_Move, this);
+ }
}
// 6.4 Non-member functions
-inline _LIBCPP_HIDE_FROM_ABI
-void swap(any & __lhs, any & __rhs) _NOEXCEPT
-{
- __lhs.swap(__rhs);
-}
+inline _LIBCPP_HIDE_FROM_ABI void swap(any& __lhs, any& __rhs) _NOEXCEPT { __lhs.swap(__rhs); }
-template <class _Tp, class ..._Args>
-inline _LIBCPP_HIDE_FROM_ABI
-any make_any(_Args&&... __args) {
- return any(in_place_type<_Tp>, std::forward<_Args>(__args)...);
+template <class _Tp, class... _Args>
+inline _LIBCPP_HIDE_FROM_ABI any make_any(_Args&&... __args) {
+ return any(in_place_type<_Tp>, std::forward<_Args>(__args)...);
}
-template <class _Tp, class _Up, class ..._Args>
-inline _LIBCPP_HIDE_FROM_ABI
-any make_any(initializer_list<_Up> __il, _Args&&... __args) {
- return any(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
+template <class _Tp, class _Up, class... _Args>
+inline _LIBCPP_HIDE_FROM_ABI any make_any(initializer_list<_Up> __il, _Args&&... __args) {
+ return any(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-_ValueType any_cast(any const & __v)
-{
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType const &>::value,
- "ValueType is required to be a const lvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(*__tmp);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any const& __v) {
+ using _RawValueType = __remove_cvref_t<_ValueType>;
+ static_assert(is_constructible<_ValueType, _RawValueType const&>::value,
+ "ValueType is required to be a const lvalue reference "
+ "or a CopyConstructible type");
+ auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return static_cast<_ValueType>(*__tmp);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-_ValueType any_cast(any & __v)
-{
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType &>::value,
- "ValueType is required to be an lvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<_RawValueType>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(*__tmp);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any& __v) {
+ using _RawValueType = __remove_cvref_t<_ValueType>;
+ static_assert(is_constructible<_ValueType, _RawValueType&>::value,
+ "ValueType is required to be an lvalue reference "
+ "or a CopyConstructible type");
+ auto __tmp = std::any_cast<_RawValueType>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return static_cast<_ValueType>(*__tmp);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
-_ValueType any_cast(any && __v)
-{
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType>::value,
- "ValueType is required to be an rvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<_RawValueType>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(std::move(*__tmp));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any&& __v) {
+ using _RawValueType = __remove_cvref_t<_ValueType>;
+ static_assert(is_constructible<_ValueType, _RawValueType>::value,
+ "ValueType is required to be an rvalue reference "
+ "or a CopyConstructible type");
+ auto __tmp = std::any_cast<_RawValueType>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return static_cast<_ValueType>(std::move(*__tmp));
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-add_pointer_t<add_const_t<_ValueType>>
-any_cast(any const * __any) _NOEXCEPT
-{
- static_assert(!is_reference<_ValueType>::value,
- "_ValueType may not be a reference.");
- return std::any_cast<_ValueType>(const_cast<any *>(__any));
+inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT {
+ static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
+ return std::any_cast<_ValueType>(const_cast<any*>(__any));
}
template <class _RetType>
-inline _LIBCPP_HIDE_FROM_ABI
-_RetType __pointer_or_func_cast(void* __p, /*IsFunction*/false_type) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void* __p, /*IsFunction*/ false_type) noexcept {
return static_cast<_RetType>(__p);
}
template <class _RetType>
-inline _LIBCPP_HIDE_FROM_ABI
-_RetType __pointer_or_func_cast(void*, /*IsFunction*/true_type) noexcept {
+inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction*/ true_type) noexcept {
return nullptr;
}
template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI
-add_pointer_t<_ValueType>
-any_cast(any * __any) _NOEXCEPT
-{
- using __any_imp::_Action;
- static_assert(!is_reference<_ValueType>::value,
- "_ValueType may not be a reference.");
- typedef add_pointer_t<_ValueType> _ReturnType;
- if (__any && __any->__h_) {
- void *__p = __any->__call(_Action::_Get, nullptr,
-#if !defined(_LIBCPP_HAS_NO_RTTI)
- &typeid(_ValueType),
-#else
- nullptr,
-#endif
- __any_imp::__get_fallback_typeid<_ValueType>());
- return std::__pointer_or_func_cast<_ReturnType>(
- __p, is_function<_ValueType>{});
- }
- return nullptr;
+_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
+ using __any_imp::_Action;
+ static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
+ typedef add_pointer_t<_ValueType> _ReturnType;
+ if (__any && __any->__h_) {
+ void* __p = __any->__call(
+ _Action::_Get,
+ nullptr,
+# if !defined(_LIBCPP_HAS_NO_RTTI)
+ &typeid(_ValueType),
+# else
+ nullptr,
+# endif
+ __any_imp::__get_fallback_typeid<_ValueType>());
+ return std::__pointer_or_func_cast<_ReturnType>(__p, is_function<_ValueType>{});
+ }
+ return nullptr;
}
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/array b/contrib/llvm-project/libcxx/include/array
index d00bf278e635..dcb419f536dc 100644
--- a/contrib/llvm-project/libcxx/include/array
+++ b/contrib/llvm-project/libcxx/include/array
@@ -162,276 +162,251 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS array
-{
- // types:
- using __self = array;
- using value_type = _Tp;
- using reference = value_type&;
- using const_reference = const value_type&;
- using iterator = value_type*;
- using const_iterator = const value_type*;
- using pointer = value_type*;
- using const_pointer = const value_type*;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using reverse_iterator = std::reverse_iterator<iterator>;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
- _Tp __elems_[_Size];
-
- // No explicit construct/copy/destroy for aggregate type
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void fill(const value_type& __u) {
- std::fill_n(data(), _Size, __u);
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
- std::swap_ranges(data(), data() + _Size, __a.data());
- }
-
- // iterators:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator begin() _NOEXCEPT {return iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator begin() const _NOEXCEPT {return const_iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator end() _NOEXCEPT {return iterator(data() + _Size);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator end() const _NOEXCEPT {return const_iterator(data() + _Size);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- // capacity:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](size_type __n) _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
- return __elems_[__n];
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference operator[](size_type __n) const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
- return __elems_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n)
- {
- if (__n >= _Size)
- __throw_out_of_range("array::at");
- return __elems_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const
- {
- if (__n >= _Size)
- __throw_out_of_range("array::at");
- return __elems_[__n];
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {return (*this)[0];}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {return (*this)[0];}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {return (*this)[_Size - 1];}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {return (*this)[_Size - 1];}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- value_type* data() _NOEXCEPT {return __elems_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const value_type* data() const _NOEXCEPT {return __elems_;}
+struct _LIBCPP_TEMPLATE_VIS array {
+ // types:
+ using __self = array;
+ using value_type = _Tp;
+ using reference = value_type&;
+ using const_reference = const value_type&;
+ using iterator = value_type*;
+ using const_iterator = const value_type*;
+ using pointer = value_type*;
+ using const_pointer = const value_type*;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ using reverse_iterator = std::reverse_iterator<iterator>;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
+ _Tp __elems_[_Size];
+
+ // No explicit construct/copy/destroy for aggregate type
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void fill(const value_type& __u) {
+ std::fill_n(data(), _Size, __u);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array& __a)
+ _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
+ std::swap_ranges(data(), data() + _Size, __a.data());
+ }
+
+ // iterators:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT { return iterator(data()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
+ return const_iterator(data());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT { return iterator(data() + _Size); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
+ return const_iterator(data() + _Size);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ // capacity:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return _Size; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return _Size; }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {
+ return _Size == 0;
+ }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
+ return __elems_[__n];
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < _Size, "out-of-bounds access in std::array<T, N>");
+ return __elems_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) {
+ if (__n >= _Size)
+ __throw_out_of_range("array::at");
+ return __elems_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const {
+ if (__n >= _Size)
+ __throw_out_of_range("array::at");
+ return __elems_[__n];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT { return (*this)[0]; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT { return (*this)[0]; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT { return (*this)[_Size - 1]; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
+ return (*this)[_Size - 1];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT { return __elems_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT { return __elems_; }
};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
-{
- // types:
- typedef array __self;
- typedef _Tp value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- typedef __conditional_t<is_const<_Tp>::value, const __empty, __empty> _EmptyType;
-
- struct _ArrayInStructT { _Tp __data_[1]; };
- _ALIGNAS_TYPE(_ArrayInStructT) _EmptyType __elems_[sizeof(_ArrayInStructT)];
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- value_type* data() _NOEXCEPT {return nullptr;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const value_type* data() const _NOEXCEPT {return nullptr;}
-
- // No explicit construct/copy/destroy for aggregate type
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void fill(const value_type&) {
- static_assert(!is_const<_Tp>::value,
- "cannot fill zero-sized array of type 'const T'");
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(array&) _NOEXCEPT {
- static_assert(!is_const<_Tp>::value,
- "cannot swap zero-sized array of type 'const T'");
- }
-
- // iterators:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator begin() _NOEXCEPT {return iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator begin() const _NOEXCEPT {return const_iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- iterator end() _NOEXCEPT {return iterator(data());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator end() const _NOEXCEPT {return const_iterator(data());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- // capacity:
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return 0; }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return 0;}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return true;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference operator[](size_type) _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference operator[](size_type) const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference at(size_type) {
- __throw_out_of_range("array<T, 0>::at");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference at(size_type) const {
- __throw_out_of_range("array<T, 0>::at");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference front() _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference front() const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
- reference back() _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const_reference back() const _NOEXCEPT {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
- __libcpp_unreachable();
- }
+struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> {
+ // types:
+ typedef array __self;
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ typedef __conditional_t<is_const<_Tp>::value, const __empty, __empty> _EmptyType;
+
+ struct _ArrayInStructT {
+ _Tp __data_[1];
+ };
+ _ALIGNAS_TYPE(_ArrayInStructT) _EmptyType __elems_[sizeof(_ArrayInStructT)];
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 value_type* data() _NOEXCEPT { return nullptr; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const value_type* data() const _NOEXCEPT { return nullptr; }
+
+ // No explicit construct/copy/destroy for aggregate type
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void fill(const value_type&) {
+ static_assert(!is_const<_Tp>::value, "cannot fill zero-sized array of type 'const T'");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array&) _NOEXCEPT {
+ static_assert(!is_const<_Tp>::value, "cannot swap zero-sized array of type 'const T'");
+ }
+
+ // iterators:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator begin() _NOEXCEPT { return iterator(data()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator begin() const _NOEXCEPT {
+ return const_iterator(data());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 iterator end() _NOEXCEPT { return iterator(data()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator end() const _NOEXCEPT {
+ return const_iterator(data());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ // capacity:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return 0; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return 0; }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return true; }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type) const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type) {
+ __throw_out_of_range("array<T, 0>::at");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type) const {
+ __throw_out_of_range("array<T, 0>::at");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::front() on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
+ __libcpp_unreachable();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "cannot call array<T, 0>::back() on a zero-sized array");
+ __libcpp_unreachable();
+ }
};
-
#if _LIBCPP_STD_VER >= 17
-template<class _Tp, class... _Args,
- class = enable_if_t<__all<_IsSame<_Tp, _Args>::value...>::value>
- >
-array(_Tp, _Args...)
- -> array<_Tp, 1 + sizeof...(_Args)>;
+template <class _Tp, class... _Args, class = enable_if_t<__all<_IsSame<_Tp, _Args>::value...>::value> >
+array(_Tp, _Args...) -> array<_Tp, 1 + sizeof...(_Args)>;
#endif
template <class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
-{
- return std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
+ return std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return !(__x == __y);
+ return !(__x == __y);
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return __y < __x;
+ return __y < __x;
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return !(__y < __x);
+ return !(__y < __x);
}
template <class _Tp, size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return !(__x < __y);
+ return !(__x < __y);
}
#else // _LIBCPP_STD_VER <= 17
@@ -439,66 +414,49 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const array<_Tp, _Size>& __x, const
template <class _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
operator<=>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, size_t _Size, __enable_if_t<_Size == 0 || __is_swappable<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y)
- _NOEXCEPT_(noexcept(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y)
+ _NOEXCEPT_(noexcept(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >
- : public integral_constant<size_t, _Size> {};
+struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
- typedef _Tp type;
+struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> > {
+ static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
+ typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&
-get(array<_Tp, _Size>& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
- return __a.__elems_[_Ip];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
+ return __a.__elems_[_Ip];
}
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&
-get(const array<_Tp, _Size>& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
- return __a.__elems_[_Ip];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
+ return __a.__elems_[_Ip];
}
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp&&
-get(array<_Tp, _Size>&& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
- return std::move(__a.__elems_[_Ip]);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
+ return std::move(__a.__elems_[_Ip]);
}
template <size_t _Ip, class _Tp, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Tp&&
-get(const array<_Tp, _Size>&& __a) _NOEXCEPT
-{
- static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
- return std::move(__a.__elems_[_Ip]);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&& __a) _NOEXCEPT {
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
+ return std::move(__a.__elems_[_Ip]);
}
#if _LIBCPP_STD_VER >= 20
@@ -511,33 +469,24 @@ __to_array_lvalue_impl(_Tp (&__arr)[_Size], index_sequence<_Index...>) {
template <typename _Tp, size_t _Size, size_t... _Index>
_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
-__to_array_rvalue_impl(_Tp(&&__arr)[_Size], index_sequence<_Index...>) {
+__to_array_rvalue_impl(_Tp (&&__arr)[_Size], index_sequence<_Index...>) {
return {{std::move(__arr[_Index])...}};
}
template <typename _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
to_array(_Tp (&__arr)[_Size]) noexcept(is_nothrow_constructible_v<_Tp, _Tp&>) {
- static_assert(
- !is_array_v<_Tp>,
- "[array.creation]/1: to_array does not accept multidimensional arrays.");
- static_assert(
- is_constructible_v<_Tp, _Tp&>,
- "[array.creation]/1: to_array requires copy constructible elements.");
+ static_assert(!is_array_v<_Tp>, "[array.creation]/1: to_array does not accept multidimensional arrays.");
+ static_assert(is_constructible_v<_Tp, _Tp&>, "[array.creation]/1: to_array requires copy constructible elements.");
return std::__to_array_lvalue_impl(__arr, make_index_sequence<_Size>());
}
template <typename _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI constexpr array<remove_cv_t<_Tp>, _Size>
-to_array(_Tp(&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) {
- static_assert(
- !is_array_v<_Tp>,
- "[array.creation]/4: to_array does not accept multidimensional arrays.");
- static_assert(
- is_move_constructible_v<_Tp>,
- "[array.creation]/4: to_array requires move constructible elements.");
- return std::__to_array_rvalue_impl(std::move(__arr),
- make_index_sequence<_Size>());
+to_array(_Tp (&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) {
+ static_assert(!is_array_v<_Tp>, "[array.creation]/4: to_array does not accept multidimensional arrays.");
+ static_assert(is_move_constructible_v<_Tp>, "[array.creation]/4: to_array requires move constructible elements.");
+ return std::__to_array_rvalue_impl(std::move(__arr), make_index_sequence<_Size>());
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/barrier b/contrib/llvm-project/libcxx/include/barrier
index dff650b75d1f..fcfc96cb0484 100644
--- a/contrib/llvm-project/libcxx/include/barrier
+++ b/contrib/llvm-project/libcxx/include/barrier
@@ -64,7 +64,7 @@ namespace std
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<barrier> is not supported since libc++ has been configured without support for threads."
+# error "<barrier> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_PUSH_MACROS
@@ -74,15 +74,11 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-struct __empty_completion
-{
- inline _LIBCPP_HIDE_FROM_ABI
- void operator()() noexcept
- {
- }
+struct __empty_completion {
+ inline _LIBCPP_HIDE_FROM_ABI void operator()() noexcept {}
};
-#ifndef _LIBCPP_HAS_NO_TREE_BARRIER
+# ifndef _LIBCPP_HAS_NO_TREE_BARRIER
/*
@@ -102,73 +98,61 @@ using __barrier_phase_t = uint8_t;
class __barrier_algorithm_base;
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI
-__barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
+__construct_barrier_algorithm_base(ptrdiff_t& __expected);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI
-bool __arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier,
- __barrier_phase_t __old_phase);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool
+__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI
-void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
-template<class _CompletionF>
+template <class _CompletionF>
class __barrier_base {
- ptrdiff_t __expected_;
- unique_ptr<__barrier_algorithm_base,
- void (*)(__barrier_algorithm_base*)> __base_;
- __atomic_base<ptrdiff_t> __expected_adjustment_;
- _CompletionF __completion_;
- __atomic_base<__barrier_phase_t> __phase_;
+ ptrdiff_t __expected_;
+ unique_ptr<__barrier_algorithm_base, void (*)(__barrier_algorithm_base*)> __base_;
+ __atomic_base<ptrdiff_t> __expected_adjustment_;
+ _CompletionF __completion_;
+ __atomic_base<__barrier_phase_t> __phase_;
public:
- using arrival_token = __barrier_phase_t;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
- return numeric_limits<ptrdiff_t>::max();
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
- : __expected_(__expected), __base_(std::__construct_barrier_algorithm_base(this->__expected_),
- &__destroy_barrier_algorithm_base),
- __expected_adjustment_(0), __completion_(std::move(__completion)), __phase_(0)
- {
- }
- [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t __update)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update <= __expected_, "update is greater than the expected count for the current barrier phase");
-
- auto const __old_phase = __phase_.load(memory_order_relaxed);
- for(; __update; --__update)
- if(__arrive_barrier_algorithm_base(__base_.get(), __old_phase)) {
- __completion_();
- __expected_ += __expected_adjustment_.load(memory_order_relaxed);
- __expected_adjustment_.store(0, memory_order_relaxed);
- __phase_.store(__old_phase + 2, memory_order_release);
- __phase_.notify_all();
- }
- return __old_phase;
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __old_phase) const
- {
- auto const __test_fn = [this, __old_phase]() -> bool {
- return __phase_.load(memory_order_acquire) != __old_phase;
- };
- std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __expected_adjustment_.fetch_sub(1, memory_order_relaxed);
- (void)arrive(1);
- }
+ using arrival_token = __barrier_phase_t;
+
+ static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
+ __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
+ : __expected_(__expected),
+ __base_(std::__construct_barrier_algorithm_base(this->__expected_), &__destroy_barrier_algorithm_base),
+ __expected_adjustment_(0),
+ __completion_(std::move(__completion)),
+ __phase_(0) {}
+ [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __update <= __expected_, "update is greater than the expected count for the current barrier phase");
+
+ auto const __old_phase = __phase_.load(memory_order_relaxed);
+ for (; __update; --__update)
+ if (__arrive_barrier_algorithm_base(__base_.get(), __old_phase)) {
+ __completion_();
+ __expected_ += __expected_adjustment_.load(memory_order_relaxed);
+ __expected_adjustment_.store(0, memory_order_relaxed);
+ __phase_.store(__old_phase + 2, memory_order_release);
+ __phase_.notify_all();
+ }
+ return __old_phase;
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
+ auto const __test_fn = [this, __old_phase]() -> bool { return __phase_.load(memory_order_acquire) != __old_phase; };
+ std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
+ __expected_adjustment_.fetch_sub(1, memory_order_relaxed);
+ (void)arrive(1);
+ }
};
-#else
+# else
/*
@@ -183,167 +167,127 @@ Two versions of this algorithm are provided:
*/
-template<class _CompletionF>
+template <class _CompletionF>
class __barrier_base {
+ __atomic_base<ptrdiff_t> __expected;
+ __atomic_base<ptrdiff_t> __arrived;
+ _CompletionF __completion;
+ __atomic_base<bool> __phase;
- __atomic_base<ptrdiff_t> __expected;
- __atomic_base<ptrdiff_t> __arrived;
- _CompletionF __completion;
- __atomic_base<bool> __phase;
public:
- using arrival_token = bool;
+ using arrival_token = bool;
- static constexpr ptrdiff_t max() noexcept {
- return numeric_limits<ptrdiff_t>::max();
- }
+ static constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
- _LIBCPP_HIDE_FROM_ABI
- __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
- : __expected(__expected), __arrived(__expected), __completion(std::move(__completion)), __phase(false)
- {
- }
- [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t update)
- {
- auto const __old_phase = __phase.load(memory_order_relaxed);
- auto const __result = __arrived.fetch_sub(update, memory_order_acq_rel) - update;
- auto const new_expected = __expected.load(memory_order_relaxed);
-
- _LIBCPP_ASSERT_UNCATEGORIZED(
- update <= new_expected, "update is greater than the expected count for the current barrier phase");
-
- if (0 == __result) {
- __completion();
- __arrived.store(new_expected, memory_order_relaxed);
- __phase.store(!__old_phase, memory_order_release);
- __phase.notify_all();
- }
- return __old_phase;
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __old_phase) const
- {
- __phase.wait(__old_phase, memory_order_acquire);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __expected.fetch_sub(1, memory_order_relaxed);
- (void)arrive(1);
+ _LIBCPP_HIDE_FROM_ABI __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
+ : __expected(__expected), __arrived(__expected), __completion(std::move(__completion)), __phase(false) {}
+ [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t update) {
+ auto const __old_phase = __phase.load(memory_order_relaxed);
+ auto const __result = __arrived.fetch_sub(update, memory_order_acq_rel) - update;
+ auto const new_expected = __expected.load(memory_order_relaxed);
+
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ update <= new_expected, "update is greater than the expected count for the current barrier phase");
+
+ if (0 == __result) {
+ __completion();
+ __arrived.store(new_expected, memory_order_relaxed);
+ __phase.store(!__old_phase, memory_order_release);
+ __phase.notify_all();
}
+ return __old_phase;
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
+ __phase.wait(__old_phase, memory_order_acquire);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
+ __expected.fetch_sub(1, memory_order_relaxed);
+ (void)arrive(1);
+ }
};
-template<>
+template <>
class __barrier_base<__empty_completion> {
+ static constexpr uint64_t __expected_unit = 1ull;
+ static constexpr uint64_t __arrived_unit = 1ull << 32;
+ static constexpr uint64_t __expected_mask = __arrived_unit - 1;
+ static constexpr uint64_t __phase_bit = 1ull << 63;
+ static constexpr uint64_t __arrived_mask = (__phase_bit - 1) & ~__expected_mask;
- static constexpr uint64_t __expected_unit = 1ull;
- static constexpr uint64_t __arrived_unit = 1ull << 32;
- static constexpr uint64_t __expected_mask = __arrived_unit - 1;
- static constexpr uint64_t __phase_bit = 1ull << 63;
- static constexpr uint64_t __arrived_mask = (__phase_bit - 1) & ~__expected_mask;
+ __atomic_base<uint64_t> __phase_arrived_expected;
- __atomic_base<uint64_t> __phase_arrived_expected;
-
- static _LIBCPP_HIDE_FROM_ABI
- constexpr uint64_t __init(ptrdiff_t __count) _NOEXCEPT
- {
- return ((uint64_t(1u << 31) - __count) << 32)
- | (uint64_t(1u << 31) - __count);
- }
+ static _LIBCPP_HIDE_FROM_ABI constexpr uint64_t __init(ptrdiff_t __count) _NOEXCEPT {
+ return ((uint64_t(1u << 31) - __count) << 32) | (uint64_t(1u << 31) - __count);
+ }
public:
- using arrival_token = uint64_t;
+ using arrival_token = uint64_t;
- static constexpr ptrdiff_t max() noexcept {
- return ptrdiff_t(1u << 31) - 1;
- }
+ static constexpr ptrdiff_t max() noexcept { return ptrdiff_t(1u << 31) - 1; }
- _LIBCPP_HIDE_FROM_ABI
- explicit inline __barrier_base(ptrdiff_t __count, __empty_completion = __empty_completion())
- : __phase_arrived_expected(__init(__count))
- {
- }
- [[nodiscard]] inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t update)
- {
- auto const __inc = __arrived_unit * update;
- auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel);
-
- _LIBCPP_ASSERT_UNCATEGORIZED(
- update <= __old, "update is greater than the expected count for the current barrier phase");
-
- if ((__old ^ (__old + __inc)) & __phase_bit) {
- __phase_arrived_expected.fetch_add((__old & __expected_mask) << 32, memory_order_relaxed);
- __phase_arrived_expected.notify_all();
- }
- return __old & __phase_bit;
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __phase) const
- {
- auto const __test_fn = [=]() -> bool {
- uint64_t const __current = __phase_arrived_expected.load(memory_order_acquire);
- return ((__current & __phase_bit) != __phase);
- };
- __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __phase_arrived_expected.fetch_add(__expected_unit, memory_order_relaxed);
- (void)arrive(1);
+ _LIBCPP_HIDE_FROM_ABI explicit inline __barrier_base(ptrdiff_t __count, __empty_completion = __empty_completion())
+ : __phase_arrived_expected(__init(__count)) {}
+ [[nodiscard]] inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t update) {
+ auto const __inc = __arrived_unit * update;
+ auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel);
+
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ update <= __old, "update is greater than the expected count for the current barrier phase");
+
+ if ((__old ^ (__old + __inc)) & __phase_bit) {
+ __phase_arrived_expected.fetch_add((__old & __expected_mask) << 32, memory_order_relaxed);
+ __phase_arrived_expected.notify_all();
}
+ return __old & __phase_bit;
+ }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
+ auto const __test_fn = [=]() -> bool {
+ uint64_t const __current = __phase_arrived_expected.load(memory_order_acquire);
+ return ((__current & __phase_bit) != __phase);
+ };
+ __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
+ }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
+ __phase_arrived_expected.fetch_add(__expected_unit, memory_order_relaxed);
+ (void)arrive(1);
+ }
};
-#endif // !_LIBCPP_HAS_NO_TREE_BARRIER
+# endif // !_LIBCPP_HAS_NO_TREE_BARRIER
-template<class _CompletionF = __empty_completion>
+template <class _CompletionF = __empty_completion>
class barrier {
+ __barrier_base<_CompletionF> __b_;
- __barrier_base<_CompletionF> __b_;
public:
- using arrival_token = typename __barrier_base<_CompletionF>::arrival_token;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
- return __barrier_base<_CompletionF>::max();
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
- : __b_(__count, std::move(__completion)) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count >= 0,
- "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count <= max(),
- "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with "
- "a value greater than max()");
- }
-
- barrier(barrier const&) = delete;
- barrier& operator=(barrier const&) = delete;
-
- [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- arrival_token arrive(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update > 0, "barrier:arrive must be called with a value greater than 0");
- return __b_.arrive(__update);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait(arrival_token&& __phase) const
- {
- __b_.wait(std::move(__phase));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_wait()
- {
- wait(arrive());
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_drop()
- {
- __b_.arrive_and_drop();
- }
+ using arrival_token = typename __barrier_base<_CompletionF>::arrival_token;
+
+ static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return __barrier_base<_CompletionF>::max(); }
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI explicit barrier(
+ ptrdiff_t __count, _CompletionF __completion = _CompletionF())
+ : __b_(__count, std::move(__completion)) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count >= 0,
+ "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count <= max(),
+ "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with "
+ "a value greater than max()");
+ }
+
+ barrier(barrier const&) = delete;
+ barrier& operator=(barrier const&) = delete;
+
+ [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update > 0, "barrier:arrive must be called with a value greater than 0");
+ return __b_.arrive(__update);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
+ __b_.wait(std::move(__phase));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait() { wait(arrive()); }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() { __b_.arrive_and_drop(); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/bitset b/contrib/llvm-project/libcxx/include/bitset
index d33015dc6b87..308c58995dc3 100644
--- a/contrib/llvm-project/libcxx/include/bitset
+++ b/contrib/llvm-project/libcxx/include/bitset
@@ -154,1012 +154,796 @@ template <size_t N> struct hash<std::bitset<N>>;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
class __bitset;
template <size_t _N_words, size_t _Size>
-struct __has_storage_type<__bitset<_N_words, _Size> >
-{
- static const bool value = true;
+struct __has_storage_type<__bitset<_N_words, _Size> > {
+ static const bool value = true;
};
template <size_t _N_words, size_t _Size>
-class __bitset
-{
+class __bitset {
public:
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef size_type __storage_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef size_type __storage_type;
+
protected:
- typedef __bitset __self;
- typedef __storage_type* __storage_pointer;
- typedef const __storage_type* __const_storage_pointer;
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- friend class __bit_reference<__bitset>;
- friend class __bit_const_reference<__bitset>;
- friend class __bit_iterator<__bitset, false>;
- friend class __bit_iterator<__bitset, true>;
- friend struct __bit_array<__bitset>;
-
- __storage_type __first_[_N_words];
-
- typedef __bit_reference<__bitset> reference;
- typedef __bit_const_reference<__bitset> const_reference;
- typedef __bit_iterator<__bitset, false> iterator;
- typedef __bit_iterator<__bitset, true> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT
- {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
- {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT
- {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT
- {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator&=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator|=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator^=(const __bitset& __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const
- {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const
- {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash_code() const _NOEXCEPT;
+ typedef __bitset __self;
+ typedef __storage_type* __storage_pointer;
+ typedef const __storage_type* __const_storage_pointer;
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ friend class __bit_reference<__bitset>;
+ friend class __bit_const_reference<__bitset>;
+ friend class __bit_iterator<__bitset, false>;
+ friend class __bit_iterator<__bitset, true>;
+ friend struct __bit_array<__bitset>;
+
+ __storage_type __first_[_N_words];
+
+ typedef __bit_reference<__bitset> reference;
+ typedef __bit_const_reference<__bitset> const_reference;
+ typedef __bit_iterator<__bitset, false> iterator;
+ typedef __bit_iterator<__bitset, true> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT {
+ return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {
+ return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT {
+ return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT {
+ return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset& __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {
+ return to_ulong(integral_constant < bool, _Size< sizeof(unsigned long) * CHAR_BIT>());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {
+ return to_ullong(integral_constant < bool, _Size< sizeof(unsigned long long) * CHAR_BIT>());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT;
+
private:
#ifdef _LIBCPP_CXX03_LANG
- void __init(unsigned long long __v, false_type) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void __init(unsigned long long __v, true_type) _NOEXCEPT;
+ void __init(unsigned long long __v, false_type) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong(false_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong(true_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(false_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(true_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(true_type, false_type) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong(true_type, true_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong(false_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong(true_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(false_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type, false_type) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type, true_type) const;
};
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
+inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_CXX03_LANG
: __first_{0}
#endif
{
#ifdef _LIBCPP_CXX03_LANG
- std::fill_n(__first_, _N_words, __storage_type(0));
+ std::fill_n(__first_, _N_words, __storage_type(0));
#endif
}
#ifdef _LIBCPP_CXX03_LANG
template <size_t _N_words, size_t _Size>
-void
-__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
-{
- __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
- size_t __sz = _Size;
- for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word )
- if ( __sz < __bits_per_word)
- __t[__i] = static_cast<__storage_type>(__v) & ( 1ULL << __sz ) - 1;
- else
- __t[__i] = static_cast<__storage_type>(__v);
-
- std::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
- std::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
- __storage_type(0));
+void __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT {
+ __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
+ size_t __sz = _Size;
+ for (size_t __i = 0; __i < sizeof(__t) / sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word)
+ if (__sz < __bits_per_word)
+ __t[__i] = static_cast<__storage_type>(__v) & (1ULL << __sz) - 1;
+ else
+ __t[__i] = static_cast<__storage_type>(__v);
+
+ std::copy(__t, __t + sizeof(__t) / sizeof(__t[0]), __first_);
+ std::fill(
+ __first_ + sizeof(__t) / sizeof(__t[0]), __first_ + sizeof(__first_) / sizeof(__first_[0]), __storage_type(0));
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
-{
- __first_[0] = __v;
- if (_Size < __bits_per_word)
- __first_[0] &= ( 1ULL << _Size ) - 1;
+inline _LIBCPP_HIDE_FROM_ABI void __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT {
+ __first_[0] = __v;
+ if (_Size < __bits_per_word)
+ __first_[0] &= (1ULL << _Size) - 1;
- std::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
+ std::fill(__first_ + 1, __first_ + sizeof(__first_) / sizeof(__first_[0]), __storage_type(0));
}
#endif // _LIBCPP_CXX03_LANG
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
+inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_CXX03_LANG
-#if __SIZEOF_SIZE_T__ == 8
+# if __SIZEOF_SIZE_T__ == 8
: __first_{__v}
-#elif __SIZEOF_SIZE_T__ == 4
+# elif __SIZEOF_SIZE_T__ == 4
: __first_{static_cast<__storage_type>(__v),
- _Size >= 2 * __bits_per_word ? static_cast<__storage_type>(__v >> __bits_per_word)
- : static_cast<__storage_type>((__v >> __bits_per_word) & (__storage_type(1) << (_Size - __bits_per_word)) - 1)}
-#else
-#error This constructor has not been ported to this platform
-#endif
+ _Size >= 2 * __bits_per_word
+ ? static_cast<__storage_type>(__v >> __bits_per_word)
+ : static_cast<__storage_type>((__v >> __bits_per_word) &
+ (__storage_type(1) << (_Size - __bits_per_word)) - 1)}
+# else
+# error This constructor has not been ported to this platform
+# endif
#endif
{
#ifdef _LIBCPP_CXX03_LANG
- __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
+ __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
#endif
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
-{
- for (size_type __i = 0; __i < _N_words; ++__i)
- __first_[__i] &= __v.__first_[__i];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT {
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __first_[__i] &= __v.__first_[__i];
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
-{
- for (size_type __i = 0; __i < _N_words; ++__i)
- __first_[__i] |= __v.__first_[__i];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT {
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __first_[__i] |= __v.__first_[__i];
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
-{
- for (size_type __i = 0; __i < _N_words; ++__i)
- __first_[__i] ^= __v.__first_[__i];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT {
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __first_[__i] ^= __v.__first_[__i];
}
template <size_t _N_words, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<_N_words, _Size>::flip() _NOEXCEPT
-{
- // do middle whole words
- size_type __n = _Size;
- __storage_pointer __p = __first_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- *__p = ~*__p;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __storage_type __b = *__p & __m;
- *__p &= ~__m;
- *__p |= ~__b & __m;
- }
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<_N_words, _Size>::flip() _NOEXCEPT {
+ // do middle whole words
+ size_type __n = _Size;
+ __storage_pointer __p = __first_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ *__p = ~*__p;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ __storage_type __b = *__p & __m;
+ *__p &= ~__m;
+ *__p |= ~__b & __m;
+ }
}
template <size_t _N_words, size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
-__bitset<_N_words, _Size>::to_ulong(false_type) const
-{
- const_iterator __e = __make_iter(_Size);
- const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
- if (__i != __e)
- __throw_overflow_error("bitset to_ulong overflow error");
+__bitset<_N_words, _Size>::to_ulong(false_type) const {
+ const_iterator __e = __make_iter(_Size);
+ const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
+ if (__i != __e)
+ __throw_overflow_error("bitset to_ulong overflow error");
- return __first_[0];
+ return __first_[0];
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
-__bitset<_N_words, _Size>::to_ulong(true_type) const
-{
- return __first_[0];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
+__bitset<_N_words, _Size>::to_ulong(true_type) const {
+ return __first_[0];
}
template <size_t _N_words, size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(false_type) const
-{
- const_iterator __e = __make_iter(_Size);
- const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
- if (__i != __e)
- __throw_overflow_error("bitset to_ullong overflow error");
+__bitset<_N_words, _Size>::to_ullong(false_type) const {
+ const_iterator __e = __make_iter(_Size);
+ const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
+ if (__i != __e)
+ __throw_overflow_error("bitset to_ullong overflow error");
- return to_ullong(true_type());
+ return to_ullong(true_type());
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(true_type) const
-{
- return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
+__bitset<_N_words, _Size>::to_ullong(true_type) const {
+ return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>());
}
template <size_t _N_words, size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
-{
- return __first_[0];
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
+__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const {
+ return __first_[0];
}
template <size_t _N_words, size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
-{
- unsigned long long __r = __first_[0];
- for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
- __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
- return __r;
+__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const {
+ unsigned long long __r = __first_[0];
+ for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
+ __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
+ return __r;
}
template <size_t _N_words, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<_N_words, _Size>::all() const _NOEXCEPT
-{
- // do middle whole words
- size_type __n = _Size;
- __const_storage_pointer __p = __first_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- if (~*__p)
- return false;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- if (~*__p & __m)
- return false;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::all() const _NOEXCEPT {
+ // do middle whole words
+ size_type __n = _Size;
+ __const_storage_pointer __p = __first_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ if (~*__p)
+ return false;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ if (~*__p & __m)
+ return false;
+ }
+ return true;
}
template <size_t _N_words, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<_N_words, _Size>::any() const _NOEXCEPT
-{
- // do middle whole words
- size_type __n = _Size;
- __const_storage_pointer __p = __first_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- if (*__p)
- return true;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- if (*__p & __m)
- return true;
- }
- return false;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::any() const _NOEXCEPT {
+ // do middle whole words
+ size_type __n = _Size;
+ __const_storage_pointer __p = __first_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ if (*__p)
+ return true;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ if (*__p & __m)
+ return true;
+ }
+ return false;
}
template <size_t _N_words, size_t _Size>
-inline
-size_t
-__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
-{
- size_t __h = 0;
- for (size_type __i = 0; __i < _N_words; ++__i)
- __h ^= __first_[__i];
- return __h;
+inline size_t __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT {
+ size_t __h = 0;
+ for (size_type __i = 0; __i < _N_words; ++__i)
+ __h ^= __first_[__i];
+ return __h;
}
template <size_t _Size>
-class __bitset<1, _Size>
-{
+class __bitset<1, _Size> {
public:
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef size_type __storage_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef size_type __storage_type;
+
protected:
- typedef __bitset __self;
- typedef __storage_type* __storage_pointer;
- typedef const __storage_type* __const_storage_pointer;
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- friend class __bit_reference<__bitset>;
- friend class __bit_const_reference<__bitset>;
- friend class __bit_iterator<__bitset, false>;
- friend class __bit_iterator<__bitset, true>;
- friend struct __bit_array<__bitset>;
-
- __storage_type __first_;
-
- typedef __bit_reference<__bitset> reference;
- typedef __bit_const_reference<__bitset> const_reference;
- typedef __bit_iterator<__bitset, false> iterator;
- typedef __bit_iterator<__bitset, true> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT
- {return reference(&__first_, __storage_type(1) << __pos);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
- {return const_reference(&__first_, __storage_type(1) << __pos);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT
- {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT
- {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator&=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator|=(const __bitset& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void operator^=(const __bitset& __v) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- void flip() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong() const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong() const;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool all() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool any() const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash_code() const _NOEXCEPT;
+ typedef __bitset __self;
+ typedef __storage_type* __storage_pointer;
+ typedef const __storage_type* __const_storage_pointer;
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ friend class __bit_reference<__bitset>;
+ friend class __bit_const_reference<__bitset>;
+ friend class __bit_iterator<__bitset, false>;
+ friend class __bit_iterator<__bitset, true>;
+ friend struct __bit_array<__bitset>;
+
+ __storage_type __first_;
+
+ typedef __bit_reference<__bitset> reference;
+ typedef __bit_const_reference<__bitset> const_reference;
+ typedef __bit_iterator<__bitset, false> iterator;
+ typedef __bit_iterator<__bitset, true> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT {
+ return reference(&__first_, __storage_type(1) << __pos);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {
+ return const_reference(&__first_, __storage_type(1) << __pos);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT {
+ return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT {
+ return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset& __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT;
};
template <size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<1, _Size>::__bitset() _NOEXCEPT
- : __first_(0)
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) {}
template <size_t _Size>
-inline
-_LIBCPP_CONSTEXPR
-__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
- : __first_(
- _Size == __bits_per_word ? static_cast<__storage_type>(__v)
- : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)
- )
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
+ : __first_(_Size == __bits_per_word ? static_cast<__storage_type>(__v)
+ : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)) {}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
-{
- __first_ &= __v.__first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT {
+ __first_ &= __v.__first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
-{
- __first_ |= __v.__first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT {
+ __first_ |= __v.__first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
-{
- __first_ ^= __v.__first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT {
+ __first_ ^= __v.__first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
-__bitset<1, _Size>::flip() _NOEXCEPT
-{
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
- __first_ = ~__first_;
- __first_ &= __m;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<1, _Size>::flip() _NOEXCEPT {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+ __first_ = ~__first_;
+ __first_ &= __m;
}
template <size_t _Size>
-inline
-_LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
-__bitset<1, _Size>::to_ulong() const
-{
- return __first_;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long __bitset<1, _Size>::to_ulong() const {
+ return __first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
-__bitset<1, _Size>::to_ullong() const
-{
- return __first_;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long __bitset<1, _Size>::to_ullong() const {
+ return __first_;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<1, _Size>::all() const _NOEXCEPT
-{
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
- return !(~__first_ & __m);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<1, _Size>::all() const _NOEXCEPT {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+ return !(~__first_ & __m);
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-__bitset<1, _Size>::any() const _NOEXCEPT
-{
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
- return __first_ & __m;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<1, _Size>::any() const _NOEXCEPT {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
+ return __first_ & __m;
}
template <size_t _Size>
-inline
-size_t
-__bitset<1, _Size>::__hash_code() const _NOEXCEPT
-{
- return __first_;
+inline size_t __bitset<1, _Size>::__hash_code() const _NOEXCEPT {
+ return __first_;
}
template <>
-class __bitset<0, 0>
-{
+class __bitset<0, 0> {
public:
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef size_type __storage_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef size_type __storage_type;
+
protected:
- typedef __bitset __self;
- typedef __storage_type* __storage_pointer;
- typedef const __storage_type* __const_storage_pointer;
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- friend class __bit_reference<__bitset>;
- friend class __bit_const_reference<__bitset>;
- friend class __bit_iterator<__bitset, false>;
- friend class __bit_iterator<__bitset, true>;
- friend struct __bit_array<__bitset>;
-
- typedef __bit_reference<__bitset> reference;
- typedef __bit_const_reference<__bitset> const_reference;
- typedef __bit_iterator<__bitset, false> iterator;
- typedef __bit_iterator<__bitset, true> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT
- {return reference(nullptr, 1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
- {return const_reference(nullptr, 1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT
- {return iterator(nullptr, 0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT
- {return const_iterator(nullptr, 0);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {return 0;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {return 0;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT {return true;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT {return false;}
-
- _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT {return 0;}
+ typedef __bitset __self;
+ typedef __storage_type* __storage_pointer;
+ typedef const __storage_type* __const_storage_pointer;
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ friend class __bit_reference<__bitset>;
+ friend class __bit_const_reference<__bitset>;
+ friend class __bit_iterator<__bitset, false>;
+ friend class __bit_iterator<__bitset, true>;
+ friend struct __bit_array<__bitset>;
+
+ typedef __bit_reference<__bitset> reference;
+ typedef __bit_const_reference<__bitset> const_reference;
+ typedef __bit_iterator<__bitset, false> iterator;
+ typedef __bit_iterator<__bitset, true> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT {
+ return reference(nullptr, 1);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT {
+ return const_reference(nullptr, 1);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT {
+ return iterator(nullptr, 0);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT {
+ return const_iterator(nullptr, 0);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const { return 0; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const { return 0; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT { return true; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT { return false; }
+
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return 0; }
};
-inline
-_LIBCPP_CONSTEXPR
-__bitset<0, 0>::__bitset() _NOEXCEPT
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset() _NOEXCEPT {}
-inline
-_LIBCPP_CONSTEXPR
-__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
-{
-}
+inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT {}
-template <size_t _Size> class _LIBCPP_TEMPLATE_VIS bitset;
-template <size_t _Size> struct hash<bitset<_Size> >;
+template <size_t _Size>
+class _LIBCPP_TEMPLATE_VIS bitset;
+template <size_t _Size>
+struct hash<bitset<_Size> >;
template <size_t _Size>
class _LIBCPP_TEMPLATE_VIS bitset
- : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
-{
+ : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> {
public:
- static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
- typedef __bitset<__n_words, _Size> base;
+ static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
+ typedef __bitset<__n_words, _Size> base;
public:
- typedef typename base::reference reference;
- typedef typename base::const_reference const_reference;
-
- // 23.3.5.1 constructors:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
- template <class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
- const _CharT* __str,
-# if _LIBCPP_STD_VER >= 26
- typename basic_string_view<_CharT>::size_type __n = basic_string_view<_CharT>::npos,
-# else
- typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
-# endif
- _CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) {
-
- size_t __rlen = std::min(__n, char_traits<_CharT>::length(__str));
- __init_from_string_view(basic_string_view<_CharT>(__str, __rlen), __zero, __one);
- }
+ typedef typename base::reference reference;
+ typedef typename base::const_reference const_reference;
+
+ // 23.3.5.1 constructors:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
+ template <class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
+ const _CharT* __str,
#if _LIBCPP_STD_VER >= 26
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit bitset(
- basic_string_view<_CharT, _Traits> __str,
- typename basic_string_view<_CharT, _Traits>::size_type __pos = 0,
- typename basic_string_view<_CharT, _Traits>::size_type __n = basic_string_view<_CharT, _Traits>::npos,
- _CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) {
- if (__pos > __str.size())
- __throw_out_of_range("bitset string pos out of range");
-
- size_t __rlen = std::min(__n, __str.size() - __pos);
- __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
- }
+ typename basic_string_view<_CharT>::size_type __n = basic_string_view<_CharT>::npos,
+#else
+ typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
#endif
- template <class _CharT, class _Traits, class _Allocator>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
- const basic_string<_CharT, _Traits, _Allocator>& __str,
- typename basic_string<_CharT, _Traits, _Allocator>::size_type __pos = 0,
- typename basic_string<_CharT, _Traits, _Allocator>::size_type __n =
- basic_string<_CharT, _Traits, _Allocator>::npos,
- _CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) {
- if (__pos > __str.size())
- std::__throw_out_of_range("bitset string pos out of range");
-
- size_t __rlen = std::min(__n, __str.size() - __pos);
- __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
- }
-
- // 23.3.5.2 bitset operations:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator<<=(size_t __pos) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& operator>>=(size_t __pos) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& set() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& set(size_t __pos, bool __val = true);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& reset() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& reset(size_t __pos);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset operator~() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& flip() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset& flip(size_t __pos);
+ _CharT __zero = _CharT('0'),
+ _CharT __one = _CharT('1')) {
- // element access:
+ size_t __rlen = std::min(__n, char_traits<_CharT>::length(__str));
+ __init_from_string_view(basic_string_view<_CharT>(__str, __rlen), __zero, __one);
+ }
+#if _LIBCPP_STD_VER >= 26
+ template <class _CharT, class _Traits>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit bitset(
+ basic_string_view<_CharT, _Traits> __str,
+ typename basic_string_view<_CharT, _Traits>::size_type __pos = 0,
+ typename basic_string_view<_CharT, _Traits>::size_type __n = basic_string_view<_CharT, _Traits>::npos,
+ _CharT __zero = _CharT('0'),
+ _CharT __one = _CharT('1')) {
+ if (__pos > __str.size())
+ __throw_out_of_range("bitset string pos out of range");
+
+ size_t __rlen = std::min(__n, __str.size() - __pos);
+ __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
+ }
+#endif
+ template <class _CharT, class _Traits, class _Allocator>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
+ const basic_string<_CharT, _Traits, _Allocator>& __str,
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __pos = 0,
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __n =
+ basic_string<_CharT, _Traits, _Allocator>::npos,
+ _CharT __zero = _CharT('0'),
+ _CharT __one = _CharT('1')) {
+ if (__pos > __str.size())
+ std::__throw_out_of_range("bitset string pos out of range");
+
+ size_t __rlen = std::min(__n, __str.size() - __pos);
+ __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
+ }
+
+ // 23.3.5.2 bitset operations:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator<<=(size_t __pos) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator>>=(size_t __pos) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& set() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& set(size_t __pos, bool __val = true);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset(size_t __pos);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator~() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip(size_t __pos);
+
+ // element access:
#ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const {return base::__make_ref(__p);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const { return base::__make_ref(__p); }
#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const { return base::__make_ref(__p); }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {return base::__make_ref(__p);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long to_ulong() const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- unsigned long long to_ullong() const;
- template <class _CharT, class _Traits, class _Allocator>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) const;
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) const;
- template <class _CharT>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
- _CharT __one = _CharT('1')) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
- char __one = '1') const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- size_t count() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool operator==(const bitset& __rhs) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) { return base::__make_ref(__p); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const;
+ template <class _CharT, class _Traits, class _Allocator>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator>
+ to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
+ template <class _CharT, class _Traits>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> >
+ to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
+ template <class _CharT>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
+ to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> >
+ to_string(char __zero = '0', char __one = '1') const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t count() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT { return _Size; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const bitset& __rhs) const _NOEXCEPT;
#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const bitset& __rhs) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const bitset& __rhs) const _NOEXCEPT;
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool test(size_t __pos) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool all() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool any() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT {return !any();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset operator<<(size_t __pos) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bitset operator>>(size_t __pos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool test(size_t __pos) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT { return !any(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator<<(size_t __pos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator>>(size_t __pos) const _NOEXCEPT;
private:
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
- __init_from_string_view(basic_string_view<_CharT, _Traits> __str, _CharT __zero, _CharT __one) {
-
- for (size_t __i = 0; __i < __str.size(); ++__i)
- if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
- std::__throw_invalid_argument("bitset string ctor has invalid argument");
-
- size_t __mp = std::min(__str.size(), _Size);
- size_t __i = 0;
- for (; __i < __mp; ++__i) {
- _CharT __c = __str[__mp - 1 - __i];
- (*this)[__i] = _Traits::eq(__c, __one);
- }
- std::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
+ template <class _CharT, class _Traits>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
+ __init_from_string_view(basic_string_view<_CharT, _Traits> __str, _CharT __zero, _CharT __one) {
+ for (size_t __i = 0; __i < __str.size(); ++__i)
+ if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
+ std::__throw_invalid_argument("bitset string ctor has invalid argument");
+
+ size_t __mp = std::min(__str.size(), _Size);
+ size_t __i = 0;
+ for (; __i < __mp; ++__i) {
+ _CharT __c = __str[__mp - 1 - __i];
+ (*this)[__i] = _Traits::eq(__c, __one);
}
+ std::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
+ _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return base::__hash_code(); }
- friend struct hash<bitset>;
+ friend struct hash<bitset>;
};
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
-{
- base::operator&=(__rhs);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
+bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT {
+ base::operator&=(__rhs);
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
-{
- base::operator|=(__rhs);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
+bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT {
+ base::operator|=(__rhs);
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
-{
- base::operator^=(__rhs);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
+bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT {
+ base::operator^=(__rhs);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
-{
- __pos = std::min(__pos, _Size);
- std::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
- std::fill_n(base::__make_iter(0), __pos, false);
- return *this;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT {
+ __pos = std::min(__pos, _Size);
+ std::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
+ std::fill_n(base::__make_iter(0), __pos, false);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
-{
- __pos = std::min(__pos, _Size);
- std::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
- std::fill_n(base::__make_iter(_Size - __pos), __pos, false);
- return *this;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT {
+ __pos = std::min(__pos, _Size);
+ std::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
+ std::fill_n(base::__make_iter(_Size - __pos), __pos, false);
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::set() _NOEXCEPT
-{
- std::fill_n(base::__make_iter(0), _Size, true);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set() _NOEXCEPT {
+ std::fill_n(base::__make_iter(0), _Size, true);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::set(size_t __pos, bool __val)
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset set argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset set argument out of range");
- (*this)[__pos] = __val;
- return *this;
+ (*this)[__pos] = __val;
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::reset() _NOEXCEPT
-{
- std::fill_n(base::__make_iter(0), _Size, false);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset() _NOEXCEPT {
+ std::fill_n(base::__make_iter(0), _Size, false);
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::reset(size_t __pos)
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset reset argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset(size_t __pos) {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset reset argument out of range");
- (*this)[__pos] = false;
- return *this;
+ (*this)[__pos] = false;
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-bitset<_Size>::operator~() const _NOEXCEPT
-{
- bitset __x(*this);
- __x.flip();
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> bitset<_Size>::operator~() const _NOEXCEPT {
+ bitset __x(*this);
+ __x.flip();
+ return __x;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::flip() _NOEXCEPT
-{
- base::flip();
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip() _NOEXCEPT {
+ base::flip();
+ return *this;
}
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>&
-bitset<_Size>::flip(size_t __pos)
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset flip argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip(size_t __pos) {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset flip argument out of range");
- reference __r = base::__make_ref(__pos);
- __r = ~__r;
- return *this;
+ reference __r = base::__make_ref(__pos);
+ __r = ~__r;
+ return *this;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-unsigned long
-bitset<_Size>::to_ulong() const
-{
- return base::to_ulong();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long bitset<_Size>::to_ulong() const {
+ return base::to_ulong();
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-unsigned long long
-bitset<_Size>::to_ullong() const
-{
- return base::to_ullong();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long bitset<_Size>::to_ullong() const {
+ return base::to_ullong();
}
template <size_t _Size>
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<_CharT, _Traits, _Allocator>
-bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
-{
- basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero);
- for (size_t __i = 0; __i != _Size; ++__i)
- {
- if ((*this)[__i])
- __r[_Size - 1 - __i] = __one;
- }
- return __r;
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator>
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const {
+ basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero);
+ for (size_t __i = 0; __i != _Size; ++__i) {
+ if ((*this)[__i])
+ __r[_Size - 1 - __i] = __one;
+ }
+ return __r;
}
template <size_t _Size>
template <class _CharT, class _Traits>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<_CharT, _Traits, allocator<_CharT> >
-bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
-{
- return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> >
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const {
+ return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one);
}
template <size_t _Size>
template <class _CharT>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
-bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
-{
- return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
+bitset<_Size>::to_string(_CharT __zero, _CharT __one) const {
+ return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one);
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-basic_string<char, char_traits<char>, allocator<char> >
-bitset<_Size>::to_string(char __zero, char __one) const
-{
- return to_string<char, char_traits<char>, allocator<char> >(__zero, __one);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> >
+bitset<_Size>::to_string(char __zero, char __one) const {
+ return to_string<char, char_traits<char>, allocator<char> >(__zero, __one);
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-size_t
-bitset<_Size>::count() const _NOEXCEPT
-{
- return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t bitset<_Size>::count() const _NOEXCEPT {
+ return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true));
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
-{
- return std::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
+bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT {
+ return std::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
}
#if _LIBCPP_STD_VER <= 17
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI
-bool
-bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
-{
- return !(*this == __rhs);
+inline _LIBCPP_HIDE_FROM_ABI bool bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT {
+ return !(*this == __rhs);
}
#endif
template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::test(size_t __pos) const
-{
- if (__pos >= _Size)
- __throw_out_of_range("bitset test argument out of range");
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::test(size_t __pos) const {
+ if (__pos >= _Size)
+ __throw_out_of_range("bitset test argument out of range");
- return (*this)[__pos];
+ return (*this)[__pos];
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::all() const _NOEXCEPT
-{
- return base::all();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::all() const _NOEXCEPT {
+ return base::all();
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bool
-bitset<_Size>::any() const _NOEXCEPT
-{
- return base::any();
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::any() const _NOEXCEPT {
+ return base::any();
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
-{
- bitset __r = *this;
- __r <<= __pos;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT {
+ bitset __r = *this;
+ __r <<= __pos;
+ return __r;
}
template <size_t _Size>
-inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
-{
- bitset __r = *this;
- __r >>= __pos;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT {
+ bitset __r = *this;
+ __r >>= __pos;
+ return __r;
}
template <size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
-{
- bitset<_Size> __r = __x;
- __r &= __y;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
+ bitset<_Size> __r = __x;
+ __r &= __y;
+ return __r;
}
template <size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
-{
- bitset<_Size> __r = __x;
- __r |= __y;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
+ bitset<_Size> __r = __x;
+ __r |= __y;
+ return __r;
}
template <size_t _Size>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
-bitset<_Size>
-operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
-{
- bitset<_Size> __r = __x;
- __r ^= __y;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>
+operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT {
+ bitset<_Size> __r = __x;
+ __r ^= __y;
+ return __r;
}
template <size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> >
- : public __unary_function<bitset<_Size>, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
- {return __bs.__hash_code();}
+struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> > : public __unary_function<bitset<_Size>, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT { return __bs.__hash_code(); }
};
template <class _CharT, class _Traits, size_t _Size>
diff --git a/contrib/llvm-project/libcxx/include/cctype b/contrib/llvm-project/libcxx/include/cctype
index 867e7d5b0b35..32be6f38e5f8 100644
--- a/contrib/llvm-project/libcxx/include/cctype
+++ b/contrib/llvm-project/libcxx/include/cctype
@@ -53,62 +53,61 @@ int toupper(int c);
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef isalnum
-#undef isalnum
+# undef isalnum
#endif
#ifdef isalpha
-#undef isalpha
+# undef isalpha
#endif
#ifdef isblank
-#undef isblank
+# undef isblank
#endif
#ifdef iscntrl
-#undef iscntrl
+# undef iscntrl
#endif
#ifdef isdigit
-#undef isdigit
+# undef isdigit
#endif
#ifdef isgraph
-#undef isgraph
+# undef isgraph
#endif
#ifdef islower
-#undef islower
+# undef islower
#endif
#ifdef isprint
-#undef isprint
+# undef isprint
#endif
#ifdef ispunct
-#undef ispunct
+# undef ispunct
#endif
#ifdef isspace
-#undef isspace
+# undef isspace
#endif
#ifdef isupper
-#undef isupper
+# undef isupper
#endif
#ifdef isxdigit
-#undef isxdigit
+# undef isxdigit
#endif
#ifdef tolower
-#undef tolower
+# undef tolower
#endif
#ifdef toupper
-#undef toupper
+# undef toupper
#endif
-
using ::isalnum _LIBCPP_USING_IF_EXISTS;
using ::isalpha _LIBCPP_USING_IF_EXISTS;
using ::isblank _LIBCPP_USING_IF_EXISTS;
diff --git a/contrib/llvm-project/libcxx/include/cmath b/contrib/llvm-project/libcxx/include/cmath
index e8a2acf078cd..798ddb4963b0 100644
--- a/contrib/llvm-project/libcxx/include/cmath
+++ b/contrib/llvm-project/libcxx/include/cmath
@@ -546,126 +546,109 @@ using ::tgammal _LIBCPP_USING_IF_EXISTS;
using ::truncl _LIBCPP_USING_IF_EXISTS;
#if _LIBCPP_STD_VER >= 17
-inline _LIBCPP_HIDE_FROM_ABI float hypot( float __x, float __y, float __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
-inline _LIBCPP_HIDE_FROM_ABI double hypot( double __x, double __y, double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
-inline _LIBCPP_HIDE_FROM_ABI long double hypot( long double __x, long double __y, long double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
+inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) {
+ return sqrt(__x * __x + __y * __y + __z * __z);
+}
+inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) {
+ return sqrt(__x * __x + __y * __y + __z * __z);
+}
+inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) {
+ return sqrt(__x * __x + __y * __y + __z * __z);
+}
template <class _A1, class _A2, class _A3>
inline _LIBCPP_HIDE_FROM_ABI
-typename enable_if_t
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value &&
- is_arithmetic<_A3>::value,
- __promote<_A1, _A2, _A3>
->::type
-hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2, _A3>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value &&
- is_same<_A3, __result_type>::value)), "");
- return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
+ typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
+ __promote<_A1, _A2, _A3> >::type
+ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT {
+ typedef typename __promote<_A1, _A2, _A3>::type __result_type;
+ static_assert((!(is_same<_A1, __result_type>::value && is_same<_A2, __result_type>::value &&
+ is_same<_A3, __result_type>::value)),
+ "");
+ return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
}
#endif
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isnan)
- return __builtin_isnan(__lcpp_x);
+ return __builtin_isnan(__lcpp_x);
#else
- return isnan(__lcpp_x);
+ return isnan(__lcpp_x);
#endif
}
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
-{
- return std::isnan(__lcpp_x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
+ return std::isnan(__lcpp_x);
}
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isinf)
- return __builtin_isinf(__lcpp_x);
+ return __builtin_isinf(__lcpp_x);
#else
- return isinf(__lcpp_x);
+ return isinf(__lcpp_x);
#endif
}
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
-{
- return std::isinf(__lcpp_x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
+ return std::isinf(__lcpp_x);
}
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isfinite)
- return __builtin_isfinite(__lcpp_x);
+ return __builtin_isfinite(__lcpp_x);
#else
- return isfinite(__lcpp_x);
+ return isfinite(__lcpp_x);
#endif
}
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool
-__constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT
-{
- return __builtin_isfinite(__lcpp_x);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
+ return __builtin_isfinite(__lcpp_x);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI float __constexpr_copysign(float __x, float __y) _NOEXCEPT {
- return __builtin_copysignf(__x, __y);
+ return __builtin_copysignf(__x, __y);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI double __constexpr_copysign(double __x, double __y) _NOEXCEPT {
- return __builtin_copysign(__x, __y);
+ return __builtin_copysign(__x, __y);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI long double
__constexpr_copysign(long double __x, long double __y) _NOEXCEPT {
- return __builtin_copysignl(__x, __y);
+ return __builtin_copysignl(__x, __y);
}
-template <class _A1, class _A2, __enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
-_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI
- typename __promote<_A1, _A2>::type
- __constexpr_copysign(_A1 __x, _A2 __y) _NOEXCEPT {
- typedef typename std::__promote<_A1, _A2>::type __result_type;
- static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), "");
- return __builtin_copysign((__result_type)__x, (__result_type)__y);
+template <class _A1,
+ class _A2,
+ __enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
+_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type
+__constexpr_copysign(_A1 __x, _A2 __y) _NOEXCEPT {
+ typedef typename std::__promote<_A1, _A2>::type __result_type;
+ static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), "");
+ return __builtin_copysign((__result_type)__x, (__result_type)__y);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float __constexpr_fabs(float __x) _NOEXCEPT {
- return __builtin_fabsf(__x);
+ return __builtin_fabsf(__x);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(double __x) _NOEXCEPT {
- return __builtin_fabs(__x);
+ return __builtin_fabs(__x);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double __constexpr_fabs(long double __x) _NOEXCEPT {
- return __builtin_fabsl(__x);
+ return __builtin_fabsl(__x);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(_Tp __x) _NOEXCEPT {
- return __builtin_fabs(static_cast<double>(__x));
+ return __builtin_fabs(static_cast<double>(__x));
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 float __constexpr_fmax(float __x, float __y) _NOEXCEPT {
@@ -730,7 +713,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __constexpr_logb(_Tp __x
if (std::__constexpr_isnan(__x))
return numeric_limits<_Tp>::quiet_NaN();
- __x = std::__constexpr_fabs(__x);
+ __x = std::__constexpr_fabs(__x);
unsigned long long __exp = 0;
while (__x >= numeric_limits<_Tp>::radix) {
__x /= numeric_limits<_Tp>::radix;
@@ -785,44 +768,40 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp __constexpr_scalbn(_Tp _
#if _LIBCPP_STD_VER >= 20
template <typename _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-_Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
- if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
- return __t * __b + (1 - __t) * __a;
-
- if (__t == 1) return __b;
- const _Fp __x = __a + __t * (__b - __a);
- if ((__t > 1) == (__b > __a))
- return __b < __x ? __x : __b;
- else
- return __x < __b ? __x : __b;
+_LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
+ if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
+ return __t * __b + (1 - __t) * __a;
+
+ if (__t == 1)
+ return __b;
+ const _Fp __x = __a + __t * (__b - __a);
+ if ((__t > 1) == (__b > __a))
+ return __b < __x ? __x : __b;
+ else
+ return __x < __b ? __x : __b;
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr float
-lerp(float __a, float __b, float __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr float lerp(float __a, float __b, float __t) _NOEXCEPT {
+ return __lerp(__a, __b, __t);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr double
-lerp(double __a, double __b, double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr double lerp(double __a, double __b, double __t) _NOEXCEPT {
+ return __lerp(__a, __b, __t);
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr long double
-lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
+_LIBCPP_HIDE_FROM_ABI inline constexpr long double lerp(long double __a, long double __b, long double __t) _NOEXCEPT {
+ return __lerp(__a, __b, __t);
+}
template <class _A1, class _A2, class _A3>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr typename enable_if_t
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value &&
- is_arithmetic<_A3>::value,
- __promote<_A1, _A2, _A3>
->::type
-lerp(_A1 __a, _A2 __b, _A3 __t) noexcept
-{
- typedef typename __promote<_A1, _A2, _A3>::type __result_type;
- static_assert(!(_IsSame<_A1, __result_type>::value &&
- _IsSame<_A2, __result_type>::value &&
- _IsSame<_A3, __result_type>::value));
- return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
+inline _LIBCPP_HIDE_FROM_ABI constexpr
+ typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
+ __promote<_A1, _A2, _A3> >::type
+ lerp(_A1 __a, _A2 __b, _A3 __t) noexcept {
+ typedef typename __promote<_A1, _A2, _A3>::type __result_type;
+ static_assert(!(
+ _IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value));
+ return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/codecvt b/contrib/llvm-project/libcxx/include/codecvt
index 35d2c27d8ab9..504dd71f3004 100644
--- a/contrib/llvm-project/libcxx/include/codecvt
+++ b/contrib/llvm-project/libcxx/include/codecvt
@@ -67,489 +67,511 @@ class codecvt_utf8_utf16
_LIBCPP_BEGIN_NAMESPACE_STD
-enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode
-{
- consume_header = 4,
- generate_header = 2,
- little_endian = 1
-};
+enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 };
// codecvt_utf8
-template <class _Elem> class __codecvt_utf8;
+template <class _Elem>
+class __codecvt_utf8;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<wchar_t>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char16_t>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char16_t> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char32_t>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8<char32_t> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Elem, unsigned long _Maxcode = 0x10ffff,
- codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8
- : public __codecvt_utf8<_Elem>
-{
+template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8 : public __codecvt_utf8<_Elem> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_utf8(size_t __refs = 0)
- : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf8(size_t __refs = 0) : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
- _LIBCPP_HIDE_FROM_ABI
- ~codecvt_utf8() {}
+ _LIBCPP_HIDE_FROM_ABI ~codecvt_utf8() {}
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
// codecvt_utf16
-template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
+template <class _Elem, bool _LittleEndian>
+class __codecvt_utf16;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, false>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, false> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
- size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, true>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<wchar_t, true> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, false>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, false> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, true>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char16_t, true> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, false>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, false> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, true>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf16<char32_t, true> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Elem, unsigned long _Maxcode = 0x10ffff,
- codecvt_mode _Mode = (codecvt_mode)0>
+template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf16
- : public __codecvt_utf16<_Elem, _Mode & little_endian>
-{
+ : public __codecvt_utf16<_Elem, _Mode & little_endian> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_utf16(size_t __refs = 0)
- : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf16(size_t __refs = 0)
+ : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
- _LIBCPP_HIDE_FROM_ABI
- ~codecvt_utf16() {}
+ _LIBCPP_HIDE_FROM_ABI ~codecvt_utf16() {}
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
// codecvt_utf8_utf16
-template <class _Elem> class __codecvt_utf8_utf16;
+template <class _Elem>
+class __codecvt_utf8_utf16;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<wchar_t>
- : public codecvt<wchar_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- codecvt_mode __mode_;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<wchar_t> : public codecvt<wchar_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ codecvt_mode __mode_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<wchar_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char32_t>
- : public codecvt<char32_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char32_t> : public codecvt<char32_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char32_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char32_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char32_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
-class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char16_t>
- : public codecvt<char16_t, char, mbstate_t>
-{
- unsigned long __maxcode_;
- codecvt_mode __mode_;
+class _LIBCPP_EXPORTED_FROM_ABI __codecvt_utf8_utf16<char16_t> : public codecvt<char16_t, char, mbstate_t> {
+ unsigned long __maxcode_;
+ codecvt_mode __mode_;
+
public:
- typedef char16_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode,
- codecvt_mode __mode)
- : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode),
- __mode_(__mode) {}
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ typedef char16_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __codecvt_utf8_utf16(size_t __refs, unsigned long __maxcode, codecvt_mode __mode)
+ : codecvt<char16_t, char, mbstate_t>(__refs), __maxcode_(__maxcode), __mode_(__mode) {}
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
protected:
- result do_out(state_type& __st,
- const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- result do_in(state_type& __st,
- const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
- intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override;
- result do_unshift(state_type& __st,
- extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
- int do_encoding() const _NOEXCEPT override;
- bool do_always_noconv() const _NOEXCEPT override;
- int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
- int do_max_length() const _NOEXCEPT override;
+ result do_out(state_type& __st,
+ const intern_type* __frm,
+ const intern_type* __frm_end,
+ const intern_type*& __frm_nxt,
+ extern_type* __to,
+ extern_type* __to_end,
+ extern_type*& __to_nxt) const override;
+ result do_in(state_type& __st,
+ const extern_type* __frm,
+ const extern_type* __frm_end,
+ const extern_type*& __frm_nxt,
+ intern_type* __to,
+ intern_type* __to_end,
+ intern_type*& __to_nxt) const override;
+ result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override;
+ int do_encoding() const _NOEXCEPT override;
+ bool do_always_noconv() const _NOEXCEPT override;
+ int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override;
+ int do_max_length() const _NOEXCEPT override;
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template <class _Elem, unsigned long _Maxcode = 0x10ffff,
- codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8_utf16
- : public __codecvt_utf8_utf16<_Elem>
-{
+template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8_utf16 : public __codecvt_utf8_utf16<_Elem> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit codecvt_utf8_utf16(size_t __refs = 0)
- : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
+ _LIBCPP_HIDE_FROM_ABI explicit codecvt_utf8_utf16(size_t __refs = 0)
+ : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
- _LIBCPP_HIDE_FROM_ABI
- ~codecvt_utf8_utf16() {}
+ _LIBCPP_HIDE_FROM_ABI ~codecvt_utf8_utf16() {}
};
_LIBCPP_SUPPRESS_DEPRECATED_POP
diff --git a/contrib/llvm-project/libcxx/include/complex b/contrib/llvm-project/libcxx/include/complex
index 44579b1ad528..02b9db8c516d 100644
--- a/contrib/llvm-project/libcxx/include/complex
+++ b/contrib/llvm-project/libcxx/include/complex
@@ -237,7 +237,7 @@ template<class T> complex<T> tanh (const complex<T>&);
#include <version>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <sstream> // for std::basic_ostringstream
+# include <sstream> // for std::basic_ostringstream
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -246,1295 +246,1138 @@ template<class T> complex<T> tanh (const complex<T>&);
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS complex;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS complex;
-template<class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
-template<class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS complex
-{
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS complex {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
+
private:
- value_type __re_;
- value_type __im_;
+ value_type __re_;
+ value_type __im_;
+
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- complex(const value_type& __re = value_type(), const value_type& __im = value_type())
- : __re_(__re), __im_(__im) {}
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- complex(const complex<_Xp>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const value_type& __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
+ complex(const value_type& __re = value_type(), const value_type& __im = value_type())
+ : __re_(__re), __im_(__im) {}
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 complex(const complex<_Xp>& __c)
+ : __re_(__c.real()), __im_(__c.imag()) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const value_type& __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const value_type& __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const value_type& __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const value_type& __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const value_type& __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-template<> class _LIBCPP_TEMPLATE_VIS complex<double>;
-template<> class _LIBCPP_TEMPLATE_VIS complex<long double>;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<double>;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<long double>;
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<float>
-{
- float __re_;
- float __im_;
-public:
- typedef float value_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<float> {
+ float __re_;
+ float __im_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (float __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(float __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(float __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+public:
+ typedef float value_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re), __im_(__im) {}
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(float __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(float __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(float __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(float __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(float __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<double>
-{
- double __re_;
- double __im_;
-public:
- typedef double value_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<double> {
+ double __re_;
+ double __im_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
- _LIBCPP_HIDE_FROM_ABI
- explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (double __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(double __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(double __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+public:
+ typedef double value_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) : __re_(__re), __im_(__im) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(double __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(double __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(double __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(double __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(double __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-template<>
-class _LIBCPP_TEMPLATE_VIS complex<long double>
-{
- long double __re_;
- long double __im_;
-public:
- typedef long double value_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS complex<long double> {
+ long double __re_;
+ long double __im_;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
- : __re_(__re), __im_(__im) {}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double real() const {return __re_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) {__re_ = __re;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) {__im_ = __im;}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (long double __re)
- {__re_ = __re; __im_ = value_type(); return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(long double __re) {__re_ += __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(long double __re) {__re_ -= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;}
-
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator= (const complex<_Xp>& __c)
- {
- __re_ = __c.real();
- __im_ = __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c)
- {
- __re_ += __c.real();
- __im_ += __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c)
- {
- __re_ -= __c.real();
- __im_ -= __c.imag();
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c)
- {
- *this = *this * complex(__c.real(), __c.imag());
- return *this;
- }
- template<class _Xp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c)
- {
- *this = *this / complex(__c.real(), __c.imag());
- return *this;
- }
+public:
+ typedef long double value_type;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
+ : __re_(__re), __im_(__im) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double real() const { return __re_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double imag() const { return __im_; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void imag(value_type __im) { __im_ = __im; }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(long double __re) {
+ __re_ = __re;
+ __im_ = value_type();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(long double __re) {
+ __re_ += __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(long double __re) {
+ __re_ -= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(long double __re) {
+ __re_ *= __re;
+ __im_ *= __re;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(long double __re) {
+ __re_ /= __re;
+ __im_ /= __re;
+ return *this;
+ }
+
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator=(const complex<_Xp>& __c) {
+ __re_ = __c.real();
+ __im_ = __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator+=(const complex<_Xp>& __c) {
+ __re_ += __c.real();
+ __im_ += __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
+ __re_ -= __c.real();
+ __im_ -= __c.imag();
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator*=(const complex<_Xp>& __c) {
+ *this = *this * complex(__c.real(), __c.imag());
+ return *this;
+ }
+ template <class _Xp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator/=(const complex<_Xp>& __c) {
+ *this = *this / complex(__c.real(), __c.imag());
+ return *this;
+ }
};
-inline
-_LIBCPP_CONSTEXPR
-complex<float>::complex(const complex<double>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
+inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<double>& __c) : __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<float>::complex(const complex<long double>& __c)
+inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<double>::complex(const complex<float>& __c)
- : __re_(__c.real()), __im_(__c.imag()) {}
+inline _LIBCPP_CONSTEXPR complex<double>::complex(const complex<float>& __c) : __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<double>::complex(const complex<long double>& __c)
+inline _LIBCPP_CONSTEXPR complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<long double>::complex(const complex<float>& __c)
+inline _LIBCPP_CONSTEXPR complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-inline
-_LIBCPP_CONSTEXPR
-complex<long double>::complex(const complex<double>& __c)
+inline _LIBCPP_CONSTEXPR complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
// 26.3.6 operators:
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t += __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__x);
+ __t += __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t += __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator+(const complex<_Tp>& __x, const _Tp& __y) {
+ complex<_Tp> __t(__x);
+ __t += __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__y);
- __t += __x;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator+(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__y);
+ __t += __x;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t -= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__x);
+ __t -= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t -= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator-(const complex<_Tp>& __x, const _Tp& __y) {
+ complex<_Tp> __t(__x);
+ __t -= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(-__y);
- __t += __x;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator-(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(-__y);
+ __t += __x;
+ return __t;
}
-template<class _Tp>
+template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
-operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
-{
- _Tp __a = __z.real();
- _Tp __b = __z.imag();
- _Tp __c = __w.real();
- _Tp __d = __w.imag();
-
- // Avoid floating point operations that are invalid during constant evaluation
- if (__libcpp_is_constant_evaluated()) {
- bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
- bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
- bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
- bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
- bool __z_nan = !__z_inf && (
- (std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b))
- || (std::__constexpr_isnan(__a) && __b == _Tp(0))
- || (__a == _Tp(0) && std::__constexpr_isnan(__b))
- );
- bool __w_nan = !__w_inf && (
- (std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d))
- || (std::__constexpr_isnan(__c) && __d == _Tp(0))
- || (__c == _Tp(0) && std::__constexpr_isnan(__d))
- );
- if (__z_nan || __w_nan) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- if (__z_inf || __w_inf) {
- if (__z_zero || __w_zero) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
- bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
- bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
- if (__z_nonzero_nan || __w_nonzero_nan) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
+operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) {
+ _Tp __a = __z.real();
+ _Tp __b = __z.imag();
+ _Tp __c = __w.real();
+ _Tp __d = __w.imag();
+
+ // Avoid floating point operations that are invalid during constant evaluation
+ if (__libcpp_is_constant_evaluated()) {
+ bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
+ bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
+ bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
+ bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
+ bool __z_nan =
+ !__z_inf && ((std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b)) ||
+ (std::__constexpr_isnan(__a) && __b == _Tp(0)) || (__a == _Tp(0) && std::__constexpr_isnan(__b)));
+ bool __w_nan =
+ !__w_inf && ((std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d)) ||
+ (std::__constexpr_isnan(__c) && __d == _Tp(0)) || (__c == _Tp(0) && std::__constexpr_isnan(__d)));
+ if (__z_nan || __w_nan) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
-
- _Tp __ac = __a * __c;
- _Tp __bd = __b * __d;
- _Tp __ad = __a * __d;
- _Tp __bc = __b * __c;
- _Tp __x = __ac - __bd;
- _Tp __y = __ad + __bc;
- if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y))
- {
- bool __recalc = false;
- if (std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b))
- {
- __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
- if (std::__constexpr_isnan(__c))
- __c = std::__constexpr_copysign(_Tp(0), __c);
- if (std::__constexpr_isnan(__d))
- __d = std::__constexpr_copysign(_Tp(0), __d);
- __recalc = true;
- }
- if (std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d))
- {
- __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
- if (std::__constexpr_isnan(__a))
- __a = std::__constexpr_copysign(_Tp(0), __a);
- if (std::__constexpr_isnan(__b))
- __b = std::__constexpr_copysign(_Tp(0), __b);
- __recalc = true;
- }
- if (!__recalc && (std::__constexpr_isinf(__ac) || std::__constexpr_isinf(__bd) ||
- std::__constexpr_isinf(__ad) || std::__constexpr_isinf(__bc)))
- {
- if (std::__constexpr_isnan(__a))
- __a = std::__constexpr_copysign(_Tp(0), __a);
- if (std::__constexpr_isnan(__b))
- __b = std::__constexpr_copysign(_Tp(0), __b);
- if (std::__constexpr_isnan(__c))
- __c = std::__constexpr_copysign(_Tp(0), __c);
- if (std::__constexpr_isnan(__d))
- __d = std::__constexpr_copysign(_Tp(0), __d);
- __recalc = true;
- }
- if (__recalc)
- {
- __x = _Tp(INFINITY) * (__a * __c - __b * __d);
- __y = _Tp(INFINITY) * (__a * __d + __b * __c);
- }
+ if (__z_inf || __w_inf) {
+ if (__z_zero || __w_zero) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
+ }
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
+ }
+ bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
+ bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
+ if (__z_nonzero_nan || __w_nonzero_nan) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
- return complex<_Tp>(__x, __y);
+ }
+
+ _Tp __ac = __a * __c;
+ _Tp __bd = __b * __d;
+ _Tp __ad = __a * __d;
+ _Tp __bc = __b * __c;
+ _Tp __x = __ac - __bd;
+ _Tp __y = __ad + __bc;
+ if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y)) {
+ bool __recalc = false;
+ if (std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) {
+ __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+ if (std::__constexpr_isnan(__c))
+ __c = std::__constexpr_copysign(_Tp(0), __c);
+ if (std::__constexpr_isnan(__d))
+ __d = std::__constexpr_copysign(_Tp(0), __d);
+ __recalc = true;
+ }
+ if (std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d)) {
+ __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+ if (std::__constexpr_isnan(__a))
+ __a = std::__constexpr_copysign(_Tp(0), __a);
+ if (std::__constexpr_isnan(__b))
+ __b = std::__constexpr_copysign(_Tp(0), __b);
+ __recalc = true;
+ }
+ if (!__recalc && (std::__constexpr_isinf(__ac) || std::__constexpr_isinf(__bd) || std::__constexpr_isinf(__ad) ||
+ std::__constexpr_isinf(__bc))) {
+ if (std::__constexpr_isnan(__a))
+ __a = std::__constexpr_copysign(_Tp(0), __a);
+ if (std::__constexpr_isnan(__b))
+ __b = std::__constexpr_copysign(_Tp(0), __b);
+ if (std::__constexpr_isnan(__c))
+ __c = std::__constexpr_copysign(_Tp(0), __c);
+ if (std::__constexpr_isnan(__d))
+ __d = std::__constexpr_copysign(_Tp(0), __d);
+ __recalc = true;
+ }
+ if (__recalc) {
+ __x = _Tp(INFINITY) * (__a * __c - __b * __d);
+ __y = _Tp(INFINITY) * (__a * __d + __b * __c);
+ }
+ }
+ return complex<_Tp>(__x, __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator*(const complex<_Tp>& __x, const _Tp& __y)
-{
- complex<_Tp> __t(__x);
- __t *= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator*(const complex<_Tp>& __x, const _Tp& __y) {
+ complex<_Tp> __t(__x);
+ __t *= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator*(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__y);
- __t *= __x;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator*(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__y);
+ __t *= __x;
+ return __t;
}
-template<class _Tp>
+template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
-operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
-{
- int __ilogbw = 0;
- _Tp __a = __z.real();
- _Tp __b = __z.imag();
- _Tp __c = __w.real();
- _Tp __d = __w.imag();
- _Tp __logbw = std::__constexpr_logb(std::__constexpr_fmax(std::__constexpr_fabs(__c), std::__constexpr_fabs(__d)));
- if (std::__constexpr_isfinite(__logbw))
- {
- __ilogbw = static_cast<int>(__logbw);
- __c = std::__constexpr_scalbn(__c, -__ilogbw);
- __d = std::__constexpr_scalbn(__d, -__ilogbw);
+operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) {
+ int __ilogbw = 0;
+ _Tp __a = __z.real();
+ _Tp __b = __z.imag();
+ _Tp __c = __w.real();
+ _Tp __d = __w.imag();
+ _Tp __logbw = std::__constexpr_logb(std::__constexpr_fmax(std::__constexpr_fabs(__c), std::__constexpr_fabs(__d)));
+ if (std::__constexpr_isfinite(__logbw)) {
+ __ilogbw = static_cast<int>(__logbw);
+ __c = std::__constexpr_scalbn(__c, -__ilogbw);
+ __d = std::__constexpr_scalbn(__d, -__ilogbw);
+ }
+
+ // Avoid floating point operations that are invalid during constant evaluation
+ if (__libcpp_is_constant_evaluated()) {
+ bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
+ bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
+ bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
+ bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
+ bool __z_nan =
+ !__z_inf && ((std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b)) ||
+ (std::__constexpr_isnan(__a) && __b == _Tp(0)) || (__a == _Tp(0) && std::__constexpr_isnan(__b)));
+ bool __w_nan =
+ !__w_inf && ((std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d)) ||
+ (std::__constexpr_isnan(__c) && __d == _Tp(0)) || (__c == _Tp(0) && std::__constexpr_isnan(__d)));
+ if ((__z_nan || __w_nan) || (__z_inf && __w_inf)) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
-
- // Avoid floating point operations that are invalid during constant evaluation
- if (__libcpp_is_constant_evaluated()) {
- bool __z_zero = __a == _Tp(0) && __b == _Tp(0);
- bool __w_zero = __c == _Tp(0) && __d == _Tp(0);
- bool __z_inf = std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b);
- bool __w_inf = std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d);
- bool __z_nan = !__z_inf && (
- (std::__constexpr_isnan(__a) && std::__constexpr_isnan(__b))
- || (std::__constexpr_isnan(__a) && __b == _Tp(0))
- || (__a == _Tp(0) && std::__constexpr_isnan(__b))
- );
- bool __w_nan = !__w_inf && (
- (std::__constexpr_isnan(__c) && std::__constexpr_isnan(__d))
- || (std::__constexpr_isnan(__c) && __d == _Tp(0))
- || (__c == _Tp(0) && std::__constexpr_isnan(__d))
- );
- if ((__z_nan || __w_nan) || (__z_inf && __w_inf)) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
- bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
- if (__z_nonzero_nan || __w_nonzero_nan) {
- if (__w_zero) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- if (__w_inf) {
- return complex<_Tp>(_Tp(0), _Tp(0));
- }
- if (__z_inf) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
- if (__w_zero) {
- if (__z_zero) {
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
- }
- return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
- }
+ bool __z_nonzero_nan = !__z_inf && !__z_nan && (std::__constexpr_isnan(__a) || std::__constexpr_isnan(__b));
+ bool __w_nonzero_nan = !__w_inf && !__w_nan && (std::__constexpr_isnan(__c) || std::__constexpr_isnan(__d));
+ if (__z_nonzero_nan || __w_nonzero_nan) {
+ if (__w_zero) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
+ }
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
}
-
- _Tp __denom = __c * __c + __d * __d;
- _Tp __x = std::__constexpr_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
- _Tp __y = std::__constexpr_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
- if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y))
- {
- if ((__denom == _Tp(0)) && (!std::__constexpr_isnan(__a) || !std::__constexpr_isnan(__b)))
- {
- __x = std::__constexpr_copysign(_Tp(INFINITY), __c) * __a;
- __y = std::__constexpr_copysign(_Tp(INFINITY), __c) * __b;
- } else if ((std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) && std::__constexpr_isfinite(__c) &&
- std::__constexpr_isfinite(__d)) {
- __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
- __x = _Tp(INFINITY) * (__a * __c + __b * __d);
- __y = _Tp(INFINITY) * (__b * __c - __a * __d);
- } else if (std::__constexpr_isinf(__logbw) && __logbw > _Tp(0) && std::__constexpr_isfinite(__a) &&
- std::__constexpr_isfinite(__b)) {
- __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
- __x = _Tp(0) * (__a * __c + __b * __d);
- __y = _Tp(0) * (__b * __c - __a * __d);
- }
+ if (__w_inf) {
+ return complex<_Tp>(_Tp(0), _Tp(0));
+ }
+ if (__z_inf) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
+ }
+ if (__w_zero) {
+ if (__z_zero) {
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0));
+ }
+ return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity()));
}
- return complex<_Tp>(__x, __y);
+ }
+
+ _Tp __denom = __c * __c + __d * __d;
+ _Tp __x = std::__constexpr_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
+ _Tp __y = std::__constexpr_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
+ if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y)) {
+ if ((__denom == _Tp(0)) && (!std::__constexpr_isnan(__a) || !std::__constexpr_isnan(__b))) {
+ __x = std::__constexpr_copysign(_Tp(INFINITY), __c) * __a;
+ __y = std::__constexpr_copysign(_Tp(INFINITY), __c) * __b;
+ } else if ((std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) && std::__constexpr_isfinite(__c) &&
+ std::__constexpr_isfinite(__d)) {
+ __a = std::__constexpr_copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = std::__constexpr_copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+ __x = _Tp(INFINITY) * (__a * __c + __b * __d);
+ __y = _Tp(INFINITY) * (__b * __c - __a * __d);
+ } else if (std::__constexpr_isinf(__logbw) && __logbw > _Tp(0) && std::__constexpr_isfinite(__a) &&
+ std::__constexpr_isfinite(__b)) {
+ __c = std::__constexpr_copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = std::__constexpr_copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+ __x = _Tp(0) * (__a * __c + __b * __d);
+ __y = _Tp(0) * (__b * __c - __a * __d);
+ }
+ }
+ return complex<_Tp>(__x, __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator/(const complex<_Tp>& __x, const _Tp& __y)
-{
- return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator/(const complex<_Tp>& __x, const _Tp& __y) {
+ return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator/(const _Tp& __x, const complex<_Tp>& __y)
-{
- complex<_Tp> __t(__x);
- __t /= __y;
- return __t;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp>
+operator/(const _Tp& __x, const complex<_Tp>& __y) {
+ complex<_Tp> __t(__x);
+ __t /= __y;
+ return __t;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator+(const complex<_Tp>& __x)
-{
- return __x;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator+(const complex<_Tp>& __x) {
+ return __x;
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-operator-(const complex<_Tp>& __x)
-{
- return complex<_Tp>(-__x.real(), -__x.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator-(const complex<_Tp>& __x) {
+ return complex<_Tp>(-__x.real(), -__x.imag());
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return __x.real() == __y.real() && __x.imag() == __y.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ return __x.real() == __y.real() && __x.imag() == __y.imag();
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const complex<_Tp>& __x, const _Tp& __y)
-{
- return __x.real() == __y && __x.imag() == 0;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const complex<_Tp>& __x, const _Tp& __y) {
+ return __x.real() == __y && __x.imag() == 0;
}
#if _LIBCPP_STD_VER <= 17
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const _Tp& __x, const complex<_Tp>& __y)
-{
- return __x == __y.real() && 0 == __y.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const _Tp& __x, const complex<_Tp>& __y) {
+ return __x == __y.real() && 0 == __y.imag();
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return !(__x == __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ return !(__x == __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const complex<_Tp>& __x, const _Tp& __y)
-{
- return !(__x == __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const complex<_Tp>& __x, const _Tp& __y) {
+ return !(__x == __y);
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const _Tp& __x, const complex<_Tp>& __y)
-{
- return !(__x == __y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const _Tp& __x, const complex<_Tp>& __y) {
+ return !(__x == __y);
}
#endif
// 26.3.7 values:
-template <class _Tp, bool = is_integral<_Tp>::value,
- bool = is_floating_point<_Tp>::value
- >
+template <class _Tp, bool = is_integral<_Tp>::value, bool = is_floating_point<_Tp>::value >
struct __libcpp_complex_overload_traits {};
// Integral Types
template <class _Tp>
-struct __libcpp_complex_overload_traits<_Tp, true, false>
-{
- typedef double _ValueType;
- typedef complex<double> _ComplexType;
+struct __libcpp_complex_overload_traits<_Tp, true, false> {
+ typedef double _ValueType;
+ typedef complex<double> _ComplexType;
};
// Floating point types
template <class _Tp>
-struct __libcpp_complex_overload_traits<_Tp, false, true>
-{
- typedef _Tp _ValueType;
- typedef complex<_Tp> _ComplexType;
+struct __libcpp_complex_overload_traits<_Tp, false, true> {
+ typedef _Tp _ValueType;
+ typedef complex<_Tp> _ComplexType;
};
// real
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-real(const complex<_Tp>& __c)
-{
- return __c.real();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp real(const complex<_Tp>& __c) {
+ return __c.real();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-real(_Tp __re)
-{
- return __re;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
+real(_Tp __re) {
+ return __re;
}
// imag
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-_Tp
-imag(const complex<_Tp>& __c)
-{
- return __c.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp imag(const complex<_Tp>& __c) {
+ return __c.imag();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-imag(_Tp)
-{
- return 0;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
+imag(_Tp) {
+ return 0;
}
// abs
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp
-abs(const complex<_Tp>& __c)
-{
- return std::hypot(__c.real(), __c.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _Tp abs(const complex<_Tp>& __c) {
+ return std::hypot(__c.real(), __c.imag());
}
// arg
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp
-arg(const complex<_Tp>& __c)
-{
- return std::atan2(__c.imag(), __c.real());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _Tp arg(const complex<_Tp>& __c) {
+ return std::atan2(__c.imag(), __c.real());
}
template <class _Tp, __enable_if_t<is_same<_Tp, long double>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-long double
-arg(_Tp __re)
-{
- return std::atan2l(0.L, __re);
+inline _LIBCPP_HIDE_FROM_ABI long double arg(_Tp __re) {
+ return std::atan2l(0.L, __re);
}
-template<class _Tp, __enable_if_t<is_integral<_Tp>::value || is_same<_Tp, double>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-double
-arg(_Tp __re)
-{
- return std::atan2(0., __re);
+template <class _Tp, __enable_if_t<is_integral<_Tp>::value || is_same<_Tp, double>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI double arg(_Tp __re) {
+ return std::atan2(0., __re);
}
template <class _Tp, __enable_if_t<is_same<_Tp, float>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-float
-arg(_Tp __re)
-{
- return std::atan2f(0.F, __re);
+inline _LIBCPP_HIDE_FROM_ABI float arg(_Tp __re) {
+ return std::atan2f(0.F, __re);
}
// norm
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_Tp
-norm(const complex<_Tp>& __c)
-{
- if (std::__constexpr_isinf(__c.real()))
- return std::abs(__c.real());
- if (std::__constexpr_isinf(__c.imag()))
- return std::abs(__c.imag());
- return __c.real() * __c.real() + __c.imag() * __c.imag();
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp norm(const complex<_Tp>& __c) {
+ if (std::__constexpr_isinf(__c.real()))
+ return std::abs(__c.real());
+ if (std::__constexpr_isinf(__c.imag()))
+ return std::abs(__c.imag());
+ return __c.real() * __c.real() + __c.imag() * __c.imag();
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-norm(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType;
- return static_cast<_ValueType>(__re) * __re;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
+norm(_Tp __re) {
+ typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType;
+ return static_cast<_ValueType>(__re) * __re;
}
// conj
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-complex<_Tp>
-conj(const complex<_Tp>& __c)
-{
- return complex<_Tp>(__c.real(), -__c.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> conj(const complex<_Tp>& __c) {
+ return complex<_Tp>(__c.real(), -__c.imag());
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
-conj(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
- return _ComplexType(__re);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
+conj(_Tp __re) {
+ typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
+ return _ComplexType(__re);
}
-
-
// proj
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-proj(const complex<_Tp>& __c)
-{
- complex<_Tp> __r = __c;
- if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag()))
- __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag()));
- return __r;
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> proj(const complex<_Tp>& __c) {
+ complex<_Tp> __r = __c;
+ if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag()))
+ __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag()));
+ return __r;
}
template <class _Tp, __enable_if_t<is_floating_point<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
-proj(_Tp __re)
-{
- if (std::__constexpr_isinf(__re))
- __re = std::abs(__re);
- return complex<_Tp>(__re);
+inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType proj(_Tp __re) {
+ if (std::__constexpr_isinf(__re))
+ __re = std::abs(__re);
+ return complex<_Tp>(__re);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-typename __libcpp_complex_overload_traits<_Tp>::_ComplexType
-proj(_Tp __re)
-{
- typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
- return _ComplexType(__re);
+inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType proj(_Tp __re) {
+ typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType;
+ return _ComplexType(__re);
}
// polar
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-polar(const _Tp& __rho, const _Tp& __theta = _Tp())
-{
- if (std::__constexpr_isnan(__rho) || std::signbit(__rho))
- return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- if (std::__constexpr_isnan(__theta))
- {
- if (std::__constexpr_isinf(__rho))
- return complex<_Tp>(__rho, __theta);
- return complex<_Tp>(__theta, __theta);
- }
- if (std::__constexpr_isinf(__theta))
- {
- if (std::__constexpr_isinf(__rho))
- return complex<_Tp>(__rho, _Tp(NAN));
- return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- }
- _Tp __x = __rho * std::cos(__theta);
- if (std::__constexpr_isnan(__x))
- __x = 0;
- _Tp __y = __rho * std::sin(__theta);
- if (std::__constexpr_isnan(__y))
- __y = 0;
- return complex<_Tp>(__x, __y);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta = _Tp()) {
+ if (std::__constexpr_isnan(__rho) || std::signbit(__rho))
+ return complex<_Tp>(_Tp(NAN), _Tp(NAN));
+ if (std::__constexpr_isnan(__theta)) {
+ if (std::__constexpr_isinf(__rho))
+ return complex<_Tp>(__rho, __theta);
+ return complex<_Tp>(__theta, __theta);
+ }
+ if (std::__constexpr_isinf(__theta)) {
+ if (std::__constexpr_isinf(__rho))
+ return complex<_Tp>(__rho, _Tp(NAN));
+ return complex<_Tp>(_Tp(NAN), _Tp(NAN));
+ }
+ _Tp __x = __rho * std::cos(__theta);
+ if (std::__constexpr_isnan(__x))
+ __x = 0;
+ _Tp __y = __rho * std::sin(__theta);
+ if (std::__constexpr_isnan(__y))
+ __y = 0;
+ return complex<_Tp>(__x, __y);
}
// log
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-log(const complex<_Tp>& __x)
-{
- return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log(const complex<_Tp>& __x) {
+ return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x));
}
// log10
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-log10(const complex<_Tp>& __x)
-{
- return std::log(__x) / std::log(_Tp(10));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log10(const complex<_Tp>& __x) {
+ return std::log(__x) / std::log(_Tp(10));
}
// sqrt
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-sqrt(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(_Tp(INFINITY), __x.imag());
- if (std::__constexpr_isinf(__x.real()))
- {
- if (__x.real() > _Tp(0))
- return complex<_Tp>(__x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag()));
- return complex<_Tp>(std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag()));
- }
- return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(_Tp(INFINITY), __x.imag());
+ if (std::__constexpr_isinf(__x.real())) {
+ if (__x.real() > _Tp(0))
+ return complex<_Tp>(
+ __x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag()));
+ return complex<_Tp>(
+ std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag()));
+ }
+ return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2));
}
// exp
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-exp(const complex<_Tp>& __x)
-{
- _Tp __i = __x.imag();
- if (__i == 0) {
- return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
- }
- if (std::__constexpr_isinf(__x.real()))
- {
- if (__x.real() < _Tp(0))
- {
- if (!std::__constexpr_isfinite(__i))
- __i = _Tp(1);
- }
- else if (__i == 0 || !std::__constexpr_isfinite(__i))
- {
- if (std::__constexpr_isinf(__i))
- __i = _Tp(NAN);
- return complex<_Tp>(__x.real(), __i);
- }
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
+ _Tp __i = __x.imag();
+ if (__i == 0) {
+ return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
+ }
+ if (std::__constexpr_isinf(__x.real())) {
+ if (__x.real() < _Tp(0)) {
+ if (!std::__constexpr_isfinite(__i))
+ __i = _Tp(1);
+ } else if (__i == 0 || !std::__constexpr_isfinite(__i)) {
+ if (std::__constexpr_isinf(__i))
+ __i = _Tp(NAN);
+ return complex<_Tp>(__x.real(), __i);
}
- _Tp __e = std::exp(__x.real());
- return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i));
+ }
+ _Tp __e = std::exp(__x.real());
+ return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i));
}
// pow
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
-{
- return std::exp(__y * std::log(__x));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) {
+ return std::exp(__y * std::log(__x));
}
-template<class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<typename __promote<_Tp, _Up>::type>
-pow(const complex<_Tp>& __x, const complex<_Up>& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return std::pow(result_type(__x), result_type(__y));
+template <class _Tp, class _Up>
+inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type>
+pow(const complex<_Tp>& __x, const complex<_Up>& __y) {
+ typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+ return std::pow(result_type(__x), result_type(__y));
}
-template<class _Tp, class _Up, __enable_if_t<is_arithmetic<_Up>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<typename __promote<_Tp, _Up>::type>
-pow(const complex<_Tp>& __x, const _Up& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return std::pow(result_type(__x), result_type(__y));
+template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Up>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type> pow(const complex<_Tp>& __x, const _Up& __y) {
+ typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+ return std::pow(result_type(__x), result_type(__y));
}
-template<class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<typename __promote<_Tp, _Up>::type>
-pow(const _Tp& __x, const complex<_Up>& __y)
-{
- typedef complex<typename __promote<_Tp, _Up>::type> result_type;
- return std::pow(result_type(__x), result_type(__y));
+template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI complex<typename __promote<_Tp, _Up>::type> pow(const _Tp& __x, const complex<_Up>& __y) {
+ typedef complex<typename __promote<_Tp, _Up>::type> result_type;
+ return std::pow(result_type(__x), result_type(__y));
}
// __sqr, computes pow(x, 2)
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-__sqr(const complex<_Tp>& __x)
-{
- return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()),
- _Tp(2) * __x.real() * __x.imag());
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> __sqr(const complex<_Tp>& __x) {
+ return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), _Tp(2) * __x.real() * __x.imag());
}
// asinh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-asinh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.real()))
- {
- if (std::__constexpr_isnan(__x.imag()))
- return __x;
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
- return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__x.imag(), __x.real());
- if (__x.imag() == 0)
- return __x;
- return complex<_Tp>(__x.real(), __x.real());
- }
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.real())) {
+ if (std::__constexpr_isnan(__x.imag()))
+ return __x;
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
+ return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
+ }
+ if (std::__constexpr_isnan(__x.real())) {
if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1)));
- return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
+ return complex<_Tp>(__x.imag(), __x.real());
+ if (__x.imag() == 0)
+ return __x;
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1)));
+ return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
}
// acosh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-acosh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.real()))
- {
- if (std::__constexpr_isnan(__x.imag()))
- return complex<_Tp>(std::abs(__x.real()), __x.imag());
- if (std::__constexpr_isinf(__x.imag()))
- {
- if (__x.real() > 0)
- return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
- else
- return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag()));
- }
- if (__x.real() < 0)
- return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag()));
- return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(std::abs(__x.imag()), __x.real());
- return complex<_Tp>(__x.real(), __x.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.real())) {
+ if (std::__constexpr_isnan(__x.imag()))
+ return complex<_Tp>(std::abs(__x.real()), __x.imag());
+ if (std::__constexpr_isinf(__x.imag())) {
+ if (__x.real() > 0)
+ return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
+ else
+ return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag()));
}
+ if (__x.real() < 0)
+ return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag()));
+ return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
+ }
+ if (std::__constexpr_isnan(__x.real())) {
if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
- return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag()));
+ return complex<_Tp>(std::abs(__x.imag()), __x.real());
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi / _Tp(2), __x.imag()));
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
+ return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag()));
}
// atanh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-atanh(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.imag()))
- {
- return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
- }
- if (std::__constexpr_isnan(__x.imag()))
- {
- if (std::__constexpr_isinf(__x.real()) || __x.real() == 0)
- return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag());
- return complex<_Tp>(__x.imag(), __x.imag());
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- return complex<_Tp>(__x.real(), __x.real());
- }
- if (std::__constexpr_isinf(__x.real()))
- {
- return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
- }
- if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0))
- {
- return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag()));
- }
- complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
- return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.imag())) {
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
+ }
+ if (std::__constexpr_isnan(__x.imag())) {
+ if (std::__constexpr_isinf(__x.real()) || __x.real() == 0)
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag());
+ return complex<_Tp>(__x.imag(), __x.imag());
+ }
+ if (std::__constexpr_isnan(__x.real())) {
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.real())) {
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
+ }
+ if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
+ return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag()));
+ }
+ complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
+ return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
}
// sinh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-sinh(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
- return __x;
- return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin(__x.imag()));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(__x.real(), _Tp(NAN));
+ if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(__x.real(), _Tp(NAN));
+ if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
+ return __x;
+ return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin(__x.imag()));
}
// cosh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-cosh(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
- if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(_Tp(NAN), __x.real());
- if (__x.real() == 0 && __x.imag() == 0)
- return complex<_Tp>(_Tp(1), __x.imag());
- if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
- return complex<_Tp>(std::abs(__x.real()), __x.imag());
- return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin(__x.imag()));
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
+ if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(_Tp(NAN), __x.real());
+ if (__x.real() == 0 && __x.imag() == 0)
+ return complex<_Tp>(_Tp(1), __x.imag());
+ if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
+ return complex<_Tp>(std::abs(__x.real()), __x.imag());
+ return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin(__x.imag()));
}
// tanh
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-tanh(const complex<_Tp>& __x)
-{
- if (std::__constexpr_isinf(__x.real()))
- {
- if (!std::__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
- return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x.imag())));
- }
- if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0)
- return __x;
- _Tp __2r(_Tp(2) * __x.real());
- _Tp __2i(_Tp(2) * __x.imag());
- _Tp __d(std::cosh(__2r) + std::cos(__2i));
- _Tp __2rsh(std::sinh(__2r));
- if (std::__constexpr_isinf(__2rsh) && std::__constexpr_isinf(__d))
- return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
- __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
- return complex<_Tp>(__2rsh/__d, std::sin(__2i)/__d);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> tanh(const complex<_Tp>& __x) {
+ if (std::__constexpr_isinf(__x.real())) {
+ if (!std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
+ return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x.imag())));
+ }
+ if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0)
+ return __x;
+ _Tp __2r(_Tp(2) * __x.real());
+ _Tp __2i(_Tp(2) * __x.imag());
+ _Tp __d(std::cosh(__2r) + std::cos(__2i));
+ _Tp __2rsh(std::sinh(__2r));
+ if (std::__constexpr_isinf(__2rsh) && std::__constexpr_isinf(__d))
+ return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
+ return complex<_Tp>(__2rsh / __d, std::sin(__2i) / __d);
}
// asin
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-asin(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> asin(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
// acos
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-acos(const complex<_Tp>& __x)
-{
- const _Tp __pi(atan2(+0., -0.));
- if (std::__constexpr_isinf(__x.real()))
- {
- if (std::__constexpr_isnan(__x.imag()))
- return complex<_Tp>(__x.imag(), __x.real());
- if (std::__constexpr_isinf(__x.imag()))
- {
- if (__x.real() < _Tp(0))
- return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
- return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
- }
- if (__x.real() < _Tp(0))
- return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real());
- return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real());
- }
- if (std::__constexpr_isnan(__x.real()))
- {
- if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__x.real(), -__x.imag());
- return complex<_Tp>(__x.real(), __x.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) {
+ const _Tp __pi(atan2(+0., -0.));
+ if (std::__constexpr_isinf(__x.real())) {
+ if (std::__constexpr_isnan(__x.imag()))
+ return complex<_Tp>(__x.imag(), __x.real());
+ if (std::__constexpr_isinf(__x.imag())) {
+ if (__x.real() < _Tp(0))
+ return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
+ return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
}
+ if (__x.real() < _Tp(0))
+ return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real());
+ return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real());
+ }
+ if (std::__constexpr_isnan(__x.real())) {
if (std::__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag())))
- return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
- if (std::signbit(__x.imag()))
- return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real()));
- return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real()));
+ return complex<_Tp>(__x.real(), -__x.imag());
+ return complex<_Tp>(__x.real(), __x.real());
+ }
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(__pi / _Tp(2), -__x.imag());
+ if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag())))
+ return complex<_Tp>(__pi / _Tp(2), -__x.imag());
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
+ if (std::signbit(__x.imag()))
+ return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real()));
+ return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real()));
}
// atan
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-atan(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> atan(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
// sin
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-sin(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> sin(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
// cos
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-complex<_Tp>
-cos(const complex<_Tp>& __x)
-{
- return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> cos(const complex<_Tp>& __x) {
+ return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
}
// tan
-template<class _Tp>
-_LIBCPP_HIDE_FROM_ABI complex<_Tp>
-tan(const complex<_Tp>& __x)
-{
- complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
- return complex<_Tp>(__z.imag(), -__z.real());
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI complex<_Tp> tan(const complex<_Tp>& __x) {
+ complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
+ return complex<_Tp>(__z.imag(), -__z.real());
}
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-template<class _Tp, class _CharT, class _Traits>
+template <class _Tp, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
-{
- if (__is.good())
- {
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) {
+ if (__is.good()) {
+ std::ws(__is);
+ if (__is.peek() == _CharT('(')) {
+ __is.get();
+ _Tp __r;
+ __is >> __r;
+ if (!__is.fail()) {
std::ws(__is);
- if (__is.peek() == _CharT('('))
- {
- __is.get();
- _Tp __r;
- __is >> __r;
- if (!__is.fail())
- {
- std::ws(__is);
- _CharT __c = __is.peek();
- if (__c == _CharT(','))
- {
- __is.get();
- _Tp __i;
- __is >> __i;
- if (!__is.fail())
- {
- std::ws(__is);
- __c = __is.peek();
- if (__c == _CharT(')'))
- {
- __is.get();
- __x = complex<_Tp>(__r, __i);
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- __is.setstate(__is.failbit);
- }
- else if (__c == _CharT(')'))
- {
- __is.get();
- __x = complex<_Tp>(__r, _Tp(0));
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- __is.setstate(__is.failbit);
- }
- else
- {
- _Tp __r;
- __is >> __r;
- if (!__is.fail())
- __x = complex<_Tp>(__r, _Tp(0));
- else
- __is.setstate(__is.failbit);
- }
- }
- else
+ _CharT __c = __is.peek();
+ if (__c == _CharT(',')) {
+ __is.get();
+ _Tp __i;
+ __is >> __i;
+ if (!__is.fail()) {
+ std::ws(__is);
+ __c = __is.peek();
+ if (__c == _CharT(')')) {
+ __is.get();
+ __x = complex<_Tp>(__r, __i);
+ } else
+ __is.setstate(__is.failbit);
+ } else
+ __is.setstate(__is.failbit);
+ } else if (__c == _CharT(')')) {
+ __is.get();
+ __x = complex<_Tp>(__r, _Tp(0));
+ } else
+ __is.setstate(__is.failbit);
+ } else
__is.setstate(__is.failbit);
- return __is;
+ } else {
+ _Tp __r;
+ __is >> __r;
+ if (!__is.fail())
+ __x = complex<_Tp>(__r, _Tp(0));
+ else
+ __is.setstate(__is.failbit);
+ }
+ } else
+ __is.setstate(__is.failbit);
+ return __is;
}
-template<class _Tp, class _CharT, class _Traits>
+template <class _Tp, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
-{
- basic_ostringstream<_CharT, _Traits> __s;
- __s.flags(__os.flags());
- __s.imbue(__os.getloc());
- __s.precision(__os.precision());
- __s << '(' << __x.real() << ',' << __x.imag() << ')';
- return __os << __s.str();
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) {
+ basic_ostringstream<_CharT, _Traits> __s;
+ __s.flags(__os.flags());
+ __s.imbue(__os.getloc());
+ __s.precision(__os.precision());
+ __s << '(' << __x.real() << ',' << __x.imag() << ')';
+ return __os << __s.str();
}
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
#if _LIBCPP_STD_VER >= 14
// Literal suffix for complex number literals [complex.literals]
-inline namespace literals
-{
- inline namespace complex_literals
- {
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(long double __im)
- {
- return { 0.0l, __im };
- }
+inline namespace literals {
+inline namespace complex_literals {
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(long double __im) { return {0.0l, __im}; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(unsigned long long __im)
- {
- return { 0.0l, static_cast<long double>(__im) };
- }
-
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(long double __im)
- {
- return { 0.0, static_cast<double>(__im) };
- }
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<long double> operator""il(unsigned long long __im) {
+ return {0.0l, static_cast<long double>(__im)};
+}
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long long __im)
- {
- return { 0.0, static_cast<double>(__im) };
- }
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(long double __im) {
+ return {0.0, static_cast<double>(__im)};
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long long __im) {
+ return {0.0, static_cast<double>(__im)};
+}
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im)
- {
- return { 0.0f, static_cast<float>(__im) };
- }
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im) {
+ return {0.0f, static_cast<float>(__im)};
+}
- _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im)
- {
- return { 0.0f, static_cast<float>(__im) };
- }
- } // namespace complex_literals
+_LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im) {
+ return {0.0f, static_cast<float>(__im)};
+}
+} // namespace complex_literals
} // namespace literals
#endif
diff --git a/contrib/llvm-project/libcxx/include/condition_variable b/contrib/llvm-project/libcxx/include/condition_variable
index 4109ee52c125..cf7a570b6cb6 100644
--- a/contrib/llvm-project/libcxx/include/condition_variable
+++ b/contrib/llvm-project/libcxx/include/condition_variable
@@ -143,192 +143,147 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_EXPORTED_FROM_ABI condition_variable_any
-{
- condition_variable __cv_;
- shared_ptr<mutex> __mut_;
+class _LIBCPP_EXPORTED_FROM_ABI condition_variable_any {
+ condition_variable __cv_;
+ shared_ptr<mutex> __mut_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- condition_variable_any();
+ _LIBCPP_HIDE_FROM_ABI condition_variable_any();
- _LIBCPP_HIDE_FROM_ABI
- void notify_one() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void notify_all() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT;
- template <class _Lock>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- void wait(_Lock& __lock);
- template <class _Lock, class _Predicate>
- _LIBCPP_HIDE_FROM_ABI
- void wait(_Lock& __lock, _Predicate __pred);
+ template <class _Lock>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS void wait(_Lock& __lock);
+ template <class _Lock, class _Predicate>
+ _LIBCPP_HIDE_FROM_ABI void wait(_Lock& __lock, _Predicate __pred);
- template <class _Lock, class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- cv_status
- wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t);
+ template <class _Lock, class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status
+ wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t);
- template <class _Lock, class _Clock, class _Duration, class _Predicate>
- bool
- _LIBCPP_HIDE_FROM_ABI
- wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t,
- _Predicate __pred);
+ template <class _Lock, class _Clock, class _Duration, class _Predicate>
+ bool _LIBCPP_HIDE_FROM_ABI
+ wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred);
- template <class _Lock, class _Rep, class _Period>
- cv_status
- _LIBCPP_HIDE_FROM_ABI
- wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d);
+ template <class _Lock, class _Rep, class _Period>
+ cv_status _LIBCPP_HIDE_FROM_ABI wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d);
- template <class _Lock, class _Rep, class _Period, class _Predicate>
- bool
- _LIBCPP_HIDE_FROM_ABI
- wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d,
- _Predicate __pred);
+ template <class _Lock, class _Rep, class _Period, class _Predicate>
+ bool _LIBCPP_HIDE_FROM_ABI wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred);
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
- template <class _Lock, class _Predicate>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred);
+ template <class _Lock, class _Predicate>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred);
- template <class _Lock, class _Clock, class _Duration, class _Predicate>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_until(_Lock& __lock, stop_token __stoken,
- const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred);
+ template <class _Lock, class _Clock, class _Duration, class _Predicate>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_until(
+ _Lock& __lock, stop_token __stoken, const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred);
- template <class _Lock, class _Rep, class _Period, class _Predicate>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_for(_Lock& __lock, stop_token __stoken,
- const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred);
+ template <class _Lock, class _Rep, class _Period, class _Predicate>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ wait_for(_Lock& __lock, stop_token __stoken, const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred);
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
};
-inline
-condition_variable_any::condition_variable_any()
- : __mut_(make_shared<mutex>()) {}
+inline condition_variable_any::condition_variable_any() : __mut_(make_shared<mutex>()) {}
-inline
-void
-condition_variable_any::notify_one() _NOEXCEPT
-{
- {lock_guard<mutex> __lx(*__mut_);}
- __cv_.notify_one();
+inline void condition_variable_any::notify_one() _NOEXCEPT {
+ { lock_guard<mutex> __lx(*__mut_); }
+ __cv_.notify_one();
}
-inline
-void
-condition_variable_any::notify_all() _NOEXCEPT
-{
- {lock_guard<mutex> __lx(*__mut_);}
- __cv_.notify_all();
+inline void condition_variable_any::notify_all() _NOEXCEPT {
+ { lock_guard<mutex> __lx(*__mut_); }
+ __cv_.notify_all();
}
-struct __lock_external
-{
- template <class _Lock>
- _LIBCPP_HIDE_FROM_ABI void operator()(_Lock* __m) {__m->lock();}
+struct __lock_external {
+ template <class _Lock>
+ _LIBCPP_HIDE_FROM_ABI void operator()(_Lock* __m) {
+ __m->lock();
+ }
};
template <class _Lock>
-void
-condition_variable_any::wait(_Lock& __lock)
-{
- shared_ptr<mutex> __mut = __mut_;
- unique_lock<mutex> __lk(*__mut);
- __lock.unlock();
- unique_ptr<_Lock, __lock_external> __lxx(&__lock);
- lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
- __cv_.wait(__lk);
-} // __mut_.unlock(), __lock.lock()
+void condition_variable_any::wait(_Lock& __lock) {
+ shared_ptr<mutex> __mut = __mut_;
+ unique_lock<mutex> __lk(*__mut);
+ __lock.unlock();
+ unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
+ __cv_.wait(__lk);
+} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Predicate>
-inline
-void
-condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
-{
- while (!__pred())
- wait(__lock);
+inline void condition_variable_any::wait(_Lock& __lock, _Predicate __pred) {
+ while (!__pred())
+ wait(__lock);
}
template <class _Lock, class _Clock, class _Duration>
-cv_status
-condition_variable_any::wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t)
-{
- shared_ptr<mutex> __mut = __mut_;
- unique_lock<mutex> __lk(*__mut);
- __lock.unlock();
- unique_ptr<_Lock, __lock_external> __lxx(&__lock);
- lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
- return __cv_.wait_until(__lk, __t);
-} // __mut_.unlock(), __lock.lock()
+cv_status condition_variable_any::wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t) {
+ shared_ptr<mutex> __mut = __mut_;
+ unique_lock<mutex> __lk(*__mut);
+ __lock.unlock();
+ unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
+ return __cv_.wait_until(__lk, __t);
+} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Clock, class _Duration, class _Predicate>
-inline
-bool
-condition_variable_any::wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __t,
- _Predicate __pred)
-{
- while (!__pred())
- if (wait_until(__lock, __t) == cv_status::timeout)
- return __pred();
- return true;
+inline bool
+condition_variable_any::wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred) {
+ while (!__pred())
+ if (wait_until(__lock, __t) == cv_status::timeout)
+ return __pred();
+ return true;
}
template <class _Lock, class _Rep, class _Period>
-inline
-cv_status
-condition_variable_any::wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d)
-{
- return wait_until(__lock, chrono::steady_clock::now() + __d);
+inline cv_status condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d) {
+ return wait_until(__lock, chrono::steady_clock::now() + __d);
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
-inline
-bool
-condition_variable_any::wait_for(_Lock& __lock,
- const chrono::duration<_Rep, _Period>& __d,
- _Predicate __pred)
-{
- return wait_until(__lock, chrono::steady_clock::now() + __d,
- std::move(__pred));
+inline bool
+condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred) {
+ return wait_until(__lock, chrono::steady_clock::now() + __d, std::move(__pred));
}
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
template <class _Lock, class _Predicate>
bool condition_variable_any::wait(_Lock& __lock, stop_token __stoken, _Predicate __pred) {
- while (!__stoken.stop_requested()) {
- if (__pred())
- return true;
- wait(__lock);
- }
- return __pred();
+ while (!__stoken.stop_requested()) {
+ if (__pred())
+ return true;
+ wait(__lock);
+ }
+ return __pred();
}
template <class _Lock, class _Clock, class _Duration, class _Predicate>
bool condition_variable_any::wait_until(
_Lock& __lock, stop_token __stoken, const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred) {
- while (!__stoken.stop_requested()) {
- if (__pred())
- return true;
- if (wait_until(__lock, __abs_time) == cv_status::timeout)
- return __pred();
- }
- return __pred();
+ while (!__stoken.stop_requested()) {
+ if (__pred())
+ return true;
+ if (wait_until(__lock, __abs_time) == cv_status::timeout)
+ return __pred();
+ }
+ return __pred();
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
bool condition_variable_any::wait_for(
_Lock& __lock, stop_token __stoken, const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred) {
- return wait_until(__lock, std::move(__stoken), chrono::steady_clock::now() + __rel_time, std::move(__pred));
+ return wait_until(__lock, std::move(__stoken), chrono::steady_clock::now() + __rel_time, std::move(__pred));
}
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
+# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
_LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>);
diff --git a/contrib/llvm-project/libcxx/include/cstddef b/contrib/llvm-project/libcxx/include/cstddef
index 24be0fe78058..1d7bac24c81e 100644
--- a/contrib/llvm-project/libcxx/include/cstddef
+++ b/contrib/llvm-project/libcxx/include/cstddef
@@ -67,49 +67,39 @@ using ::max_align_t _LIBCPP_USING_IF_EXISTS;
_LIBCPP_END_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-namespace std // purposefully not versioned
+namespace std // purposefully not versioned
{
enum class byte : unsigned char {};
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator| (byte __lhs, byte __rhs) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept {
+ return static_cast<byte>(
+ static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = __lhs | __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept {
+ return __lhs = __lhs | __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator& (byte __lhs, byte __rhs) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept {
+ return static_cast<byte>(
+ static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = __lhs & __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept {
+ return __lhs = __lhs & __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept {
+ return static_cast<byte>(
+ static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)));
}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
-{ return __lhs = __lhs ^ __rhs; }
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept {
+ return __lhs = __lhs ^ __rhs;
+}
-_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~ (byte __b) noexcept
-{
- return static_cast<byte>(
- static_cast<unsigned char>(
- ~static_cast<unsigned int>(__b)
- ));
+_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept {
+ return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b)));
}
template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
diff --git a/contrib/llvm-project/libcxx/include/ctype.h b/contrib/llvm-project/libcxx/include/ctype.h
index 728173ed670f..448e4410c554 100644
--- a/contrib/llvm-project/libcxx/include/ctype.h
+++ b/contrib/llvm-project/libcxx/include/ctype.h
@@ -41,20 +41,20 @@ int toupper(int c);
#ifdef __cplusplus
-#undef isalnum
-#undef isalpha
-#undef isblank
-#undef iscntrl
-#undef isdigit
-#undef isgraph
-#undef islower
-#undef isprint
-#undef ispunct
-#undef isspace
-#undef isupper
-#undef isxdigit
-#undef tolower
-#undef toupper
+# undef isalnum
+# undef isalpha
+# undef isblank
+# undef iscntrl
+# undef isdigit
+# undef isgraph
+# undef islower
+# undef isprint
+# undef ispunct
+# undef isspace
+# undef isupper
+# undef isxdigit
+# undef tolower
+# undef toupper
#endif
diff --git a/contrib/llvm-project/libcxx/include/cuchar b/contrib/llvm-project/libcxx/include/cuchar
index 93e657e84b6d..03b8c7d2a88b 100644
--- a/contrib/llvm-project/libcxx/include/cuchar
+++ b/contrib/llvm-project/libcxx/include/cuchar
@@ -73,4 +73,4 @@ using ::c32rtomb _LIBCPP_USING_IF_EXISTS;
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_CUCHAR
+#endif // _LIBCPP_CUCHAR
diff --git a/contrib/llvm-project/libcxx/include/deque b/contrib/llvm-project/libcxx/include/deque
index eabcc7bd0e3c..fca8b3d6e2c7 100644
--- a/contrib/llvm-project/libcxx/include/deque
+++ b/contrib/llvm-project/libcxx/include/deque
@@ -242,182 +242,173 @@ template <class T, class Allocator, class Predicate>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS deque;
+template <class _Tp, class _Allocator = allocator<_Tp> >
+class _LIBCPP_TEMPLATE_VIS deque;
template <class _ValueType, class _DiffType>
struct __deque_block_size {
static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
};
-template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
- class _DiffType, _DiffType _BS =
+template <class _ValueType,
+ class _Pointer,
+ class _Reference,
+ class _MapPointer,
+ class _DiffType,
+ _DiffType _BS =
#ifdef _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
-// Keep template parameter to avoid changing all template declarations thoughout
-// this file.
- 0
+ // Keep template parameter to avoid changing all template declarations thoughout
+ // this file.
+ 0
#else
- __deque_block_size<_ValueType, _DiffType>::value
+ __deque_block_size<_ValueType, _DiffType>::value
#endif
>
-class _LIBCPP_TEMPLATE_VIS __deque_iterator
-{
- typedef _MapPointer __map_iterator;
+class _LIBCPP_TEMPLATE_VIS __deque_iterator {
+ typedef _MapPointer __map_iterator;
+
public:
- typedef _Pointer pointer;
- typedef _DiffType difference_type;
+ typedef _Pointer pointer;
+ typedef _DiffType difference_type;
+
private:
- __map_iterator __m_iter_;
- pointer __ptr_;
+ __map_iterator __m_iter_;
+ pointer __ptr_;
+
+ static const difference_type __block_size;
- static const difference_type __block_size;
public:
- typedef _ValueType value_type;
- typedef random_access_iterator_tag iterator_category;
- typedef _Reference reference;
+ typedef _ValueType value_type;
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Reference reference;
- _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER >= 14
- : __m_iter_(nullptr), __ptr_(nullptr)
+ : __m_iter_(nullptr),
+ __ptr_(nullptr)
#endif
- {}
-
- template <class _Pp, class _Rp, class _MP, __enable_if_t<is_convertible<_Pp, pointer>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it) _NOEXCEPT
- : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const {return *__ptr_;}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const {return __ptr_;}
-
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator++()
- {
- if (++__ptr_ - *__m_iter_ == __block_size)
- {
- ++__m_iter_;
- __ptr_ = *__m_iter_;
- }
- return *this;
- }
+ {
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator++(int)
- {
- __deque_iterator __tmp = *this;
- ++(*this);
- return __tmp;
- }
+ template <class _Pp, class _Rp, class _MP, __enable_if_t<is_convertible<_Pp, pointer>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it) _NOEXCEPT
+ : __m_iter_(__it.__m_iter_),
+ __ptr_(__it.__ptr_) {}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator--()
- {
- if (__ptr_ == *__m_iter_)
- {
- --__m_iter_;
- __ptr_ = *__m_iter_ + __block_size;
- }
- --__ptr_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__ptr_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return __ptr_; }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator--(int)
- {
- __deque_iterator __tmp = *this;
- --(*this);
- return __tmp;
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator++() {
+ if (++__ptr_ - *__m_iter_ == __block_size) {
+ ++__m_iter_;
+ __ptr_ = *__m_iter_;
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator+=(difference_type __n)
- {
- if (__n != 0)
- {
- __n += __ptr_ - *__m_iter_;
- if (__n > 0)
- {
- __m_iter_ += __n / __block_size;
- __ptr_ = *__m_iter_ + __n % __block_size;
- }
- else // (__n < 0)
- {
- difference_type __z = __block_size - 1 - __n;
- __m_iter_ -= __z / __block_size;
- __ptr_ = *__m_iter_ + (__block_size - 1 - __z % __block_size);
- }
- }
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator++(int) {
+ __deque_iterator __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator-=(difference_type __n)
- {
- return *this += -__n;
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator--() {
+ if (__ptr_ == *__m_iter_) {
+ --__m_iter_;
+ __ptr_ = *__m_iter_ + __block_size;
}
+ --__ptr_;
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator+(difference_type __n) const
- {
- __deque_iterator __t(*this);
- __t += __n;
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator--(int) {
+ __deque_iterator __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator-(difference_type __n) const
- {
- __deque_iterator __t(*this);
- __t -= __n;
- return __t;
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator+=(difference_type __n) {
+ if (__n != 0) {
+ __n += __ptr_ - *__m_iter_;
+ if (__n > 0) {
+ __m_iter_ += __n / __block_size;
+ __ptr_ = *__m_iter_ + __n % __block_size;
+ } else // (__n < 0)
+ {
+ difference_type __z = __block_size - 1 - __n;
+ __m_iter_ -= __z / __block_size;
+ __ptr_ = *__m_iter_ + (__block_size - 1 - __z % __block_size);
+ }
}
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it)
- {return __it + __n;}
-
- _LIBCPP_HIDE_FROM_ABI
- friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y)
- {
- if (__x != __y)
- return (__x.__m_iter_ - __y.__m_iter_) * __block_size
- + (__x.__ptr_ - *__x.__m_iter_)
- - (__y.__ptr_ - *__y.__m_iter_);
- return 0;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator-=(difference_type __n) { return *this += -__n; }
+
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator+(difference_type __n) const {
+ __deque_iterator __t(*this);
+ __t += __n;
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __deque_iterator operator-(difference_type __n) const {
+ __deque_iterator __t(*this);
+ __t -= __n;
+ return __t;
+ }
- _LIBCPP_HIDE_FROM_ABI reference operator[](difference_type __n) const
- {return *(*this + __n);}
+ _LIBCPP_HIDE_FROM_ABI friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it) {
+ return __it + __n;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator==(const __deque_iterator& __x, const __deque_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
+ _LIBCPP_HIDE_FROM_ABI friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y) {
+ if (__x != __y)
+ return (__x.__m_iter_ - __y.__m_iter_) * __block_size + (__x.__ptr_ - *__x.__m_iter_) -
+ (__y.__ptr_ - *__y.__m_iter_);
+ return 0;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI reference operator[](difference_type __n) const { return *(*this + __n); }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator<(const __deque_iterator& __x, const __deque_iterator& __y)
- {return __x.__m_iter_ < __y.__m_iter_ ||
- (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return !(__x == __y);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator>(const __deque_iterator& __x, const __deque_iterator& __y)
- {return __y < __x;}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator>(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return __y < __x;
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y)
- {return !(__y < __x);}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return !(__y < __x);
+ }
- _LIBCPP_HIDE_FROM_ABI friend
- bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y)
- {return !(__x < __y);}
+ _LIBCPP_HIDE_FROM_ABI friend bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ return !(__x < __y);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
- : __m_iter_(__m), __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
+ : __m_iter_(__m),
+ __ptr_(__p) {}
- template <class _Tp, class _Ap> friend class _LIBCPP_TEMPLATE_VIS deque;
- template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
- friend class _LIBCPP_TEMPLATE_VIS __deque_iterator;
+ template <class _Tp, class _Ap>
+ friend class _LIBCPP_TEMPLATE_VIS deque;
+ template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
+ friend class _LIBCPP_TEMPLATE_VIS __deque_iterator;
- template <class>
- friend struct __segmented_iterator_traits;
+ template <class>
+ friend struct __segmented_iterator_traits;
};
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BlockSize>
@@ -428,37 +419,34 @@ private:
public:
using __is_segmented_iterator = true_type;
- using __segment_iterator = _MapPointer;
- using __local_iterator = _Pointer;
+ using __segment_iterator = _MapPointer;
+ using __local_iterator = _Pointer;
static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; }
static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; }
static _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) { return *__iter; }
static _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) {
- return *__iter + _Iterator::__block_size;
+ return *__iter + _Iterator::__block_size;
}
static _LIBCPP_HIDE_FROM_ABI _Iterator __compose(__segment_iterator __segment, __local_iterator __local) {
- if (__segment && __local == __end(__segment)) {
- ++__segment;
- return _Iterator(__segment, *__segment);
- }
- return _Iterator(__segment, __local);
+ if (__segment && __local == __end(__segment)) {
+ ++__segment;
+ return _Iterator(__segment, *__segment);
+ }
+ return _Iterator(__segment, __local);
}
};
-template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
- class _DiffType, _DiffType _BlockSize>
-const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
- _DiffType, _BlockSize>::__block_size =
+template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BlockSize>
+const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>::__block_size =
__deque_block_size<_ValueType, _DiffType>::value;
template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS deque
-{
+class _LIBCPP_TEMPLATE_VIS deque {
public:
- // types:
+ // types:
using value_type = _Tp;
@@ -503,8 +491,9 @@ public:
private:
struct __deque_block_range {
- explicit _LIBCPP_HIDE_FROM_ABI
- __deque_block_range(pointer __b, pointer __e) _NOEXCEPT : __begin_(__b), __end_(__e) {}
+ explicit _LIBCPP_HIDE_FROM_ABI __deque_block_range(pointer __b, pointer __e) _NOEXCEPT
+ : __begin_(__b),
+ __end_(__e) {}
const pointer __begin_;
const pointer __end_;
};
@@ -513,22 +502,15 @@ private:
iterator __pos_;
const iterator __end_;
- _LIBCPP_HIDE_FROM_ABI __deque_range(iterator __pos, iterator __e) _NOEXCEPT
- : __pos_(__pos), __end_(__e) {}
+ _LIBCPP_HIDE_FROM_ABI __deque_range(iterator __pos, iterator __e) _NOEXCEPT : __pos_(__pos), __end_(__e) {}
- explicit _LIBCPP_HIDE_FROM_ABI operator bool() const _NOEXCEPT {
- return __pos_ != __end_;
- }
+ explicit _LIBCPP_HIDE_FROM_ABI operator bool() const _NOEXCEPT { return __pos_ != __end_; }
- _LIBCPP_HIDE_FROM_ABI __deque_range begin() const {
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_range begin() const { return *this; }
- _LIBCPP_HIDE_FROM_ABI __deque_range end() const {
- return __deque_range(__end_, __end_);
- }
+ _LIBCPP_HIDE_FROM_ABI __deque_range end() const { return __deque_range(__end_, __end_); }
_LIBCPP_HIDE_FROM_ABI __deque_block_range operator*() const _NOEXCEPT {
- if (__pos_.__m_iter_ == __end_.__m_iter_) {
+ if (__pos_.__m_iter_ == __end_.__m_iter_) {
return __deque_block_range(__pos_.__ptr_, __end_.__ptr_);
}
return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size);
@@ -544,7 +526,6 @@ private:
return *this;
}
-
_LIBCPP_HIDE_FROM_ABI friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
return __lhs.__pos_ == __rhs.__pos_;
}
@@ -555,15 +536,13 @@ private:
struct _ConstructTransaction {
_LIBCPP_HIDE_FROM_ABI _ConstructTransaction(deque* __db, __deque_block_range& __r)
- : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {}
+ : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {}
-
- _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
- __base_->__size() += (__pos_ - __begin_);
- }
+ _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { __base_->__size() += (__pos_ - __begin_); }
pointer __pos_;
const pointer __end_;
+
private:
const pointer __begin_;
deque* const __base_;
@@ -576,53 +555,49 @@ private:
__compressed_pair<size_type, allocator_type> __size_;
public:
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+ : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ }
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- : __start_(0), __size_(0, __default_init_tag()) {
- __annotate_new(0);
- }
-
- _LIBCPP_HIDE_FROM_ABI ~deque() {
- clear();
- __annotate_delete();
- typename __map::iterator __i = __map_.begin();
- typename __map::iterator __e = __map_.end();
- for (; __i != __e; ++__i)
- __alloc_traits::deallocate(__alloc(), *__i, __block_size);
- }
+ _LIBCPP_HIDE_FROM_ABI ~deque() {
+ clear();
+ __annotate_delete();
+ typename __map::iterator __i = __map_.begin();
+ typename __map::iterator __e = __map_.end();
+ for (; __i != __e; ++__i)
+ __alloc_traits::deallocate(__alloc(), *__i, __block_size);
+ }
- _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
- __annotate_new(0);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a)
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ }
- explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n);
+ explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n);
#if _LIBCPP_STD_VER >= 14
- explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a);
+ explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
-
- template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
- _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
- {
- __annotate_new(0);
- if (__n > 0)
- __append(__n, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
+
+ template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
+ _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a)
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n, __v);
+ }
- template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l);
- template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a);
+ template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l);
+ template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range,
- const allocator_type& __a = allocator_type())
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
__append_with_size(ranges::begin(__range), ranges::distance(__range));
@@ -634,688 +609,620 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI deque(const deque& __c);
- _LIBCPP_HIDE_FROM_ABI deque(const deque& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI deque(const deque& __c);
+ _LIBCPP_HIDE_FROM_ABI deque(const deque& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c);
+ _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI
- deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI
- deque(deque&& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI
- deque& operator=(deque&& __c)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
-
- _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI deque& operator=(initializer_list<value_type> __il) {
+ assign(__il);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI deque(deque&& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c)
+ _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<allocator_type>::value);
+
+ _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
- !__has_random_access_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void assign(_InputIter __f, _InputIter __l);
- template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void assign(_RAIter __f, _RAIter __l);
+ template <class _InputIter,
+ __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
+ !__has_random_access_iterator_category<_InputIter>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void assign(_InputIter __f, _InputIter __l);
+ template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void assign(_RAIter __f, _RAIter __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void assign_range(_Range&& __range) {
- if constexpr (ranges::random_access_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size_random_access(ranges::begin(__range), __n);
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
+ if constexpr (ranges::random_access_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size_random_access(ranges::begin(__range), __n);
- } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size(ranges::begin(__range), __n);
+ } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size(ranges::begin(__range), __n);
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __size_.second(); }
_LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __size_.second(); }
// iterators:
_LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
- __map_pointer __mp = __map_.begin() + __start_ / __block_size;
- return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
+ __map_pointer __mp = __map_.begin() + __start_ / __block_size;
+ return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
_LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
- __map_const_pointer __mp =
- static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
- return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
+ __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
+ return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
_LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
- size_type __p = size() + __start_;
- __map_pointer __mp = __map_.begin() + __p / __block_size;
- return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
+ size_type __p = size() + __start_;
+ __map_pointer __mp = __map_.begin() + __p / __block_size;
+ return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
}
_LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
- size_type __p = size() + __start_;
- __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
- return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT
- {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT
- {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
+ size_type __p = size() + __start_;
+ __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
+ return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
+ }
- // capacity:
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __size();}
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ // capacity:
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size(); }
_LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_.first(); }
_LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_.first(); }
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {return std::min<size_type>(
- __alloc_traits::max_size(__alloc()),
- numeric_limits<difference_type>::max());}
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return size() == 0;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI
- reference operator[](size_type __i) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_reference operator[](size_type __i) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- reference at(size_type __i);
- _LIBCPP_HIDE_FROM_ABI
- const_reference at(size_type __i) const;
- _LIBCPP_HIDE_FROM_ABI
- reference front() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- reference back() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- const_reference back() const _NOEXCEPT;
-
- // 23.2.2.3 modifiers:
- _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__alloc_traits::max_size(__alloc()), numeric_limits<difference_type>::max());
+ }
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __i) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI reference at(size_type __i);
+ _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __i) const;
+ _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT;
+
+ // 23.2.2.3 modifiers:
+ _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v);
#ifndef _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER >= 17
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_back (_Args&&... __args);
-#else
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI void emplace_back (_Args&&... __args);
-#endif
- template <class... _Args> _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
-
- _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
- _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v);
-
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void prepend_range(_Range&& __range) {
- insert_range(begin(), std::forward<_Range>(__range));
- }
+# if _LIBCPP_STD_VER >= 17
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
+# else
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
+# endif
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
+
+ _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
+ _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v);
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
+ insert_range(begin(), std::forward<_Range>(__range));
+ }
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
-#endif
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
+# endif
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v);
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, initializer_list<value_type> __il)
- {return insert(__p, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, initializer_list<value_type> __il) {
+ return insert(__p, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __v);
- template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InputIter __f, _InputIter __l);
- template <class _ForwardIterator, __enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l);
- template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _BiIter __f, _BiIter __l);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __v);
+ template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InputIter __f, _InputIter __l);
+ template <class _ForwardIterator,
+ __enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l);
+ template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _BiIter __f, _BiIter __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::bidirectional_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_bidirectional(__position, ranges::begin(__range), ranges::end(__range), __n);
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::bidirectional_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_bidirectional(__position, ranges::begin(__range), ranges::end(__range), __n);
- } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), __n);
+ } else if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), __n);
- } else {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ } else {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void pop_front();
- _LIBCPP_HIDE_FROM_ABI void pop_back();
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI void pop_front();
+ _LIBCPP_HIDE_FROM_ABI void pop_back();
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI
- void swap(deque& __c)
+ _LIBCPP_HIDE_FROM_ABI void swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- bool __invariants() const {
- if (!__map_.__invariants())
- return false;
- if (__map_.size() >= size_type(-1) / __block_size)
- return false;
- for (__map_const_iterator __i = __map_.begin(), __e = __map_.end();
- __i != __e; ++__i)
- if (*__i == nullptr)
- return false;
- if (__map_.size() != 0)
- {
- if (size() >= __map_.size() * __block_size)
- return false;
- if (__start_ >= __map_.size() * __block_size - size())
- return false;
- }
- else
- {
- if (size() != 0)
- return false;
- if (__start_ != 0)
- return false;
- }
- return true;
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI bool __invariants() const {
+ if (!__map_.__invariants())
+ return false;
+ if (__map_.size() >= size_type(-1) / __block_size)
+ return false;
+ for (__map_const_iterator __i = __map_.begin(), __e = __map_.end(); __i != __e; ++__i)
+ if (*__i == nullptr)
+ return false;
+ if (__map_.size() != 0) {
+ if (size() >= __map_.size() * __block_size)
+ return false;
+ if (__start_ >= __map_.size() * __block_size - size())
+ return false;
+ } else {
+ if (size() != 0)
+ return false;
+ if (__start_ != 0)
+ return false;
}
+ return true;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(deque& __c)
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(deque& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
- __alloc() = std::move(__c.__alloc());
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(deque&, false_type) _NOEXCEPT
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign(deque& __c)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
- {
- __map_ = std::move(__c.__map_);
- __start_ = __c.__start_;
- __size() = __c.size();
- __move_assign_alloc(__c);
- __c.__start_ = __c.__size() = 0;
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __alloc() = std::move(__c.__alloc());
+ }
- _LIBCPP_HIDE_FROM_ABI
- static size_type __recommend_blocks(size_type __n)
- {
- return __n / __block_size + (__n % __block_size != 0);
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __capacity() const
- {
- return __map_.size() == 0 ? 0 : __map_.size() * __block_size - 1;
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __block_count() const
- {
- return __map_.size();
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque&, false_type) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI
- size_type __front_spare() const
- {
- return __start_;
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __front_spare_blocks() const {
- return __front_spare() / __block_size;
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __back_spare() const
- {
- return __capacity() - (__start_ + size());
- }
- _LIBCPP_HIDE_FROM_ABI
- size_type __back_spare_blocks() const {
- return __back_spare() / __block_size;
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c)
+ _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __map_ = std::move(__c.__map_);
+ __start_ = __c.__start_;
+ __size() = __c.size();
+ __move_assign_alloc(__c);
+ __c.__start_ = __c.__size() = 0;
+ }
- private:
- enum __asan_annotation_type {
- __asan_unposion,
- __asan_poison
- };
+ _LIBCPP_HIDE_FROM_ABI static size_type __recommend_blocks(size_type __n) {
+ return __n / __block_size + (__n % __block_size != 0);
+ }
+ _LIBCPP_HIDE_FROM_ABI size_type __capacity() const {
+ return __map_.size() == 0 ? 0 : __map_.size() * __block_size - 1;
+ }
+ _LIBCPP_HIDE_FROM_ABI size_type __block_count() const { return __map_.size(); }
- enum __asan_annotation_place {
- __asan_front_moved,
- __asan_back_moved,
- };
+ _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const { return __start_; }
+ _LIBCPP_HIDE_FROM_ABI size_type __front_spare_blocks() const { return __front_spare() / __block_size; }
+ _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const { return __capacity() - (__start_ + size()); }
+ _LIBCPP_HIDE_FROM_ABI size_type __back_spare_blocks() const { return __back_spare() / __block_size; }
-// The following functions are no-ops outside of AddressSanitizer mode.
-// We call annotations for every allocator, unless explicitly disabled.
-//
-// To disable annotations for a particular allocator, change value of
-// __asan_annotate_container_with_allocator to false.
-// For more details, see the "Using libc++" documentation page or
-// the documentation for __sanitizer_annotate_contiguous_container.
- _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
- const void* __beg,
- const void* __end,
- const void* __old_con_beg,
- const void* __old_con_end,
- const void* __new_con_beg,
- const void* __new_con_end) const {
- (void)__beg;
- (void)__end;
- (void)__old_con_beg;
- (void)__old_con_end;
- (void)__new_con_beg;
- (void)__new_con_end;
+private:
+ enum __asan_annotation_type { __asan_unposion, __asan_poison };
+
+ enum __asan_annotation_place {
+ __asan_front_moved,
+ __asan_back_moved,
+ };
+
+ // The following functions are no-ops outside of AddressSanitizer mode.
+ // We call annotations for every allocator, unless explicitly disabled.
+ //
+ // To disable annotations for a particular allocator, change value of
+ // __asan_annotate_container_with_allocator to false.
+ // For more details, see the "Using libc++" documentation page or
+ // the documentation for __sanitizer_annotate_contiguous_container.
+ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
+ const void* __beg,
+ const void* __end,
+ const void* __old_con_beg,
+ const void* __old_con_end,
+ const void* __new_con_beg,
+ const void* __new_con_end) const {
+ (void)__beg;
+ (void)__end;
+ (void)__old_con_beg;
+ (void)__old_con_end;
+ (void)__new_con_beg;
+ (void)__new_con_end;
#ifndef _LIBCPP_HAS_NO_ASAN
- if (__beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
- __sanitizer_annotate_double_ended_contiguous_container(
- __beg, __end, __old_con_beg, __old_con_end, __new_con_beg, __new_con_end);
+ if (__beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
+ __sanitizer_annotate_double_ended_contiguous_container(
+ __beg, __end, __old_con_beg, __old_con_end, __new_con_beg, __new_con_end);
#endif
- }
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_from_to(
- size_type __beg,
- size_type __end,
- __asan_annotation_type __annotation_type,
- __asan_annotation_place __place) const _NOEXCEPT {
- (void)__beg;
- (void)__end;
- (void)__annotation_type;
- (void)__place;
+ _LIBCPP_HIDE_FROM_ABI void __annotate_from_to(
+ size_type __beg,
+ size_type __end,
+ __asan_annotation_type __annotation_type,
+ __asan_annotation_place __place) const _NOEXCEPT {
+ (void)__beg;
+ (void)__end;
+ (void)__annotation_type;
+ (void)__place;
#ifndef _LIBCPP_HAS_NO_ASAN
- // __beg - index of the first item to annotate
- // __end - index behind the last item to annotate (so last item + 1)
- // __annotation_type - __asan_unposion or __asan_poison
- // __place - __asan_front_moved or __asan_back_moved
- // Note: All indexes in __map_
- if (__beg == __end)
- return;
- // __annotations_beg_map - first chunk which annotations we want to modify
- // __annotations_end_map - last chunk which annotations we want to modify
- // NOTE: if __end % __block_size == 0, __annotations_end_map points at the next block, which may not exist
- __map_const_iterator __annotations_beg_map = __map_.begin() + __beg / __block_size;
- __map_const_iterator __annotations_end_map = __map_.begin() + __end / __block_size;
-
- bool const __poisoning = __annotation_type == __asan_poison;
- // __old_c_beg_index - index of the first element in old container
- // __old_c_end_index - index of the end of old container (last + 1)
- // Note: may be outside the area we are annotating
- size_t __old_c_beg_index = (__poisoning && __place == __asan_front_moved) ? __beg : __start_;
- size_t __old_c_end_index = (__poisoning && __place == __asan_back_moved) ? __end : __start_ + size();
- bool const __front = __place == __asan_front_moved;
-
- if (__poisoning && empty()) {
- // Special case: we shouldn't trust __start_
- __old_c_beg_index = __beg;
- __old_c_end_index = __end;
- }
- // __old_c_beg_map - memory block (chunk) with first element
- // __old_c_end_map - memory block (chunk) with end of old container
- // Note: if __old_c_end_index % __block_size == 0, __old_c_end_map points at the next block,
- // which may not exist
- __map_const_iterator __old_c_beg_map = __map_.begin() + __old_c_beg_index / __block_size;
- __map_const_iterator __old_c_end_map = __map_.begin() + __old_c_end_index / __block_size;
-
- // One edge (front/end) of the container was moved and one was not modified.
- // __new_edge_index - index of new edge
- // __new_edge_map - memory block (chunk) with new edge, it always equals to
- // __annotations_beg_map or __annotations_end_map
- // __old_edge_map - memory block (chunk) with old edge, it always equals to
- // __old_c_beg_map or __old_c_end_map
- size_t __new_edge_index = (__poisoning ^ __front) ? __beg : __end;
- __map_const_iterator __new_edge_map = __map_.begin() + __new_edge_index / __block_size;
- __map_const_iterator __old_edge_map = __front ? __old_c_end_map : __old_c_beg_map;
-
- // We iterate over map pointers (chunks) and fully poison all memory blocks between the first and the last.
- // First and last chunk may be partially poisoned.
- // __annotate_end_map may point at not existing chunk, therefore we have to have a check for it.
- for (__map_const_iterator __map_it = __annotations_beg_map; __map_it <= __annotations_end_map; ++__map_it) {
- if (__map_it == __annotations_end_map && __end % __block_size == 0)
- // Chunk may not exist, but nothing to do here anyway
- break;
-
- // The beginning and the end of the current memory block
- const void* __mem_beg = std::__to_address(*__map_it);
- const void* __mem_end = std::__to_address(*__map_it + __block_size);
-
- // The beginning of memory-in-use in the memory block before container modification
- const void* __old_beg =
- (__map_it == __old_c_beg_map) ? std::__to_address(*__map_it + (__old_c_beg_index % __block_size)) : __mem_beg;
-
- // The end of memory-in-use in the memory block before container modification
- const void* __old_end;
- if (__map_it < __old_c_beg_map || __map_it > __old_c_end_map || (!__poisoning && empty()))
- __old_end = __old_beg;
- else
- __old_end = (__map_it == __old_c_end_map) ? std::__to_address(*__map_it + (__old_c_end_index % __block_size))
- : __mem_end;
-
- // New edge of the container in current memory block
- // If the edge is in a different chunk it points on corresponding end of the memory block
- const void* __new_edge;
- if (__map_it == __new_edge_map)
- __new_edge = std::__to_address(*__map_it + (__new_edge_index % __block_size));
- else
- __new_edge = (__poisoning ^ __front) ? __mem_beg : __mem_end;
-
- // Not modified edge of the container
- // If the edge is in a different chunk it points on corresponding end of the memory block
- const void* __old_edge;
- if (__map_it == __old_edge_map)
- __old_edge = __front ? __old_end : __old_beg;
- else
- __old_edge = __front ? __mem_end : __mem_beg;
-
- // __new_beg - the beginning of memory-in-use in the memory block after container modification
- // __new_end - the end of memory-in-use in the memory block after container modification
- const void* __new_beg = __front ? __new_edge : __old_edge;
- const void* __new_end = __front ? __old_edge : __new_edge;
-
- __annotate_double_ended_contiguous_container(__mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end);
- }
-#endif // !_LIBCPP_HAS_NO_ASAN
- }
+ // __beg - index of the first item to annotate
+ // __end - index behind the last item to annotate (so last item + 1)
+ // __annotation_type - __asan_unposion or __asan_poison
+ // __place - __asan_front_moved or __asan_back_moved
+ // Note: All indexes in __map_
+ if (__beg == __end)
+ return;
+ // __annotations_beg_map - first chunk which annotations we want to modify
+ // __annotations_end_map - last chunk which annotations we want to modify
+ // NOTE: if __end % __block_size == 0, __annotations_end_map points at the next block, which may not exist
+ __map_const_iterator __annotations_beg_map = __map_.begin() + __beg / __block_size;
+ __map_const_iterator __annotations_end_map = __map_.begin() + __end / __block_size;
+
+ bool const __poisoning = __annotation_type == __asan_poison;
+ // __old_c_beg_index - index of the first element in old container
+ // __old_c_end_index - index of the end of old container (last + 1)
+ // Note: may be outside the area we are annotating
+ size_t __old_c_beg_index = (__poisoning && __place == __asan_front_moved) ? __beg : __start_;
+ size_t __old_c_end_index = (__poisoning && __place == __asan_back_moved) ? __end : __start_ + size();
+ bool const __front = __place == __asan_front_moved;
+
+ if (__poisoning && empty()) {
+ // Special case: we shouldn't trust __start_
+ __old_c_beg_index = __beg;
+ __old_c_end_index = __end;
+ }
+ // __old_c_beg_map - memory block (chunk) with first element
+ // __old_c_end_map - memory block (chunk) with end of old container
+ // Note: if __old_c_end_index % __block_size == 0, __old_c_end_map points at the next block,
+ // which may not exist
+ __map_const_iterator __old_c_beg_map = __map_.begin() + __old_c_beg_index / __block_size;
+ __map_const_iterator __old_c_end_map = __map_.begin() + __old_c_end_index / __block_size;
+
+ // One edge (front/end) of the container was moved and one was not modified.
+ // __new_edge_index - index of new edge
+ // __new_edge_map - memory block (chunk) with new edge, it always equals to
+ // __annotations_beg_map or __annotations_end_map
+ // __old_edge_map - memory block (chunk) with old edge, it always equals to
+ // __old_c_beg_map or __old_c_end_map
+ size_t __new_edge_index = (__poisoning ^ __front) ? __beg : __end;
+ __map_const_iterator __new_edge_map = __map_.begin() + __new_edge_index / __block_size;
+ __map_const_iterator __old_edge_map = __front ? __old_c_end_map : __old_c_beg_map;
+
+ // We iterate over map pointers (chunks) and fully poison all memory blocks between the first and the last.
+ // First and last chunk may be partially poisoned.
+ // __annotate_end_map may point at not existing chunk, therefore we have to have a check for it.
+ for (__map_const_iterator __map_it = __annotations_beg_map; __map_it <= __annotations_end_map; ++__map_it) {
+ if (__map_it == __annotations_end_map && __end % __block_size == 0)
+ // Chunk may not exist, but nothing to do here anyway
+ break;
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_new(size_type __current_size) const _NOEXCEPT {
- if (__current_size == 0)
- __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
- else {
- __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved);
- __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
- }
+ // The beginning and the end of the current memory block
+ const void* __mem_beg = std::__to_address(*__map_it);
+ const void* __mem_end = std::__to_address(*__map_it + __block_size);
+
+ // The beginning of memory-in-use in the memory block before container modification
+ const void* __old_beg =
+ (__map_it == __old_c_beg_map) ? std::__to_address(*__map_it + (__old_c_beg_index % __block_size)) : __mem_beg;
+
+ // The end of memory-in-use in the memory block before container modification
+ const void* __old_end;
+ if (__map_it < __old_c_beg_map || __map_it > __old_c_end_map || (!__poisoning && empty()))
+ __old_end = __old_beg;
+ else
+ __old_end = (__map_it == __old_c_end_map)
+ ? std::__to_address(*__map_it + (__old_c_end_index % __block_size))
+ : __mem_end;
+
+ // New edge of the container in current memory block
+ // If the edge is in a different chunk it points on corresponding end of the memory block
+ const void* __new_edge;
+ if (__map_it == __new_edge_map)
+ __new_edge = std::__to_address(*__map_it + (__new_edge_index % __block_size));
+ else
+ __new_edge = (__poisoning ^ __front) ? __mem_beg : __mem_end;
+
+ // Not modified edge of the container
+ // If the edge is in a different chunk it points on corresponding end of the memory block
+ const void* __old_edge;
+ if (__map_it == __old_edge_map)
+ __old_edge = __front ? __old_end : __old_beg;
+ else
+ __old_edge = __front ? __mem_end : __mem_beg;
+
+ // __new_beg - the beginning of memory-in-use in the memory block after container modification
+ // __new_end - the end of memory-in-use in the memory block after container modification
+ const void* __new_beg = __front ? __new_edge : __old_edge;
+ const void* __new_end = __front ? __old_edge : __new_edge;
+
+ __annotate_double_ended_contiguous_container(__mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end);
}
+#endif // !_LIBCPP_HAS_NO_ASAN
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_delete() const _NOEXCEPT {
- if (empty()) {
- for(size_t __i = 0; __i < __map_.size(); ++__i) {
- __annotate_whole_block(__i, __asan_unposion);
- }
- }
- else {
- __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved);
- __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
+ (void)__current_size;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ if (__current_size == 0)
+ __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
+ else {
+ __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved);
+ __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
}
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_increase_front(size_type __n) const _NOEXCEPT {
- __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved);
+ _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
+#ifndef _LIBCPP_HAS_NO_ASAN
+ if (empty()) {
+ for (size_t __i = 0; __i < __map_.size(); ++__i) {
+ __annotate_whole_block(__i, __asan_unposion);
+ }
+ } else {
+ __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved);
+ __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved);
}
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_increase_back(size_type __n) const _NOEXCEPT {
- __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT {
+ (void)__n;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
- __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT {
+ (void)__n;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
- __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
+ (void)__old_size;
+ (void)__old_start;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_poison_block(const void *__beginning, const void *__end) const _NOEXCEPT {
- __annotate_double_ended_contiguous_container(__beginning, __end, __beginning, __end, __end, __end);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
+ (void)__old_size;
+ (void)__old_start;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT {
- __map_const_iterator __block_it = __map_.begin() + __block_index;
- const void* __block_start = std::__to_address(*__block_it);
- const void* __block_end = std::__to_address(*__block_it + __block_size);
-
- if(__annotation_type == __asan_poison)
- __annotate_poison_block(__block_start, __block_end);
- else {
- __annotate_double_ended_contiguous_container(
- __block_start, __block_end, __block_start, __block_start, __block_start, __block_end);
- }
+ _LIBCPP_HIDE_FROM_ABI void __annotate_poison_block(const void* __beginning, const void* __end) const _NOEXCEPT {
+ (void)__beginning;
+ (void)__end;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_double_ended_contiguous_container(__beginning, __end, __beginning, __end, __end, __end);
+#endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void
+ __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT {
+ (void)__block_index;
+ (void)__annotation_type;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __map_const_iterator __block_it = __map_.begin() + __block_index;
+ const void* __block_start = std::__to_address(*__block_it);
+ const void* __block_end = std::__to_address(*__block_it + __block_size);
+
+ if (__annotation_type == __asan_poison)
+ __annotate_poison_block(__block_start, __block_end);
+ else {
+ __annotate_double_ended_contiguous_container(
+ __block_start, __block_end, __block_start, __block_start, __block_start, __block_end);
}
+#endif
+ }
#if !defined(_LIBCPP_HAS_NO_ASAN)
- public:
- _LIBCPP_HIDE_FROM_ABI
- bool __verify_asan_annotations() const _NOEXCEPT {
- // This function tests deque object annotations.
- if (empty()) {
- for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
- if (!__sanitizer_verify_double_ended_contiguous_container(
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it + __block_size)))
- return false;
- }
-
- return true;
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT {
+ // This function tests deque object annotations.
+ if (empty()) {
+ for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
+ if (!__sanitizer_verify_double_ended_contiguous_container(
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it + __block_size)))
+ return false;
+ }
- size_type __end = __start_ + size();
- __map_const_iterator __first_mp = __map_.begin() + __start_ / __block_size;
- __map_const_iterator __last_mp = __map_.begin() + (__end - 1) / __block_size;
-
- // Pointers to first and after last elements
- // Those can be in different deque blocks
- const void* __p_beg = std::__to_address(*__first_mp + (__start_ % __block_size));
- const void* __p_end =
- std::__to_address(*__last_mp + ((__end % __block_size == 0) ? __block_size : __end % __block_size));
-
- for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
- // Go over all blocks, find the place we are in and verify its annotations
- // Note that __p_end points *behind* the last item.
-
- // - blocks before the first block with container elements
- // - first block with items
- // - last block with items
- // - blocks after last block with ciontainer elements
-
- // Is the block before or after deque blocks that contain elements?
- if (__it < __first_mp || __it > __last_mp) {
- if (!__sanitizer_verify_double_ended_contiguous_container(
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it),
- std::__to_address(*__it + __block_size)))
- return false;
- } else {
- const void* __containers_buffer_beg = (__it == __first_mp) ? __p_beg : (const void*)std::__to_address(*__it);
- const void* __containers_buffer_end =
- (__it == __last_mp) ? __p_end : (const void*)std::__to_address(*__it + __block_size);
- if (!__sanitizer_verify_double_ended_contiguous_container(
- std::__to_address(*__it),
- __containers_buffer_beg,
- __containers_buffer_end,
- std::__to_address(*__it + __block_size))) {
- return false;
- }
- }
- }
- return true;
+ return true;
}
- private:
-#endif // _LIBCPP_VERIFY_ASAN_DEQUE_ANNOTATIONS
- _LIBCPP_HIDE_FROM_ABI
- bool __maybe_remove_front_spare(bool __keep_one = true) {
- if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
- __annotate_whole_block(0, __asan_unposion);
- __alloc_traits::deallocate(__alloc(), __map_.front(),
- __block_size);
- __map_.pop_front();
- __start_ -= __block_size;
- return true;
+ size_type __end = __start_ + size();
+ __map_const_iterator __first_mp = __map_.begin() + __start_ / __block_size;
+ __map_const_iterator __last_mp = __map_.begin() + (__end - 1) / __block_size;
+
+ // Pointers to first and after last elements
+ // Those can be in different deque blocks
+ const void* __p_beg = std::__to_address(*__first_mp + (__start_ % __block_size));
+ const void* __p_end =
+ std::__to_address(*__last_mp + ((__end % __block_size == 0) ? __block_size : __end % __block_size));
+
+ for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
+ // Go over all blocks, find the place we are in and verify its annotations
+ // Note that __p_end points *behind* the last item.
+
+ // - blocks before the first block with container elements
+ // - first block with items
+ // - last block with items
+ // - blocks after last block with ciontainer elements
+
+ // Is the block before or after deque blocks that contain elements?
+ if (__it < __first_mp || __it > __last_mp) {
+ if (!__sanitizer_verify_double_ended_contiguous_container(
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it),
+ std::__to_address(*__it + __block_size)))
+ return false;
+ } else {
+ const void* __containers_buffer_beg = (__it == __first_mp) ? __p_beg : (const void*)std::__to_address(*__it);
+ const void* __containers_buffer_end =
+ (__it == __last_mp) ? __p_end : (const void*)std::__to_address(*__it + __block_size);
+ if (!__sanitizer_verify_double_ended_contiguous_container(
+ std::__to_address(*__it),
+ __containers_buffer_beg,
+ __containers_buffer_end,
+ std::__to_address(*__it + __block_size))) {
+ return false;
+ }
}
- return false;
}
+ return true;
+ }
- _LIBCPP_HIDE_FROM_ABI
- bool __maybe_remove_back_spare(bool __keep_one = true) {
- if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) {
- __annotate_whole_block(__map_.size() - 1, __asan_unposion);
- __alloc_traits::deallocate(__alloc(), __map_.back(),
- __block_size);
- __map_.pop_back();
- return true;
- }
- return false;
+private:
+#endif // _LIBCPP_VERIFY_ASAN_DEQUE_ANNOTATIONS
+ _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) {
+ if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
+ __annotate_whole_block(0, __asan_unposion);
+ __alloc_traits::deallocate(__alloc(), __map_.front(), __block_size);
+ __map_.pop_front();
+ __start_ -= __block_size;
+ return true;
+ }
+ return false;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_back_spare(bool __keep_one = true) {
+ if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) {
+ __annotate_whole_block(__map_.size() - 1, __asan_unposion);
+ __alloc_traits::deallocate(__alloc(), __map_.back(), __block_size);
+ __map_.pop_back();
+ return true;
}
+ return false;
+ }
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
-
- template <class _RandomAccessIterator>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n);
- template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size(_Iterator __f, difference_type __n);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
-
- template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_size(const_iterator __p, _Iterator __f, size_type __n);
-
- template <class _BiIter, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel __sent, size_type __n);
- template <class _BiIter>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n);
-
- template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __append(_InpIter __f, _InpIter __l);
- template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __append(_ForIter __f, _ForIter __l);
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __append_with_size(_InputIterator __from, size_type __n);
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI void __append_with_sentinel(_InputIterator __f, _Sentinel __l);
-
- _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void __erase_to_end(const_iterator __f);
- _LIBCPP_HIDE_FROM_ABI void __add_front_capacity();
- _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __add_back_capacity();
- _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(size_type __n);
- _LIBCPP_HIDE_FROM_ABI iterator __move_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI iterator __move_backward_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI void __move_construct_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI void __move_construct_backward_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt);
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const deque& __c)
- {__copy_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const deque& __c, true_type)
- {
- if (__alloc() != __c.__alloc())
- {
- clear();
- shrink_to_fit();
- }
- __alloc() = __c.__alloc();
- __map_.__alloc() = __c.__map_.__alloc();
- }
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
+
+ template <class _RandomAccessIterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n);
+ template <class _Iterator>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_size(_Iterator __f, difference_type __n);
+
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
+
+ template <class _Iterator>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_with_size(const_iterator __p, _Iterator __f, size_type __n);
+
+ template <class _BiIter, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel __sent, size_type __n);
+ template <class _BiIter>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n);
+
+ template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __append(_InpIter __f, _InpIter __l);
+ template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __append(_ForIter __f, _ForIter __l);
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void __append_with_size(_InputIterator __from, size_type __n);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI void __append_with_sentinel(_InputIterator __f, _Sentinel __l);
+
+ _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void __erase_to_end(const_iterator __f);
+ _LIBCPP_HIDE_FROM_ABI void __add_front_capacity();
+ _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void __add_back_capacity();
+ _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI iterator __move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_HIDE_FROM_ABI iterator
+ __move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_HIDE_FROM_ABI void __move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_HIDE_FROM_ABI void
+ __move_construct_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c) {
+ __copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const deque&, false_type)
- {}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c, true_type) {
+ if (__alloc() != __c.__alloc()) {
+ clear();
+ shrink_to_fit();
+ }
+ __alloc() = __c.__alloc();
+ __map_.__alloc() = __c.__map_.__alloc();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque&, false_type) {}
- _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, false_type);
};
template <class _Tp, class _Alloc>
@@ -1323,245 +1230,198 @@ _LIBCPP_CONSTEXPR const typename allocator_traits<_Alloc>::difference_type deque
__deque_block_size<value_type, difference_type>::value;
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-deque(_InputIterator, _InputIterator)
- -> deque<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-deque(_InputIterator, _InputIterator, _Alloc)
- -> deque<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+deque(_InputIterator, _InputIterator) -> deque<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+deque(_InputIterator, _InputIterator, _Alloc) -> deque<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-deque(from_range_t, _Range&&, _Alloc = _Alloc())
- -> deque<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+deque(from_range_t, _Range&&, _Alloc = _Alloc()) -> deque<ranges::range_value_t<_Range>, _Alloc>;
#endif
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(size_type __n)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- if (__n > 0)
- __append(__n);
+deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n);
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- if (__n > 0)
- __append(__n);
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n);
}
#endif
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- if (__n > 0)
- __append(__n, __v);
+deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ if (__n > 0)
+ __append(__n, __v);
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
-deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- __append(__f, __l);
+deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ __append(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- __append(__f, __l);
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ __append(__f, __l);
}
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(const deque& __c)
: __map_(__pointer_allocator(__alloc_traits::select_on_container_copy_construction(__c.__alloc()))),
__start_(0),
- __size_(0, __map_.__alloc())
-{
- __annotate_new(0);
- __append(__c.begin(), __c.end());
+ __size_(0, __map_.__alloc()) {
+ __annotate_new(0);
+ __append(__c.begin(), __c.end());
}
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t<allocator_type>& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- __append(__c.begin(), __c.end());
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ __append(__c.begin(), __c.end());
}
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>&
-deque<_Tp, _Allocator>::operator=(const deque& __c)
-{
- if (this != std::addressof(__c))
- {
- __copy_assign_alloc(__c);
- assign(__c.begin(), __c.end());
- }
- return *this;
+deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(const deque& __c) {
+ if (this != std::addressof(__c)) {
+ __copy_assign_alloc(__c);
+ assign(__c.begin(), __c.end());
+ }
+ return *this;
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
- : __start_(0), __size_(0, __default_init_tag())
-{
- __annotate_new(0);
- __append(__il.begin(), __il.end());
+deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il) : __start_(0), __size_(0, __default_init_tag()) {
+ __annotate_new(0);
+ __append(__il.begin(), __il.end());
}
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator_type& __a)
- : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a)
-{
- __annotate_new(0);
- __append(__il.begin(), __il.end());
+ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {
+ __annotate_new(0);
+ __append(__il.begin(), __il.end());
}
template <class _Tp, class _Allocator>
-inline
-deque<_Tp, _Allocator>::deque(deque&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
- : __map_(std::move(__c.__map_)), __start_(std::move(__c.__start_)), __size_(std::move(__c.__size_))
-{
+inline deque<_Tp, _Allocator>::deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+ : __map_(std::move(__c.__map_)), __start_(std::move(__c.__start_)), __size_(std::move(__c.__size_)) {
__c.__start_ = 0;
__c.__size() = 0;
}
template <class _Tp, class _Allocator>
-inline
-deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a)
+inline deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a)
: __map_(std::move(__c.__map_), __pointer_allocator(__a)),
__start_(std::move(__c.__start_)),
- __size_(std::move(__c.__size()), __a)
-{
- if (__a == __c.__alloc())
- {
- __c.__start_ = 0;
- __c.__size() = 0;
- }
- else
- {
- __map_.clear();
- __start_ = 0;
- __size() = 0;
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
+ __size_(std::move(__c.__size()), __a) {
+ if (__a == __c.__alloc()) {
+ __c.__start_ = 0;
+ __c.__size() = 0;
+ } else {
+ __map_.clear();
+ __start_ = 0;
+ __size() = 0;
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ }
}
template <class _Tp, class _Allocator>
-inline
-deque<_Tp, _Allocator>&
-deque<_Tp, _Allocator>::operator=(deque&& __c)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
-{
- __move_assign(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) _NOEXCEPT_(
+ __alloc_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
-{
- if (__alloc() != __c.__alloc())
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
- else
- __move_assign(__c, true_type());
+void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) {
+ if (__alloc() != __c.__alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ } else
+ __move_assign(__c, true_type());
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- clear();
- shrink_to_fit();
- __move_assign(__c);
+void deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ clear();
+ shrink_to_fit();
+ __move_assign(__c);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
- !__has_random_access_iterator_category<_InputIter>::value, int> >
-void
-deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l)
-{
+template <class _InputIter,
+ __enable_if_t<__has_input_iterator_category<_InputIter>::value &&
+ !__has_random_access_iterator_category<_InputIter>::value,
+ int> >
+void deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l) {
__assign_with_sentinel(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
- iterator __i = begin();
- iterator __e = end();
- for (; __f != __l && __i != __e; ++__f, (void) ++__i)
- *__i = *__f;
- if (__f != __l)
- __append_with_sentinel(std::move(__f), std::move(__l));
- else
- __erase_to_end(__i);
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __f != __l && __i != __e; ++__f, (void)++__i)
+ *__i = *__f;
+ if (__f != __l)
+ __append_with_sentinel(std::move(__f), std::move(__l));
+ else
+ __erase_to_end(__i);
}
template <class _Tp, class _Allocator>
template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> >
-void
-deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l)
-{
+void deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l) {
__assign_with_size_random_access(__f, __l - __f);
}
template <class _Tp, class _Allocator>
template <class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n) {
- if (static_cast<size_type>(__n) > size())
- {
- auto __l = __f + size();
- std::copy(__f, __l, begin());
- __append_with_size(__l, __n - size());
- }
- else
- __erase_to_end(std::copy_n(__f, __n, begin()));
+_LIBCPP_HIDE_FROM_ABI void
+deque<_Tp, _Allocator>::__assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n) {
+ if (static_cast<size_type>(__n) > size()) {
+ auto __l = __f + size();
+ std::copy(__f, __l, begin());
+ __append_with_size(__l, __n - size());
+ } else
+ __erase_to_end(std::copy_n(__f, __n, begin()));
}
template <class _Tp, class _Allocator>
template <class _Iterator>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__assign_with_size(_Iterator __f, difference_type __n) {
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__assign_with_size(_Iterator __f, difference_type __n) {
if (static_cast<size_type>(__n) > size()) {
auto __added_size = __n - size();
@@ -1578,1351 +1438,1104 @@ void deque<_Tp, _Allocator>::__assign_with_size(_Iterator __f, difference_type _
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
-{
- if (__n > size())
- {
- std::fill_n(begin(), size(), __v);
- __n -= size();
- __append(__n, __v);
- }
- else
- __erase_to_end(std::fill_n(begin(), __n, __v));
+void deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) {
+ if (__n > size()) {
+ std::fill_n(begin(), size(), __v);
+ __n -= size();
+ __append(__n, __v);
+ } else
+ __erase_to_end(std::fill_n(begin(), __n, __v));
}
template <class _Tp, class _Allocator>
-inline
-_Allocator
-deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
-{
- return __alloc();
+inline _Allocator deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT {
+ return __alloc();
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::resize(size_type __n)
-{
- if (__n > size())
- __append(__n - size());
- else if (__n < size())
- __erase_to_end(begin() + __n);
+void deque<_Tp, _Allocator>::resize(size_type __n) {
+ if (__n > size())
+ __append(__n - size());
+ else if (__n < size())
+ __erase_to_end(begin() + __n);
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v)
-{
- if (__n > size())
- __append(__n - size(), __v);
- else if (__n < size())
- __erase_to_end(begin() + __n);
+void deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) {
+ if (__n > size())
+ __append(__n - size(), __v);
+ else if (__n < size())
+ __erase_to_end(begin() + __n);
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- allocator_type& __a = __alloc();
- if (empty())
- {
- __annotate_delete();
- while (__map_.size() > 0)
- {
- __alloc_traits::deallocate(__a, __map_.back(), __block_size);
- __map_.pop_back();
- }
- __start_ = 0;
- }
- else
- {
- __maybe_remove_front_spare(/*__keep_one=*/false);
- __maybe_remove_back_spare(/*__keep_one=*/false);
+void deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ allocator_type& __a = __alloc();
+ if (empty()) {
+ __annotate_delete();
+ while (__map_.size() > 0) {
+ __alloc_traits::deallocate(__a, __map_.back(), __block_size);
+ __map_.pop_back();
}
- __map_.shrink_to_fit();
+ __start_ = 0;
+ } else {
+ __maybe_remove_front_spare(/*__keep_one=*/false);
+ __maybe_remove_back_spare(/*__keep_one=*/false);
+ }
+ __map_.shrink_to_fit();
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT
-{
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT {
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT
-{
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT {
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::at(size_type __i)
-{
- if (__i >= size())
- std::__throw_out_of_range("deque");
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::at(size_type __i) {
+ if (__i >= size())
+ std::__throw_out_of_range("deque");
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::at(size_type __i) const
-{
- if (__i >= size())
- std::__throw_out_of_range("deque");
- size_type __p = __start_ + __i;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::at(size_type __i) const {
+ if (__i >= size())
+ std::__throw_out_of_range("deque");
+ size_type __p = __start_ + __i;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::front() _NOEXCEPT
-{
- return *(*(__map_.begin() + __start_ / __block_size)
- + __start_ % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::front() _NOEXCEPT {
+ return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::front() const _NOEXCEPT
-{
- return *(*(__map_.begin() + __start_ / __block_size)
- + __start_ % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::front() const _NOEXCEPT {
+ return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::reference
-deque<_Tp, _Allocator>::back() _NOEXCEPT
-{
- size_type __p = size() + __start_ - 1;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::back() _NOEXCEPT {
+ size_type __p = size() + __start_ - 1;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline
-typename deque<_Tp, _Allocator>::const_reference
-deque<_Tp, _Allocator>::back() const _NOEXCEPT
-{
- size_type __p = size() + __start_ - 1;
- return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
+inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::back() const _NOEXCEPT {
+ size_type __p = size() + __start_ - 1;
+ return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_back(const value_type& __v)
-{
- allocator_type& __a = __alloc();
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_spare() >= 1
- __annotate_increase_back(1);
- __alloc_traits::construct(__a, std::addressof(*end()), __v);
- ++__size();
+void deque<_Tp, _Allocator>::push_back(const value_type& __v) {
+ allocator_type& __a = __alloc();
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_spare() >= 1
+ __annotate_increase_back(1);
+ __alloc_traits::construct(__a, std::addressof(*end()), __v);
+ ++__size();
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_front(const value_type& __v)
-{
- allocator_type& __a = __alloc();
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
- --__start_;
- ++__size();
+void deque<_Tp, _Allocator>::push_front(const value_type& __v) {
+ allocator_type& __a = __alloc();
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
+ --__start_;
+ ++__size();
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_back(value_type&& __v)
-{
- allocator_type& __a = __alloc();
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_spare() >= 1
- __annotate_increase_back(1);
- __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
- ++__size();
+void deque<_Tp, _Allocator>::push_back(value_type&& __v) {
+ allocator_type& __a = __alloc();
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_spare() >= 1
+ __annotate_increase_back(1);
+ __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
+ ++__size();
}
template <class _Tp, class _Allocator>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename deque<_Tp, _Allocator>::reference
-#else
+# else
void
-#endif
-deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
-{
- allocator_type& __a = __alloc();
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_spare() >= 1
- __annotate_increase_back(1);
- __alloc_traits::construct(__a, std::addressof(*end()),
- std::forward<_Args>(__args)...);
- ++__size();
-#if _LIBCPP_STD_VER >= 17
- return *--end();
-#endif
+# endif
+deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
+ allocator_type& __a = __alloc();
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_spare() >= 1
+ __annotate_increase_back(1);
+ __alloc_traits::construct(__a, std::addressof(*end()), std::forward<_Args>(__args)...);
+ ++__size();
+# if _LIBCPP_STD_VER >= 17
+ return *--end();
+# endif
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_front(value_type&& __v)
-{
- allocator_type& __a = __alloc();
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
- --__start_;
- ++__size();
+void deque<_Tp, _Allocator>::push_front(value_type&& __v) {
+ allocator_type& __a = __alloc();
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
+ --__start_;
+ ++__size();
}
-
template <class _Tp, class _Allocator>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename deque<_Tp, _Allocator>::reference
-#else
+# else
void
-#endif
-deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
-{
- allocator_type& __a = __alloc();
+# endif
+deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) {
+ allocator_type& __a = __alloc();
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
+ --__start_;
+ ++__size();
+# if _LIBCPP_STD_VER >= 17
+ return *begin();
+# endif
+}
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) {
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
if (__front_spare() == 0)
- __add_front_capacity();
+ __add_front_capacity();
// __front_spare() >= 1
__annotate_increase_front(1);
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
- --__start_;
- ++__size();
-#if _LIBCPP_STD_VER >= 17
- return *begin();
-#endif
-}
-
-template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
-{
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- if (__pos == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
- --__start_;
- ++__size();
- }
- else
- {
- iterator __b = begin();
- iterator __bm1 = std::prev(__b);
- __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
- --__start_;
- ++__size();
- if (__pos > 1)
- __b = std::move(std::next(__b), __b + __pos, __b);
- *__b = std::move(__v);
- }
- }
- else
- { // insert by shifting things forward
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_capacity >= 1
- __annotate_increase_back(1);
- size_type __de = size() - __pos;
- if (__de == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
- ++__size();
- }
- else
- {
- iterator __e = end();
- iterator __em1 = std::prev(__e);
- __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
- ++__size();
- if (__de > 1)
- __e = std::move_backward(__e - __de, __em1, __e);
- *--__e = std::move(__v);
- }
+ if (__pos == 0) {
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::move(__v));
+ --__start_;
+ ++__size();
+ } else {
+ iterator __b = begin();
+ iterator __bm1 = std::prev(__b);
+ __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
+ --__start_;
+ ++__size();
+ if (__pos > 1)
+ __b = std::move(std::next(__b), __b + __pos, __b);
+ *__b = std::move(__v);
+ }
+ } else { // insert by shifting things forward
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_capacity >= 1
+ __annotate_increase_back(1);
+ size_type __de = size() - __pos;
+ if (__de == 0) {
+ __alloc_traits::construct(__a, std::addressof(*end()), std::move(__v));
+ ++__size();
+ } else {
+ iterator __e = end();
+ iterator __em1 = std::prev(__e);
+ __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
+ ++__size();
+ if (__de > 1)
+ __e = std::move_backward(__e - __de, __em1, __e);
+ *--__e = std::move(__v);
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
-{
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- if (__pos == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
- --__start_;
- ++__size();
- }
- else
- {
- __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
- iterator __b = begin();
- iterator __bm1 = std::prev(__b);
- __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
- --__start_;
- ++__size();
- if (__pos > 1)
- __b = std::move(std::next(__b), __b + __pos, __b);
- *__b = std::move(__tmp.get());
- }
- }
- else
- { // insert by shifting things forward
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_capacity >= 1
- __annotate_increase_back(1);
- size_type __de = size() - __pos;
- if (__de == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*end()), std::forward<_Args>(__args)...);
- ++__size();
- }
- else
- {
- __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
- iterator __e = end();
- iterator __em1 = std::prev(__e);
- __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
- ++__size();
- if (__de > 1)
- __e = std::move_backward(__e - __de, __em1, __e);
- *--__e = std::move(__tmp.get());
- }
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) {
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ if (__pos == 0) {
+ __alloc_traits::construct(__a, std::addressof(*--begin()), std::forward<_Args>(__args)...);
+ --__start_;
+ ++__size();
+ } else {
+ __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
+ iterator __b = begin();
+ iterator __bm1 = std::prev(__b);
+ __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
+ --__start_;
+ ++__size();
+ if (__pos > 1)
+ __b = std::move(std::next(__b), __b + __pos, __b);
+ *__b = std::move(__tmp.get());
+ }
+ } else { // insert by shifting things forward
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_capacity >= 1
+ __annotate_increase_back(1);
+ size_type __de = size() - __pos;
+ if (__de == 0) {
+ __alloc_traits::construct(__a, std::addressof(*end()), std::forward<_Args>(__args)...);
+ ++__size();
+ } else {
+ __temp_value<value_type, _Allocator> __tmp(__alloc(), std::forward<_Args>(__args)...);
+ iterator __e = end();
+ iterator __em1 = std::prev(__e);
+ __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
+ ++__size();
+ if (__de > 1)
+ __e = std::move_backward(__e - __de, __em1, __e);
+ *--__e = std::move(__tmp.get());
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
#endif // _LIBCPP_CXX03_LANG
-
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
-{
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __annotate_increase_front(1);
- if (__pos == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
- --__start_;
- ++__size();
- }
- else
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __b = begin();
- iterator __bm1 = std::prev(__b);
- if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
- __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
- __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
- --__start_;
- ++__size();
- if (__pos > 1)
- __b = __move_and_check(std::next(__b), __b + __pos, __b, __vt);
- *__b = *__vt;
- }
- }
- else
- { // insert by shifting things forward
- if (__back_spare() == 0)
- __add_back_capacity();
- // __back_capacity >= 1
- __annotate_increase_back(1);
- size_type __de = size() - __pos;
- if (__de == 0)
- {
- __alloc_traits::construct(__a, std::addressof(*end()), __v);
- ++__size();
- }
- else
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __e = end();
- iterator __em1 = std::prev(__e);
- if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
- __vt = pointer_traits<const_pointer>::pointer_to(*__e);
- __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
- ++__size();
- if (__de > 1)
- __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
- *--__e = *__vt;
- }
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) {
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __annotate_increase_front(1);
+ if (__pos == 0) {
+ __alloc_traits::construct(__a, std::addressof(*--begin()), __v);
+ --__start_;
+ ++__size();
+ } else {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __b = begin();
+ iterator __bm1 = std::prev(__b);
+ if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
+ __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
+ __alloc_traits::construct(__a, std::addressof(*__bm1), std::move(*__b));
+ --__start_;
+ ++__size();
+ if (__pos > 1)
+ __b = __move_and_check(std::next(__b), __b + __pos, __b, __vt);
+ *__b = *__vt;
+ }
+ } else { // insert by shifting things forward
+ if (__back_spare() == 0)
+ __add_back_capacity();
+ // __back_capacity >= 1
+ __annotate_increase_back(1);
+ size_type __de = size() - __pos;
+ if (__de == 0) {
+ __alloc_traits::construct(__a, std::addressof(*end()), __v);
+ ++__size();
+ } else {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __e = end();
+ iterator __em1 = std::prev(__e);
+ if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
+ __vt = pointer_traits<const_pointer>::pointer_to(*__e);
+ __alloc_traits::construct(__a, std::addressof(*__e), std::move(*__em1));
+ ++__size();
+ if (__de > 1)
+ __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
+ *--__e = *__vt;
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v)
-{
- size_type __pos = __p - begin();
- size_type __to_end = __size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__n > __front_spare())
- __add_front_capacity(__n - __front_spare());
- // __n <= __front_spare()
- __annotate_increase_front(__n);
- iterator __old_begin = begin();
- iterator __i = __old_begin;
- if (__n > __pos)
- {
- for (size_type __m = __n - __pos; __m; --__m, --__start_, ++__size())
- __alloc_traits::construct(__a, std::addressof(*--__i), __v);
- __n = __pos;
- }
- if (__n > 0)
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __obn = __old_begin + __n;
- __move_construct_backward_and_check(__old_begin, __obn, __i, __vt);
- if (__n < __pos)
- __old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt);
- std::fill_n(__old_begin, __n, *__vt);
- }
- }
- else
- { // insert by shifting things forward
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- iterator __old_end = end();
- iterator __i = __old_end;
- size_type __de = size() - __pos;
- if (__n > __de)
- {
- for (size_type __m = __n - __de; __m; --__m, (void) ++__i, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__i), __v);
- __n = __de;
- }
- if (__n > 0)
- {
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
- iterator __oen = __old_end - __n;
- __move_construct_and_check(__oen, __old_end, __i, __vt);
- if (__n < __de)
- __old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt);
- std::fill_n(__old_end - __n, __n, *__vt);
- }
+deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) {
+ size_type __pos = __p - begin();
+ size_type __to_end = __size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__n > __front_spare())
+ __add_front_capacity(__n - __front_spare());
+ // __n <= __front_spare()
+ __annotate_increase_front(__n);
+ iterator __old_begin = begin();
+ iterator __i = __old_begin;
+ if (__n > __pos) {
+ for (size_type __m = __n - __pos; __m; --__m, --__start_, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*--__i), __v);
+ __n = __pos;
+ }
+ if (__n > 0) {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __obn = __old_begin + __n;
+ __move_construct_backward_and_check(__old_begin, __obn, __i, __vt);
+ if (__n < __pos)
+ __old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt);
+ std::fill_n(__old_begin, __n, *__vt);
+ }
+ } else { // insert by shifting things forward
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ iterator __old_end = end();
+ iterator __i = __old_end;
+ size_type __de = size() - __pos;
+ if (__n > __de) {
+ for (size_type __m = __n - __de; __m; --__m, (void)++__i, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__i), __v);
+ __n = __de;
+ }
+ if (__n > 0) {
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
+ iterator __oen = __old_end - __n;
+ __move_construct_and_check(__oen, __old_end, __i, __vt);
+ if (__n < __de)
+ __old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt);
+ std::fill_n(__old_end - __n, __n, *__vt);
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> >
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l)
-{
+deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l) {
return __insert_with_sentinel(__p, __f, __l);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l) {
- __split_buffer<value_type, allocator_type&> __buf(__alloc());
- __buf.__construct_at_end_with_sentinel(std::move(__f), std::move(__l));
- typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi;
- return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
+ __split_buffer<value_type, allocator_type&> __buf(__alloc());
+ __buf.__construct_at_end_with_sentinel(std::move(__f), std::move(__l));
+ typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi;
+ return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> >
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l)
-{
+deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l) {
return __insert_with_size(__p, __f, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _Iterator>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_with_size(const_iterator __p, _Iterator __f, size_type __n) {
- __split_buffer<value_type, allocator_type&> __buf(__n, 0, __alloc());
- __buf.__construct_at_end_with_size(__f, __n);
- typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
- return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
+ __split_buffer<value_type, allocator_type&> __buf(__n, 0, __alloc());
+ __buf.__construct_at_end_with_size(__f, __n);
+ typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
+ return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
}
template <class _Tp, class _Allocator>
template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> >
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l)
-{
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l) {
return __insert_bidirectional(__p, __f, __l, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _BiIter, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel, size_type __n) {
return __insert_bidirectional(__p, __f, std::next(__f, __n), __n);
}
template <class _Tp, class _Allocator>
template <class _BiIter>
-_LIBCPP_HIDE_FROM_ABI
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n) {
- size_type __pos = __p - begin();
- size_type __to_end = size() - __pos;
- allocator_type& __a = __alloc();
- if (__pos < __to_end)
- { // insert by shifting things backward
- if (__n > __front_spare())
- __add_front_capacity(__n - __front_spare());
- // __n <= __front_spare()
- __annotate_increase_front(__n);
- iterator __old_begin = begin();
- iterator __i = __old_begin;
- _BiIter __m = __f;
- if (__n > __pos)
- {
- __m = __pos < __n / 2 ? std::prev(__l, __pos) : std::next(__f, __n - __pos);
- for (_BiIter __j = __m; __j != __f; --__start_, ++__size())
- __alloc_traits::construct(__a, std::addressof(*--__i), *--__j);
- __n = __pos;
- }
- if (__n > 0)
- {
- iterator __obn = __old_begin + __n;
- for (iterator __j = __obn; __j != __old_begin;)
- {
- __alloc_traits::construct(__a, std::addressof(*--__i), std::move(*--__j));
- --__start_;
- ++__size();
- }
- if (__n < __pos)
- __old_begin = std::move(__obn, __old_begin + __pos, __old_begin);
- std::copy(__m, __l, __old_begin);
- }
+ size_type __pos = __p - begin();
+ size_type __to_end = size() - __pos;
+ allocator_type& __a = __alloc();
+ if (__pos < __to_end) { // insert by shifting things backward
+ if (__n > __front_spare())
+ __add_front_capacity(__n - __front_spare());
+ // __n <= __front_spare()
+ __annotate_increase_front(__n);
+ iterator __old_begin = begin();
+ iterator __i = __old_begin;
+ _BiIter __m = __f;
+ if (__n > __pos) {
+ __m = __pos < __n / 2 ? std::prev(__l, __pos) : std::next(__f, __n - __pos);
+ for (_BiIter __j = __m; __j != __f; --__start_, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*--__i), *--__j);
+ __n = __pos;
+ }
+ if (__n > 0) {
+ iterator __obn = __old_begin + __n;
+ for (iterator __j = __obn; __j != __old_begin;) {
+ __alloc_traits::construct(__a, std::addressof(*--__i), std::move(*--__j));
+ --__start_;
+ ++__size();
+ }
+ if (__n < __pos)
+ __old_begin = std::move(__obn, __old_begin + __pos, __old_begin);
+ std::copy(__m, __l, __old_begin);
}
- else
- { // insert by shifting things forward
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- iterator __old_end = end();
- iterator __i = __old_end;
- _BiIter __m = __l;
- size_type __de = size() - __pos;
- if (__n > __de)
- {
- __m = __de < __n / 2 ? std::next(__f, __de) : std::prev(__l, __n - __de);
- for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__i), *__j);
- __n = __de;
- }
- if (__n > 0)
- {
- iterator __oen = __old_end - __n;
- for (iterator __j = __oen; __j != __old_end; ++__i, (void) ++__j, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__i), std::move(*__j));
- if (__n < __de)
- __old_end = std::move_backward(__old_end - __de, __oen, __old_end);
- std::copy_backward(__f, __m, __old_end);
- }
+ } else { // insert by shifting things forward
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ iterator __old_end = end();
+ iterator __i = __old_end;
+ _BiIter __m = __l;
+ size_type __de = size() - __pos;
+ if (__n > __de) {
+ __m = __de < __n / 2 ? std::next(__f, __de) : std::prev(__l, __n - __de);
+ for (_BiIter __j = __m; __j != __l; ++__i, (void)++__j, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__i), *__j);
+ __n = __de;
+ }
+ if (__n > 0) {
+ iterator __oen = __old_end - __n;
+ for (iterator __j = __oen; __j != __old_end; ++__i, (void)++__j, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__i), std::move(*__j));
+ if (__n < __de)
+ __old_end = std::move_backward(__old_end - __de, __oen, __old_end);
+ std::copy_backward(__f, __m, __old_end);
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> >
-void
-deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l)
-{
+void deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l) {
__append_with_sentinel(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__append_with_sentinel(_InputIterator __f, _Sentinel __l) {
- for (; __f != __l; ++__f)
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_sentinel(_InputIterator __f, _Sentinel __l) {
+ for (; __f != __l; ++__f)
#ifdef _LIBCPP_CXX03_LANG
- push_back(*__f);
+ push_back(*__f);
#else
- emplace_back(*__f);
+ emplace_back(*__f);
#endif
}
template <class _Tp, class _Allocator>
template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> >
-void
-deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l)
-{
- __append_with_size(__f, std::distance(__f, __l));
+void deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l) {
+ __append_with_size(__f, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _InputIterator>
-_LIBCPP_HIDE_FROM_ABI
-void deque<_Tp, _Allocator>::__append_with_size(_InputIterator __f, size_type __n) {
- allocator_type& __a = __alloc();
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
-
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
- _ConstructTransaction __tx(this, __br);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
- __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
- }
+_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_size(_InputIterator __f, size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
+ _ConstructTransaction __tx(this, __br);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
+ __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
}
+ }
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__append(size_type __n)
-{
- allocator_type& __a = __alloc();
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
- _ConstructTransaction __tx(this, __br);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
- }
+void deque<_Tp, _Allocator>::__append(size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
+ _ConstructTransaction __tx(this, __br);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
}
+ }
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
-{
- allocator_type& __a = __alloc();
- size_type __back_capacity = __back_spare();
- if (__n > __back_capacity)
- __add_back_capacity(__n - __back_capacity);
- // __n <= __back_capacity
- __annotate_increase_back(__n);
- for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
- _ConstructTransaction __tx(this, __br);
- for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
- __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
- }
+void deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) {
+ allocator_type& __a = __alloc();
+ size_type __back_capacity = __back_spare();
+ if (__n > __back_capacity)
+ __add_back_capacity(__n - __back_capacity);
+ // __n <= __back_capacity
+ __annotate_increase_back(__n);
+ for (__deque_block_range __br : __deque_range(end(), end() + __n)) {
+ _ConstructTransaction __tx(this, __br);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
}
-
+ }
}
// Create front capacity for one block of elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_front_capacity()
-{
- allocator_type& __a = __alloc();
- if (__back_spare() >= __block_size)
- {
- __start_ += __block_size;
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- }
- // Else if __map_.size() < __map_.capacity() then we need to allocate 1 buffer
- else if (__map_.size() < __map_.capacity())
- { // we can put the new buffer into the map, but don't shift things around
- // until all buffers are allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- if (__map_.__front_spare() > 0)
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- else
- {
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- // Done allocating, reorder capacity
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- }
- __start_ = __map_.size() == 1 ?
- __block_size / 2 :
- __start_ + __block_size;
- }
- // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
- else
- {
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2 * __map_.capacity(), 1),
- 0, __map_.__alloc());
-
- typedef __allocator_destructor<_Allocator> _Dp;
- unique_ptr<pointer, _Dp> __hold(
- __alloc_traits::allocate(__a, __block_size),
- _Dp(__a, __block_size));
- __buf.push_back(__hold.get());
- __hold.release();
-
- for (__map_pointer __i = __map_.begin();
- __i != __map_.end(); ++__i)
- __buf.push_back(*__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __start_ = __map_.size() == 1 ?
- __block_size / 2 :
- __start_ + __block_size;
- }
- __annotate_whole_block(0, __asan_poison);
+void deque<_Tp, _Allocator>::__add_front_capacity() {
+ allocator_type& __a = __alloc();
+ if (__back_spare() >= __block_size) {
+ __start_ += __block_size;
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
+ }
+ // Else if __map_.size() < __map_.capacity() then we need to allocate 1 buffer
+ else if (__map_.size() < __map_.capacity()) { // we can put the new buffer into the map, but don't shift things around
+ // until all buffers are allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ if (__map_.__front_spare() > 0)
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ else {
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ // Done allocating, reorder capacity
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
+ }
+ __start_ = __map_.size() == 1 ? __block_size / 2 : __start_ + __block_size;
+ }
+ // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
+ else {
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), 1), 0, __map_.__alloc());
+
+ typedef __allocator_destructor<_Allocator> _Dp;
+ unique_ptr<pointer, _Dp> __hold(__alloc_traits::allocate(__a, __block_size), _Dp(__a, __block_size));
+ __buf.push_back(__hold.get());
+ __hold.release();
+
+ for (__map_pointer __i = __map_.begin(); __i != __map_.end(); ++__i)
+ __buf.push_back(*__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __start_ = __map_.size() == 1 ? __block_size / 2 : __start_ + __block_size;
+ }
+ __annotate_whole_block(0, __asan_poison);
}
// Create front capacity for __n elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
-{
- allocator_type& __a = __alloc();
- size_type __nb = __recommend_blocks(__n + __map_.empty());
- // Number of unused blocks at back:
- size_type __back_capacity = __back_spare() / __block_size;
- __back_capacity = std::min(__back_capacity, __nb); // don't take more than you need
- __nb -= __back_capacity; // number of blocks need to allocate
- // If __nb == 0, then we have sufficient capacity.
- if (__nb == 0)
- {
- __start_ += __block_size * __back_capacity;
- for (; __back_capacity > 0; --__back_capacity)
- {
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- }
+void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __nb = __recommend_blocks(__n + __map_.empty());
+ // Number of unused blocks at back:
+ size_type __back_capacity = __back_spare() / __block_size;
+ __back_capacity = std::min(__back_capacity, __nb); // don't take more than you need
+ __nb -= __back_capacity; // number of blocks need to allocate
+ // If __nb == 0, then we have sufficient capacity.
+ if (__nb == 0) {
+ __start_ += __block_size * __back_capacity;
+ for (; __back_capacity > 0; --__back_capacity) {
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
}
- // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
- else if (__nb <= __map_.capacity() - __map_.size())
- { // we can put the new buffers into the map, but don't shift things around
- // until all buffers are allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- for (; __nb > 0; --__nb, __start_ += __block_size - (__map_.size() == 1))
- {
- if (__map_.__front_spare() == 0)
- break;
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- __annotate_whole_block(0, __asan_poison);
- }
- for (; __nb > 0; --__nb, ++__back_capacity)
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- // Done allocating, reorder capacity
- __start_ += __back_capacity * __block_size;
- for (; __back_capacity > 0; --__back_capacity)
- {
- pointer __pt = __map_.back();
- __map_.pop_back();
- __map_.push_front(__pt);
- __annotate_whole_block(0, __asan_poison);
- }
+ }
+ // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+ else if (__nb <= __map_.capacity() -
+ __map_.size()) { // we can put the new buffers into the map, but don't shift things around
+ // until all buffers are allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ for (; __nb > 0; --__nb, __start_ += __block_size - (__map_.size() == 1)) {
+ if (__map_.__front_spare() == 0)
+ break;
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ __annotate_whole_block(0, __asan_poison);
+ }
+ for (; __nb > 0; --__nb, ++__back_capacity)
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ // Done allocating, reorder capacity
+ __start_ += __back_capacity * __block_size;
+ for (; __back_capacity > 0; --__back_capacity) {
+ pointer __pt = __map_.back();
+ __map_.pop_back();
+ __map_.push_front(__pt);
+ __annotate_whole_block(0, __asan_poison);
}
- // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
- else
- {
- size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty();
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2* __map_.capacity(),
- __nb + __map_.size()),
- 0, __map_.__alloc());
+ }
+ // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
+ else {
+ size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty();
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()), 0, __map_.__alloc());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __nb > 0; --__nb) {
- __buf.push_back(__alloc_traits::allocate(__a, __block_size));
- // ASan: this is empty container, we have to poison whole block
- __annotate_poison_block(
- std::__to_address(__buf.back()),
- std::__to_address(__buf.back() + __block_size));
- }
+ for (; __nb > 0; --__nb) {
+ __buf.push_back(__alloc_traits::allocate(__a, __block_size));
+ // ASan: this is empty container, we have to poison whole block
+ __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __annotate_delete();
- for (__map_pointer __i = __buf.begin();
- __i != __buf.end(); ++__i)
- __alloc_traits::deallocate(__a, *__i, __block_size);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __back_capacity > 0; --__back_capacity)
- {
- __buf.push_back(__map_.back());
- __map_.pop_back();
- }
- for (__map_pointer __i = __map_.begin();
- __i != __map_.end(); ++__i)
- __buf.push_back(*__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __start_ += __ds;
+ } catch (...) {
+ __annotate_delete();
+ for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
+ __alloc_traits::deallocate(__a, *__i, __block_size);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ for (; __back_capacity > 0; --__back_capacity) {
+ __buf.push_back(__map_.back());
+ __map_.pop_back();
+ }
+ for (__map_pointer __i = __map_.begin(); __i != __map_.end(); ++__i)
+ __buf.push_back(*__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __start_ += __ds;
+ }
}
// Create back capacity for one block of elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_back_capacity()
-{
- allocator_type& __a = __alloc();
- if (__front_spare() >= __block_size)
- {
- __start_ -= __block_size;
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
- // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
- else if (__map_.size() < __map_.capacity())
- { // we can put the new buffer into the map, but don't shift things around
- // until it is allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- if (__map_.__back_spare() != 0)
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- else
- {
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- // Done allocating, reorder capacity
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
- __annotate_whole_block(__map_.size() - 1, __asan_poison);
- }
- // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
- else
- {
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2* __map_.capacity(), 1),
- __map_.size(),
- __map_.__alloc());
-
- typedef __allocator_destructor<_Allocator> _Dp;
- unique_ptr<pointer, _Dp> __hold(
- __alloc_traits::allocate(__a, __block_size),
- _Dp(__a, __block_size));
- __buf.push_back(__hold.get());
- __hold.release();
-
- for (__map_pointer __i = __map_.end();
- __i != __map_.begin();)
- __buf.push_front(*--__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __annotate_whole_block(__map_.size() - 1, __asan_poison);
- }
+void deque<_Tp, _Allocator>::__add_back_capacity() {
+ allocator_type& __a = __alloc();
+ if (__front_spare() >= __block_size) {
+ __start_ -= __block_size;
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
+ }
+ // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+ else if (__map_.size() < __map_.capacity()) { // we can put the new buffer into the map, but don't shift things around
+ // until it is allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ if (__map_.__back_spare() != 0)
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ else {
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ // Done allocating, reorder capacity
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
+ }
+ __annotate_whole_block(__map_.size() - 1, __asan_poison);
+ }
+ // Else need to allocate 1 buffer, *and* we need to reallocate __map_.
+ else {
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), 1), __map_.size(), __map_.__alloc());
+
+ typedef __allocator_destructor<_Allocator> _Dp;
+ unique_ptr<pointer, _Dp> __hold(__alloc_traits::allocate(__a, __block_size), _Dp(__a, __block_size));
+ __buf.push_back(__hold.get());
+ __hold.release();
+
+ for (__map_pointer __i = __map_.end(); __i != __map_.begin();)
+ __buf.push_front(*--__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __annotate_whole_block(__map_.size() - 1, __asan_poison);
+ }
}
// Create back capacity for __n elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
-{
- allocator_type& __a = __alloc();
- size_type __nb = __recommend_blocks(__n + __map_.empty());
- // Number of unused blocks at front:
- size_type __front_capacity = __front_spare() / __block_size;
- __front_capacity = std::min(__front_capacity, __nb); // don't take more than you need
- __nb -= __front_capacity; // number of blocks need to allocate
- // If __nb == 0, then we have sufficient capacity.
- if (__nb == 0)
- {
- __start_ -= __block_size * __front_capacity;
- for (; __front_capacity > 0; --__front_capacity)
- {
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
+void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
+ allocator_type& __a = __alloc();
+ size_type __nb = __recommend_blocks(__n + __map_.empty());
+ // Number of unused blocks at front:
+ size_type __front_capacity = __front_spare() / __block_size;
+ __front_capacity = std::min(__front_capacity, __nb); // don't take more than you need
+ __nb -= __front_capacity; // number of blocks need to allocate
+ // If __nb == 0, then we have sufficient capacity.
+ if (__nb == 0) {
+ __start_ -= __block_size * __front_capacity;
+ for (; __front_capacity > 0; --__front_capacity) {
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
}
- // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
- else if (__nb <= __map_.capacity() - __map_.size())
- { // we can put the new buffers into the map, but don't shift things around
- // until all buffers are allocated. If we throw, we don't need to fix
- // anything up (any added buffers are undetectible)
- for (; __nb > 0; --__nb)
- {
- if (__map_.__back_spare() == 0)
- break;
- __map_.push_back(__alloc_traits::allocate(__a, __block_size));
- __annotate_whole_block(__map_.size() - 1, __asan_poison);
- }
- for (; __nb > 0; --__nb, ++__front_capacity, __start_ +=
- __block_size - (__map_.size() == 1)) {
- __map_.push_front(__alloc_traits::allocate(__a, __block_size));
- __annotate_whole_block(0, __asan_poison);
- }
- // Done allocating, reorder capacity
- __start_ -= __block_size * __front_capacity;
- for (; __front_capacity > 0; --__front_capacity)
- {
- pointer __pt = __map_.front();
- __map_.pop_front();
- __map_.push_back(__pt);
- }
+ }
+ // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers
+ else if (__nb <= __map_.capacity() -
+ __map_.size()) { // we can put the new buffers into the map, but don't shift things around
+ // until all buffers are allocated. If we throw, we don't need to fix
+ // anything up (any added buffers are undetectible)
+ for (; __nb > 0; --__nb) {
+ if (__map_.__back_spare() == 0)
+ break;
+ __map_.push_back(__alloc_traits::allocate(__a, __block_size));
+ __annotate_whole_block(__map_.size() - 1, __asan_poison);
+ }
+ for (; __nb > 0; --__nb, ++__front_capacity, __start_ += __block_size - (__map_.size() == 1)) {
+ __map_.push_front(__alloc_traits::allocate(__a, __block_size));
+ __annotate_whole_block(0, __asan_poison);
+ }
+ // Done allocating, reorder capacity
+ __start_ -= __block_size * __front_capacity;
+ for (; __front_capacity > 0; --__front_capacity) {
+ pointer __pt = __map_.front();
+ __map_.pop_front();
+ __map_.push_back(__pt);
}
- // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
- else
- {
- size_type __ds = __front_capacity * __block_size;
- __split_buffer<pointer, __pointer_allocator&>
- __buf(std::max<size_type>(2* __map_.capacity(),
- __nb + __map_.size()),
- __map_.size() - __front_capacity,
- __map_.__alloc());
+ }
+ // Else need to allocate __nb buffers, *and* we need to reallocate __map_.
+ else {
+ size_type __ds = __front_capacity * __block_size;
+ __split_buffer<pointer, __pointer_allocator&> __buf(
+ std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()),
+ __map_.size() - __front_capacity,
+ __map_.__alloc());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __nb > 0; --__nb) {
- __buf.push_back(__alloc_traits::allocate(__a, __block_size));
- // ASan: this is an empty container, we have to poison the whole block
- __annotate_poison_block(
- std::__to_address(__buf.back()),
- std::__to_address(__buf.back() + __block_size));
- }
+ for (; __nb > 0; --__nb) {
+ __buf.push_back(__alloc_traits::allocate(__a, __block_size));
+ // ASan: this is an empty container, we have to poison the whole block
+ __annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __annotate_delete();
- for (__map_pointer __i = __buf.begin();
- __i != __buf.end(); ++__i)
- __alloc_traits::deallocate(__a, *__i, __block_size);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __front_capacity > 0; --__front_capacity)
- {
- __buf.push_back(__map_.front());
- __map_.pop_front();
- }
- for (__map_pointer __i = __map_.end();
- __i != __map_.begin();)
- __buf.push_front(*--__i);
- std::swap(__map_.__first_, __buf.__first_);
- std::swap(__map_.__begin_, __buf.__begin_);
- std::swap(__map_.__end_, __buf.__end_);
- std::swap(__map_.__end_cap(), __buf.__end_cap());
- __start_ -= __ds;
+ } catch (...) {
+ __annotate_delete();
+ for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
+ __alloc_traits::deallocate(__a, *__i, __block_size);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ for (; __front_capacity > 0; --__front_capacity) {
+ __buf.push_back(__map_.front());
+ __map_.pop_front();
+ }
+ for (__map_pointer __i = __map_.end(); __i != __map_.begin();)
+ __buf.push_front(*--__i);
+ std::swap(__map_.__first_, __buf.__first_);
+ std::swap(__map_.__begin_, __buf.__begin_);
+ std::swap(__map_.__end_, __buf.__end_);
+ std::swap(__map_.__end_cap(), __buf.__end_cap());
+ __start_ -= __ds;
+ }
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::pop_front()
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- allocator_type& __a = __alloc();
- __alloc_traits::destroy(__a, std::__to_address(*(__map_.begin() +
- __start_ / __block_size) +
- __start_ % __block_size));
- --__size();
- ++__start_;
- __annotate_shrink_front(__old_sz, __old_start);
- __maybe_remove_front_spare();
+void deque<_Tp, _Allocator>::pop_front() {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ allocator_type& __a = __alloc();
+ __alloc_traits::destroy(
+ __a, std::__to_address(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size));
+ --__size();
+ ++__start_;
+ __annotate_shrink_front(__old_sz, __old_start);
+ __maybe_remove_front_spare();
}
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::pop_back called on an empty deque");
- size_type __old_sz = size();
- size_type __old_start = __start_;
- allocator_type& __a = __alloc();
- size_type __p = size() + __start_ - 1;
- __alloc_traits::destroy(__a, std::__to_address(*(__map_.begin() +
- __p / __block_size) +
- __p % __block_size));
- --__size();
- __annotate_shrink_back(__old_sz, __old_start);
- __maybe_remove_back_spare();
+void deque<_Tp, _Allocator>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::pop_back called on an empty deque");
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ allocator_type& __a = __alloc();
+ size_type __p = size() + __start_ - 1;
+ __alloc_traits::destroy(__a, std::__to_address(*(__map_.begin() + __p / __block_size) + __p % __block_size));
+ --__size();
+ __annotate_shrink_back(__old_sz, __old_start);
+ __maybe_remove_back_spare();
}
// move assign [__f, __l) to [__r, __r + (__l-__f)).
// If __vt points into [__f, __l), then subtract (__f - __r) from __vt.
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt)
-{
- // as if
- // for (; __f != __l; ++__f, ++__r)
- // *__r = std::move(*__f);
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + __block_size;
- difference_type __bs = __fe - __fb;
- if (__bs > __n)
- {
- __bs = __n;
- __fe = __fb + __bs;
- }
- if (__fb <= __vt && __vt < __fe)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
- __r = std::move(__fb, __fe, __r);
- __n -= __bs;
- __f += __bs;
- }
- return __r;
+deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ // as if
+ // for (; __f != __l; ++__f, ++__r)
+ // *__r = std::move(*__f);
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ pointer __fb = __f.__ptr_;
+ pointer __fe = *__f.__m_iter_ + __block_size;
+ difference_type __bs = __fe - __fb;
+ if (__bs > __n) {
+ __bs = __n;
+ __fe = __fb + __bs;
+ }
+ if (__fb <= __vt && __vt < __fe)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
+ __r = std::move(__fb, __fe, __r);
+ __n -= __bs;
+ __f += __bs;
+ }
+ return __r;
}
// move assign [__f, __l) to [__r - (__l-__f), __r) backwards.
// If __vt points into [__f, __l), then add (__r - __l) to __vt.
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r,
- const_pointer& __vt)
-{
- // as if
- // while (__f != __l)
- // *--__r = std::move(*--__l);
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- --__l;
- pointer __lb = *__l.__m_iter_;
- pointer __le = __l.__ptr_ + 1;
- difference_type __bs = __le - __lb;
- if (__bs > __n)
- {
- __bs = __n;
- __lb = __le - __bs;
- }
- if (__lb <= __vt && __vt < __le)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
- __r = std::move_backward(__lb, __le, __r);
- __n -= __bs;
- __l -= __bs - 1;
- }
- return __r;
+deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ // as if
+ // while (__f != __l)
+ // *--__r = std::move(*--__l);
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ --__l;
+ pointer __lb = *__l.__m_iter_;
+ pointer __le = __l.__ptr_ + 1;
+ difference_type __bs = __le - __lb;
+ if (__bs > __n) {
+ __bs = __n;
+ __lb = __le - __bs;
+ }
+ if (__lb <= __vt && __vt < __le)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
+ __r = std::move_backward(__lb, __le, __r);
+ __n -= __bs;
+ __l -= __bs - 1;
+ }
+ return __r;
}
// move construct [__f, __l) to [__r, __r + (__l-__f)).
// If __vt points into [__f, __l), then add (__r - __f) to __vt.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt)
-{
- allocator_type& __a = __alloc();
- // as if
- // for (; __f != __l; ++__r, ++__f, ++__size())
- // __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__f));
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + __block_size;
- difference_type __bs = __fe - __fb;
- if (__bs > __n)
- {
- __bs = __n;
- __fe = __fb + __bs;
- }
- if (__fb <= __vt && __vt < __fe)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
- for (; __fb != __fe; ++__fb, ++__r, ++__size())
- __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb));
- __n -= __bs;
- __f += __bs;
- }
+void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ allocator_type& __a = __alloc();
+ // as if
+ // for (; __f != __l; ++__r, ++__f, ++__size())
+ // __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__f));
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ pointer __fb = __f.__ptr_;
+ pointer __fe = *__f.__m_iter_ + __block_size;
+ difference_type __bs = __fe - __fb;
+ if (__bs > __n) {
+ __bs = __n;
+ __fe = __fb + __bs;
+ }
+ if (__fb <= __vt && __vt < __fe)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
+ for (; __fb != __fe; ++__fb, ++__r, ++__size())
+ __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb));
+ __n -= __bs;
+ __f += __bs;
+ }
}
// move construct [__f, __l) to [__r - (__l-__f), __r) backwards.
// If __vt points into [__f, __l), then subtract (__l - __r) from __vt.
template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterator __l,
- iterator __r, const_pointer& __vt)
-{
- allocator_type& __a = __alloc();
- // as if
- // for (iterator __j = __l; __j != __f;)
- // {
- // __alloc_traitsconstruct(__a, std::addressof(*--__r), std::move(*--__j));
- // --__start_;
- // ++__size();
- // }
- difference_type __n = __l - __f;
- while (__n > 0)
- {
- --__l;
- pointer __lb = *__l.__m_iter_;
- pointer __le = __l.__ptr_ + 1;
- difference_type __bs = __le - __lb;
- if (__bs > __n)
- {
- __bs = __n;
- __lb = __le - __bs;
- }
- if (__lb <= __vt && __vt < __le)
- __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
- while (__le != __lb)
- {
- __alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le));
- --__start_;
- ++__size();
- }
- __n -= __bs;
- __l -= __bs - 1;
- }
+void deque<_Tp, _Allocator>::__move_construct_backward_and_check(
+ iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+ allocator_type& __a = __alloc();
+ // as if
+ // for (iterator __j = __l; __j != __f;)
+ // {
+ // __alloc_traitsconstruct(__a, std::addressof(*--__r), std::move(*--__j));
+ // --__start_;
+ // ++__size();
+ // }
+ difference_type __n = __l - __f;
+ while (__n > 0) {
+ --__l;
+ pointer __lb = *__l.__m_iter_;
+ pointer __le = __l.__ptr_ + 1;
+ difference_type __bs = __le - __lb;
+ if (__bs > __n) {
+ __bs = __n;
+ __lb = __le - __bs;
+ }
+ if (__lb <= __vt && __vt < __le)
+ __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
+ while (__le != __lb) {
+ __alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le));
+ --__start_;
+ ++__size();
+ }
+ __n -= __bs;
+ __l -= __bs - 1;
+ }
}
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::erase(const_iterator __f)
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- iterator __b = begin();
- difference_type __pos = __f - __b;
- iterator __p = __b + __pos;
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f) {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ iterator __b = begin();
+ difference_type __pos = __f - __b;
+ iterator __p = __b + __pos;
+ allocator_type& __a = __alloc();
+ if (static_cast<size_t>(__pos) <= (size() - 1) / 2) { // erase from front
+ std::move_backward(__b, __p, std::next(__p));
+ __alloc_traits::destroy(__a, std::addressof(*__b));
+ --__size();
+ ++__start_;
+ __annotate_shrink_front(__old_sz, __old_start);
+ __maybe_remove_front_spare();
+ } else { // erase from back
+ iterator __i = std::move(std::next(__p), end(), __p);
+ __alloc_traits::destroy(__a, std::addressof(*__i));
+ --__size();
+ __annotate_shrink_back(__old_sz, __old_start);
+ __maybe_remove_back_spare();
+ }
+ return begin() + __pos;
+}
+
+template <class _Tp, class _Allocator>
+typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ difference_type __n = __l - __f;
+ iterator __b = begin();
+ difference_type __pos = __f - __b;
+ iterator __p = __b + __pos;
+ if (__n > 0) {
allocator_type& __a = __alloc();
- if (static_cast<size_t>(__pos) <= (size() - 1) / 2)
- { // erase from front
- std::move_backward(__b, __p, std::next(__p));
+ if (static_cast<size_t>(__pos) <= (size() - __n) / 2) { // erase from front
+ iterator __i = std::move_backward(__b, __p, __p + __n);
+ for (; __b != __i; ++__b)
__alloc_traits::destroy(__a, std::addressof(*__b));
- --__size();
- ++__start_;
- __annotate_shrink_front(__old_sz, __old_start);
- __maybe_remove_front_spare();
- }
- else
- { // erase from back
- iterator __i = std::move(std::next(__p), end(), __p);
+ __size() -= __n;
+ __start_ += __n;
+ __annotate_shrink_front(__old_sz, __old_start);
+ while (__maybe_remove_front_spare()) {
+ }
+ } else { // erase from back
+ iterator __i = std::move(__p + __n, end(), __p);
+ for (iterator __e = end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, std::addressof(*__i));
- --__size();
- __annotate_shrink_back(__old_sz, __old_start);
- __maybe_remove_back_spare();
+ __size() -= __n;
+ __annotate_shrink_back(__old_sz, __old_start);
+ while (__maybe_remove_back_spare()) {
+ }
}
- return begin() + __pos;
+ }
+ return begin() + __pos;
}
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- difference_type __n = __l - __f;
- iterator __b = begin();
+void deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) {
+ size_type __old_sz = size();
+ size_type __old_start = __start_;
+ iterator __e = end();
+ difference_type __n = __e - __f;
+ if (__n > 0) {
+ allocator_type& __a = __alloc();
+ iterator __b = begin();
difference_type __pos = __f - __b;
- iterator __p = __b + __pos;
- if (__n > 0)
- {
- allocator_type& __a = __alloc();
- if (static_cast<size_t>(__pos) <= (size() - __n) / 2)
- { // erase from front
- iterator __i = std::move_backward(__b, __p, __p + __n);
- for (; __b != __i; ++__b)
- __alloc_traits::destroy(__a, std::addressof(*__b));
- __size() -= __n;
- __start_ += __n;
- __annotate_shrink_front(__old_sz, __old_start);
- while (__maybe_remove_front_spare()) {
- }
- }
- else
- { // erase from back
- iterator __i = std::move(__p + __n, end(), __p);
- for (iterator __e = end(); __i != __e; ++__i)
- __alloc_traits::destroy(__a, std::addressof(*__i));
- __size() -= __n;
- __annotate_shrink_back(__old_sz, __old_start);
- while (__maybe_remove_back_spare()) {
- }
- }
- }
- return begin() + __pos;
-}
-
-template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
-{
- size_type __old_sz = size();
- size_type __old_start = __start_;
- iterator __e = end();
- difference_type __n = __e - __f;
- if (__n > 0)
- {
- allocator_type& __a = __alloc();
- iterator __b = begin();
- difference_type __pos = __f - __b;
- for (iterator __p = __b + __pos; __p != __e; ++__p)
- __alloc_traits::destroy(__a, std::addressof(*__p));
- __size() -= __n;
- __annotate_shrink_back(__old_sz, __old_start);
- while (__maybe_remove_back_spare()) {
- }
+ for (iterator __p = __b + __pos; __p != __e; ++__p)
+ __alloc_traits::destroy(__a, std::addressof(*__p));
+ __size() -= __n;
+ __annotate_shrink_back(__old_sz, __old_start);
+ while (__maybe_remove_back_spare()) {
}
+ }
}
template <class _Tp, class _Allocator>
-inline
-void
-deque<_Tp, _Allocator>::swap(deque& __c)
+inline void deque<_Tp, _Allocator>::swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- __map_.swap(__c.__map_);
- std::swap(__start_, __c.__start_);
- std::swap(__size(), __c.__size());
- std::__swap_allocator(__alloc(), __c.__alloc());
+ __map_.swap(__c.__map_);
+ std::swap(__start_, __c.__start_);
+ std::swap(__size(), __c.__size());
+ std::__swap_allocator(__alloc(), __c.__alloc());
}
template <class _Tp, class _Allocator>
-inline
-void
-deque<_Tp, _Allocator>::clear() _NOEXCEPT
-{
- __annotate_delete();
- allocator_type& __a = __alloc();
- for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
- __alloc_traits::destroy(__a, std::addressof(*__i));
- __size() = 0;
- while (__map_.size() > 2)
- {
- __alloc_traits::deallocate(__a, __map_.front(), __block_size);
- __map_.pop_front();
- }
- switch (__map_.size())
- {
- case 1:
- __start_ = __block_size / 2;
- break;
- case 2:
- __start_ = __block_size;
- break;
- }
- __annotate_new(0);
+inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT {
+ __annotate_delete();
+ allocator_type& __a = __alloc();
+ for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
+ __alloc_traits::destroy(__a, std::addressof(*__i));
+ __size() = 0;
+ while (__map_.size() > 2) {
+ __alloc_traits::deallocate(__a, __map_.front(), __block_size);
+ __map_.pop_front();
+ }
+ switch (__map_.size()) {
+ case 1:
+ __start_ = __block_size / 2;
+ break;
+ case 2:
+ __start_ = __block_size;
+ break;
+ }
+ __annotate_new(0);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- const typename deque<_Tp, _Allocator>::size_type __sz = __x.size();
- return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ const typename deque<_Tp, _Allocator>::size_type __sz = __x.size();
+ return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -2930,19 +2543,16 @@ operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
@@ -2964,10 +2574,10 @@ erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) {
template <>
inline constexpr bool __format::__enable_insertable<std::deque<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<std::deque<wchar_t>> = true;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/errno.h b/contrib/llvm-project/libcxx/include/errno.h
index 7b02d2b47953..e657ad84ff44 100644
--- a/contrib/llvm-project/libcxx/include/errno.h
+++ b/contrib/llvm-project/libcxx/include/errno.h
@@ -34,365 +34,365 @@ Macros:
#ifdef __cplusplus
-#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+# if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
-#ifdef ELAST
+# ifdef ELAST
-static const int __elast1 = ELAST+1;
-static const int __elast2 = ELAST+2;
+static const int __elast1 = ELAST + 1;
+static const int __elast2 = ELAST + 2;
-#else
+# else
static const int __elast1 = 104;
static const int __elast2 = 105;
-#endif
+# endif
-#ifdef ENOTRECOVERABLE
+# ifdef ENOTRECOVERABLE
-#define EOWNERDEAD __elast1
+# define EOWNERDEAD __elast1
-#ifdef ELAST
-#undef ELAST
-#define ELAST EOWNERDEAD
-#endif
+# ifdef ELAST
+# undef ELAST
+# define ELAST EOWNERDEAD
+# endif
-#elif defined(EOWNERDEAD)
+# elif defined(EOWNERDEAD)
-#define ENOTRECOVERABLE __elast1
-#ifdef ELAST
-#undef ELAST
-#define ELAST ENOTRECOVERABLE
-#endif
+# define ENOTRECOVERABLE __elast1
+# ifdef ELAST
+# undef ELAST
+# define ELAST ENOTRECOVERABLE
+# endif
-#else // defined(EOWNERDEAD)
+# else // defined(EOWNERDEAD)
-#define EOWNERDEAD __elast1
-#define ENOTRECOVERABLE __elast2
-#ifdef ELAST
-#undef ELAST
-#define ELAST ENOTRECOVERABLE
-#endif
+# define EOWNERDEAD __elast1
+# define ENOTRECOVERABLE __elast2
+# ifdef ELAST
+# undef ELAST
+# define ELAST ENOTRECOVERABLE
+# endif
-#endif // defined(EOWNERDEAD)
+# endif // defined(EOWNERDEAD)
-#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+# endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
// supply errno values likely to be missing, particularly on Windows
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT 9901
-#endif
+# ifndef EAFNOSUPPORT
+# define EAFNOSUPPORT 9901
+# endif
-#ifndef EADDRINUSE
-#define EADDRINUSE 9902
-#endif
+# ifndef EADDRINUSE
+# define EADDRINUSE 9902
+# endif
-#ifndef EADDRNOTAVAIL
-#define EADDRNOTAVAIL 9903
-#endif
+# ifndef EADDRNOTAVAIL
+# define EADDRNOTAVAIL 9903
+# endif
-#ifndef EISCONN
-#define EISCONN 9904
-#endif
+# ifndef EISCONN
+# define EISCONN 9904
+# endif
-#ifndef EBADMSG
-#define EBADMSG 9905
-#endif
+# ifndef EBADMSG
+# define EBADMSG 9905
+# endif
-#ifndef ECONNABORTED
-#define ECONNABORTED 9906
-#endif
+# ifndef ECONNABORTED
+# define ECONNABORTED 9906
+# endif
-#ifndef EALREADY
-#define EALREADY 9907
-#endif
+# ifndef EALREADY
+# define EALREADY 9907
+# endif
-#ifndef ECONNREFUSED
-#define ECONNREFUSED 9908
-#endif
+# ifndef ECONNREFUSED
+# define ECONNREFUSED 9908
+# endif
-#ifndef ECONNRESET
-#define ECONNRESET 9909
-#endif
+# ifndef ECONNRESET
+# define ECONNRESET 9909
+# endif
-#ifndef EDESTADDRREQ
-#define EDESTADDRREQ 9910
-#endif
+# ifndef EDESTADDRREQ
+# define EDESTADDRREQ 9910
+# endif
-#ifndef EHOSTUNREACH
-#define EHOSTUNREACH 9911
-#endif
+# ifndef EHOSTUNREACH
+# define EHOSTUNREACH 9911
+# endif
-#ifndef EIDRM
-#define EIDRM 9912
-#endif
+# ifndef EIDRM
+# define EIDRM 9912
+# endif
-#ifndef EMSGSIZE
-#define EMSGSIZE 9913
-#endif
+# ifndef EMSGSIZE
+# define EMSGSIZE 9913
+# endif
-#ifndef ENETDOWN
-#define ENETDOWN 9914
-#endif
+# ifndef ENETDOWN
+# define ENETDOWN 9914
+# endif
-#ifndef ENETRESET
-#define ENETRESET 9915
-#endif
+# ifndef ENETRESET
+# define ENETRESET 9915
+# endif
-#ifndef ENETUNREACH
-#define ENETUNREACH 9916
-#endif
+# ifndef ENETUNREACH
+# define ENETUNREACH 9916
+# endif
-#ifndef ENOBUFS
-#define ENOBUFS 9917
-#endif
+# ifndef ENOBUFS
+# define ENOBUFS 9917
+# endif
-#ifndef ENOLINK
-#define ENOLINK 9918
-#endif
+# ifndef ENOLINK
+# define ENOLINK 9918
+# endif
-#ifndef ENODATA
-#define ENODATA 9919
-#endif
+# ifndef ENODATA
+# define ENODATA 9919
+# endif
-#ifndef ENOMSG
-#define ENOMSG 9920
-#endif
+# ifndef ENOMSG
+# define ENOMSG 9920
+# endif
-#ifndef ENOPROTOOPT
-#define ENOPROTOOPT 9921
-#endif
+# ifndef ENOPROTOOPT
+# define ENOPROTOOPT 9921
+# endif
-#ifndef ENOSR
-#define ENOSR 9922
-#endif
+# ifndef ENOSR
+# define ENOSR 9922
+# endif
-#ifndef ENOTSOCK
-#define ENOTSOCK 9923
-#endif
+# ifndef ENOTSOCK
+# define ENOTSOCK 9923
+# endif
-#ifndef ENOSTR
-#define ENOSTR 9924
-#endif
+# ifndef ENOSTR
+# define ENOSTR 9924
+# endif
-#ifndef ENOTCONN
-#define ENOTCONN 9925
-#endif
+# ifndef ENOTCONN
+# define ENOTCONN 9925
+# endif
-#ifndef ENOTSUP
-#define ENOTSUP 9926
-#endif
+# ifndef ENOTSUP
+# define ENOTSUP 9926
+# endif
-#ifndef ECANCELED
-#define ECANCELED 9927
-#endif
+# ifndef ECANCELED
+# define ECANCELED 9927
+# endif
-#ifndef EINPROGRESS
-#define EINPROGRESS 9928
-#endif
+# ifndef EINPROGRESS
+# define EINPROGRESS 9928
+# endif
-#ifndef EOPNOTSUPP
-#define EOPNOTSUPP 9929
-#endif
+# ifndef EOPNOTSUPP
+# define EOPNOTSUPP 9929
+# endif
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK 9930
-#endif
+# ifndef EWOULDBLOCK
+# define EWOULDBLOCK 9930
+# endif
-#ifndef EOWNERDEAD
-#define EOWNERDEAD 9931
-#endif
+# ifndef EOWNERDEAD
+# define EOWNERDEAD 9931
+# endif
-#ifndef EPROTO
-#define EPROTO 9932
-#endif
+# ifndef EPROTO
+# define EPROTO 9932
+# endif
-#ifndef EPROTONOSUPPORT
-#define EPROTONOSUPPORT 9933
-#endif
+# ifndef EPROTONOSUPPORT
+# define EPROTONOSUPPORT 9933
+# endif
-#ifndef ENOTRECOVERABLE
-#define ENOTRECOVERABLE 9934
-#endif
+# ifndef ENOTRECOVERABLE
+# define ENOTRECOVERABLE 9934
+# endif
-#ifndef ETIME
-#define ETIME 9935
-#endif
+# ifndef ETIME
+# define ETIME 9935
+# endif
-#ifndef ETXTBSY
-#define ETXTBSY 9936
-#endif
+# ifndef ETXTBSY
+# define ETXTBSY 9936
+# endif
-#ifndef ETIMEDOUT
-#define ETIMEDOUT 9938
-#endif
+# ifndef ETIMEDOUT
+# define ETIMEDOUT 9938
+# endif
-#ifndef ELOOP
-#define ELOOP 9939
-#endif
+# ifndef ELOOP
+# define ELOOP 9939
+# endif
-#ifndef EOVERFLOW
-#define EOVERFLOW 9940
-#endif
+# ifndef EOVERFLOW
+# define EOVERFLOW 9940
+# endif
-#ifndef EPROTOTYPE
-#define EPROTOTYPE 9941
-#endif
+# ifndef EPROTOTYPE
+# define EPROTOTYPE 9941
+# endif
-#ifndef ENOSYS
-#define ENOSYS 9942
-#endif
+# ifndef ENOSYS
+# define ENOSYS 9942
+# endif
-#ifndef EINVAL
-#define EINVAL 9943
-#endif
+# ifndef EINVAL
+# define EINVAL 9943
+# endif
-#ifndef ERANGE
-#define ERANGE 9944
-#endif
+# ifndef ERANGE
+# define ERANGE 9944
+# endif
-#ifndef EILSEQ
-#define EILSEQ 9945
-#endif
+# ifndef EILSEQ
+# define EILSEQ 9945
+# endif
// Windows Mobile doesn't appear to define these:
-#ifndef E2BIG
-#define E2BIG 9946
-#endif
+# ifndef E2BIG
+# define E2BIG 9946
+# endif
-#ifndef EDOM
-#define EDOM 9947
-#endif
+# ifndef EDOM
+# define EDOM 9947
+# endif
-#ifndef EFAULT
-#define EFAULT 9948
-#endif
+# ifndef EFAULT
+# define EFAULT 9948
+# endif
-#ifndef EBADF
-#define EBADF 9949
-#endif
+# ifndef EBADF
+# define EBADF 9949
+# endif
-#ifndef EPIPE
-#define EPIPE 9950
-#endif
+# ifndef EPIPE
+# define EPIPE 9950
+# endif
-#ifndef EXDEV
-#define EXDEV 9951
-#endif
+# ifndef EXDEV
+# define EXDEV 9951
+# endif
-#ifndef EBUSY
-#define EBUSY 9952
-#endif
+# ifndef EBUSY
+# define EBUSY 9952
+# endif
-#ifndef ENOTEMPTY
-#define ENOTEMPTY 9953
-#endif
+# ifndef ENOTEMPTY
+# define ENOTEMPTY 9953
+# endif
-#ifndef ENOEXEC
-#define ENOEXEC 9954
-#endif
+# ifndef ENOEXEC
+# define ENOEXEC 9954
+# endif
-#ifndef EEXIST
-#define EEXIST 9955
-#endif
+# ifndef EEXIST
+# define EEXIST 9955
+# endif
-#ifndef EFBIG
-#define EFBIG 9956
-#endif
+# ifndef EFBIG
+# define EFBIG 9956
+# endif
-#ifndef ENAMETOOLONG
-#define ENAMETOOLONG 9957
-#endif
+# ifndef ENAMETOOLONG
+# define ENAMETOOLONG 9957
+# endif
-#ifndef ENOTTY
-#define ENOTTY 9958
-#endif
+# ifndef ENOTTY
+# define ENOTTY 9958
+# endif
-#ifndef EINTR
-#define EINTR 9959
-#endif
+# ifndef EINTR
+# define EINTR 9959
+# endif
-#ifndef ESPIPE
-#define ESPIPE 9960
-#endif
+# ifndef ESPIPE
+# define ESPIPE 9960
+# endif
-#ifndef EIO
-#define EIO 9961
-#endif
+# ifndef EIO
+# define EIO 9961
+# endif
-#ifndef EISDIR
-#define EISDIR 9962
-#endif
+# ifndef EISDIR
+# define EISDIR 9962
+# endif
-#ifndef ECHILD
-#define ECHILD 9963
-#endif
+# ifndef ECHILD
+# define ECHILD 9963
+# endif
-#ifndef ENOLCK
-#define ENOLCK 9964
-#endif
+# ifndef ENOLCK
+# define ENOLCK 9964
+# endif
-#ifndef ENOSPC
-#define ENOSPC 9965
-#endif
+# ifndef ENOSPC
+# define ENOSPC 9965
+# endif
-#ifndef ENXIO
-#define ENXIO 9966
-#endif
+# ifndef ENXIO
+# define ENXIO 9966
+# endif
-#ifndef ENODEV
-#define ENODEV 9967
-#endif
+# ifndef ENODEV
+# define ENODEV 9967
+# endif
-#ifndef ENOENT
-#define ENOENT 9968
-#endif
+# ifndef ENOENT
+# define ENOENT 9968
+# endif
-#ifndef ESRCH
-#define ESRCH 9969
-#endif
+# ifndef ESRCH
+# define ESRCH 9969
+# endif
-#ifndef ENOTDIR
-#define ENOTDIR 9970
-#endif
+# ifndef ENOTDIR
+# define ENOTDIR 9970
+# endif
-#ifndef ENOMEM
-#define ENOMEM 9971
-#endif
+# ifndef ENOMEM
+# define ENOMEM 9971
+# endif
-#ifndef EPERM
-#define EPERM 9972
-#endif
+# ifndef EPERM
+# define EPERM 9972
+# endif
-#ifndef EACCES
-#define EACCES 9973
-#endif
+# ifndef EACCES
+# define EACCES 9973
+# endif
-#ifndef EROFS
-#define EROFS 9974
-#endif
+# ifndef EROFS
+# define EROFS 9974
+# endif
-#ifndef EDEADLK
-#define EDEADLK 9975
-#endif
+# ifndef EDEADLK
+# define EDEADLK 9975
+# endif
-#ifndef EAGAIN
-#define EAGAIN 9976
-#endif
+# ifndef EAGAIN
+# define EAGAIN 9976
+# endif
-#ifndef ENFILE
-#define ENFILE 9977
-#endif
+# ifndef ENFILE
+# define ENFILE 9977
+# endif
-#ifndef EMFILE
-#define EMFILE 9978
-#endif
+# ifndef EMFILE
+# define EMFILE 9978
+# endif
-#ifndef EMLINK
-#define EMLINK 9979
-#endif
+# ifndef EMLINK
+# define EMLINK 9979
+# endif
#endif // __cplusplus
diff --git a/contrib/llvm-project/libcxx/include/expected b/contrib/llvm-project/libcxx/include/expected
index 486d0a21d087..44d0ce6b00c8 100644
--- a/contrib/llvm-project/libcxx/include/expected
+++ b/contrib/llvm-project/libcxx/include/expected
@@ -51,4 +51,3 @@ namespace std {
#endif
#endif // _LIBCPP_EXPECTED
-
diff --git a/contrib/llvm-project/libcxx/include/experimental/__config b/contrib/llvm-project/libcxx/include/experimental/__config
index 8bc4f5dd141a..7b23791511ce 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__config
+++ b/contrib/llvm-project/libcxx/include/experimental/__config
@@ -16,20 +16,30 @@
# pragma GCC system_header
#endif
-#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental {
-#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } }
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL \
+ namespace std { \
+ namespace experimental {
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL \
+ } \
+ }
#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
-#define _LIBCPP_END_NAMESPACE_LFTS } } }
+#define _LIBCPP_END_NAMESPACE_LFTS \
+ } \
+ } \
+ }
#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 {
-#define _LIBCPP_END_NAMESPACE_LFTS_V2 } } }
+#define _LIBCPP_END_NAMESPACE_LFTS_V2 \
+ } \
+ } \
+ }
// TODO: support more targets
#if defined(__AVX__)
-#define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
+# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
#else
-#define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16
+# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16
#endif
#endif
diff --git a/contrib/llvm-project/libcxx/include/experimental/__memory b/contrib/llvm-project/libcxx/include/experimental/__memory
index fb82922d1eb2..b9dbf541d7e4 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__memory
+++ b/contrib/llvm-project/libcxx/include/experimental/__memory
@@ -25,11 +25,7 @@
_LIBCPP_BEGIN_NAMESPACE_LFTS
-template <
- class _Tp, class _Alloc
- , bool = uses_allocator<_Tp, _Alloc>::value
- , bool = __has_allocator_type<_Tp>::value
- >
+template < class _Tp, class _Alloc, bool = uses_allocator<_Tp, _Alloc>::value, bool = __has_allocator_type<_Tp>::value >
struct __lfts_uses_allocator : public false_type {};
template <class _Tp, class _Alloc>
@@ -40,79 +36,57 @@ struct __lfts_uses_allocator<_Tp, _Alloc, true, HasAlloc> : public true_type {};
template <class _Tp, class _Alloc>
struct __lfts_uses_allocator<_Tp, _Alloc, false, true>
- : public integral_constant<bool
- , is_convertible<_Alloc, typename _Tp::allocator_type>::value
- || is_same<erased_type, typename _Tp::allocator_type>::value
- >
-{};
-
-template <bool _UsesAlloc, class _Tp, class _Alloc, class ..._Args>
-struct __lfts_uses_alloc_ctor_imp
-{
- static const int value = 0;
+ : public integral_constant<bool,
+ is_convertible<_Alloc, typename _Tp::allocator_type>::value ||
+ is_same<erased_type, typename _Tp::allocator_type>::value > {};
+
+template <bool _UsesAlloc, class _Tp, class _Alloc, class... _Args>
+struct __lfts_uses_alloc_ctor_imp {
+ static const int value = 0;
};
-template <class _Tp, class _Alloc, class ..._Args>
-struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...>
-{
- static const bool __ic_first
- = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+template <class _Tp, class _Alloc, class... _Args>
+struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...> {
+ static const bool __ic_first = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
- static const bool __ic_second =
- __conditional_t<
- __ic_first,
- false_type,
- is_constructible<_Tp, _Args..., _Alloc>
- >::value;
+ static const bool __ic_second =
+ __conditional_t< __ic_first, false_type, is_constructible<_Tp, _Args..., _Alloc> >::value;
- static_assert(__ic_first || __ic_second,
- "Request for uses allocator construction is ill-formed");
+ static_assert(__ic_first || __ic_second, "Request for uses allocator construction is ill-formed");
- static const int value = __ic_first ? 1 : 2;
+ static const int value = __ic_first ? 1 : 2;
};
-template <class _Tp, class _Alloc, class ..._Args>
+template <class _Tp, class _Alloc, class... _Args>
struct __lfts_uses_alloc_ctor
- : integral_constant<int,
- __lfts_uses_alloc_ctor_imp<
- __lfts_uses_allocator<_Tp, _Alloc>::value
- , _Tp, _Alloc, _Args...
- >::value
- >
-{};
+ : integral_constant<
+ int,
+ __lfts_uses_alloc_ctor_imp< __lfts_uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args... >::value > {};
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (allocator_arg_t(), __a, std::forward<_Args>(__args)...);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(allocator_arg_t(), __a, std::forward<_Args>(__args)...);
}
// FIXME: This should have a version which takes a non-const alloc.
template <class _Tp, class _Allocator, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
-{
- new (__storage) _Tp (std::forward<_Args>(__args)..., __a);
+inline _LIBCPP_HIDE_FROM_ABI void
+__user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args) {
+ new (__storage) _Tp(std::forward<_Args>(__args)..., __a);
}
-template <class _Tp, class _Alloc, class ..._Args>
-inline _LIBCPP_HIDE_FROM_ABI
-void __lfts_user_alloc_construct(
- _Tp * __store, const _Alloc & __a, _Args &&... __args)
-{
- ::std::experimental::fundamentals_v1::__user_alloc_construct_impl(
- typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type()
- , __store, __a, std::forward<_Args>(__args)...
- );
+template <class _Tp, class _Alloc, class... _Args>
+inline _LIBCPP_HIDE_FROM_ABI void __lfts_user_alloc_construct(_Tp* __store, const _Alloc& __a, _Args&&... __args) {
+ ::std::experimental::fundamentals_v1::__user_alloc_construct_impl(
+ typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type(), __store, __a, std::forward<_Args>(__args)...);
}
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h b/contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h
deleted file mode 100644
index cec5be65ce5c..000000000000
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/abi_tag.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H
-#define _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H
-
-#include <cstddef>
-#include <experimental/__config>
-#include <experimental/__simd/internal_declaration.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-namespace simd_abi {
-
-using scalar = __scalar;
-
-// TODO: make this platform dependent
-template <int _Np>
-using fixed_size = __vec_ext<_Np>;
-
-template <class _Tp>
-inline constexpr int max_fixed_size = 32;
-
-// TODO: make this platform dependent
-template <class _Tp>
-using compatible = __vec_ext<16 / sizeof(_Tp)>;
-
-// TODO: make this platform dependent
-template <class _Tp>
-using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>;
-
-// TODO: make this platform dependent
-template <class _Tp, size_t _Np, class... _Abis>
-struct deduce {
- using type = fixed_size<_Np>;
-};
-
-// TODO: make this platform dependent
-template <class _Tp, size_t _Np, class... _Abis>
-using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type;
-
-} // namespace simd_abi
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h b/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
index d216a21c073f..edbb3b24931f 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
@@ -10,10 +10,10 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
#define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
-#include <__bit/bit_ceil.h>
#include <__memory/assume_aligned.h>
#include <cstddef>
#include <experimental/__config>
+#include <experimental/__simd/traits.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
@@ -30,9 +30,12 @@ struct element_aligned_tag {
}
};
+template <>
+inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true;
+
struct vector_aligned_tag {
template <class _Tp, class _Up = typename _Tp::value_type>
- static constexpr size_t __alignment = std::__bit_ceil(sizeof(_Up) * _Tp::size());
+ static constexpr size_t __alignment = memory_alignment_v<_Tp, _Up>;
template <class _Tp, class _Up>
static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) {
@@ -40,6 +43,9 @@ struct vector_aligned_tag {
}
};
+template <>
+inline constexpr bool is_simd_flag_type_v<vector_aligned_tag> = true;
+
template <size_t _Np>
struct overaligned_tag {
template <class _Tp, class _Up = typename _Tp::value_type>
@@ -51,6 +57,9 @@ struct overaligned_tag {
}
};
+template <size_t _Np>
+inline constexpr bool is_simd_flag_type_v<overaligned_tag<_Np>> = true;
+
inline constexpr element_aligned_tag element_aligned{};
inline constexpr vector_aligned_tag vector_aligned{};
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h b/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h
index 065faeaec384..7b45d035c271 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/declaration.h
@@ -10,13 +10,63 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
#define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
+#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
inline namespace parallelism_v2 {
+namespace simd_abi {
+template <int>
+struct __vec_ext;
+struct __scalar;
+
+using scalar = __scalar;
+
+// TODO: make this platform dependent
+template <int _Np>
+using fixed_size = __vec_ext<_Np>;
+
+template <class _Tp>
+inline constexpr int max_fixed_size = 32;
+
+// TODO: make this platform dependent
+template <class _Tp>
+using compatible = __vec_ext<16 / sizeof(_Tp)>;
+
+// TODO: make this platform dependent
+template <class _Tp>
+using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>;
+
+// TODO: make this platform dependent
+template <class _Tp, size_t _Np, class... _Abis>
+struct deduce {
+ using type = fixed_size<_Np>;
+};
+
+// TODO: make this platform dependent
+template <class _Tp, size_t _Np, class... _Abis>
+using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type;
+
+} // namespace simd_abi
+
+template <class _Tp, class _Abi>
+struct __simd_storage;
+
+template <class _Tp, class _Abi>
+struct __mask_storage;
+
+template <class _Tp, class _Abi>
+struct __simd_operations;
+
+template <class _Tp, class _Abi>
+struct __mask_operations;
+
+struct element_aligned_tag;
+struct vector_aligned_tag;
+template <size_t>
+struct overaligned_tag;
template <class _Tp, class _Abi = simd_abi::compatible<_Tp>>
class simd;
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h b/contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h
deleted file mode 100644
index 9ad1ad1ae319..000000000000
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/internal_declaration.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H
-#define _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H
-
-#include <experimental/__config>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-namespace simd_abi {
-template <int>
-struct __vec_ext;
-struct __scalar;
-} // namespace simd_abi
-
-template <class _Tp, class _Abi>
-struct __simd_storage;
-
-template <class _Tp, class _Abi>
-struct __mask_storage;
-
-template <class _Tp, class _Abi>
-struct __simd_operations;
-
-template <class _Tp, class _Abi>
-struct __mask_operations;
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h b/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
index 53fa1c29f374..5eeff4c1e82a 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
@@ -12,7 +12,7 @@
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/internal_declaration.h>
+#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h b/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
index ffb328eb345b..c345811fee7f 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
@@ -15,9 +15,7 @@
#include <__utility/forward.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#include <experimental/__simd/declaration.h>
-#include <experimental/__simd/internal_declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
#include <experimental/__simd/utility.h>
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h b/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
index 325b8409e3b6..db03843b46e3 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
@@ -13,9 +13,7 @@
#include <__type_traits/is_same.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#include <experimental/__simd/declaration.h>
-#include <experimental/__simd/internal_declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h b/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h
index 9b4abe9d0c23..ec25b4bfa7f9 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/traits.h
@@ -10,14 +10,12 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H
#define _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H
+#include <__bit/bit_ceil.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_same.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
-#include <experimental/__simd/aligned_tag.h>
#include <experimental/__simd/declaration.h>
-#include <experimental/__simd/internal_declaration.h>
#include <experimental/__simd/utility.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
@@ -47,15 +45,6 @@ struct is_simd_mask : bool_constant<is_simd_mask_v<_Tp>> {};
template <class _Tp>
inline constexpr bool is_simd_flag_type_v = false;
-template <>
-inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true;
-
-template <>
-inline constexpr bool is_simd_flag_type_v<vector_aligned_tag> = true;
-
-template <size_t _Np>
-inline constexpr bool is_simd_flag_type_v<overaligned_tag<_Np>> = true;
-
template <class _Tp>
struct is_simd_flag_type : bool_constant<is_simd_flag_type_v<_Tp>> {};
@@ -71,7 +60,7 @@ inline constexpr size_t simd_size_v = simd_size<_Tp, _Abi>::value;
template <class _Tp,
class _Up = typename _Tp::value_type,
bool = (is_simd_v<_Tp> && __is_vectorizable_v<_Up>) || (is_simd_mask_v<_Tp> && is_same_v<_Up, bool>)>
-struct memory_alignment : integral_constant<size_t, vector_aligned_tag::__alignment<_Tp, _Up>> {};
+struct memory_alignment : integral_constant<size_t, std::__bit_ceil(sizeof(_Up) * _Tp::size())> {};
template <class _Tp, class _Up>
struct memory_alignment<_Tp, _Up, false> {};
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h b/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
index baaeda6a7401..07ba032f493b 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
@@ -15,7 +15,7 @@
#include <__utility/integer_sequence.h>
#include <cstddef>
#include <experimental/__config>
-#include <experimental/__simd/internal_declaration.h>
+#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
#include <experimental/__simd/utility.h>
@@ -38,11 +38,11 @@ struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> {
_Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np)))));
_LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
return __data[__idx];
}
_LIBCPP_HIDE_FROM_ABI void __set(size_t __idx, _Tp __v) noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
__data[__idx] = __v;
}
};
diff --git a/contrib/llvm-project/libcxx/include/experimental/iterator b/contrib/llvm-project/libcxx/include/experimental/iterator
index bca7d4c182ad..5bb1dd1ada63 100644
--- a/contrib/llvm-project/libcxx/include/experimental/iterator
+++ b/contrib/llvm-project/libcxx/include/experimental/iterator
@@ -71,48 +71,45 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
class ostream_joiner {
public:
-
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_ostream<char_type,traits_type> ostream_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, _Delim&& __d)
- : __output_iter_(std::addressof(__os)), __delim_(std::move(__d)), __first_(true) {}
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, const _Delim& __d)
- : __output_iter_(std::addressof(__os)), __delim_(__d), __first_(true) {}
-
-
- template<typename _Tp>
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator=(const _Tp& __v)
- {
- if (!__first_)
- *__output_iter_ << __delim_;
- __first_ = false;
- *__output_iter_ << __v;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator*() _NOEXCEPT { return *this; }
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++() _NOEXCEPT { return *this; }
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<char_type, traits_type> ostream_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, _Delim&& __d)
+ : __output_iter_(std::addressof(__os)), __delim_(std::move(__d)), __first_(true) {}
+
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, const _Delim& __d)
+ : __output_iter_(std::addressof(__os)), __delim_(__d), __first_(true) {}
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator=(const _Tp& __v) {
+ if (!__first_)
+ *__output_iter_ << __delim_;
+ __first_ = false;
+ *__output_iter_ << __v;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator*() _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++() _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
private:
- ostream_type* __output_iter_;
- _Delim __delim_;
- bool __first_;
+ ostream_type* __output_iter_;
+ _Delim __delim_;
+ bool __first_;
};
-
template <class _CharT, class _Traits, class _Delim>
_LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>
-make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d)
-{ return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, std::forward<_Delim>(__d)); }
+make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim&& __d) {
+ return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, std::forward<_Delim>(__d));
+}
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/experimental/propagate_const b/contrib/llvm-project/libcxx/include/experimental/propagate_const
index fd58f6637af5..06d7ba43daf1 100644
--- a/contrib/llvm-project/libcxx/include/experimental/propagate_const
+++ b/contrib/llvm-project/libcxx/include/experimental/propagate_const
@@ -146,69 +146,58 @@ template <class _Tp>
class propagate_const;
template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-_Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
template <class _Tp>
-class propagate_const
-{
+class propagate_const {
public:
typedef remove_reference_t<decltype(*std::declval<_Tp&>())> element_type;
- static_assert(!is_array<_Tp>::value,
- "Instantiation of propagate_const with an array type is ill-formed.");
- static_assert(!is_reference<_Tp>::value,
- "Instantiation of propagate_const with a reference type is ill-formed.");
+ static_assert(!is_array<_Tp>::value, "Instantiation of propagate_const with an array type is ill-formed.");
+ static_assert(!is_reference<_Tp>::value, "Instantiation of propagate_const with a reference type is ill-formed.");
static_assert(!(is_pointer<_Tp>::value && is_function<__remove_pointer_t<_Tp> >::value),
- "Instantiation of propagate_const with a function-pointer type is ill-formed.");
+ "Instantiation of propagate_const with a function-pointer type is ill-formed.");
static_assert(!(is_pointer<_Tp>::value && is_same<__remove_cv_t<__remove_pointer_t<_Tp> >, void>::value),
- "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed.");
+ "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed.");
private:
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u) {
return __u;
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u) {
return __get_pointer(__u.get());
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u) {
return __u;
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u)
- {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u) {
return __get_pointer(__u.get());
}
template <class _Up>
- struct __is_propagate_const : false_type
- {
- };
+ struct __is_propagate_const : false_type {};
template <class _Up>
- struct __is_propagate_const<propagate_const<_Up>> : true_type
- {
- };
+ struct __is_propagate_const<propagate_const<_Up>> : true_type {};
_Tp __t_;
public:
-
- template <class _Up> friend _LIBCPP_CONSTEXPR const _Up& experimental::fundamentals_v2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
- template <class _Up> friend _LIBCPP_CONSTEXPR _Up& experimental::fundamentals_v2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
+ template <class _Up>
+ friend _LIBCPP_CONSTEXPR const _Up&
+ experimental::fundamentals_v2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
+ template <class _Up>
+ friend _LIBCPP_CONSTEXPR _Up& experimental::fundamentals_v2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const() = default;
@@ -216,100 +205,67 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const&&) = default;
- template <class _Up, enable_if_t<!is_convertible<_Up, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value,bool> = true>
+ template <class _Up,
+ enable_if_t<!is_convertible<_Up, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = true>
explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
- : __t_(std::move(experimental::get_underlying(__pu)))
- {
- }
+ : __t_(std::move(experimental::get_underlying(__pu))) {}
- template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value,bool> = false>
+ template <class _Up,
+ enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = false>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
- : __t_(std::move(experimental::get_underlying(__pu)))
- {
- }
+ : __t_(std::move(experimental::get_underlying(__pu))) {}
- template <class _Up, enable_if_t<!is_convertible<_Up&&, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value &&
- !__is_propagate_const<decay_t<_Up>>::value,bool> = true>
- explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
- : __t_(std::forward<_Up>(__u))
- {
- }
+ template <class _Up,
+ enable_if_t<!is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
+ !__is_propagate_const<decay_t<_Up>>::value,
+ bool> = true>
+ explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
- template <class _Up, enable_if_t<is_convertible<_Up&&, _Tp>::value &&
- is_constructible<_Tp, _Up&&>::value &&
- !__is_propagate_const<decay_t<_Up>>::value,bool> = false>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u)
- : __t_(std::forward<_Up>(__u))
- {
- }
+ template <class _Up,
+ enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
+ !__is_propagate_const<decay_t<_Up>>::value,
+ bool> = false>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
propagate_const& operator=(const propagate_const&) = delete;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const&&) = default;
template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu) {
__t_ = std::move(experimental::get_underlying(__pu));
return *this;
}
template <class _Up, class _Vp = enable_if_t<!__is_propagate_const<decay_t<_Up>>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u) {
__t_ = std::forward<_Up>(__u);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* get() const
- {
- return __get_pointer(__t_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* get() const { return __get_pointer(__t_); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* get()
- {
- return __get_pointer(__t_);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* get() { return __get_pointer(__t_); }
- _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR operator bool() const
- {
- return get() != nullptr;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR operator bool() const { return get() != nullptr; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* operator->() const
- {
- return get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* operator->() const { return get(); }
- template <class _Dummy = _Tp, class _Up = enable_if_t<is_convertible<
- const _Dummy, const element_type *>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator const element_type *() const {
+ template <class _Dummy = _Tp, class _Up = enable_if_t<is_convertible< const _Dummy, const element_type*>::value>>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator const element_type*() const {
return get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type& operator*() const
- {
- return *get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type& operator*() const { return *get(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* operator->()
- {
- return get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* operator->() { return get(); }
- template <class _Dummy = _Tp, class _Up = enable_if_t<
- is_convertible<_Dummy, element_type *>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator element_type *() {
+ template <class _Dummy = _Tp, class _Up = enable_if_t< is_convertible<_Dummy, element_type*>::value>>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator element_type*() {
return get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type& operator*()
- {
- return *get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type& operator*() { return *get(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void swap(propagate_const& __pt)
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
@@ -318,184 +274,135 @@ public:
}
};
-
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t) {
return experimental::get_underlying(__pt) == nullptr;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt) {
return nullptr == experimental::get_underlying(__pt);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t) {
return experimental::get_underlying(__pt) != nullptr;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt) {
return nullptr != experimental::get_underlying(__pt);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) == experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) != experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) < experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) > experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) <= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt,
- const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) >= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) == __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) != __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) < __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) > __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) <= __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) >= __u;
}
-
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t == experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t != experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t < experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t > experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t <= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t >= experimental::get_underlying(__pu);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
-{
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2)
+ _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
__pc1.swap(__pc2);
}
template <class _Tp>
-_LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT
-{
+_LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT {
return __pt.__t_;
}
template <class _Tp>
-_LIBCPP_CONSTEXPR _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT
-{
+_LIBCPP_CONSTEXPR _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT {
return __pt.__t_;
}
@@ -504,91 +411,77 @@ _LIBCPP_END_NAMESPACE_LFTS_V2
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct hash<experimental::propagate_const<_Tp>>
-{
+struct hash<experimental::propagate_const<_Tp>> {
typedef size_t result_type;
typedef experimental::propagate_const<_Tp> argument_type;
- _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::propagate_const<_Tp>& __pc1) const
- {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::propagate_const<_Tp>& __pc1) const {
return std::hash<_Tp>()(experimental::get_underlying(__pc1));
}
};
template <class _Tp>
-struct equal_to<experimental::propagate_const<_Tp>>
-{
+struct equal_to<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::equal_to<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct not_equal_to<experimental::propagate_const<_Tp>>
-{
+struct not_equal_to<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::not_equal_to<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct less<experimental::propagate_const<_Tp>>
-{
+struct less<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::less<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct greater<experimental::propagate_const<_Tp>>
-{
+struct greater<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::greater<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct less_equal<experimental::propagate_const<_Tp>>
-{
+struct less_equal<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::less_equal<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
template <class _Tp>
-struct greater_equal<experimental::propagate_const<_Tp>>
-{
+struct greater_equal<experimental::propagate_const<_Tp>> {
typedef experimental::propagate_const<_Tp> first_argument_type;
typedef experimental::propagate_const<_Tp> second_argument_type;
- _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1,
- const experimental::propagate_const<_Tp>& __pc2) const
- {
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
return std::greater_equal<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
}
};
diff --git a/contrib/llvm-project/libcxx/include/experimental/simd b/contrib/llvm-project/libcxx/include/experimental/simd
index 56858832857c..adca9faa47bb 100644
--- a/contrib/llvm-project/libcxx/include/experimental/simd
+++ b/contrib/llvm-project/libcxx/include/experimental/simd
@@ -78,7 +78,6 @@ inline namespace parallelism_v2 {
#endif
#include <experimental/__config>
-#include <experimental/__simd/abi_tag.h>
#include <experimental/__simd/aligned_tag.h>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/scalar.h>
diff --git a/contrib/llvm-project/libcxx/include/experimental/type_traits b/contrib/llvm-project/libcxx/include/experimental/type_traits
index bebd86d54da3..62f9574ec58f 100644
--- a/contrib/llvm-project/libcxx/include/experimental/type_traits
+++ b/contrib/llvm-project/libcxx/include/experimental/type_traits
@@ -73,12 +73,12 @@ inline namespace fundamentals_v1 {
#if _LIBCPP_STD_VER >= 14
-#include <initializer_list>
-#include <type_traits>
+# include <initializer_list>
+# include <type_traits>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
_LIBCPP_BEGIN_NAMESPACE_LFTS
@@ -104,49 +104,48 @@ using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
*/
// 3.3.4, Detection idiom
-template <class...> using void_t = void;
+template <class...>
+using void_t = void;
struct nonesuch : private __nat { // make nonesuch "not an aggregate"
- ~nonesuch() = delete;
- nonesuch (nonesuch const&) = delete;
+ ~nonesuch() = delete;
+ nonesuch(nonesuch const&) = delete;
void operator=(nonesuch const&) = delete;
- };
+};
template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
struct _DETECTOR {
- using value_t = false_type;
- using type = _Default;
- };
+ using value_t = false_type;
+ using type = _Default;
+};
template <class _Default, template <class...> class _Op, class... _Args>
struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
- using value_t = true_type;
- using type = _Op<_Args...>;
- };
-
+ using value_t = true_type;
+ using type = _Op<_Args...>;
+};
-template <template<class...> class _Op, class... _Args>
- using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
-template <template<class...> class _Op, class... _Args>
- using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
-template <template<class...> class _Op, class... _Args>
- _LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
+template <template <class...> class _Op, class... _Args>
+using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
+template <template <class...> class _Op, class... _Args>
+using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
+template <template <class...> class _Op, class... _Args>
+_LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
-template <class _Default, template<class...> class _Op, class... _Args>
- using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
-template <class _Default, template<class...> class _Op, class... _Args>
- using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
-
-template <class _Expected, template<class...> class _Op, class... _Args>
- using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
-template <class _Expected, template<class...> class _Op, class... _Args>
- _LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
+template <class _Default, template <class...> class _Op, class... _Args>
+using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
+template <class _Default, template <class...> class _Op, class... _Args>
+using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
-template <class _To, template<class...> class _Op, class... _Args>
- using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
-template <class _To, template<class...> class _Op, class... _Args>
- _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
+template <class _Expected, template <class...> class _Op, class... _Args>
+using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
+template <class _Expected, template <class...> class _Op, class... _Args>
+_LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
+template <class _To, template <class...> class _Op, class... _Args>
+using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
+template <class _To, template <class...> class _Op, class... _Args>
+_LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/experimental/utility b/contrib/llvm-project/libcxx/include/experimental/utility
index 576b8be46357..c1bd9364fd51 100644
--- a/contrib/llvm-project/libcxx/include/experimental/utility
+++ b/contrib/llvm-project/libcxx/include/experimental/utility
@@ -40,7 +40,7 @@ inline namespace fundamentals_v1 {
_LIBCPP_BEGIN_NAMESPACE_LFTS
- struct _LIBCPP_TEMPLATE_VIS erased_type { };
+struct _LIBCPP_TEMPLATE_VIS erased_type {};
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/include/ext/__hash b/contrib/llvm-project/libcxx/include/ext/__hash
index dcfee910d21b..67f7e351756f 100644
--- a/contrib/llvm-project/libcxx/include/ext/__hash
+++ b/contrib/llvm-project/libcxx/include/ext/__hash
@@ -10,7 +10,7 @@
#ifndef _LIBCPP_EXT_HASH
#define _LIBCPP_EXT_HASH
-# pragma GCC system_header
+#pragma GCC system_header
#include <__config>
#include <cstring>
@@ -19,116 +19,66 @@
namespace __gnu_cxx {
-template <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };
+template <typename _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash {};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>
- : public std::__unary_function<const char*, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const char *__c) const _NOEXCEPT
- {
- return std::__do_string_hash(__c, __c + strlen(__c));
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<const char*> : public std::__unary_function<const char*, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const char* __c) const _NOEXCEPT {
+ return std::__do_string_hash(__c, __c + strlen(__c));
+ }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<char *>
- : public std::__unary_function<char*, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char *__c) const _NOEXCEPT
- {
- return std::__do_string_hash<const char *>(__c, __c + strlen(__c));
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char*> : public std::__unary_function<char*, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char* __c) const _NOEXCEPT {
+ return std::__do_string_hash<const char*>(__c, __c + strlen(__c));
+ }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
- : public std::__unary_function<char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(char __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char> : public std::__unary_function<char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(char __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
- : public std::__unary_function<signed char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(signed char __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public std::__unary_function<signed char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
- : public std::__unary_function<unsigned char, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned char __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public std::__unary_function<unsigned char, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
- : public std::__unary_function<short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(short __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<short> : public std::__unary_function<short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(short __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
- : public std::__unary_function<unsigned short, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned short __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public std::__unary_function<unsigned short, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
- : public std::__unary_function<int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(int __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<int> : public std::__unary_function<int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(int __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
- : public std::__unary_function<unsigned int, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned int __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public std::__unary_function<unsigned int, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
- : public std::__unary_function<long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(long __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<long> : public std::__unary_function<long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(long __c) const _NOEXCEPT { return __c; }
};
-template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
- : public std::__unary_function<unsigned long, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(unsigned long __c) const _NOEXCEPT
- {
- return __c;
- }
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public std::__unary_function<unsigned long, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __c) const _NOEXCEPT { return __c; }
};
} // namespace __gnu_cxx
diff --git a/contrib/llvm-project/libcxx/include/ext/hash_map b/contrib/llvm-project/libcxx/include/ext/hash_map
index 176b59fa9ed6..7ac268d5dcbd 100644
--- a/contrib/llvm-project/libcxx/include/ext/hash_map
+++ b/contrib/llvm-project/libcxx/include/ext/hash_map
@@ -209,11 +209,11 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <functional>
#if defined(__DEPRECATED) && __DEPRECATED
-#if defined(_LIBCPP_WARNING)
- _LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
-#else
-# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
-#endif
+# if defined(_LIBCPP_WARNING)
+_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
+# else
+# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
+# endif
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -222,760 +222,644 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
namespace __gnu_cxx {
-template <class _Tp, class _Hash,
- bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value
- >
-class __hash_map_hasher
- : private _Hash
-{
+template <class _Tp, class _Hash, bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value >
+class __hash_map_hasher : private _Hash {
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : _Hash() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
- _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Tp& __x) const
- {return static_cast<const _Hash&>(*this)(__x.first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const typename _Tp::first_type& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : _Hash() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const { return *this; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Tp& __x) const { return static_cast<const _Hash&>(*this)(__x.first); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const typename _Tp::first_type& __x) const {
+ return static_cast<const _Hash&>(*this)(__x);
+ }
};
template <class _Tp, class _Hash>
-class __hash_map_hasher<_Tp, _Hash, false>
-{
- _Hash __hash_;
+class __hash_map_hasher<_Tp, _Hash, false> {
+ _Hash __hash_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : __hash_() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
- _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const {return __hash_;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Tp& __x) const
- {return __hash_(__x.first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const typename _Tp::first_type& __x) const
- {return __hash_(__x);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher() : __hash_() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const { return __hash_; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Tp& __x) const { return __hash_(__x.first); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const typename _Tp::first_type& __x) const { return __hash_(__x); }
};
-template <class _Tp, class _Pred,
- bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value
- >
-class __hash_map_equal
- : private _Pred
-{
+template <class _Tp, class _Pred, bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value >
+class __hash_map_equal : private _Pred {
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : _Pred() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
- _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
- {return static_cast<const _Pred&>(*this)(__x.first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x,
- const typename _Tp::first_type& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : _Pred() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.first, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const typename _Tp::first_type& __x, const typename _Tp::first_type& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y);
+ }
};
template <class _Tp, class _Pred>
-class __hash_map_equal<_Tp, _Pred, false>
-{
- _Pred __pred_;
+class __hash_map_equal<_Tp, _Pred, false> {
+ _Pred __pred_;
+
public:
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : __pred_() {}
- _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
- _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const {return __pred_;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __pred_(__x.first, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
- {return __pred_(__x, __y.first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
- {return __pred_(__x.first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const typename _Tp::first_type& __x,
- const typename _Tp::first_type& __y) const
- {return __pred_(__x, __y);}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal() : __pred_() {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const { return __pred_; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { return __pred_(__x.first, __y.first); }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const {
+ return __pred_(__x, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const {
+ return __pred_(__x.first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool
+ operator()(const typename _Tp::first_type& __x, const typename _Tp::first_type& __y) const {
+ return __pred_(__x, __y);
+ }
};
template <class _Alloc>
-class __hash_map_node_destructor
-{
- typedef _Alloc allocator_type;
- typedef std::allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::value_type::__node_value_type value_type;
+class __hash_map_node_destructor {
+ typedef _Alloc allocator_type;
+ typedef std::allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::value_type::__node_value_type value_type;
+
public:
- typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::pointer pointer;
+
private:
- typedef typename value_type::first_type first_type;
- typedef typename value_type::second_type second_type;
+ typedef typename value_type::first_type first_type;
+ typedef typename value_type::second_type second_type;
- allocator_type& __na_;
+ allocator_type& __na_;
public:
- bool __first_constructed;
- bool __second_constructed;
+ bool __first_constructed;
+ bool __second_constructed;
- _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(__hash_map_node_destructor const&) = default;
- __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(__hash_map_node_destructor const&) = default;
+ __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_map_node_destructor(allocator_type& __na)
- : __na_(__na),
- __first_constructed(false),
- __second_constructed(false)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_map_node_destructor(allocator_type& __na)
+ : __na_(__na), __first_constructed(false), __second_constructed(false) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(std::__hash_node_destructor<allocator_type>&& __x)
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- __x.__value_constructed = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(std::__hash_node_destructor<allocator_type>&& __x)
+ : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) {
+ __x.__value_constructed = false;
+ }
#else // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(const std::__hash_node_destructor<allocator_type>& __x)
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- const_cast<bool&>(__x.__value_constructed) = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(const std::__hash_node_destructor<allocator_type>& __x)
+ : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) {
+ const_cast<bool&>(__x.__value_constructed) = false;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p)
- {
- if (__second_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().second));
- if (__first_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().first));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) {
+ if (__second_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().second));
+ if (__first_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().first));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
};
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_iterator {
+ _HashIterator __i_;
+
+ typedef const typename _HashIterator::value_type::first_type key_type;
+ typedef typename _HashIterator::value_type::second_type mapped_type;
- typedef const typename _HashIterator::value_type::first_type key_type;
- typedef typename _HashIterator::value_type::second_type mapped_type;
public:
- typedef std::forward_iterator_tag iterator_category;
- typedef std::pair<key_type, mapped_type> value_type;
- typedef typename _HashIterator::difference_type difference_type;
- typedef value_type& reference;
- typedef std::__rebind_pointer_t<typename _HashIterator::pointer, value_type>
- pointer;
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_iterator() {}
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const {return *operator->();}
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const {return (pointer)__i_.operator->();}
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator operator++(int)
- {
- __hash_map_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::pair<key_type, mapped_type> value_type;
+ typedef typename _HashIterator::difference_type difference_type;
+ typedef value_type& reference;
+ typedef std::__rebind_pointer_t<typename _HashIterator::pointer, value_type> pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator() {}
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *operator->(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return (pointer)__i_.operator->(); }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator operator++(int) {
+ __hash_map_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
};
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator {
+ _HashIterator __i_;
+
+ typedef const typename _HashIterator::value_type::first_type key_type;
+ typedef typename _HashIterator::value_type::second_type mapped_type;
- typedef const typename _HashIterator::value_type::first_type key_type;
- typedef typename _HashIterator::value_type::second_type mapped_type;
public:
- typedef std::forward_iterator_tag iterator_category;
- typedef std::pair<key_type, mapped_type> value_type;
- typedef typename _HashIterator::difference_type difference_type;
- typedef const value_type& reference;
- typedef std::__rebind_pointer_t<typename _HashIterator::pointer, const value_type>
- pointer;
-
- _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator() {}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(
- __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
- : __i_(__i.__i_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return *operator->();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return (pointer)__i_.operator->();}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator operator++(int)
- {
- __hash_map_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::pair<key_type, mapped_type> value_type;
+ typedef typename _HashIterator::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef std::__rebind_pointer_t<typename _HashIterator::pointer, const value_type> pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator() {}
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator(__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
+ : __i_(__i.__i_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *operator->(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return (pointer)__i_.operator->(); }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator operator++(int) {
+ __hash_map_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS hash_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
};
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS hash_map
-{
+class _LIBCPP_TEMPLATE_VIS hash_map {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef _Tp data_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef std::pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef _Tp data_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef std::pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::pair<key_type, mapped_type> __value_type;
- typedef __hash_map_hasher<__value_type, hasher> __hasher;
- typedef __hash_map_equal<__value_type, key_equal> __key_equal;
- typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef std::__hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::__node_pointer __node_pointer;
- typedef typename __table::__node_const_pointer __node_const_pointer;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef std::unique_ptr<__node, _Dp> __node_holder;
- typedef std::allocator_traits<allocator_type> __alloc_traits;
+ typedef std::pair<key_type, mapped_type> __value_type;
+ typedef __hash_map_hasher<__value_type, hasher> __hasher;
+ typedef __hash_map_equal<__value_type, key_equal> __key_equal;
+ typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef std::__hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::__node_pointer __node_pointer;
+ typedef typename __table::__node_const_pointer __node_const_pointer;
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef std::unique_ptr<__node, _Dp> __node_holder;
+ typedef std::allocator_traits<allocator_type> __alloc_traits;
+
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI hash_map() { }
- explicit _LIBCPP_HIDE_FROM_ABI hash_map(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_map(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_map(const hash_map& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_map& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
-
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const
- {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_unique(__n);}
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_map() {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ hash_map(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_map(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_map(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_map(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_map(const hash_map& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, bool> insert(const value_type& __x) {
+ return __table_.__insert_unique(__x);
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) {
+ __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_map& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_unique(__n); }
private:
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(const key_type& __k);
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
- const hash_map& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(const hash_map& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
-{
- __node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, std::addressof(__h->__get_value().first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, std::addressof(__h->__get_value().second));
- __h.get_deleter().__second_constructed = true;
- return __h;
+hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) {
+ __node_allocator& __na = __table_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, std::addressof(__h->__get_value().first), __k);
+ __h.get_deleter().__first_constructed = true;
+ __node_traits::construct(__na, std::addressof(__h->__get_value().second));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i != end())
- return __i->second;
- __node_holder __h = __construct_node(__k);
- std::pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
- __h.release();
- return __r.first->second;
+_Tp& hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) {
+ iterator __i = find(__k);
+ if (__i != end())
+ return __i->second;
+ __node_holder __h = __construct_node(__k);
+ std::pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+ __h.release();
+ return __r.first->second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(__i->first);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(__i->first);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS hash_multimap
-{
+class _LIBCPP_TEMPLATE_VIS hash_multimap {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef _Tp data_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef std::pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef _Tp data_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef std::pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::pair<key_type, mapped_type> __value_type;
- typedef __hash_map_hasher<__value_type, hasher> __hasher;
- typedef __hash_map_equal<__value_type, key_equal> __key_equal;
- typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef std::__hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef std::unique_ptr<__node, _Dp> __node_holder;
- typedef std::allocator_traits<allocator_type> __alloc_traits;
+ typedef std::pair<key_type, mapped_type> __value_type;
+ typedef __hash_map_hasher<__value_type, hasher> __hasher;
+ typedef __hash_map_equal<__value_type, key_equal> __key_equal;
+ typedef std::__rebind_alloc<std::allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef std::__hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef std::unique_ptr<__node, _Dp> __node_holder;
+ typedef std::allocator_traits<allocator_type> __alloc_traits;
+
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- hash_multimap() { }
- explicit _LIBCPP_HIDE_FROM_ABI hash_multimap(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_multimap(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_multimap(const hash_multimap& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const
- {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_multi(__n);}
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_multimap() {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ hash_multimap(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multimap(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multimap(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multimap(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_multimap(const hash_multimap& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x); }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) {
+ __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_multimap& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_multi(__n); }
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
- const hash_multimap& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(const hash_multimap& __u) : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef std::pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(__i->first);
- _EqRng __yeq = __y.equal_range(__i->first);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef std::pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(__i->first);
+ _EqRng __yeq = __y.equal_range(__i->first);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
} // namespace __gnu_cxx
diff --git a/contrib/llvm-project/libcxx/include/ext/hash_set b/contrib/llvm-project/libcxx/include/ext/hash_set
index 7166aa815ec7..79f0925f6f4c 100644
--- a/contrib/llvm-project/libcxx/include/ext/hash_set
+++ b/contrib/llvm-project/libcxx/include/ext/hash_set
@@ -200,11 +200,11 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <functional>
#if defined(__DEPRECATED) && __DEPRECATED
-#if defined(_LIBCPP_WARNING)
- _LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
-#else
-# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
-#endif
+# if defined(_LIBCPP_WARNING)
+_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
+# else
+# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
+# endif
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -213,451 +213,365 @@ template <class Value, class Hash, class Pred, class Alloc>
namespace __gnu_cxx {
-
-template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
+template <class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS hash_set
-{
+class _LIBCPP_TEMPLATE_VIS hash_set {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
+ typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- hash_set() { }
- _LIBCPP_HIDE_FROM_ABI explicit hash_set(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_set(const hash_set& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_set& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_unique(__n);}
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
+
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_set() {}
+ _LIBCPP_HIDE_FROM_ABI explicit hash_set(
+ size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_set(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_set(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_set(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_set(const hash_set& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, bool> insert(const value_type& __x) {
+ return __table_.__insert_unique(__x);
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) { __table_.erase(__first, __last); }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_set& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_unique(__n); }
};
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
- const hash_set& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(const hash_set& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
- hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x, hash_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(*__i);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x, const hash_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(*__i);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x, const hash_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
-template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
+template <class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
class _Alloc = std::allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS hash_multiset
-{
+class _LIBCPP_TEMPLATE_VIS hash_multiset {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef _Hash hasher;
- typedef _Pred key_equal;
- typedef _Alloc allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef _Hash hasher;
+ typedef _Pred key_equal;
+ typedef _Alloc allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
private:
- typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
+ typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- hash_multiset() { }
- explicit _LIBCPP_HIDE_FROM_ABI hash_multiset(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI hash_multiset(size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n , const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI hash_multiset(const hash_multiset& __u);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
-
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __p) {__table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- void erase(const_iterator __first, const_iterator __last)
- {__table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_funct() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- void resize(size_type __n) {__table_.__rehash_multi(__n);}
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
+
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI hash_multiset() {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ hash_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multiset(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ hash_multiset(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI hash_multiset(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI hash_multiset(const hash_multiset& __u);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
+
+ _LIBCPP_HIDE_FROM_ABI bool empty() const { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x); }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
+
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __p) { __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI void erase(const_iterator __first, const_iterator __last) { __table_.erase(__first, __last); }
+ _LIBCPP_HIDE_FROM_ABI void clear() { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(hash_multiset& __u) { __table_.swap(__u.__table_); }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_funct() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI std::pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type elems_in_bucket(size_type __n) const { return __table_.bucket_size(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n) { __table_.__rehash_multi(__n); }
};
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
- const hash_multiset& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(const hash_multiset& __u) : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ __x.swap(__y);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef std::pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(*__i);
- _EqRng __yeq = __y.equal_range(*__i);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef std::pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(*__i);
+ _EqRng __yeq = __y.equal_range(*__i);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
} // namespace __gnu_cxx
diff --git a/contrib/llvm-project/libcxx/include/fenv.h b/contrib/llvm-project/libcxx/include/fenv.h
index 15e41568cbf7..5647f2b33955 100644
--- a/contrib/llvm-project/libcxx/include/fenv.h
+++ b/contrib/llvm-project/libcxx/include/fenv.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP_FENV_H
#define _LIBCPP_FENV_H
-
/*
fenv.h synopsis
@@ -64,52 +63,49 @@ int feupdateenv(const fenv_t* envp);
extern "C++" {
-#ifdef feclearexcept
-#undef feclearexcept
-#endif
+# ifdef feclearexcept
+# undef feclearexcept
+# endif
-#ifdef fegetexceptflag
-#undef fegetexceptflag
-#endif
+# ifdef fegetexceptflag
+# undef fegetexceptflag
+# endif
+# ifdef feraiseexcept
+# undef feraiseexcept
+# endif
-#ifdef feraiseexcept
-#undef feraiseexcept
-#endif
+# ifdef fesetexceptflag
+# undef fesetexceptflag
+# endif
-#ifdef fesetexceptflag
-#undef fesetexceptflag
-#endif
+# ifdef fetestexcept
+# undef fetestexcept
+# endif
+# ifdef fegetround
+# undef fegetround
+# endif
-#ifdef fetestexcept
-#undef fetestexcept
-#endif
+# ifdef fesetround
+# undef fesetround
+# endif
-#ifdef fegetround
-#undef fegetround
-#endif
+# ifdef fegetenv
+# undef fegetenv
+# endif
-#ifdef fesetround
-#undef fesetround
-#endif
-
-#ifdef fegetenv
-#undef fegetenv
-#endif
-
-#ifdef feholdexcept
-#undef feholdexcept
-#endif
+# ifdef feholdexcept
+# undef feholdexcept
+# endif
+# ifdef fesetenv
+# undef fesetenv
+# endif
-#ifdef fesetenv
-#undef fesetenv
-#endif
-
-#ifdef feupdateenv
-#undef feupdateenv
-#endif
+# ifdef feupdateenv
+# undef feupdateenv
+# endif
} // extern "C++"
diff --git a/contrib/llvm-project/libcxx/include/float.h b/contrib/llvm-project/libcxx/include/float.h
index 9e5f711fab83..d572866c1358 100644
--- a/contrib/llvm-project/libcxx/include/float.h
+++ b/contrib/llvm-project/libcxx/include/float.h
@@ -82,13 +82,13 @@ Macros:
#ifdef __cplusplus
-#ifndef FLT_EVAL_METHOD
-#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
-#endif
+# ifndef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+# endif
-#ifndef DECIMAL_DIG
-#define DECIMAL_DIG __DECIMAL_DIG__
-#endif
+# ifndef DECIMAL_DIG
+# define DECIMAL_DIG __DECIMAL_DIG__
+# endif
#endif // __cplusplus
diff --git a/contrib/llvm-project/libcxx/include/forward_list b/contrib/llvm-project/libcxx/include/forward_list
index b8b793c98545..22cb0ebc2247 100644
--- a/contrib/llvm-project/libcxx/include/forward_list
+++ b/contrib/llvm-project/libcxx/include/forward_list
@@ -254,12 +254,12 @@ template <class T, class Allocator, class Predicate>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _VoidPtr> struct __forward_list_node;
-template <class _NodePtr> struct __forward_begin_node;
-
+template <class _Tp, class _VoidPtr>
+struct __forward_list_node;
+template <class _NodePtr>
+struct __forward_begin_node;
template <class>
struct __forward_list_node_value_type;
@@ -271,1020 +271,837 @@ struct __forward_list_node_value_type<__forward_list_node<_Tp, _VoidPtr> > {
template <class _NodePtr>
struct __forward_node_traits {
-
typedef __remove_cv_t<typename pointer_traits<_NodePtr>::element_type> __node_type;
- typedef typename __forward_list_node_value_type<__node_type>::type __node_value_type;
- typedef _NodePtr __node_pointer;
- typedef __forward_begin_node<_NodePtr> __begin_node;
- typedef __rebind_pointer_t<_NodePtr, __begin_node> __begin_node_pointer;
- typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
+ typedef typename __forward_list_node_value_type<__node_type>::type __node_value_type;
+ typedef _NodePtr __node_pointer;
+ typedef __forward_begin_node<_NodePtr> __begin_node;
+ typedef __rebind_pointer_t<_NodePtr, __begin_node> __begin_node_pointer;
+ typedef __rebind_pointer_t<_NodePtr, void> __void_pointer;
#if defined(_LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB)
typedef __begin_node_pointer __iter_node_pointer;
#else
- typedef __conditional_t<is_pointer<__void_pointer>::value, __begin_node_pointer, __node_pointer>
- __iter_node_pointer;
+ typedef __conditional_t<is_pointer<__void_pointer>::value, __begin_node_pointer, __node_pointer> __iter_node_pointer;
#endif
typedef __conditional_t<is_same<__iter_node_pointer, __node_pointer>::value, __begin_node_pointer, __node_pointer>
__non_iter_node_pointer;
- _LIBCPP_HIDE_FROM_ABI
- static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) {
- return __p;
- }
- _LIBCPP_HIDE_FROM_ABI
- static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) {
- return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p));
+ _LIBCPP_HIDE_FROM_ABI static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) { return __p; }
+ _LIBCPP_HIDE_FROM_ABI static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) {
+ return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p));
}
};
template <class _NodePtr>
-struct __forward_begin_node
-{
- typedef _NodePtr pointer;
- typedef __rebind_pointer_t<_NodePtr, __forward_begin_node> __begin_node_pointer;
+struct __forward_begin_node {
+ typedef _NodePtr pointer;
+ typedef __rebind_pointer_t<_NodePtr, __forward_begin_node> __begin_node_pointer;
- pointer __next_;
+ pointer __next_;
- _LIBCPP_HIDE_FROM_ABI __forward_begin_node() : __next_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI explicit __forward_begin_node(pointer __n) : __next_(__n) {}
+ _LIBCPP_HIDE_FROM_ABI __forward_begin_node() : __next_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_begin_node(pointer __n) : __next_(__n) {}
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __next_as_begin() const {
- return static_cast<__begin_node_pointer>(__next_);
- }
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __next_as_begin() const {
+ return static_cast<__begin_node_pointer>(__next_);
+ }
};
template <class _Tp, class _VoidPtr>
using __begin_node_of = __forward_begin_node<__rebind_pointer_t<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> > >;
template <class _Tp, class _VoidPtr>
-struct __forward_list_node
- : public __begin_node_of<_Tp, _VoidPtr>
-{
- typedef _Tp value_type;
- typedef __begin_node_of<_Tp, _VoidPtr> _Base;
- typedef typename _Base::pointer _NodePtr;
+struct __forward_list_node : public __begin_node_of<_Tp, _VoidPtr> {
+ typedef _Tp value_type;
+ typedef __begin_node_of<_Tp, _VoidPtr> _Base;
+ typedef typename _Base::pointer _NodePtr;
- // We allow starting the lifetime of nodes without initializing the value held by the node,
- // since that is handled by the list itself in order to be allocator-aware.
+ // We allow starting the lifetime of nodes without initializing the value held by the node,
+ // since that is handled by the list itself in order to be allocator-aware.
#ifndef _LIBCPP_CXX03_LANG
+
private:
- union {
- _Tp __value_;
- };
+ union {
+ _Tp __value_;
+ };
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
#else
+
private:
- _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
+ _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() {
- return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_));
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_)); }
#endif
- _LIBCPP_HIDE_FROM_ABI explicit __forward_list_node(_NodePtr __next) : _Base(__next) {}
- _LIBCPP_HIDE_FROM_ABI ~__forward_list_node() {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_node(_NodePtr __next) : _Base(__next) {}
+ _LIBCPP_HIDE_FROM_ABI ~__forward_list_node() {}
};
-
-template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS forward_list;
-template<class _NodeConstPtr> class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
+template <class _Tp, class _Alloc = allocator<_Tp> >
+class _LIBCPP_TEMPLATE_VIS forward_list;
+template <class _NodeConstPtr>
+class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
template <class _NodePtr>
-class _LIBCPP_TEMPLATE_VIS __forward_list_iterator
-{
- typedef __forward_node_traits<_NodePtr> __traits;
- typedef typename __traits::__node_pointer __node_pointer;
- typedef typename __traits::__begin_node_pointer __begin_node_pointer;
- typedef typename __traits::__iter_node_pointer __iter_node_pointer;
- typedef typename __traits::__void_pointer __void_pointer;
-
- __iter_node_pointer __ptr_;
-
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __get_begin() const {
- return static_cast<__begin_node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __get_unsafe_node_pointer() const {
- return static_cast<__node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
+class _LIBCPP_TEMPLATE_VIS __forward_list_iterator {
+ typedef __forward_node_traits<_NodePtr> __traits;
+ typedef typename __traits::__node_pointer __node_pointer;
+ typedef typename __traits::__begin_node_pointer __begin_node_pointer;
+ typedef typename __traits::__iter_node_pointer __iter_node_pointer;
+ typedef typename __traits::__void_pointer __void_pointer;
+
+ __iter_node_pointer __ptr_;
+
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
+ return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
+ return static_cast<__node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_iterator(__begin_node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator(__begin_node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
- template<class, class> friend class _LIBCPP_TEMPLATE_VIS forward_list;
- template<class> friend class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
+ template <class, class>
+ friend class _LIBCPP_TEMPLATE_VIS forward_list;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename __traits::__node_value_type value_type;
- typedef value_type& reference;
- typedef typename pointer_traits<__node_pointer>::difference_type
- difference_type;
- typedef __rebind_pointer_t<__node_pointer, value_type> pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __get_unsafe_node_pointer()->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {
- return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__get_value());
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename __traits::__node_value_type value_type;
+ typedef value_type& reference;
+ typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
+ typedef __rebind_pointer_t<__node_pointer, value_type> pointer;
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_iterator& operator++()
- {
- __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_iterator operator++(int)
- {
- __forward_list_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ _LIBCPP_HIDE_FROM_ABI __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_unsafe_node_pointer()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __forward_list_iterator& __x,
- const __forward_list_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __forward_list_iterator& __x,
- const __forward_list_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __forward_list_iterator& operator++() {
+ __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __forward_list_iterator operator++(int) {
+ __forward_list_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __forward_list_iterator& __x, const __forward_list_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __forward_list_iterator& __x, const __forward_list_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _NodeConstPtr>
-class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator
-{
- static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), "");
- typedef _NodeConstPtr _NodePtr;
-
- typedef __forward_node_traits<_NodePtr> __traits;
- typedef typename __traits::__node_type __node_type;
- typedef typename __traits::__node_pointer __node_pointer;
- typedef typename __traits::__begin_node_pointer __begin_node_pointer;
- typedef typename __traits::__iter_node_pointer __iter_node_pointer;
- typedef typename __traits::__void_pointer __void_pointer;
+class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator {
+ static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), "");
+ typedef _NodeConstPtr _NodePtr;
- __iter_node_pointer __ptr_;
+ typedef __forward_node_traits<_NodePtr> __traits;
+ typedef typename __traits::__node_type __node_type;
+ typedef typename __traits::__node_pointer __node_pointer;
+ typedef typename __traits::__begin_node_pointer __begin_node_pointer;
+ typedef typename __traits::__iter_node_pointer __iter_node_pointer;
+ typedef typename __traits::__void_pointer __void_pointer;
- _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
- return static_cast<__begin_node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
- _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
- return static_cast<__node_pointer>(
- static_cast<__void_pointer>(__ptr_));
- }
+ __iter_node_pointer __ptr_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_const_iterator(nullptr_t) _NOEXCEPT
- : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
+ return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
+ return static_cast<__node_pointer>(static_cast<__void_pointer>(__ptr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_const_iterator(__begin_node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_const_iterator(__node_pointer __p) _NOEXCEPT
- : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator(__begin_node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator(__node_pointer __p) _NOEXCEPT
+ : __ptr_(__traits::__as_iter_node(__p)) {}
- template<class, class> friend class forward_list;
+ template <class, class>
+ friend class forward_list;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename __traits::__node_value_type value_type;
- typedef const value_type& reference;
- typedef typename pointer_traits<__node_pointer>::difference_type
- difference_type;
- typedef __rebind_pointer_t<__node_pointer, const value_type>
- pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
- : __ptr_(__p.__ptr_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __get_unsafe_node_pointer()->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(
- __get_unsafe_node_pointer()->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator& operator++()
- {
- __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_const_iterator operator++(int)
- {
- __forward_list_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename __traits::__node_value_type value_type;
+ typedef const value_type& reference;
+ typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
+ typedef __rebind_pointer_t<__node_pointer, const value_type> pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
+ : __ptr_(__p.__ptr_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_unsafe_node_pointer()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __forward_list_const_iterator& __x,
- const __forward_list_const_iterator& __y)
- {return __x.__ptr_ == __y.__ptr_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __forward_list_const_iterator& __x,
- const __forward_list_const_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator& operator++() {
+ __ptr_ = __traits::__as_iter_node(__ptr_->__next_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __forward_list_const_iterator operator++(int) {
+ __forward_list_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __forward_list_const_iterator& __x, const __forward_list_const_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __forward_list_const_iterator& __x, const __forward_list_const_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _Tp, class _Alloc>
-class __forward_list_base
-{
+class __forward_list_base {
protected:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
-
- typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
- typedef __forward_list_node<value_type, void_pointer> __node_type;
- typedef __begin_node_of<value_type, void_pointer> __begin_node;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __node_type> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_traits;
- typedef typename __node_traits::pointer __node_pointer;
-
- typedef __rebind_alloc<allocator_traits<allocator_type>, __begin_node> __begin_node_allocator;
- typedef typename allocator_traits<__begin_node_allocator>::pointer
- __begin_node_pointer;
-
- __compressed_pair<__begin_node, __node_allocator> __before_begin_;
-
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __before_begin() _NOEXCEPT
- {return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());}
- _LIBCPP_HIDE_FROM_ABI
- __begin_node_pointer __before_begin() const _NOEXCEPT
- {return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));}
-
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __alloc() _NOEXCEPT
- {return __before_begin_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __alloc() const _NOEXCEPT
- {return __before_begin_.second();}
-
- typedef __forward_list_iterator<__node_pointer> iterator;
- typedef __forward_list_const_iterator<__node_pointer> const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_base()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- : __before_begin_(__begin_node(), __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_base(const allocator_type& __a)
- : __before_begin_(__begin_node(), __node_allocator(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __forward_list_base(const __node_allocator& __a)
- : __before_begin_(__begin_node(), __a) {}
+ typedef _Tp value_type;
+ typedef _Alloc allocator_type;
+
+ typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
+ typedef __forward_list_node<value_type, void_pointer> __node_type;
+ typedef __begin_node_of<value_type, void_pointer> __begin_node;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __node_type> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_traits;
+ typedef typename __node_traits::pointer __node_pointer;
+
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __begin_node> __begin_node_allocator;
+ typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer;
+
+ __compressed_pair<__begin_node, __node_allocator> __before_begin_;
+
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() _NOEXCEPT {
+ return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());
+ }
+ _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() const _NOEXCEPT {
+ return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __alloc() _NOEXCEPT { return __before_begin_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __alloc() const _NOEXCEPT { return __before_begin_.second(); }
+
+ typedef __forward_list_iterator<__node_pointer> iterator;
+ typedef __forward_list_const_iterator<__node_pointer> const_iterator;
+
+ _LIBCPP_HIDE_FROM_ABI __forward_list_base() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+ : __before_begin_(__begin_node(), __default_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const allocator_type& __a)
+ : __before_begin_(__begin_node(), __node_allocator(__a)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const __node_allocator& __a)
+ : __before_begin_(__begin_node(), __a) {}
#ifndef _LIBCPP_CXX03_LANG
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x)
+ _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
private:
- __forward_list_base(const __forward_list_base&);
- __forward_list_base& operator=(const __forward_list_base&);
+ __forward_list_base(const __forward_list_base&);
+ __forward_list_base& operator=(const __forward_list_base&);
public:
- _LIBCPP_HIDE_FROM_ABI ~__forward_list_base();
+ _LIBCPP_HIDE_FROM_ABI ~__forward_list_base();
protected:
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __forward_list_base& __x)
- {__copy_assign_alloc(__x, integral_constant<bool,
- __node_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__forward_list_base& __x)
- _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__x, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());}
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__node_pointer __next, _Args&& ...__args) {
- __node_allocator& __a = __alloc();
- __allocation_guard<__node_allocator> __guard(__a, 1);
- // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
- // held inside the node, since we need to use the allocator's construct() method for that.
- //
- // We don't use the allocator's construct() method to construct the node itself since the
- // Cpp17FooInsertable named requirements don't require the allocator's construct() method
- // to work on anything other than the value_type.
- std::__construct_at(std::addressof(*__guard.__get()), __next);
-
- // Now construct the value_type using the allocator's construct() method.
- __node_traits::construct(__a, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
- return __guard.__release_ptr();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __forward_list_base& __x) {
+ __copy_assign_alloc(__x, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
+ }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
- // For the same reason as above, we use the allocator's destroy() method for the value_type,
- // but not for the node itself.
- __node_allocator& __a = __alloc();
- __node_traits::destroy(__a, std::addressof(__node->__get_value()));
- std::__destroy_at(std::addressof(*__node));
- __node_traits::deallocate(__a, __node, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__forward_list_base& __x)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign_alloc(__x, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__node_pointer __next, _Args&&... __args) {
+ __node_allocator& __a = __alloc();
+ __allocation_guard<__node_allocator> __guard(__a, 1);
+ // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
+ // held inside the node, since we need to use the allocator's construct() method for that.
+ //
+ // We don't use the allocator's construct() method to construct the node itself since the
+ // Cpp17FooInsertable named requirements don't require the allocator's construct() method
+ // to work on anything other than the value_type.
+ std::__construct_at(std::addressof(*__guard.__get()), __next);
+
+ // Now construct the value_type using the allocator's construct() method.
+ __node_traits::construct(__a, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
+ return __guard.__release_ptr();
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
+ // For the same reason as above, we use the allocator's destroy() method for the value_type,
+ // but not for the node itself.
+ __node_allocator& __a = __alloc();
+ __node_traits::destroy(__a, std::addressof(__node->__get_value()));
+ std::__destroy_at(std::addressof(*__node));
+ __node_traits::deallocate(__a, __node, 1);
+ }
public:
- _LIBCPP_HIDE_FROM_ABI
- void swap(__forward_list_base& __x)
+ _LIBCPP_HIDE_FROM_ABI void swap(__forward_list_base& __x)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value);
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value);
#endif
+
protected:
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
private:
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __forward_list_base&, false_type) {}
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __forward_list_base& __x, true_type)
- {
- if (__alloc() != __x.__alloc())
- clear();
- __alloc() = __x.__alloc();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __forward_list_base&, false_type) {}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __forward_list_base& __x, true_type) {
+ if (__alloc() != __x.__alloc())
+ clear();
+ __alloc() = __x.__alloc();
+ }
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__forward_list_base&, false_type) _NOEXCEPT
- {}
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__forward_list_base& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {__alloc() = std::move(__x.__alloc());}
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__forward_list_base&, false_type) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__forward_list_base& __x, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ __alloc() = std::move(__x.__alloc());
+ }
};
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline
-__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
- : __before_begin_(std::move(__x.__before_begin_))
-{
- __x.__before_begin()->__next_ = nullptr;
+inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
+ _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+ : __before_begin_(std::move(__x.__before_begin_)) {
+ __x.__before_begin()->__next_ = nullptr;
}
template <class _Tp, class _Alloc>
-inline
-__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
- const allocator_type& __a)
- : __before_begin_(__begin_node(), __node_allocator(__a))
-{
- if (__alloc() == __x.__alloc())
- {
- __before_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
- }
+inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, const allocator_type& __a)
+ : __before_begin_(__begin_node(), __node_allocator(__a)) {
+ if (__alloc() == __x.__alloc()) {
+ __before_begin()->__next_ = __x.__before_begin()->__next_;
+ __x.__before_begin()->__next_ = nullptr;
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
-{
- clear();
+__forward_list_base<_Tp, _Alloc>::~__forward_list_base() {
+ clear();
}
template <class _Tp, class _Alloc>
-inline
-void
-__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
+inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value)
#endif
{
- std::__swap_allocator(__alloc(), __x.__alloc(),
- integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
- using std::swap;
- swap(__before_begin()->__next_, __x.__before_begin()->__next_);
+ std::__swap_allocator(
+ __alloc(), __x.__alloc(), integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
+ using std::swap;
+ swap(__before_begin()->__next_, __x.__before_begin()->__next_);
}
template <class _Tp, class _Alloc>
-void
-__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
-{
- for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
- {
- __node_pointer __next = __p->__next_;
- __delete_node(__p);
- __p = __next;
- }
- __before_begin()->__next_ = nullptr;
+void __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT {
+ for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;) {
+ __node_pointer __next = __p->__next_;
+ __delete_node(__p);
+ __p = __next;
+ }
+ __before_begin()->__next_ = nullptr;
}
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS forward_list
- : private __forward_list_base<_Tp, _Alloc>
-{
- typedef __forward_list_base<_Tp, _Alloc> base;
- typedef typename base::__node_allocator __node_allocator;
- typedef typename base::__node_type __node_type;
- typedef typename base::__node_traits __node_traits;
- typedef typename base::__node_pointer __node_pointer;
- typedef typename base::__begin_node_pointer __begin_node_pointer;
+class _LIBCPP_TEMPLATE_VIS forward_list : private __forward_list_base<_Tp, _Alloc> {
+ typedef __forward_list_base<_Tp, _Alloc> base;
+ typedef typename base::__node_allocator __node_allocator;
+ typedef typename base::__node_type __node_type;
+ typedef typename base::__node_traits __node_traits;
+ typedef typename base::__node_pointer __node_pointer;
+ typedef typename base::__begin_node_pointer __begin_node_pointer;
public:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
+ typedef _Tp value_type;
+ typedef _Alloc allocator_type;
- static_assert(is_same<value_type, typename allocator_type::value_type>::value,
- "Allocator::value_type must be same type as value_type");
+ static_assert(is_same<value_type, typename allocator_type::value_type>::value,
+ "Allocator::value_type must be same type as value_type");
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
+ static_assert((!is_same<allocator_type, __node_allocator>::value),
+ "internal allocator type must differ from user-specified "
+ "type; otherwise overload resolution breaks");
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename allocator_traits<allocator_type>::pointer pointer;
- typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename allocator_traits<allocator_type>::pointer pointer;
+ typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
+ typedef typename allocator_traits<allocator_type>::size_type size_type;
+ typedef typename allocator_traits<allocator_type>::difference_type difference_type;
- typedef typename base::iterator iterator;
- typedef typename base::const_iterator const_iterator;
+ typedef typename base::iterator iterator;
+ typedef typename base::const_iterator const_iterator;
#if _LIBCPP_STD_VER >= 20
- typedef size_type __remove_return_type;
+ typedef size_type __remove_return_type;
#else
- typedef void __remove_return_type;
+ typedef void __remove_return_type;
#endif
- _LIBCPP_HIDE_FROM_ABI
- forward_list()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- {} // = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit forward_list(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI forward_list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {
+ } // = default;
+ _LIBCPP_HIDE_FROM_ABI explicit forward_list(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v);
- template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
- _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a)
- {
- insert_after(cbefore_begin(), __n, __v);
- }
+ template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
+ _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a) {
+ insert_after(cbefore_begin(), __n, __v);
+ }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI forward_list(_InputIterator __f, _InputIterator __l,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI forward_list(_InputIterator __f, _InputIterator __l,
- const allocator_type& __a,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ forward_list(_InputIterator __f,
+ _InputIterator __l,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ forward_list(_InputIterator __f,
+ _InputIterator __l,
+ const allocator_type& __a,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value>* = nullptr);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI forward_list(from_range_t, _Range&& __range,
- const allocator_type& __a = allocator_type()) : base(__a) {
- prepend_range(std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI forward_list(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ : base(__a) {
+ prepend_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x);
- _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x);
+ _LIBCPP_HIDE_FROM_ABI forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI forward_list& operator=(const forward_list& __x);
+ _LIBCPP_HIDE_FROM_ABI forward_list& operator=(const forward_list& __x);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- forward_list(forward_list&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<base>::value)
- : base(std::move(__x)) {}
- _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a);
-
- _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- forward_list& operator=(forward_list&& __x)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x) _NOEXCEPT_(is_nothrow_move_constructible<base>::value)
+ : base(std::move(__x)) {}
+ _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a);
+
+ _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI forward_list& operator=(forward_list&& __x) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI
- forward_list& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI forward_list& operator=(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- // ~forward_list() = default;
+ // ~forward_list() = default;
- template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI assign(_InputIterator __f, _InputIterator __l);
+ template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI assign(_InputIterator __f, _InputIterator __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void assign_range(_Range&& __range) {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(base::__alloc());}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT
- {return iterator(base::__before_begin()->__next_);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin()->__next_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT
- {return iterator(nullptr);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT
- {return const_iterator(nullptr);}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT
- {return const_iterator(base::__before_begin()->__next_);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT
- {return const_iterator(nullptr);}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator before_begin() _NOEXCEPT
- {return iterator(base::__before_begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator before_begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbefore_begin() const _NOEXCEPT
- {return const_iterator(base::__before_begin());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT
- {return base::__before_begin()->__next_ == nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {
- return std::min<size_type>(
- __node_traits::max_size(base::__alloc()),
- numeric_limits<difference_type>::max());
- }
+ _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(base::__alloc()); }
- _LIBCPP_HIDE_FROM_ABI
- reference front() {return base::__before_begin()->__next_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const {return base::__before_begin()->__next_->__get_value();}
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(base::__before_begin()->__next_); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
+ return const_iterator(base::__before_begin()->__next_);
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(nullptr); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(nullptr); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
+ return const_iterator(base::__before_begin()->__next_);
+ }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return const_iterator(nullptr); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator before_begin() _NOEXCEPT { return iterator(base::__before_begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator before_begin() const _NOEXCEPT { return const_iterator(base::__before_begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbefore_begin() const _NOEXCEPT {
+ return const_iterator(base::__before_begin());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
+ return base::__before_begin()->__next_ == nullptr;
+ }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(__node_traits::max_size(base::__alloc()), numeric_limits<difference_type>::max());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI reference front() { return base::__before_begin()->__next_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const { return base::__before_begin()->__next_->__get_value(); }
#ifndef _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER >= 17
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
-#else
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
-#endif
- _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
+# if _LIBCPP_STD_VER >= 17
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
+# else
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
+# endif
+ _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void prepend_range(_Range&& __range) {
- insert_range_after(cbefore_begin(), std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
+ insert_range_after(cbefore_begin(), std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void pop_front();
+ _LIBCPP_HIDE_FROM_ABI void pop_front();
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace_after(const_iterator __p, _Args&&... __args);
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_after(const_iterator __p, _Args&&... __args);
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, value_type&& __v);
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
- {return insert_after(__p, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, value_type&& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, initializer_list<value_type> __il) {
+ return insert_after(__p, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
- template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
+ template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_range_after(const_iterator __position, _Range&& __range) {
- return __insert_after_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_range_after(const_iterator __position, _Range&& __range) {
+ return __insert_after_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
+ }
#endif
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_after_with_sentinel(const_iterator __p, _InputIterator __f, _Sentinel __l);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_after_with_sentinel(const_iterator __p, _InputIterator __f, _Sentinel __l);
- _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase_after(const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI
- void swap(forward_list& __x)
+ _LIBCPP_HIDE_FROM_ABI void swap(forward_list& __x)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value)
#endif
- {base::swap(__x);}
-
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {base::clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void splice_after(const_iterator __p, forward_list&& __x);
- _LIBCPP_HIDE_FROM_ABI
- void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
- _LIBCPP_HIDE_FROM_ABI
- void splice_after(const_iterator __p, forward_list&& __x,
- const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x);
- _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
- _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x,
- const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __v);
- template <class _Predicate>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Predicate __pred);
- _LIBCPP_HIDE_FROM_ABI
- __remove_return_type unique() { return unique(__equal_to()); }
- template <class _BinaryPredicate>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPredicate __binary_pred);
+ {
+ base::swap(__x);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { base::clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list&& __x);
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
+ _LIBCPP_HIDE_FROM_ABI void
+ splice_after(const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x);
+ _LIBCPP_HIDE_FROM_ABI void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
+ _LIBCPP_HIDE_FROM_ABI void
+ splice_after(const_iterator __p, forward_list& __x, const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __v);
+ template <class _Predicate>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Predicate __pred);
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique() { return unique(__equal_to()); }
+ template <class _BinaryPredicate>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPredicate __binary_pred);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void merge(forward_list&& __x) {merge(__x, __less<>());}
- template <class _Compare>
- _LIBCPP_HIDE_FROM_ABI
- void merge(forward_list&& __x, _Compare __comp)
- {merge(__x, std::move(__comp));}
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list&& __x) { merge(__x, __less<>()); }
+ template <class _Compare>
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list&& __x, _Compare __comp) {
+ merge(__x, std::move(__comp));
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void merge(forward_list& __x) {merge(__x, __less<>());}
- template <class _Compare>
- _LIBCPP_HIDE_FROM_ABI void merge(forward_list& __x, _Compare __comp);
- _LIBCPP_HIDE_FROM_ABI
- void sort() {sort(__less<>());}
- template <class _Compare> _LIBCPP_HIDE_FROM_ABI void sort(_Compare __comp);
- _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list& __x) { merge(__x, __less<>()); }
+ template <class _Compare>
+ _LIBCPP_HIDE_FROM_ABI void merge(forward_list& __x, _Compare __comp);
+ _LIBCPP_HIDE_FROM_ABI void sort() { sort(__less<>()); }
+ template <class _Compare>
+ _LIBCPP_HIDE_FROM_ABI void sort(_Compare __comp);
+ _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
private:
-
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, false_type);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(forward_list& __x, false_type);
#endif // _LIBCPP_CXX03_LANG
- template <class _Iter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iter __f, _Sent __l);
+ template <class _Iter, class _Sent>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iter __f, _Sent __l);
- template <class _Compare>
- static _LIBCPP_HIDE_FROM_ABI
- __node_pointer
- __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp);
+ template <class _Compare>
+ static _LIBCPP_HIDE_FROM_ABI __node_pointer __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp);
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- template <class _Compare>
- static _LIBCPP_HIDDEN
- __node_pointer
- __sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ template <class _Compare>
+ static _LIBCPP_HIDDEN __node_pointer __sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
};
-
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(_InputIterator, _InputIterator)
- -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(_InputIterator, _InputIterator, _Alloc)
- -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+forward_list(_InputIterator, _InputIterator) -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+forward_list(_InputIterator, _InputIterator, _Alloc) -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-forward_list(from_range_t, _Range&&, _Alloc = _Alloc())
- -> forward_list<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+forward_list(from_range_t, _Range&&, _Alloc = _Alloc()) -> forward_list<ranges::range_value_t<_Range>, _Alloc>;
#endif
template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)
- : base(__a)
-{
-}
+inline forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a) : base(__a) {}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n)
-{
- if (__n > 0)
- {
- for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n,
- __p = __p->__next_as_begin())
- {
- __p->__next_ = this->__create_node(/* next = */nullptr);
- }
+forward_list<_Tp, _Alloc>::forward_list(size_type __n) {
+ if (__n > 0) {
+ for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, __p = __p->__next_as_begin()) {
+ __p->__next_ = this->__create_node(/* next = */ nullptr);
}
+ }
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n,
- const allocator_type& __base_alloc)
- : base ( __base_alloc )
-{
- if (__n > 0)
- {
- for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n,
- __p = __p->__next_as_begin())
- {
- __p->__next_ = this->__create_node(/* next = */nullptr);
- }
+forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __base_alloc) : base(__base_alloc) {
+ if (__n > 0) {
+ for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, __p = __p->__next_as_begin()) {
+ __p->__next_ = this->__create_node(/* next = */ nullptr);
}
+ }
}
#endif
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
-{
- insert_after(cbefore_begin(), __n, __v);
+forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) {
+ insert_after(cbefore_begin(), __n, __v);
}
template <class _Tp, class _Alloc>
template <class _InputIterator>
-forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*)
-{
- insert_after(cbefore_begin(), __f, __l);
+forward_list<_Tp, _Alloc>::forward_list(
+ _InputIterator __f, _InputIterator __l, __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*) {
+ insert_after(cbefore_begin(), __f, __l);
}
template <class _Tp, class _Alloc>
template <class _InputIterator>
-forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
- const allocator_type& __a,
- __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*)
- : base(__a)
-{
- insert_after(cbefore_begin(), __f, __l);
+forward_list<_Tp, _Alloc>::forward_list(
+ _InputIterator __f,
+ _InputIterator __l,
+ const allocator_type& __a,
+ __enable_if_t<__has_input_iterator_category<_InputIterator>::value>*)
+ : base(__a) {
+ insert_after(cbefore_begin(), __f, __l);
}
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x)
- : base(
- __node_traits::select_on_container_copy_construction(__x.__alloc())) {
+ : base(__node_traits::select_on_container_copy_construction(__x.__alloc())) {
insert_after(cbefore_begin(), __x.begin(), __x.end());
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
- const __type_identity_t<allocator_type>& __a)
- : base(__a)
-{
- insert_after(cbefore_begin(), __x.begin(), __x.end());
+forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, const __type_identity_t<allocator_type>& __a)
+ : base(__a) {
+ insert_after(cbefore_begin(), __x.begin(), __x.end());
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
-{
- if (this != std::addressof(__x))
- {
- base::__copy_assign_alloc(__x);
- assign(__x.begin(), __x.end());
- }
- return *this;
+forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) {
+ if (this != std::addressof(__x)) {
+ base::__copy_assign_alloc(__x);
+ assign(__x.begin(), __x.end());
+ }
+ return *this;
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
- const __type_identity_t<allocator_type>& __a)
- : base(std::move(__x), __a)
-{
- if (base::__alloc() != __x.__alloc())
- {
- typedef move_iterator<iterator> _Ip;
- insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
- }
+forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a)
+ : base(std::move(__x), __a) {
+ if (base::__alloc() != __x.__alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
+ }
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
-{
- insert_after(cbefore_begin(), __il.begin(), __il.end());
+forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il) {
+ insert_after(cbefore_begin(), __il.begin(), __il.end());
}
template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
- const allocator_type& __a)
- : base(__a)
-{
- insert_after(cbefore_begin(), __il.begin(), __il.end());
+forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il, const allocator_type& __a) : base(__a) {
+ insert_after(cbefore_begin(), __il.begin(), __il.end());
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- clear();
- base::__move_assign_alloc(__x);
- base::__before_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
+void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ clear();
+ base::__move_assign_alloc(__x);
+ base::__before_begin()->__next_ = __x.__before_begin()->__next_;
+ __x.__before_begin()->__next_ = nullptr;
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
-{
- if (base::__alloc() == __x.__alloc())
- __move_assign(__x, true_type());
- else
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__x.begin()), _Ip(__x.end()));
- }
+void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) {
+ if (base::__alloc() == __x.__alloc())
+ __move_assign(__x, true_type());
+ else {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__x.begin()), _Ip(__x.end()));
+ }
}
template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
- _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
-{
- __move_assign(__x, integral_constant<bool,
- __node_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) _NOEXCEPT_(
+ __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign(__x, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Alloc>
-inline
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
-{
- assign(__il.begin(), __il.end());
- return *this;
+inline forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
-void
-forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
-{
+void forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) {
__assign_with_sentinel(__f, __l);
}
template <class _Tp, class _Alloc>
template <class _Iter, class _Sent>
-_LIBCPP_HIDE_FROM_ABI
-void forward_list<_Tp, _Alloc>::__assign_with_sentinel(_Iter __f, _Sent __l) {
- iterator __i = before_begin();
- iterator __j = std::next(__i);
- iterator __e = end();
- for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
- *__j = *__f;
- if (__j == __e)
- __insert_after_with_sentinel(__i, std::move(__f), std::move(__l));
- else
- erase_after(__i, __e);
+_LIBCPP_HIDE_FROM_ABI void forward_list<_Tp, _Alloc>::__assign_with_sentinel(_Iter __f, _Sent __l) {
+ iterator __i = before_begin();
+ iterator __j = std::next(__i);
+ iterator __e = end();
+ for (; __j != __e && __f != __l; ++__i, (void)++__j, ++__f)
+ *__j = *__f;
+ if (__j == __e)
+ __insert_after_with_sentinel(__i, std::move(__f), std::move(__l));
+ else
+ erase_after(__i, __e);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
-{
- iterator __i = before_begin();
- iterator __j = std::next(__i);
- iterator __e = end();
- for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
- *__j = __v;
- if (__j == __e)
- insert_after(__i, __n, __v);
- else
- erase_after(__i, __e);
+void forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) {
+ iterator __i = before_begin();
+ iterator __j = std::next(__i);
+ iterator __e = end();
+ for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
+ *__j = __v;
+ if (__j == __e)
+ insert_after(__i, __n, __v);
+ else
+ erase_after(__i, __e);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline
-void
-forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
-{
- assign(__il.begin(), __il.end());
+inline void forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
}
template <class _Tp, class _Alloc>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename forward_list<_Tp, _Alloc>::reference
-#else
+# else
void
-#endif
-forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
-{
- base::__before_begin()->__next_ = this->__create_node(/* next = */base::__before_begin()->__next_, std::forward<_Args>(__args)...);
-#if _LIBCPP_STD_VER >= 17
- return base::__before_begin()->__next_->__get_value();
-#endif
+# endif
+forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) {
+ base::__before_begin()->__next_ =
+ this->__create_node(/* next = */ base::__before_begin()->__next_, std::forward<_Args>(__args)...);
+# if _LIBCPP_STD_VER >= 17
+ return base::__before_begin()->__next_->__get_value();
+# endif
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
-{
- base::__before_begin()->__next_ = this->__create_node(/* next = */base::__before_begin()->__next_, std::move(__v));
+void forward_list<_Tp, _Alloc>::push_front(value_type&& __v) {
+ base::__before_begin()->__next_ = this->__create_node(/* next = */ base::__before_begin()->__next_, std::move(__v));
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
-{
- base::__before_begin()->__next_ = this->__create_node(/* next = */base::__before_begin()->__next_, __v);
+void forward_list<_Tp, _Alloc>::push_front(const value_type& __v) {
+ base::__before_begin()->__next_ = this->__create_node(/* next = */ base::__before_begin()->__next_, __v);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::pop_front()
-{
- __node_pointer __p = base::__before_begin()->__next_;
- base::__before_begin()->__next_ = __p->__next_;
- this->__delete_node(__p);
+void forward_list<_Tp, _Alloc>::pop_front() {
+ __node_pointer __p = base::__before_begin()->__next_;
+ base::__before_begin()->__next_ = __p->__next_;
+ this->__delete_node(__p);
}
#ifndef _LIBCPP_CXX03_LANG
@@ -1292,544 +1109,427 @@ forward_list<_Tp, _Alloc>::pop_front()
template <class _Tp, class _Alloc>
template <class... _Args>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __r->__next_ = this->__create_node(/* next = */__r->__next_, std::forward<_Args>(__args)...);
- return iterator(__r->__next_);
+forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) {
+ __begin_node_pointer const __r = __p.__get_begin();
+ __r->__next_ = this->__create_node(/* next = */ __r->__next_, std::forward<_Args>(__args)...);
+ return iterator(__r->__next_);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __r->__next_ = this->__create_node(/* next = */__r->__next_, std::move(__v));
- return iterator(__r->__next_);
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) {
+ __begin_node_pointer const __r = __p.__get_begin();
+ __r->__next_ = this->__create_node(/* next = */ __r->__next_, std::move(__v));
+ return iterator(__r->__next_);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
-{
- __begin_node_pointer const __r = __p.__get_begin();
- __r->__next_ = this->__create_node(/* next = */__r->__next_, __v);
- return iterator(__r->__next_);
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v) {
+ __begin_node_pointer const __r = __p.__get_begin();
+ __r->__next_ = this->__create_node(/* next = */ __r->__next_, __v);
+ return iterator(__r->__next_);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
- const value_type& __v)
-{
- __begin_node_pointer __r = __p.__get_begin();
- if (__n > 0)
- {
- __node_pointer __first = this->__create_node(/* next = */nullptr, __v);
- __node_pointer __last = __first;
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, const value_type& __v) {
+ __begin_node_pointer __r = __p.__get_begin();
+ if (__n > 0) {
+ __node_pointer __first = this->__create_node(/* next = */ nullptr, __v);
+ __node_pointer __last = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, __last = __last->__next_)
- {
- __last->__next_ = this->__create_node(/* next = */nullptr, __v);
- }
+ for (--__n; __n != 0; --__n, __last = __last->__next_) {
+ __last->__next_ = this->__create_node(/* next = */ nullptr, __v);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (__first != nullptr)
- {
- __node_pointer __next = __first->__next_;
- this->__delete_node(__first);
- __first = __next;
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __last->__next_ = __r->__next_;
- __r->__next_ = __first;
- __r = static_cast<__begin_node_pointer>(__last);
+ } catch (...) {
+ while (__first != nullptr) {
+ __node_pointer __next = __first->__next_;
+ this->__delete_node(__first);
+ __first = __next;
+ }
+ throw;
}
- return iterator(__r);
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __last->__next_ = __r->__next_;
+ __r->__next_ = __first;
+ __r = static_cast<__begin_node_pointer>(__last);
+ }
+ return iterator(__r);
}
template <class _Tp, class _Alloc>
template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
- _InputIterator __f, _InputIterator __l)
-{
+forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l) {
return __insert_after_with_sentinel(__p, std::move(__f), std::move(__l));
}
template <class _Tp, class _Alloc>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename forward_list<_Tp, _Alloc>::iterator
+_LIBCPP_HIDE_FROM_ABI typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::__insert_after_with_sentinel(const_iterator __p, _InputIterator __f, _Sentinel __l) {
- __begin_node_pointer __r = __p.__get_begin();
+ __begin_node_pointer __r = __p.__get_begin();
- if (__f != __l)
- {
- __node_pointer __first = this->__create_node(/* next = */nullptr, *__f);
- __node_pointer __last = __first;
+ if (__f != __l) {
+ __node_pointer __first = this->__create_node(/* next = */ nullptr, *__f);
+ __node_pointer __last = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
- {
- __last->__next_ = this->__create_node(/* next = */nullptr, *__f);
- }
+ for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) {
+ __last->__next_ = this->__create_node(/* next = */ nullptr, *__f);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (__first != nullptr)
- {
- __node_pointer __next = __first->__next_;
- this->__delete_node(__first);
- __first = __next;
- }
- throw;
- }
+ } catch (...) {
+ while (__first != nullptr) {
+ __node_pointer __next = __first->__next_;
+ this->__delete_node(__first);
+ __first = __next;
+ }
+ throw;
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __last->__next_ = __r->__next_;
- __r->__next_ = __first;
- __r = static_cast<__begin_node_pointer>(__last);
- }
+ __last->__next_ = __r->__next_;
+ __r->__next_ = __first;
+ __r = static_cast<__begin_node_pointer>(__last);
+ }
- return iterator(__r);
+ return iterator(__r);
}
template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
-{
- __begin_node_pointer __p = __f.__get_begin();
- __node_pointer __n = __p->__next_;
- __p->__next_ = __n->__next_;
- this->__delete_node(__n);
- return iterator(__p->__next_);
+typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::erase_after(const_iterator __f) {
+ __begin_node_pointer __p = __f.__get_begin();
+ __node_pointer __n = __p->__next_;
+ __p->__next_ = __n->__next_;
+ this->__delete_node(__n);
+ return iterator(__p->__next_);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
-forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
-{
- __node_pointer __e = __l.__get_unsafe_node_pointer();
- if (__f != __l)
- {
- __begin_node_pointer __bp = __f.__get_begin();
-
- __node_pointer __n = __bp->__next_;
- if (__n != __e)
- {
- __bp->__next_ = __e;
- do
- {
- __node_pointer __tmp = __n->__next_;
- this->__delete_node(__n);
- __n = __tmp;
- } while (__n != __e);
- }
+forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l) {
+ __node_pointer __e = __l.__get_unsafe_node_pointer();
+ if (__f != __l) {
+ __begin_node_pointer __bp = __f.__get_begin();
+
+ __node_pointer __n = __bp->__next_;
+ if (__n != __e) {
+ __bp->__next_ = __e;
+ do {
+ __node_pointer __tmp = __n->__next_;
+ this->__delete_node(__n);
+ __n = __tmp;
+ } while (__n != __e);
}
- return iterator(__e);
+ }
+ return iterator(__e);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::resize(size_type __n)
-{
- size_type __sz = 0;
- iterator __p = before_begin();
- iterator __i = begin();
- iterator __e = end();
- for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
- ;
- if (__i != __e)
- erase_after(__p, __e);
- else
- {
- __n -= __sz;
- if (__n > 0)
- {
- for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n,
- __ptr = __ptr->__next_as_begin())
- {
- __ptr->__next_ = this->__create_node(/* next = */nullptr);
- }
- }
+void forward_list<_Tp, _Alloc>::resize(size_type __n) {
+ size_type __sz = 0;
+ iterator __p = before_begin();
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
+ ;
+ if (__i != __e)
+ erase_after(__p, __e);
+ else {
+ __n -= __sz;
+ if (__n > 0) {
+ for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, __ptr = __ptr->__next_as_begin()) {
+ __ptr->__next_ = this->__create_node(/* next = */ nullptr);
+ }
}
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
-{
- size_type __sz = 0;
- iterator __p = before_begin();
- iterator __i = begin();
- iterator __e = end();
- for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
- ;
- if (__i != __e)
- erase_after(__p, __e);
- else
- {
- __n -= __sz;
- if (__n > 0)
- {
- for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n,
- __ptr = __ptr->__next_as_begin())
- {
- __ptr->__next_ = this->__create_node(/* next = */nullptr, __v);
- }
- }
+void forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v) {
+ size_type __sz = 0;
+ iterator __p = before_begin();
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz)
+ ;
+ if (__i != __e)
+ erase_after(__p, __e);
+ else {
+ __n -= __sz;
+ if (__n > 0) {
+ for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, __ptr = __ptr->__next_as_begin()) {
+ __ptr->__next_ = this->__create_node(/* next = */ nullptr, __v);
+ }
}
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& __x)
-{
- if (!__x.empty())
- {
- if (__p.__get_begin()->__next_ != nullptr)
- {
- const_iterator __lm1 = __x.before_begin();
- while (__lm1.__get_begin()->__next_ != nullptr)
- ++__lm1;
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- }
- __p.__get_begin()->__next_ = __x.__before_begin()->__next_;
- __x.__before_begin()->__next_ = nullptr;
+void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& __x) {
+ if (!__x.empty()) {
+ if (__p.__get_begin()->__next_ != nullptr) {
+ const_iterator __lm1 = __x.before_begin();
+ while (__lm1.__get_begin()->__next_ != nullptr)
+ ++__lm1;
+ __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
}
+ __p.__get_begin()->__next_ = __x.__before_begin()->__next_;
+ __x.__before_begin()->__next_ = nullptr;
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& /*__other*/,
- const_iterator __i)
-{
- const_iterator __lm1 = std::next(__i);
- if (__p != __i && __p != __lm1)
- {
- __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_;
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer();
- }
+void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& /*__other*/, const_iterator __i) {
+ const_iterator __lm1 = std::next(__i);
+ if (__p != __i && __p != __lm1) {
+ __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_;
+ __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
+ __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer();
+ }
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list& /*__other*/,
- const_iterator __f, const_iterator __l)
-{
- if (__f != __l && __p != __f)
- {
- const_iterator __lm1 = __f;
- while (__lm1.__get_begin()->__next_ != __l.__get_begin())
- ++__lm1;
- if (__f != __lm1)
- {
- __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
- __p.__get_begin()->__next_ = __f.__get_begin()->__next_;
- __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer();
- }
+void forward_list<_Tp, _Alloc>::splice_after(
+ const_iterator __p, forward_list& /*__other*/, const_iterator __f, const_iterator __l) {
+ if (__f != __l && __p != __f) {
+ const_iterator __lm1 = __f;
+ while (__lm1.__get_begin()->__next_ != __l.__get_begin())
+ ++__lm1;
+ if (__f != __lm1) {
+ __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_;
+ __p.__get_begin()->__next_ = __f.__get_begin()->__next_;
+ __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer();
}
+ }
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x)
-{
- splice_after(__p, __x);
+inline _LIBCPP_HIDE_FROM_ABI void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list&& __x) {
+ splice_after(__p, __x);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x,
- const_iterator __i)
-{
- splice_after(__p, __x, __i);
+inline _LIBCPP_HIDE_FROM_ABI void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list&& __x, const_iterator __i) {
+ splice_after(__p, __x, __i);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
- forward_list&& __x,
- const_iterator __f, const_iterator __l)
-{
- splice_after(__p, __x, __f, __l);
+inline _LIBCPP_HIDE_FROM_ABI void forward_list<_Tp, _Alloc>::splice_after(
+ const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l) {
+ splice_after(__p, __x, __f, __l);
}
template <class _Tp, class _Alloc>
-typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::remove(const value_type& __v)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- const iterator __e = end();
- for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
- {
- if (__i.__get_begin()->__next_->__get_value() == __v)
- {
- ++__count_removed;
- iterator __j = std::next(__i, 2);
- for (; __j != __e && *__j == __v; ++__j)
- ++__count_removed;
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- if (__j == __e)
- break;
- __i = __j;
- }
- else
- ++__i;
- }
+typename forward_list<_Tp, _Alloc>::__remove_return_type forward_list<_Tp, _Alloc>::remove(const value_type& __v) {
+ forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+ const iterator __e = end();
+ for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) {
+ if (__i.__get_begin()->__next_->__get_value() == __v) {
+ ++__count_removed;
+ iterator __j = std::next(__i, 2);
+ for (; __j != __e && *__j == __v; ++__j)
+ ++__count_removed;
+ __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+ if (__j == __e)
+ break;
+ __i = __j;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __count_removed;
+ return (__remove_return_type)__count_removed;
}
template <class _Tp, class _Alloc>
template <class _Predicate>
-typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- const iterator __e = end();
- for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
- {
- if (__pred(__i.__get_begin()->__next_->__get_value()))
- {
- ++__count_removed;
- iterator __j = std::next(__i, 2);
- for (; __j != __e && __pred(*__j); ++__j)
- ++__count_removed;
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- if (__j == __e)
- break;
- __i = __j;
- }
- else
- ++__i;
- }
+typename forward_list<_Tp, _Alloc>::__remove_return_type forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) {
+ forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+ const iterator __e = end();
+ for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) {
+ if (__pred(__i.__get_begin()->__next_->__get_value())) {
+ ++__count_removed;
+ iterator __j = std::next(__i, 2);
+ for (; __j != __e && __pred(*__j); ++__j)
+ ++__count_removed;
+ __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+ if (__j == __e)
+ break;
+ __i = __j;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __count_removed;
+ return (__remove_return_type)__count_removed;
}
template <class _Tp, class _Alloc>
template <class _BinaryPredicate>
typename forward_list<_Tp, _Alloc>::__remove_return_type
-forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
-{
- forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- iterator __j = std::next(__i);
- for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
- ++__count_removed;
- if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
- __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
- __i = __j;
- }
+forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred) {
+ forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
+ for (iterator __i = begin(), __e = end(); __i != __e;) {
+ iterator __j = std::next(__i);
+ for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
+ ++__count_removed;
+ if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
+ __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+ __i = __j;
+ }
- return (__remove_return_type) __count_removed;
+ return (__remove_return_type)__count_removed;
}
template <class _Tp, class _Alloc>
template <class _Compare>
-void
-forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
-{
- if (this != std::addressof(__x))
- {
- base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_,
- __x.__before_begin()->__next_,
- __comp);
- __x.__before_begin()->__next_ = nullptr;
- }
+void forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp) {
+ if (this != std::addressof(__x)) {
+ base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_, __x.__before_begin()->__next_, __comp);
+ __x.__before_begin()->__next_ = nullptr;
+ }
}
template <class _Tp, class _Alloc>
template <class _Compare>
typename forward_list<_Tp, _Alloc>::__node_pointer
-forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2,
- _Compare& __comp)
-{
- if (__f1 == nullptr)
- return __f2;
- if (__f2 == nullptr)
- return __f1;
- __node_pointer __r;
- if (__comp(__f2->__get_value(), __f1->__get_value()))
- {
- __node_pointer __t = __f2;
- while (__t->__next_ != nullptr &&
- __comp(__t->__next_->__get_value(), __f1->__get_value()))
- __t = __t->__next_;
- __r = __f2;
- __f2 = __t->__next_;
- __t->__next_ = __f1;
+forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp) {
+ if (__f1 == nullptr)
+ return __f2;
+ if (__f2 == nullptr)
+ return __f1;
+ __node_pointer __r;
+ if (__comp(__f2->__get_value(), __f1->__get_value())) {
+ __node_pointer __t = __f2;
+ while (__t->__next_ != nullptr && __comp(__t->__next_->__get_value(), __f1->__get_value()))
+ __t = __t->__next_;
+ __r = __f2;
+ __f2 = __t->__next_;
+ __t->__next_ = __f1;
+ } else
+ __r = __f1;
+ __node_pointer __p = __f1;
+ __f1 = __f1->__next_;
+ while (__f1 != nullptr && __f2 != nullptr) {
+ if (__comp(__f2->__get_value(), __f1->__get_value())) {
+ __node_pointer __t = __f2;
+ while (__t->__next_ != nullptr && __comp(__t->__next_->__get_value(), __f1->__get_value()))
+ __t = __t->__next_;
+ __p->__next_ = __f2;
+ __f2 = __t->__next_;
+ __t->__next_ = __f1;
}
- else
- __r = __f1;
- __node_pointer __p = __f1;
+ __p = __f1;
__f1 = __f1->__next_;
- while (__f1 != nullptr && __f2 != nullptr)
- {
- if (__comp(__f2->__get_value(), __f1->__get_value()))
- {
- __node_pointer __t = __f2;
- while (__t->__next_ != nullptr &&
- __comp(__t->__next_->__get_value(), __f1->__get_value()))
- __t = __t->__next_;
- __p->__next_ = __f2;
- __f2 = __t->__next_;
- __t->__next_ = __f1;
- }
- __p = __f1;
- __f1 = __f1->__next_;
- }
- if (__f2 != nullptr)
- __p->__next_ = __f2;
- return __r;
+ }
+ if (__f2 != nullptr)
+ __p->__next_ = __f2;
+ return __r;
}
template <class _Tp, class _Alloc>
template <class _Compare>
-inline
-void
-forward_list<_Tp, _Alloc>::sort(_Compare __comp)
-{
- base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
- std::distance(begin(), end()), __comp);
+inline void forward_list<_Tp, _Alloc>::sort(_Compare __comp) {
+ base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_, std::distance(begin(), end()), __comp);
}
template <class _Tp, class _Alloc>
template <class _Compare>
typename forward_list<_Tp, _Alloc>::__node_pointer
-forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
- _Compare& __comp)
-{
- switch (__sz)
- {
- case 0:
- case 1:
- return __f1;
- case 2:
- if (__comp(__f1->__next_->__get_value(), __f1->__get_value()))
- {
- __node_pointer __t = __f1->__next_;
- __t->__next_ = __f1;
- __f1->__next_ = nullptr;
- __f1 = __t;
- }
- return __f1;
+forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz, _Compare& __comp) {
+ switch (__sz) {
+ case 0:
+ case 1:
+ return __f1;
+ case 2:
+ if (__comp(__f1->__next_->__get_value(), __f1->__get_value())) {
+ __node_pointer __t = __f1->__next_;
+ __t->__next_ = __f1;
+ __f1->__next_ = nullptr;
+ __f1 = __t;
}
- difference_type __sz1 = __sz / 2;
- difference_type __sz2 = __sz - __sz1;
- __node_pointer __t = std::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer();
- __node_pointer __f2 = __t->__next_;
- __t->__next_ = nullptr;
- return __merge(__sort(__f1, __sz1, __comp),
- __sort(__f2, __sz2, __comp), __comp);
+ return __f1;
+ }
+ difference_type __sz1 = __sz / 2;
+ difference_type __sz2 = __sz - __sz1;
+ __node_pointer __t = std::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer();
+ __node_pointer __f2 = __t->__next_;
+ __t->__next_ = nullptr;
+ return __merge(__sort(__f1, __sz1, __comp), __sort(__f2, __sz2, __comp), __comp);
}
template <class _Tp, class _Alloc>
-void
-forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
-{
- __node_pointer __p = base::__before_begin()->__next_;
- if (__p != nullptr)
- {
- __node_pointer __f = __p->__next_;
- __p->__next_ = nullptr;
- while (__f != nullptr)
- {
- __node_pointer __t = __f->__next_;
- __f->__next_ = __p;
- __p = __f;
- __f = __t;
- }
- base::__before_begin()->__next_ = __p;
+void forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT {
+ __node_pointer __p = base::__before_begin()->__next_;
+ if (__p != nullptr) {
+ __node_pointer __f = __p->__next_;
+ __p->__next_ = nullptr;
+ while (__f != nullptr) {
+ __node_pointer __t = __f->__next_;
+ __f->__next_ = __p;
+ __p = __f;
+ __f = __t;
}
+ base::__before_begin()->__next_ = __p;
+ }
}
template <class _Tp, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI
-bool operator==(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- typedef forward_list<_Tp, _Alloc> _Cp;
- typedef typename _Cp::const_iterator _Ip;
- _Ip __ix = __x.begin();
- _Ip __ex = __x.end();
- _Ip __iy = __y.begin();
- _Ip __ey = __y.end();
- for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
- if (!(*__ix == *__iy))
- return false;
- return (__ix == __ex) == (__iy == __ey);
+_LIBCPP_HIDE_FROM_ABI bool operator==(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ typedef forward_list<_Tp, _Alloc> _Cp;
+ typedef typename _Cp::const_iterator _Ip;
+ _Ip __ix = __x.begin();
+ _Ip __ex = __x.end();
+ _Ip __iy = __y.begin();
+ _Ip __ey = __y.end();
+ for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
+ if (!(*__ix == *__iy))
+ return false;
+ return (__ix == __ex) == (__iy == __ey);
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator!=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator< (const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator> (const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator>=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator<=(const forward_list<_Tp, _Alloc>& __x,
- const forward_list<_Tp, _Alloc>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) {
+ return !(__y < __x);
}
#else // #if _LIBCPP_STD_VER <= 17
@@ -1837,33 +1537,28 @@ bool operator<=(const forward_list<_Tp, _Alloc>& __x,
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const forward_list<_Tp, _Allocator>& __x, const forward_list<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // #if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename forward_list<_Tp, _Allocator>::size_type
- erase_if(forward_list<_Tp, _Allocator>& __c, _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename forward_list<_Tp, _Allocator>::size_type
+erase_if(forward_list<_Tp, _Allocator>& __c, _Predicate __pred) {
return __c.remove_if(__pred);
}
template <class _Tp, class _Allocator, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
- typename forward_list<_Tp, _Allocator>::size_type
- erase(forward_list<_Tp, _Allocator>& __c, const _Up& __v) {
+inline _LIBCPP_HIDE_FROM_ABI typename forward_list<_Tp, _Allocator>::size_type
+erase(forward_list<_Tp, _Allocator>& __c, const _Up& __v) {
return std::erase_if(__c, [&](auto& __elem) { return __elem == __v; });
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/fstream b/contrib/llvm-project/libcxx/include/fstream
index 468ff42dc9bc..7a4e15b55d56 100644
--- a/contrib/llvm-project/libcxx/include/fstream
+++ b/contrib/llvm-project/libcxx/include/fstream
@@ -211,63 +211,54 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_filebuf
- : public basic_streambuf<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_filebuf : public basic_streambuf<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef typename traits_type::state_type state_type;
-
- // 27.9.1.2 Constructors/destructor:
- basic_filebuf();
- basic_filebuf(basic_filebuf&& __rhs);
- ~basic_filebuf() override;
-
- // 27.9.1.3 Assign/swap:
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf& operator=(basic_filebuf&& __rhs);
- void swap(basic_filebuf& __rhs);
-
- // 27.9.1.4 Members:
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- basic_filebuf* open(const char* __s, ios_base::openmode __mode);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf* open(const string& __s, ios_base::openmode __mode);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- basic_filebuf* open(const filesystem::path& __p, ios_base::openmode __mode) {
- return open(__p.c_str(), __mode);
- }
-#endif
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf* __open(int __fd, ios_base::openmode __mode);
- basic_filebuf* close();
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef typename traits_type::state_type state_type;
+
+ // 27.9.1.2 Constructors/destructor:
+ basic_filebuf();
+ basic_filebuf(basic_filebuf&& __rhs);
+ ~basic_filebuf() override;
+
+ // 27.9.1.3 Assign/swap:
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf& operator=(basic_filebuf&& __rhs);
+ void swap(basic_filebuf& __rhs);
+
+ // 27.9.1.4 Members:
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ basic_filebuf* open(const char* __s, ios_base::openmode __mode);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
+# endif
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf* open(const string& __s, ios_base::openmode __mode);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI basic_filebuf*
+ open(const filesystem::path& __p, ios_base::openmode __mode) {
+ return open(__p.c_str(), __mode);
+ }
+# endif
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf* __open(int __fd, ios_base::openmode __mode);
+ basic_filebuf* close();
- _LIBCPP_HIDE_FROM_ABI
- inline static const char*
- __make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI inline static const char* __make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
- protected:
- // 27.9.1.5 Overridden virtual functions:
- int_type underflow() override;
- int_type pbackfail(int_type __c = traits_type::eof()) override;
- int_type overflow (int_type __c = traits_type::eof()) override;
- basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n) override;
- pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override;
- pos_type seekpos(pos_type __sp,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override;
- int sync() override;
- void imbue(const locale& __loc) override;
+protected:
+ // 27.9.1.5 Overridden virtual functions:
+ int_type underflow() override;
+ int_type pbackfail(int_type __c = traits_type::eof()) override;
+ int_type overflow(int_type __c = traits_type::eof()) override;
+ basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n) override;
+ pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out) override;
+ pos_type seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out) override;
+ int sync() override;
+ void imbue(const locale& __loc) override;
private:
char* __extbuf_;
@@ -289,6 +280,8 @@ private:
bool __read_mode();
void __write_mode();
+
+ _LIBCPP_EXPORTED_FROM_ABI friend FILE* __get_ostream_file(ostream&);
};
template <class _CharT, class _Traits>
@@ -307,220 +300,173 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__cm_(0),
__owns_eb_(false),
__owns_ib_(false),
- __always_noconv_(false)
-{
- if (std::has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
- {
- __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(this->getloc());
- __always_noconv_ = __cv_->always_noconv();
- }
- setbuf(nullptr, 4096);
+ __always_noconv_(false) {
+ if (std::has_facet<codecvt<char_type, char, state_type> >(this->getloc())) {
+ __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(this->getloc());
+ __always_noconv_ = __cv_->always_noconv();
+ }
+ setbuf(nullptr, 4096);
}
template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
- : basic_streambuf<_CharT, _Traits>(__rhs)
-{
- if (__rhs.__extbuf_ == __rhs.__extbuf_min_)
- {
- __extbuf_ = __extbuf_min_;
- __extbufnext_ = __extbuf_ + (__rhs.__extbufnext_ - __rhs.__extbuf_);
- __extbufend_ = __extbuf_ + (__rhs.__extbufend_ - __rhs.__extbuf_);
- }
+basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) : basic_streambuf<_CharT, _Traits>(__rhs) {
+ if (__rhs.__extbuf_ == __rhs.__extbuf_min_) {
+ __extbuf_ = __extbuf_min_;
+ __extbufnext_ = __extbuf_ + (__rhs.__extbufnext_ - __rhs.__extbuf_);
+ __extbufend_ = __extbuf_ + (__rhs.__extbufend_ - __rhs.__extbuf_);
+ } else {
+ __extbuf_ = __rhs.__extbuf_;
+ __extbufnext_ = __rhs.__extbufnext_;
+ __extbufend_ = __rhs.__extbufend_;
+ }
+ __ebs_ = __rhs.__ebs_;
+ __intbuf_ = __rhs.__intbuf_;
+ __ibs_ = __rhs.__ibs_;
+ __file_ = __rhs.__file_;
+ __cv_ = __rhs.__cv_;
+ __st_ = __rhs.__st_;
+ __st_last_ = __rhs.__st_last_;
+ __om_ = __rhs.__om_;
+ __cm_ = __rhs.__cm_;
+ __owns_eb_ = __rhs.__owns_eb_;
+ __owns_ib_ = __rhs.__owns_ib_;
+ __always_noconv_ = __rhs.__always_noconv_;
+ if (__rhs.pbase()) {
+ if (__rhs.pbase() == __rhs.__intbuf_)
+ this->setp(__intbuf_, __intbuf_ + (__rhs.epptr() - __rhs.pbase()));
else
- {
- __extbuf_ = __rhs.__extbuf_;
- __extbufnext_ = __rhs.__extbufnext_;
- __extbufend_ = __rhs.__extbufend_;
- }
- __ebs_ = __rhs.__ebs_;
- __intbuf_ = __rhs.__intbuf_;
- __ibs_ = __rhs.__ibs_;
- __file_ = __rhs.__file_;
- __cv_ = __rhs.__cv_;
- __st_ = __rhs.__st_;
- __st_last_ = __rhs.__st_last_;
- __om_ = __rhs.__om_;
- __cm_ = __rhs.__cm_;
- __owns_eb_ = __rhs.__owns_eb_;
- __owns_ib_ = __rhs.__owns_ib_;
- __always_noconv_ = __rhs.__always_noconv_;
- if (__rhs.pbase())
- {
- if (__rhs.pbase() == __rhs.__intbuf_)
- this->setp(__intbuf_, __intbuf_ + (__rhs. epptr() - __rhs.pbase()));
- else
- this->setp((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__rhs. epptr() - __rhs.pbase()));
- this->__pbump(__rhs. pptr() - __rhs.pbase());
- }
- else if (__rhs.eback())
- {
- if (__rhs.eback() == __rhs.__intbuf_)
- this->setg(__intbuf_, __intbuf_ + (__rhs.gptr() - __rhs.eback()),
- __intbuf_ + (__rhs.egptr() - __rhs.eback()));
- else
- this->setg((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
- (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
- }
- __rhs.__extbuf_ = nullptr;
- __rhs.__extbufnext_ = nullptr;
- __rhs.__extbufend_ = nullptr;
- __rhs.__ebs_ = 0;
- __rhs.__intbuf_ = 0;
- __rhs.__ibs_ = 0;
- __rhs.__file_ = nullptr;
- __rhs.__st_ = state_type();
- __rhs.__st_last_ = state_type();
- __rhs.__om_ = 0;
- __rhs.__cm_ = 0;
- __rhs.__owns_eb_ = false;
- __rhs.__owns_ib_ = false;
- __rhs.setg(0, 0, 0);
- __rhs.setp(0, 0);
-}
-
-template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>&
-basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
-{
- close();
- swap(__rhs);
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>::~basic_filebuf()
-{
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- close();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
-}
-
-template <class _CharT, class _Traits>
-void
-basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
-{
- basic_streambuf<char_type, traits_type>::swap(__rhs);
- if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
- {
- // Neither *this nor __rhs uses the small buffer, so we can simply swap the pointers.
- std::swap(__extbuf_, __rhs.__extbuf_);
- std::swap(__extbufnext_, __rhs.__extbufnext_);
- std::swap(__extbufend_, __rhs.__extbufend_);
- }
+ this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__rhs.epptr() - __rhs.pbase()));
+ this->__pbump(__rhs.pptr() - __rhs.pbase());
+ } else if (__rhs.eback()) {
+ if (__rhs.eback() == __rhs.__intbuf_)
+ this->setg(__intbuf_, __intbuf_ + (__rhs.gptr() - __rhs.eback()), __intbuf_ + (__rhs.egptr() - __rhs.eback()));
else
- {
- ptrdiff_t __ln = __extbufnext_ ? __extbufnext_ - __extbuf_ : 0;
- ptrdiff_t __le = __extbufend_ ? __extbufend_ - __extbuf_ : 0;
- ptrdiff_t __rn = __rhs.__extbufnext_ ? __rhs.__extbufnext_ - __rhs.__extbuf_ : 0;
- ptrdiff_t __re = __rhs.__extbufend_ ? __rhs.__extbufend_ - __rhs.__extbuf_ : 0;
- if (__extbuf_ == __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
- {
- // *this uses the small buffer, but __rhs doesn't.
- __extbuf_ = __rhs.__extbuf_;
- __rhs.__extbuf_ = __rhs.__extbuf_min_;
- std::memmove(__rhs.__extbuf_min_, __extbuf_min_, sizeof(__extbuf_min_));
- }
- else if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ == __rhs.__extbuf_min_)
- {
- // *this doesn't use the small buffer, but __rhs does.
- __rhs.__extbuf_ = __extbuf_;
- __extbuf_ = __extbuf_min_;
- std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
- }
- else
- {
- // Both *this and __rhs use the small buffer.
- char __tmp[sizeof(__extbuf_min_)];
- std::memmove(__tmp, __extbuf_min_, sizeof(__extbuf_min_));
- std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
- std::memmove(__rhs.__extbuf_min_, __tmp, sizeof(__extbuf_min_));
- }
- __extbufnext_ = __extbuf_ + __rn;
- __extbufend_ = __extbuf_ + __re;
- __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
- __rhs.__extbufend_ = __rhs.__extbuf_ + __le;
- }
- std::swap(__ebs_, __rhs.__ebs_);
- std::swap(__intbuf_, __rhs.__intbuf_);
- std::swap(__ibs_, __rhs.__ibs_);
- std::swap(__file_, __rhs.__file_);
- std::swap(__cv_, __rhs.__cv_);
- std::swap(__st_, __rhs.__st_);
- std::swap(__st_last_, __rhs.__st_last_);
- std::swap(__om_, __rhs.__om_);
- std::swap(__cm_, __rhs.__cm_);
- std::swap(__owns_eb_, __rhs.__owns_eb_);
- std::swap(__owns_ib_, __rhs.__owns_ib_);
- std::swap(__always_noconv_, __rhs.__always_noconv_);
- if (this->eback() == (char_type*)__rhs.__extbuf_min_)
- {
- ptrdiff_t __n = this->gptr() - this->eback();
- ptrdiff_t __e = this->egptr() - this->eback();
- this->setg((char_type*)__extbuf_min_,
- (char_type*)__extbuf_min_ + __n,
- (char_type*)__extbuf_min_ + __e);
- }
- else if (this->pbase() == (char_type*)__rhs.__extbuf_min_)
- {
- ptrdiff_t __n = this->pptr() - this->pbase();
- ptrdiff_t __e = this->epptr() - this->pbase();
- this->setp((char_type*)__extbuf_min_,
- (char_type*)__extbuf_min_ + __e);
- this->__pbump(__n);
- }
- if (__rhs.eback() == (char_type*)__extbuf_min_)
- {
- ptrdiff_t __n = __rhs.gptr() - __rhs.eback();
- ptrdiff_t __e = __rhs.egptr() - __rhs.eback();
- __rhs.setg((char_type*)__rhs.__extbuf_min_,
- (char_type*)__rhs.__extbuf_min_ + __n,
- (char_type*)__rhs.__extbuf_min_ + __e);
- }
- else if (__rhs.pbase() == (char_type*)__extbuf_min_)
- {
- ptrdiff_t __n = __rhs.pptr() - __rhs.pbase();
- ptrdiff_t __e = __rhs.epptr() - __rhs.pbase();
- __rhs.setp((char_type*)__rhs.__extbuf_min_,
- (char_type*)__rhs.__extbuf_min_ + __e);
- __rhs.__pbump(__n);
+ this->setg((char_type*)__extbuf_,
+ (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
+ (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
+ }
+ __rhs.__extbuf_ = nullptr;
+ __rhs.__extbufnext_ = nullptr;
+ __rhs.__extbufend_ = nullptr;
+ __rhs.__ebs_ = 0;
+ __rhs.__intbuf_ = 0;
+ __rhs.__ibs_ = 0;
+ __rhs.__file_ = nullptr;
+ __rhs.__st_ = state_type();
+ __rhs.__st_last_ = state_type();
+ __rhs.__om_ = 0;
+ __rhs.__cm_ = 0;
+ __rhs.__owns_eb_ = false;
+ __rhs.__owns_ib_ = false;
+ __rhs.setg(0, 0, 0);
+ __rhs.setp(0, 0);
+}
+
+template <class _CharT, class _Traits>
+inline basic_filebuf<_CharT, _Traits>& basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) {
+ close();
+ swap(__rhs);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::~basic_filebuf() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ close();
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ }
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
+}
+
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs) {
+ basic_streambuf<char_type, traits_type>::swap(__rhs);
+ if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) {
+ // Neither *this nor __rhs uses the small buffer, so we can simply swap the pointers.
+ std::swap(__extbuf_, __rhs.__extbuf_);
+ std::swap(__extbufnext_, __rhs.__extbufnext_);
+ std::swap(__extbufend_, __rhs.__extbufend_);
+ } else {
+ ptrdiff_t __ln = __extbufnext_ ? __extbufnext_ - __extbuf_ : 0;
+ ptrdiff_t __le = __extbufend_ ? __extbufend_ - __extbuf_ : 0;
+ ptrdiff_t __rn = __rhs.__extbufnext_ ? __rhs.__extbufnext_ - __rhs.__extbuf_ : 0;
+ ptrdiff_t __re = __rhs.__extbufend_ ? __rhs.__extbufend_ - __rhs.__extbuf_ : 0;
+ if (__extbuf_ == __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) {
+ // *this uses the small buffer, but __rhs doesn't.
+ __extbuf_ = __rhs.__extbuf_;
+ __rhs.__extbuf_ = __rhs.__extbuf_min_;
+ std::memmove(__rhs.__extbuf_min_, __extbuf_min_, sizeof(__extbuf_min_));
+ } else if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ == __rhs.__extbuf_min_) {
+ // *this doesn't use the small buffer, but __rhs does.
+ __rhs.__extbuf_ = __extbuf_;
+ __extbuf_ = __extbuf_min_;
+ std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
+ } else {
+ // Both *this and __rhs use the small buffer.
+ char __tmp[sizeof(__extbuf_min_)];
+ std::memmove(__tmp, __extbuf_min_, sizeof(__extbuf_min_));
+ std::memmove(__extbuf_min_, __rhs.__extbuf_min_, sizeof(__extbuf_min_));
+ std::memmove(__rhs.__extbuf_min_, __tmp, sizeof(__extbuf_min_));
}
+ __extbufnext_ = __extbuf_ + __rn;
+ __extbufend_ = __extbuf_ + __re;
+ __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
+ __rhs.__extbufend_ = __rhs.__extbuf_ + __le;
+ }
+ std::swap(__ebs_, __rhs.__ebs_);
+ std::swap(__intbuf_, __rhs.__intbuf_);
+ std::swap(__ibs_, __rhs.__ibs_);
+ std::swap(__file_, __rhs.__file_);
+ std::swap(__cv_, __rhs.__cv_);
+ std::swap(__st_, __rhs.__st_);
+ std::swap(__st_last_, __rhs.__st_last_);
+ std::swap(__om_, __rhs.__om_);
+ std::swap(__cm_, __rhs.__cm_);
+ std::swap(__owns_eb_, __rhs.__owns_eb_);
+ std::swap(__owns_ib_, __rhs.__owns_ib_);
+ std::swap(__always_noconv_, __rhs.__always_noconv_);
+ if (this->eback() == (char_type*)__rhs.__extbuf_min_) {
+ ptrdiff_t __n = this->gptr() - this->eback();
+ ptrdiff_t __e = this->egptr() - this->eback();
+ this->setg((char_type*)__extbuf_min_, (char_type*)__extbuf_min_ + __n, (char_type*)__extbuf_min_ + __e);
+ } else if (this->pbase() == (char_type*)__rhs.__extbuf_min_) {
+ ptrdiff_t __n = this->pptr() - this->pbase();
+ ptrdiff_t __e = this->epptr() - this->pbase();
+ this->setp((char_type*)__extbuf_min_, (char_type*)__extbuf_min_ + __e);
+ this->__pbump(__n);
+ }
+ if (__rhs.eback() == (char_type*)__extbuf_min_) {
+ ptrdiff_t __n = __rhs.gptr() - __rhs.eback();
+ ptrdiff_t __e = __rhs.egptr() - __rhs.eback();
+ __rhs.setg(
+ (char_type*)__rhs.__extbuf_min_, (char_type*)__rhs.__extbuf_min_ + __n, (char_type*)__rhs.__extbuf_min_ + __e);
+ } else if (__rhs.pbase() == (char_type*)__extbuf_min_) {
+ ptrdiff_t __n = __rhs.pptr() - __rhs.pbase();
+ ptrdiff_t __e = __rhs.epptr() - __rhs.pbase();
+ __rhs.setp((char_type*)__rhs.__extbuf_min_, (char_type*)__rhs.__extbuf_min_ + __e);
+ __rhs.__pbump(__n);
+ }
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_filebuf<_CharT, _Traits>::is_open() const
-{
- return __file_ != nullptr;
+inline bool basic_filebuf<_CharT, _Traits>::is_open() const {
+ return __file_ != nullptr;
}
template <class _CharT, class _Traits>
-const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
- ios_base::openmode __mode) _NOEXCEPT {
+const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode __mode) _NOEXCEPT {
switch (__mode & ~ios_base::ate) {
case ios_base::out:
case ios_base::out | ios_base::trunc:
@@ -552,7 +498,7 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
case ios_base::in | ios_base::app | ios_base::binary:
return "a+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
case ios_base::out | ios_base::noreplace:
case ios_base::out | ios_base::trunc | ios_base::noreplace:
return "wx" _LIBCPP_FOPEN_CLOEXEC_MODE;
@@ -563,7 +509,7 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
return "wbx" _LIBCPP_FOPEN_CLOEXEC_MODE;
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary | ios_base::noreplace:
return "w+bx" _LIBCPP_FOPEN_CLOEXEC_MODE;
-#endif // _LIBCPP_STD_VER >= 23
+# endif // _LIBCPP_STD_VER >= 23
default:
return nullptr;
}
@@ -571,39 +517,34 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
}
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;
- }
+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;
- }
+ }
+ } else
+ __rt = nullptr;
}
- return __rt;
+ }
+ return __rt;
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
+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;
+ __rt = this;
__file_ = fdopen(__fd, __mdstr);
if (__file_) {
__om_ = __mode;
@@ -611,7 +552,7 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
if (fseek(__file_, 0, SEEK_END)) {
fclose(__file_);
__file_ = nullptr;
- __rt = nullptr;
+ __rt = nullptr;
}
}
} else
@@ -621,740 +562,593 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
return __rt;
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# 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;
+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;
+ }
+ return __rt;
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- return open(__s.c_str(), __mode);
+inline basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ return open(__s.c_str(), __mode);
}
template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::close()
-{
- basic_filebuf<_CharT, _Traits>* __rt = nullptr;
- if (__file_)
- {
- __rt = this;
- unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
- if (sync())
- __rt = nullptr;
- if (fclose(__h.release()))
- __rt = nullptr;
- __file_ = nullptr;
- setbuf(0, 0);
- }
- return __rt;
+basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::close() {
+ basic_filebuf<_CharT, _Traits>* __rt = nullptr;
+ if (__file_) {
+ __rt = this;
+ unique_ptr<FILE, int (*)(FILE*)> __h(__file_, fclose);
+ if (sync())
+ __rt = nullptr;
+ if (fclose(__h.release()))
+ __rt = nullptr;
+ __file_ = nullptr;
+ setbuf(0, 0);
+ }
+ return __rt;
}
template <class _CharT, class _Traits>
-typename basic_filebuf<_CharT, _Traits>::int_type
-basic_filebuf<_CharT, _Traits>::underflow()
-{
- if (__file_ == nullptr)
- return traits_type::eof();
- bool __initial = __read_mode();
- char_type __1buf;
- if (this->gptr() == nullptr)
- this->setg(&__1buf, &__1buf+1, &__1buf+1);
- const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
- int_type __c = traits_type::eof();
- if (this->gptr() == this->egptr())
- {
- std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
- if (__always_noconv_)
- {
- size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
- __nmemb = ::fread(this->eback() + __unget_sz, 1, __nmemb, __file_);
- if (__nmemb != 0)
- {
- this->setg(this->eback(),
- this->eback() + __unget_sz,
- this->eback() + __unget_sz + __nmemb);
- __c = traits_type::to_int_type(*this->gptr());
- }
- }
- else
- {
- if (__extbufend_ != __extbufnext_) {
- _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
- _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
- std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
- }
- __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
- __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
- size_t __nmemb = std::min(static_cast<size_t>(__ibs_ - __unget_sz),
- static_cast<size_t>(__extbufend_ - __extbufnext_));
- codecvt_base::result __r;
- __st_last_ = __st_;
- size_t __nr = fread((void*) const_cast<char *>(__extbufnext_), 1, __nmemb, __file_);
- if (__nr != 0)
- {
- if (!__cv_)
- __throw_bad_cast();
-
- __extbufend_ = __extbufnext_ + __nr;
- char_type* __inext;
- __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
- this->eback() + __unget_sz,
- this->eback() + __ibs_, __inext);
- if (__r == codecvt_base::noconv)
- {
- this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
- (char_type*)const_cast<char *>(__extbufend_));
- __c = traits_type::to_int_type(*this->gptr());
- }
- else if (__inext != this->eback() + __unget_sz)
- {
- this->setg(this->eback(), this->eback() + __unget_sz, __inext);
- __c = traits_type::to_int_type(*this->gptr());
- }
- }
- }
- }
- else
+typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::underflow() {
+ if (__file_ == nullptr)
+ return traits_type::eof();
+ bool __initial = __read_mode();
+ char_type __1buf;
+ if (this->gptr() == nullptr)
+ this->setg(&__1buf, &__1buf + 1, &__1buf + 1);
+ const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
+ int_type __c = traits_type::eof();
+ if (this->gptr() == this->egptr()) {
+ std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
+ if (__always_noconv_) {
+ size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
+ __nmemb = ::fread(this->eback() + __unget_sz, 1, __nmemb, __file_);
+ if (__nmemb != 0) {
+ this->setg(this->eback(), this->eback() + __unget_sz, this->eback() + __unget_sz + __nmemb);
__c = traits_type::to_int_type(*this->gptr());
- if (this->eback() == &__1buf)
- this->setg(nullptr, nullptr, nullptr);
- return __c;
-}
-
-template <class _CharT, class _Traits>
-typename basic_filebuf<_CharT, _Traits>::int_type
-basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c)
-{
- if (__file_ && this->eback() < this->gptr())
- {
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- {
- this->gbump(-1);
- return traits_type::not_eof(__c);
- }
- if ((__om_ & ios_base::out) ||
- traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
- {
- this->gbump(-1);
- *this->gptr() = traits_type::to_char_type(__c);
- return __c;
+ }
+ } else {
+ if (__extbufend_ != __extbufnext_) {
+ _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
+ _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
+ std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
+ }
+ __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
+ __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
+ size_t __nmemb =
+ std::min(static_cast<size_t>(__ibs_ - __unget_sz), static_cast<size_t>(__extbufend_ - __extbufnext_));
+ codecvt_base::result __r;
+ __st_last_ = __st_;
+ size_t __nr = fread((void*)const_cast<char*>(__extbufnext_), 1, __nmemb, __file_);
+ if (__nr != 0) {
+ if (!__cv_)
+ __throw_bad_cast();
+
+ __extbufend_ = __extbufnext_ + __nr;
+ char_type* __inext;
+ __r = __cv_->in(
+ __st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, this->eback() + __ibs_, __inext);
+ if (__r == codecvt_base::noconv) {
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)const_cast<char*>(__extbufend_));
+ __c = traits_type::to_int_type(*this->gptr());
+ } else if (__inext != this->eback() + __unget_sz) {
+ this->setg(this->eback(), this->eback() + __unget_sz, __inext);
+ __c = traits_type::to_int_type(*this->gptr());
}
+ }
}
- return traits_type::eof();
+ } else
+ __c = traits_type::to_int_type(*this->gptr());
+ if (this->eback() == &__1buf)
+ this->setg(nullptr, nullptr, nullptr);
+ return __c;
}
template <class _CharT, class _Traits>
-typename basic_filebuf<_CharT, _Traits>::int_type
-basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
-{
- if (__file_ == nullptr)
- return traits_type::eof();
- __write_mode();
- char_type __1buf;
- char_type* __pb_save = this->pbase();
- char_type* __epb_save = this->epptr();
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- {
- if (this->pptr() == nullptr)
- this->setp(&__1buf, &__1buf+1);
- *this->pptr() = traits_type::to_char_type(__c);
- this->pbump(1);
+typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) {
+ if (__file_ && this->eback() < this->gptr()) {
+ if (traits_type::eq_int_type(__c, traits_type::eof())) {
+ this->gbump(-1);
+ return traits_type::not_eof(__c);
}
- if (this->pptr() != this->pbase())
- {
- if (__always_noconv_)
- {
- size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (std::fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
- return traits_type::eof();
- }
- else
- {
- char* __extbe = __extbuf_;
- codecvt_base::result __r;
- do
- {
- if (!__cv_)
- __throw_bad_cast();
-
- const char_type* __e;
- __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
- __extbuf_, __extbuf_ + __ebs_, __extbe);
- if (__e == this->pbase())
- return traits_type::eof();
- if (__r == codecvt_base::noconv)
- {
- size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (std::fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb)
- return traits_type::eof();
- }
- else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
- {
- size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
- if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
- return traits_type::eof();
- if (__r == codecvt_base::partial)
- {
- this->setp(const_cast<char_type*>(__e), this->pptr());
- this->__pbump(this->epptr() - this->pbase());
- }
- }
- else
- return traits_type::eof();
- } while (__r == codecvt_base::partial);
- }
- this->setp(__pb_save, __epb_save);
+ if ((__om_ & ios_base::out) || traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) {
+ this->gbump(-1);
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
}
- return traits_type::not_eof(__c);
+ }
+ return traits_type::eof();
}
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
-{
- this->setg(nullptr, nullptr, nullptr);
- this->setp(nullptr, nullptr);
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
- __ebs_ = __n;
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_ && __s)
- {
- __extbuf_ = (char*)__s;
- __owns_eb_ = false;
- }
- else
- {
- __extbuf_ = new char[__ebs_];
- __owns_eb_ = true;
- }
- }
- else
- {
- __extbuf_ = __extbuf_min_;
- __ebs_ = sizeof(__extbuf_min_);
- __owns_eb_ = false;
+typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::overflow(int_type __c) {
+ if (__file_ == nullptr)
+ return traits_type::eof();
+ __write_mode();
+ char_type __1buf;
+ char_type* __pb_save = this->pbase();
+ char_type* __epb_save = this->epptr();
+ if (!traits_type::eq_int_type(__c, traits_type::eof())) {
+ if (this->pptr() == nullptr)
+ this->setp(&__1buf, &__1buf + 1);
+ *this->pptr() = traits_type::to_char_type(__c);
+ this->pbump(1);
+ }
+ if (this->pptr() != this->pbase()) {
+ if (__always_noconv_) {
+ size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+ if (std::fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
+ return traits_type::eof();
+ } else {
+ char* __extbe = __extbuf_;
+ codecvt_base::result __r;
+ do {
+ if (!__cv_)
+ __throw_bad_cast();
+
+ const char_type* __e;
+ __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ if (__e == this->pbase())
+ return traits_type::eof();
+ if (__r == codecvt_base::noconv) {
+ size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+ if (std::fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb)
+ return traits_type::eof();
+ } else if (__r == codecvt_base::ok || __r == codecvt_base::partial) {
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+ if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
+ return traits_type::eof();
+ if (__r == codecvt_base::partial) {
+ this->setp(const_cast<char_type*>(__e), this->pptr());
+ this->__pbump(this->epptr() - this->pbase());
+ }
+ } else
+ return traits_type::eof();
+ } while (__r == codecvt_base::partial);
}
- if (!__always_noconv_)
- {
- __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
- if (__s && __ibs_ > sizeof(__extbuf_min_))
- {
- __intbuf_ = __s;
- __owns_ib_ = false;
- }
- else
- {
- __intbuf_ = new char_type[__ibs_];
- __owns_ib_ = true;
- }
+ this->setp(__pb_save, __epb_save);
+ }
+ return traits_type::not_eof(__c);
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) {
+ this->setg(nullptr, nullptr, nullptr);
+ this->setp(nullptr, nullptr);
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
+ __ebs_ = __n;
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_ && __s) {
+ __extbuf_ = (char*)__s;
+ __owns_eb_ = false;
+ } else {
+ __extbuf_ = new char[__ebs_];
+ __owns_eb_ = true;
}
- else
- {
- __ibs_ = 0;
- __intbuf_ = nullptr;
- __owns_ib_ = false;
+ } else {
+ __extbuf_ = __extbuf_min_;
+ __ebs_ = sizeof(__extbuf_min_);
+ __owns_eb_ = false;
+ }
+ if (!__always_noconv_) {
+ __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
+ if (__s && __ibs_ > sizeof(__extbuf_min_)) {
+ __intbuf_ = __s;
+ __owns_ib_ = false;
+ } else {
+ __intbuf_ = new char_type[__ibs_];
+ __owns_ib_ = true;
}
- return this;
+ } else {
+ __ibs_ = 0;
+ __intbuf_ = nullptr;
+ __owns_ib_ = false;
+ }
+ return this;
}
template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::pos_type
-basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode)
-{
- if (!__cv_)
- __throw_bad_cast();
-
- int __width = __cv_->encoding();
- if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
- return pos_type(off_type(-1));
- // __width > 0 || __off == 0
- int __whence;
- switch (__way)
- {
- case ios_base::beg:
- __whence = SEEK_SET;
- break;
- case ios_base::cur:
- __whence = SEEK_CUR;
- break;
- case ios_base::end:
- __whence = SEEK_END;
- break;
- default:
- return pos_type(off_type(-1));
- }
-#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
- if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
- return pos_type(off_type(-1));
- pos_type __r = ftell(__file_);
-#else
- if (::fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
- return pos_type(off_type(-1));
- pos_type __r = ftello(__file_);
-#endif
- __r.state(__st_);
- return __r;
+basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) {
+ if (!__cv_)
+ __throw_bad_cast();
+
+ int __width = __cv_->encoding();
+ if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
+ return pos_type(off_type(-1));
+ // __width > 0 || __off == 0
+ int __whence;
+ switch (__way) {
+ case ios_base::beg:
+ __whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ __whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ __whence = SEEK_END;
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+ if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
+ return pos_type(off_type(-1));
+ pos_type __r = ftell(__file_);
+# else
+ if (::fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
+ return pos_type(off_type(-1));
+ pos_type __r = ftello(__file_);
+# endif
+ __r.state(__st_);
+ return __r;
}
template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::pos_type
-basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
-{
- if (__file_ == nullptr || sync())
- return pos_type(off_type(-1));
-#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
- if (fseek(__file_, __sp, SEEK_SET))
- return pos_type(off_type(-1));
-#else
- if (::fseeko(__file_, __sp, SEEK_SET))
- return pos_type(off_type(-1));
-#endif
- __st_ = __sp.state();
- return __sp;
-}
-
-template <class _CharT, class _Traits>
-int
-basic_filebuf<_CharT, _Traits>::sync()
-{
- if (__file_ == nullptr)
- return 0;
- if (!__cv_)
- __throw_bad_cast();
+basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) {
+ if (__file_ == nullptr || sync())
+ return pos_type(off_type(-1));
+# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+ if (fseek(__file_, __sp, SEEK_SET))
+ return pos_type(off_type(-1));
+# else
+ if (::fseeko(__file_, __sp, SEEK_SET))
+ return pos_type(off_type(-1));
+# endif
+ __st_ = __sp.state();
+ return __sp;
+}
+
+template <class _CharT, class _Traits>
+int basic_filebuf<_CharT, _Traits>::sync() {
+ if (__file_ == nullptr)
+ return 0;
+ if (!__cv_)
+ __throw_bad_cast();
- if (__cm_ & ios_base::out)
- {
- if (this->pptr() != this->pbase())
- if (overflow() == traits_type::eof())
- return -1;
- codecvt_base::result __r;
- do
- {
- char* __extbe;
- __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
- size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
- if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
- return -1;
- } while (__r == codecvt_base::partial);
- if (__r == codecvt_base::error)
- return -1;
- if (fflush(__file_))
- return -1;
- }
- else if (__cm_ & ios_base::in)
- {
- off_type __c;
- state_type __state = __st_last_;
- bool __update_st = false;
- if (__always_noconv_)
- __c = this->egptr() - this->gptr();
- else
- {
- int __width = __cv_->encoding();
- __c = __extbufend_ - __extbufnext_;
- if (__width > 0)
- __c += __width * (this->egptr() - this->gptr());
- else
- {
- if (this->gptr() != this->egptr())
- {
- const int __off = __cv_->length(__state, __extbuf_,
- __extbufnext_,
- this->gptr() - this->eback());
- __c += __extbufnext_ - __extbuf_ - __off;
- __update_st = true;
- }
- }
+ if (__cm_ & ios_base::out) {
+ if (this->pptr() != this->pbase())
+ if (overflow() == traits_type::eof())
+ return -1;
+ codecvt_base::result __r;
+ do {
+ char* __extbe;
+ __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+ if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb)
+ return -1;
+ } while (__r == codecvt_base::partial);
+ if (__r == codecvt_base::error)
+ return -1;
+ if (fflush(__file_))
+ return -1;
+ } else if (__cm_ & ios_base::in) {
+ off_type __c;
+ state_type __state = __st_last_;
+ bool __update_st = false;
+ if (__always_noconv_)
+ __c = this->egptr() - this->gptr();
+ else {
+ int __width = __cv_->encoding();
+ __c = __extbufend_ - __extbufnext_;
+ if (__width > 0)
+ __c += __width * (this->egptr() - this->gptr());
+ else {
+ if (this->gptr() != this->egptr()) {
+ const int __off = __cv_->length(__state, __extbuf_, __extbufnext_, this->gptr() - this->eback());
+ __c += __extbufnext_ - __extbuf_ - __off;
+ __update_st = true;
}
-#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
- if (fseek(__file_, -__c, SEEK_CUR))
- return -1;
-#else
- if (::fseeko(__file_, -__c, SEEK_CUR))
- return -1;
-#endif
- if (__update_st)
- __st_ = __state;
- __extbufnext_ = __extbufend_ = __extbuf_;
- this->setg(nullptr, nullptr, nullptr);
- __cm_ = 0;
+ }
}
- return 0;
+# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+ if (fseek(__file_, -__c, SEEK_CUR))
+ return -1;
+# else
+ if (::fseeko(__file_, -__c, SEEK_CUR))
+ return -1;
+# endif
+ if (__update_st)
+ __st_ = __state;
+ __extbufnext_ = __extbufend_ = __extbuf_;
+ this->setg(nullptr, nullptr, nullptr);
+ __cm_ = 0;
+ }
+ return 0;
}
template <class _CharT, class _Traits>
-void
-basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
-{
- sync();
- __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(__loc);
- bool __old_anc = __always_noconv_;
- __always_noconv_ = __cv_->always_noconv();
- if (__old_anc != __always_noconv_)
+void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) {
+ sync();
+ __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(__loc);
+ bool __old_anc = __always_noconv_;
+ __always_noconv_ = __cv_->always_noconv();
+ if (__old_anc != __always_noconv_) {
+ this->setg(nullptr, nullptr, nullptr);
+ this->setp(nullptr, nullptr);
+ // invariant, char_type is char, else we couldn't get here
+ if (__always_noconv_) // need to dump __intbuf_
{
- this->setg(nullptr, nullptr, nullptr);
- this->setp(nullptr, nullptr);
- // invariant, char_type is char, else we couldn't get here
- if (__always_noconv_) // need to dump __intbuf_
- {
- if (__owns_eb_)
- delete [] __extbuf_;
- __owns_eb_ = __owns_ib_;
- __ebs_ = __ibs_;
- __extbuf_ = (char*)__intbuf_;
- __ibs_ = 0;
- __intbuf_ = nullptr;
- __owns_ib_ = false;
- }
- else // need to obtain an __intbuf_.
- { // If __extbuf_ is user-supplied, use it, else new __intbuf_
- if (!__owns_eb_ && __extbuf_ != __extbuf_min_)
- {
- __ibs_ = __ebs_;
- __intbuf_ = (char_type*)__extbuf_;
- __owns_ib_ = false;
- __extbuf_ = new char[__ebs_];
- __owns_eb_ = true;
- }
- else
- {
- __ibs_ = __ebs_;
- __intbuf_ = new char_type[__ibs_];
- __owns_ib_ = true;
- }
- }
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ __owns_eb_ = __owns_ib_;
+ __ebs_ = __ibs_;
+ __extbuf_ = (char*)__intbuf_;
+ __ibs_ = 0;
+ __intbuf_ = nullptr;
+ __owns_ib_ = false;
+ } else // need to obtain an __intbuf_.
+ { // If __extbuf_ is user-supplied, use it, else new __intbuf_
+ if (!__owns_eb_ && __extbuf_ != __extbuf_min_) {
+ __ibs_ = __ebs_;
+ __intbuf_ = (char_type*)__extbuf_;
+ __owns_ib_ = false;
+ __extbuf_ = new char[__ebs_];
+ __owns_eb_ = true;
+ } else {
+ __ibs_ = __ebs_;
+ __intbuf_ = new char_type[__ibs_];
+ __owns_ib_ = true;
+ }
}
+ }
}
template <class _CharT, class _Traits>
-bool
-basic_filebuf<_CharT, _Traits>::__read_mode()
-{
- if (!(__cm_ & ios_base::in))
- {
- this->setp(nullptr, nullptr);
- if (__always_noconv_)
- this->setg((char_type*)__extbuf_,
- (char_type*)__extbuf_ + __ebs_,
- (char_type*)__extbuf_ + __ebs_);
- else
- this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
- __cm_ = ios_base::in;
- return true;
- }
- return false;
+bool basic_filebuf<_CharT, _Traits>::__read_mode() {
+ if (!(__cm_ & ios_base::in)) {
+ this->setp(nullptr, nullptr);
+ if (__always_noconv_)
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_);
+ else
+ this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
+ __cm_ = ios_base::in;
+ return true;
+ }
+ return false;
}
template <class _CharT, class _Traits>
-void
-basic_filebuf<_CharT, _Traits>::__write_mode()
-{
- if (!(__cm_ & ios_base::out))
- {
- this->setg(nullptr, nullptr, nullptr);
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_)
- this->setp((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__ebs_ - 1));
- else
- this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
- }
- else
- this->setp(nullptr, nullptr);
- __cm_ = ios_base::out;
- }
+void basic_filebuf<_CharT, _Traits>::__write_mode() {
+ if (!(__cm_ & ios_base::out)) {
+ this->setg(nullptr, nullptr, nullptr);
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_)
+ this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__ebs_ - 1));
+ else
+ this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
+ } else
+ this->setp(nullptr, nullptr);
+ __cm_ = ios_base::out;
+ }
}
// basic_ifstream
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ifstream
- : public basic_istream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ifstream : public basic_istream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_ifstream();
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ _LIBCPP_HIDE_FROM_ABI basic_ifstream();
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
+# endif
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(
+ const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
: basic_ifstream(__p.c_str(), __mode) {}
-#endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- basic_ifstream(basic_ifstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_ifstream& operator=(basic_ifstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ifstream& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- void open(const char* __s, ios_base::openmode __mode = ios_base::in);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
-#endif
- void open(const string& __s, ios_base::openmode __mode = ios_base::in);
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- void open(const filesystem::path& __p,
- ios_base::openmode __mode = ios_base::in) {
- return open(__p.c_str(), __mode);
- }
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI basic_ifstream(basic_ifstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_ifstream& operator=(basic_ifstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream& __rhs);
+
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ void open(const char* __s, ios_base::openmode __mode = ios_base::in);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
+# endif
+ void open(const string& __s, ios_base::openmode __mode = ios_base::in);
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
+ open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) {
+ return open(__p.c_str(), __mode);
+ }
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- void __open(int __fd, ios_base::openmode __mode);
- _LIBCPP_HIDE_FROM_ABI
- void close();
+ _LIBCPP_HIDE_FROM_ABI void __open(int __fd, ios_base::openmode __mode);
+ _LIBCPP_HIDE_FROM_ABI void close();
private:
- basic_filebuf<char_type, traits_type> __sb_;
+ basic_filebuf<char_type, traits_type> __sb_;
};
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream()
- : basic_istream<char_type, traits_type>(&__sb_)
-{
-}
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream() : basic_istream<char_type, traits_type>(&__sb_) {}
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
- : basic_istream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
+ : basic_istream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
- : basic_istream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
+ : basic_istream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
- : basic_istream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
+ : basic_istream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
- : basic_istream<char_type, traits_type>(std::move(__rhs)),
- __sb_(std::move(__rhs.__sb_))
-{
- this->set_rdbuf(&__sb_);
+inline basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
+ : basic_istream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ this->set_rdbuf(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-basic_ifstream<_CharT, _Traits>&
-basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
-{
- basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
+inline basic_ifstream<_CharT, _Traits>& basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) {
+ basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs)
-{
- basic_istream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
+inline void basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs) {
+ basic_istream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_ifstream<_CharT, _Traits>::rdbuf() const
-{
- return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+inline basic_filebuf<_CharT, _Traits>* basic_ifstream<_CharT, _Traits>::rdbuf() const {
+ return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_ifstream<_CharT, _Traits>::is_open() const
-{
- return __sb_.is_open();
+inline bool basic_ifstream<_CharT, _Traits>::is_open() const {
+ return __sb_.is_open();
}
template <class _CharT, class _Traits>
-void
-basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::in))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::in))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-void
-basic_ifstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::in))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ifstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::in))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-void
-basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::in))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::in))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-void basic_ifstream<_CharT, _Traits>::__open(int __fd,
- ios_base::openmode __mode) {
+inline void basic_ifstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
if (__sb_.__open(__fd, __mode | ios_base::in))
this->clear();
else
@@ -1362,200 +1156,149 @@ void basic_ifstream<_CharT, _Traits>::__open(int __fd,
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ifstream<_CharT, _Traits>::close()
-{
- if (__sb_.close() == 0)
- this->setstate(ios_base::failbit);
+inline void basic_ifstream<_CharT, _Traits>::close() {
+ if (__sb_.close() == 0)
+ this->setstate(ios_base::failbit);
}
// basic_ofstream
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ofstream
- : public basic_ostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ofstream : public basic_ostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_ofstream();
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ _LIBCPP_HIDE_FROM_ABI basic_ofstream();
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
+# endif
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(
+ const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
: basic_ofstream(__p.c_str(), __mode) {}
-#endif // _LIBCPP_STD_VER >= 17
-
- _LIBCPP_HIDE_FROM_ABI
- basic_ofstream(basic_ofstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_ofstream& operator=(basic_ofstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ofstream& __rhs);
-
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- void open(const char* __s, ios_base::openmode __mode = ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
-#endif
- void open(const string& __s, ios_base::openmode __mode = ios_base::out);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
- { return open(__p.c_str(), __mode); }
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
+
+ _LIBCPP_HIDE_FROM_ABI basic_ofstream(basic_ofstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_ofstream& operator=(basic_ofstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream& __rhs);
+
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ void open(const char* __s, ios_base::openmode __mode = ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
+# endif
+ void open(const string& __s, ios_base::openmode __mode = ios_base::out);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
+ open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) {
+ return open(__p.c_str(), __mode);
+ }
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- void __open(int __fd, ios_base::openmode __mode);
- _LIBCPP_HIDE_FROM_ABI
- void close();
+ _LIBCPP_HIDE_FROM_ABI void __open(int __fd, ios_base::openmode __mode);
+ _LIBCPP_HIDE_FROM_ABI void close();
private:
- basic_filebuf<char_type, traits_type> __sb_;
+ basic_filebuf<char_type, traits_type> __sb_;
};
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream()
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
-}
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream() : basic_ostream<char_type, traits_type>(&__sb_) {}
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
+ : basic_ostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
+ : basic_ostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
- : basic_ostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
+ : basic_ostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
- : basic_ostream<char_type, traits_type>(std::move(__rhs)),
- __sb_(std::move(__rhs.__sb_))
-{
- this->set_rdbuf(&__sb_);
+inline basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
+ : basic_ostream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ this->set_rdbuf(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-basic_ofstream<_CharT, _Traits>&
-basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
-{
- basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
+inline basic_ofstream<_CharT, _Traits>& basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) {
+ basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs)
-{
- basic_ostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
+inline void basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs) {
+ basic_ostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_ofstream<_CharT, _Traits>::rdbuf() const
-{
- return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+inline basic_filebuf<_CharT, _Traits>* basic_ofstream<_CharT, _Traits>::rdbuf() const {
+ return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_ofstream<_CharT, _Traits>::is_open() const
-{
- return __sb_.is_open();
+inline bool basic_ofstream<_CharT, _Traits>::is_open() const {
+ return __sb_.is_open();
}
template <class _CharT, class _Traits>
-void
-basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::out))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::out))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-void
-basic_ofstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::out))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ofstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::out))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-void
-basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode | ios_base::out))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode | ios_base::out))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-void basic_ofstream<_CharT, _Traits>::__open(int __fd,
- ios_base::openmode __mode) {
+inline void basic_ofstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
if (__sb_.__open(__fd, __mode | ios_base::out))
this->clear();
else
@@ -1563,210 +1306,162 @@ void basic_ofstream<_CharT, _Traits>::__open(int __fd,
}
template <class _CharT, class _Traits>
-inline
-void
-basic_ofstream<_CharT, _Traits>::close()
-{
- if (__sb_.close() == nullptr)
- this->setstate(ios_base::failbit);
+inline void basic_ofstream<_CharT, _Traits>::close() {
+ if (__sb_.close() == nullptr)
+ this->setstate(ios_base::failbit);
}
// basic_fstream
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_fstream
- : public basic_iostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_fstream : public basic_iostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_fstream();
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ _LIBCPP_HIDE_FROM_ABI basic_fstream();
+ _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const char* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const wchar_t* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+# endif
+ _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const string& __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_fstream(
+ const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
: basic_fstream(__p.c_str(), __mode) {}
-#endif // _LIBCPP_STD_VER >= 17
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- basic_fstream(basic_fstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_fstream(basic_fstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_fstream& operator=(basic_fstream&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI basic_fstream& operator=(basic_fstream&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_fstream& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_fstream& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- basic_filebuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- bool is_open() const;
- _LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
- void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#endif
- _LIBCPP_HIDE_FROM_ABI void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+ _LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI bool is_open() const;
+ _LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+ void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
+# endif
+ _LIBCPP_HIDE_FROM_ABI void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI
- void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)
- { return open(__p.c_str(), __mode); }
-#endif // _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI void
+ open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out) {
+ return open(__p.c_str(), __mode);
+ }
+# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- void close();
+ _LIBCPP_HIDE_FROM_ABI void close();
private:
- basic_filebuf<char_type, traits_type> __sb_;
+ basic_filebuf<char_type, traits_type> __sb_;
};
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream()
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
-}
+inline basic_fstream<_CharT, _Traits>::basic_fstream() : basic_iostream<char_type, traits_type>(&__sb_) {}
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
+ : basic_iostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
+ : basic_iostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode) == nullptr)
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
- : basic_iostream<char_type, traits_type>(&__sb_)
-{
- if (__sb_.open(__s, __mode) == nullptr)
- this->setstate(ios_base::failbit);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
+ : basic_iostream<char_type, traits_type>(&__sb_) {
+ if (__sb_.open(__s, __mode) == nullptr)
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
- : basic_iostream<char_type, traits_type>(std::move(__rhs)),
- __sb_(std::move(__rhs.__sb_))
-{
- this->set_rdbuf(&__sb_);
+inline basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
+ : basic_iostream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ this->set_rdbuf(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-basic_fstream<_CharT, _Traits>&
-basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
-{
- basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
+inline basic_fstream<_CharT, _Traits>& basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) {
+ basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
}
template <class _CharT, class _Traits>
-inline
-void
-basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs)
-{
- basic_iostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
+inline void basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs) {
+ basic_iostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y) {
+ __x.swap(__y);
}
template <class _CharT, class _Traits>
-inline
-basic_filebuf<_CharT, _Traits>*
-basic_fstream<_CharT, _Traits>::rdbuf() const
-{
- return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
+inline basic_filebuf<_CharT, _Traits>* basic_fstream<_CharT, _Traits>::rdbuf() const {
+ return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_);
}
template <class _CharT, class _Traits>
-inline
-bool
-basic_fstream<_CharT, _Traits>::is_open() const
-{
- return __sb_.is_open();
+inline bool basic_fstream<_CharT, _Traits>::is_open() const {
+ return __sb_.is_open();
}
template <class _CharT, class _Traits>
-void
-basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
+# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
-void
-basic_fstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_fstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
-#endif
+# endif
template <class _CharT, class _Traits>
-void
-basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
-{
- if (__sb_.open(__s, __mode))
- this->clear();
- else
- this->setstate(ios_base::failbit);
+void basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) {
+ if (__sb_.open(__s, __mode))
+ this->clear();
+ else
+ this->setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-inline
-void
-basic_fstream<_CharT, _Traits>::close()
-{
- if (__sb_.close() == nullptr)
- this->setstate(ios_base::failbit);
+inline void basic_fstream<_CharT, _Traits>::close() {
+ if (__sb_.close() == nullptr)
+ this->setstate(ios_base::failbit);
}
-#if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
+# if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>;
-#endif
+# endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/future b/contrib/llvm-project/libcxx/include/future
index ab645b7d3dcb..92ba18821069 100644
--- a/contrib/llvm-project/libcxx/include/future
+++ b/contrib/llvm-project/libcxx/include/future
@@ -397,19 +397,14 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<future> is not supported since libc++ has been configured without support for threads."
+# error "<future> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-//enum class future_errc
-_LIBCPP_DECLARE_STRONG_ENUM(future_errc)
-{
- future_already_retrieved = 1,
- promise_already_satisfied,
- no_state,
- broken_promise
-};
+// enum class future_errc
+_LIBCPP_DECLARE_STRONG_ENUM(future_errc){
+ future_already_retrieved = 1, promise_already_satisfied, no_state, broken_promise};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc)
template <>
@@ -417,1807 +412,1460 @@ struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc> : public true_type {
#ifdef _LIBCPP_CXX03_LANG
template <>
-struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc::__lx> : public true_type { };
+struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc::__lx> : public true_type {};
#endif
-//enum class launch
-_LIBCPP_DECLARE_STRONG_ENUM(launch)
-{
- async = 1,
- deferred = 2,
- any = async | deferred
-};
+// enum class launch
+_LIBCPP_DECLARE_STRONG_ENUM(launch){async = 1, deferred = 2, any = async | deferred};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
#ifndef _LIBCPP_CXX03_LANG
typedef underlying_type<launch>::type __launch_underlying_type;
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator&(launch __x, launch __y)
-{
- return static_cast<launch>(static_cast<__launch_underlying_type>(__x) &
- static_cast<__launch_underlying_type>(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator&(launch __x, launch __y) {
+ return static_cast<launch>(static_cast<__launch_underlying_type>(__x) & static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator|(launch __x, launch __y)
-{
- return static_cast<launch>(static_cast<__launch_underlying_type>(__x) |
- static_cast<__launch_underlying_type>(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator|(launch __x, launch __y) {
+ return static_cast<launch>(static_cast<__launch_underlying_type>(__x) | static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator^(launch __x, launch __y)
-{
- return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^
- static_cast<__launch_underlying_type>(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator^(launch __x, launch __y) {
+ return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^ static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-launch
-operator~(launch __x)
-{
- return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator~(launch __x) {
+ return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
}
-inline _LIBCPP_HIDE_FROM_ABI
-launch&
-operator&=(launch& __x, launch __y)
-{
- __x = __x & __y; return __x;
+inline _LIBCPP_HIDE_FROM_ABI launch& operator&=(launch& __x, launch __y) {
+ __x = __x & __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-launch&
-operator|=(launch& __x, launch __y)
-{
- __x = __x | __y; return __x;
+inline _LIBCPP_HIDE_FROM_ABI launch& operator|=(launch& __x, launch __y) {
+ __x = __x | __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-launch&
-operator^=(launch& __x, launch __y)
-{
- __x = __x ^ __y; return __x;
+inline _LIBCPP_HIDE_FROM_ABI launch& operator^=(launch& __x, launch __y) {
+ __x = __x ^ __y;
+ return __x;
}
#endif // !_LIBCPP_CXX03_LANG
-//enum class future_status
-_LIBCPP_DECLARE_STRONG_ENUM(future_status)
-{
- ready,
- timeout,
- deferred
-};
+// enum class future_status
+_LIBCPP_DECLARE_STRONG_ENUM(future_status){ready, timeout, deferred};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status)
_LIBCPP_EXPORTED_FROM_ABI const error_category& future_category() _NOEXCEPT;
-inline _LIBCPP_HIDE_FROM_ABI
-error_code
-make_error_code(future_errc __e) _NOEXCEPT
-{
- return error_code(static_cast<int>(__e), future_category());
+inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(future_errc __e) _NOEXCEPT {
+ return error_code(static_cast<int>(__e), future_category());
}
-inline _LIBCPP_HIDE_FROM_ABI
-error_condition
-make_error_condition(future_errc __e) _NOEXCEPT
-{
- return error_condition(static_cast<int>(__e), future_category());
+inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(future_errc __e) _NOEXCEPT {
+ return error_condition(static_cast<int>(__e), future_category());
}
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev);
class _LIBCPP_EXPORTED_FROM_ABI future_error : public logic_error {
- error_code __ec_;
+ error_code __ec_;
- future_error(error_code);
- friend void __throw_future_error(future_errc);
- template <class> friend class promise;
+ future_error(error_code);
+ friend void __throw_future_error(future_errc);
+ template <class>
+ friend class promise;
public:
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI explicit future_error(future_errc __ec) : future_error(std::make_error_code(__ec)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit future_error(future_errc __ec) : future_error(std::make_error_code(__ec)) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- const error_code& code() const _NOEXCEPT {return __ec_;}
+ _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
- _LIBCPP_HIDE_FROM_ABI future_error(const future_error&) _NOEXCEPT = default;
- ~future_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI future_error(const future_error&) _NOEXCEPT = default;
+ ~future_error() _NOEXCEPT override;
};
// Declared above std::future_error
-void __throw_future_error(future_errc __ev)
-{
+void __throw_future_error(future_errc __ev) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw future_error(make_error_code(__ev));
+ throw future_error(make_error_code(__ev));
#else
- (void)__ev;
- _LIBCPP_VERBOSE_ABORT("future_error was thrown in -fno-exceptions mode");
+ (void)__ev;
+ _LIBCPP_VERBOSE_ABORT("future_error was thrown in -fno-exceptions mode");
#endif
}
class _LIBCPP_EXPORTED_FROM_ABI __assoc_sub_state : public __shared_count {
protected:
- exception_ptr __exception_;
- mutable mutex __mut_;
- mutable condition_variable __cv_;
- unsigned __state_;
+ exception_ptr __exception_;
+ mutable mutex __mut_;
+ mutable condition_variable __cv_;
+ unsigned __state_;
+
+ void __on_zero_shared() _NOEXCEPT override;
+ void __sub_wait(unique_lock<mutex>& __lk);
- void __on_zero_shared() _NOEXCEPT override;
- void __sub_wait(unique_lock<mutex>& __lk);
public:
- enum
- {
- __constructed = 1,
- __future_attached = 2,
- ready = 4,
- deferred = 8
- };
-
- _LIBCPP_HIDE_FROM_ABI
- __assoc_sub_state() : __state_(0) {}
-
- _LIBCPP_HIDE_FROM_ABI
- bool __has_value() const
- {return (__state_ & __constructed) || (__exception_ != nullptr);}
-
- _LIBCPP_HIDE_FROM_ABI
- void __attach_future() {
- lock_guard<mutex> __lk(__mut_);
- bool __has_future_attached = (__state_ & __future_attached) != 0;
- if (__has_future_attached)
- __throw_future_error(future_errc::future_already_retrieved);
- this->__add_shared();
- __state_ |= __future_attached;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void __set_deferred() {__state_ |= deferred;}
-
- void __make_ready();
- _LIBCPP_HIDE_FROM_ABI
- bool __is_ready() const {return (__state_ & ready) != 0;}
+ enum { __constructed = 1, __future_attached = 2, ready = 4, deferred = 8 };
- void set_value();
- void set_value_at_thread_exit();
+ _LIBCPP_HIDE_FROM_ABI __assoc_sub_state() : __state_(0) {}
- void set_exception(exception_ptr __p);
- void set_exception_at_thread_exit(exception_ptr __p);
+ _LIBCPP_HIDE_FROM_ABI bool __has_value() const { return (__state_ & __constructed) || (__exception_ != nullptr); }
- void copy();
+ _LIBCPP_HIDE_FROM_ABI void __attach_future() {
+ lock_guard<mutex> __lk(__mut_);
+ bool __has_future_attached = (__state_ & __future_attached) != 0;
+ if (__has_future_attached)
+ __throw_future_error(future_errc::future_already_retrieved);
+ this->__add_shared();
+ __state_ |= __future_attached;
+ }
- void wait();
- template <class _Rep, class _Period>
- future_status
- _LIBCPP_HIDE_FROM_ABI
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
+ _LIBCPP_HIDE_FROM_ABI void __set_deferred() { __state_ |= deferred; }
+
+ void __make_ready();
+ _LIBCPP_HIDE_FROM_ABI bool __is_ready() const { return (__state_ & ready) != 0; }
+
+ void set_value();
+ void set_value_at_thread_exit();
- virtual void __execute();
+ void set_exception(exception_ptr __p);
+ void set_exception_at_thread_exit(exception_ptr __p);
+
+ void copy();
+
+ void wait();
+ template <class _Rep, class _Period>
+ future_status _LIBCPP_HIDE_FROM_ABI wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
+ template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS future_status
+ wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
+
+ virtual void __execute();
};
template <class _Clock, class _Duration>
-future_status
-__assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
-{
- unique_lock<mutex> __lk(__mut_);
- if (__state_ & deferred)
- return future_status::deferred;
- while (!(__state_ & ready) && _Clock::now() < __abs_time)
- __cv_.wait_until(__lk, __abs_time);
- if (__state_ & ready)
- return future_status::ready;
- return future_status::timeout;
+future_status __assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ unique_lock<mutex> __lk(__mut_);
+ if (__state_ & deferred)
+ return future_status::deferred;
+ while (!(__state_ & ready) && _Clock::now() < __abs_time)
+ __cv_.wait_until(__lk, __abs_time);
+ if (__state_ & ready)
+ return future_status::ready;
+ return future_status::timeout;
}
template <class _Rep, class _Period>
-inline
-future_status
-__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
-{
- return wait_until(chrono::steady_clock::now() + __rel_time);
+inline future_status __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return wait_until(chrono::steady_clock::now() + __rel_time);
}
template <class _Rp>
-class _LIBCPP_HIDDEN __assoc_state : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typedef typename aligned_storage<sizeof(_Rp), _LIBCPP_ALIGNOF(_Rp)>::type _Up;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+class _LIBCPP_HIDDEN __assoc_state : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typedef typename aligned_storage<sizeof(_Rp), _LIBCPP_ALIGNOF(_Rp)>::type _Up;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+
protected:
- _Up __value_;
+ _Up __value_;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
-public:
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- template <class _Arg>
- _LIBCPP_HIDE_FROM_ABI void set_value(_Arg&& __arg);
+public:
+ template <class _Arg>
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Arg&& __arg);
- template <class _Arg>
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Arg&& __arg);
+ template <class _Arg>
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Arg&& __arg);
- _LIBCPP_HIDE_FROM_ABI _Rp move();
- _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<_Rp> copy();
+ _LIBCPP_HIDE_FROM_ABI _Rp move();
+ _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<_Rp> copy();
};
template <class _Rp>
-void
-__assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT
-{
- if (this->__state_ & base::__constructed)
- reinterpret_cast<_Rp*>(&__value_)->~_Rp();
- delete this;
+void __assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT {
+ if (this->__state_ & base::__constructed)
+ reinterpret_cast<_Rp*>(&__value_)->~_Rp();
+ delete this;
}
template <class _Rp>
template <class _Arg>
-void
-__assoc_state<_Rp>::set_value(_Arg&& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
- this->__state_ |= base::__constructed | base::ready;
- __cv_.notify_all();
+void __assoc_state<_Rp>::set_value(_Arg&& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
+ this->__state_ |= base::__constructed | base::ready;
+ __cv_.notify_all();
}
template <class _Rp>
template <class _Arg>
-void
-__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
- this->__state_ |= base::__constructed;
- __thread_local_data()->__make_ready_at_thread_exit(this);
+void __assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
+ this->__state_ |= base::__constructed;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
}
template <class _Rp>
-_Rp
-__assoc_state<_Rp>::move()
-{
- unique_lock<mutex> __lk(this->__mut_);
- this->__sub_wait(__lk);
- if (this->__exception_ != nullptr)
- std::rethrow_exception(this->__exception_);
- return std::move(*reinterpret_cast<_Rp*>(&__value_));
+_Rp __assoc_state<_Rp>::move() {
+ unique_lock<mutex> __lk(this->__mut_);
+ this->__sub_wait(__lk);
+ if (this->__exception_ != nullptr)
+ std::rethrow_exception(this->__exception_);
+ return std::move(*reinterpret_cast<_Rp*>(&__value_));
}
template <class _Rp>
-__add_lvalue_reference_t<_Rp>
-__assoc_state<_Rp>::copy()
-{
- unique_lock<mutex> __lk(this->__mut_);
- this->__sub_wait(__lk);
- if (this->__exception_ != nullptr)
- std::rethrow_exception(this->__exception_);
- return *reinterpret_cast<_Rp*>(&__value_);
+__add_lvalue_reference_t<_Rp> __assoc_state<_Rp>::copy() {
+ unique_lock<mutex> __lk(this->__mut_);
+ this->__sub_wait(__lk);
+ if (this->__exception_ != nullptr)
+ std::rethrow_exception(this->__exception_);
+ return *reinterpret_cast<_Rp*>(&__value_);
}
template <class _Rp>
-class __assoc_state<_Rp&> : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
- typedef _Rp* _Up;
+class __assoc_state<_Rp&> : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+ typedef _Rp* _Up;
+
protected:
- _Up __value_;
+ _Up __value_;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
-public:
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __arg);
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp& __arg);
+public:
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __arg);
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp& __arg);
- _LIBCPP_HIDE_FROM_ABI _Rp& copy();
+ _LIBCPP_HIDE_FROM_ABI _Rp& copy();
};
template <class _Rp>
-void
-__assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT
-{
- delete this;
+void __assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT {
+ delete this;
}
template <class _Rp>
-void
-__assoc_state<_Rp&>::set_value(_Rp& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __value_ = std::addressof(__arg);
- this->__state_ |= base::__constructed | base::ready;
- __cv_.notify_all();
+void __assoc_state<_Rp&>::set_value(_Rp& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __value_ = std::addressof(__arg);
+ this->__state_ |= base::__constructed | base::ready;
+ __cv_.notify_all();
}
template <class _Rp>
-void
-__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
-{
- unique_lock<mutex> __lk(this->__mut_);
- if (this->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __value_ = std::addressof(__arg);
- this->__state_ |= base::__constructed;
- __thread_local_data()->__make_ready_at_thread_exit(this);
+void __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg) {
+ unique_lock<mutex> __lk(this->__mut_);
+ if (this->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __value_ = std::addressof(__arg);
+ this->__state_ |= base::__constructed;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
}
template <class _Rp>
-_Rp&
-__assoc_state<_Rp&>::copy()
-{
- unique_lock<mutex> __lk(this->__mut_);
- this->__sub_wait(__lk);
- if (this->__exception_ != nullptr)
- std::rethrow_exception(this->__exception_);
- return *__value_;
+_Rp& __assoc_state<_Rp&>::copy() {
+ unique_lock<mutex> __lk(this->__mut_);
+ this->__sub_wait(__lk);
+ if (this->__exception_ != nullptr)
+ std::rethrow_exception(this->__exception_);
+ return *__value_;
}
template <class _Rp, class _Alloc>
-class __assoc_state_alloc : public __assoc_state<_Rp>
-{
- typedef __assoc_state<_Rp> base;
- _Alloc __alloc_;
+class __assoc_state_alloc : public __assoc_state<_Rp> {
+ typedef __assoc_state<_Rp> base;
+ _Alloc __alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __assoc_state_alloc(const _Alloc& __a)
- : __alloc_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __assoc_state_alloc(const _Alloc& __a) : __alloc_(__a) {}
};
template <class _Rp, class _Alloc>
-void
-__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
-{
- if (this->__state_ & base::__constructed)
- reinterpret_cast<_Rp*>(std::addressof(this->__value_))->~_Rp();
- typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__alloc_);
- this->~__assoc_state_alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+void __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT {
+ if (this->__state_ & base::__constructed)
+ reinterpret_cast<_Rp*>(std::addressof(this->__value_))->~_Rp();
+ typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Al __a(__alloc_);
+ this->~__assoc_state_alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
template <class _Rp, class _Alloc>
-class __assoc_state_alloc<_Rp&, _Alloc> : public __assoc_state<_Rp&>
-{
- typedef __assoc_state<_Rp&> base;
- _Alloc __alloc_;
+class __assoc_state_alloc<_Rp&, _Alloc> : public __assoc_state<_Rp&> {
+ typedef __assoc_state<_Rp&> base;
+ _Alloc __alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __assoc_state_alloc(const _Alloc& __a)
- : __alloc_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __assoc_state_alloc(const _Alloc& __a) : __alloc_(__a) {}
};
template <class _Rp, class _Alloc>
-void
-__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
-{
- typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__alloc_);
- this->~__assoc_state_alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+void __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT {
+ typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Al __a(__alloc_);
+ this->~__assoc_state_alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
template <class _Alloc>
-class __assoc_sub_state_alloc : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
- _Alloc __alloc_;
+class __assoc_sub_state_alloc : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+ _Alloc __alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __assoc_sub_state_alloc(const _Alloc& __a)
- : __alloc_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __assoc_sub_state_alloc(const _Alloc& __a) : __alloc_(__a) {}
};
template <class _Alloc>
-void
-__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
-{
- typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al;
- typedef allocator_traits<_Al> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Al __a(__alloc_);
- this->~__assoc_sub_state_alloc();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+void __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT {
+ typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al;
+ typedef allocator_traits<_Al> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Al __a(__alloc_);
+ this->~__assoc_sub_state_alloc();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
template <class _Rp, class _Fp>
-class __deferred_assoc_state : public __assoc_state<_Rp>
-{
- typedef __assoc_state<_Rp> base;
+class __deferred_assoc_state : public __assoc_state<_Rp> {
+ typedef __assoc_state<_Rp> base;
- _Fp __func_;
+ _Fp __func_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __deferred_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __deferred_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
};
template <class _Rp, class _Fp>
-inline
-__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
- this->__set_deferred();
+inline __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {
+ this->__set_deferred();
}
template <class _Rp, class _Fp>
-void
-__deferred_assoc_state<_Rp, _Fp>::__execute()
-{
+void __deferred_assoc_state<_Rp, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->set_value(__func_());
+ this->set_value(__func_());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Fp>
-class __deferred_assoc_state<void, _Fp> : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
+class __deferred_assoc_state<void, _Fp> : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
- _Fp __func_;
+ _Fp __func_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __deferred_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __deferred_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
};
template <class _Fp>
-inline
-__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
- this->__set_deferred();
+inline __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {
+ this->__set_deferred();
}
template <class _Fp>
-void
-__deferred_assoc_state<void, _Fp>::__execute()
-{
+void __deferred_assoc_state<void, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __func_();
- this->set_value();
+ __func_();
+ this->set_value();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Rp, class _Fp>
-class __async_assoc_state : public __assoc_state<_Rp>
-{
- typedef __assoc_state<_Rp> base;
+class __async_assoc_state : public __assoc_state<_Rp> {
+ typedef __assoc_state<_Rp> base;
- _Fp __func_;
+ _Fp __func_;
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __on_zero_shared() _NOEXCEPT;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __async_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __async_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __execute();
};
template <class _Rp, class _Fp>
-inline
-__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
-}
+inline __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {}
template <class _Rp, class _Fp>
-void
-__async_assoc_state<_Rp, _Fp>::__execute()
-{
+void __async_assoc_state<_Rp, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->set_value(__func_());
+ this->set_value(__func_());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Rp, class _Fp>
-void
-__async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT
-{
- this->wait();
- base::__on_zero_shared();
+void __async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT {
+ this->wait();
+ base::__on_zero_shared();
}
template <class _Fp>
-class __async_assoc_state<void, _Fp> : public __assoc_sub_state
-{
- typedef __assoc_sub_state base;
+class __async_assoc_state<void, _Fp> : public __assoc_sub_state {
+ typedef __assoc_sub_state base;
+
+ _Fp __func_;
- _Fp __func_;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __async_assoc_state(_Fp&& __f);
+ _LIBCPP_HIDE_FROM_ABI explicit __async_assoc_state(_Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __execute() override;
};
template <class _Fp>
-inline
-__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
- : __func_(std::forward<_Fp>(__f))
-{
-}
+inline __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f) : __func_(std::forward<_Fp>(__f)) {}
template <class _Fp>
-void
-__async_assoc_state<void, _Fp>::__execute()
-{
+void __async_assoc_state<void, _Fp>::__execute() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __func_();
- this->set_value();
+ __func_();
+ this->set_value();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->set_exception(current_exception());
- }
+ } catch (...) {
+ this->set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _Fp>
-void
-__async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT
-{
- this->wait();
- base::__on_zero_shared();
+void __async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT {
+ this->wait();
+ base::__on_zero_shared();
}
-template <class _Rp> class _LIBCPP_TEMPLATE_VIS promise;
-template <class _Rp> class _LIBCPP_TEMPLATE_VIS shared_future;
+template <class _Rp>
+class _LIBCPP_TEMPLATE_VIS promise;
+template <class _Rp>
+class _LIBCPP_TEMPLATE_VIS shared_future;
// future
-template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;
+template <class _Rp>
+class _LIBCPP_TEMPLATE_VIS future;
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_deferred_assoc_state(_Fp&& __f);
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_deferred_assoc_state(_Fp&& __f);
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_async_assoc_state(_Fp&& __f);
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_async_assoc_state(_Fp&& __f);
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS future
-{
- __assoc_state<_Rp>* __state_;
+class _LIBCPP_TEMPLATE_VIS future {
+ __assoc_state<_Rp>* __state_;
- explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp>* __state);
+ explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp>* __state);
- template <class> friend class promise;
- template <class> friend class shared_future;
+ template <class>
+ friend class promise;
+ template <class>
+ friend class shared_future;
- template <class _R1, class _Fp>
- friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
- template <class _R1, class _Fp>
- friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
public:
- _LIBCPP_HIDE_FROM_ABI
- future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- future(future&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- future(const future&) = delete;
- future& operator=(const future&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- future& operator=(future&& __rhs) _NOEXCEPT
- {
- future(std::move(__rhs)).swap(*this);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~future();
- _LIBCPP_HIDE_FROM_ABI
- shared_future<_Rp> share() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ future(const future&) = delete;
+ future& operator=(const future&) = delete;
+ _LIBCPP_HIDE_FROM_ABI future& operator=(future&& __rhs) _NOEXCEPT {
+ future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI _Rp get();
+ _LIBCPP_HIDE_FROM_ABI ~future();
+ _LIBCPP_HIDE_FROM_ABI shared_future<_Rp> share() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void swap(future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI _Rp get();
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-future<_Rp>::future(__assoc_state<_Rp>* __state)
- : __state_(__state)
-{
- __state_->__attach_future();
+future<_Rp>::future(__assoc_state<_Rp>* __state) : __state_(__state) {
+ __state_->__attach_future();
}
-struct __release_shared_count
-{
- _LIBCPP_HIDE_FROM_ABI void operator()(__shared_count* __p) {__p->__release_shared();}
+struct __release_shared_count {
+ _LIBCPP_HIDE_FROM_ABI void operator()(__shared_count* __p) { __p->__release_shared(); }
};
template <class _Rp>
-future<_Rp>::~future()
-{
- if (__state_)
- __state_->__release_shared();
+future<_Rp>::~future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-_Rp
-future<_Rp>::get()
-{
- unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
- __assoc_state<_Rp>* __s = __state_;
- __state_ = nullptr;
- return __s->move();
+_Rp future<_Rp>::get() {
+ unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
+ __assoc_state<_Rp>* __s = __state_;
+ __state_ = nullptr;
+ return __s->move();
}
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS future<_Rp&>
-{
- __assoc_state<_Rp&>* __state_;
+class _LIBCPP_TEMPLATE_VIS future<_Rp&> {
+ __assoc_state<_Rp&>* __state_;
- explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp&>* __state);
+ explicit _LIBCPP_HIDE_FROM_ABI future(__assoc_state<_Rp&>* __state);
- template <class> friend class promise;
- template <class> friend class shared_future;
+ template <class>
+ friend class promise;
+ template <class>
+ friend class shared_future;
- template <class _R1, class _Fp>
- friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
- template <class _R1, class _Fp>
- friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
public:
- _LIBCPP_HIDE_FROM_ABI
- future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- future(future&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- future(const future&) = delete;
- future& operator=(const future&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- future& operator=(future&& __rhs) _NOEXCEPT
- {
- future(std::move(__rhs)).swap(*this);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~future();
- _LIBCPP_HIDE_FROM_ABI
- shared_future<_Rp&> share() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ future(const future&) = delete;
+ future& operator=(const future&) = delete;
+ _LIBCPP_HIDE_FROM_ABI future& operator=(future&& __rhs) _NOEXCEPT {
+ future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI _Rp& get();
+ _LIBCPP_HIDE_FROM_ABI ~future();
+ _LIBCPP_HIDE_FROM_ABI shared_future<_Rp&> share() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void swap(future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI _Rp& get();
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-future<_Rp&>::future(__assoc_state<_Rp&>* __state)
- : __state_(__state)
-{
- __state_->__attach_future();
+future<_Rp&>::future(__assoc_state<_Rp&>* __state) : __state_(__state) {
+ __state_->__attach_future();
}
template <class _Rp>
-future<_Rp&>::~future()
-{
- if (__state_)
- __state_->__release_shared();
+future<_Rp&>::~future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-_Rp&
-future<_Rp&>::get()
-{
- unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
- __assoc_state<_Rp&>* __s = __state_;
- __state_ = nullptr;
- return __s->copy();
+_Rp& future<_Rp&>::get() {
+ unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
+ __assoc_state<_Rp&>* __s = __state_;
+ __state_ = nullptr;
+ return __s->copy();
}
template <>
-class _LIBCPP_EXPORTED_FROM_ABI future<void>
-{
- __assoc_sub_state* __state_;
+class _LIBCPP_EXPORTED_FROM_ABI future<void> {
+ __assoc_sub_state* __state_;
- explicit future(__assoc_sub_state* __state);
+ explicit future(__assoc_sub_state* __state);
- template <class> friend class promise;
- template <class> friend class shared_future;
+ template <class>
+ friend class promise;
+ template <class>
+ friend class shared_future;
- template <class _R1, class _Fp>
- friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
- template <class _R1, class _Fp>
- friend future<_R1> __make_async_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
public:
- _LIBCPP_HIDE_FROM_ABI
- future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- future(future&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- future(const future&) = delete;
- future& operator=(const future&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- future& operator=(future&& __rhs) _NOEXCEPT
- {
- future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ future(const future&) = delete;
+ future& operator=(const future&) = delete;
+ _LIBCPP_HIDE_FROM_ABI future& operator=(future&& __rhs) _NOEXCEPT {
+ future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- ~future();
- _LIBCPP_HIDE_FROM_ABI
- shared_future<void> share() _NOEXCEPT;
+ ~future();
+ _LIBCPP_HIDE_FROM_ABI shared_future<void> share() _NOEXCEPT;
- // retrieving the value
- void get();
+ // retrieving the value
+ void get();
- _LIBCPP_HIDE_FROM_ABI
- void swap(future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
// promise<R>
-template <class _Callable> class packaged_task;
+template <class _Callable>
+class packaged_task;
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS promise
-{
- __assoc_state<_Rp>* __state_;
+class _LIBCPP_TEMPLATE_VIS promise {
+ __assoc_state<_Rp>* __state_;
- _LIBCPP_HIDE_FROM_ABI
- explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+
+ template <class>
+ friend class packaged_task;
- template <class> friend class packaged_task;
public:
- _LIBCPP_HIDE_FROM_ABI promise();
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Alloc& __a);
- _LIBCPP_HIDE_FROM_ABI
- promise(promise&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- promise(const promise& __rhs) = delete;
- _LIBCPP_HIDE_FROM_ABI ~promise();
+ _LIBCPP_HIDE_FROM_ABI promise();
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Alloc& __a);
+ _LIBCPP_HIDE_FROM_ABI promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ promise(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI ~promise();
+
+ // assignment
+ _LIBCPP_HIDE_FROM_ABI promise& operator=(promise&& __rhs) _NOEXCEPT {
+ promise(std::move(__rhs)).swap(*this);
+ return *this;
+ }
+ promise& operator=(const promise& __rhs) = delete;
- // assignment
- _LIBCPP_HIDE_FROM_ABI
- promise& operator=(promise&& __rhs) _NOEXCEPT
- {
- promise(std::move(__rhs)).swap(*this);
- return *this;
- }
- promise& operator=(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(promise& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the result
+ _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future();
- // retrieving the result
- _LIBCPP_HIDE_FROM_ABI future<_Rp> get_future();
+ // setting the result
+ _LIBCPP_HIDE_FROM_ABI void set_value(const _Rp& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Rp&& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
- // setting the result
- _LIBCPP_HIDE_FROM_ABI void set_value(const _Rp& __r);
- _LIBCPP_HIDE_FROM_ABI void set_value(_Rp&& __r);
- _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
-
- // setting the result with deferred notification
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(const _Rp& __r);
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&& __r);
- _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
+ // setting the result with deferred notification
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(const _Rp& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
};
template <class _Rp>
-promise<_Rp>::promise()
- : __state_(new __assoc_state<_Rp>)
-{
-}
+promise<_Rp>::promise() : __state_(new __assoc_state<_Rp>) {}
template <class _Rp>
template <class _Alloc>
-promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
-{
- typedef __assoc_state_alloc<_Rp, _Alloc> _State;
- typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a(__a0);
- unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
- __state_ = std::addressof(*__hold.release());
+promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0) {
+ typedef __assoc_state_alloc<_Rp, _Alloc> _State;
+ typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a(__a0);
+ unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
+ __state_ = std::addressof(*__hold.release());
}
template <class _Rp>
-promise<_Rp>::~promise()
-{
- if (__state_)
- {
- if (!__state_->__has_value() && __state_->use_count() > 1)
- __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
- __state_->__release_shared();
- }
+promise<_Rp>::~promise() {
+ if (__state_) {
+ if (!__state_->__has_value() && __state_->use_count() > 1)
+ __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
+ __state_->__release_shared();
+ }
}
template <class _Rp>
-future<_Rp>
-promise<_Rp>::get_future()
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- return future<_Rp>(__state_);
+future<_Rp> promise<_Rp>::get_future() {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ return future<_Rp>(__state_);
}
template <class _Rp>
-void
-promise<_Rp>::set_value(const _Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value(__r);
+void promise<_Rp>::set_value(const _Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value(__r);
}
template <class _Rp>
-void
-promise<_Rp>::set_value(_Rp&& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value(std::move(__r));
+void promise<_Rp>::set_value(_Rp&& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value(std::move(__r));
}
template <class _Rp>
-void
-promise<_Rp>::set_exception(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception(__p);
+void promise<_Rp>::set_exception(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception(__p);
}
template <class _Rp>
-void
-promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value_at_thread_exit(__r);
+void promise<_Rp>::set_value_at_thread_exit(const _Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value_at_thread_exit(__r);
}
template <class _Rp>
-void
-promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value_at_thread_exit(std::move(__r));
+void promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value_at_thread_exit(std::move(__r));
}
template <class _Rp>
-void
-promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception_at_thread_exit(__p);
+void promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception_at_thread_exit(__p);
}
// promise<R&>
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS promise<_Rp&>
-{
- __assoc_state<_Rp&>* __state_;
+class _LIBCPP_TEMPLATE_VIS promise<_Rp&> {
+ __assoc_state<_Rp&>* __state_;
- _LIBCPP_HIDE_FROM_ABI
- explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
- template <class> friend class packaged_task;
+ template <class>
+ friend class packaged_task;
public:
- _LIBCPP_HIDE_FROM_ABI promise();
- template <class _Allocator>
- _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Allocator& __a);
- _LIBCPP_HIDE_FROM_ABI
- promise(promise&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- promise(const promise& __rhs) = delete;
- _LIBCPP_HIDE_FROM_ABI ~promise();
+ _LIBCPP_HIDE_FROM_ABI promise();
+ template <class _Allocator>
+ _LIBCPP_HIDE_FROM_ABI promise(allocator_arg_t, const _Allocator& __a);
+ _LIBCPP_HIDE_FROM_ABI promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ promise(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI ~promise();
+
+ // assignment
+ _LIBCPP_HIDE_FROM_ABI promise& operator=(promise&& __rhs) _NOEXCEPT {
+ promise(std::move(__rhs)).swap(*this);
+ return *this;
+ }
+ promise& operator=(const promise& __rhs) = delete;
- // assignment
- _LIBCPP_HIDE_FROM_ABI
- promise& operator=(promise&& __rhs) _NOEXCEPT
- {
- promise(std::move(__rhs)).swap(*this);
- return *this;
- }
- promise& operator=(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(promise& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the result
+ _LIBCPP_HIDE_FROM_ABI future<_Rp&> get_future();
- // retrieving the result
- _LIBCPP_HIDE_FROM_ABI future<_Rp&> get_future();
+ // setting the result
+ _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __r);
+ _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
- // setting the result
- _LIBCPP_HIDE_FROM_ABI void set_value(_Rp& __r);
- _LIBCPP_HIDE_FROM_ABI void set_exception(exception_ptr __p);
-
- // setting the result with deferred notification
- _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&);
- _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
+ // setting the result with deferred notification
+ _LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Rp&);
+ _LIBCPP_HIDE_FROM_ABI void set_exception_at_thread_exit(exception_ptr __p);
};
template <class _Rp>
-promise<_Rp&>::promise()
- : __state_(new __assoc_state<_Rp&>)
-{
-}
+promise<_Rp&>::promise() : __state_(new __assoc_state<_Rp&>) {}
template <class _Rp>
template <class _Alloc>
-promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
-{
- typedef __assoc_state_alloc<_Rp&, _Alloc> _State;
- typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a(__a0);
- unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
- __state_ = std::addressof(*__hold.release());
+promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0) {
+ typedef __assoc_state_alloc<_Rp&, _Alloc> _State;
+ typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a(__a0);
+ unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
+ __state_ = std::addressof(*__hold.release());
}
template <class _Rp>
-promise<_Rp&>::~promise()
-{
- if (__state_)
- {
- if (!__state_->__has_value() && __state_->use_count() > 1)
- __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
- __state_->__release_shared();
- }
+promise<_Rp&>::~promise() {
+ if (__state_) {
+ if (!__state_->__has_value() && __state_->use_count() > 1)
+ __state_->set_exception(make_exception_ptr(future_error(make_error_code(future_errc::broken_promise))));
+ __state_->__release_shared();
+ }
}
template <class _Rp>
-future<_Rp&>
-promise<_Rp&>::get_future()
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- return future<_Rp&>(__state_);
+future<_Rp&> promise<_Rp&>::get_future() {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ return future<_Rp&>(__state_);
}
template <class _Rp>
-void
-promise<_Rp&>::set_value(_Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value(__r);
+void promise<_Rp&>::set_value(_Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value(__r);
}
template <class _Rp>
-void
-promise<_Rp&>::set_exception(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception(__p);
+void promise<_Rp&>::set_exception(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception(__p);
}
template <class _Rp>
-void
-promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value_at_thread_exit(__r);
+void promise<_Rp&>::set_value_at_thread_exit(_Rp& __r) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value_at_thread_exit(__r);
}
template <class _Rp>
-void
-promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
-{
- _LIBCPP_ASSERT_NON_NULL( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" );
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception_at_thread_exit(__p);
+void promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr");
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception_at_thread_exit(__p);
}
// promise<void>
template <>
-class _LIBCPP_EXPORTED_FROM_ABI promise<void>
-{
- __assoc_sub_state* __state_;
+class _LIBCPP_EXPORTED_FROM_ABI promise<void> {
+ __assoc_sub_state* __state_;
- _LIBCPP_HIDE_FROM_ABI
- explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
- template <class> friend class packaged_task;
+ template <class>
+ friend class packaged_task;
public:
- promise();
- template <class _Allocator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- promise(allocator_arg_t, const _Allocator& __a);
- _LIBCPP_HIDE_FROM_ABI
- promise(promise&& __rhs) _NOEXCEPT
- : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
- promise(const promise& __rhs) = delete;
- ~promise();
+ promise();
+ template <class _Allocator>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS promise(allocator_arg_t, const _Allocator& __a);
+ _LIBCPP_HIDE_FROM_ABI promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) { __rhs.__state_ = nullptr; }
+ promise(const promise& __rhs) = delete;
+ ~promise();
+
+ // assignment
+ _LIBCPP_HIDE_FROM_ABI promise& operator=(promise&& __rhs) _NOEXCEPT {
+ promise(std::move(__rhs)).swap(*this);
+ return *this;
+ }
+ promise& operator=(const promise& __rhs) = delete;
- // assignment
- _LIBCPP_HIDE_FROM_ABI
- promise& operator=(promise&& __rhs) _NOEXCEPT
- {
- promise(std::move(__rhs)).swap(*this);
- return *this;
- }
- promise& operator=(const promise& __rhs) = delete;
+ _LIBCPP_HIDE_FROM_ABI void swap(promise& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(promise& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ // retrieving the result
+ future<void> get_future();
- // retrieving the result
- future<void> get_future();
-
- // setting the result
- void set_value();
- void set_exception(exception_ptr __p);
+ // setting the result
+ void set_value();
+ void set_exception(exception_ptr __p);
- // setting the result with deferred notification
- void set_value_at_thread_exit();
- void set_exception_at_thread_exit(exception_ptr __p);
+ // setting the result with deferred notification
+ void set_value_at_thread_exit();
+ void set_exception_at_thread_exit(exception_ptr __p);
};
template <class _Alloc>
-promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
-{
- typedef __assoc_sub_state_alloc<_Alloc> _State;
- typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
- typedef __allocator_destructor<_A2> _D2;
- _A2 __a(__a0);
- unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
- __state_ = std::addressof(*__hold.release());
+promise<void>::promise(allocator_arg_t, const _Alloc& __a0) {
+ typedef __assoc_sub_state_alloc<_Alloc> _State;
+ typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
+ typedef __allocator_destructor<_A2> _D2;
+ _A2 __a(__a0);
+ unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _State(__a0);
+ __state_ = std::addressof(*__hold.release());
}
template <class _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
template <class _Rp, class _Alloc>
- struct _LIBCPP_TEMPLATE_VIS uses_allocator<promise<_Rp>, _Alloc>
- : public true_type {};
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<promise<_Rp>, _Alloc> : public true_type {};
// packaged_task
-template<class _Fp> class __packaged_task_base;
+template <class _Fp>
+class __packaged_task_base;
+
+template <class _Rp, class... _ArgTypes>
+class __packaged_task_base<_Rp(_ArgTypes...)> {
+ __packaged_task_base(const __packaged_task_base&);
+ __packaged_task_base& operator=(const __packaged_task_base&);
-template<class _Rp, class ..._ArgTypes>
-class __packaged_task_base<_Rp(_ArgTypes...)>
-{
- __packaged_task_base(const __packaged_task_base&);
- __packaged_task_base& operator=(const __packaged_task_base&);
public:
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_base() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual ~__packaged_task_base() {}
- virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
- virtual void destroy() = 0;
- virtual void destroy_deallocate() = 0;
- virtual _Rp operator()(_ArgTypes&& ...) = 0;
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_base() {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual ~__packaged_task_base() {}
+ virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
+ virtual void destroy() = 0;
+ virtual void destroy_deallocate() = 0;
+ virtual _Rp operator()(_ArgTypes&&...) = 0;
};
-template<class _FD, class _Alloc, class _FB> class __packaged_task_func;
+template <class _FD, class _Alloc, class _FB>
+class __packaged_task_func;
+
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> {
+ __compressed_pair<_Fp, _Alloc> __f_;
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)>
-{
- __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit __packaged_task_func(_Fp&& __f) : __f_(std::move(__f), __default_init_tag()) {}
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_func(const _Fp& __f, const _Alloc& __a)
- : __f_(__f, __a) {}
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_func(_Fp&& __f, const _Alloc& __a)
- : __f_(std::move(__f), __a) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&& ... __args);
+ _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(_Fp&& __f) : __f_(std::move(__f), __default_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {}
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_func(_Fp&& __f, const _Alloc& __a) : __f_(std::move(__f), __a) {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __args);
};
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
- __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT
-{
- ::new ((void*)__p) __packaged_task_func(std::move(__f_.first()), std::move(__f_.second()));
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
+ __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT {
+ ::new ((void*)__p) __packaged_task_func(std::move(__f_.first()), std::move(__f_.second()));
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy()
-{
- __f_.~__compressed_pair<_Fp, _Alloc>();
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() {
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-void
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
-{
- typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap;
- typedef allocator_traits<_Ap> _ATraits;
- typedef pointer_traits<typename _ATraits::pointer> _PTraits;
- _Ap __a(__f_.second());
- __f_.~__compressed_pair<_Fp, _Alloc>();
- __a.deallocate(_PTraits::pointer_to(*this), 1);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() {
+ typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap;
+ typedef allocator_traits<_Ap> _ATraits;
+ typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
+ __a.deallocate(_PTraits::pointer_to(*this), 1);
}
-template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-_Rp
-__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
-{
- return std::__invoke(__f_.first(), std::forward<_ArgTypes>(__arg)...);
+template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
+_Rp __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&&... __arg) {
+ return std::__invoke(__f_.first(), std::forward<_ArgTypes>(__arg)...);
}
-template <class _Callable> class __packaged_task_function;
+template <class _Callable>
+class __packaged_task_function;
-template<class _Rp, class ..._ArgTypes>
-class __packaged_task_function<_Rp(_ArgTypes...)>
-{
- typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
+template <class _Rp, class... _ArgTypes>
+class __packaged_task_function<_Rp(_ArgTypes...)> {
+ typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI
- __base* __get_buf() { return (__base*)&__buf_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI __base* __get_buf() { return (__base*)&__buf_; }
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<3*sizeof(void*)>::type __buf_;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __base* __f_;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<3 * sizeof(void*)>::type __buf_;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __base* __f_;
public:
- typedef _Rp result_type;
+ typedef _Rp result_type;
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- __packaged_task_function() _NOEXCEPT : __f_(nullptr) {}
- template<class _Fp>
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function(_Fp&& __f);
- template<class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function() _NOEXCEPT : __f_(nullptr) {}
+ template <class _Fp>
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function(_Fp&& __f);
+ template <class _Fp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function(__packaged_task_function&&) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI __packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function(__packaged_task_function&&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT;
- __packaged_task_function(const __packaged_task_function&) = delete;
- __packaged_task_function& operator=(const __packaged_task_function&) = delete;
+ __packaged_task_function(const __packaged_task_function&) = delete;
+ __packaged_task_function& operator=(const __packaged_task_function&) = delete;
- _LIBCPP_HIDE_FROM_ABI ~__packaged_task_function();
+ _LIBCPP_HIDE_FROM_ABI ~__packaged_task_function();
- _LIBCPP_HIDE_FROM_ABI void swap(__packaged_task_function&) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void swap(__packaged_task_function&) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
};
-template<class _Rp, class ..._ArgTypes>
-__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT
-{
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if (__f.__f_ == __f.__get_buf())
- {
- __f.__f_->__move_to(__get_buf());
- __f_ = (__base*)&__buf_;
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
-}
-
-template<class _Rp, class ..._ArgTypes>
+template <class _Rp, class... _ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT {
+ if (__f.__f_ == nullptr)
+ __f_ = nullptr;
+ else if (__f.__f_ == __f.__get_buf()) {
+ __f.__f_->__move_to(__get_buf());
+ __f_ = (__base*)&__buf_;
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
+ }
+}
+
+template <class _Rp, class... _ArgTypes>
template <class _Fp>
-__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
- : __f_(nullptr)
-{
- typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
- typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- ::new ((void*)&__buf_) _FF(std::forward<_Fp>(__f));
- __f_ = (__base*)&__buf_;
- }
- else
- {
- typedef allocator<_FF> _Ap;
- _Ap __a;
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(std::forward<_Fp>(__f), allocator<_FR>(__a));
- __f_ = __hold.release();
- }
-}
-
-template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) : __f_(nullptr) {
+ typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
+ typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
+ if (sizeof(_FF) <= sizeof(__buf_)) {
+ ::new ((void*)&__buf_) _FF(std::forward<_Fp>(__f));
+ __f_ = (__base*)&__buf_;
+ } else {
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)__hold.get()) _FF(std::forward<_Fp>(__f), allocator<_FR>(__a));
+ __f_ = __hold.release();
+ }
+}
+
+template <class _Rp, class... _ArgTypes>
template <class _Fp, class _Alloc>
-__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
- allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
- : __f_(nullptr)
-{
- typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
- typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(std::forward<_Fp>(__f));
- }
- else
- {
- typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap;
- _Ap __a(__a0);
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)std::addressof(*__hold.get()))
- _FF(std::forward<_Fp>(__f), _Alloc(__a));
- __f_ = std::addressof(*__hold.release());
- }
-}
-
-template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
+ : __f_(nullptr) {
+ typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR;
+ typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
+ if (sizeof(_FF) <= sizeof(__buf_)) {
+ __f_ = (__base*)&__buf_;
+ ::new ((void*)__f_) _FF(std::forward<_Fp>(__f));
+ } else {
+ typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new ((void*)std::addressof(*__hold.get())) _FF(std::forward<_Fp>(__f), _Alloc(__a));
+ __f_ = std::addressof(*__hold.release());
+ }
+}
+
+template <class _Rp, class... _ArgTypes>
__packaged_task_function<_Rp(_ArgTypes...)>&
-__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT
-{
- if (__f_ == __get_buf())
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
+__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT {
+ if (__f_ == __get_buf())
+ __f_->destroy();
+ else if (__f_)
+ __f_->destroy_deallocate();
+ __f_ = nullptr;
+ if (__f.__f_ == nullptr)
__f_ = nullptr;
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if (__f.__f_ == __f.__get_buf())
- {
- __f.__f_->__move_to(__get_buf());
- __f_ = __get_buf();
- }
- else
- {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- return *this;
+ else if (__f.__f_ == __f.__get_buf()) {
+ __f.__f_->__move_to(__get_buf());
+ __f_ = __get_buf();
+ } else {
+ __f_ = __f.__f_;
+ __f.__f_ = nullptr;
+ }
+ return *this;
}
-template<class _Rp, class ..._ArgTypes>
-__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
-{
- if (__f_ == __get_buf())
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
+template <class _Rp, class... _ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function() {
+ if (__f_ == __get_buf())
+ __f_->destroy();
+ else if (__f_)
+ __f_->destroy_deallocate();
}
-template<class _Rp, class ..._ArgTypes>
-_LIBCPP_NO_CFI
-void
-__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT
-{
- if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
- {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __base* __t = (__base*)&__tempbuf;
- __f_->__move_to(__t);
- __f_->destroy();
- __f_ = nullptr;
- __f.__f_->__move_to((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = nullptr;
- __f_ = (__base*)&__buf_;
- __t->__move_to((__base*)&__f.__buf_);
- __t->destroy();
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f_ == (__base*)&__buf_)
- {
- __f_->__move_to((__base*)&__f.__buf_);
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f.__f_ == (__base*)&__f.__buf_)
- {
- __f.__f_->__move_to((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = (__base*)&__buf_;
- }
- else
- std::swap(__f_, __f.__f_);
-}
-
-template<class _Rp, class ..._ArgTypes>
-inline
-_Rp
-__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
-{
- return (*__f_)(std::forward<_ArgTypes>(__arg)...);
+template <class _Rp, class... _ArgTypes>
+_LIBCPP_NO_CFI void __packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT {
+ if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) {
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __base* __t = (__base*)&__tempbuf;
+ __f_->__move_to(__t);
+ __f_->destroy();
+ __f_ = nullptr;
+ __f.__f_->__move_to((__base*)&__buf_);
+ __f.__f_->destroy();
+ __f.__f_ = nullptr;
+ __f_ = (__base*)&__buf_;
+ __t->__move_to((__base*)&__f.__buf_);
+ __t->destroy();
+ __f.__f_ = (__base*)&__f.__buf_;
+ } else if (__f_ == (__base*)&__buf_) {
+ __f_->__move_to((__base*)&__f.__buf_);
+ __f_->destroy();
+ __f_ = __f.__f_;
+ __f.__f_ = (__base*)&__f.__buf_;
+ } else if (__f.__f_ == (__base*)&__f.__buf_) {
+ __f.__f_->__move_to((__base*)&__buf_);
+ __f.__f_->destroy();
+ __f.__f_ = __f_;
+ __f_ = (__base*)&__buf_;
+ } else
+ std::swap(__f_, __f.__f_);
}
-template<class _Rp, class ..._ArgTypes>
-class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)>
-{
+template <class _Rp, class... _ArgTypes>
+inline _Rp __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const {
+ return (*__f_)(std::forward<_ArgTypes>(__arg)...);
+}
+
+template <class _Rp, class... _ArgTypes>
+class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)> {
public:
- typedef _Rp result_type; // extension
+ typedef _Rp result_type; // extension
private:
- __packaged_task_function<result_type(_ArgTypes...)> __f_;
- promise<result_type> __p_;
+ __packaged_task_function<result_type(_ArgTypes...)> __f_;
+ promise<result_type> __p_;
public:
- // construction and destruction
- _LIBCPP_HIDE_FROM_ABI
- packaged_task() _NOEXCEPT : __p_(nullptr) {}
- template <class _Fp,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
- template <class _Fp, class _Allocator,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
- : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)),
- __p_(allocator_arg_t(), __a) {}
- // ~packaged_task() = default;
+ // construction and destruction
+ _LIBCPP_HIDE_FROM_ABI packaged_task() _NOEXCEPT : __p_(nullptr) {}
+ template <class _Fp, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
+ template <class _Fp, class _Allocator, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+ : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {}
+ // ~packaged_task() = default;
+
+ // no copy
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
+
+ // move support
+ _LIBCPP_HIDE_FROM_ABI packaged_task(packaged_task&& __other) _NOEXCEPT
+ : __f_(std::move(__other.__f_)),
+ __p_(std::move(__other.__p_)) {}
+ _LIBCPP_HIDE_FROM_ABI packaged_task& operator=(packaged_task&& __other) _NOEXCEPT {
+ __f_ = std::move(__other.__f_);
+ __p_ = std::move(__other.__p_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(packaged_task& __other) _NOEXCEPT {
+ __f_.swap(__other.__f_);
+ __p_.swap(__other.__p_);
+ }
- // no copy
- packaged_task(const packaged_task&) = delete;
- packaged_task& operator=(const packaged_task&) = delete;
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
- // move support
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(packaged_task&& __other) _NOEXCEPT
- : __f_(std::move(__other.__f_)), __p_(std::move(__other.__p_)) {}
- _LIBCPP_HIDE_FROM_ABI
- packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
- {
- __f_ = std::move(__other.__f_);
- __p_ = std::move(__other.__p_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(packaged_task& __other) _NOEXCEPT
- {
- __f_.swap(__other.__f_);
- __p_.swap(__other.__p_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
+ // result retrieval
+ _LIBCPP_HIDE_FROM_ABI future<result_type> get_future() { return __p_.get_future(); }
- // result retrieval
- _LIBCPP_HIDE_FROM_ABI
- future<result_type> get_future() {return __p_.get_future();}
+ // execution
+ _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
+ _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
- // execution
- _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
- _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
-
- _LIBCPP_HIDE_FROM_ABI void reset();
+ _LIBCPP_HIDE_FROM_ABI void reset();
};
-template<class _Rp, class ..._ArgTypes>
-void
-packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class _Rp, class... _ArgTypes>
+void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __p_.set_value(__f_(std::forward<_ArgTypes>(__args)...));
+ __p_.set_value(__f_(std::forward<_ArgTypes>(__args)...));
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class _Rp, class ..._ArgTypes>
-void
-packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class _Rp, class... _ArgTypes>
+void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __p_.set_value_at_thread_exit(__f_(std::forward<_ArgTypes>(__args)...));
+ __p_.set_value_at_thread_exit(__f_(std::forward<_ArgTypes>(__args)...));
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception_at_thread_exit(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception_at_thread_exit(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class _Rp, class ..._ArgTypes>
-void
-packaged_task<_Rp(_ArgTypes...)>::reset()
-{
- if (!valid())
- __throw_future_error(future_errc::no_state);
- __p_ = promise<result_type>();
+template <class _Rp, class... _ArgTypes>
+void packaged_task<_Rp(_ArgTypes...)>::reset() {
+ if (!valid())
+ __throw_future_error(future_errc::no_state);
+ __p_ = promise<result_type>();
}
-template<class ..._ArgTypes>
-class _LIBCPP_TEMPLATE_VIS packaged_task<void(_ArgTypes...)>
-{
+template <class... _ArgTypes>
+class _LIBCPP_TEMPLATE_VIS packaged_task<void(_ArgTypes...)> {
public:
- typedef void result_type; // extension
+ typedef void result_type; // extension
private:
- __packaged_task_function<result_type(_ArgTypes...)> __f_;
- promise<result_type> __p_;
+ __packaged_task_function<result_type(_ArgTypes...)> __f_;
+ promise<result_type> __p_;
public:
- // construction and destruction
- _LIBCPP_HIDE_FROM_ABI
- packaged_task() _NOEXCEPT : __p_(nullptr) {}
- template <class _Fp,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
- template <class _Fp, class _Allocator,
- class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
- : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)),
- __p_(allocator_arg_t(), __a) {}
- // ~packaged_task() = default;
-
- // no copy
- packaged_task(const packaged_task&) = delete;
- packaged_task& operator=(const packaged_task&) = delete;
+ // construction and destruction
+ _LIBCPP_HIDE_FROM_ABI packaged_task() _NOEXCEPT : __p_(nullptr) {}
+ template <class _Fp, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {}
+ template <class _Fp, class _Allocator, class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> >
+ _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+ : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {}
+ // ~packaged_task() = default;
+
+ // no copy
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
+
+ // move support
+ _LIBCPP_HIDE_FROM_ABI packaged_task(packaged_task&& __other) _NOEXCEPT
+ : __f_(std::move(__other.__f_)),
+ __p_(std::move(__other.__p_)) {}
+ _LIBCPP_HIDE_FROM_ABI packaged_task& operator=(packaged_task&& __other) _NOEXCEPT {
+ __f_ = std::move(__other.__f_);
+ __p_ = std::move(__other.__p_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(packaged_task& __other) _NOEXCEPT {
+ __f_.swap(__other.__f_);
+ __p_.swap(__other.__p_);
+ }
- // move support
- _LIBCPP_HIDE_FROM_ABI
- packaged_task(packaged_task&& __other) _NOEXCEPT
- : __f_(std::move(__other.__f_)), __p_(std::move(__other.__p_)) {}
- _LIBCPP_HIDE_FROM_ABI
- packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
- {
- __f_ = std::move(__other.__f_);
- __p_ = std::move(__other.__p_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(packaged_task& __other) _NOEXCEPT
- {
- __f_.swap(__other.__f_);
- __p_.swap(__other.__p_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __p_.__state_ != nullptr; }
- // result retrieval
- _LIBCPP_HIDE_FROM_ABI
- future<result_type> get_future() {return __p_.get_future();}
+ // result retrieval
+ _LIBCPP_HIDE_FROM_ABI future<result_type> get_future() { return __p_.get_future(); }
- // execution
- _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
- _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
+ // execution
+ _LIBCPP_HIDE_FROM_ABI void operator()(_ArgTypes... __args);
+ _LIBCPP_HIDE_FROM_ABI void make_ready_at_thread_exit(_ArgTypes... __args);
- _LIBCPP_HIDE_FROM_ABI void reset();
+ _LIBCPP_HIDE_FROM_ABI void reset();
};
#if _LIBCPP_STD_VER >= 17
template <class _Rp, class... _Args>
-packaged_task(_Rp(*)(_Args...)) -> packaged_task<_Rp(_Args...)>;
+packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>;
template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
packaged_task(_Fp) -> packaged_task<_Stripped>;
#endif
-template<class ..._ArgTypes>
-void
-packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class... _ArgTypes>
+void packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __f_(std::forward<_ArgTypes>(__args)...);
- __p_.set_value();
+ __f_(std::forward<_ArgTypes>(__args)...);
+ __p_.set_value();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class ..._ArgTypes>
-void
-packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
-{
- if (__p_.__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- if (__p_.__state_->__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
+template <class... _ArgTypes>
+void packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) {
+ if (__p_.__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ if (__p_.__state_->__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __f_(std::forward<_ArgTypes>(__args)...);
- __p_.set_value_at_thread_exit();
+ __f_(std::forward<_ArgTypes>(__args)...);
+ __p_.set_value_at_thread_exit();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __p_.set_exception_at_thread_exit(current_exception());
- }
+ } catch (...) {
+ __p_.set_exception_at_thread_exit(current_exception());
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class ..._ArgTypes>
-void
-packaged_task<void(_ArgTypes...)>::reset()
-{
- if (!valid())
- __throw_future_error(future_errc::no_state);
- __p_ = promise<result_type>();
+template <class... _ArgTypes>
+void packaged_task<void(_ArgTypes...)>::reset() {
+ if (!valid())
+ __throw_future_error(future_errc::no_state);
+ __p_ = promise<result_type>();
}
template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(packaged_task<_Rp(_ArgTypes...)>& __x, packaged_task<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(packaged_task<_Rp(_ArgTypes...)>& __x, packaged_task<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
template <class _Callable, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
- : public true_type {};
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc> : public true_type {};
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_deferred_assoc_state(_Fp&& __f)
-{
- unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count>
- __h(new __deferred_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
- return future<_Rp>(__h.get());
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_deferred_assoc_state(_Fp&& __f) {
+ unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count> __h(
+ new __deferred_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
+ return future<_Rp>(__h.get());
}
template <class _Rp, class _Fp>
-_LIBCPP_HIDE_FROM_ABI future<_Rp>
-__make_async_assoc_state(_Fp&& __f)
-{
- unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count>
- __h(new __async_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
- std::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
- return future<_Rp>(__h.get());
+_LIBCPP_HIDE_FROM_ABI future<_Rp> __make_async_assoc_state(_Fp&& __f) {
+ unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count> __h(
+ new __async_assoc_state<_Rp, _Fp>(std::forward<_Fp>(__f)));
+ std::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
+ return future<_Rp>(__h.get());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Fp, class... _Args>
-class _LIBCPP_HIDDEN __async_func
-{
- tuple<_Fp, _Args...> __f_;
+class _LIBCPP_HIDDEN __async_func {
+ tuple<_Fp, _Args...> __f_;
public:
- typedef typename __invoke_of<_Fp, _Args...>::type _Rp;
+ typedef typename __invoke_of<_Fp, _Args...>::type _Rp;
- _LIBCPP_HIDE_FROM_ABI
- explicit __async_func(_Fp&& __f, _Args&&... __args)
- : __f_(std::move(__f), std::move(__args)...) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __async_func(_Fp&& __f, _Args&&... __args)
+ : __f_(std::move(__f), std::move(__args)...) {}
- _LIBCPP_HIDE_FROM_ABI
- __async_func(__async_func&& __f) : __f_(std::move(__f.__f_)) {}
+ _LIBCPP_HIDE_FROM_ABI __async_func(__async_func&& __f) : __f_(std::move(__f.__f_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()() {
+ typedef typename __make_tuple_indices<1 + sizeof...(_Args), 1>::type _Index;
+ return __execute(_Index());
+ }
- _LIBCPP_HIDE_FROM_ABI _Rp operator()()
- {
- typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
- return __execute(_Index());
- }
private:
- template <size_t ..._Indices>
- _LIBCPP_HIDE_FROM_ABI _Rp
- __execute(__tuple_indices<_Indices...>)
- {
- return std::__invoke(std::move(std::get<0>(__f_)), std::move(std::get<_Indices>(__f_))...);
- }
+ template <size_t... _Indices>
+ _LIBCPP_HIDE_FROM_ABI _Rp __execute(__tuple_indices<_Indices...>) {
+ return std::__invoke(std::move(std::get<0>(__f_)), std::move(std::get<_Indices>(__f_))...);
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI bool __does_policy_contain(launch __policy, launch __value )
-{ return (int(__policy) & int(__value)) != 0; }
+inline _LIBCPP_HIDE_FROM_ABI bool __does_policy_contain(launch __policy, launch __value) {
+ return (int(__policy) & int(__value)) != 0;
+}
template <class _Fp, class... _Args>
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
-async(launch __policy, _Fp&& __f, _Args&&... __args)
-{
- typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF;
- typedef typename _BF::_Rp _Rp;
-
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif
- if (__does_policy_contain(__policy, launch::async))
- return std::__make_async_assoc_state<_Rp>(_BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)),
- _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch ( ... ) { if (__policy == launch::async) throw ; }
-#endif
-
- if (__does_policy_contain(__policy, launch::deferred))
- return std::__make_deferred_assoc_state<_Rp>(_BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)),
- _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
- return future<_Rp>{};
+ future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
+ async(launch __policy, _Fp&& __f, _Args&&... __args) {
+ typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF;
+ typedef typename _BF::_Rp _Rp;
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif
+ if (__does_policy_contain(__policy, launch::async))
+ return std::__make_async_assoc_state<_Rp>(
+ _BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ if (__policy == launch::async)
+ throw;
+ }
+# endif
+
+ if (__does_policy_contain(__policy, launch::deferred))
+ return std::__make_deferred_assoc_state<_Rp>(
+ _BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
+ return future<_Rp>{};
}
template <class _Fp, class... _Args>
_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI
-future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
-async(_Fp&& __f, _Args&&... __args)
-{
- return std::async(launch::any, std::forward<_Fp>(__f),
- std::forward<_Args>(__args)...);
+ future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
+ async(_Fp&& __f, _Args&&... __args) {
+ return std::async(launch::any, std::forward<_Fp>(__f), std::forward<_Args>(__args)...);
}
#endif // C++03
@@ -2225,226 +1873,173 @@ async(_Fp&& __f, _Args&&... __args)
// shared_future
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS shared_future
-{
- __assoc_state<_Rp>* __state_;
+class _LIBCPP_TEMPLATE_VIS shared_future {
+ __assoc_state<_Rp>* __state_;
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(const shared_future& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {if (__state_) __state_->__add_shared();}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_)
- {__f.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {__rhs.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI ~shared_future();
- _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
- {
- shared_future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI shared_future(const shared_future& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ if (__state_)
+ __state_->__add_shared();
+ }
+ _LIBCPP_HIDE_FROM_ABI shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_) { __f.__state_ = nullptr; }
+ _LIBCPP_HIDE_FROM_ABI shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ __rhs.__state_ = nullptr;
+ }
+ _LIBCPP_HIDE_FROM_ABI ~shared_future();
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(shared_future&& __rhs) _NOEXCEPT {
+ shared_future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI
- const _Rp& get() const {return __state_->copy();}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI const _Rp& get() const { return __state_->copy(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-shared_future<_Rp>::~shared_future()
-{
- if (__state_)
- __state_->__release_shared();
+shared_future<_Rp>::~shared_future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-shared_future<_Rp>&
-shared_future<_Rp>::operator=(const shared_future& __rhs) _NOEXCEPT
-{
- if (__rhs.__state_)
- __rhs.__state_->__add_shared();
- if (__state_)
- __state_->__release_shared();
- __state_ = __rhs.__state_;
- return *this;
+shared_future<_Rp>& shared_future<_Rp>::operator=(const shared_future& __rhs) _NOEXCEPT {
+ if (__rhs.__state_)
+ __rhs.__state_->__add_shared();
+ if (__state_)
+ __state_->__release_shared();
+ __state_ = __rhs.__state_;
+ return *this;
}
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS shared_future<_Rp&>
-{
- __assoc_state<_Rp&>* __state_;
+class _LIBCPP_TEMPLATE_VIS shared_future<_Rp&> {
+ __assoc_state<_Rp&>* __state_;
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
- {if (__state_) __state_->__add_shared();}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_)
- {__f.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {__rhs.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI ~shared_future();
- _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
- {
- shared_future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) {
+ if (__state_)
+ __state_->__add_shared();
+ }
+ _LIBCPP_HIDE_FROM_ABI shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_) { __f.__state_ = nullptr; }
+ _LIBCPP_HIDE_FROM_ABI shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ __rhs.__state_ = nullptr;
+ }
+ _LIBCPP_HIDE_FROM_ABI ~shared_future();
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(const shared_future& __rhs);
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(shared_future&& __rhs) _NOEXCEPT {
+ shared_future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI
- _Rp& get() const {return __state_->copy();}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI _Rp& get() const { return __state_->copy(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-shared_future<_Rp&>::~shared_future()
-{
- if (__state_)
- __state_->__release_shared();
+shared_future<_Rp&>::~shared_future() {
+ if (__state_)
+ __state_->__release_shared();
}
template <class _Rp>
-shared_future<_Rp&>&
-shared_future<_Rp&>::operator=(const shared_future& __rhs)
-{
- if (__rhs.__state_)
- __rhs.__state_->__add_shared();
- if (__state_)
- __state_->__release_shared();
- __state_ = __rhs.__state_;
- return *this;
+shared_future<_Rp&>& shared_future<_Rp&>::operator=(const shared_future& __rhs) {
+ if (__rhs.__state_)
+ __rhs.__state_->__add_shared();
+ if (__state_)
+ __state_->__release_shared();
+ __state_ = __rhs.__state_;
+ return *this;
}
template <>
-class _LIBCPP_EXPORTED_FROM_ABI shared_future<void>
-{
- __assoc_sub_state* __state_;
+class _LIBCPP_EXPORTED_FROM_ABI shared_future<void> {
+ __assoc_sub_state* __state_;
public:
- _LIBCPP_HIDE_FROM_ABI
- shared_future() _NOEXCEPT : __state_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
- {if (__state_) __state_->__add_shared();}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_)
- {__f.__state_ = nullptr;}
- _LIBCPP_HIDE_FROM_ABI
- shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
- {__rhs.__state_ = nullptr;}
- ~shared_future();
- shared_future& operator=(const shared_future& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
- {
- shared_future(std::move(__rhs)).swap(*this);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI shared_future() _NOEXCEPT : __state_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) {
+ if (__state_)
+ __state_->__add_shared();
+ }
+ _LIBCPP_HIDE_FROM_ABI shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_) { __f.__state_ = nullptr; }
+ _LIBCPP_HIDE_FROM_ABI shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {
+ __rhs.__state_ = nullptr;
+ }
+ ~shared_future();
+ shared_future& operator=(const shared_future& __rhs);
+ _LIBCPP_HIDE_FROM_ABI shared_future& operator=(shared_future&& __rhs) _NOEXCEPT {
+ shared_future(std::move(__rhs)).swap(*this);
+ return *this;
+ }
- // retrieving the value
- _LIBCPP_HIDE_FROM_ABI
- void get() const {__state_->copy();}
+ // retrieving the value
+ _LIBCPP_HIDE_FROM_ABI void get() const { __state_->copy(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(shared_future& __rhs) _NOEXCEPT {std::swap(__state_, __rhs.__state_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(shared_future& __rhs) _NOEXCEPT { std::swap(__state_, __rhs.__state_); }
- // functions to check state
- _LIBCPP_HIDE_FROM_ABI
- bool valid() const _NOEXCEPT {return __state_ != nullptr;}
+ // functions to check state
+ _LIBCPP_HIDE_FROM_ABI bool valid() const _NOEXCEPT { return __state_ != nullptr; }
- _LIBCPP_HIDE_FROM_ABI
- void wait() const {__state_->wait();}
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
- {return __state_->wait_for(__rel_time);}
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI
- future_status
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const
- {return __state_->wait_until(__abs_time);}
+ _LIBCPP_HIDE_FROM_ABI void wait() const { __state_->wait(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const {
+ return __state_->wait_for(__rel_time);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_HIDE_FROM_ABI future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const {
+ return __state_->wait_until(__abs_time);
+ }
};
template <class _Rp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
template <class _Rp>
-inline
-shared_future<_Rp>
-future<_Rp>::share() _NOEXCEPT
-{
- return shared_future<_Rp>(std::move(*this));
+inline shared_future<_Rp> future<_Rp>::share() _NOEXCEPT {
+ return shared_future<_Rp>(std::move(*this));
}
template <class _Rp>
-inline
-shared_future<_Rp&>
-future<_Rp&>::share() _NOEXCEPT
-{
- return shared_future<_Rp&>(std::move(*this));
+inline shared_future<_Rp&> future<_Rp&>::share() _NOEXCEPT {
+ return shared_future<_Rp&>(std::move(*this));
}
-inline
-shared_future<void>
-future<void>::share() _NOEXCEPT
-{
- return shared_future<void>(std::move(*this));
-}
+inline shared_future<void> future<void>::share() _NOEXCEPT { return shared_future<void>(std::move(*this)); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/initializer_list b/contrib/llvm-project/libcxx/include/initializer_list
index 4954a7ee89ed..4c2a7925a57b 100644
--- a/contrib/llvm-project/libcxx/include/initializer_list
+++ b/contrib/llvm-project/libcxx/include/initializer_list
@@ -50,65 +50,46 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
# pragma GCC system_header
#endif
-namespace std // purposefully not versioned
+namespace std // purposefully not versioned
{
#ifndef _LIBCPP_CXX03_LANG
-template<class _Ep>
-class _LIBCPP_TEMPLATE_VIS initializer_list
-{
- const _Ep* __begin_;
- size_t __size_;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
- : __begin_(__b),
- __size_(__s)
- {}
+template <class _Ep>
+class _LIBCPP_TEMPLATE_VIS initializer_list {
+ const _Ep* __begin_;
+ size_t __size_;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
+ : __begin_(__b),
+ __size_(__s) {}
+
public:
- typedef _Ep value_type;
- typedef const _Ep& reference;
- typedef const _Ep& const_reference;
- typedef size_t size_type;
+ typedef _Ep value_type;
+ typedef const _Ep& reference;
+ typedef const _Ep& const_reference;
+ typedef size_t size_type;
- typedef const _Ep* iterator;
- typedef const _Ep* const_iterator;
+ typedef const _Ep* iterator;
+ typedef const _Ep* const_iterator;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- size_t size() const _NOEXCEPT {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t size() const _NOEXCEPT { return __size_; }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _Ep* begin() const _NOEXCEPT {return __begin_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin() const _NOEXCEPT { return __begin_; }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end() const _NOEXCEPT { return __begin_ + __size_; }
};
-template<class _Ep>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Ep*
-begin(initializer_list<_Ep> __il) _NOEXCEPT
-{
- return __il.begin();
+template <class _Ep>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin(initializer_list<_Ep> __il) _NOEXCEPT {
+ return __il.begin();
}
-template<class _Ep>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX14
-const _Ep*
-end(initializer_list<_Ep> __il) _NOEXCEPT
-{
- return __il.end();
+template <class _Ep>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initializer_list<_Ep> __il) _NOEXCEPT {
+ return __il.end();
}
#endif // !defined(_LIBCPP_CXX03_LANG)
diff --git a/contrib/llvm-project/libcxx/include/inttypes.h b/contrib/llvm-project/libcxx/include/inttypes.h
index b755526b8492..8664412bd52f 100644
--- a/contrib/llvm-project/libcxx/include/inttypes.h
+++ b/contrib/llvm-project/libcxx/include/inttypes.h
@@ -12,7 +12,7 @@
// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
// case the header guard macro is defined.
#if !defined(_AIX) || !defined(_STD_TYPES_T)
-#define _LIBCPP_INTTYPES_H
+# define _LIBCPP_INTTYPES_H
#endif // _STD_TYPES_T
/*
@@ -245,7 +245,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
for C++11 unless __STDC_FORMAT_MACROS is defined
*/
#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
-# define __STDC_FORMAT_MACROS
+# define __STDC_FORMAT_MACROS
#endif
#if __has_include_next(<inttypes.h>)
@@ -254,10 +254,10 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
#ifdef __cplusplus
-#include <stdint.h>
+# include <stdint.h>
-#undef imaxabs
-#undef imaxdiv
+# undef imaxabs
+# undef imaxdiv
#endif // __cplusplus
diff --git a/contrib/llvm-project/libcxx/include/iomanip b/contrib/llvm-project/libcxx/include/iomanip
index 157d974c6356..1b9563a24e10 100644
--- a/contrib/llvm-project/libcxx/include/iomanip
+++ b/contrib/llvm-project/libcxx/include/iomanip
@@ -55,601 +55,485 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// resetiosflags
-class __iom_t1
-{
- ios_base::fmtflags __mask_;
+class __iom_t1 {
+ ios_base::fmtflags __mask_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
- {
- __is.unsetf(__x.__mask_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
- {
- __os.unsetf(__x.__mask_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x) {
+ __is.unsetf(__x.__mask_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x) {
+ __os.unsetf(__x.__mask_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t1
-resetiosflags(ios_base::fmtflags __mask)
-{
- return __iom_t1(__mask);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t1 resetiosflags(ios_base::fmtflags __mask) { return __iom_t1(__mask); }
// setiosflags
-class __iom_t2
-{
- ios_base::fmtflags __mask_;
+class __iom_t2 {
+ ios_base::fmtflags __mask_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
- {
- __is.setf(__x.__mask_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
- {
- __os.setf(__x.__mask_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x) {
+ __is.setf(__x.__mask_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x) {
+ __os.setf(__x.__mask_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t2
-setiosflags(ios_base::fmtflags __mask)
-{
- return __iom_t2(__mask);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t2 setiosflags(ios_base::fmtflags __mask) { return __iom_t2(__mask); }
// setbase
-class __iom_t3
-{
- int __base_;
-public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t3(int __b) : __base_(__b) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
- {
- __is.setf(__x.__base_ == 8 ? ios_base::oct :
- __x.__base_ == 10 ? ios_base::dec :
- __x.__base_ == 16 ? ios_base::hex :
- ios_base::fmtflags(0), ios_base::basefield);
- return __is;
- }
+class __iom_t3 {
+ int __base_;
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
- {
- __os.setf(__x.__base_ == 8 ? ios_base::oct :
- __x.__base_ == 10 ? ios_base::dec :
- __x.__base_ == 16 ? ios_base::hex :
- ios_base::fmtflags(0), ios_base::basefield);
- return __os;
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t3(int __b) : __base_(__b) {}
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x) {
+ __is.setf(__x.__base_ == 8 ? ios_base::oct
+ : __x.__base_ == 10 ? ios_base::dec
+ : __x.__base_ == 16 ? ios_base::hex
+ : ios_base::fmtflags(0),
+ ios_base::basefield);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x) {
+ __os.setf(__x.__base_ == 8 ? ios_base::oct
+ : __x.__base_ == 10 ? ios_base::dec
+ : __x.__base_ == 16 ? ios_base::hex
+ : ios_base::fmtflags(0),
+ ios_base::basefield);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t3
-setbase(int __base)
-{
- return __iom_t3(__base);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t3 setbase(int __base) { return __iom_t3(__base); }
// setfill
-template<class _CharT>
-class __iom_t4
-{
- _CharT __fill_;
+template <class _CharT>
+class __iom_t4 {
+ _CharT __fill_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t4(_CharT __c) : __fill_(__c) {}
-
- template <class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
- {
- __os.fill(__x.__fill_);
- return __os;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t4(_CharT __c) : __fill_(__c) {}
+
+ template <class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x) {
+ __os.fill(__x.__fill_);
+ return __os;
+ }
};
-template<class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t4<_CharT>
-setfill(_CharT __c)
-{
- return __iom_t4<_CharT>(__c);
+template <class _CharT>
+inline _LIBCPP_HIDE_FROM_ABI __iom_t4<_CharT> setfill(_CharT __c) {
+ return __iom_t4<_CharT>(__c);
}
// setprecision
-class __iom_t5
-{
- int __n_;
+class __iom_t5 {
+ int __n_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t5(int __n) : __n_(__n) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
- {
- __is.precision(__x.__n_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t5(int __n) : __n_(__n) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
- {
- __os.precision(__x.__n_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x) {
+ __is.precision(__x.__n_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x) {
+ __os.precision(__x.__n_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t5
-setprecision(int __n)
-{
- return __iom_t5(__n);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t5 setprecision(int __n) { return __iom_t5(__n); }
// setw
-class __iom_t6
-{
- int __n_;
+class __iom_t6 {
+ int __n_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __iom_t6(int __n) : __n_(__n) {}
-
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
- {
- __is.width(__x.__n_);
- return __is;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __iom_t6(int __n) : __n_(__n) {}
- template <class _CharT, class _Traits>
- friend
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
- {
- __os.width(__x.__n_);
- return __os;
- }
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x) {
+ __is.width(__x.__n_);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x) {
+ __os.width(__x.__n_);
+ return __os;
+ }
};
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t6
-setw(int __n)
-{
- return __iom_t6(__n);
-}
+inline _LIBCPP_HIDE_FROM_ABI __iom_t6 setw(int __n) { return __iom_t6(__n); }
// get_money
-template <class _MoneyT> class __iom_t7;
+template <class _MoneyT>
+class __iom_t7;
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x);
template <class _MoneyT>
-class __iom_t7
-{
- _MoneyT& __mon_;
- bool __intl_;
+class __iom_t7 {
+ _MoneyT& __mon_;
+ bool __intl_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t7(_MoneyT& __mon, bool __intl)
- : __mon_(__mon), __intl_(__intl) {}
-
- template <class _CharT, class _Traits, class _Mp>
- friend
- basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t7(_MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {}
+
+ template <class _CharT, class _Traits, class _Mp>
+ friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
-{
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef money_get<_CharT, _Ip> _Fp;
- ios_base::iostate __err = ios_base::goodbit;
- const _Fp& __mf = std::use_facet<_Fp>(__is.getloc());
- __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
- __is.setstate(__err);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __is.__set_badbit_and_consider_rethrow();
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef money_get<_CharT, _Ip> _Fp;
+ ios_base::iostate __err = ios_base::goodbit;
+ const _Fp& __mf = std::use_facet<_Fp>(__is.getloc());
+ __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
+ __is.setstate(__err);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __is.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __is;
+ return __is;
}
template <class _MoneyT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t7<_MoneyT>
-get_money(_MoneyT& __mon, bool __intl = false)
-{
- return __iom_t7<_MoneyT>(__mon, __intl);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t7<_MoneyT> get_money(_MoneyT& __mon, bool __intl = false) {
+ return __iom_t7<_MoneyT>(__mon, __intl);
}
// put_money
-template <class _MoneyT> class __iom_t8;
+template <class _MoneyT>
+class __iom_t8;
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x);
template <class _MoneyT>
-class __iom_t8
-{
- const _MoneyT& __mon_;
- bool __intl_;
+class __iom_t8 {
+ const _MoneyT& __mon_;
+ bool __intl_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t8(const _MoneyT& __mon, bool __intl)
- : __mon_(__mon), __intl_(__intl) {}
-
- template <class _CharT, class _Traits, class _Mp>
- friend
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t8(const _MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {}
+
+ template <class _CharT, class _Traits, class _Mp>
+ friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
-{
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- typedef money_put<_CharT, _Op> _Fp;
- const _Fp& __mf = std::use_facet<_Fp>(__os.getloc());
- if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
- __os.setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ typedef money_put<_CharT, _Op> _Fp;
+ const _Fp& __mf = std::use_facet<_Fp>(__os.getloc());
+ if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
+ __os.setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
template <class _MoneyT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t8<_MoneyT>
-put_money(const _MoneyT& __mon, bool __intl = false)
-{
- return __iom_t8<_MoneyT>(__mon, __intl);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t8<_MoneyT> put_money(const _MoneyT& __mon, bool __intl = false) {
+ return __iom_t8<_MoneyT>(__mon, __intl);
}
// get_time
-template <class _CharT> class __iom_t9;
+template <class _CharT>
+class __iom_t9;
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x);
template <class _CharT>
-class __iom_t9
-{
- tm* __tm_;
- const _CharT* __fmt_;
+class __iom_t9 {
+ tm* __tm_;
+ const _CharT* __fmt_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t9(tm* __tm, const _CharT* __fmt)
- : __tm_(__tm), __fmt_(__fmt) {}
-
- template <class _Cp, class _Traits>
- friend
- basic_istream<_Cp, _Traits>&
- operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t9(tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {}
+
+ template <class _Cp, class _Traits>
+ friend basic_istream<_Cp, _Traits>& operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
};
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
-{
+operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef time_get<_CharT, _Ip> _Fp;
- ios_base::iostate __err = ios_base::goodbit;
- const _Fp& __tf = std::use_facet<_Fp>(__is.getloc());
- __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
- __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
- __is.setstate(__err);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __is.__set_badbit_and_consider_rethrow();
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef time_get<_CharT, _Ip> _Fp;
+ ios_base::iostate __err = ios_base::goodbit;
+ const _Fp& __tf = std::use_facet<_Fp>(__is.getloc());
+ __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
+ __is.setstate(__err);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __is.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __is;
+ return __is;
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t9<_CharT>
-get_time(tm* __tm, const _CharT* __fmt)
-{
- return __iom_t9<_CharT>(__tm, __fmt);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t9<_CharT> get_time(tm* __tm, const _CharT* __fmt) {
+ return __iom_t9<_CharT>(__tm, __fmt);
}
// put_time
-template <class _CharT> class __iom_t10;
+template <class _CharT>
+class __iom_t10;
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x);
template <class _CharT>
-class __iom_t10
-{
- const tm* __tm_;
- const _CharT* __fmt_;
+class __iom_t10 {
+ const tm* __tm_;
+ const _CharT* __fmt_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __iom_t10(const tm* __tm, const _CharT* __fmt)
- : __tm_(__tm), __fmt_(__fmt) {}
-
- template <class _Cp, class _Traits>
- friend
- basic_ostream<_Cp, _Traits>&
- operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
+ _LIBCPP_HIDE_FROM_ABI __iom_t10(const tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {}
+
+ template <class _Cp, class _Traits>
+ friend basic_ostream<_Cp, _Traits>& operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
};
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
-{
+operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- typedef time_put<_CharT, _Op> _Fp;
- const _Fp& __tf = std::use_facet<_Fp>(__os.getloc());
- if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
- __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
- __os.setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ typedef time_put<_CharT, _Op> _Fp;
+ const _Fp& __tf = std::use_facet<_Fp>(__os.getloc());
+ if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_))
+ .failed())
+ __os.setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
template <class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-__iom_t10<_CharT>
-put_time(const tm* __tm, const _CharT* __fmt)
-{
- return __iom_t10<_CharT>(__tm, __fmt);
+inline _LIBCPP_HIDE_FROM_ABI __iom_t10<_CharT> put_time(const tm* __tm, const _CharT* __fmt) {
+ return __iom_t10<_CharT>(__tm, __fmt);
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-__quoted_output(basic_ostream<_CharT, _Traits>& __os,
- const _CharT *__first, const _CharT *__last, _CharT __delim, _CharT __escape)
-{
- basic_string<_CharT, _Traits> __str;
- __str.push_back(__delim);
- for (; __first != __last; ++__first) {
- if (_Traits::eq(*__first, __escape) || _Traits::eq(*__first, __delim))
- __str.push_back(__escape);
- __str.push_back(*__first);
- }
- __str.push_back(__delim);
- return std::__put_character_sequence(__os, __str.data(), __str.size());
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __quoted_output(
+ basic_ostream<_CharT, _Traits>& __os,
+ const _CharT* __first,
+ const _CharT* __last,
+ _CharT __delim,
+ _CharT __escape) {
+ basic_string<_CharT, _Traits> __str;
+ __str.push_back(__delim);
+ for (; __first != __last; ++__first) {
+ if (_Traits::eq(*__first, __escape) || _Traits::eq(*__first, __delim))
+ __str.push_back(__escape);
+ __str.push_back(*__first);
+ }
+ __str.push_back(__delim);
+ return std::__put_character_sequence(__os, __str.data(), __str.size());
}
template <class _CharT, class _Traits, class _String>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-__quoted_input(basic_istream<_CharT, _Traits>& __is, _String& __string, _CharT __delim, _CharT __escape)
-{
- __string.clear();
- _CharT __c;
- __is >> __c;
- if (__is.fail())
- return __is;
-
- if (!_Traits::eq(__c, __delim)) {
- // no delimiter, read the whole string
- __is.unget();
- __is >> __string;
- return __is;
- }
+__quoted_input(basic_istream<_CharT, _Traits>& __is, _String& __string, _CharT __delim, _CharT __escape) {
+ __string.clear();
+ _CharT __c;
+ __is >> __c;
+ if (__is.fail())
+ return __is;
- __save_flags<_CharT, _Traits> __sf(__is);
- std::noskipws(__is);
- while (true) {
- __is >> __c;
- if (__is.fail())
- break;
- if (_Traits::eq(__c, __escape)) {
- __is >> __c;
- if (__is.fail())
- break;
- } else if (_Traits::eq(__c, __delim))
- break;
- __string.push_back(__c);
- }
+ if (!_Traits::eq(__c, __delim)) {
+ // no delimiter, read the whole string
+ __is.unget();
+ __is >> __string;
return __is;
+ }
+
+ __save_flags<_CharT, _Traits> __sf(__is);
+ std::noskipws(__is);
+ while (true) {
+ __is >> __c;
+ if (__is.fail())
+ break;
+ if (_Traits::eq(__c, __escape)) {
+ __is >> __c;
+ if (__is.fail())
+ break;
+ } else if (_Traits::eq(__c, __delim))
+ break;
+ __string.push_back(__c);
+ }
+ return __is;
}
template <class _CharT, class _Traits>
-struct _LIBCPP_HIDDEN __quoted_output_proxy
-{
- const _CharT *__first_;
- const _CharT *__last_;
- _CharT __delim_;
- _CharT __escape_;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __quoted_output_proxy(const _CharT *__f, const _CharT *__l, _CharT __d, _CharT __e)
- : __first_(__f), __last_(__l), __delim_(__d), __escape_(__e) {}
-
- template<class _T2, __enable_if_t<_IsSame<_Traits, void>::value || _IsSame<_Traits, _T2>::value>* = nullptr>
- friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _T2>&
- operator<<(basic_ostream<_CharT, _T2>& __os, const __quoted_output_proxy& __p) {
- return std::__quoted_output(__os, __p.__first_, __p.__last_, __p.__delim_, __p.__escape_);
- }
+struct _LIBCPP_HIDDEN __quoted_output_proxy {
+ const _CharT* __first_;
+ const _CharT* __last_;
+ _CharT __delim_;
+ _CharT __escape_;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __quoted_output_proxy(const _CharT* __f, const _CharT* __l, _CharT __d, _CharT __e)
+ : __first_(__f), __last_(__l), __delim_(__d), __escape_(__e) {}
+
+ template <class _T2, __enable_if_t<_IsSame<_Traits, void>::value || _IsSame<_Traits, _T2>::value>* = nullptr>
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _T2>&
+ operator<<(basic_ostream<_CharT, _T2>& __os, const __quoted_output_proxy& __p) {
+ return std::__quoted_output(__os, __p.__first_, __p.__last_, __p.__delim_, __p.__escape_);
+ }
};
template <class _CharT, class _Traits, class _Allocator>
-struct _LIBCPP_HIDDEN __quoted_proxy
-{
- basic_string<_CharT, _Traits, _Allocator>& __string_;
- _CharT __delim_;
- _CharT __escape_;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __quoted_proxy(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __d, _CharT __e)
- : __string_(__s), __delim_(__d), __escape_(__e) {}
-
- friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __quoted_proxy& __p) {
- return std::__quoted_output(__os, __p.__string_.data(), __p.__string_.data() + __p.__string_.size(), __p.__delim_, __p.__escape_);
- }
-
- friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __quoted_proxy& __p) {
- return std::__quoted_input(__is, __p.__string_, __p.__delim_, __p.__escape_);
- }
+struct _LIBCPP_HIDDEN __quoted_proxy {
+ basic_string<_CharT, _Traits, _Allocator>& __string_;
+ _CharT __delim_;
+ _CharT __escape_;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __quoted_proxy(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __d, _CharT __e)
+ : __string_(__s), __delim_(__d), __escape_(__e) {}
+
+ friend _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __quoted_proxy& __p) {
+ return std::__quoted_output(
+ __os, __p.__string_.data(), __p.__string_.data() + __p.__string_.size(), __p.__delim_, __p.__escape_);
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __quoted_proxy& __p) {
+ return std::__quoted_input(__is, __p.__string_, __p.__delim_, __p.__escape_);
+ }
};
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-__quoted_output_proxy<_CharT, _Traits>
-__quoted(const basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI __quoted_output_proxy<_CharT, _Traits>
+__quoted(const basic_string<_CharT, _Traits, _Allocator>& __s,
+ _CharT __delim = _CharT('"'),
+ _CharT __escape = _CharT('\\')) {
+ return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-__quoted_proxy<_CharT, _Traits, _Allocator>
-__quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI __quoted_proxy<_CharT, _Traits, _Allocator>
+__quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
}
#if _LIBCPP_STD_VER >= 14
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- const _CharT *__end = __s;
- while (*__end) ++__end;
- return __quoted_output_proxy<_CharT, void>(__s, __end, __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto quoted(const _CharT* __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ const _CharT* __end = __s;
+ while (*__end)
+ ++__end;
+ return __quoted_output_proxy<_CharT, void>(__s, __end, __delim, __escape);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(const basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto
+quoted(const basic_string<_CharT, _Traits, _Allocator>& __s,
+ _CharT __delim = _CharT('"'),
+ _CharT __escape = _CharT('\\')) {
+ return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto
+quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-auto quoted(basic_string_view<_CharT, _Traits> __sv, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\'))
-{
- return __quoted_output_proxy<_CharT, _Traits>(__sv.data(), __sv.data() + __sv.size(), __delim, __escape);
+_LIBCPP_HIDE_FROM_ABI auto
+quoted(basic_string_view<_CharT, _Traits> __sv, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
+ return __quoted_output_proxy<_CharT, _Traits>(__sv.data(), __sv.data() + __sv.size(), __delim, __escape);
}
#endif // _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/ios b/contrib/llvm-project/libcxx/include/ios
index 63abebcded3c..d36f5fb2ca28 100644
--- a/contrib/llvm-project/libcxx/include/ios
+++ b/contrib/llvm-project/libcxx/include/ios
@@ -214,7 +214,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__config>
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# error "The iostreams library is not supported since libc++ has been configured without support for localization."
+# error "The iostreams library is not supported since libc++ has been configured without support for localization."
#endif
#include <__assert> // all public C++ headers provide the assertion handler
@@ -246,609 +246,450 @@ _LIBCPP_BEGIN_NAMESPACE_STD
typedef ptrdiff_t streamsize;
-class _LIBCPP_EXPORTED_FROM_ABI ios_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI ios_base {
public:
- class _LIBCPP_EXPORTED_FROM_ABI failure;
-
- typedef unsigned int fmtflags;
- static const fmtflags boolalpha = 0x0001;
- static const fmtflags dec = 0x0002;
- static const fmtflags fixed = 0x0004;
- static const fmtflags hex = 0x0008;
- static const fmtflags internal = 0x0010;
- static const fmtflags left = 0x0020;
- static const fmtflags oct = 0x0040;
- static const fmtflags right = 0x0080;
- static const fmtflags scientific = 0x0100;
- static const fmtflags showbase = 0x0200;
- static const fmtflags showpoint = 0x0400;
- static const fmtflags showpos = 0x0800;
- static const fmtflags skipws = 0x1000;
- static const fmtflags unitbuf = 0x2000;
- static const fmtflags uppercase = 0x4000;
- static const fmtflags adjustfield = left | right | internal;
- static const fmtflags basefield = dec | oct | hex;
- static const fmtflags floatfield = scientific | fixed;
-
- typedef unsigned int iostate;
- static const iostate badbit = 0x1;
- static const iostate eofbit = 0x2;
- static const iostate failbit = 0x4;
- static const iostate goodbit = 0x0;
-
- typedef unsigned int openmode;
- static const openmode app = 0x01;
- static const openmode ate = 0x02;
- static const openmode binary = 0x04;
- static const openmode in = 0x08;
- static const openmode out = 0x10;
- static const openmode trunc = 0x20;
+ class _LIBCPP_EXPORTED_FROM_ABI failure;
+
+ typedef unsigned int fmtflags;
+ static const fmtflags boolalpha = 0x0001;
+ static const fmtflags dec = 0x0002;
+ static const fmtflags fixed = 0x0004;
+ static const fmtflags hex = 0x0008;
+ static const fmtflags internal = 0x0010;
+ static const fmtflags left = 0x0020;
+ static const fmtflags oct = 0x0040;
+ static const fmtflags right = 0x0080;
+ static const fmtflags scientific = 0x0100;
+ static const fmtflags showbase = 0x0200;
+ static const fmtflags showpoint = 0x0400;
+ static const fmtflags showpos = 0x0800;
+ static const fmtflags skipws = 0x1000;
+ static const fmtflags unitbuf = 0x2000;
+ static const fmtflags uppercase = 0x4000;
+ static const fmtflags adjustfield = left | right | internal;
+ static const fmtflags basefield = dec | oct | hex;
+ static const fmtflags floatfield = scientific | fixed;
+
+ typedef unsigned int iostate;
+ static const iostate badbit = 0x1;
+ static const iostate eofbit = 0x2;
+ static const iostate failbit = 0x4;
+ static const iostate goodbit = 0x0;
+
+ typedef unsigned int openmode;
+ static const openmode app = 0x01;
+ static const openmode ate = 0x02;
+ static const openmode binary = 0x04;
+ static const openmode in = 0x08;
+ static const openmode out = 0x10;
+ static const openmode trunc = 0x20;
#if _LIBCPP_STD_VER >= 23
- static const openmode noreplace = 0x40;
+ static const openmode noreplace = 0x40;
#endif
- enum seekdir {beg, cur, end};
+ enum seekdir { beg, cur, end };
#if _LIBCPP_STD_VER <= 14
- typedef iostate io_state;
- typedef openmode open_mode;
- typedef seekdir seek_dir;
+ typedef iostate io_state;
+ typedef openmode open_mode;
+ typedef seekdir seek_dir;
- typedef std::streamoff streamoff;
- typedef std::streampos streampos;
+ typedef std::streamoff streamoff;
+ typedef std::streampos streampos;
#endif
- class _LIBCPP_EXPORTED_FROM_ABI Init;
+ class _LIBCPP_EXPORTED_FROM_ABI Init;
- // 27.5.2.2 fmtflags state:
- _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
- _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
- _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
- _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
- _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
+ // 27.5.2.2 fmtflags state:
+ _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
+ _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
+ _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
+ _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
+ _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
- _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
- _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
- _LIBCPP_HIDE_FROM_ABI streamsize width() const;
- _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
+ _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
+ _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
+ _LIBCPP_HIDE_FROM_ABI streamsize width() const;
+ _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
- // 27.5.2.3 locales:
- locale imbue(const locale& __loc);
- locale getloc() const;
+ // 27.5.2.3 locales:
+ locale imbue(const locale& __loc);
+ locale getloc() const;
- // 27.5.2.5 storage:
- static int xalloc();
- long& iword(int __index);
- void*& pword(int __index);
+ // 27.5.2.5 storage:
+ static int xalloc();
+ long& iword(int __index);
+ void*& pword(int __index);
- // destructor
- virtual ~ios_base();
+ // destructor
+ virtual ~ios_base();
- // 27.5.2.6 callbacks;
- enum event { erase_event, imbue_event, copyfmt_event };
- typedef void (*event_callback)(event, ios_base&, int __index);
- void register_callback(event_callback __fn, int __index);
+ // 27.5.2.6 callbacks;
+ enum event { erase_event, imbue_event, copyfmt_event };
+ typedef void (*event_callback)(event, ios_base&, int __index);
+ void register_callback(event_callback __fn, int __index);
- ios_base(const ios_base&) = delete;
- ios_base& operator=(const ios_base&) = delete;
+ ios_base(const ios_base&) = delete;
+ ios_base& operator=(const ios_base&) = delete;
- static bool sync_with_stdio(bool __sync = true);
+ static bool sync_with_stdio(bool __sync = true);
- _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
- void clear(iostate __state = goodbit);
- _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state);
+ _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
+ void clear(iostate __state = goodbit);
+ _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state);
- _LIBCPP_HIDE_FROM_ABI bool good() const;
- _LIBCPP_HIDE_FROM_ABI bool eof() const;
- _LIBCPP_HIDE_FROM_ABI bool fail() const;
- _LIBCPP_HIDE_FROM_ABI bool bad() const;
+ _LIBCPP_HIDE_FROM_ABI bool good() const;
+ _LIBCPP_HIDE_FROM_ABI bool eof() const;
+ _LIBCPP_HIDE_FROM_ABI bool fail() const;
+ _LIBCPP_HIDE_FROM_ABI bool bad() const;
- _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
- _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate);
+ _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
+ _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate);
- void __set_badbit_and_consider_rethrow();
- void __set_failbit_and_consider_rethrow();
+ void __set_badbit_and_consider_rethrow();
+ void __set_failbit_and_consider_rethrow();
- _LIBCPP_HIDE_FROM_ABI
- void __setstate_nothrow(iostate __state)
- {
- if (__rdbuf_)
- __rdstate_ |= __state;
- else
- __rdstate_ |= __state | ios_base::badbit;
- }
+ _LIBCPP_HIDE_FROM_ABI void __setstate_nothrow(iostate __state) {
+ if (__rdbuf_)
+ __rdstate_ |= __state;
+ else
+ __rdstate_ |= __state | ios_base::badbit;
+ }
protected:
- _LIBCPP_HIDE_FROM_ABI
- ios_base() {// purposefully does no initialization
- }
-
- void init(void* __sb);
- _LIBCPP_HIDE_FROM_ABI void* rdbuf() const {return __rdbuf_;}
-
- _LIBCPP_HIDE_FROM_ABI
- void rdbuf(void* __sb)
- {
- __rdbuf_ = __sb;
- clear();
- }
-
- void __call_callbacks(event);
- void copyfmt(const ios_base&);
- void move(ios_base&);
- void swap(ios_base&) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- void set_rdbuf(void* __sb)
- {
- __rdbuf_ = __sb;
- }
+ _LIBCPP_HIDE_FROM_ABI ios_base() { // purposefully does no initialization
+ }
+
+ void init(void* __sb);
+ _LIBCPP_HIDE_FROM_ABI void* rdbuf() const { return __rdbuf_; }
+
+ _LIBCPP_HIDE_FROM_ABI void rdbuf(void* __sb) {
+ __rdbuf_ = __sb;
+ clear();
+ }
+
+ void __call_callbacks(event);
+ void copyfmt(const ios_base&);
+ void move(ios_base&);
+ void swap(ios_base&) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; }
private:
- // All data members must be scalars
- fmtflags __fmtflags_;
- streamsize __precision_;
- streamsize __width_;
- iostate __rdstate_;
- iostate __exceptions_;
- void* __rdbuf_;
- void* __loc_;
- event_callback* __fn_;
- int* __index_;
- size_t __event_size_;
- size_t __event_cap_;
+ // All data members must be scalars
+ fmtflags __fmtflags_;
+ streamsize __precision_;
+ streamsize __width_;
+ iostate __rdstate_;
+ iostate __exceptions_;
+ void* __rdbuf_;
+ void* __loc_;
+ event_callback* __fn_;
+ int* __index_;
+ size_t __event_size_;
+ size_t __event_cap_;
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
// enabled with clang.
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
- static atomic<int> __xindex_;
+ static atomic<int> __xindex_;
#else
- static int __xindex_;
+ static int __xindex_;
#endif
- long* __iarray_;
- size_t __iarray_size_;
- size_t __iarray_cap_;
- void** __parray_;
- size_t __parray_size_;
- size_t __parray_cap_;
+ long* __iarray_;
+ size_t __iarray_size_;
+ size_t __iarray_cap_;
+ void** __parray_;
+ size_t __parray_size_;
+ size_t __parray_cap_;
};
-//enum class io_errc
-_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
-{
- stream = 1
-};
+// enum class io_errc
+_LIBCPP_DECLARE_STRONG_ENUM(io_errc){stream = 1};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
template <>
-struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type { };
+struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type {};
#ifdef _LIBCPP_CXX03_LANG
template <>
-struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type { };
+struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type {};
#endif
_LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT;
-inline _LIBCPP_HIDE_FROM_ABI
-error_code
-make_error_code(io_errc __e) _NOEXCEPT
-{
- return error_code(static_cast<int>(__e), iostream_category());
+inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(io_errc __e) _NOEXCEPT {
+ return error_code(static_cast<int>(__e), iostream_category());
}
-inline _LIBCPP_HIDE_FROM_ABI
-error_condition
-make_error_condition(io_errc __e) _NOEXCEPT
-{
- return error_condition(static_cast<int>(__e), iostream_category());
+inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(io_errc __e) _NOEXCEPT {
+ return error_condition(static_cast<int>(__e), iostream_category());
}
-class _LIBCPP_EXPORTED_FROM_ABI ios_base::failure
- : public system_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI ios_base::failure : public system_error {
public:
- explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
- explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
- _LIBCPP_HIDE_FROM_ABI failure(const failure&) _NOEXCEPT = default;
- ~failure() _NOEXCEPT override;
+ explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
+ explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
+ _LIBCPP_HIDE_FROM_ABI failure(const failure&) _NOEXCEPT = default;
+ ~failure() _NOEXCEPT override;
};
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_failure(char const* __msg) {
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw ios_base::failure(__msg);
+ throw ios_base::failure(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init
-{
+class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init {
public:
- Init();
- ~Init();
+ Init();
+ ~Init();
};
// fmtflags
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::flags() const
-{
- return __fmtflags_;
-}
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags() const { return __fmtflags_; }
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::flags(fmtflags __fmtfl)
-{
- fmtflags __r = __fmtflags_;
- __fmtflags_ = __fmtfl;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags(fmtflags __fmtfl) {
+ fmtflags __r = __fmtflags_;
+ __fmtflags_ = __fmtfl;
+ return __r;
}
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::setf(fmtflags __fmtfl)
-{
- fmtflags __r = __fmtflags_;
- __fmtflags_ |= __fmtfl;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl) {
+ fmtflags __r = __fmtflags_;
+ __fmtflags_ |= __fmtfl;
+ return __r;
}
-inline _LIBCPP_HIDE_FROM_ABI
-void
-ios_base::unsetf(fmtflags __mask)
-{
- __fmtflags_ &= ~__mask;
-}
+inline _LIBCPP_HIDE_FROM_ABI void ios_base::unsetf(fmtflags __mask) { __fmtflags_ &= ~__mask; }
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::fmtflags
-ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
-{
- fmtflags __r = __fmtflags_;
- unsetf(__mask);
- __fmtflags_ |= __fmtfl & __mask;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl, fmtflags __mask) {
+ fmtflags __r = __fmtflags_;
+ unsetf(__mask);
+ __fmtflags_ |= __fmtfl & __mask;
+ return __r;
}
// precision
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::precision() const
-{
- return __precision_;
-}
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision() const { return __precision_; }
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::precision(streamsize __prec)
-{
- streamsize __r = __precision_;
- __precision_ = __prec;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision(streamsize __prec) {
+ streamsize __r = __precision_;
+ __precision_ = __prec;
+ return __r;
}
// width
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::width() const
-{
- return __width_;
-}
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width() const { return __width_; }
-inline _LIBCPP_HIDE_FROM_ABI
-streamsize
-ios_base::width(streamsize __wide)
-{
- streamsize __r = __width_;
- __width_ = __wide;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width(streamsize __wide) {
+ streamsize __r = __width_;
+ __width_ = __wide;
+ return __r;
}
// iostate
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::iostate
-ios_base::rdstate() const
-{
- return __rdstate_;
-}
+inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::rdstate() const { return __rdstate_; }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-ios_base::setstate(iostate __state)
-{
- clear(__rdstate_ | __state);
-}
+inline _LIBCPP_HIDE_FROM_ABI void ios_base::setstate(iostate __state) { clear(__rdstate_ | __state); }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::good() const
-{
- return __rdstate_ == 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::good() const { return __rdstate_ == 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::eof() const
-{
- return (__rdstate_ & eofbit) != 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::eof() const { return (__rdstate_ & eofbit) != 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::fail() const
-{
- return (__rdstate_ & (failbit | badbit)) != 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::fail() const { return (__rdstate_ & (failbit | badbit)) != 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-ios_base::bad() const
-{
- return (__rdstate_ & badbit) != 0;
-}
+inline _LIBCPP_HIDE_FROM_ABI bool ios_base::bad() const { return (__rdstate_ & badbit) != 0; }
-inline _LIBCPP_HIDE_FROM_ABI
-ios_base::iostate
-ios_base::exceptions() const
-{
- return __exceptions_;
-}
+inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::exceptions() const { return __exceptions_; }
-inline _LIBCPP_HIDE_FROM_ABI
-void
-ios_base::exceptions(iostate __iostate)
-{
- __exceptions_ = __iostate;
- clear(__rdstate_);
+inline _LIBCPP_HIDE_FROM_ABI void ios_base::exceptions(iostate __iostate) {
+ __exceptions_ = __iostate;
+ clear(__rdstate_);
}
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ios
- : public ios_base
-{
+class _LIBCPP_TEMPLATE_VIS basic_ios : public ios_base {
public:
- // types:
- typedef _CharT char_type;
- typedef _Traits traits_type;
+ // types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
#ifdef _LIBCPP_CXX03_LANG
- // Preserve the ability to compare with literal 0,
- // and implicitly convert to bool, but not implicitly convert to int.
- _LIBCPP_HIDE_FROM_ABI
- operator void*() const {return fail() ? nullptr : (void*)this;}
+ // Preserve the ability to compare with literal 0,
+ // and implicitly convert to bool, but not implicitly convert to int.
+ _LIBCPP_HIDE_FROM_ABI operator void*() const { return fail() ? nullptr : (void*)this; }
#else
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const {return !fail();}
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return !fail(); }
#endif
- _LIBCPP_HIDE_FROM_ABI bool operator!() const {return fail();}
- _LIBCPP_HIDE_FROM_ABI iostate rdstate() const {return ios_base::rdstate();}
- _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) {ios_base::clear(__state);}
- _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) {ios_base::setstate(__state);}
- _LIBCPP_HIDE_FROM_ABI bool good() const {return ios_base::good();}
- _LIBCPP_HIDE_FROM_ABI bool eof() const {return ios_base::eof();}
- _LIBCPP_HIDE_FROM_ABI bool fail() const {return ios_base::fail();}
- _LIBCPP_HIDE_FROM_ABI bool bad() const {return ios_base::bad();}
+ _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); }
+ _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); }
+ _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) { ios_base::clear(__state); }
+ _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) { ios_base::setstate(__state); }
+ _LIBCPP_HIDE_FROM_ABI bool good() const { return ios_base::good(); }
+ _LIBCPP_HIDE_FROM_ABI bool eof() const { return ios_base::eof(); }
+ _LIBCPP_HIDE_FROM_ABI bool fail() const { return ios_base::fail(); }
+ _LIBCPP_HIDE_FROM_ABI bool bad() const { return ios_base::bad(); }
- _LIBCPP_HIDE_FROM_ABI iostate exceptions() const {return ios_base::exceptions();}
- _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
+ _LIBCPP_HIDE_FROM_ABI iostate exceptions() const { return ios_base::exceptions(); }
+ _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) { ios_base::exceptions(__iostate); }
- // 27.5.4.1 Constructor/destructor:
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
- ~basic_ios() override;
+ // 27.5.4.1 Constructor/destructor:
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ios(basic_streambuf<char_type, traits_type>* __sb);
+ ~basic_ios() override;
- // 27.5.4.2 Members:
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<char_type, traits_type>* tie() const;
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
+ // 27.5.4.2 Members:
+ _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie() const;
+ _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
- _LIBCPP_HIDE_FROM_ABI
- basic_streambuf<char_type, traits_type>* rdbuf() const;
- _LIBCPP_HIDE_FROM_ABI
- basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+ _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf() const;
+ _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
- basic_ios& copyfmt(const basic_ios& __rhs);
+ basic_ios& copyfmt(const basic_ios& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- char_type fill() const;
- _LIBCPP_HIDE_FROM_ABI
- char_type fill(char_type __ch);
+ _LIBCPP_HIDE_FROM_ABI char_type fill() const;
+ _LIBCPP_HIDE_FROM_ABI char_type fill(char_type __ch);
- _LIBCPP_HIDE_FROM_ABI
- locale imbue(const locale& __loc);
+ _LIBCPP_HIDE_FROM_ABI locale imbue(const locale& __loc);
- _LIBCPP_HIDE_FROM_ABI
- char narrow(char_type __c, char __dfault) const;
- _LIBCPP_HIDE_FROM_ABI
- char_type widen(char __c) const;
+ _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const;
+ _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const;
protected:
- _LIBCPP_HIDE_FROM_ABI
- basic_ios() {// purposefully does no initialization
- }
- _LIBCPP_HIDE_FROM_ABI
- void init(basic_streambuf<char_type, traits_type>* __sb);
-
- _LIBCPP_HIDE_FROM_ABI
- void move(basic_ios& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- void move(basic_ios&& __rhs) {move(__rhs);}
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ios& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+ _LIBCPP_HIDE_FROM_ABI basic_ios() { // purposefully does no initialization
+ }
+ _LIBCPP_HIDE_FROM_ABI void init(basic_streambuf<char_type, traits_type>* __sb);
+
+ _LIBCPP_HIDE_FROM_ABI void move(basic_ios& __rhs);
+ _LIBCPP_HIDE_FROM_ABI void move(basic_ios&& __rhs) { move(__rhs); }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ios& __rhs) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
+
private:
- basic_ostream<char_type, traits_type>* __tie_;
- mutable int_type __fill_;
+ basic_ostream<char_type, traits_type>* __tie_;
+ mutable int_type __fill_;
};
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
-{
- init(__sb);
+inline _LIBCPP_HIDE_FROM_ABI basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type, traits_type>* __sb) {
+ init(__sb);
}
template <class _CharT, class _Traits>
-basic_ios<_CharT, _Traits>::~basic_ios()
-{
-}
+basic_ios<_CharT, _Traits>::~basic_ios() {}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
-{
- ios_base::init(__sb);
- __tie_ = nullptr;
- __fill_ = traits_type::eof();
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) {
+ ios_base::init(__sb);
+ __tie_ = nullptr;
+ __fill_ = traits_type::eof();
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::tie() const
-{
- return __tie_;
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>* basic_ios<_CharT, _Traits>::tie() const {
+ return __tie_;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
-{
- basic_ostream<char_type, traits_type>* __r = __tie_;
- __tie_ = __tiestr;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr) {
+ basic_ostream<char_type, traits_type>* __r = __tie_;
+ __tie_ = __tiestr;
+ return __r;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_streambuf<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::rdbuf() const
-{
- return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
+inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf() const {
+ return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_streambuf<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
-{
- basic_streambuf<char_type, traits_type>* __r = rdbuf();
- ios_base::rdbuf(__sb);
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
+ basic_streambuf<char_type, traits_type>* __r = rdbuf();
+ ios_base::rdbuf(__sb);
+ return __r;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-locale
-basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
-{
- locale __r = getloc();
- ios_base::imbue(__loc);
- if (rdbuf())
- rdbuf()->pubimbue(__loc);
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
+ locale __r = getloc();
+ ios_base::imbue(__loc);
+ if (rdbuf())
+ rdbuf()->pubimbue(__loc);
+ return __r;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-char
-basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
-{
- return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
+inline _LIBCPP_HIDE_FROM_ABI char basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const {
+ return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-basic_ios<_CharT, _Traits>::widen(char __c) const
-{
- return std::use_facet<ctype<char_type> >(getloc()).widen(__c);
+inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::widen(char __c) const {
+ return std::use_facet<ctype<char_type> >(getloc()).widen(__c);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-basic_ios<_CharT, _Traits>::fill() const
-{
- if (traits_type::eq_int_type(traits_type::eof(), __fill_))
- __fill_ = widen(' ');
- return __fill_;
+inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill() const {
+ if (traits_type::eq_int_type(traits_type::eof(), __fill_))
+ __fill_ = widen(' ');
+ return __fill_;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-_CharT
-basic_ios<_CharT, _Traits>::fill(char_type __ch)
-{
- if (traits_type::eq_int_type(traits_type::eof(), __fill_))
- __fill_ = widen(' ');
- char_type __r = __fill_;
- __fill_ = __ch;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill(char_type __ch) {
+ if (traits_type::eq_int_type(traits_type::eof(), __fill_))
+ __fill_ = widen(' ');
+ char_type __r = __fill_;
+ __fill_ = __ch;
+ return __r;
}
template <class _CharT, class _Traits>
-basic_ios<_CharT, _Traits>&
-basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
-{
- if (this != &__rhs)
- {
- __call_callbacks(erase_event);
- ios_base::copyfmt(__rhs);
- __tie_ = __rhs.__tie_;
- __fill_ = __rhs.__fill_;
- __call_callbacks(copyfmt_event);
- exceptions(__rhs.exceptions());
- }
- return *this;
+basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) {
+ if (this != &__rhs) {
+ __call_callbacks(erase_event);
+ ios_base::copyfmt(__rhs);
+ __tie_ = __rhs.__tie_;
+ __fill_ = __rhs.__fill_;
+ __call_callbacks(copyfmt_event);
+ exceptions(__rhs.exceptions());
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
-{
- ios_base::move(__rhs);
- __tie_ = __rhs.__tie_;
- __rhs.__tie_ = nullptr;
- __fill_ = __rhs.__fill_;
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) {
+ ios_base::move(__rhs);
+ __tie_ = __rhs.__tie_;
+ __rhs.__tie_ = nullptr;
+ __fill_ = __rhs.__fill_;
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
-{
- ios_base::swap(__rhs);
- std::swap(__tie_, __rhs.__tie_);
- std::swap(__fill_, __rhs.__fill_);
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT {
+ ios_base::swap(__rhs);
+ std::swap(__tie_, __rhs.__tie_);
+ std::swap(__fill_, __rhs.__fill_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
-{
- ios_base::set_rdbuf(__sb);
+inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
+ ios_base::set_rdbuf(__sb);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
@@ -857,196 +698,124 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>;
#endif
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-boolalpha(ios_base& __str)
-{
- __str.setf(ios_base::boolalpha);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& boolalpha(ios_base& __str) {
+ __str.setf(ios_base::boolalpha);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noboolalpha(ios_base& __str)
-{
- __str.unsetf(ios_base::boolalpha);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noboolalpha(ios_base& __str) {
+ __str.unsetf(ios_base::boolalpha);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-showbase(ios_base& __str)
-{
- __str.setf(ios_base::showbase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& showbase(ios_base& __str) {
+ __str.setf(ios_base::showbase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noshowbase(ios_base& __str)
-{
- __str.unsetf(ios_base::showbase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noshowbase(ios_base& __str) {
+ __str.unsetf(ios_base::showbase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-showpoint(ios_base& __str)
-{
- __str.setf(ios_base::showpoint);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& showpoint(ios_base& __str) {
+ __str.setf(ios_base::showpoint);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noshowpoint(ios_base& __str)
-{
- __str.unsetf(ios_base::showpoint);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpoint(ios_base& __str) {
+ __str.unsetf(ios_base::showpoint);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-showpos(ios_base& __str)
-{
- __str.setf(ios_base::showpos);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& showpos(ios_base& __str) {
+ __str.setf(ios_base::showpos);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noshowpos(ios_base& __str)
-{
- __str.unsetf(ios_base::showpos);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpos(ios_base& __str) {
+ __str.unsetf(ios_base::showpos);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-skipws(ios_base& __str)
-{
- __str.setf(ios_base::skipws);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& skipws(ios_base& __str) {
+ __str.setf(ios_base::skipws);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-noskipws(ios_base& __str)
-{
- __str.unsetf(ios_base::skipws);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& noskipws(ios_base& __str) {
+ __str.unsetf(ios_base::skipws);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-uppercase(ios_base& __str)
-{
- __str.setf(ios_base::uppercase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& uppercase(ios_base& __str) {
+ __str.setf(ios_base::uppercase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-nouppercase(ios_base& __str)
-{
- __str.unsetf(ios_base::uppercase);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& nouppercase(ios_base& __str) {
+ __str.unsetf(ios_base::uppercase);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-unitbuf(ios_base& __str)
-{
- __str.setf(ios_base::unitbuf);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& unitbuf(ios_base& __str) {
+ __str.setf(ios_base::unitbuf);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-nounitbuf(ios_base& __str)
-{
- __str.unsetf(ios_base::unitbuf);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& nounitbuf(ios_base& __str) {
+ __str.unsetf(ios_base::unitbuf);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-internal(ios_base& __str)
-{
- __str.setf(ios_base::internal, ios_base::adjustfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& internal(ios_base& __str) {
+ __str.setf(ios_base::internal, ios_base::adjustfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-left(ios_base& __str)
-{
- __str.setf(ios_base::left, ios_base::adjustfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& left(ios_base& __str) {
+ __str.setf(ios_base::left, ios_base::adjustfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-right(ios_base& __str)
-{
- __str.setf(ios_base::right, ios_base::adjustfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& right(ios_base& __str) {
+ __str.setf(ios_base::right, ios_base::adjustfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-dec(ios_base& __str)
-{
- __str.setf(ios_base::dec, ios_base::basefield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& dec(ios_base& __str) {
+ __str.setf(ios_base::dec, ios_base::basefield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-hex(ios_base& __str)
-{
- __str.setf(ios_base::hex, ios_base::basefield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& hex(ios_base& __str) {
+ __str.setf(ios_base::hex, ios_base::basefield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-oct(ios_base& __str)
-{
- __str.setf(ios_base::oct, ios_base::basefield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& oct(ios_base& __str) {
+ __str.setf(ios_base::oct, ios_base::basefield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-fixed(ios_base& __str)
-{
- __str.setf(ios_base::fixed, ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& fixed(ios_base& __str) {
+ __str.setf(ios_base::fixed, ios_base::floatfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-scientific(ios_base& __str)
-{
- __str.setf(ios_base::scientific, ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& scientific(ios_base& __str) {
+ __str.setf(ios_base::scientific, ios_base::floatfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-hexfloat(ios_base& __str)
-{
- __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& hexfloat(ios_base& __str) {
+ __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
+ return __str;
}
-_LIBCPP_HIDE_FROM_ABI inline
-ios_base&
-defaultfloat(ios_base& __str)
-{
- __str.unsetf(ios_base::floatfield);
- return __str;
+_LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) {
+ __str.unsetf(ios_base::floatfield);
+ return __str;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/iosfwd b/contrib/llvm-project/libcxx/include/iosfwd
index 48fe28e896d8..e28998d00415 100644
--- a/contrib/llvm-project/libcxx/include/iosfwd
+++ b/contrib/llvm-project/libcxx/include/iosfwd
@@ -127,38 +127,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_EXPORTED_FROM_ABI ios_base;
template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
+class _LIBCPP_TEMPLATE_VIS istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
+class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
-template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
-typedef fpos<mbstate_t> streampos;
+template <class _State>
+class _LIBCPP_TEMPLATE_VIS fpos;
+typedef fpos<mbstate_t> streampos;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef fpos<mbstate_t> wstreampos;
+typedef fpos<mbstate_t> wstreampos;
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
-typedef fpos<mbstate_t> u8streampos;
+typedef fpos<mbstate_t> u8streampos;
#endif
-typedef fpos<mbstate_t> u16streampos;
-typedef fpos<mbstate_t> u32streampos;
+typedef fpos<mbstate_t> u16streampos;
+typedef fpos<mbstate_t> u32streampos;
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class basic_syncbuf;
-using syncbuf = basic_syncbuf<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+using syncbuf = basic_syncbuf<char>;
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wsyncbuf = basic_syncbuf<wchar_t>;
-#endif
+# endif
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class basic_osyncstream;
-using osyncstream = basic_osyncstream<char>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+using osyncstream = basic_osyncstream<char>;
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wosyncstream = basic_osyncstream<wchar_t>;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >=20
@@ -167,30 +168,24 @@ template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TEMPLATE_VIS vector;
template <class _CharT, class _Traits>
-class __save_flags
-{
- typedef basic_ios<_CharT, _Traits> __stream_type;
- typedef typename __stream_type::fmtflags fmtflags;
+class __save_flags {
+ typedef basic_ios<_CharT, _Traits> __stream_type;
+ typedef typename __stream_type::fmtflags fmtflags;
+
+ __stream_type& __stream_;
+ fmtflags __fmtflags_;
+ _CharT __fill_;
- __stream_type& __stream_;
- fmtflags __fmtflags_;
- _CharT __fill_;
+ __save_flags(const __save_flags&);
+ __save_flags& operator=(const __save_flags&);
- __save_flags(const __save_flags&);
- __save_flags& operator=(const __save_flags&);
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __save_flags(__stream_type& __stream)
- : __stream_(__stream),
- __fmtflags_(__stream.flags()),
- __fill_(__stream.fill())
- {}
- _LIBCPP_HIDE_FROM_ABI
- ~__save_flags()
- {
- __stream_.flags(__fmtflags_);
- __stream_.fill(__fill_);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream)
+ : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}
+ _LIBCPP_HIDE_FROM_ABI ~__save_flags() {
+ __stream_.flags(__fmtflags_);
+ __stream_.fill(__fill_);
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/istream b/contrib/llvm-project/libcxx/include/istream
index 0351257c7df8..1c7fb992dff4 100644
--- a/contrib/llvm-project/libcxx/include/istream
+++ b/contrib/llvm-project/libcxx/include/istream
@@ -177,1464 +177,1177 @@ template <class Stream, class T>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_istream
- : virtual public basic_ios<_CharT, _Traits>
-{
- streamsize __gc_;
+class _LIBCPP_TEMPLATE_VIS basic_istream : virtual public basic_ios<_CharT, _Traits> {
+ streamsize __gc_;
+
+ _LIBCPP_HIDE_FROM_ABI void __inc_gcount() {
+ if (__gc_ < numeric_limits<streamsize>::max())
+ ++__gc_;
+ }
- _LIBCPP_HIDE_FROM_ABI void __inc_gcount() {
- if (__gc_ < numeric_limits<streamsize>::max())
- ++__gc_;
- }
public:
- // types (inherited from basic_ios (27.5.4)):
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ // types (inherited from basic_ios (27.5.4)):
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // 27.7.1.1.1 Constructor/destructor:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb)
+ : __gc_(0) {
+ this->init(__sb);
+ }
+ ~basic_istream() override;
- // 27.7.1.1.1 Constructor/destructor:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb) : __gc_(0)
- { this->init(__sb); }
- ~basic_istream() override;
protected:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_istream(basic_istream&& __rhs);
+ inline _LIBCPP_HIDE_FROM_ABI basic_istream(basic_istream&& __rhs);
- // 27.7.1.1.2 Assign/swap:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_istream& operator=(basic_istream&& __rhs);
+ // 27.7.1.1.2 Assign/swap:
+ inline _LIBCPP_HIDE_FROM_ABI basic_istream& operator=(basic_istream&& __rhs);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void swap(basic_istream& __rhs) {
- std::swap(__gc_, __rhs.__gc_);
- basic_ios<char_type, traits_type>::swap(__rhs);
- }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_istream& __rhs) {
+ std::swap(__gc_, __rhs.__gc_);
+ basic_ios<char_type, traits_type>::swap(__rhs);
+ }
- basic_istream (const basic_istream& __rhs) = delete;
- basic_istream& operator=(const basic_istream& __rhs) = delete;
-public:
+ basic_istream(const basic_istream& __rhs) = delete;
+ basic_istream& operator=(const basic_istream& __rhs) = delete;
- // 27.7.1.1.3 Prefix/suffix:
- class _LIBCPP_TEMPLATE_VIS sentry;
-
- // 27.7.1.2 Formatted input:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&))
- { return __pf(*this); }
+public:
+ // 27.7.1.1.3 Prefix/suffix:
+ class _LIBCPP_TEMPLATE_VIS sentry;
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& operator>>(basic_ios<char_type, traits_type>&
- (*__pf)(basic_ios<char_type, traits_type>&))
- { __pf(*this); return *this; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& operator>>(ios_base& (*__pf)(ios_base&))
- { __pf(*this); return *this; }
-
- basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
- basic_istream& operator>>(bool& __n);
- basic_istream& operator>>(short& __n);
- basic_istream& operator>>(unsigned short& __n);
- basic_istream& operator>>(int& __n);
- basic_istream& operator>>(unsigned int& __n);
- basic_istream& operator>>(long& __n);
- basic_istream& operator>>(unsigned long& __n);
- basic_istream& operator>>(long long& __n);
- basic_istream& operator>>(unsigned long long& __n);
- basic_istream& operator>>(float& __f);
- basic_istream& operator>>(double& __f);
- basic_istream& operator>>(long double& __f);
- basic_istream& operator>>(void*& __p);
+ // 27.7.1.2 Formatted input:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)) {
+ return __pf(*this);
+ }
- // 27.7.1.3 Unformatted input:
- _LIBCPP_HIDE_FROM_ABI
- streamsize gcount() const {return __gc_;}
- int_type get();
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream&
+ operator>>(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) {
+ __pf(*this);
+ return *this;
+ }
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& get(char_type& __c) {
- int_type __ch = get();
- if (__ch != traits_type::eof())
- __c = traits_type::to_char_type(__ch);
- return *this;
- }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& operator>>(ios_base& (*__pf)(ios_base&)) {
+ __pf(*this);
+ return *this;
+ }
+
+ basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb);
+ basic_istream& operator>>(bool& __n);
+ basic_istream& operator>>(short& __n);
+ basic_istream& operator>>(unsigned short& __n);
+ basic_istream& operator>>(int& __n);
+ basic_istream& operator>>(unsigned int& __n);
+ basic_istream& operator>>(long& __n);
+ basic_istream& operator>>(unsigned long& __n);
+ basic_istream& operator>>(long long& __n);
+ basic_istream& operator>>(unsigned long long& __n);
+ basic_istream& operator>>(float& __f);
+ basic_istream& operator>>(double& __f);
+ basic_istream& operator>>(long double& __f);
+ basic_istream& operator>>(void*& __p);
+
+ // 27.7.1.3 Unformatted input:
+ _LIBCPP_HIDE_FROM_ABI streamsize gcount() const { return __gc_; }
+ int_type get();
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(char_type& __c) {
+ int_type __ch = get();
+ if (__ch != traits_type::eof())
+ __c = traits_type::to_char_type(__ch);
+ return *this;
+ }
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& get(char_type* __s, streamsize __n)
- { return get(__s, __n, this->widen('\n')); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(char_type* __s, streamsize __n) {
+ return get(__s, __n, this->widen('\n'));
+ }
- basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
+ basic_istream& get(char_type* __s, streamsize __n, char_type __dlm);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& get(basic_streambuf<char_type, traits_type>& __sb)
- { return get(__sb, this->widen('\n')); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& get(basic_streambuf<char_type, traits_type>& __sb) {
+ return get(__sb, this->widen('\n'));
+ }
- basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
+ basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_istream& getline(char_type* __s, streamsize __n)
- { return getline(__s, __n, this->widen('\n')); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_istream& getline(char_type* __s, streamsize __n) {
+ return getline(__s, __n, this->widen('\n'));
+ }
- basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
+ basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm);
- basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
- int_type peek();
- basic_istream& read (char_type* __s, streamsize __n);
- streamsize readsome(char_type* __s, streamsize __n);
+ basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof());
+ int_type peek();
+ basic_istream& read(char_type* __s, streamsize __n);
+ streamsize readsome(char_type* __s, streamsize __n);
- basic_istream& putback(char_type __c);
- basic_istream& unget();
- int sync();
+ basic_istream& putback(char_type __c);
+ basic_istream& unget();
+ int sync();
- pos_type tellg();
- basic_istream& seekg(pos_type __pos);
- basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
+ pos_type tellg();
+ basic_istream& seekg(pos_type __pos);
+ basic_istream& seekg(off_type __off, ios_base::seekdir __dir);
};
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry
-{
- bool __ok_;
+class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry {
+ bool __ok_;
public:
- explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
-// ~sentry() = default;
+ explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
+ // ~sentry() = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const {return __ok_;}
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ok_; }
- sentry(const sentry&) = delete;
- sentry& operator=(const sentry&) = delete;
+ sentry(const sentry&) = delete;
+ sentry& operator=(const sentry&) = delete;
};
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is,
- bool __noskipws)
- : __ok_(false)
-{
- if (__is.good())
- {
- if (__is.tie())
- __is.tie()->flush();
- if (!__noskipws && (__is.flags() & ios_base::skipws))
- {
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- _Ip __i(__is);
- _Ip __eof;
- for (; __i != __eof; ++__i)
- if (!__ct.is(__ct.space, *__i))
- break;
- if (__i == __eof)
- __is.setstate(ios_base::failbit | ios_base::eofbit);
- }
- __ok_ = __is.good();
+basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws) : __ok_(false) {
+ if (__is.good()) {
+ if (__is.tie())
+ __is.tie()->flush();
+ if (!__noskipws && (__is.flags() & ios_base::skipws)) {
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ _Ip __i(__is);
+ _Ip __eof;
+ for (; __i != __eof; ++__i)
+ if (!__ct.is(__ct.space, *__i))
+ break;
+ if (__i == __eof)
+ __is.setstate(ios_base::failbit | ios_base::eofbit);
}
- else
- __is.setstate(ios_base::failbit);
+ __ok_ = __is.good();
+ } else
+ __is.setstate(ios_base::failbit);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
- : __gc_(__rhs.__gc_)
-{
- __rhs.__gc_ = 0;
- this->move(__rhs);
+basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) : __gc_(__rhs.__gc_) {
+ __rhs.__gc_ = 0;
+ this->move(__rhs);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
-{
- swap(__rhs);
- return *this;
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) {
+ swap(__rhs);
+ return *this;
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>::~basic_istream()
-{
-}
+basic_istream<_CharT, _Traits>::~basic_istream() {}
template <class _Tp, class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
__input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef num_get<_CharT, _Ip> _Fp;
- std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef num_get<_CharT, _Ip> _Fp;
+ std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
-{
- return std::__input_arithmetic<unsigned short>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n) {
+ return std::__input_arithmetic<unsigned short>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
-{
- return std::__input_arithmetic<unsigned int>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n) {
+ return std::__input_arithmetic<unsigned int>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(long& __n)
-{
- return std::__input_arithmetic<long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long& __n) {
+ return std::__input_arithmetic<long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
-{
- return std::__input_arithmetic<unsigned long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n) {
+ return std::__input_arithmetic<unsigned long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(long long& __n)
-{
- return std::__input_arithmetic<long long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long long& __n) {
+ return std::__input_arithmetic<long long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
-{
- return std::__input_arithmetic<unsigned long long>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n) {
+ return std::__input_arithmetic<unsigned long long>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(float& __n)
-{
- return std::__input_arithmetic<float>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(float& __n) {
+ return std::__input_arithmetic<float>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(double& __n)
-{
- return std::__input_arithmetic<double>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(double& __n) {
+ return std::__input_arithmetic<double>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(long double& __n)
-{
- return std::__input_arithmetic<long double>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long double& __n) {
+ return std::__input_arithmetic<long double>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(bool& __n)
-{
- return std::__input_arithmetic<bool>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(bool& __n) {
+ return std::__input_arithmetic<bool>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(void*& __n)
-{
- return std::__input_arithmetic<void*>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(void*& __n) {
+ return std::__input_arithmetic<void*>(*this, __n);
}
template <class _Tp, class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
__input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __s(__is);
- if (__s)
- {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __s(__is);
+ if (__s) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef num_get<_CharT, _Ip> _Fp;
- long __temp;
- std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
- if (__temp < numeric_limits<_Tp>::min())
- {
- __state |= ios_base::failbit;
- __n = numeric_limits<_Tp>::min();
- }
- else if (__temp > numeric_limits<_Tp>::max())
- {
- __state |= ios_base::failbit;
- __n = numeric_limits<_Tp>::max();
- }
- else
- {
- __n = static_cast<_Tp>(__temp);
- }
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef num_get<_CharT, _Ip> _Fp;
+ long __temp;
+ std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
+ if (__temp < numeric_limits<_Tp>::min()) {
+ __state |= ios_base::failbit;
+ __n = numeric_limits<_Tp>::min();
+ } else if (__temp > numeric_limits<_Tp>::max()) {
+ __state |= ios_base::failbit;
+ __n = numeric_limits<_Tp>::max();
+ } else {
+ __n = static_cast<_Tp>(__temp);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __is.setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __is.setstate(__state);
+ }
+ return __is;
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(short& __n)
-{
- return std::__input_arithmetic_with_numeric_limits<short>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(short& __n) {
+ return std::__input_arithmetic_with_numeric_limits<short>(*this, __n);
}
template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(int& __n)
-{
- return std::__input_arithmetic_with_numeric_limits<int>(*this, __n);
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(int& __n) {
+ return std::__input_arithmetic_with_numeric_limits<int>(*this, __n);
}
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- _CharT* __s = __p;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- while (__s != __p + (__n-1))
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- _CharT __ch = _Traits::to_char_type(__i);
- if (__ct.is(__ct.space, __ch))
- break;
- *__s++ = __ch;
- __is.rdbuf()->sbumpc();
- }
- *__s = _CharT();
- __is.width(0);
- if (__s == __p)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ _CharT* __s = __p;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ while (__s != __p + (__n - 1)) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (__ct.is(__ct.space, __ch))
+ break;
+ *__s++ = __ch;
+ __is.rdbuf()->sbumpc();
+ }
+ *__s = _CharT();
+ __is.width(0);
+ if (__s == __p)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
#if _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits, size_t _Np>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np])
-{
- size_t __n = _Np;
- if (__is.width() > 0)
- __n = std::min(size_t(__is.width()), _Np);
- return std::__input_c_string(__is, __buf, __n);
+template <class _CharT, class _Traits, size_t _Np>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np]) {
+ size_t __n = _Np;
+ if (__is.width() > 0)
+ __n = std::min(size_t(__is.width()), _Np);
+ return std::__input_c_string(__is, __buf, __n);
}
-template<class _Traits, size_t _Np>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, unsigned char (&__buf)[_Np])
-{
- return __is >> (char(&)[_Np])__buf;
+template <class _Traits, size_t _Np>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char (&__buf)[_Np]) {
+ return __is >> (char(&)[_Np])__buf;
}
-template<class _Traits, size_t _Np>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, signed char (&__buf)[_Np])
-{
- return __is >> (char(&)[_Np])__buf;
+template <class _Traits, size_t _Np>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char (&__buf)[_Np]) {
+ return __is >> (char(&)[_Np])__buf;
}
#else
-template<class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
-{
- streamsize __n = __is.width();
- if (__n <= 0)
- __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
- return std::__input_c_string(__is, __s, size_t(__n));
+template <class _CharT, class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s) {
+ streamsize __n = __is.width();
+ if (__n <= 0)
+ __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
+ return std::__input_c_string(__is, __s, size_t(__n));
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
-{
- return __is >> (char*)__s;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s) {
+ return __is >> (char*)__s;
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
-{
- return __is >> (char*)__s;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char* __s) {
+ return __is >> (char*)__s;
}
#endif // _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- __state |= ios_base::eofbit | ios_base::failbit;
- else
- __c = _Traits::to_char_type(__i);
+ typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
+ if (_Traits::eq_int_type(__i, _Traits::eof()))
+ __state |= ios_base::eofbit | ios_base::failbit;
+ else
+ __c = _Traits::to_char_type(__i);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
-{
- return __is >> (char&)__c;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c) {
+ return __is >> (char&)__c;
}
-template<class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<char, _Traits>&
-operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
-{
- return __is >> (char&)__c;
+template <class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<char, _Traits>&
+operator>>(basic_istream<char, _Traits>& __is, signed char& __c) {
+ return __is >> (char&)__c;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __s(*this, true);
- if (__s)
- {
- if (__sb)
- {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- if (traits_type::eq_int_type(
- __sb->sputc(traits_type::to_char_type(__i)),
- traits_type::eof()))
- break;
- __inc_gcount();
- this->rdbuf()->sbumpc();
- }
- if (__gc_ == 0)
- __state |= ios_base::failbit;
+basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __s(*this, true);
+ if (__s) {
+ if (__sb) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- if (__gc_ == 0)
- __state |= ios_base::failbit;
-
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ if (traits_type::eq_int_type(__sb->sputc(traits_type::to_char_type(__i)), traits_type::eof()))
+ break;
+ __inc_gcount();
+ this->rdbuf()->sbumpc();
}
- else
- {
- __state |= ios_base::failbit;
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit) {
+ throw;
}
- this->setstate(__state);
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
}
- return *this;
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
-typename basic_istream<_CharT, _Traits>::int_type
-basic_istream<_CharT, _Traits>::get()
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- int_type __r = traits_type::eof();
- sentry __s(*this, true);
- if (__s)
- {
+template <class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::get() {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ int_type __r = traits_type::eof();
+ sentry __s(*this, true);
+ if (__s) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- __r = this->rdbuf()->sbumpc();
- if (traits_type::eq_int_type(__r, traits_type::eof()))
- __state |= ios_base::failbit | ios_base::eofbit;
- else
- __gc_ = 1;
+ __r = this->rdbuf()->sbumpc();
+ if (traits_type::eq_int_type(__r, traits_type::eof()))
+ __state |= ios_base::failbit | ios_base::eofbit;
+ else
+ __gc_ = 1;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- this->setstate(__state);
+ } catch (...) {
+ this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
- if (__n > 0)
- {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif
- while (__gc_ < __n-1)
- {
- int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
- break;
- *__s++ = __ch;
- __inc_gcount();
- this->rdbuf()->sbumpc();
- }
- if (__gc_ == 0)
- __state |= ios_base::failbit;
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
+ if (__n > 0) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- if (__n > 0)
- *__s = char_type();
- throw;
- }
- }
+ try {
#endif
+ while (__gc_ < __n - 1) {
+ int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ char_type __ch = traits_type::to_char_type(__i);
+ if (traits_type::eq(__ch, __dlm))
+ break;
+ *__s++ = __ch;
+ __inc_gcount();
+ this->rdbuf()->sbumpc();
}
- else
- {
- __state |= ios_base::failbit;
- }
-
- if (__n > 0)
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ if (__n > 0)
*__s = char_type();
- this->setstate(__state);
+ throw;
+ }
+ }
+#endif
+ } else {
+ __state |= ios_base::failbit;
}
+
if (__n > 0)
- *__s = char_type();
- return *this;
+ *__s = char_type();
+ this->setstate(__state);
+ }
+ if (__n > 0)
+ *__s = char_type();
+ return *this;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
- char_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
- break;
- if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
- break;
- __inc_gcount();
- this->rdbuf()->sbumpc();
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- // according to the spec, exceptions here are caught but not rethrown
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__gc_ == 0)
- __state |= ios_base::failbit;
- this->setstate(__state);
+ char_type __ch = traits_type::to_char_type(__i);
+ if (traits_type::eq(__ch, __dlm))
+ break;
+ if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
+ break;
+ __inc_gcount();
+ this->rdbuf()->sbumpc();
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ // according to the spec, exceptions here are caught but not rethrown
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
- {
- this->rdbuf()->sbumpc();
- __inc_gcount();
- break;
- }
- if (__gc_ >= __n-1)
- {
- __state |= ios_base::failbit;
- break;
- }
- *__s++ = __ch;
- this->rdbuf()->sbumpc();
- __inc_gcount();
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- if (__n > 0)
- *__s = char_type();
- if (__gc_ == 0)
- __state |= ios_base::failbit;
- throw;
- }
+ char_type __ch = traits_type::to_char_type(__i);
+ if (traits_type::eq(__ch, __dlm)) {
+ this->rdbuf()->sbumpc();
+ __inc_gcount();
+ break;
}
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__gc_ >= __n - 1) {
+ __state |= ios_base::failbit;
+ break;
+ }
+ *__s++ = __ch;
+ this->rdbuf()->sbumpc();
+ __inc_gcount();
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ if (__n > 0)
+ *__s = char_type();
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+ throw;
+ }
}
- if (__n > 0)
- *__s = char_type();
- if (__gc_ == 0)
- __state |= ios_base::failbit;
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+ if (__n > 0)
+ *__s = char_type();
+ if (__gc_ == 0)
+ __state |= ios_base::failbit;
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__n == numeric_limits<streamsize>::max())
- {
- while (true)
- {
- typename traits_type::int_type __i = this->rdbuf()->sbumpc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- __inc_gcount();
- if (traits_type::eq_int_type(__i, __dlm))
- break;
- }
- }
- else
- {
- while (__gc_ < __n)
- {
- typename traits_type::int_type __i = this->rdbuf()->sbumpc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- __inc_gcount();
- if (traits_type::eq_int_type(__i, __dlm))
- break;
- }
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__n == numeric_limits<streamsize>::max()) {
+ while (true) {
+ typename traits_type::int_type __i = this->rdbuf()->sbumpc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ __inc_gcount();
+ if (traits_type::eq_int_type(__i, __dlm))
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
+ } else {
+ while (__gc_ < __n) {
+ typename traits_type::int_type __i = this->rdbuf()->sbumpc();
+ if (traits_type::eq_int_type(__i, traits_type::eof())) {
+ __state |= ios_base::eofbit;
+ break;
+ }
+ __inc_gcount();
+ if (traits_type::eq_int_type(__i, __dlm))
+ break;
}
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
-typename basic_istream<_CharT, _Traits>::int_type
-basic_istream<_CharT, _Traits>::peek()
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- int_type __r = traits_type::eof();
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::peek() {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ int_type __r = traits_type::eof();
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __r = this->rdbuf()->sgetc();
- if (traits_type::eq_int_type(__r, traits_type::eof()))
- __state |= ios_base::eofbit;
+ __r = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__r, traits_type::eof()))
+ __state |= ios_base::eofbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __gc_ = this->rdbuf()->sgetn(__s, __n);
- if (__gc_ != __n)
- __state |= ios_base::failbit | ios_base::eofbit;
+ __gc_ = this->rdbuf()->sgetn(__s, __n);
+ if (__gc_ != __n)
+ __state |= ios_base::failbit | ios_base::eofbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-streamsize
-basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
-{
- ios_base::iostate __state = ios_base::goodbit;
- __gc_ = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) {
+ ios_base::iostate __state = ios_base::goodbit;
+ __gc_ = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- streamsize __c = this->rdbuf()->in_avail();
- switch (__c)
- {
- case -1:
- __state |= ios_base::eofbit;
- break;
- case 0:
- break;
- default:
- __n = std::min(__c, __n);
- __gc_ = this->rdbuf()->sgetn(__s, __n);
- if (__gc_ != __n)
- __state |= ios_base::failbit | ios_base::eofbit;
- break;
- }
+ streamsize __c = this->rdbuf()->in_avail();
+ switch (__c) {
+ case -1:
+ __state |= ios_base::eofbit;
+ break;
+ case 0:
+ break;
+ default:
+ __n = std::min(__c, __n);
+ __gc_ = this->rdbuf()->sgetn(__s, __n);
+ if (__gc_ != __n)
+ __state |= ios_base::failbit | ios_base::eofbit;
+ break;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return __gc_;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return __gc_;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::putback(char_type __c)
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- __gc_ = 0;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_type __c) {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ __gc_ = 0;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof())
- __state |= ios_base::badbit;
+ if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof())
+ __state |= ios_base::badbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::unget()
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- __gc_ = 0;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ __gc_ = 0;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof())
- __state |= ios_base::badbit;
+ if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof())
+ __state |= ios_base::badbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- else
- {
- __state |= ios_base::failbit;
- }
- this->setstate(__state);
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else {
+ __state |= ios_base::failbit;
+ }
+ this->setstate(__state);
+ return *this;
}
-template<class _CharT, class _Traits>
-int
-basic_istream<_CharT, _Traits>::sync()
-{
- ios_base::iostate __state = ios_base::goodbit;
- int __r = 0;
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+int basic_istream<_CharT, _Traits>::sync() {
+ ios_base::iostate __state = ios_base::goodbit;
+ int __r = 0;
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf() == nullptr)
- return -1;
- if (this->rdbuf()->pubsync() == -1)
- {
- __state |= ios_base::badbit;
- return -1;
- }
+ if (this->rdbuf() == nullptr)
+ return -1;
+ if (this->rdbuf()->pubsync() == -1) {
+ __state |= ios_base::badbit;
+ return -1;
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-typename basic_istream<_CharT, _Traits>::pos_type
-basic_istream<_CharT, _Traits>::tellg()
-{
- ios_base::iostate __state = ios_base::goodbit;
- pos_type __r(-1);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>::tellg() {
+ ios_base::iostate __state = ios_base::goodbit;
+ pos_type __r(-1);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
+ __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return __r;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
- __state |= ios_base::failbit;
+ if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
+ __state |= ios_base::failbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return *this;
}
-template<class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
-{
- ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
- this->clear(__state);
- sentry __sen(*this, true);
- if (__sen)
- {
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) {
+ ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
+ this->clear(__state);
+ sentry __sen(*this, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
- __state |= ios_base::failbit;
+ if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
+ __state |= ios_base::failbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- this->__setstate_nothrow(__state);
- if (this->exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- this->setstate(__state);
+ } catch (...) {
+ __state |= ios_base::badbit;
+ this->__setstate_nothrow(__state);
+ if (this->exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return *this;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ this->setstate(__state);
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-ws(basic_istream<_CharT, _Traits>& __is)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
- if (__sen)
- {
+_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __is) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- while (true)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
- break;
- __is.rdbuf()->sbumpc();
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ while (true) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __is.setstate(__state);
+ if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
+ break;
+ __is.rdbuf()->sbumpc();
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __is.setstate(__state);
+ }
+ return __is;
}
template <class _Stream, class _Tp, class = void>
-struct __is_istreamable : false_type { };
+struct __is_istreamable : false_type {};
template <class _Stream, class _Tp>
-struct __is_istreamable<_Stream, _Tp, decltype(
- std::declval<_Stream>() >> std::declval<_Tp>(), void()
-)> : true_type { };
-
-template <class _Stream, class _Tp, __enable_if_t<
- _And<is_base_of<ios_base, _Stream>, __is_istreamable<_Stream&, _Tp&&> >::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Stream&& operator>>(_Stream&& __is, _Tp&& __x)
-{
- __is >> std::forward<_Tp>(__x);
- return std::move(__is);
+struct __is_istreamable<_Stream, _Tp, decltype(std::declval<_Stream>() >> std::declval<_Tp>(), void())> : true_type {};
+
+template <class _Stream,
+ class _Tp,
+ __enable_if_t< _And<is_base_of<ios_base, _Stream>, __is_istreamable<_Stream&, _Tp&&> >::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI _Stream&& operator>>(_Stream&& __is, _Tp&& __x) {
+ __is >> std::forward<_Tp>(__x);
+ return std::move(__is);
}
template <class _CharT, class _Traits>
class _LIBCPP_TEMPLATE_VIS basic_iostream
: public basic_istream<_CharT, _Traits>,
- public basic_ostream<_CharT, _Traits>
-{
+ public basic_ostream<_CharT, _Traits> {
public:
- // types:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ // types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
- // constructor/destructor
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
- : basic_istream<_CharT, _Traits>(__sb)
- {}
+ // constructor/destructor
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
+ : basic_istream<_CharT, _Traits>(__sb) {}
+
+ ~basic_iostream() override;
- ~basic_iostream() override;
protected:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_iostream(basic_iostream&& __rhs);
+ inline _LIBCPP_HIDE_FROM_ABI basic_iostream(basic_iostream&& __rhs);
- // assign/swap
- inline _LIBCPP_HIDE_FROM_ABI
- basic_iostream& operator=(basic_iostream&& __rhs);
+ // assign/swap
+ inline _LIBCPP_HIDE_FROM_ABI basic_iostream& operator=(basic_iostream&& __rhs);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void swap(basic_iostream& __rhs)
- { basic_istream<char_type, traits_type>::swap(__rhs); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_iostream& __rhs) {
+ basic_istream<char_type, traits_type>::swap(__rhs);
+ }
};
template <class _CharT, class _Traits>
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
- : basic_istream<_CharT, _Traits>(std::move(__rhs))
-{
-}
+ : basic_istream<_CharT, _Traits>(std::move(__rhs)) {}
template <class _CharT, class _Traits>
-basic_iostream<_CharT, _Traits>&
-basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
-{
- swap(__rhs);
- return *this;
+basic_iostream<_CharT, _Traits>& basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) {
+ swap(__rhs);
+ return *this;
}
template <class _CharT, class _Traits>
-basic_iostream<_CharT, _Traits>::~basic_iostream()
-{
-}
+basic_iostream<_CharT, _Traits>::~basic_iostream() {}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- __str.clear();
- streamsize __n = __is.width();
- if (__n <= 0)
- __n = __str.max_size();
- if (__n <= 0)
- __n = numeric_limits<streamsize>::max();
- streamsize __c = 0;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- while (__c < __n)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- _CharT __ch = _Traits::to_char_type(__i);
- if (__ct.is(__ct.space, __ch))
- break;
- __str.push_back(__ch);
- ++__c;
- __is.rdbuf()->sbumpc();
- }
- __is.width(0);
- if (__c == 0)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ __str.clear();
+ streamsize __n = __is.width();
+ if (__n <= 0)
+ __n = __str.max_size();
+ if (__n <= 0)
+ __n = numeric_limits<streamsize>::max();
+ streamsize __c = 0;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ while (__c < __n) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
- }
-#endif
- __is.setstate(__state);
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (__ct.is(__ct.space, __ch))
+ break;
+ __str.push_back(__ch);
+ ++__c;
+ __is.rdbuf()->sbumpc();
+ }
+ __is.width(0);
+ if (__c == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
- if (__sen)
- {
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- __str.clear();
- streamsize __extr = 0;
- while (true)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- ++__extr;
- _CharT __ch = _Traits::to_char_type(__i);
- if (_Traits::eq(__ch, __dlm))
- break;
- __str.push_back(__ch);
- if (__str.size() == __str.max_size())
- {
- __state |= ios_base::failbit;
- break;
- }
- }
- if (__extr == 0)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ __str.clear();
+ streamsize __extr = 0;
+ while (true) {
+ typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
+ ++__extr;
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (_Traits::eq(__ch, __dlm))
+ break;
+ __str.push_back(__ch);
+ if (__str.size() == __str.max_size()) {
+ __state |= ios_base::failbit;
+ break;
}
-#endif
- __is.setstate(__state);
+ }
+ if (__extr == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- return std::getline(__is, __str, __is.widen('\n'));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str) {
+ return std::getline(__is, __str, __is.widen('\n'));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
-{
- return std::getline(__is, __str, __dlm);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) {
+ return std::getline(__is, __str, __dlm);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- return std::getline(__is, __str, __is.widen('\n'));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str) {
+ return std::getline(__is, __str, __is.widen('\n'));
}
template <class _CharT, class _Traits, size_t _Size>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
-{
- ios_base::iostate __state = ios_base::goodbit;
- typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
- if (__sen)
- {
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) {
+ ios_base::iostate __state = ios_base::goodbit;
+ typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
+ if (__sen) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif
- basic_string<_CharT, _Traits> __str;
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
- size_t __c = 0;
- _CharT __zero = __ct.widen('0');
- _CharT __one = __ct.widen('1');
- while (__c != _Size)
- {
- typename _Traits::int_type __i = __is.rdbuf()->sgetc();
- if (_Traits::eq_int_type(__i, _Traits::eof()))
- {
- __state |= ios_base::eofbit;
- break;
- }
- _CharT __ch = _Traits::to_char_type(__i);
- if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
- break;
- __str.push_back(__ch);
- ++__c;
- __is.rdbuf()->sbumpc();
- }
- __x = bitset<_Size>(__str);
- if (_Size > 0 && __c == 0)
- __state |= ios_base::failbit;
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __state |= ios_base::badbit;
- __is.__setstate_nothrow(__state);
- if (__is.exceptions() & ios_base::badbit)
- {
- throw;
- }
+ basic_string<_CharT, _Traits> __str;
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
+ size_t __c = 0;
+ _CharT __zero = __ct.widen('0');
+ _CharT __one = __ct.widen('1');
+ while (__c != _Size) {
+ typename _Traits::int_type __i = __is.rdbuf()->sgetc();
+ if (_Traits::eq_int_type(__i, _Traits::eof())) {
+ __state |= ios_base::eofbit;
+ break;
}
-#endif
- __is.setstate(__state);
+ _CharT __ch = _Traits::to_char_type(__i);
+ if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
+ break;
+ __str.push_back(__ch);
+ ++__c;
+ __is.rdbuf()->sbumpc();
+ }
+ __x = bitset<_Size>(__str);
+ if (_Size > 0 && __c == 0)
+ __state |= ios_base::failbit;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __state |= ios_base::badbit;
+ __is.__setstate_nothrow(__state);
+ if (__is.exceptions() & ios_base::badbit) {
+ throw;
+ }
}
- return __is;
+#endif
+ __is.setstate(__state);
+ }
+ return __is;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>;
diff --git a/contrib/llvm-project/libcxx/include/latch b/contrib/llvm-project/libcxx/include/latch
index 0d1b3713ea62..ef52c0562a7c 100644
--- a/contrib/llvm-project/libcxx/include/latch
+++ b/contrib/llvm-project/libcxx/include/latch
@@ -55,7 +55,7 @@ namespace std
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<latch> is not supported since libc++ has been configured without support for threads."
+# error "<latch> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_PUSH_MACROS
@@ -65,64 +65,48 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-class latch
-{
- __atomic_base<ptrdiff_t> __a_;
+class latch {
+ __atomic_base<ptrdiff_t> __a_;
public:
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept {
- return numeric_limits<ptrdiff_t>::max();
- }
-
- inline _LIBCPP_HIDE_FROM_ABI
- constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__expected >= 0,
- "latch::latch(ptrdiff_t): latch cannot be "
- "initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(__expected <= max(),
- "latch::latch(ptrdiff_t): latch cannot be "
- "initialized with a value greater than max()");
- }
-
- _LIBCPP_HIDE_FROM_ABI ~latch() = default;
- latch(const latch&) = delete;
- latch& operator=(const latch&) = delete;
-
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void count_down(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update >= 0, "latch::count_down called with a negative value");
- auto const __old = __a_.fetch_sub(__update, memory_order_release);
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update <= __old, "latch::count_down called with a value greater "
- "than the internal counter");
- if (__old == __update)
- __a_.notify_all();
- }
- inline _LIBCPP_HIDE_FROM_ABI
- bool try_wait() const noexcept
- {
- return 0 == __a_.load(memory_order_acquire);
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void wait() const
- {
- __cxx_atomic_wait(&__a_.__a_, [this]() -> bool {
- return try_wait();
- });
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void arrive_and_wait(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __update >= 0, "latch::arrive_and_wait called with a negative value");
- // other preconditions on __update are checked in count_down()
-
- count_down(__update);
- wait();
- }
+ static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
+
+ inline _LIBCPP_HIDE_FROM_ABI constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __expected >= 0,
+ "latch::latch(ptrdiff_t): latch cannot be "
+ "initialized with a negative value");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __expected <= max(),
+ "latch::latch(ptrdiff_t): latch cannot be "
+ "initialized with a value greater than max()");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ~latch() = default;
+ latch(const latch&) = delete;
+ latch& operator=(const latch&) = delete;
+
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void count_down(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::count_down called with a negative value");
+ auto const __old = __a_.fetch_sub(__update, memory_order_release);
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __update <= __old,
+ "latch::count_down called with a value greater "
+ "than the internal counter");
+ if (__old == __update)
+ __a_.notify_all();
+ }
+ inline _LIBCPP_HIDE_FROM_ABI bool try_wait() const noexcept { return 0 == __a_.load(memory_order_acquire); }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait() const {
+ __cxx_atomic_wait(&__a_.__a_, [this]() -> bool { return try_wait(); });
+ }
+ inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::arrive_and_wait called with a negative value");
+ // other preconditions on __update are checked in count_down()
+
+ count_down(__update);
+ wait();
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/limits b/contrib/llvm-project/libcxx/include/limits
index a31593fe03e7..a240580c0132 100644
--- a/contrib/llvm-project/libcxx/include/limits
+++ b/contrib/llvm-project/libcxx/include/limits
@@ -116,716 +116,700 @@ _LIBCPP_PUSH_MACROS
#include <__undef_macros>
#include <version>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-enum float_round_style
-{
- round_indeterminate = -1,
- round_toward_zero = 0,
- round_to_nearest = 1,
- round_toward_infinity = 2,
- round_toward_neg_infinity = 3
+enum float_round_style {
+ round_indeterminate = -1,
+ round_toward_zero = 0,
+ round_to_nearest = 1,
+ round_toward_infinity = 2,
+ round_toward_neg_infinity = 3
};
-enum _LIBCPP_DEPRECATED_IN_CXX23 float_denorm_style
-{
- denorm_indeterminate = -1,
- denorm_absent = 0,
- denorm_present = 1
+enum _LIBCPP_DEPRECATED_IN_CXX23 float_denorm_style {
+ denorm_indeterminate = -1,
+ denorm_absent = 0,
+ denorm_present = 1
};
template <class _Tp, bool = is_arithmetic<_Tp>::value>
-class __libcpp_numeric_limits
-{
+class __libcpp_numeric_limits {
protected:
- typedef _Tp type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();}
-
- static _LIBCPP_CONSTEXPR const int digits = 0;
- static _LIBCPP_CONSTEXPR const int digits10 = 0;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
- static _LIBCPP_CONSTEXPR const bool is_signed = false;
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = 0;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = 0;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = false;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
- static _LIBCPP_CONSTEXPR const bool is_bounded = false;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+ typedef _Tp type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return type(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = 0;
+ static _LIBCPP_CONSTEXPR const int digits10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
+ static _LIBCPP_CONSTEXPR const bool is_signed = false;
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = 0;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = false;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
};
template <class _Tp, int __digits, bool _IsSigned>
-struct __libcpp_compute_min
-{
- static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits);
+struct __libcpp_compute_min {
+ static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits);
};
template <class _Tp, int __digits>
-struct __libcpp_compute_min<_Tp, __digits, false>
-{
- static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
+struct __libcpp_compute_min<_Tp, __digits, false> {
+ static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
};
template <class _Tp>
-class __libcpp_numeric_limits<_Tp, true>
-{
+class __libcpp_numeric_limits<_Tp, true> {
protected:
- typedef _Tp type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
- static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
- static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
- static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
- static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = true;
- static _LIBCPP_CONSTEXPR const bool is_exact = true;
- static _LIBCPP_CONSTEXPR const int radix = 2;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = 0;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = false;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = !std::is_signed<_Tp>::value;
-
-#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \
- defined(__wasm__)
- static _LIBCPP_CONSTEXPR const bool traps = true;
+ typedef _Tp type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
+ static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
+ static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
+ static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
+ static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = true;
+ static _LIBCPP_CONSTEXPR const bool is_exact = true;
+ static _LIBCPP_CONSTEXPR const int radix = 2;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = !std::is_signed<_Tp>::value;
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || defined(__wasm__)
+ static _LIBCPP_CONSTEXPR const bool traps = true;
#else
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#endif
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
};
template <>
-class __libcpp_numeric_limits<bool, true>
-{
+class __libcpp_numeric_limits<bool, true> {
protected:
- typedef bool type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = false;
- static _LIBCPP_CONSTEXPR const int digits = 1;
- static _LIBCPP_CONSTEXPR const int digits10 = 0;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
- static _LIBCPP_CONSTEXPR const type __min = false;
- static _LIBCPP_CONSTEXPR const type __max = true;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = true;
- static _LIBCPP_CONSTEXPR const bool is_exact = true;
- static _LIBCPP_CONSTEXPR const int radix = 2;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = 0;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent = 0;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = false;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
+ typedef bool type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = false;
+ static _LIBCPP_CONSTEXPR const int digits = 1;
+ static _LIBCPP_CONSTEXPR const int digits10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
+ static _LIBCPP_CONSTEXPR const type __min = false;
+ static _LIBCPP_CONSTEXPR const type __max = true;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = true;
+ static _LIBCPP_CONSTEXPR const bool is_exact = true;
+ static _LIBCPP_CONSTEXPR const int radix = 2;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent = 0;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = false;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
};
template <>
-class __libcpp_numeric_limits<float, true>
-{
+class __libcpp_numeric_limits<float, true> {
protected:
- typedef float type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = true;
- static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__;
- static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5F;}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = true;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ typedef float type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = true;
+ static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__;
+ static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __FLT_MIN__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __FLT_MAX__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __FLT_EPSILON__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5F; }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_valf(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanf(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansf(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __FLT_DENORM_MIN__; }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#if (defined(__arm__) || defined(__aarch64__))
- static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
#else
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
#endif
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
};
template <>
-class __libcpp_numeric_limits<double, true>
-{
+class __libcpp_numeric_limits<double, true> {
protected:
- typedef double type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = true;
- static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__;
- static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = true;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_val();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
-
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ typedef double type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = true;
+ static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__;
+ static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __DBL_MIN__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __DBL_MAX__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __DBL_EPSILON__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5; }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_val(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nan(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nans(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __DBL_DENORM_MIN__; }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#if (defined(__arm__) || defined(__aarch64__))
- static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
#else
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
#endif
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
};
template <>
-class __libcpp_numeric_limits<long double, true>
-{
+class __libcpp_numeric_limits<long double, true> {
protected:
- typedef long double type;
-
- static _LIBCPP_CONSTEXPR const bool is_specialized = true;
-
- static _LIBCPP_CONSTEXPR const bool is_signed = true;
- static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__;
- static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__;
- static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103l)/100000l;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
-
- static _LIBCPP_CONSTEXPR const bool is_integer = false;
- static _LIBCPP_CONSTEXPR const bool is_exact = false;
- static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = true;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_vall();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ typedef long double type;
+
+ static _LIBCPP_CONSTEXPR const bool is_specialized = true;
+
+ static _LIBCPP_CONSTEXPR const bool is_signed = true;
+ static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__;
+ static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __LDBL_MIN__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __LDBL_MAX__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_integer = false;
+ static _LIBCPP_CONSTEXPR const bool is_exact = false;
+ static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __LDBL_EPSILON__; }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5L; }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = true;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_vall(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanl(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansl(""); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __LDBL_DENORM_MIN__; }
#if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__)
- static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
#else
- static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
#endif
- static _LIBCPP_CONSTEXPR const bool is_bounded = true;
- static _LIBCPP_CONSTEXPR const bool is_modulo = false;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = true;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = false;
- static _LIBCPP_CONSTEXPR const bool traps = false;
+ static _LIBCPP_CONSTEXPR const bool traps = false;
#if (defined(__arm__) || defined(__aarch64__))
- static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
#else
- static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
#endif
- static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
};
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits
- : private __libcpp_numeric_limits<__remove_cv_t<_Tp> >
-{
- typedef __libcpp_numeric_limits<__remove_cv_t<_Tp> > __base;
- typedef typename __base::type type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<__remove_cv_t<_Tp> > {
+ typedef __libcpp_numeric_limits<__remove_cv_t<_Tp> > __base;
+ typedef typename __base::type type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp>
- : private numeric_limits<_Tp>
-{
- typedef numeric_limits<_Tp> __base;
- typedef _Tp type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : private numeric_limits<_Tp> {
+ typedef numeric_limits<_Tp> __base;
+ typedef _Tp type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp>
- : private numeric_limits<_Tp>
-{
- typedef numeric_limits<_Tp> __base;
- typedef _Tp type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits<volatile _Tp> : private numeric_limits<_Tp> {
+ typedef numeric_limits<_Tp> __base;
+ typedef _Tp type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp>
- : private numeric_limits<_Tp>
-{
- typedef numeric_limits<_Tp> __base;
- typedef _Tp type;
+class _LIBCPP_TEMPLATE_VIS numeric_limits<const volatile _Tp> : private numeric_limits<_Tp> {
+ typedef numeric_limits<_Tp> __base;
+ typedef _Tp type;
+
public:
- static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
-
- static _LIBCPP_CONSTEXPR const int digits = __base::digits;
- static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
- static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
- static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
- static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
- static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
- static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
-
- static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
- static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
- static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
- static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
-
- static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
- static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
- static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
- static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
-
- static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
- static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
- static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
-
- static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
- static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
- static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
+ static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
+
+ static _LIBCPP_CONSTEXPR const int digits = __base::digits;
+ static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
+ static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
+ static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
+ static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
+ static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
+ static _LIBCPP_CONSTEXPR const int radix = __base::radix;
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+
+ static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
+ static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
+ static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
+ static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
+
+ static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
+ static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
+ static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
+ static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
+ _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+
+ static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
+ static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
+ static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
+
+ static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
+ static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
+ static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
};
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent;
template <class _Tp>
- _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10;
+_LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm;
+_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps;
template <class _Tp>
- _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before;
+_LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before;
template <class _Tp>
- _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style;
+_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style;
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/list b/contrib/llvm-project/libcxx/include/list
index 922843ad571d..7fea48744569 100644
--- a/contrib/llvm-project/libcxx/include/list
+++ b/contrib/llvm-project/libcxx/include/list
@@ -261,18 +261,17 @@ template <class T, class Allocator, class Predicate>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _VoidPtr> struct __list_node;
-template <class _Tp, class _VoidPtr> struct __list_node_base;
+template <class _Tp, class _VoidPtr>
+struct __list_node;
+template <class _Tp, class _VoidPtr>
+struct __list_node_base;
template <class _Tp, class _VoidPtr>
struct __list_node_pointer_traits {
- typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> >
- __node_pointer;
- typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >
- __base_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> > __node_pointer;
+ typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> > __base_pointer;
#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB)
typedef __base_pointer __link_pointer;
@@ -283,432 +282,339 @@ struct __list_node_pointer_traits {
typedef __conditional_t<is_same<__link_pointer, __node_pointer>::value, __base_pointer, __node_pointer>
__non_link_pointer;
- static _LIBCPP_HIDE_FROM_ABI
- __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) {
- return __p;
- }
+ static _LIBCPP_HIDE_FROM_ABI __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { return __p; }
- static _LIBCPP_HIDE_FROM_ABI
- __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) {
- return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p));
+ static _LIBCPP_HIDE_FROM_ABI __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) {
+ return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p));
}
-
};
template <class _Tp, class _VoidPtr>
-struct __list_node_base
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__node_pointer __node_pointer;
- typedef typename _NodeTraits::__base_pointer __base_pointer;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
+struct __list_node_base {
+ typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
+ typedef typename _NodeTraits::__node_pointer __node_pointer;
+ typedef typename _NodeTraits::__base_pointer __base_pointer;
+ typedef typename _NodeTraits::__link_pointer __link_pointer;
- __link_pointer __prev_;
- __link_pointer __next_;
+ __link_pointer __prev_;
+ __link_pointer __next_;
- _LIBCPP_HIDE_FROM_ABI
- __list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())),
- __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {}
+ _LIBCPP_HIDE_FROM_ABI __list_node_base()
+ : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())),
+ __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {}
- _LIBCPP_HIDE_FROM_ABI explicit __list_node_base(__link_pointer __prev, __link_pointer __next)
- : __prev_(__prev), __next_(__next) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __list_node_base(__link_pointer __prev, __link_pointer __next)
+ : __prev_(__prev), __next_(__next) {}
- _LIBCPP_HIDE_FROM_ABI
- __base_pointer __self() {
- return pointer_traits<__base_pointer>::pointer_to(*this);
- }
+ _LIBCPP_HIDE_FROM_ABI __base_pointer __self() { return pointer_traits<__base_pointer>::pointer_to(*this); }
- _LIBCPP_HIDE_FROM_ABI
- __node_pointer __as_node() {
- return static_cast<__node_pointer>(__self());
- }
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __as_node() { return static_cast<__node_pointer>(__self()); }
};
template <class _Tp, class _VoidPtr>
-struct __list_node
- : public __list_node_base<_Tp, _VoidPtr>
-{
- // We allow starting the lifetime of nodes without initializing the value held by the node,
- // since that is handled by the list itself in order to be allocator-aware.
+struct __list_node : public __list_node_base<_Tp, _VoidPtr> {
+ // We allow starting the lifetime of nodes without initializing the value held by the node,
+ // since that is handled by the list itself in order to be allocator-aware.
#ifndef _LIBCPP_CXX03_LANG
+
private:
- union {
- _Tp __value_;
- };
+ union {
+ _Tp __value_;
+ };
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
#else
+
private:
- _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
+ _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)];
public:
- _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() {
- return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_));
- }
+ _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_)); }
#endif
- typedef __list_node_base<_Tp, _VoidPtr> __base;
- typedef typename __base::__link_pointer __link_pointer;
+ typedef __list_node_base<_Tp, _VoidPtr> __base;
+ typedef typename __base::__link_pointer __link_pointer;
- _LIBCPP_HIDE_FROM_ABI explicit __list_node(__link_pointer __prev, __link_pointer __next) : __base(__prev, __next) {}
- _LIBCPP_HIDE_FROM_ABI ~__list_node() {}
+ _LIBCPP_HIDE_FROM_ABI explicit __list_node(__link_pointer __prev, __link_pointer __next) : __base(__prev, __next) {}
+ _LIBCPP_HIDE_FROM_ABI ~__list_node() {}
- _LIBCPP_HIDE_FROM_ABI
- __link_pointer __as_link() {
- return static_cast<__link_pointer>(__base::__self());
- }
+ _LIBCPP_HIDE_FROM_ABI __link_pointer __as_link() { return static_cast<__link_pointer>(__base::__self()); }
};
-template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS list;
-template <class _Tp, class _Alloc> class __list_imp;
-template <class _Tp, class _VoidPtr> class _LIBCPP_TEMPLATE_VIS __list_const_iterator;
+template <class _Tp, class _Alloc = allocator<_Tp> >
+class _LIBCPP_TEMPLATE_VIS list;
+template <class _Tp, class _Alloc>
+class __list_imp;
+template <class _Tp, class _VoidPtr>
+class _LIBCPP_TEMPLATE_VIS __list_const_iterator;
template <class _Tp, class _VoidPtr>
-class _LIBCPP_TEMPLATE_VIS __list_iterator
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
+class _LIBCPP_TEMPLATE_VIS __list_iterator {
+ typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
+ typedef typename _NodeTraits::__link_pointer __link_pointer;
- __link_pointer __ptr_;
+ __link_pointer __ptr_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __list_iterator(__link_pointer __p) _NOEXCEPT
- : __ptr_(__p)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+
+ template <class, class>
+ friend class list;
+ template <class, class>
+ friend class __list_imp;
+ template <class, class>
+ friend class __list_const_iterator;
- template<class, class> friend class list;
- template<class, class> friend class __list_imp;
- template<class, class> friend class __list_const_iterator;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef value_type& reference;
- typedef __rebind_pointer_t<_VoidPtr, value_type> pointer;
- typedef typename pointer_traits<pointer>::difference_type difference_type;
-
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator() _NOEXCEPT : __ptr_(nullptr)
- {
- }
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef __rebind_pointer_t<_VoidPtr, value_type> pointer;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const
- {
- return __ptr_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const
- {
- return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI __list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator& operator++()
- {
- __ptr_ = __ptr_->__next_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator& operator--()
- {
- __ptr_ = __ptr_->__prev_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __ptr_->__as_node()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __list_iterator& __x, const __list_iterator& __y)
- {
- return __x.__ptr_ == __y.__ptr_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
- {return !(__x == __y);}
+ _LIBCPP_HIDE_FROM_ABI __list_iterator& operator++() {
+ __ptr_ = __ptr_->__next_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_iterator operator++(int) {
+ __list_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __list_iterator& operator--() {
+ __ptr_ = __ptr_->__prev_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_iterator operator--(int) {
+ __list_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __list_iterator& __x, const __list_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __list_iterator& __x, const __list_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _Tp, class _VoidPtr>
-class _LIBCPP_TEMPLATE_VIS __list_const_iterator
-{
- typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
- typedef typename _NodeTraits::__link_pointer __link_pointer;
+class _LIBCPP_TEMPLATE_VIS __list_const_iterator {
+ typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
+ typedef typename _NodeTraits::__link_pointer __link_pointer;
- __link_pointer __ptr_;
+ __link_pointer __ptr_;
- _LIBCPP_HIDE_FROM_ABI
- explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT
- : __ptr_(__p)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
+
+ template <class, class>
+ friend class list;
+ template <class, class>
+ friend class __list_imp;
- template<class, class> friend class list;
- template<class, class> friend class __list_imp;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef const value_type& reference;
- typedef __rebind_pointer_t<_VoidPtr, const value_type> pointer;
- typedef typename pointer_traits<pointer>::difference_type difference_type;
-
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
- {
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
- : __ptr_(__p.__ptr_)
- {
- }
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef const value_type& reference;
+ typedef __rebind_pointer_t<_VoidPtr, const value_type> pointer;
+ typedef typename pointer_traits<pointer>::difference_type difference_type;
+
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
+ : __ptr_(__p.__ptr_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __ptr_->__as_node()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
+ }
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const
- {
- return __ptr_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const
- {
- return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__get_value());
- }
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator& operator++() {
+ __ptr_ = __ptr_->__next_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator operator++(int) {
+ __list_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator& operator++()
- {
- __ptr_ = __ptr_->__next_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;}
-
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator& operator--()
- {
- __ptr_ = __ptr_->__prev_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;}
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator& operator--() {
+ __ptr_ = __ptr_->__prev_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __list_const_iterator operator--(int) {
+ __list_const_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
- {
- return __x.__ptr_ == __y.__ptr_;
- }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
- {return !(__x == __y);}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) {
+ return __x.__ptr_ == __y.__ptr_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y) {
+ return !(__x == __y);
+ }
};
template <class _Tp, class _Alloc>
-class __list_imp
-{
- __list_imp(const __list_imp&);
- __list_imp& operator=(const __list_imp&);
+class __list_imp {
+ __list_imp(const __list_imp&);
+ __list_imp& operator=(const __list_imp&);
+
public:
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+
protected:
- typedef _Tp value_type;
- typedef typename __alloc_traits::void_pointer __void_pointer;
- typedef __list_iterator<value_type, __void_pointer> iterator;
- typedef __list_const_iterator<value_type, __void_pointer> const_iterator;
- typedef __list_node_base<value_type, __void_pointer> __node_base;
- typedef __list_node<value_type, __void_pointer> __node_type;
- typedef __rebind_alloc<__alloc_traits, __node_type> __node_allocator;
- typedef allocator_traits<__node_allocator> __node_alloc_traits;
- typedef typename __node_alloc_traits::pointer __node_pointer;
- typedef typename __node_alloc_traits::pointer __node_const_pointer;
- typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits;
- typedef typename __node_pointer_traits::__link_pointer __link_pointer;
- typedef __link_pointer __link_const_pointer;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::difference_type difference_type;
-
- typedef __rebind_alloc<__alloc_traits, __node_base> __node_base_allocator;
- typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
-
- __node_base __end_;
- __compressed_pair<size_type, __node_allocator> __size_alloc_;
-
- _LIBCPP_HIDE_FROM_ABI
- __link_pointer __end_as_link() const _NOEXCEPT {
- return __node_pointer_traits::__unsafe_link_pointer_cast(
- const_cast<__node_base&>(__end_).__self());
- }
+ typedef _Tp value_type;
+ typedef typename __alloc_traits::void_pointer __void_pointer;
+ typedef __list_iterator<value_type, __void_pointer> iterator;
+ typedef __list_const_iterator<value_type, __void_pointer> const_iterator;
+ typedef __list_node_base<value_type, __void_pointer> __node_base;
+ typedef __list_node<value_type, __void_pointer> __node_type;
+ typedef __rebind_alloc<__alloc_traits, __node_type> __node_allocator;
+ typedef allocator_traits<__node_allocator> __node_alloc_traits;
+ typedef typename __node_alloc_traits::pointer __node_pointer;
+ typedef typename __node_alloc_traits::pointer __node_const_pointer;
+ typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits;
+ typedef typename __node_pointer_traits::__link_pointer __link_pointer;
+ typedef __link_pointer __link_const_pointer;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::difference_type difference_type;
+
+ typedef __rebind_alloc<__alloc_traits, __node_base> __node_base_allocator;
+ typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
+ static_assert((!is_same<allocator_type, __node_allocator>::value),
+ "internal allocator type must differ from user-specified "
+ "type; otherwise overload resolution breaks");
+
+ __node_base __end_;
+ __compressed_pair<size_type, __node_allocator> __size_alloc_;
+
+ _LIBCPP_HIDE_FROM_ABI __link_pointer __end_as_link() const _NOEXCEPT {
+ return __node_pointer_traits::__unsafe_link_pointer_cast(const_cast<__node_base&>(__end_).__self());
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_type& __sz() _NOEXCEPT {return __size_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI
- const size_type& __sz() const _NOEXCEPT
- {return __size_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI
- __node_allocator& __node_alloc() _NOEXCEPT
- {return __size_alloc_.second();}
- _LIBCPP_HIDE_FROM_ABI
- const __node_allocator& __node_alloc() const _NOEXCEPT
- {return __size_alloc_.second();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type __node_alloc_max_size() const _NOEXCEPT {
- return __node_alloc_traits::max_size(__node_alloc());
- }
- _LIBCPP_HIDE_FROM_ABI
- static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- __list_imp()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- __list_imp(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI
- __list_imp(const __node_allocator& __a);
+ _LIBCPP_HIDE_FROM_ABI size_type& __sz() _NOEXCEPT { return __size_alloc_.first(); }
+ _LIBCPP_HIDE_FROM_ABI const size_type& __sz() const _NOEXCEPT { return __size_alloc_.first(); }
+ _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __size_alloc_.second(); }
+ _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __size_alloc_.second(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type __node_alloc_max_size() const _NOEXCEPT {
+ return __node_alloc_traits::max_size(__node_alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI __list_imp() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI __list_imp(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI __list_imp(const __node_allocator& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI __list_imp(__node_allocator&& __a) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI __list_imp(__node_allocator&& __a) _NOEXCEPT;
#endif
- _LIBCPP_HIDE_FROM_ABI ~__list_imp();
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __sz() == 0;}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT
- {
- return iterator(__end_.__next_);
- }
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT
- {
- return const_iterator(__end_.__next_);
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT
- {
- return iterator(__end_as_link());
- }
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT
- {
- return const_iterator(__end_as_link());
- }
+ _LIBCPP_HIDE_FROM_ABI ~__list_imp();
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __sz() == 0; }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__end_.__next_); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__end_.__next_); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_as_link()); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_as_link()); }
- _LIBCPP_HIDE_FROM_ABI void swap(__list_imp& __c)
+ _LIBCPP_HIDE_FROM_ABI void swap(__list_imp& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __list_imp& __c)
- {__copy_assign_alloc(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__list_imp& __c)
- _NOEXCEPT_(
- !__node_alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<__node_allocator>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_move_assignment::value>());}
-
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__link_pointer __prev, __link_pointer __next, _Args&& ...__args) {
- __node_allocator& __alloc = __node_alloc();
- __allocation_guard<__node_allocator> __guard(__alloc, 1);
- // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
- // held inside the node, since we need to use the allocator's construct() method for that.
- //
- // We don't use the allocator's construct() method to construct the node itself since the
- // Cpp17FooInsertable named requirements don't require the allocator's construct() method
- // to work on anything other than the value_type.
- std::__construct_at(std::addressof(*__guard.__get()), __prev, __next);
-
- // Now construct the value_type using the allocator's construct() method.
- __node_alloc_traits::construct(__alloc, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
- return __guard.__release_ptr();
- }
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __list_imp& __c) {
+ __copy_assign_alloc(
+ __c, integral_constant<bool, __node_alloc_traits::propagate_on_container_copy_assignment::value>());
+ }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
- // For the same reason as above, we use the allocator's destroy() method for the value_type,
- // but not for the node itself.
- __node_allocator& __alloc = __node_alloc();
- __node_alloc_traits::destroy(__alloc, std::addressof(__node->__get_value()));
- std::__destroy_at(std::addressof(*__node));
- __node_alloc_traits::deallocate(__alloc, __node, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__list_imp& __c)
+ _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign_alloc(
+ __c, integral_constant<bool, __node_alloc_traits::propagate_on_container_move_assignment::value>());
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__link_pointer __prev, __link_pointer __next, _Args&&... __args) {
+ __node_allocator& __alloc = __node_alloc();
+ __allocation_guard<__node_allocator> __guard(__alloc, 1);
+ // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value
+ // held inside the node, since we need to use the allocator's construct() method for that.
+ //
+ // We don't use the allocator's construct() method to construct the node itself since the
+ // Cpp17FooInsertable named requirements don't require the allocator's construct() method
+ // to work on anything other than the value_type.
+ std::__construct_at(std::addressof(*__guard.__get()), __prev, __next);
+
+ // Now construct the value_type using the allocator's construct() method.
+ __node_alloc_traits::construct(
+ __alloc, std::addressof(__guard.__get()->__get_value()), std::forward<_Args>(__args)...);
+ return __guard.__release_ptr();
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __delete_node(__node_pointer __node) {
+ // For the same reason as above, we use the allocator's destroy() method for the value_type,
+ // but not for the node itself.
+ __node_allocator& __alloc = __node_alloc();
+ __node_alloc_traits::destroy(__alloc, std::addressof(__node->__get_value()));
+ std::__destroy_at(std::addressof(*__node));
+ __node_alloc_traits::deallocate(__alloc, __node, 1);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __list_imp& __c, true_type)
- {
- if (__node_alloc() != __c.__node_alloc())
- clear();
- __node_alloc() = __c.__node_alloc();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const __list_imp&, false_type)
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__list_imp& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
- {
- __node_alloc() = std::move(__c.__node_alloc());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(__list_imp&, false_type)
- _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __list_imp& __c, true_type) {
+ if (__node_alloc() != __c.__node_alloc())
+ clear();
+ __node_alloc() = __c.__node_alloc();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __list_imp&, false_type) {}
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__list_imp& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ __node_alloc() = std::move(__c.__node_alloc());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__list_imp&, false_type) _NOEXCEPT {}
};
// Unlink nodes [__f, __l]
template <class _Tp, class _Alloc>
-inline
-void
-__list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l)
- _NOEXCEPT
-{
- __f->__prev_->__next_ = __l->__next_;
- __l->__next_->__prev_ = __f->__prev_;
+inline void __list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT {
+ __f->__prev_->__next_ = __l->__next_;
+ __l->__next_->__prev_ = __f->__prev_;
}
template <class _Tp, class _Alloc>
-inline
-__list_imp<_Tp, _Alloc>::__list_imp()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- : __size_alloc_(0, __default_init_tag())
-{
-}
+inline __list_imp<_Tp, _Alloc>::__list_imp() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
+ : __size_alloc_(0, __default_init_tag()) {}
template <class _Tp, class _Alloc>
-inline
-__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
- : __size_alloc_(0, __node_allocator(__a))
-{
-}
+inline __list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a) : __size_alloc_(0, __node_allocator(__a)) {}
template <class _Tp, class _Alloc>
-inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a)
- : __size_alloc_(0, __a) {}
+inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) : __size_alloc_(0, __a) {}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
- : __size_alloc_(0, std::move(__a)) {}
+inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT : __size_alloc_(0, std::move(__a)) {}
#endif
template <class _Tp, class _Alloc>
@@ -717,1330 +623,1077 @@ __list_imp<_Tp, _Alloc>::~__list_imp() {
}
template <class _Tp, class _Alloc>
-void
-__list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
-{
- if (!empty())
- {
- __link_pointer __f = __end_.__next_;
- __link_pointer __l = __end_as_link();
- __unlink_nodes(__f, __l->__prev_);
- __sz() = 0;
- while (__f != __l)
- {
- __node_pointer __np = __f->__as_node();
- __f = __f->__next_;
- __delete_node(__np);
- }
+void __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT {
+ if (!empty()) {
+ __link_pointer __f = __end_.__next_;
+ __link_pointer __l = __end_as_link();
+ __unlink_nodes(__f, __l->__prev_);
+ __sz() = 0;
+ while (__f != __l) {
+ __node_pointer __np = __f->__as_node();
+ __f = __f->__next_;
+ __delete_node(__np);
}
+ }
}
template <class _Tp, class _Alloc>
-void
-__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
+void __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__alloc_traits::propagate_on_container_swap::value ||
- this->__node_alloc() == __c.__node_alloc(),
- "list::swap: Either propagate_on_container_swap must be true"
- " or the allocators must compare equal");
- using std::swap;
- std::__swap_allocator(__node_alloc(), __c.__node_alloc());
- swap(__sz(), __c.__sz());
- swap(__end_, __c.__end_);
- if (__sz() == 0)
- __end_.__next_ = __end_.__prev_ = __end_as_link();
- else
- __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link();
- if (__c.__sz() == 0)
- __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link();
- else
- __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_traits::propagate_on_container_swap::value || this->__node_alloc() == __c.__node_alloc(),
+ "list::swap: Either propagate_on_container_swap must be true"
+ " or the allocators must compare equal");
+ using std::swap;
+ std::__swap_allocator(__node_alloc(), __c.__node_alloc());
+ swap(__sz(), __c.__sz());
+ swap(__end_, __c.__end_);
+ if (__sz() == 0)
+ __end_.__next_ = __end_.__prev_ = __end_as_link();
+ else
+ __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link();
+ if (__c.__sz() == 0)
+ __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link();
+ else
+ __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
}
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS list
- : private __list_imp<_Tp, _Alloc>
-{
- typedef __list_imp<_Tp, _Alloc> base;
- typedef typename base::__node_type __node_type;
- typedef typename base::__node_allocator __node_allocator;
- typedef typename base::__node_pointer __node_pointer;
- typedef typename base::__node_alloc_traits __node_alloc_traits;
- typedef typename base::__node_base __node_base;
- typedef typename base::__node_base_pointer __node_base_pointer;
- typedef typename base::__link_pointer __link_pointer;
+class _LIBCPP_TEMPLATE_VIS list : private __list_imp<_Tp, _Alloc> {
+ typedef __list_imp<_Tp, _Alloc> base;
+ typedef typename base::__node_type __node_type;
+ typedef typename base::__node_allocator __node_allocator;
+ typedef typename base::__node_pointer __node_pointer;
+ typedef typename base::__node_alloc_traits __node_alloc_traits;
+ typedef typename base::__node_base __node_base;
+ typedef typename base::__node_base_pointer __node_base_pointer;
+ typedef typename base::__link_pointer __link_pointer;
public:
- typedef _Tp value_type;
- typedef _Alloc allocator_type;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename base::pointer pointer;
- typedef typename base::const_pointer const_pointer;
- typedef typename base::size_type size_type;
- typedef typename base::difference_type difference_type;
- typedef typename base::iterator iterator;
- typedef typename base::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef _Tp value_type;
+ typedef _Alloc allocator_type;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename base::pointer pointer;
+ typedef typename base::const_pointer const_pointer;
+ typedef typename base::size_type size_type;
+ typedef typename base::difference_type difference_type;
+ typedef typename base::iterator iterator;
+ typedef typename base::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 20
- typedef size_type __remove_return_type;
+ typedef size_type __remove_return_type;
#else
- typedef void __remove_return_type;
+ typedef void __remove_return_type;
#endif
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- _LIBCPP_HIDE_FROM_ABI
- list()
- _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
- {
- }
- _LIBCPP_HIDE_FROM_ABI
- explicit list(const allocator_type& __a) : base(__a)
- {
- }
- _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {}
+ _LIBCPP_HIDE_FROM_ABI explicit list(const allocator_type& __a) : base(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x);
- template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
- _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a)
- {
- for (; __n > 0; --__n)
- push_back(__x);
- }
+ _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x);
+ template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
+ _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) {
+ for (; __n > 0; --__n)
+ push_back(__x);
+ }
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI list(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI list(_InpIter __f, _InpIter __l, const allocator_type& __a,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI
+ list(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI
+ list(_InpIter __f,
+ _InpIter __l,
+ const allocator_type& __a,
+ __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI list(from_range_t, _Range&& __range,
- const allocator_type& __a = allocator_type()) : base(__a) {
- prepend_range(std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI list(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) : base(__a) {
+ prepend_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI list(const list& __c);
- _LIBCPP_HIDE_FROM_ABI list(const list& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI
- list& operator=(const list& __c);
+ _LIBCPP_HIDE_FROM_ABI list(const list& __c);
+ _LIBCPP_HIDE_FROM_ABI list(const list& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI list& operator=(const list& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- list(list&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI
- list(list&& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI
- list& operator=(list&& __c)
- _NOEXCEPT_(
- __node_alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value);
-
- _LIBCPP_HIDE_FROM_ABI
- list& operator=(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end()); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI list(initializer_list<value_type> __il, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI list(list&& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI list& operator=(list&& __c)
+ _NOEXCEPT_(__node_alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<__node_allocator>::value);
+
+ _LIBCPP_HIDE_FROM_ABI list& operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI void assign(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI void
+ assign(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void assign_range(_Range&& __range) {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __x);
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return base::__sz();}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return base::empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT
- {
- return std::min<size_type>(
- base::__node_alloc_max_size(),
- numeric_limits<difference_type >::max());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return base::begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return base::begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return base::end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return base::end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return base::begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return base::end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- reference front()
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
- return base::__end_.__next_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
- return base::__end_.__next_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- reference back()
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
- return base::__end_.__prev_->__as_node()->__get_value();
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference back() const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
- return base::__end_.__prev_->__as_node()->__get_value();
- }
+ _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __x);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __x);
- _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void prepend_range(_Range&& __range) {
- insert_range(begin(), std::forward<_Range>(__range));
- }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return base::__sz(); }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return base::empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return std::min<size_type>(base::__node_alloc_max_size(), numeric_limits<difference_type >::max());
+ }
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
-#endif
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return base::begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return base::begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return base::end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return base::end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return base::begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return base::end(); }
+
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI reference front() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
+ return base::__end_.__next_->__as_node()->__get_value();
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::front called on empty list");
+ return base::__end_.__next_->__as_node()->__get_value();
+ }
+ _LIBCPP_HIDE_FROM_ABI reference back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
+ return base::__end_.__prev_->__as_node()->__get_value();
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference back() const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::back called on empty list");
+ return base::__end_.__prev_->__as_node()->__get_value();
+ }
- template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
-#else
- _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
-#endif
- template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
-#else
- _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
-#endif
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __x);
+ _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x);
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
+ insert_range(begin(), std::forward<_Range>(__range));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, initializer_list<value_type> __il)
- {return insert(__p, __il.begin(), __il.end());}
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
+# endif
+
+ template <class... _Args>
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
+# else
+ _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
+# endif
+ template <class... _Args>
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
+# else
+ _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
+# endif
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args);
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x);
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, initializer_list<value_type> __il) {
+ return insert(__p, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __x);
#ifndef _LIBCPP_CXX03_LANG
- template <class _Arg>
- _LIBCPP_HIDE_FROM_ABI
- void __emplace_back(_Arg&& __arg) { emplace_back(std::forward<_Arg>(__arg)); }
+ template <class _Arg>
+ _LIBCPP_HIDE_FROM_ABI void __emplace_back(_Arg&& __arg) {
+ emplace_back(std::forward<_Arg>(__arg));
+ }
#else
- _LIBCPP_HIDE_FROM_ABI
- void __emplace_back(value_type const& __arg) { push_back(__arg); }
+ _LIBCPP_HIDE_FROM_ABI void __emplace_back(value_type const& __arg) { push_back(__arg); }
#endif
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __x);
- template <class _InpIter>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __x);
+ template <class _InpIter>
+ _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __p,
+ _InpIter __f,
+ _InpIter __l,
+ __enable_if_t<__has_input_iterator_category<_InpIter>::value>* = 0);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_range(const_iterator __position, _Range&& __range) {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_range(const_iterator __position, _Range&& __range) {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(list& __c)
+ _LIBCPP_HIDE_FROM_ABI void swap(list& __c)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<__node_allocator>::value)
#endif
- {base::swap(__c);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {base::clear();}
+ {
+ base::swap(__c);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { base::clear(); }
- _LIBCPP_HIDE_FROM_ABI void pop_front();
- _LIBCPP_HIDE_FROM_ABI void pop_back();
+ _LIBCPP_HIDE_FROM_ABI void pop_front();
+ _LIBCPP_HIDE_FROM_ABI void pop_back();
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c);
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
- _LIBCPP_HIDE_FROM_ABI
- void splice(const_iterator __p, list&& __c, const_iterator __i)
- {splice(__p, __c, __i);}
- _LIBCPP_HIDE_FROM_ABI
- void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
- {splice(__p, __c, __f, __l);}
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list&& __c) { splice(__p, __c); }
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list&& __c, const_iterator __i) { splice(__p, __c, __i); }
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) {
+ splice(__p, __c, __f, __l);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __i);
- _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
-
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __x);
- template <class _Pred>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Pred __pred);
- _LIBCPP_HIDE_FROM_ABI
- __remove_return_type unique() { return unique(__equal_to()); }
- template <class _BinaryPred>
- _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPred __binary_pred);
- _LIBCPP_HIDE_FROM_ABI
- void merge(list& __c);
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __i);
+ _LIBCPP_HIDE_FROM_ABI void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
+
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove(const value_type& __x);
+ template <class _Pred>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type remove_if(_Pred __pred);
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique() { return unique(__equal_to()); }
+ template <class _BinaryPred>
+ _LIBCPP_HIDE_FROM_ABI __remove_return_type unique(_BinaryPred __binary_pred);
+ _LIBCPP_HIDE_FROM_ABI void merge(list& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void merge(list&& __c) {merge(__c);}
+ _LIBCPP_HIDE_FROM_ABI void merge(list&& __c) { merge(__c); }
- template <class _Comp>
- _LIBCPP_HIDE_FROM_ABI
- void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
+ template <class _Comp>
+ _LIBCPP_HIDE_FROM_ABI void merge(list&& __c, _Comp __comp) {
+ merge(__c, __comp);
+ }
#endif
- template <class _Comp>
- _LIBCPP_HIDE_FROM_ABI void merge(list& __c, _Comp __comp);
+ template <class _Comp>
+ _LIBCPP_HIDE_FROM_ABI void merge(list& __c, _Comp __comp);
- _LIBCPP_HIDE_FROM_ABI
- void sort();
- template <class _Comp>
- _LIBCPP_HIDE_FROM_ABI
- void sort(_Comp __comp);
+ _LIBCPP_HIDE_FROM_ABI void sort();
+ template <class _Comp>
+ _LIBCPP_HIDE_FROM_ABI void sort(_Comp __comp);
- _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI void reverse() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
+ _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
private:
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
-
- _LIBCPP_HIDE_FROM_ABI
- static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l);
- _LIBCPP_HIDE_FROM_ABI
- void __link_nodes_at_front(__link_pointer __f, __link_pointer __l);
- _LIBCPP_HIDE_FROM_ABI
- void __link_nodes_at_back (__link_pointer __f, __link_pointer __l);
- _LIBCPP_HIDE_FROM_ABI iterator __iterator(size_type __n);
- // TODO: Make this _LIBCPP_HIDE_FROM_ABI
- template <class _Comp>
- _LIBCPP_HIDDEN static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
-
- _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, false_type);
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
+
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
+
+ _LIBCPP_HIDE_FROM_ABI static void __link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l);
+ _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_front(__link_pointer __f, __link_pointer __l);
+ _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_back(__link_pointer __f, __link_pointer __l);
+ _LIBCPP_HIDE_FROM_ABI iterator __iterator(size_type __n);
+ // TODO: Make this _LIBCPP_HIDE_FROM_ABI
+ template <class _Comp>
+ _LIBCPP_HIDDEN static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
+
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value);
+ _LIBCPP_HIDE_FROM_ABI void __move_assign(list& __c, false_type);
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(_InputIterator, _InputIterator)
- -> list<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(_InputIterator, _InputIterator, _Alloc)
- -> list<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+list(_InputIterator, _InputIterator) -> list<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+list(_InputIterator, _InputIterator, _Alloc) -> list<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-list(from_range_t, _Range&&, _Alloc = _Alloc())
- -> list<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+list(from_range_t, _Range&&, _Alloc = _Alloc()) -> list<ranges::range_value_t<_Range>, _Alloc>;
#endif
// Link in nodes [__f, __l] just prior to __p
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l)
-{
- __p->__prev_->__next_ = __f;
- __f->__prev_ = __p->__prev_;
- __p->__prev_ = __l;
- __l->__next_ = __p;
+inline void list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l) {
+ __p->__prev_->__next_ = __f;
+ __f->__prev_ = __p->__prev_;
+ __p->__prev_ = __l;
+ __l->__next_ = __p;
}
// Link in nodes [__f, __l] at the front of the list
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l)
-{
- __f->__prev_ = base::__end_as_link();
- __l->__next_ = base::__end_.__next_;
- __l->__next_->__prev_ = __l;
- base::__end_.__next_ = __f;
+inline void list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l) {
+ __f->__prev_ = base::__end_as_link();
+ __l->__next_ = base::__end_.__next_;
+ __l->__next_->__prev_ = __l;
+ base::__end_.__next_ = __f;
}
// Link in nodes [__f, __l] at the back of the list
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l)
-{
- __l->__next_ = base::__end_as_link();
- __f->__prev_ = base::__end_.__prev_;
- __f->__prev_->__next_ = __f;
- base::__end_.__prev_ = __l;
+inline void list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l) {
+ __l->__next_ = base::__end_as_link();
+ __f->__prev_ = base::__end_.__prev_;
+ __f->__prev_->__next_ = __f;
+ base::__end_.__prev_ = __l;
}
-
template <class _Tp, class _Alloc>
-inline
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::__iterator(size_type __n)
-{
- return __n <= base::__sz() / 2 ? std::next(begin(), __n)
- : std::prev(end(), base::__sz() - __n);
+inline typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::__iterator(size_type __n) {
+ return __n <= base::__sz() / 2 ? std::next(begin(), __n) : std::prev(end(), base::__sz() - __n);
}
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n)
-{
- for (; __n > 0; --__n)
+list<_Tp, _Alloc>::list(size_type __n) {
+ for (; __n > 0; --__n)
#ifndef _LIBCPP_CXX03_LANG
- emplace_back();
+ emplace_back();
#else
- push_back(value_type());
+ push_back(value_type());
#endif
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
-{
- for (; __n > 0; --__n)
- emplace_back();
+list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) {
+ for (; __n > 0; --__n)
+ emplace_back();
}
#endif
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
-{
- for (; __n > 0; --__n)
- push_back(__x);
+list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) {
+ for (; __n > 0; --__n)
+ push_back(__x);
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
-{
- for (; __f != __l; ++__f)
- __emplace_back(*__f);
+list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) {
+ for (; __f != __l; ++__f)
+ __emplace_back(*__f);
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
+list<_Tp, _Alloc>::list(_InpIter __f,
+ _InpIter __l,
+ const allocator_type& __a,
__enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
- : base(__a)
-{
- for (; __f != __l; ++__f)
- __emplace_back(*__f);
+ : base(__a) {
+ for (; __f != __l; ++__f)
+ __emplace_back(*__f);
}
template <class _Tp, class _Alloc>
list<_Tp, _Alloc>::list(const list& __c)
- : base(__node_alloc_traits::select_on_container_copy_construction(
- __c.__node_alloc())) {
- for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
- push_back(*__i);
+ : base(__node_alloc_traits::select_on_container_copy_construction(__c.__node_alloc())) {
+ for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
+ push_back(*__i);
}
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(const list& __c, const __type_identity_t<allocator_type>& __a)
- : base(__a)
-{
- for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
- push_back(*__i);
+list<_Tp, _Alloc>::list(const list& __c, const __type_identity_t<allocator_type>& __a) : base(__a) {
+ for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
+ push_back(*__i);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
- : base(__a)
-{
- for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
- __e = __il.end(); __i != __e; ++__i)
- push_back(*__i);
+list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a) : base(__a) {
+ for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i)
+ push_back(*__i);
}
template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
-{
- for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
- __e = __il.end(); __i != __e; ++__i)
- push_back(*__i);
+list<_Tp, _Alloc>::list(initializer_list<value_type> __il) {
+ for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i)
+ push_back(*__i);
}
template <class _Tp, class _Alloc>
-inline list<_Tp, _Alloc>::list(list&& __c)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
- : base(std::move(__c.__node_alloc())) {
- splice(end(), __c);
+inline list<_Tp, _Alloc>::list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+ : base(std::move(__c.__node_alloc())) {
+ splice(end(), __c);
}
template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t<allocator_type>& __a)
- : base(__a)
-{
- if (__a == __c.get_allocator())
- splice(end(), __c);
- else
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
+inline list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t<allocator_type>& __a) : base(__a) {
+ if (__a == __c.get_allocator())
+ splice(end(), __c);
+ else {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ }
}
template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>&
-list<_Tp, _Alloc>::operator=(list&& __c)
- _NOEXCEPT_(
- __node_alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<__node_allocator>::value)
-{
- __move_assign(__c, integral_constant<bool,
- __node_alloc_traits::propagate_on_container_move_assignment::value>());
- return *this;
+inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(list&& __c)
+ _NOEXCEPT_(__node_alloc_traits::propagate_on_container_move_assignment::value&&
+ is_nothrow_move_assignable<__node_allocator>::value) {
+ __move_assign(__c, integral_constant<bool, __node_alloc_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
-{
- if (base::__node_alloc() != __c.__node_alloc())
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
- else
- __move_assign(__c, true_type());
+void list<_Tp, _Alloc>::__move_assign(list& __c, false_type) {
+ if (base::__node_alloc() != __c.__node_alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ } else
+ __move_assign(__c, true_type());
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
-{
- clear();
- base::__move_assign_alloc(__c);
- splice(end(), __c);
+void list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+ clear();
+ base::__move_assign_alloc(__c);
+ splice(end(), __c);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>&
-list<_Tp, _Alloc>::operator=(const list& __c)
-{
- if (this != std::addressof(__c))
- {
- base::__copy_assign_alloc(__c);
- assign(__c.begin(), __c.end());
- }
- return *this;
+inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list& __c) {
+ if (this != std::addressof(__c)) {
+ base::__copy_assign_alloc(__c);
+ assign(__c.begin(), __c.end());
+ }
+ return *this;
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-void
-list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
-{
+void list<_Tp, _Alloc>::assign(
+ _InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) {
__assign_with_sentinel(__f, __l);
}
template <class _Tp, class _Alloc>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-void list<_Tp, _Alloc>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
- iterator __i = begin();
- iterator __e = end();
- for (; __f != __l && __i != __e; ++__f, (void) ++__i)
- *__i = *__f;
- if (__i == __e)
- __insert_with_sentinel(__e, std::move(__f), std::move(__l));
- else
- erase(__i, __e);
+_LIBCPP_HIDE_FROM_ABI void list<_Tp, _Alloc>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __f != __l && __i != __e; ++__f, (void)++__i)
+ *__i = *__f;
+ if (__i == __e)
+ __insert_with_sentinel(__e, std::move(__f), std::move(__l));
+ else
+ erase(__i, __e);
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
-{
- iterator __i = begin();
- iterator __e = end();
- for (; __n > 0 && __i != __e; --__n, (void) ++__i)
- *__i = __x;
- if (__i == __e)
- insert(__e, __n, __x);
- else
- erase(__i, __e);
+void list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x) {
+ iterator __i = begin();
+ iterator __e = end();
+ for (; __n > 0 && __i != __e; --__n, (void)++__i)
+ *__i = __x;
+ if (__i == __e)
+ insert(__e, __n, __x);
+ else
+ erase(__i, __e);
}
template <class _Tp, class _Alloc>
-inline
-_Alloc
-list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT
-{
- return allocator_type(base::__node_alloc());
+inline _Alloc list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT {
+ return allocator_type(base::__node_alloc());
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- __link_nodes(__p.__ptr_, __node->__as_link(), __node->__as_link());
- ++base::__sz();
- return iterator(__node->__as_link());
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ __link_nodes(__p.__ptr_, __node->__as_link(), __node->__as_link());
+ ++base::__sz();
+ return iterator(__node->__as_link());
}
template <class _Tp, class _Alloc>
typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x)
-{
- iterator __r(__p.__ptr_);
- if (__n > 0)
- {
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- ++__ds;
- __r = iterator(__node->__as_link());
- iterator __e = __r;
+list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x) {
+ iterator __r(__p.__ptr_);
+ if (__n > 0) {
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ ++__ds;
+ __r = iterator(__node->__as_link());
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr, __x)->__as_link();
- }
+ for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
+ return __r;
}
template <class _Tp, class _Alloc>
template <class _InpIter>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
- __enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
-{
- return __insert_with_sentinel(__p, __f, __l);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(
+ const_iterator __p, _InpIter __f, _InpIter __l, __enable_if_t<__has_input_iterator_category<_InpIter>::value>*) {
+ return __insert_with_sentinel(__p, __f, __l);
}
template <class _Tp, class _Alloc>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI
-typename list<_Tp, _Alloc>::iterator
+_LIBCPP_HIDE_FROM_ABI typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l) {
- iterator __r(__p.__ptr_);
- if (__f != __l)
- {
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, *__f);
- ++__ds;
- __r = iterator(__node->__as_link());
- iterator __e = __r;
+ iterator __r(__p.__ptr_);
+ if (__f != __l) {
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, *__f);
+ ++__ds;
+ __r = iterator(__node->__as_link());
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (++__f; __f != __l; ++__f, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr, *__f)->__as_link();
- }
+ for (++__f; __f != __l; ++__f, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, *__f)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
- return __r;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
+ return __r;
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_front(const value_type& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_front(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_front(const value_type& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_front(__nl, __nl);
+ ++base::__sz();
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_back(const value_type& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_back(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_back(const value_type& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_back(__nl, __nl);
+ ++base::__sz();
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_front(value_type&& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::move(__x));
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_front(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_front(value_type&& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x));
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_front(__nl, __nl);
+ ++base::__sz();
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::push_back(value_type&& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::move(__x));
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_back(__nl, __nl);
- ++base::__sz();
+void list<_Tp, _Alloc>::push_back(value_type&& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x));
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_back(__nl, __nl);
+ ++base::__sz();
}
template <class _Tp, class _Alloc>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename list<_Tp, _Alloc>::reference
-#else
+# else
void
-#endif
-list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::forward<_Args>(__args)...);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_front(__nl, __nl);
- ++base::__sz();
-#if _LIBCPP_STD_VER >= 17
- return __node->__get_value();
-#endif
+# endif
+list<_Tp, _Alloc>::emplace_front(_Args&&... __args) {
+ __node_pointer __node =
+ this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_front(__nl, __nl);
+ ++base::__sz();
+# if _LIBCPP_STD_VER >= 17
+ return __node->__get_value();
+# endif
}
template <class _Tp, class _Alloc>
template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
typename list<_Tp, _Alloc>::reference
-#else
+# else
void
-#endif
-list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::forward<_Args>(__args)...);
- __link_pointer __nl = __node->__as_link();
- __link_nodes_at_back(__nl, __nl);
- ++base::__sz();
-#if _LIBCPP_STD_VER >= 17
- return __node->__get_value();
-#endif
+# endif
+list<_Tp, _Alloc>::emplace_back(_Args&&... __args) {
+ __node_pointer __node =
+ this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes_at_back(__nl, __nl);
+ ++base::__sz();
+# if _LIBCPP_STD_VER >= 17
+ return __node->__get_value();
+# endif
}
template <class _Tp, class _Alloc>
template <class... _Args>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::forward<_Args>(__args)...);
- __link_pointer __nl = __node->__as_link();
- __link_nodes(__p.__ptr_, __nl, __nl);
- ++base::__sz();
- return iterator(__nl);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) {
+ __node_pointer __node =
+ this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...);
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes(__p.__ptr_, __nl, __nl);
+ ++base::__sz();
+ return iterator(__nl);
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
-{
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, std::move(__x));
- __link_pointer __nl = __node->__as_link();
- __link_nodes(__p.__ptr_, __nl, __nl);
- ++base::__sz();
- return iterator(__nl);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) {
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x));
+ __link_pointer __nl = __node->__as_link();
+ __link_nodes(__p.__ptr_, __nl, __nl);
+ ++base::__sz();
+ return iterator(__nl);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::pop_front()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_front() called with empty list");
- __link_pointer __n = base::__end_.__next_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
- this->__delete_node(__n->__as_node());
+void list<_Tp, _Alloc>::pop_front() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_front() called with empty list");
+ __link_pointer __n = base::__end_.__next_;
+ base::__unlink_nodes(__n, __n);
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_back() called on an empty list");
- __link_pointer __n = base::__end_.__prev_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
- this->__delete_node(__n->__as_node());
+void list<_Tp, _Alloc>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_back() called on an empty list");
+ __link_pointer __n = base::__end_.__prev_;
+ base::__unlink_nodes(__n, __n);
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::erase(const_iterator __p)
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p != end(),
- "list::erase(iterator) called with a non-dereferenceable iterator");
- __link_pointer __n = __p.__ptr_;
- __link_pointer __r = __n->__next_;
- base::__unlink_nodes(__n, __n);
- --base::__sz();
- this->__delete_node(__n->__as_node());
- return iterator(__r);
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __p) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p != end(), "list::erase(iterator) called with a non-dereferenceable iterator");
+ __link_pointer __n = __p.__ptr_;
+ __link_pointer __r = __n->__next_;
+ base::__unlink_nodes(__n, __n);
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
+ return iterator(__r);
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
-{
- if (__f != __l)
- {
- base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
- while (__f != __l)
- {
- __link_pointer __n = __f.__ptr_;
- ++__f;
- --base::__sz();
- this->__delete_node(__n->__as_node());
- }
+typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) {
+ if (__f != __l) {
+ base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
+ while (__f != __l) {
+ __link_pointer __n = __f.__ptr_;
+ ++__f;
+ --base::__sz();
+ this->__delete_node(__n->__as_node());
}
- return iterator(__l.__ptr_);
+ }
+ return iterator(__l.__ptr_);
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::resize(size_type __n)
-{
- if (__n < base::__sz())
- erase(__iterator(__n), end());
- else if (__n > base::__sz())
- {
- __n -= base::__sz();
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr);
- ++__ds;
- iterator __r = iterator(__node->__as_link());
- iterator __e = __r;
+void list<_Tp, _Alloc>::resize(size_type __n) {
+ if (__n < base::__sz())
+ erase(__iterator(__n), end());
+ else if (__n > base::__sz()) {
+ __n -= base::__sz();
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr);
+ ++__ds;
+ iterator __r = iterator(__node->__as_link());
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr)->__as_link();
- }
+ for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes_at_back(__r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes_at_back(__r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
-{
- if (__n < base::__sz())
- erase(__iterator(__n), end());
- else if (__n > base::__sz())
- {
- __n -= base::__sz();
- size_type __ds = 0;
- __node_pointer __node = this->__create_node(/* prev = */nullptr, /* next = */nullptr, __x);
- ++__ds;
- __link_pointer __nl = __node->__as_link();
- iterator __r = iterator(__nl);
- iterator __e = __r;
+void list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) {
+ if (__n < base::__sz())
+ erase(__iterator(__n), end());
+ else if (__n > base::__sz()) {
+ __n -= base::__sz();
+ size_type __ds = 0;
+ __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x);
+ ++__ds;
+ __link_pointer __nl = __node->__as_link();
+ iterator __r = iterator(__nl);
+ iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (--__n; __n != 0; --__n, (void) ++__e, ++__ds)
- {
- __e.__ptr_->__next_ = this->__create_node(/* prev = */__e.__ptr_, /* next = */nullptr, __x)->__as_link();
- }
+ for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
+ __e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- while (true)
- {
- __link_pointer __prev = __e.__ptr_->__prev_;
- __node_pointer __current = __e.__ptr_->__as_node();
- this->__delete_node(__current);
- if (__prev == 0)
- break;
- __e = iterator(__prev);
- }
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_);
- base::__sz() += __ds;
+ } catch (...) {
+ while (true) {
+ __link_pointer __prev = __e.__ptr_->__prev_;
+ __node_pointer __current = __e.__ptr_->__as_node();
+ this->__delete_node(__current);
+ if (__prev == 0)
+ break;
+ __e = iterator(__prev);
+ }
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_);
+ base::__sz() += __ds;
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
-{
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(this != std::addressof(__c),
- "list::splice(iterator, list) called with this == &list");
- if (!__c.empty())
- {
- __link_pointer __f = __c.__end_.__next_;
- __link_pointer __l = __c.__end_.__prev_;
- base::__unlink_nodes(__f, __l);
- __link_nodes(__p.__ptr_, __f, __l);
- base::__sz() += __c.__sz();
- __c.__sz() = 0;
- }
+void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(
+ this != std::addressof(__c), "list::splice(iterator, list) called with this == &list");
+ if (!__c.empty()) {
+ __link_pointer __f = __c.__end_.__next_;
+ __link_pointer __l = __c.__end_.__prev_;
+ base::__unlink_nodes(__f, __l);
+ __link_nodes(__p.__ptr_, __f, __l);
+ base::__sz() += __c.__sz();
+ __c.__sz() = 0;
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
-{
- if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
- {
- __link_pointer __f = __i.__ptr_;
- base::__unlink_nodes(__f, __f);
- __link_nodes(__p.__ptr_, __f, __f);
- --__c.__sz();
- ++base::__sz();
- }
+void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) {
+ if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) {
+ __link_pointer __f = __i.__ptr_;
+ base::__unlink_nodes(__f, __f);
+ __link_nodes(__p.__ptr_, __f, __f);
+ --__c.__sz();
+ ++base::__sz();
+ }
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l)
-{
- if (__f != __l)
- {
- __link_pointer __first = __f.__ptr_;
- --__l;
- __link_pointer __last = __l.__ptr_;
- if (this != std::addressof(__c))
- {
- size_type __s = std::distance(__f, __l) + 1;
- __c.__sz() -= __s;
- base::__sz() += __s;
- }
- base::__unlink_nodes(__first, __last);
- __link_nodes(__p.__ptr_, __first, __last);
+void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) {
+ if (__f != __l) {
+ __link_pointer __first = __f.__ptr_;
+ --__l;
+ __link_pointer __last = __l.__ptr_;
+ if (this != std::addressof(__c)) {
+ size_type __s = std::distance(__f, __l) + 1;
+ __c.__sz() -= __s;
+ base::__sz() += __s;
}
+ base::__unlink_nodes(__first, __last);
+ __link_nodes(__p.__ptr_, __first, __last);
+ }
}
template <class _Tp, class _Alloc>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::remove(const value_type& __x)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (const_iterator __i = begin(), __e = end(); __i != __e;)
- {
- if (*__i == __x)
- {
- const_iterator __j = std::next(__i);
- for (; __j != __e && *__j == __x; ++__j)
- ;
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- if (__i != __e)
- ++__i;
- }
- else
- ++__i;
- }
+typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::remove(const value_type& __x) {
+ list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ for (const_iterator __i = begin(), __e = end(); __i != __e;) {
+ if (*__i == __x) {
+ const_iterator __j = std::next(__i);
+ for (; __j != __e && *__j == __x; ++__j)
+ ;
+ __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+ __i = __j;
+ if (__i != __e)
+ ++__i;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __deleted_nodes.size();
+ return (__remove_return_type)__deleted_nodes.size();
}
template <class _Tp, class _Alloc>
template <class _Pred>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::remove_if(_Pred __pred)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- if (__pred(*__i))
- {
- iterator __j = std::next(__i);
- for (; __j != __e && __pred(*__j); ++__j)
- ;
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- if (__i != __e)
- ++__i;
- }
- else
- ++__i;
- }
+typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::remove_if(_Pred __pred) {
+ list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ for (iterator __i = begin(), __e = end(); __i != __e;) {
+ if (__pred(*__i)) {
+ iterator __j = std::next(__i);
+ for (; __j != __e && __pred(*__j); ++__j)
+ ;
+ __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+ __i = __j;
+ if (__i != __e)
+ ++__i;
+ } else
+ ++__i;
+ }
- return (__remove_return_type) __deleted_nodes.size();
+ return (__remove_return_type)__deleted_nodes.size();
}
template <class _Tp, class _Alloc>
template <class _BinaryPred>
-typename list<_Tp, _Alloc>::__remove_return_type
-list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
-{
- list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
- for (iterator __i = begin(), __e = end(); __i != __e;)
- {
- iterator __j = std::next(__i);
- for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
- ;
- if (++__i != __j) {
- __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
- __i = __j;
- }
+typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred) {
+ list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
+ for (iterator __i = begin(), __e = end(); __i != __e;) {
+ iterator __j = std::next(__i);
+ for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
+ ;
+ if (++__i != __j) {
+ __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
+ __i = __j;
}
+ }
- return (__remove_return_type) __deleted_nodes.size();
+ return (__remove_return_type)__deleted_nodes.size();
}
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::merge(list& __c)
-{
- merge(__c, __less<>());
+inline void list<_Tp, _Alloc>::merge(list& __c) {
+ merge(__c, __less<>());
}
template <class _Tp, class _Alloc>
template <class _Comp>
-void
-list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
-{
- if (this != std::addressof(__c))
- {
- iterator __f1 = begin();
- iterator __e1 = end();
- iterator __f2 = __c.begin();
- iterator __e2 = __c.end();
- while (__f1 != __e1 && __f2 != __e2)
- {
- if (__comp(*__f2, *__f1))
- {
- size_type __ds = 1;
- iterator __m2 = std::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, (void) ++__ds)
- ;
- base::__sz() += __ds;
- __c.__sz() -= __ds;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = std::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- }
- splice(__e1, __c);
+void list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) {
+ if (this != std::addressof(__c)) {
+ iterator __f1 = begin();
+ iterator __e1 = end();
+ iterator __f2 = __c.begin();
+ iterator __e2 = __c.end();
+ while (__f1 != __e1 && __f2 != __e2) {
+ if (__comp(*__f2, *__f1)) {
+ size_type __ds = 1;
+ iterator __m2 = std::next(__f2);
+ for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, (void)++__ds)
+ ;
+ base::__sz() += __ds;
+ __c.__sz() -= __ds;
+ __link_pointer __f = __f2.__ptr_;
+ __link_pointer __l = __m2.__ptr_->__prev_;
+ __f2 = __m2;
+ base::__unlink_nodes(__f, __l);
+ __m2 = std::next(__f1);
+ __link_nodes(__f1.__ptr_, __f, __l);
+ __f1 = __m2;
+ } else
+ ++__f1;
}
+ splice(__e1, __c);
+ }
}
template <class _Tp, class _Alloc>
-inline
-void
-list<_Tp, _Alloc>::sort()
-{
- sort(__less<>());
+inline void list<_Tp, _Alloc>::sort() {
+ sort(__less<>());
}
template <class _Tp, class _Alloc>
template <class _Comp>
-inline
-void
-list<_Tp, _Alloc>::sort(_Comp __comp)
-{
- __sort(begin(), end(), base::__sz(), __comp);
+inline void list<_Tp, _Alloc>::sort(_Comp __comp) {
+ __sort(begin(), end(), base::__sz(), __comp);
}
template <class _Tp, class _Alloc>
template <class _Comp>
typename list<_Tp, _Alloc>::iterator
-list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp)
-{
- switch (__n)
- {
- case 0:
- case 1:
- return __f1;
- case 2:
- if (__comp(*--__e2, *__f1))
- {
- __link_pointer __f = __e2.__ptr_;
- base::__unlink_nodes(__f, __f);
- __link_nodes(__f1.__ptr_, __f, __f);
- return __e2;
- }
- return __f1;
+list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp) {
+ switch (__n) {
+ case 0:
+ case 1:
+ return __f1;
+ case 2:
+ if (__comp(*--__e2, *__f1)) {
+ __link_pointer __f = __e2.__ptr_;
+ base::__unlink_nodes(__f, __f);
+ __link_nodes(__f1.__ptr_, __f, __f);
+ return __e2;
}
- size_type __n2 = __n / 2;
- iterator __e1 = std::next(__f1, __n2);
- iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
- iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
- if (__comp(*__f2, *__f1))
- {
- iterator __m2 = std::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
- ;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- __r = __f2;
- __e1 = __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = std::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- while (__f1 != __e1 && __f2 != __e2)
- {
- if (__comp(*__f2, *__f1))
- {
- iterator __m2 = std::next(__f2);
- for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
- ;
- __link_pointer __f = __f2.__ptr_;
- __link_pointer __l = __m2.__ptr_->__prev_;
- if (__e1 == __f2)
- __e1 = __m2;
- __f2 = __m2;
- base::__unlink_nodes(__f, __l);
- __m2 = std::next(__f1);
- __link_nodes(__f1.__ptr_, __f, __l);
- __f1 = __m2;
- }
- else
- ++__f1;
- }
- return __r;
+ return __f1;
+ }
+ size_type __n2 = __n / 2;
+ iterator __e1 = std::next(__f1, __n2);
+ iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
+ iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
+ if (__comp(*__f2, *__f1)) {
+ iterator __m2 = std::next(__f2);
+ for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
+ ;
+ __link_pointer __f = __f2.__ptr_;
+ __link_pointer __l = __m2.__ptr_->__prev_;
+ __r = __f2;
+ __e1 = __f2 = __m2;
+ base::__unlink_nodes(__f, __l);
+ __m2 = std::next(__f1);
+ __link_nodes(__f1.__ptr_, __f, __l);
+ __f1 = __m2;
+ } else
+ ++__f1;
+ while (__f1 != __e1 && __f2 != __e2) {
+ if (__comp(*__f2, *__f1)) {
+ iterator __m2 = std::next(__f2);
+ for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
+ ;
+ __link_pointer __f = __f2.__ptr_;
+ __link_pointer __l = __m2.__ptr_->__prev_;
+ if (__e1 == __f2)
+ __e1 = __m2;
+ __f2 = __m2;
+ base::__unlink_nodes(__f, __l);
+ __m2 = std::next(__f1);
+ __link_nodes(__f1.__ptr_, __f, __l);
+ __f1 = __m2;
+ } else
+ ++__f1;
+ }
+ return __r;
}
template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::reverse() _NOEXCEPT
-{
- if (base::__sz() > 1)
- {
- iterator __e = end();
- for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;)
- {
- std::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
- __i.__ptr_ = __i.__ptr_->__prev_;
- }
- std::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
+void list<_Tp, _Alloc>::reverse() _NOEXCEPT {
+ if (base::__sz() > 1) {
+ iterator __e = end();
+ for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;) {
+ std::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
+ __i.__ptr_ = __i.__ptr_->__prev_;
}
+ std::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
+ }
}
template <class _Tp, class _Alloc>
-bool
-list<_Tp, _Alloc>::__invariants() const
-{
- return size() == std::distance(begin(), end());
+bool list<_Tp, _Alloc>::__invariants() const {
+ return size() == std::distance(begin(), end());
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -2048,19 +1701,16 @@ operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const list<_Tp, _Allocator>& __x, const list<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
@@ -2078,10 +1728,10 @@ erase(list<_Tp, _Allocator>& __c, const _Up& __v) {
template <>
inline constexpr bool __format::__enable_insertable<std::list<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<std::list<wchar_t>> = true;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/locale b/contrib/llvm-project/libcxx/include/locale
index 56fa8db91d2b..70d22ff95e1e 100644
--- a/contrib/llvm-project/libcxx/include/locale
+++ b/contrib/llvm-project/libcxx/include/locale
@@ -236,7 +236,6 @@ template <class charT> class messages_byname;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
@@ -245,9 +244,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
#else
# define _LIBCPP_GET_C_LOCALE __cloc()
- // Get the C locale object
- _LIBCPP_EXPORTED_FROM_ABI locale_t __cloc();
-#define __cloc_defined
+// Get the C locale object
+_LIBCPP_EXPORTED_FROM_ABI locale_t __cloc();
+# define __cloc_defined
#endif
// __scan_keyword
@@ -269,204 +268,201 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// If the input is "a", the first keyword matches and eofbit is set.
// If the input is "abc", no match is found and "ab" are consumed.
template <class _InputIterator, class _ForwardIterator, class _Ctype>
-_LIBCPP_HIDE_FROM_ABI
-_ForwardIterator
-__scan_keyword(_InputIterator& __b, _InputIterator __e,
- _ForwardIterator __kb, _ForwardIterator __ke,
- const _Ctype& __ct, ios_base::iostate& __err,
- bool __case_sensitive = true)
-{
- typedef typename iterator_traits<_InputIterator>::value_type _CharT;
- size_t __nkw = static_cast<size_t>(std::distance(__kb, __ke));
- const unsigned char __doesnt_match = '\0';
- const unsigned char __might_match = '\1';
- const unsigned char __does_match = '\2';
- unsigned char __statbuf[100];
- unsigned char* __status = __statbuf;
- unique_ptr<unsigned char, void(*)(void*)> __stat_hold(nullptr, free);
- if (__nkw > sizeof(__statbuf))
- {
- __status = (unsigned char*)malloc(__nkw);
- if (__status == nullptr)
- __throw_bad_alloc();
- __stat_hold.reset(__status);
- }
- size_t __n_might_match = __nkw; // At this point, any keyword might match
- size_t __n_does_match = 0; // but none of them definitely do
- // Initialize all statuses to __might_match, except for "" keywords are __does_match
- unsigned char* __st = __status;
- for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
- {
- if (!__ky->empty())
- *__st = __might_match;
- else
- {
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator __scan_keyword(
+ _InputIterator& __b,
+ _InputIterator __e,
+ _ForwardIterator __kb,
+ _ForwardIterator __ke,
+ const _Ctype& __ct,
+ ios_base::iostate& __err,
+ bool __case_sensitive = true) {
+ typedef typename iterator_traits<_InputIterator>::value_type _CharT;
+ size_t __nkw = static_cast<size_t>(std::distance(__kb, __ke));
+ const unsigned char __doesnt_match = '\0';
+ const unsigned char __might_match = '\1';
+ const unsigned char __does_match = '\2';
+ unsigned char __statbuf[100];
+ unsigned char* __status = __statbuf;
+ unique_ptr<unsigned char, void (*)(void*)> __stat_hold(nullptr, free);
+ if (__nkw > sizeof(__statbuf)) {
+ __status = (unsigned char*)malloc(__nkw);
+ if (__status == nullptr)
+ __throw_bad_alloc();
+ __stat_hold.reset(__status);
+ }
+ size_t __n_might_match = __nkw; // At this point, any keyword might match
+ size_t __n_does_match = 0; // but none of them definitely do
+ // Initialize all statuses to __might_match, except for "" keywords are __does_match
+ unsigned char* __st = __status;
+ for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void)++__st) {
+ if (!__ky->empty())
+ *__st = __might_match;
+ else {
+ *__st = __does_match;
+ --__n_might_match;
+ ++__n_does_match;
+ }
+ }
+ // While there might be a match, test keywords against the next CharT
+ for (size_t __indx = 0; __b != __e && __n_might_match > 0; ++__indx) {
+ // Peek at the next CharT but don't consume it
+ _CharT __c = *__b;
+ if (!__case_sensitive)
+ __c = __ct.toupper(__c);
+ bool __consume = false;
+ // For each keyword which might match, see if the __indx character is __c
+ // If a match if found, consume __c
+ // If a match is found, and that is the last character in the keyword,
+ // then that keyword matches.
+ // If the keyword doesn't match this character, then change the keyword
+ // to doesn't match
+ __st = __status;
+ for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void)++__st) {
+ if (*__st == __might_match) {
+ _CharT __kc = (*__ky)[__indx];
+ if (!__case_sensitive)
+ __kc = __ct.toupper(__kc);
+ if (__c == __kc) {
+ __consume = true;
+ if (__ky->size() == __indx + 1) {
*__st = __does_match;
--__n_might_match;
++__n_does_match;
+ }
+ } else {
+ *__st = __doesnt_match;
+ --__n_might_match;
}
- }
- // While there might be a match, test keywords against the next CharT
- for (size_t __indx = 0; __b != __e && __n_might_match > 0; ++__indx)
- {
- // Peek at the next CharT but don't consume it
- _CharT __c = *__b;
- if (!__case_sensitive)
- __c = __ct.toupper(__c);
- bool __consume = false;
- // For each keyword which might match, see if the __indx character is __c
- // If a match if found, consume __c
- // If a match is found, and that is the last character in the keyword,
- // then that keyword matches.
- // If the keyword doesn't match this character, then change the keyword
- // to doesn't match
+ }
+ }
+ // consume if we matched a character
+ if (__consume) {
+ ++__b;
+ // If we consumed a character and there might be a matched keyword that
+ // was marked matched on a previous iteration, then such keywords
+ // which are now marked as not matching.
+ if (__n_might_match + __n_does_match > 1) {
__st = __status;
- for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
- {
- if (*__st == __might_match)
- {
- _CharT __kc = (*__ky)[__indx];
- if (!__case_sensitive)
- __kc = __ct.toupper(__kc);
- if (__c == __kc)
- {
- __consume = true;
- if (__ky->size() == __indx+1)
- {
- *__st = __does_match;
- --__n_might_match;
- ++__n_does_match;
- }
- }
- else
- {
- *__st = __doesnt_match;
- --__n_might_match;
- }
- }
- }
- // consume if we matched a character
- if (__consume)
- {
- ++__b;
- // If we consumed a character and there might be a matched keyword that
- // was marked matched on a previous iteration, then such keywords
- // which are now marked as not matching.
- if (__n_might_match + __n_does_match > 1)
- {
- __st = __status;
- for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
- {
- if (*__st == __does_match && __ky->size() != __indx+1)
- {
- *__st = __doesnt_match;
- --__n_does_match;
- }
- }
- }
+ for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void)++__st) {
+ if (*__st == __does_match && __ky->size() != __indx + 1) {
+ *__st = __doesnt_match;
+ --__n_does_match;
+ }
}
- }
- // We've exited the loop because we hit eof and/or we have no more "might matches".
- if (__b == __e)
- __err |= ios_base::eofbit;
- // Return the first matching result
- for (__st = __status; __kb != __ke; ++__kb, (void) ++__st)
- if (*__st == __does_match)
- break;
- if (__kb == __ke)
- __err |= ios_base::failbit;
- return __kb;
-}
-
-struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base
-{
- static const int __num_get_buf_sz = 40;
-
- static int __get_base(ios_base&);
- static const char __src[33];
+ }
+ }
+ }
+ // We've exited the loop because we hit eof and/or we have no more "might matches".
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ // Return the first matching result
+ for (__st = __status; __kb != __ke; ++__kb, (void)++__st)
+ if (*__st == __does_match)
+ break;
+ if (__kb == __ke)
+ __err |= ios_base::failbit;
+ return __kb;
+}
+
+struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base {
+ static const int __num_get_buf_sz = 40;
+
+ static int __get_base(ios_base&);
+ static const char __src[33];
};
-_LIBCPP_EXPORTED_FROM_ABI void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
- ios_base::iostate& __err);
+_LIBCPP_EXPORTED_FROM_ABI void
+__check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err);
template <class _CharT>
-struct __num_get
- : protected __num_get_base
-{
- static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point,
- _CharT& __thousands_sep);
-
- static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp,
- char* __a, char*& __a_end,
- _CharT __decimal_point, _CharT __thousands_sep,
- const string& __grouping, unsigned* __g,
- unsigned*& __g_end, unsigned& __dc, _CharT* __atoms);
+struct __num_get : protected __num_get_base {
+ static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep);
+
+ static int __stage2_float_loop(
+ _CharT __ct,
+ bool& __in_units,
+ char& __exp,
+ char* __a,
+ char*& __a_end,
+ _CharT __decimal_point,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ unsigned& __dc,
+ _CharT* __atoms);
#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
- static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
- static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
- unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
- unsigned* __g, unsigned*& __g_end, _CharT* __atoms);
+ static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
+ static int __stage2_int_loop(
+ _CharT __ct,
+ int __base,
+ char* __a,
+ char*& __a_end,
+ unsigned& __dc,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ _CharT* __atoms);
#else
- static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep)
- {
- locale __loc = __iob.getloc();
- const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
- __thousands_sep = __np.thousands_sep();
- return __np.grouping();
- }
-
- const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const
- {
- return __do_widen_p(__iob, __atoms);
- }
-
+ static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) {
+ locale __loc = __iob.getloc();
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+ __thousands_sep = __np.thousands_sep();
+ return __np.grouping();
+ }
+
+ const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const { return __do_widen_p(__iob, __atoms); }
+
+ static int __stage2_int_loop(
+ _CharT __ct,
+ int __base,
+ char* __a,
+ char*& __a_end,
+ unsigned& __dc,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ const _CharT* __atoms);
- static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
- unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
- unsigned* __g, unsigned*& __g_end, const _CharT* __atoms);
private:
- template<typename _Tp>
- const _Tp* __do_widen_p(ios_base& __iob, _Tp* __atoms) const
- {
- locale __loc = __iob.getloc();
- use_facet<ctype<_Tp> >(__loc).widen(__src, __src + 26, __atoms);
- return __atoms;
- }
-
- const char* __do_widen_p(ios_base& __iob, char* __atoms) const
- {
- (void)__iob;
- (void)__atoms;
- return __src;
- }
+ template <typename _Tp>
+ const _Tp* __do_widen_p(ios_base& __iob, _Tp* __atoms) const {
+ locale __loc = __iob.getloc();
+ use_facet<ctype<_Tp> >(__loc).widen(__src, __src + 26, __atoms);
+ return __atoms;
+ }
+
+ const char* __do_widen_p(ios_base& __iob, char* __atoms) const {
+ (void)__iob;
+ (void)__atoms;
+ return __src;
+ }
#endif
};
#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
template <class _CharT>
-string
-__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep)
-{
- locale __loc = __iob.getloc();
- std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms);
- const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
- __thousands_sep = __np.thousands_sep();
- return __np.grouping();
+string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) {
+ locale __loc = __iob.getloc();
+ std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms);
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
+ __thousands_sep = __np.thousands_sep();
+ return __np.grouping();
}
#endif
template <class _CharT>
-string
-__num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point,
- _CharT& __thousands_sep)
-{
- locale __loc = __iob.getloc();
- std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms);
- const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
- __decimal_point = __np.decimal_point();
- __thousands_sep = __np.thousands_sep();
- return __np.grouping();
+string __num_get<_CharT>::__stage2_float_prep(
+ ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep) {
+ locale __loc = __iob.getloc();
+ std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms);
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
+ __decimal_point = __np.decimal_point();
+ __thousands_sep = __np.thousands_sep();
+ return __np.grouping();
}
template <class _CharT>
@@ -482,104 +478,100 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
#endif
{
- if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
- {
- *__a_end++ = __ct == __atoms[24] ? '+' : '-';
- __dc = 0;
- return 0;
- }
- if (__grouping.size() != 0 && __ct == __thousands_sep)
- {
- if (__g_end-__g < __num_get_buf_sz)
- {
- *__g_end++ = __dc;
- __dc = 0;
- }
- return 0;
- }
- ptrdiff_t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms;
- if (__f >= 24)
- return -1;
- switch (__base)
- {
- case 8:
- case 10:
- if (__f >= __base)
- return -1;
- break;
- case 16:
- if (__f < 22)
- break;
- if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
- {
- __dc = 0;
- *__a_end++ = __src[__f];
- return 0;
- }
- return -1;
+ if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) {
+ *__a_end++ = __ct == __atoms[24] ? '+' : '-';
+ __dc = 0;
+ return 0;
+ }
+ if (__grouping.size() != 0 && __ct == __thousands_sep) {
+ if (__g_end - __g < __num_get_buf_sz) {
+ *__g_end++ = __dc;
+ __dc = 0;
}
- *__a_end++ = __src[__f];
- ++__dc;
return 0;
+ }
+ ptrdiff_t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms;
+ if (__f >= 24)
+ return -1;
+ switch (__base) {
+ case 8:
+ case 10:
+ if (__f >= __base)
+ return -1;
+ break;
+ case 16:
+ if (__f < 22)
+ break;
+ if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0') {
+ __dc = 0;
+ *__a_end++ = __src[__f];
+ return 0;
+ }
+ return -1;
+ }
+ *__a_end++ = __src[__f];
+ ++__dc;
+ return 0;
}
template <class _CharT>
-int
-__num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end,
- _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping,
- unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms)
-{
- if (__ct == __decimal_point)
- {
- if (!__in_units)
- return -1;
- __in_units = false;
- *__a_end++ = '.';
- if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz)
- *__g_end++ = __dc;
- return 0;
- }
- if (__ct == __thousands_sep && __grouping.size() != 0)
- {
- if (!__in_units)
- return -1;
- if (__g_end-__g < __num_get_buf_sz)
- {
- *__g_end++ = __dc;
- __dc = 0;
- }
- return 0;
+int __num_get<_CharT>::__stage2_float_loop(
+ _CharT __ct,
+ bool& __in_units,
+ char& __exp,
+ char* __a,
+ char*& __a_end,
+ _CharT __decimal_point,
+ _CharT __thousands_sep,
+ const string& __grouping,
+ unsigned* __g,
+ unsigned*& __g_end,
+ unsigned& __dc,
+ _CharT* __atoms) {
+ if (__ct == __decimal_point) {
+ if (!__in_units)
+ return -1;
+ __in_units = false;
+ *__a_end++ = '.';
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_buf_sz)
+ *__g_end++ = __dc;
+ return 0;
+ }
+ if (__ct == __thousands_sep && __grouping.size() != 0) {
+ if (!__in_units)
+ return -1;
+ if (__g_end - __g < __num_get_buf_sz) {
+ *__g_end++ = __dc;
+ __dc = 0;
}
- ptrdiff_t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms;
- if (__f >= 32)
- return -1;
- char __x = __src[__f];
- if (__x == '-' || __x == '+')
- {
- if (__a_end == __a || (std::toupper(__a_end[-1]) == std::toupper(__exp)))
- {
- *__a_end++ = __x;
- return 0;
- }
- return -1;
+ return 0;
+ }
+ ptrdiff_t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms;
+ if (__f >= 32)
+ return -1;
+ char __x = __src[__f];
+ if (__x == '-' || __x == '+') {
+ if (__a_end == __a || (std::toupper(__a_end[-1]) == std::toupper(__exp))) {
+ *__a_end++ = __x;
+ return 0;
}
- if (__x == 'x' || __x == 'X')
- __exp = 'P';
- else if (std::toupper(__x) == __exp)
- {
- __exp = std::tolower(__exp);
- if (__in_units)
- {
- __in_units = false;
- if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz)
- *__g_end++ = __dc;
- }
+ return -1;
+ }
+ if (__x == 'x' || __x == 'X')
+ __exp = 'P';
+ else if (std::toupper(__x) == __exp) {
+ __exp = std::tolower(__exp);
+ if (__in_units) {
+ __in_units = false;
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_buf_sz)
+ *__g_end++ = __dc;
}
- *__a_end++ = __x;
- if (__f >= 22)
- return 0;
- ++__dc;
+ }
+ *__a_end++ = __x;
+ if (__f >= 22)
return 0;
+ ++__dc;
+ return 0;
}
extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>;
@@ -588,537 +580,452 @@ extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>;
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS num_get
- : public locale::facet,
- private __num_get<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS num_get : public locale::facet, private __num_get<_CharT> {
public:
- typedef _CharT char_type;
- typedef _InputIterator iter_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit num_get(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, bool& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned short& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned int& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long long& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, float& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, double& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long double& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, void*& __v) const
- {
- return do_get(__b, __e, __iob, __err, __v);
- }
-
- static locale::id id;
+ typedef _CharT char_type;
+ typedef _InputIterator iter_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit num_get(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned short& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned int& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long long& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, float& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, double& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const {
+ return do_get(__b, __e, __iob, __err, __v);
+ }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_get() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_get() override {}
- template <class _Fp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- iter_type __do_get_floating_point
- (iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, _Fp& __v) const;
+ template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS iter_type
+ __do_get_floating_point(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Fp& __v) const;
- template <class _Signed>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- iter_type __do_get_signed
- (iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, _Signed& __v) const;
+ template <class _Signed>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS iter_type
+ __do_get_signed(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Signed& __v) const;
- template <class _Unsigned>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- iter_type __do_get_unsigned
- (iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, _Unsigned& __v) const;
+ template <class _Unsigned>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS iter_type
+ __do_get_unsigned(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Unsigned& __v) const;
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const;
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, bool& __v) const;
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long& __v) const {
+ return this->__do_get_signed(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long& __v) const
- { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long long& __v) const {
+ return this->__do_get_signed(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long long& __v) const
- { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned short& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned short& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned int& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned int& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long long& __v) const {
+ return this->__do_get_unsigned(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, unsigned long long& __v) const
- { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, float& __v) const {
+ return this->__do_get_floating_point(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, float& __v) const
- { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, double& __v) const {
+ return this->__do_get_floating_point(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, double& __v) const
- { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ return this->__do_get_floating_point(__b, __e, __iob, __err, __v);
+ }
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, long double& __v) const
- { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); }
-
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, void*& __v) const;
+ virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const;
};
template <class _CharT, class _InputIterator>
-locale::id
-num_get<_CharT, _InputIterator>::id;
+locale::id num_get<_CharT, _InputIterator>::id;
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _Tp
-__num_get_signed_integral(const char* __a, const char* __a_end,
- ios_base::iostate& __err, int __base)
-{
- if (__a != __a_end)
- {
- __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
- errno = 0;
- char *__p2;
- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
- __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
- if (__current_errno == 0)
- errno = __save_errno;
- if (__p2 != __a_end)
- {
- __err = ios_base::failbit;
- return 0;
- }
- else if (__current_errno == ERANGE ||
- __ll < numeric_limits<_Tp>::min() ||
- numeric_limits<_Tp>::max() < __ll)
- {
- __err = ios_base::failbit;
- if (__ll > 0)
- return numeric_limits<_Tp>::max();
- else
- return numeric_limits<_Tp>::min();
- }
- return static_cast<_Tp>(__ll);
- }
- __err = ios_base::failbit;
- return 0;
+__num_get_signed_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) {
+ if (__a != __a_end) {
+ __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
+ errno = 0;
+ char* __p2;
+ long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+ if (__p2 != __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ } else if (__current_errno == ERANGE || __ll < numeric_limits<_Tp>::min() || numeric_limits<_Tp>::max() < __ll) {
+ __err = ios_base::failbit;
+ if (__ll > 0)
+ return numeric_limits<_Tp>::max();
+ else
+ return numeric_limits<_Tp>::min();
+ }
+ return static_cast<_Tp>(__ll);
+ }
+ __err = ios_base::failbit;
+ return 0;
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _Tp
-__num_get_unsigned_integral(const char* __a, const char* __a_end,
- ios_base::iostate& __err, int __base)
-{
- if (__a != __a_end)
- {
- const bool __negate = *__a == '-';
- if (__negate && ++__a == __a_end) {
- __err = ios_base::failbit;
- return 0;
- }
- __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
- errno = 0;
- char *__p2;
- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
- __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
- if (__current_errno == 0)
- errno = __save_errno;
- if (__p2 != __a_end)
- {
- __err = ios_base::failbit;
- return 0;
- }
- else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll)
- {
- __err = ios_base::failbit;
- return numeric_limits<_Tp>::max();
- }
- _Tp __res = static_cast<_Tp>(__ll);
- if (__negate) __res = -__res;
- return __res;
- }
- __err = ios_base::failbit;
- return 0;
+__num_get_unsigned_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) {
+ if (__a != __a_end) {
+ const bool __negate = *__a == '-';
+ if (__negate && ++__a == __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ }
+ __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
+ errno = 0;
+ char* __p2;
+ unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+ if (__p2 != __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ } else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) {
+ __err = ios_base::failbit;
+ return numeric_limits<_Tp>::max();
+ }
+ _Tp __res = static_cast<_Tp>(__ll);
+ if (__negate)
+ __res = -__res;
+ return __res;
+ }
+ __err = ios_base::failbit;
+ return 0;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp __do_strtod(const char* __a, char** __p2);
+_LIBCPP_HIDE_FROM_ABI _Tp __do_strtod(const char* __a, char** __p2);
template <>
-inline _LIBCPP_HIDE_FROM_ABI
-float __do_strtod<float>(const char* __a, char** __p2) {
- return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+inline _LIBCPP_HIDE_FROM_ABI float __do_strtod<float>(const char* __a, char** __p2) {
+ return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <>
-inline _LIBCPP_HIDE_FROM_ABI
-double __do_strtod<double>(const char* __a, char** __p2) {
- return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+inline _LIBCPP_HIDE_FROM_ABI double __do_strtod<double>(const char* __a, char** __p2) {
+ return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <>
-inline _LIBCPP_HIDE_FROM_ABI
-long double __do_strtod<long double>(const char* __a, char** __p2) {
- return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+inline _LIBCPP_HIDE_FROM_ABI long double __do_strtod<long double>(const char* __a, char** __p2) {
+ return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp
-__num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
-{
- if (__a != __a_end)
- {
- __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
- errno = 0;
- char *__p2;
- _Tp __ld = std::__do_strtod<_Tp>(__a, &__p2);
- __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
- if (__current_errno == 0)
- errno = __save_errno;
- if (__p2 != __a_end)
- {
- __err = ios_base::failbit;
- return 0;
- }
- else if (__current_errno == ERANGE)
- __err = ios_base::failbit;
- return __ld;
- }
- __err = ios_base::failbit;
- return 0;
+_LIBCPP_HIDE_FROM_ABI _Tp __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) {
+ if (__a != __a_end) {
+ __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
+ errno = 0;
+ char* __p2;
+ _Tp __ld = std::__do_strtod<_Tp>(__a, &__p2);
+ __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+ if (__p2 != __a_end) {
+ __err = ios_base::failbit;
+ return 0;
+ } else if (__current_errno == ERANGE)
+ __err = ios_base::failbit;
+ return __ld;
+ }
+ __err = ios_base::failbit;
+ return 0;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- bool& __v) const
-{
- if ((__iob.flags() & ios_base::boolalpha) == 0)
- {
- long __lv = -1;
- __b = do_get(__b, __e, __iob, __err, __lv);
- switch (__lv)
- {
- case 0:
- __v = false;
- break;
- case 1:
- __v = true;
- break;
- default:
- __v = true;
- __err = ios_base::failbit;
- break;
- }
- return __b;
+_InputIterator num_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const {
+ if ((__iob.flags() & ios_base::boolalpha) == 0) {
+ long __lv = -1;
+ __b = do_get(__b, __e, __iob, __err, __lv);
+ switch (__lv) {
+ case 0:
+ __v = false;
+ break;
+ case 1:
+ __v = true;
+ break;
+ default:
+ __v = true;
+ __err = ios_base::failbit;
+ break;
}
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__iob.getloc());
- const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__iob.getloc());
- typedef typename numpunct<_CharT>::string_type string_type;
- const string_type __names[2] = {__np.truename(), __np.falsename()};
- const string_type* __i = std::__scan_keyword(__b, __e, __names, __names+2,
- __ct, __err);
- __v = __i == __names;
return __b;
+ }
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__iob.getloc());
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__iob.getloc());
+ typedef typename numpunct<_CharT>::string_type string_type;
+ const string_type __names[2] = {__np.truename(), __np.falsename()};
+ const string_type* __i = std::__scan_keyword(__b, __e, __names, __names + 2, __ct, __err);
+ __v = __i == __names;
+ return __b;
}
// signed
template <class _CharT, class _InputIterator>
template <class _Signed>
-_InputIterator
-num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- _Signed& __v) const
-{
- // Stage 1
- int __base = this->__get_base(__iob);
- // Stage 2
- char_type __thousands_sep;
- const int __atoms_size = 26;
+_InputIterator num_get<_CharT, _InputIterator>::__do_get_signed(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Signed& __v) const {
+ // Stage 1
+ int __base = this->__get_base(__iob);
+ // Stage 2
+ char_type __thousands_sep;
+ const int __atoms_size = 26;
#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
- char_type __atoms1[__atoms_size];
- const char_type *__atoms = this->__do_widen(__iob, __atoms1);
- string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
+ char_type __atoms1[__atoms_size];
+ const char_type* __atoms = this->__do_widen(__iob, __atoms1);
+ string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
#else
- char_type __atoms[__atoms_size];
- string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+ char_type __atoms[__atoms_size];
+ string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
#endif
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
- __thousands_sep, __grouping, __g, __g_end,
- __atoms))
- break;
- }
- if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
- *__g_end++ = __dc;
- // Stage 3
- __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
- // Digit grouping checked
- __check_grouping(__grouping, __g, __g_end, __err);
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms))
+ break;
+ }
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_base::__num_get_buf_sz)
+ *__g_end++ = __dc;
+ // Stage 3
+ __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
+ // Digit grouping checked
+ __check_grouping(__grouping, __g, __g_end, __err);
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
// unsigned
template <class _CharT, class _InputIterator>
template <class _Unsigned>
-_InputIterator
-num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- _Unsigned& __v) const
-{
- // Stage 1
- int __base = this->__get_base(__iob);
- // Stage 2
- char_type __thousands_sep;
- const int __atoms_size = 26;
+_InputIterator num_get<_CharT, _InputIterator>::__do_get_unsigned(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Unsigned& __v) const {
+ // Stage 1
+ int __base = this->__get_base(__iob);
+ // Stage 2
+ char_type __thousands_sep;
+ const int __atoms_size = 26;
#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
- char_type __atoms1[__atoms_size];
- const char_type *__atoms = this->__do_widen(__iob, __atoms1);
- string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
+ char_type __atoms1[__atoms_size];
+ const char_type* __atoms = this->__do_widen(__iob, __atoms1);
+ string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
#else
- char_type __atoms[__atoms_size];
- string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+ char_type __atoms[__atoms_size];
+ string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
#endif
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
- __thousands_sep, __grouping, __g, __g_end,
- __atoms))
- break;
- }
- if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
- *__g_end++ = __dc;
- // Stage 3
- __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
- // Digit grouping checked
- __check_grouping(__grouping, __g, __g_end, __err);
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms))
+ break;
+ }
+ if (__grouping.size() != 0 && __g_end - __g < __num_get_base::__num_get_buf_sz)
+ *__g_end++ = __dc;
+ // Stage 3
+ __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
+ // Digit grouping checked
+ __check_grouping(__grouping, __g, __g_end, __err);
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
// floating point
template <class _CharT, class _InputIterator>
template <class _Fp>
-_InputIterator
-num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- _Fp& __v) const
-{
- // Stage 1, nothing to do
- // Stage 2
- char_type __atoms[32];
- char_type __decimal_point;
- char_type __thousands_sep;
- string __grouping = this->__stage2_float_prep(__iob, __atoms,
- __decimal_point,
- __thousands_sep);
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- bool __in_units = true;
- char __exp = 'E';
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
- __decimal_point, __thousands_sep,
- __grouping, __g, __g_end,
- __dc, __atoms))
- break;
- }
- if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz)
- *__g_end++ = __dc;
- // Stage 3
- __v = std::__num_get_float<_Fp>(__a, __a_end, __err);
- // Digit grouping checked
- __check_grouping(__grouping, __g, __g_end, __err);
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+_InputIterator num_get<_CharT, _InputIterator>::__do_get_floating_point(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Fp& __v) const {
+ // Stage 1, nothing to do
+ // Stage 2
+ char_type __atoms[32];
+ char_type __decimal_point;
+ char_type __thousands_sep;
+ string __grouping = this->__stage2_float_prep(__iob, __atoms, __decimal_point, __thousands_sep);
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ bool __in_units = true;
+ char __exp = 'E';
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_float_loop(
+ *__b,
+ __in_units,
+ __exp,
+ __a,
+ __a_end,
+ __decimal_point,
+ __thousands_sep,
+ __grouping,
+ __g,
+ __g_end,
+ __dc,
+ __atoms))
+ break;
+ }
+ if (__grouping.size() != 0 && __in_units && __g_end - __g < __num_get_base::__num_get_buf_sz)
+ *__g_end++ = __dc;
+ // Stage 3
+ __v = std::__num_get_float<_Fp>(__a, __a_end, __err);
+ // Digit grouping checked
+ __check_grouping(__grouping, __g, __g_end, __err);
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- void*& __v) const
-{
- // Stage 1
- int __base = 16;
- // Stage 2
- char_type __atoms[26];
- char_type __thousands_sep = char_type();
- string __grouping;
- std::use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
- __num_get_base::__src + 26, __atoms);
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
- unsigned __g[__num_get_base::__num_get_buf_sz];
- unsigned* __g_end = __g;
- unsigned __dc = 0;
- for (; __b != __e; ++__b)
- {
- if (__a_end == __a + __buf.size())
- {
- size_t __tmp = __buf.size();
- __buf.resize(2*__buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
- }
- if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
- __thousands_sep, __grouping,
- __g, __g_end, __atoms))
- break;
- }
- // Stage 3
- __buf.resize(__a_end - __a);
- if (__libcpp_sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
- __err = ios_base::failbit;
- // EOF checked
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+_InputIterator num_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const {
+ // Stage 1
+ int __base = 16;
+ // Stage 2
+ char_type __atoms[26];
+ char_type __thousands_sep = char_type();
+ string __grouping;
+ std::use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, __num_get_base::__src + 26, __atoms);
+ string __buf;
+ __buf.resize(__buf.capacity());
+ char* __a = &__buf[0];
+ char* __a_end = __a;
+ unsigned __g[__num_get_base::__num_get_buf_sz];
+ unsigned* __g_end = __g;
+ unsigned __dc = 0;
+ for (; __b != __e; ++__b) {
+ if (__a_end == __a + __buf.size()) {
+ size_t __tmp = __buf.size();
+ __buf.resize(2 * __buf.size());
+ __buf.resize(__buf.capacity());
+ __a = &__buf[0];
+ __a_end = __a + __tmp;
+ }
+ if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms))
+ break;
+ }
+ // Stage 3
+ __buf.resize(__a_end - __a);
+ if (__libcpp_sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
+ __err = ios_base::failbit;
+ // EOF checked
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>;
@@ -1126,151 +1033,117 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>;
#endif
-struct _LIBCPP_EXPORTED_FROM_ABI __num_put_base
-{
+struct _LIBCPP_EXPORTED_FROM_ABI __num_put_base {
protected:
- static void __format_int(char* __fmt, const char* __len, bool __signd,
- ios_base::fmtflags __flags);
- static bool __format_float(char* __fmt, const char* __len,
- ios_base::fmtflags __flags);
- static char* __identify_padding(char* __nb, char* __ne,
- const ios_base& __iob);
+ static void __format_int(char* __fmt, const char* __len, bool __signd, ios_base::fmtflags __flags);
+ static bool __format_float(char* __fmt, const char* __len, ios_base::fmtflags __flags);
+ static char* __identify_padding(char* __nb, char* __ne, const ios_base& __iob);
};
template <class _CharT>
-struct __num_put
- : protected __num_put_base
-{
- static void __widen_and_group_int(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc);
- static void __widen_and_group_float(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc);
+struct __num_put : protected __num_put_base {
+ static void __widen_and_group_int(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc);
+ static void __widen_and_group_float(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc);
};
template <class _CharT>
-void
-__num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc)
-{
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc);
- const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
- string __grouping = __npt.grouping();
- if (__grouping.empty())
- {
- __ct.widen(__nb, __ne, __ob);
- __oe = __ob + (__ne - __nb);
- }
- else
- {
- __oe = __ob;
- char* __nf = __nb;
- if (*__nf == '-' || *__nf == '+')
- *__oe++ = __ct.widen(*__nf++);
- if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' ||
- __nf[1] == 'X'))
- {
- *__oe++ = __ct.widen(*__nf++);
- *__oe++ = __ct.widen(*__nf++);
- }
- std::reverse(__nf, __ne);
- _CharT __thousands_sep = __npt.thousands_sep();
- unsigned __dc = 0;
- unsigned __dg = 0;
- for (char* __p = __nf; __p < __ne; ++__p)
- {
- if (static_cast<unsigned>(__grouping[__dg]) > 0 &&
- __dc == static_cast<unsigned>(__grouping[__dg]))
- {
- *__oe++ = __thousands_sep;
- __dc = 0;
- if (__dg < __grouping.size()-1)
- ++__dg;
- }
- *__oe++ = __ct.widen(*__p);
- ++__dc;
- }
- std::reverse(__ob + (__nf - __nb), __oe);
- }
- if (__np == __ne)
- __op = __oe;
- else
- __op = __ob + (__np - __nb);
+void __num_put<_CharT>::__widen_and_group_int(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) {
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__loc);
+ const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
+ string __grouping = __npt.grouping();
+ if (__grouping.empty()) {
+ __ct.widen(__nb, __ne, __ob);
+ __oe = __ob + (__ne - __nb);
+ } else {
+ __oe = __ob;
+ char* __nf = __nb;
+ if (*__nf == '-' || *__nf == '+')
+ *__oe++ = __ct.widen(*__nf++);
+ if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || __nf[1] == 'X')) {
+ *__oe++ = __ct.widen(*__nf++);
+ *__oe++ = __ct.widen(*__nf++);
+ }
+ std::reverse(__nf, __ne);
+ _CharT __thousands_sep = __npt.thousands_sep();
+ unsigned __dc = 0;
+ unsigned __dg = 0;
+ for (char* __p = __nf; __p < __ne; ++__p) {
+ if (static_cast<unsigned>(__grouping[__dg]) > 0 && __dc == static_cast<unsigned>(__grouping[__dg])) {
+ *__oe++ = __thousands_sep;
+ __dc = 0;
+ if (__dg < __grouping.size() - 1)
+ ++__dg;
+ }
+ *__oe++ = __ct.widen(*__p);
+ ++__dc;
+ }
+ std::reverse(__ob + (__nf - __nb), __oe);
+ }
+ if (__np == __ne)
+ __op = __oe;
+ else
+ __op = __ob + (__np - __nb);
}
template <class _CharT>
-void
-__num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
- _CharT* __ob, _CharT*& __op, _CharT*& __oe,
- const locale& __loc)
-{
- const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc);
- const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
- string __grouping = __npt.grouping();
- __oe = __ob;
- char* __nf = __nb;
- if (*__nf == '-' || *__nf == '+')
- *__oe++ = __ct.widen(*__nf++);
- char* __ns;
- if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' ||
- __nf[1] == 'X'))
- {
- *__oe++ = __ct.widen(*__nf++);
- *__oe++ = __ct.widen(*__nf++);
- for (__ns = __nf; __ns < __ne; ++__ns)
- if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
- break;
- }
- else
- {
- for (__ns = __nf; __ns < __ne; ++__ns)
- if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
- break;
- }
- if (__grouping.empty())
- {
- __ct.widen(__nf, __ns, __oe);
- __oe += __ns - __nf;
- }
- else
- {
- std::reverse(__nf, __ns);
- _CharT __thousands_sep = __npt.thousands_sep();
- unsigned __dc = 0;
- unsigned __dg = 0;
- for (char* __p = __nf; __p < __ns; ++__p)
- {
- if (__grouping[__dg] > 0 && __dc == static_cast<unsigned>(__grouping[__dg]))
- {
- *__oe++ = __thousands_sep;
- __dc = 0;
- if (__dg < __grouping.size()-1)
- ++__dg;
- }
- *__oe++ = __ct.widen(*__p);
- ++__dc;
- }
- std::reverse(__ob + (__nf - __nb), __oe);
- }
- for (__nf = __ns; __nf < __ne; ++__nf)
- {
- if (*__nf == '.')
- {
- *__oe++ = __npt.decimal_point();
- ++__nf;
- break;
- }
- else
- *__oe++ = __ct.widen(*__nf);
- }
- __ct.widen(__nf, __ne, __oe);
- __oe += __ne - __nf;
- if (__np == __ne)
- __op = __oe;
- else
- __op = __ob + (__np - __nb);
+void __num_put<_CharT>::__widen_and_group_float(
+ char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) {
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__loc);
+ const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
+ string __grouping = __npt.grouping();
+ __oe = __ob;
+ char* __nf = __nb;
+ if (*__nf == '-' || *__nf == '+')
+ *__oe++ = __ct.widen(*__nf++);
+ char* __ns;
+ if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || __nf[1] == 'X')) {
+ *__oe++ = __ct.widen(*__nf++);
+ *__oe++ = __ct.widen(*__nf++);
+ for (__ns = __nf; __ns < __ne; ++__ns)
+ if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
+ break;
+ } else {
+ for (__ns = __nf; __ns < __ne; ++__ns)
+ if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
+ break;
+ }
+ if (__grouping.empty()) {
+ __ct.widen(__nf, __ns, __oe);
+ __oe += __ns - __nf;
+ } else {
+ std::reverse(__nf, __ns);
+ _CharT __thousands_sep = __npt.thousands_sep();
+ unsigned __dc = 0;
+ unsigned __dg = 0;
+ for (char* __p = __nf; __p < __ns; ++__p) {
+ if (__grouping[__dg] > 0 && __dc == static_cast<unsigned>(__grouping[__dg])) {
+ *__oe++ = __thousands_sep;
+ __dc = 0;
+ if (__dg < __grouping.size() - 1)
+ ++__dg;
+ }
+ *__oe++ = __ct.widen(*__p);
+ ++__dc;
+ }
+ std::reverse(__ob + (__nf - __nb), __oe);
+ }
+ for (__nf = __ns; __nf < __ne; ++__nf) {
+ if (*__nf == '.') {
+ *__oe++ = __npt.decimal_point();
+ ++__nf;
+ break;
+ } else
+ *__oe++ = __ct.widen(*__nf);
+ }
+ __ct.widen(__nf, __ne, __oe);
+ __oe += __ne - __nf;
+ if (__np == __ne)
+ __op = __oe;
+ else
+ __op = __ob + (__np - __nb);
}
extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>;
@@ -1279,363 +1152,285 @@ extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>;
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS num_put
- : public locale::facet,
- private __num_put<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS num_put : public locale::facet, private __num_put<_CharT> {
public:
- typedef _CharT char_type;
- typedef _OutputIterator iter_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit num_put(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- bool __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ typedef _CharT char_type;
+ typedef _OutputIterator iter_type;
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- long long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long long __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- double __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- long double __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- const void* __v) const
- {
- return do_put(__s, __iob, __fl, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
- static locale::id id;
+ _LIBCPP_HIDE_FROM_ABI iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const {
+ return do_put(__s, __iob, __fl, __v);
+ }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_put() override {}
-
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- bool __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- long __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- long long __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- unsigned long long) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- double __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- long double __v) const;
- virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
- const void* __v) const;
-
- template <class _Integral>
- _LIBCPP_HIDE_FROM_ABI inline
- _OutputIterator __do_put_integral(iter_type __s, ios_base& __iob,
- char_type __fl, _Integral __v,
- char const* __len) const;
-
- template <class _Float>
- _LIBCPP_HIDE_FROM_ABI inline
- _OutputIterator __do_put_floating_point(iter_type __s, ios_base& __iob,
- char_type __fl, _Float __v,
- char const* __len) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_put() override {}
+
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const;
+ virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const;
+
+ template <class _Integral>
+ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator
+ __do_put_integral(iter_type __s, ios_base& __iob, char_type __fl, _Integral __v, char const* __len) const;
+
+ template <class _Float>
+ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator
+ __do_put_floating_point(iter_type __s, ios_base& __iob, char_type __fl, _Float __v, char const* __len) const;
};
template <class _CharT, class _OutputIterator>
-locale::id
-num_put<_CharT, _OutputIterator>::id;
+locale::id num_put<_CharT, _OutputIterator>::id;
template <class _CharT, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI
-_OutputIterator
-__pad_and_output(_OutputIterator __s,
- const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
- ios_base& __iob, _CharT __fl)
-{
- streamsize __sz = __oe - __ob;
- streamsize __ns = __iob.width();
- if (__ns > __sz)
- __ns -= __sz;
- else
- __ns = 0;
- for (;__ob < __op; ++__ob, ++__s)
- *__s = *__ob;
- for (; __ns; --__ns, ++__s)
- *__s = __fl;
- for (; __ob < __oe; ++__ob, ++__s)
- *__s = *__ob;
- __iob.width(0);
- return __s;
+_LIBCPP_HIDE_FROM_ABI _OutputIterator __pad_and_output(
+ _OutputIterator __s, const _CharT* __ob, const _CharT* __op, const _CharT* __oe, ios_base& __iob, _CharT __fl) {
+ streamsize __sz = __oe - __ob;
+ streamsize __ns = __iob.width();
+ if (__ns > __sz)
+ __ns -= __sz;
+ else
+ __ns = 0;
+ for (; __ob < __op; ++__ob, ++__s)
+ *__s = *__ob;
+ for (; __ns; --__ns, ++__s)
+ *__s = __fl;
+ for (; __ob < __oe; ++__ob, ++__s)
+ *__s = *__ob;
+ __iob.width(0);
+ return __s;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI
-ostreambuf_iterator<_CharT, _Traits>
-__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
- const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
- ios_base& __iob, _CharT __fl)
-{
- if (__s.__sbuf_ == nullptr)
- return __s;
- streamsize __sz = __oe - __ob;
- streamsize __ns = __iob.width();
- if (__ns > __sz)
- __ns -= __sz;
- else
- __ns = 0;
- streamsize __np = __op - __ob;
- if (__np > 0)
- {
- if (__s.__sbuf_->sputn(__ob, __np) != __np)
- {
- __s.__sbuf_ = nullptr;
- return __s;
- }
- }
- if (__ns > 0)
- {
- basic_string<_CharT, _Traits> __sp(__ns, __fl);
- if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns)
- {
- __s.__sbuf_ = nullptr;
- return __s;
- }
- }
- __np = __oe - __op;
- if (__np > 0)
- {
- if (__s.__sbuf_->sputn(__op, __np) != __np)
- {
- __s.__sbuf_ = nullptr;
- return __s;
- }
- }
- __iob.width(0);
+_LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output(
+ ostreambuf_iterator<_CharT, _Traits> __s,
+ const _CharT* __ob,
+ const _CharT* __op,
+ const _CharT* __oe,
+ ios_base& __iob,
+ _CharT __fl) {
+ if (__s.__sbuf_ == nullptr)
return __s;
+ streamsize __sz = __oe - __ob;
+ streamsize __ns = __iob.width();
+ if (__ns > __sz)
+ __ns -= __sz;
+ else
+ __ns = 0;
+ streamsize __np = __op - __ob;
+ if (__np > 0) {
+ if (__s.__sbuf_->sputn(__ob, __np) != __np) {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ if (__ns > 0) {
+ basic_string<_CharT, _Traits> __sp(__ns, __fl);
+ if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ __np = __oe - __op;
+ if (__np > 0) {
+ if (__s.__sbuf_->sputn(__op, __np) != __np) {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ __iob.width(0);
+ return __s;
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, bool __v) const
-{
- if ((__iob.flags() & ios_base::boolalpha) == 0)
- return do_put(__s, __iob, __fl, (unsigned long)__v);
- const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc());
- typedef typename numpunct<char_type>::string_type string_type;
- string_type __nm = __v ? __np.truename() : __np.falsename();
- for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s)
- *__s = *__i;
- return __s;
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const {
+ if ((__iob.flags() & ios_base::boolalpha) == 0)
+ return do_put(__s, __iob, __fl, (unsigned long)__v);
+ const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc());
+ typedef typename numpunct<char_type>::string_type string_type;
+ string_type __nm = __v ? __np.truename() : __np.falsename();
+ for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s)
+ *__s = *__i;
+ return __s;
}
template <class _CharT, class _OutputIterator>
template <class _Integral>
-_LIBCPP_HIDE_FROM_ABI inline
-_OutputIterator
-num_put<_CharT, _OutputIterator>::__do_put_integral(iter_type __s, ios_base& __iob,
- char_type __fl, _Integral __v,
- char const* __len) const
-{
- // Stage 1 - Get number in narrow char
- char __fmt[8] = {'%', 0};
- this->__format_int(__fmt+1, __len, is_signed<_Integral>::value, __iob.flags());
- // Worst case is octal, with showbase enabled. Note that octal is always
- // printed as an unsigned value.
- using _Unsigned = typename make_unsigned<_Integral>::type;
- _LIBCPP_CONSTEXPR const unsigned __nbuf
- = (numeric_limits<_Unsigned>::digits / 3) // 1 char per 3 bits
- + ((numeric_limits<_Unsigned>::digits % 3) != 0) // round up
- + 2; // base prefix + terminating null character
- char __nar[__nbuf];
- _LIBCPP_DIAGNOSTIC_PUSH
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
- int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
- _LIBCPP_DIAGNOSTIC_POP
- char* __ne = __nar + __nc;
- char* __np = this->__identify_padding(__nar, __ne, __iob);
- // Stage 2 - Widen __nar while adding thousands separators
- char_type __o[2*(__nbuf-1) - 1];
- char_type* __op; // pad here
- char_type* __oe; // end of output
- this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
- // [__o, __oe) contains thousands_sep'd wide number
- // Stage 3 & 4
- return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+_LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::__do_put_integral(
+ iter_type __s, ios_base& __iob, char_type __fl, _Integral __v, char const* __len) const {
+ // Stage 1 - Get number in narrow char
+ char __fmt[8] = {'%', 0};
+ this->__format_int(__fmt + 1, __len, is_signed<_Integral>::value, __iob.flags());
+ // Worst case is octal, with showbase enabled. Note that octal is always
+ // printed as an unsigned value.
+ using _Unsigned = typename make_unsigned<_Integral>::type;
+ _LIBCPP_CONSTEXPR const unsigned __nbuf =
+ (numeric_limits<_Unsigned>::digits / 3) // 1 char per 3 bits
+ + ((numeric_limits<_Unsigned>::digits % 3) != 0) // round up
+ + 2; // base prefix + terminating null character
+ char __nar[__nbuf];
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ _LIBCPP_DIAGNOSTIC_POP
+ char* __ne = __nar + __nc;
+ char* __np = this->__identify_padding(__nar, __ne, __iob);
+ // Stage 2 - Widen __nar while adding thousands separators
+ char_type __o[2 * (__nbuf - 1) - 1];
+ char_type* __op; // pad here
+ char_type* __oe; // end of output
+ this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
+ // [__o, __oe) contains thousands_sep'd wide number
+ // Stage 3 & 4
+ return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "l");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "l");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, long long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, unsigned long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "l");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "l");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, unsigned long long __v) const
-{
- return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long __v) const {
+ return this->__do_put_integral(__s, __iob, __fl, __v, "ll");
}
template <class _CharT, class _OutputIterator>
template <class _Float>
-_LIBCPP_HIDE_FROM_ABI inline
-_OutputIterator
-num_put<_CharT, _OutputIterator>::__do_put_floating_point(iter_type __s, ios_base& __iob,
- char_type __fl, _Float __v,
- char const* __len) const
-{
- // Stage 1 - Get number in narrow char
- char __fmt[8] = {'%', 0};
- bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
- const unsigned __nbuf = 30;
- char __nar[__nbuf];
- char* __nb = __nar;
- int __nc;
- _LIBCPP_DIAGNOSTIC_PUSH
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+_LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::__do_put_floating_point(
+ iter_type __s, ios_base& __iob, char_type __fl, _Float __v, char const* __len) const {
+ // Stage 1 - Get number in narrow char
+ char __fmt[8] = {'%', 0};
+ bool __specify_precision = this->__format_float(__fmt + 1, __len, __iob.flags());
+ const unsigned __nbuf = 30;
+ char __nar[__nbuf];
+ char* __nb = __nar;
+ int __nc;
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral")
+ if (__specify_precision)
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
+ else
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ unique_ptr<char, void (*)(void*)> __nbh(nullptr, free);
+ if (__nc > static_cast<int>(__nbuf - 1)) {
if (__specify_precision)
- __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
- (int)__iob.precision(), __v);
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
else
- __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- unique_ptr<char, void(*)(void*)> __nbh(nullptr, free);
- if (__nc > static_cast<int>(__nbuf-1))
- {
- if (__specify_precision)
- __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
- else
- __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
- if (__nc == -1)
- __throw_bad_alloc();
- __nbh.reset(__nb);
- }
- _LIBCPP_DIAGNOSTIC_POP
- char* __ne = __nb + __nc;
- char* __np = this->__identify_padding(__nb, __ne, __iob);
- // Stage 2 - Widen __nar while adding thousands separators
- char_type __o[2*(__nbuf-1) - 1];
- char_type* __ob = __o;
- unique_ptr<char_type, void(*)(void*)> __obh(0, free);
- if (__nb != __nar)
- {
- __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
- if (__ob == 0)
- __throw_bad_alloc();
- __obh.reset(__ob);
- }
- char_type* __op; // pad here
- char_type* __oe; // end of output
- this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc());
- // [__o, __oe) contains thousands_sep'd wide number
- // Stage 3 & 4
- __s = std::__pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
- return __s;
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ if (__nc == -1)
+ __throw_bad_alloc();
+ __nbh.reset(__nb);
+ }
+ _LIBCPP_DIAGNOSTIC_POP
+ char* __ne = __nb + __nc;
+ char* __np = this->__identify_padding(__nb, __ne, __iob);
+ // Stage 2 - Widen __nar while adding thousands separators
+ char_type __o[2 * (__nbuf - 1) - 1];
+ char_type* __ob = __o;
+ unique_ptr<char_type, void (*)(void*)> __obh(0, free);
+ if (__nb != __nar) {
+ __ob = (char_type*)malloc(2 * static_cast<size_t>(__nc) * sizeof(char_type));
+ if (__ob == 0)
+ __throw_bad_alloc();
+ __obh.reset(__ob);
+ }
+ char_type* __op; // pad here
+ char_type* __oe; // end of output
+ this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc());
+ // [__o, __oe) contains thousands_sep'd wide number
+ // Stage 3 & 4
+ __s = std::__pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
+ return __s;
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, double __v) const
-{
- return this->__do_put_floating_point(__s, __iob, __fl, __v, "");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const {
+ return this->__do_put_floating_point(__s, __iob, __fl, __v, "");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, long double __v) const
-{
- return this->__do_put_floating_point(__s, __iob, __fl, __v, "L");
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const {
+ return this->__do_put_floating_point(__s, __iob, __fl, __v, "L");
}
template <class _CharT, class _OutputIterator>
_OutputIterator
-num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
- char_type __fl, const void* __v) const
-{
- // Stage 1 - Get pointer in narrow char
- const unsigned __nbuf = 20;
- char __nar[__nbuf];
- int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, "%p", __v);
- char* __ne = __nar + __nc;
- char* __np = this->__identify_padding(__nar, __ne, __iob);
- // Stage 2 - Widen __nar
- char_type __o[2*(__nbuf-1) - 1];
- char_type* __op; // pad here
- char_type* __oe; // end of output
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __ct.widen(__nar, __ne, __o);
- __oe = __o + (__ne - __nar);
- if (__np == __ne)
- __op = __oe;
- else
- __op = __o + (__np - __nar);
- // [__o, __oe) contains wide number
- // Stage 3 & 4
- return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const {
+ // Stage 1 - Get pointer in narrow char
+ const unsigned __nbuf = 20;
+ char __nar[__nbuf];
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, "%p", __v);
+ char* __ne = __nar + __nc;
+ char* __np = this->__identify_padding(__nar, __ne, __iob);
+ // Stage 2 - Widen __nar
+ char_type __o[2 * (__nbuf - 1) - 1];
+ char_type* __op; // pad here
+ char_type* __oe; // end of output
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __ct.widen(__nar, __ne, __o);
+ __oe = __o + (__ne - __nar);
+ if (__np == __ne)
+ __op = __oe;
+ else
+ __op = __o + (__np - __nar);
+ // [__o, __oe) contains wide number
+ // Stage 3 & 4
+ return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>;
@@ -1644,687 +1439,534 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>;
#endif
template <class _CharT, class _InputIterator>
-_LIBCPP_HIDE_FROM_ABI
-int
-__get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
- ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n)
-{
- // Precondition: __n >= 1
- if (__b == __e)
- {
- __err |= ios_base::eofbit | ios_base::failbit;
- return 0;
- }
- // get first digit
- _CharT __c = *__b;
+_LIBCPP_HIDE_FROM_ABI int __get_up_to_n_digits(
+ _InputIterator& __b, _InputIterator __e, ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n) {
+ // Precondition: __n >= 1
+ if (__b == __e) {
+ __err |= ios_base::eofbit | ios_base::failbit;
+ return 0;
+ }
+ // get first digit
+ _CharT __c = *__b;
+ if (!__ct.is(ctype_base::digit, __c)) {
+ __err |= ios_base::failbit;
+ return 0;
+ }
+ int __r = __ct.narrow(__c, 0) - '0';
+ for (++__b, (void)--__n; __b != __e && __n > 0; ++__b, (void)--__n) {
+ // get next digit
+ __c = *__b;
if (!__ct.is(ctype_base::digit, __c))
- {
- __err |= ios_base::failbit;
- return 0;
- }
- int __r = __ct.narrow(__c, 0) - '0';
- for (++__b, (void) --__n; __b != __e && __n > 0; ++__b, (void) --__n)
- {
- // get next digit
- __c = *__b;
- if (!__ct.is(ctype_base::digit, __c))
- return __r;
- __r = __r * 10 + __ct.narrow(__c, 0) - '0';
- }
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __r;
+ return __r;
+ __r = __r * 10 + __ct.narrow(__c, 0) - '0';
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __r;
}
-class _LIBCPP_EXPORTED_FROM_ABI time_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI time_base {
public:
- enum dateorder {no_order, dmy, mdy, ymd, ydm};
+ enum dateorder { no_order, dmy, mdy, ymd, ydm };
};
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS __time_get_c_storage
-{
+class _LIBCPP_TEMPLATE_VIS __time_get_c_storage {
protected:
- typedef basic_string<_CharT> string_type;
-
- virtual const string_type* __weeks() const;
- virtual const string_type* __months() const;
- virtual const string_type* __am_pm() const;
- virtual const string_type& __c() const;
- virtual const string_type& __r() const;
- virtual const string_type& __x() const;
- virtual const string_type& __X() const;
-
- _LIBCPP_HIDE_FROM_ABI
- ~__time_get_c_storage() {}
+ typedef basic_string<_CharT> string_type;
+
+ virtual const string_type* __weeks() const;
+ virtual const string_type* __months() const;
+ virtual const string_type* __am_pm() const;
+ virtual const string_type& __c() const;
+ virtual const string_type& __r() const;
+ virtual const string_type& __x() const;
+ virtual const string_type& __X() const;
+
+ _LIBCPP_HIDE_FROM_ABI ~__time_get_c_storage() {}
};
-template <> _LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__weeks() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__months() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__am_pm() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__c() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__r() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__x() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__X() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__weeks() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__months() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string* __time_get_c_storage<char>::__am_pm() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__c() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__r() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__x() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__X() const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__weeks() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__months() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__am_pm() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__c() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__r() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__x() const;
-template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__X() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__weeks() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__months() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__am_pm() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__c() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__r() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__x() const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__X() const;
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS time_get
- : public locale::facet,
- public time_base,
- private __time_get_c_storage<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS time_get : public locale::facet, public time_base, private __time_get_c_storage<_CharT> {
public:
- typedef _CharT char_type;
- typedef _InputIterator iter_type;
- typedef time_base::dateorder dateorder;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit time_get(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- dateorder date_order() const
- {
- return this->do_date_order();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_time(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_time(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_date(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_date(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_weekday(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_weekday(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_monthname(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_monthname(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get_year(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const
- {
- return do_get_year(__b, __e, __iob, __err, __tm);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm *__tm,
- char __fmt, char __mod = 0) const
- {
- return do_get(__b, __e, __iob, __err, __tm, __fmt, __mod);
- }
-
- iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- const char_type* __fmtb, const char_type* __fmte) const;
-
- static locale::id id;
+ typedef _CharT char_type;
+ typedef _InputIterator iter_type;
+ typedef time_base::dateorder dateorder;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit time_get(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI dateorder date_order() const { return this->do_date_order(); }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_time(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_time(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_date(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_date(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_weekday(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_weekday(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_monthname(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_monthname(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get_year(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ return do_get_year(__b, __e, __iob, __err, __tm);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char __mod = 0)
+ const {
+ return do_get(__b, __e, __iob, __err, __tm, __fmt, __mod);
+ }
+
+ iter_type
+ get(iter_type __b,
+ iter_type __e,
+ ios_base& __iob,
+ ios_base::iostate& __err,
+ tm* __tm,
+ const char_type* __fmtb,
+ const char_type* __fmte) const;
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get() override {}
-
- virtual dateorder do_date_order() const;
- virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_date(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get_year(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm) const;
- virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- char __fmt, char __mod) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get() override {}
+
+ virtual dateorder do_date_order() const;
+ virtual iter_type
+ do_get_time(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_date(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type
+ do_get_year(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const;
+ virtual iter_type do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char __mod) const;
+
private:
- void __get_white_space(iter_type& __b, iter_type __e,
- ios_base::iostate& __err, const ctype<char_type>& __ct) const;
- void __get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
-
- void __get_weekdayname(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_monthname(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_day(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_month(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_year(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_year4(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_hour(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_12_hour(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_am_pm(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_minute(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_second(int& __s,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_weekday(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
- void __get_day_year_num(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const;
+ void __get_white_space(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+
+ void __get_weekdayname(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_monthname(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_day(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_month(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_year(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_year4(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_hour(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_12_hour(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_am_pm(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_minute(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_second(int& __s, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void
+ __get_weekday(int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
+ void __get_day_year_num(
+ int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const;
};
template <class _CharT, class _InputIterator>
-locale::id
-time_get<_CharT, _InputIterator>::id;
+locale::id time_get<_CharT, _InputIterator>::id;
// time_get primitives
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- // Note: ignoring case comes from the POSIX strptime spec
- const string_type* __wk = this->__weeks();
- ptrdiff_t __i = std::__scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
- if (__i < 14)
- __w = __i % 7;
+void time_get<_CharT, _InputIterator>::__get_weekdayname(
+ int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ // Note: ignoring case comes from the POSIX strptime spec
+ const string_type* __wk = this->__weeks();
+ ptrdiff_t __i = std::__scan_keyword(__b, __e, __wk, __wk + 14, __ct, __err, false) - __wk;
+ if (__i < 14)
+ __w = __i % 7;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- // Note: ignoring case comes from the POSIX strptime spec
- const string_type* __month = this->__months();
- ptrdiff_t __i = std::__scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
- if (__i < 24)
- __m = __i % 12;
+void time_get<_CharT, _InputIterator>::__get_monthname(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ // Note: ignoring case comes from the POSIX strptime spec
+ const string_type* __month = this->__months();
+ ptrdiff_t __i = std::__scan_keyword(__b, __e, __month, __month + 24, __ct, __err, false) - __month;
+ if (__i < 24)
+ __m = __i % 12;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_day(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31)
- __d = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_day(
+ int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31)
+ __d = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_month(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
- if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11)
- __m = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_month(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
+ if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11)
+ __m = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_year(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
- if (!(__err & ios_base::failbit))
- {
- if (__t < 69)
- __t += 2000;
- else if (69 <= __t && __t <= 99)
- __t += 1900;
- __y = __t - 1900;
- }
+void time_get<_CharT, _InputIterator>::__get_year(
+ int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
+ if (!(__err & ios_base::failbit)) {
+ if (__t < 69)
+ __t += 2000;
+ else if (69 <= __t && __t <= 99)
+ __t += 1900;
+ __y = __t - 1900;
+ }
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_year4(int& __y,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
- if (!(__err & ios_base::failbit))
- __y = __t - 1900;
+void time_get<_CharT, _InputIterator>::__get_year4(
+ int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
+ if (!(__err & ios_base::failbit))
+ __y = __t - 1900;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_hour(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && __t <= 23)
- __h = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_hour(
+ int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && __t <= 23)
+ __h = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_12_hour(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12)
- __h = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_12_hour(
+ int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12)
+ __h = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_minute(int& __m,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && __t <= 59)
- __m = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_minute(
+ int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && __t <= 59)
+ __m = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_second(int& __s,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
- if (!(__err & ios_base::failbit) && __t <= 60)
- __s = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_second(
+ int& __s, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ if (!(__err & ios_base::failbit) && __t <= 60)
+ __s = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_weekday(int& __w,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 1);
- if (!(__err & ios_base::failbit) && __t <= 6)
- __w = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_weekday(
+ int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 1);
+ if (!(__err & ios_base::failbit) && __t <= 6)
+ __w = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 3);
- if (!(__err & ios_base::failbit) && __t <= 365)
- __d = __t;
- else
- __err |= ios_base::failbit;
+void time_get<_CharT, _InputIterator>::__get_day_year_num(
+ int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 3);
+ if (!(__err & ios_base::failbit) && __t <= 365)
+ __d = __t;
+ else
+ __err |= ios_base::failbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_white_space(iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
- ;
- if (__b == __e)
- __err |= ios_base::eofbit;
+void time_get<_CharT, _InputIterator>::__get_white_space(
+ iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
+ ;
+ if (__b == __e)
+ __err |= ios_base::eofbit;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
- iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- const string_type* __ap = this->__am_pm();
- if (__ap[0].size() + __ap[1].size() == 0)
- {
- __err |= ios_base::failbit;
- return;
- }
- ptrdiff_t __i = std::__scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
- if (__i == 0 && __h == 12)
- __h = 0;
- else if (__i == 1 && __h < 12)
- __h += 12;
+void time_get<_CharT, _InputIterator>::__get_am_pm(
+ int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ const string_type* __ap = this->__am_pm();
+ if (__ap[0].size() + __ap[1].size() == 0) {
+ __err |= ios_base::failbit;
+ return;
+ }
+ ptrdiff_t __i = std::__scan_keyword(__b, __e, __ap, __ap + 2, __ct, __err, false) - __ap;
+ if (__i == 0 && __h == 12)
+ __h = 0;
+ else if (__i == 1 && __h < 12)
+ __h += 12;
}
template <class _CharT, class _InputIterator>
-void
-time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e,
- ios_base::iostate& __err,
- const ctype<char_type>& __ct) const
-{
- if (__b == __e)
- {
- __err |= ios_base::eofbit | ios_base::failbit;
- return;
- }
- if (__ct.narrow(*__b, 0) != '%')
- __err |= ios_base::failbit;
- else if(++__b == __e)
- __err |= ios_base::eofbit;
+void time_get<_CharT, _InputIterator>::__get_percent(
+ iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const {
+ if (__b == __e) {
+ __err |= ios_base::eofbit | ios_base::failbit;
+ return;
+ }
+ if (__ct.narrow(*__b, 0) != '%')
+ __err |= ios_base::failbit;
+ else if (++__b == __e)
+ __err |= ios_base::eofbit;
}
// time_get end primitives
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- const char_type* __fmtb, const char_type* __fmte) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __err = ios_base::goodbit;
- while (__fmtb != __fmte && __err == ios_base::goodbit)
- {
- if (__b == __e)
- {
- __err = ios_base::failbit;
- break;
- }
- if (__ct.narrow(*__fmtb, 0) == '%')
- {
- if (++__fmtb == __fmte)
- {
- __err = ios_base::failbit;
- break;
- }
- char __cmd = __ct.narrow(*__fmtb, 0);
- char __opt = '\0';
- if (__cmd == 'E' || __cmd == '0')
- {
- if (++__fmtb == __fmte)
- {
- __err = ios_base::failbit;
- break;
- }
- __opt = __cmd;
- __cmd = __ct.narrow(*__fmtb, 0);
- }
- __b = do_get(__b, __e, __iob, __err, __tm, __cmd, __opt);
- ++__fmtb;
- }
- else if (__ct.is(ctype_base::space, *__fmtb))
- {
- for (++__fmtb; __fmtb != __fmte && __ct.is(ctype_base::space, *__fmtb); ++__fmtb)
- ;
- for ( ; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
- ;
- }
- else if (__ct.toupper(*__b) == __ct.toupper(*__fmtb))
- {
- ++__b;
- ++__fmtb;
- }
- else
- __err = ios_base::failbit;
+_InputIterator time_get<_CharT, _InputIterator>::get(
+ iter_type __b,
+ iter_type __e,
+ ios_base& __iob,
+ ios_base::iostate& __err,
+ tm* __tm,
+ const char_type* __fmtb,
+ const char_type* __fmte) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __err = ios_base::goodbit;
+ while (__fmtb != __fmte && __err == ios_base::goodbit) {
+ if (__b == __e) {
+ __err = ios_base::failbit;
+ break;
}
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ if (__ct.narrow(*__fmtb, 0) == '%') {
+ if (++__fmtb == __fmte) {
+ __err = ios_base::failbit;
+ break;
+ }
+ char __cmd = __ct.narrow(*__fmtb, 0);
+ char __opt = '\0';
+ if (__cmd == 'E' || __cmd == '0') {
+ if (++__fmtb == __fmte) {
+ __err = ios_base::failbit;
+ break;
+ }
+ __opt = __cmd;
+ __cmd = __ct.narrow(*__fmtb, 0);
+ }
+ __b = do_get(__b, __e, __iob, __err, __tm, __cmd, __opt);
+ ++__fmtb;
+ } else if (__ct.is(ctype_base::space, *__fmtb)) {
+ for (++__fmtb; __fmtb != __fmte && __ct.is(ctype_base::space, *__fmtb); ++__fmtb)
+ ;
+ for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b)
+ ;
+ } else if (__ct.toupper(*__b) == __ct.toupper(*__fmtb)) {
+ ++__b;
+ ++__fmtb;
+ } else
+ __err = ios_base::failbit;
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
template <class _CharT, class _InputIterator>
-typename time_get<_CharT, _InputIterator>::dateorder
-time_get<_CharT, _InputIterator>::do_date_order() const
-{
- return mdy;
+typename time_get<_CharT, _InputIterator>::dateorder time_get<_CharT, _InputIterator>::do_date_order() const {
+ return mdy;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_time(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
- return get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+_InputIterator time_get<_CharT, _InputIterator>::do_get_time(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
+ return get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt) / sizeof(__fmt[0]));
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const string_type& __fmt = this->__x();
- return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
+_InputIterator time_get<_CharT, _InputIterator>::do_get_date(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const string_type& __fmt = this->__x();
+ return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get_weekday(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get_monthname(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err,
- tm* __tm) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- __get_year(__tm->tm_year, __b, __e, __err, __ct);
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get_year(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ __get_year(__tm->tm_year, __b, __e, __err, __ct);
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- ios_base& __iob,
- ios_base::iostate& __err, tm* __tm,
- char __fmt, char) const
-{
- __err = ios_base::goodbit;
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- switch (__fmt)
- {
- case 'a':
- case 'A':
- __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
- break;
- case 'b':
- case 'B':
- case 'h':
- __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
- break;
- case 'c':
- {
- const string_type& __fm = this->__c();
- __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
- }
- break;
- case 'd':
- case 'e':
- __get_day(__tm->tm_mday, __b, __e, __err, __ct);
- break;
- case 'D':
- {
- const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'F':
- {
- const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'H':
- __get_hour(__tm->tm_hour, __b, __e, __err, __ct);
- break;
- case 'I':
- __get_12_hour(__tm->tm_hour, __b, __e, __err, __ct);
- break;
- case 'j':
- __get_day_year_num(__tm->tm_yday, __b, __e, __err, __ct);
- break;
- case 'm':
- __get_month(__tm->tm_mon, __b, __e, __err, __ct);
- break;
- case 'M':
- __get_minute(__tm->tm_min, __b, __e, __err, __ct);
- break;
- case 'n':
- case 't':
- __get_white_space(__b, __e, __err, __ct);
- break;
- case 'p':
- __get_am_pm(__tm->tm_hour, __b, __e, __err, __ct);
- break;
- case 'r':
- {
- const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'R':
- {
- const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'S':
- __get_second(__tm->tm_sec, __b, __e, __err, __ct);
- break;
- case 'T':
- {
- const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
- __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
- }
- break;
- case 'w':
- __get_weekday(__tm->tm_wday, __b, __e, __err, __ct);
- break;
- case 'x':
- return do_get_date(__b, __e, __iob, __err, __tm);
- case 'X':
- {
- const string_type& __fm = this->__X();
- __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
- }
- break;
- case 'y':
- __get_year(__tm->tm_year, __b, __e, __err, __ct);
- break;
- case 'Y':
- __get_year4(__tm->tm_year, __b, __e, __err, __ct);
- break;
- case '%':
- __get_percent(__b, __e, __err, __ct);
- break;
- default:
- __err |= ios_base::failbit;
- }
- return __b;
+_InputIterator time_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char) const {
+ __err = ios_base::goodbit;
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ switch (__fmt) {
+ case 'a':
+ case 'A':
+ __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
+ break;
+ case 'b':
+ case 'B':
+ case 'h':
+ __get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
+ break;
+ case 'c': {
+ const string_type& __fm = this->__c();
+ __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
+ } break;
+ case 'd':
+ case 'e':
+ __get_day(__tm->tm_mday, __b, __e, __err, __ct);
+ break;
+ case 'D': {
+ const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'F': {
+ const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'H':
+ __get_hour(__tm->tm_hour, __b, __e, __err, __ct);
+ break;
+ case 'I':
+ __get_12_hour(__tm->tm_hour, __b, __e, __err, __ct);
+ break;
+ case 'j':
+ __get_day_year_num(__tm->tm_yday, __b, __e, __err, __ct);
+ break;
+ case 'm':
+ __get_month(__tm->tm_mon, __b, __e, __err, __ct);
+ break;
+ case 'M':
+ __get_minute(__tm->tm_min, __b, __e, __err, __ct);
+ break;
+ case 'n':
+ case 't':
+ __get_white_space(__b, __e, __err, __ct);
+ break;
+ case 'p':
+ __get_am_pm(__tm->tm_hour, __b, __e, __err, __ct);
+ break;
+ case 'r': {
+ const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'R': {
+ const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'S':
+ __get_second(__tm->tm_sec, __b, __e, __err, __ct);
+ break;
+ case 'T': {
+ const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm) / sizeof(__fm[0]));
+ } break;
+ case 'w':
+ __get_weekday(__tm->tm_wday, __b, __e, __err, __ct);
+ break;
+ case 'x':
+ return do_get_date(__b, __e, __iob, __err, __tm);
+ case 'X': {
+ const string_type& __fm = this->__X();
+ __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
+ } break;
+ case 'y':
+ __get_year(__tm->tm_year, __b, __e, __err, __ct);
+ break;
+ case 'Y':
+ __get_year4(__tm->tm_year, __b, __e, __err, __ct);
+ break;
+ case '%':
+ __get_percent(__b, __e, __err, __ct);
+ break;
+ default:
+ __err |= ios_base::failbit;
+ }
+ return __b;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>;
@@ -2332,55 +1974,59 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>;
#endif
-class _LIBCPP_EXPORTED_FROM_ABI __time_get
-{
+class _LIBCPP_EXPORTED_FROM_ABI __time_get {
protected:
- locale_t __loc_;
+ locale_t __loc_;
- __time_get(const char* __nm);
- __time_get(const string& __nm);
- ~__time_get();
+ __time_get(const char* __nm);
+ __time_get(const string& __nm);
+ ~__time_get();
};
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS __time_get_storage
- : public __time_get
-{
+class _LIBCPP_TEMPLATE_VIS __time_get_storage : public __time_get {
protected:
- typedef basic_string<_CharT> string_type;
+ typedef basic_string<_CharT> string_type;
- string_type __weeks_[14];
- string_type __months_[24];
- string_type __am_pm_[2];
- string_type __c_;
- string_type __r_;
- string_type __x_;
- string_type __X_;
+ string_type __weeks_[14];
+ string_type __months_[24];
+ string_type __am_pm_[2];
+ string_type __c_;
+ string_type __r_;
+ string_type __x_;
+ string_type __X_;
- explicit __time_get_storage(const char* __nm);
- explicit __time_get_storage(const string& __nm);
+ explicit __time_get_storage(const char* __nm);
+ explicit __time_get_storage(const string& __nm);
- _LIBCPP_HIDE_FROM_ABI ~__time_get_storage() {}
+ _LIBCPP_HIDE_FROM_ABI ~__time_get_storage() {}
- time_base::dateorder __do_date_order() const;
+ time_base::dateorder __do_date_order() const;
private:
- void init(const ctype<_CharT>&);
- string_type __analyze(char __fmt, const ctype<_CharT>&);
+ void init(const ctype<_CharT>&);
+ string_type __analyze(char __fmt, const ctype<_CharT>&);
};
-#define _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(_CharT) \
-template <> _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
-template <> _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
-template <> _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
-template <> _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
-template <> _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \
-extern template _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
-extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
-extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
-extern template _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
-extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \
-/**/
+#define _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(_CharT) \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
+ template <> \
+ _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze( \
+ char, const ctype<_CharT>&); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \
+ extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \
+ extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type \
+ __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \
+ /**/
_LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -2391,35 +2037,31 @@ _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t)
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS time_get_byname
: public time_get<_CharT, _InputIterator>,
- private __time_get_storage<_CharT>
-{
+ private __time_get_storage<_CharT> {
public:
- typedef time_base::dateorder dateorder;
- typedef _InputIterator iter_type;
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit time_get_byname(const char* __nm, size_t __refs = 0)
- : time_get<_CharT, _InputIterator>(__refs),
- __time_get_storage<_CharT>(__nm) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit time_get_byname(const string& __nm, size_t __refs = 0)
- : time_get<_CharT, _InputIterator>(__refs),
- __time_get_storage<_CharT>(__nm) {}
+ typedef time_base::dateorder dateorder;
+ typedef _InputIterator iter_type;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit time_get_byname(const char* __nm, size_t __refs = 0)
+ : time_get<_CharT, _InputIterator>(__refs), __time_get_storage<_CharT>(__nm) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_get_byname(const string& __nm, size_t __refs = 0)
+ : time_get<_CharT, _InputIterator>(__refs), __time_get_storage<_CharT>(__nm) {}
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get_byname() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get_byname() override {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL dateorder do_date_order() const override { return this->__do_date_order(); }
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL dateorder do_date_order() const override {return this->__do_date_order();}
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __weeks() const override {return this->__weeks_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __months() const override {return this->__months_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __am_pm() const override {return this->__am_pm_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __c() const override {return this->__c_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __r() const override {return this->__r_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __x() const override {return this->__x_;}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __X() const override {return this->__X_;}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __weeks() const override { return this->__weeks_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __months() const override { return this->__months_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __am_pm() const override { return this->__am_pm_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __c() const override { return this->__c_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __r() const override { return this->__r_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __x() const override { return this->__x_; }
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __X() const override { return this->__X_; }
};
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>;
@@ -2427,115 +2069,88 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>;
#endif
-class _LIBCPP_EXPORTED_FROM_ABI __time_put
-{
- locale_t __loc_;
+class _LIBCPP_EXPORTED_FROM_ABI __time_put {
+ locale_t __loc_;
+
protected:
- _LIBCPP_HIDE_FROM_ABI __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
- __time_put(const char* __nm);
- __time_put(const string& __nm);
- ~__time_put();
- void __do_put(char* __nb, char*& __ne, const tm* __tm,
- char __fmt, char __mod) const;
+ _LIBCPP_HIDE_FROM_ABI __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
+ __time_put(const char* __nm);
+ __time_put(const string& __nm);
+ ~__time_put();
+ void __do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, char __mod) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
- char __fmt, char __mod) const;
+ void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const;
#endif
};
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS time_put
- : public locale::facet,
- private __time_put
-{
+class _LIBCPP_TEMPLATE_VIS time_put : public locale::facet, private __time_put {
public:
- typedef _CharT char_type;
- typedef _OutputIterator iter_type;
+ typedef _CharT char_type;
+ typedef _OutputIterator iter_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put(size_t __refs = 0)
- : locale::facet(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put(size_t __refs = 0) : locale::facet(__refs) {}
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm,
- const char_type* __pb, const char_type* __pe) const;
+ iter_type
+ put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, const char_type* __pb, const char_type* __pe)
+ const;
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
- const tm* __tm, char __fmt, char __mod = 0) const
- {
- return do_put(__s, __iob, __fl, __tm, __fmt, __mod);
- }
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, char __fmt, char __mod = 0) const {
+ return do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+ }
- static locale::id id;
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put() override {}
- virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
- char __fmt, char __mod) const;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put(const char* __nm, size_t __refs)
- : locale::facet(__refs),
- __time_put(__nm) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put(const string& __nm, size_t __refs)
- : locale::facet(__refs),
- __time_put(__nm) {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put() override {}
+ virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const;
+
+ _LIBCPP_HIDE_FROM_ABI explicit time_put(const char* __nm, size_t __refs) : locale::facet(__refs), __time_put(__nm) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put(const string& __nm, size_t __refs)
+ : locale::facet(__refs), __time_put(__nm) {}
};
template <class _CharT, class _OutputIterator>
-locale::id
-time_put<_CharT, _OutputIterator>::id;
+locale::id time_put<_CharT, _OutputIterator>::id;
template <class _CharT, class _OutputIterator>
-_OutputIterator
-time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob,
- char_type __fl, const tm* __tm,
- const char_type* __pb,
- const char_type* __pe) const
-{
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
- for (; __pb != __pe; ++__pb)
- {
- if (__ct.narrow(*__pb, 0) == '%')
- {
- if (++__pb == __pe)
- {
- *__s++ = __pb[-1];
- break;
- }
- char __mod = 0;
- char __fmt = __ct.narrow(*__pb, 0);
- if (__fmt == 'E' || __fmt == 'O')
- {
- if (++__pb == __pe)
- {
- *__s++ = __pb[-2];
- *__s++ = __pb[-1];
- break;
- }
- __mod = __fmt;
- __fmt = __ct.narrow(*__pb, 0);
- }
- __s = do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+_OutputIterator time_put<_CharT, _OutputIterator>::put(
+ iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, const char_type* __pb, const char_type* __pe)
+ const {
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
+ for (; __pb != __pe; ++__pb) {
+ if (__ct.narrow(*__pb, 0) == '%') {
+ if (++__pb == __pe) {
+ *__s++ = __pb[-1];
+ break;
+ }
+ char __mod = 0;
+ char __fmt = __ct.narrow(*__pb, 0);
+ if (__fmt == 'E' || __fmt == 'O') {
+ if (++__pb == __pe) {
+ *__s++ = __pb[-2];
+ *__s++ = __pb[-1];
+ break;
}
- else
- *__s++ = *__pb;
- }
- return __s;
+ __mod = __fmt;
+ __fmt = __ct.narrow(*__pb, 0);
+ }
+ __s = do_put(__s, __iob, __fl, __tm, __fmt, __mod);
+ } else
+ *__s++ = *__pb;
+ }
+ return __s;
}
template <class _CharT, class _OutputIterator>
-_OutputIterator
-time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
- char_type, const tm* __tm,
- char __fmt, char __mod) const
-{
- char_type __nar[100];
- char_type* __nb = __nar;
- char_type* __ne = __nb + 100;
- __do_put(__nb, __ne, __tm, __fmt, __mod);
- return std::copy(__nb, __ne, __s);
+_OutputIterator time_put<_CharT, _OutputIterator>::do_put(
+ iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const {
+ char_type __nar[100];
+ char_type* __nb = __nar;
+ char_type* __ne = __nb + 100;
+ __do_put(__nb, __ne, __tm, __fmt, __mod);
+ return std::copy(__nb, __ne, __s);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>;
@@ -2544,20 +2159,16 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>;
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS time_put_byname
- : public time_put<_CharT, _OutputIterator>
-{
+class _LIBCPP_TEMPLATE_VIS time_put_byname : public time_put<_CharT, _OutputIterator> {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put_byname(const char* __nm, size_t __refs = 0)
- : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put_byname(const char* __nm, size_t __refs = 0)
+ : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit time_put_byname(const string& __nm, size_t __refs = 0)
- : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit time_put_byname(const string& __nm, size_t __refs = 0)
+ : time_put<_CharT, _OutputIterator>(__nm, __refs) {}
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put_byname() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put_byname() override {}
};
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>;
@@ -2567,66 +2178,64 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>;
// money_base
-class _LIBCPP_EXPORTED_FROM_ABI money_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI money_base {
public:
- enum part {none, space, symbol, sign, value};
- struct pattern {char field[4];};
+ enum part { none, space, symbol, sign, value };
+ struct pattern {
+ char field[4];
+ };
- _LIBCPP_HIDE_FROM_ABI money_base() {}
+ _LIBCPP_HIDE_FROM_ABI money_base() {}
};
// moneypunct
template <class _CharT, bool _International = false>
-class _LIBCPP_TEMPLATE_VIS moneypunct
- : public locale::facet,
- public money_base
-{
+class _LIBCPP_TEMPLATE_VIS moneypunct : public locale::facet, public money_base {
public:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit moneypunct(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const {return do_decimal_point();}
- _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const {return do_thousands_sep();}
- _LIBCPP_HIDE_FROM_ABI string grouping() const {return do_grouping();}
- _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const {return do_curr_symbol();}
- _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const {return do_positive_sign();}
- _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const {return do_negative_sign();}
- _LIBCPP_HIDE_FROM_ABI int frac_digits() const {return do_frac_digits();}
- _LIBCPP_HIDE_FROM_ABI pattern pos_format() const {return do_pos_format();}
- _LIBCPP_HIDE_FROM_ABI pattern neg_format() const {return do_neg_format();}
-
- static locale::id id;
- static const bool intl = _International;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI explicit moneypunct(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const { return do_curr_symbol(); }
+ _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const { return do_positive_sign(); }
+ _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const { return do_negative_sign(); }
+ _LIBCPP_HIDE_FROM_ABI int frac_digits() const { return do_frac_digits(); }
+ _LIBCPP_HIDE_FROM_ABI pattern pos_format() const { return do_pos_format(); }
+ _LIBCPP_HIDE_FROM_ABI pattern neg_format() const { return do_neg_format(); }
+
+ static locale::id id;
+ static const bool intl = _International;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct() override {}
-
- virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
- virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();}
- virtual string do_grouping() const {return string();}
- virtual string_type do_curr_symbol() const {return string_type();}
- virtual string_type do_positive_sign() const {return string_type();}
- virtual string_type do_negative_sign() const {return string_type(1, '-');}
- virtual int do_frac_digits() const {return 0;}
- virtual pattern do_pos_format() const
- {pattern __p = {{symbol, sign, none, value}}; return __p;}
- virtual pattern do_neg_format() const
- {pattern __p = {{symbol, sign, none, value}}; return __p;}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct() override {}
+
+ virtual char_type do_decimal_point() const { return numeric_limits<char_type>::max(); }
+ virtual char_type do_thousands_sep() const { return numeric_limits<char_type>::max(); }
+ virtual string do_grouping() const { return string(); }
+ virtual string_type do_curr_symbol() const { return string_type(); }
+ virtual string_type do_positive_sign() const { return string_type(); }
+ virtual string_type do_negative_sign() const { return string_type(1, '-'); }
+ virtual int do_frac_digits() const { return 0; }
+ virtual pattern do_pos_format() const {
+ pattern __p = {{symbol, sign, none, value}};
+ return __p;
+ }
+ virtual pattern do_neg_format() const {
+ pattern __p = {{symbol, sign, none, value}};
+ return __p;
+ }
};
template <class _CharT, bool _International>
-locale::id
-moneypunct<_CharT, _International>::id;
+locale::id moneypunct<_CharT, _International>::id;
template <class _CharT, bool _International>
-const bool
-moneypunct<_CharT, _International>::intl;
+const bool moneypunct<_CharT, _International>::intl;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>;
@@ -2638,57 +2247,61 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>
// moneypunct_byname
template <class _CharT, bool _International = false>
-class _LIBCPP_TEMPLATE_VIS moneypunct_byname
- : public moneypunct<_CharT, _International>
-{
+class _LIBCPP_TEMPLATE_VIS moneypunct_byname : public moneypunct<_CharT, _International> {
public:
- typedef money_base::pattern pattern;
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
+ typedef money_base::pattern pattern;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit moneypunct_byname(const char* __nm, size_t __refs = 0)
- : moneypunct<_CharT, _International>(__refs) {init(__nm);}
+ _LIBCPP_HIDE_FROM_ABI explicit moneypunct_byname(const char* __nm, size_t __refs = 0)
+ : moneypunct<_CharT, _International>(__refs) {
+ init(__nm);
+ }
- _LIBCPP_HIDE_FROM_ABI
- explicit moneypunct_byname(const string& __nm, size_t __refs = 0)
- : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
+ _LIBCPP_HIDE_FROM_ABI explicit moneypunct_byname(const string& __nm, size_t __refs = 0)
+ : moneypunct<_CharT, _International>(__refs) {
+ init(__nm.c_str());
+ }
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct_byname() override {}
-
- char_type do_decimal_point() const override {return __decimal_point_;}
- char_type do_thousands_sep() const override {return __thousands_sep_;}
- string do_grouping() const override {return __grouping_;}
- string_type do_curr_symbol() const override {return __curr_symbol_;}
- string_type do_positive_sign() const override {return __positive_sign_;}
- string_type do_negative_sign() const override {return __negative_sign_;}
- int do_frac_digits() const override {return __frac_digits_;}
- pattern do_pos_format() const override {return __pos_format_;}
- pattern do_neg_format() const override {return __neg_format_;}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct_byname() override {}
+
+ char_type do_decimal_point() const override { return __decimal_point_; }
+ char_type do_thousands_sep() const override { return __thousands_sep_; }
+ string do_grouping() const override { return __grouping_; }
+ string_type do_curr_symbol() const override { return __curr_symbol_; }
+ string_type do_positive_sign() const override { return __positive_sign_; }
+ string_type do_negative_sign() const override { return __negative_sign_; }
+ int do_frac_digits() const override { return __frac_digits_; }
+ pattern do_pos_format() const override { return __pos_format_; }
+ pattern do_neg_format() const override { return __neg_format_; }
private:
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
- string_type __curr_symbol_;
- string_type __positive_sign_;
- string_type __negative_sign_;
- int __frac_digits_;
- pattern __pos_format_;
- pattern __neg_format_;
-
- void init(const char*);
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
+ string_type __curr_symbol_;
+ string_type __positive_sign_;
+ string_type __negative_sign_;
+ int __frac_digits_;
+ pattern __pos_format_;
+ pattern __neg_format_;
+
+ void init(const char*);
};
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, false>::init(const char*);
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, true>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, false>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, true>::init(const char*);
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, false>::init(const char*);
-template<> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, true>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, false>::init(const char*);
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, true>::init(const char*);
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>;
#endif
@@ -2696,55 +2309,59 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t
// money_get
template <class _CharT>
-class __money_get
-{
+class __money_get {
protected:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI __money_get() {}
-
- static void __gather_info(bool __intl, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __psn,
- string_type& __nsn, int& __fd);
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI __money_get() {}
+
+ static void __gather_info(
+ bool __intl,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __psn,
+ string_type& __nsn,
+ int& __fd);
};
template <class _CharT>
-void
-__money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __psn,
- string_type& __nsn, int& __fd)
-{
- if (__intl)
- {
- const moneypunct<char_type, true>& __mp =
- std::use_facet<moneypunct<char_type, true> >(__loc);
- __pat = __mp.neg_format();
- __nsn = __mp.negative_sign();
- __psn = __mp.positive_sign();
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
- else
- {
- const moneypunct<char_type, false>& __mp =
- std::use_facet<moneypunct<char_type, false> >(__loc);
- __pat = __mp.neg_format();
- __nsn = __mp.negative_sign();
- __psn = __mp.positive_sign();
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
+void __money_get<_CharT>::__gather_info(
+ bool __intl,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __psn,
+ string_type& __nsn,
+ int& __fd) {
+ if (__intl) {
+ const moneypunct<char_type, true>& __mp = std::use_facet<moneypunct<char_type, true> >(__loc);
+ __pat = __mp.neg_format();
+ __nsn = __mp.negative_sign();
+ __psn = __mp.positive_sign();
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ } else {
+ const moneypunct<char_type, false>& __mp = std::use_facet<moneypunct<char_type, false> >(__loc);
+ __pat = __mp.neg_format();
+ __nsn = __mp.negative_sign();
+ __psn = __mp.positive_sign();
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ }
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>;
@@ -2753,365 +2370,308 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>;
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS money_get
- : public locale::facet,
- private __money_get<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS money_get : public locale::facet, private __money_get<_CharT> {
public:
- typedef _CharT char_type;
- typedef _InputIterator iter_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit money_get(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob,
- ios_base::iostate& __err, long double& __v) const
- {
- return do_get(__b, __e, __intl, __iob, __err, __v);
- }
+ typedef _CharT char_type;
+ typedef _InputIterator iter_type;
+ typedef basic_string<char_type> string_type;
- _LIBCPP_HIDE_FROM_ABI
- iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob,
- ios_base::iostate& __err, string_type& __v) const
- {
- return do_get(__b, __e, __intl, __iob, __err, __v);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit money_get(size_t __refs = 0) : locale::facet(__refs) {}
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ return do_get(__b, __e, __intl, __iob, __err, __v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const {
+ return do_get(__b, __e, __intl, __iob, __err, __v);
+ }
- static locale::id id;
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_get() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_get() override {}
- virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
- ios_base& __iob, ios_base::iostate& __err,
- long double& __v) const;
- virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
- ios_base& __iob, ios_base::iostate& __err,
- string_type& __v) const;
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const;
+ virtual iter_type
+ do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const;
private:
- static bool __do_get(iter_type& __b, iter_type __e,
- bool __intl, const locale& __loc,
- ios_base::fmtflags __flags, ios_base::iostate& __err,
- bool& __neg, const ctype<char_type>& __ct,
- unique_ptr<char_type, void(*)(void*)>& __wb,
- char_type*& __wn, char_type* __we);
+ static bool __do_get(
+ iter_type& __b,
+ iter_type __e,
+ bool __intl,
+ const locale& __loc,
+ ios_base::fmtflags __flags,
+ ios_base::iostate& __err,
+ bool& __neg,
+ const ctype<char_type>& __ct,
+ unique_ptr<char_type, void (*)(void*)>& __wb,
+ char_type*& __wn,
+ char_type* __we);
};
template <class _CharT, class _InputIterator>
-locale::id
-money_get<_CharT, _InputIterator>::id;
+locale::id money_get<_CharT, _InputIterator>::id;
_LIBCPP_EXPORTED_FROM_ABI void __do_nothing(void*);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-void
-__double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
-{
- bool __owns = __b.get_deleter() != __do_nothing;
- size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
- size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
- 2 * __cur_cap : numeric_limits<size_t>::max();
- if (__new_cap == 0)
- __new_cap = sizeof(_Tp);
- size_t __n_off = static_cast<size_t>(__n - __b.get());
- _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
- if (__t == 0)
- __throw_bad_alloc();
- if (__owns)
- __b.release();
- __b = unique_ptr<_Tp, void(*)(void*)>(__t, free);
- __new_cap /= sizeof(_Tp);
- __n = __b.get() + __n_off;
- __e = __b.get() + __new_cap;
+_LIBCPP_HIDE_FROM_ABI void __double_or_nothing(unique_ptr<_Tp, void (*)(void*)>& __b, _Tp*& __n, _Tp*& __e) {
+ bool __owns = __b.get_deleter() != __do_nothing;
+ size_t __cur_cap = static_cast<size_t>(__e - __b.get()) * sizeof(_Tp);
+ size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ? 2 * __cur_cap : numeric_limits<size_t>::max();
+ if (__new_cap == 0)
+ __new_cap = sizeof(_Tp);
+ size_t __n_off = static_cast<size_t>(__n - __b.get());
+ _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
+ if (__t == 0)
+ __throw_bad_alloc();
+ if (__owns)
+ __b.release();
+ __b = unique_ptr<_Tp, void (*)(void*)>(__t, free);
+ __new_cap /= sizeof(_Tp);
+ __n = __b.get() + __n_off;
+ __e = __b.get() + __new_cap;
}
// true == success
template <class _CharT, class _InputIterator>
-bool
-money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
- bool __intl, const locale& __loc,
- ios_base::fmtflags __flags,
- ios_base::iostate& __err,
- bool& __neg,
- const ctype<char_type>& __ct,
- unique_ptr<char_type, void(*)(void*)>& __wb,
- char_type*& __wn, char_type* __we)
-{
- if (__b == __e) {
+bool money_get<_CharT, _InputIterator>::__do_get(
+ iter_type& __b,
+ iter_type __e,
+ bool __intl,
+ const locale& __loc,
+ ios_base::fmtflags __flags,
+ ios_base::iostate& __err,
+ bool& __neg,
+ const ctype<char_type>& __ct,
+ unique_ptr<char_type, void (*)(void*)>& __wb,
+ char_type*& __wn,
+ char_type* __we) {
+ if (__b == __e) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ const unsigned __bz = 100;
+ unsigned __gbuf[__bz];
+ unique_ptr<unsigned, void (*)(void*)> __gb(__gbuf, __do_nothing);
+ unsigned* __gn = __gb.get();
+ unsigned* __ge = __gn + __bz;
+ money_base::pattern __pat;
+ char_type __dp;
+ char_type __ts;
+ string __grp;
+ string_type __sym;
+ string_type __psn;
+ string_type __nsn;
+ // Capture the spaces read into money_base::{space,none} so they
+ // can be compared to initial spaces in __sym.
+ string_type __spaces;
+ int __fd;
+ __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp, __sym, __psn, __nsn, __fd);
+ const string_type* __trailing_sign = 0;
+ __wn = __wb.get();
+ for (unsigned __p = 0; __p < 4 && __b != __e; ++__p) {
+ switch (__pat.field[__p]) {
+ case money_base::space:
+ if (__p != 3) {
+ if (__ct.is(ctype_base::space, *__b))
+ __spaces.push_back(*__b++);
+ else {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ _LIBCPP_FALLTHROUGH();
+ case money_base::none:
+ if (__p != 3) {
+ while (__b != __e && __ct.is(ctype_base::space, *__b))
+ __spaces.push_back(*__b++);
+ }
+ break;
+ case money_base::sign:
+ if (__psn.size() > 0 && *__b == __psn[0]) {
+ ++__b;
+ __neg = false;
+ if (__psn.size() > 1)
+ __trailing_sign = &__psn;
+ break;
+ }
+ if (__nsn.size() > 0 && *__b == __nsn[0]) {
+ ++__b;
+ __neg = true;
+ if (__nsn.size() > 1)
+ __trailing_sign = &__nsn;
+ break;
+ }
+ if (__psn.size() > 0 && __nsn.size() > 0) { // sign is required
__err |= ios_base::failbit;
return false;
- }
- const unsigned __bz = 100;
- unsigned __gbuf[__bz];
- unique_ptr<unsigned, void(*)(void*)> __gb(__gbuf, __do_nothing);
- unsigned* __gn = __gb.get();
- unsigned* __ge = __gn + __bz;
- money_base::pattern __pat;
- char_type __dp;
- char_type __ts;
- string __grp;
- string_type __sym;
- string_type __psn;
- string_type __nsn;
- // Capture the spaces read into money_base::{space,none} so they
- // can be compared to initial spaces in __sym.
- string_type __spaces;
- int __fd;
- __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp,
- __sym, __psn, __nsn, __fd);
- const string_type* __trailing_sign = 0;
- __wn = __wb.get();
- for (unsigned __p = 0; __p < 4 && __b != __e; ++__p)
- {
- switch (__pat.field[__p])
- {
- case money_base::space:
- if (__p != 3)
- {
- if (__ct.is(ctype_base::space, *__b))
- __spaces.push_back(*__b++);
- else
- {
- __err |= ios_base::failbit;
- return false;
- }
- }
- _LIBCPP_FALLTHROUGH();
- case money_base::none:
- if (__p != 3)
- {
- while (__b != __e && __ct.is(ctype_base::space, *__b))
- __spaces.push_back(*__b++);
- }
- break;
- case money_base::sign:
- if (__psn.size() > 0 && *__b == __psn[0])
- {
- ++__b;
- __neg = false;
- if (__psn.size() > 1)
- __trailing_sign = &__psn;
- break;
- }
- if (__nsn.size() > 0 && *__b == __nsn[0])
- {
- ++__b;
- __neg = true;
- if (__nsn.size() > 1)
- __trailing_sign = &__nsn;
- break;
- }
- if (__psn.size() > 0 && __nsn.size() > 0)
- { // sign is required
- __err |= ios_base::failbit;
- return false;
- }
- if (__psn.size() == 0 && __nsn.size() == 0)
- // locale has no way of specifying a sign. Use the initial value of __neg as a default
- break;
- __neg = (__nsn.size() == 0);
- break;
- case money_base::symbol:
- {
- bool __more_needed = __trailing_sign ||
- (__p < 2) ||
- (__p == 2 && __pat.field[3] != static_cast<char>(money_base::none));
- bool __sb = (__flags & ios_base::showbase) != 0;
- if (__sb || __more_needed)
- {
- typename string_type::const_iterator __sym_space_end = __sym.begin();
- if (__p > 0 && (__pat.field[__p - 1] == money_base::none ||
- __pat.field[__p - 1] == money_base::space)) {
- // Match spaces we've already read against spaces at
- // the beginning of __sym.
- while (__sym_space_end != __sym.end() &&
- __ct.is(ctype_base::space, *__sym_space_end))
- ++__sym_space_end;
- const size_t __num_spaces = __sym_space_end - __sym.begin();
- if (__num_spaces > __spaces.size() ||
- !std::equal(__spaces.end() - __num_spaces, __spaces.end(),
- __sym.begin())) {
- // No match. Put __sym_space_end back at the
- // beginning of __sym, which will prevent a
- // match in the next loop.
- __sym_space_end = __sym.begin();
- }
- }
- typename string_type::const_iterator __sym_curr_char = __sym_space_end;
- while (__sym_curr_char != __sym.end() && __b != __e &&
- *__b == *__sym_curr_char) {
- ++__b;
- ++__sym_curr_char;
- }
- if (__sb && __sym_curr_char != __sym.end())
- {
- __err |= ios_base::failbit;
- return false;
- }
- }
- }
- break;
- case money_base::value:
- {
- unsigned __ng = 0;
- for (; __b != __e; ++__b)
- {
- char_type __c = *__b;
- if (__ct.is(ctype_base::digit, __c))
- {
- if (__wn == __we)
- std::__double_or_nothing(__wb, __wn, __we);
- *__wn++ = __c;
- ++__ng;
- }
- else if (__grp.size() > 0 && __ng > 0 && __c == __ts)
- {
- if (__gn == __ge)
- std::__double_or_nothing(__gb, __gn, __ge);
- *__gn++ = __ng;
- __ng = 0;
- }
- else
- break;
- }
- if (__gb.get() != __gn && __ng > 0)
- {
- if (__gn == __ge)
- std::__double_or_nothing(__gb, __gn, __ge);
- *__gn++ = __ng;
- }
- if (__fd > 0)
- {
- if (__b == __e || *__b != __dp)
- {
- __err |= ios_base::failbit;
- return false;
- }
- for (++__b; __fd > 0; --__fd, ++__b)
- {
- if (__b == __e || !__ct.is(ctype_base::digit, *__b))
- {
- __err |= ios_base::failbit;
- return false;
- }
- if (__wn == __we)
- std::__double_or_nothing(__wb, __wn, __we);
- *__wn++ = *__b;
- }
- }
- if (__wn == __wb.get())
- {
- __err |= ios_base::failbit;
- return false;
- }
- }
- break;
+ }
+ if (__psn.size() == 0 && __nsn.size() == 0)
+ // locale has no way of specifying a sign. Use the initial value of __neg as a default
+ break;
+ __neg = (__nsn.size() == 0);
+ break;
+ case money_base::symbol: {
+ bool __more_needed =
+ __trailing_sign || (__p < 2) || (__p == 2 && __pat.field[3] != static_cast<char>(money_base::none));
+ bool __sb = (__flags & ios_base::showbase) != 0;
+ if (__sb || __more_needed) {
+ typename string_type::const_iterator __sym_space_end = __sym.begin();
+ if (__p > 0 && (__pat.field[__p - 1] == money_base::none || __pat.field[__p - 1] == money_base::space)) {
+ // Match spaces we've already read against spaces at
+ // the beginning of __sym.
+ while (__sym_space_end != __sym.end() && __ct.is(ctype_base::space, *__sym_space_end))
+ ++__sym_space_end;
+ const size_t __num_spaces = __sym_space_end - __sym.begin();
+ if (__num_spaces > __spaces.size() ||
+ !std::equal(__spaces.end() - __num_spaces, __spaces.end(), __sym.begin())) {
+ // No match. Put __sym_space_end back at the
+ // beginning of __sym, which will prevent a
+ // match in the next loop.
+ __sym_space_end = __sym.begin();
+ }
}
- }
- if (__trailing_sign)
- {
- for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b)
- {
- if (__b == __e || *__b != (*__trailing_sign)[__i])
- {
- __err |= ios_base::failbit;
- return false;
- }
+ typename string_type::const_iterator __sym_curr_char = __sym_space_end;
+ while (__sym_curr_char != __sym.end() && __b != __e && *__b == *__sym_curr_char) {
+ ++__b;
+ ++__sym_curr_char;
}
- }
- if (__gb.get() != __gn)
- {
- ios_base::iostate __et = ios_base::goodbit;
- __check_grouping(__grp, __gb.get(), __gn, __et);
- if (__et)
- {
+ if (__sb && __sym_curr_char != __sym.end()) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ } break;
+ case money_base::value: {
+ unsigned __ng = 0;
+ for (; __b != __e; ++__b) {
+ char_type __c = *__b;
+ if (__ct.is(ctype_base::digit, __c)) {
+ if (__wn == __we)
+ std::__double_or_nothing(__wb, __wn, __we);
+ *__wn++ = __c;
+ ++__ng;
+ } else if (__grp.size() > 0 && __ng > 0 && __c == __ts) {
+ if (__gn == __ge)
+ std::__double_or_nothing(__gb, __gn, __ge);
+ *__gn++ = __ng;
+ __ng = 0;
+ } else
+ break;
+ }
+ if (__gb.get() != __gn && __ng > 0) {
+ if (__gn == __ge)
+ std::__double_or_nothing(__gb, __gn, __ge);
+ *__gn++ = __ng;
+ }
+ if (__fd > 0) {
+ if (__b == __e || *__b != __dp) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ for (++__b; __fd > 0; --__fd, ++__b) {
+ if (__b == __e || !__ct.is(ctype_base::digit, *__b)) {
__err |= ios_base::failbit;
return false;
+ }
+ if (__wn == __we)
+ std::__double_or_nothing(__wb, __wn, __we);
+ *__wn++ = *__b;
}
+ }
+ if (__wn == __wb.get()) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ } break;
}
- return true;
+ }
+ if (__trailing_sign) {
+ for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b) {
+ if (__b == __e || *__b != (*__trailing_sign)[__i]) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ }
+ if (__gb.get() != __gn) {
+ ios_base::iostate __et = ios_base::goodbit;
+ __check_grouping(__grp, __gb.get(), __gn, __et);
+ if (__et) {
+ __err |= ios_base::failbit;
+ return false;
+ }
+ }
+ return true;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- bool __intl, ios_base& __iob,
- ios_base::iostate& __err,
- long double& __v) const
-{
- const int __bz = 100;
- char_type __wbuf[__bz];
- unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
- char_type* __wn;
- char_type* __we = __wbuf + __bz;
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- bool __neg = false;
- if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
- __wb, __wn, __we))
- {
- const char __src[] = "0123456789";
- char_type __atoms[sizeof(__src)-1];
- __ct.widen(__src, __src + (sizeof(__src)-1), __atoms);
- char __nbuf[__bz];
- char* __nc = __nbuf;
- unique_ptr<char, void(*)(void*)> __h(nullptr, free);
- if (__wn - __wb.get() > __bz-2)
- {
- __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
- if (__h.get() == nullptr)
- __throw_bad_alloc();
- __nc = __h.get();
- }
- if (__neg)
- *__nc++ = '-';
- for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc)
- *__nc = __src[std::find(__atoms, std::end(__atoms), *__w) - __atoms];
- *__nc = char();
- if (sscanf(__nbuf, "%Lf", &__v) != 1)
- __throw_runtime_error("money_get error");
+_InputIterator money_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const {
+ const int __bz = 100;
+ char_type __wbuf[__bz];
+ unique_ptr<char_type, void (*)(void*)> __wb(__wbuf, __do_nothing);
+ char_type* __wn;
+ char_type* __we = __wbuf + __bz;
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ bool __neg = false;
+ if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) {
+ const char __src[] = "0123456789";
+ char_type __atoms[sizeof(__src) - 1];
+ __ct.widen(__src, __src + (sizeof(__src) - 1), __atoms);
+ char __nbuf[__bz];
+ char* __nc = __nbuf;
+ unique_ptr<char, void (*)(void*)> __h(nullptr, free);
+ if (__wn - __wb.get() > __bz - 2) {
+ __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
+ if (__h.get() == nullptr)
+ __throw_bad_alloc();
+ __nc = __h.get();
}
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+ if (__neg)
+ *__nc++ = '-';
+ for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc)
+ *__nc = __src[std::find(__atoms, std::end(__atoms), *__w) - __atoms];
+ *__nc = char();
+ if (sscanf(__nbuf, "%Lf", &__v) != 1)
+ __throw_runtime_error("money_get error");
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
template <class _CharT, class _InputIterator>
-_InputIterator
-money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
- bool __intl, ios_base& __iob,
- ios_base::iostate& __err,
- string_type& __v) const
-{
- const int __bz = 100;
- char_type __wbuf[__bz];
- unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
- char_type* __wn;
- char_type* __we = __wbuf + __bz;
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- bool __neg = false;
- if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
- __wb, __wn, __we))
- {
- __v.clear();
- if (__neg)
- __v.push_back(__ct.widen('-'));
- char_type __z = __ct.widen('0');
- char_type* __w;
- for (__w = __wb.get(); __w < __wn-1; ++__w)
- if (*__w != __z)
- break;
- __v.append(__w, __wn);
- }
- if (__b == __e)
- __err |= ios_base::eofbit;
- return __b;
+_InputIterator money_get<_CharT, _InputIterator>::do_get(
+ iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const {
+ const int __bz = 100;
+ char_type __wbuf[__bz];
+ unique_ptr<char_type, void (*)(void*)> __wb(__wbuf, __do_nothing);
+ char_type* __wn;
+ char_type* __we = __wbuf + __bz;
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ bool __neg = false;
+ if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) {
+ __v.clear();
+ if (__neg)
+ __v.push_back(__ct.widen('-'));
+ char_type __z = __ct.widen('0');
+ char_type* __w;
+ for (__w = __wb.get(); __w < __wn - 1; ++__w)
+ if (*__w != __z)
+ break;
+ __v.append(__w, __wn);
+ }
+ if (__b == __e)
+ __err |= ios_base::eofbit;
+ return __b;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>;
@@ -3122,173 +2682,174 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>;
// money_put
template <class _CharT>
-class __money_put
-{
+class __money_put {
protected:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI __money_put() {}
-
- static void __gather_info(bool __intl, bool __neg, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __sn,
- int& __fd);
- static void __format(char_type* __mb, char_type*& __mi, char_type*& __me,
- ios_base::fmtflags __flags,
- const char_type* __db, const char_type* __de,
- const ctype<char_type>& __ct, bool __neg,
- const money_base::pattern& __pat, char_type __dp,
- char_type __ts, const string& __grp,
- const string_type& __sym, const string_type& __sn,
- int __fd);
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+
+ _LIBCPP_HIDE_FROM_ABI __money_put() {}
+
+ static void __gather_info(
+ bool __intl,
+ bool __neg,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __sn,
+ int& __fd);
+ static void __format(
+ char_type* __mb,
+ char_type*& __mi,
+ char_type*& __me,
+ ios_base::fmtflags __flags,
+ const char_type* __db,
+ const char_type* __de,
+ const ctype<char_type>& __ct,
+ bool __neg,
+ const money_base::pattern& __pat,
+ char_type __dp,
+ char_type __ts,
+ const string& __grp,
+ const string_type& __sym,
+ const string_type& __sn,
+ int __fd);
};
template <class _CharT>
-void
-__money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc,
- money_base::pattern& __pat, char_type& __dp,
- char_type& __ts, string& __grp,
- string_type& __sym, string_type& __sn,
- int& __fd)
-{
- if (__intl)
- {
- const moneypunct<char_type, true>& __mp =
- std::use_facet<moneypunct<char_type, true> >(__loc);
- if (__neg)
- {
- __pat = __mp.neg_format();
- __sn = __mp.negative_sign();
- }
- else
- {
- __pat = __mp.pos_format();
- __sn = __mp.positive_sign();
- }
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
- else
- {
- const moneypunct<char_type, false>& __mp =
- std::use_facet<moneypunct<char_type, false> >(__loc);
- if (__neg)
- {
- __pat = __mp.neg_format();
- __sn = __mp.negative_sign();
- }
- else
- {
- __pat = __mp.pos_format();
- __sn = __mp.positive_sign();
- }
- __dp = __mp.decimal_point();
- __ts = __mp.thousands_sep();
- __grp = __mp.grouping();
- __sym = __mp.curr_symbol();
- __fd = __mp.frac_digits();
- }
+void __money_put<_CharT>::__gather_info(
+ bool __intl,
+ bool __neg,
+ const locale& __loc,
+ money_base::pattern& __pat,
+ char_type& __dp,
+ char_type& __ts,
+ string& __grp,
+ string_type& __sym,
+ string_type& __sn,
+ int& __fd) {
+ if (__intl) {
+ const moneypunct<char_type, true>& __mp = std::use_facet<moneypunct<char_type, true> >(__loc);
+ if (__neg) {
+ __pat = __mp.neg_format();
+ __sn = __mp.negative_sign();
+ } else {
+ __pat = __mp.pos_format();
+ __sn = __mp.positive_sign();
+ }
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ } else {
+ const moneypunct<char_type, false>& __mp = std::use_facet<moneypunct<char_type, false> >(__loc);
+ if (__neg) {
+ __pat = __mp.neg_format();
+ __sn = __mp.negative_sign();
+ } else {
+ __pat = __mp.pos_format();
+ __sn = __mp.positive_sign();
+ }
+ __dp = __mp.decimal_point();
+ __ts = __mp.thousands_sep();
+ __grp = __mp.grouping();
+ __sym = __mp.curr_symbol();
+ __fd = __mp.frac_digits();
+ }
}
template <class _CharT>
-void
-__money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __me,
- ios_base::fmtflags __flags,
- const char_type* __db, const char_type* __de,
- const ctype<char_type>& __ct, bool __neg,
- const money_base::pattern& __pat, char_type __dp,
- char_type __ts, const string& __grp,
- const string_type& __sym, const string_type& __sn,
- int __fd)
-{
- __me = __mb;
- for (char __p : __pat.field)
- {
- switch (__p)
- {
- case money_base::none:
- __mi = __me;
- break;
- case money_base::space:
- __mi = __me;
- *__me++ = __ct.widen(' ');
- break;
- case money_base::sign:
- if (!__sn.empty())
- *__me++ = __sn[0];
- break;
- case money_base::symbol:
- if (!__sym.empty() && (__flags & ios_base::showbase))
- __me = std::copy(__sym.begin(), __sym.end(), __me);
- break;
- case money_base::value:
- {
- // remember start of value so we can reverse it
- char_type* __t = __me;
- // find beginning of digits
- if (__neg)
- ++__db;
- // find end of digits
- const char_type* __d;
- for (__d = __db; __d < __de; ++__d)
- if (!__ct.is(ctype_base::digit, *__d))
- break;
- // print fractional part
- if (__fd > 0)
- {
- int __f;
- for (__f = __fd; __d > __db && __f > 0; --__f)
- *__me++ = *--__d;
- char_type __z = __f > 0 ? __ct.widen('0') : char_type();
- for (; __f > 0; --__f)
- *__me++ = __z;
- *__me++ = __dp;
- }
- // print units part
- if (__d == __db)
- {
- *__me++ = __ct.widen('0');
- }
- else
- {
- unsigned __ng = 0;
- unsigned __ig = 0;
- unsigned __gl = __grp.empty() ? numeric_limits<unsigned>::max()
- : static_cast<unsigned>(__grp[__ig]);
- while (__d != __db)
- {
- if (__ng == __gl)
- {
- *__me++ = __ts;
- __ng = 0;
- if (++__ig < __grp.size())
- __gl = __grp[__ig] == numeric_limits<char>::max() ?
- numeric_limits<unsigned>::max() :
- static_cast<unsigned>(__grp[__ig]);
- }
- *__me++ = *--__d;
- ++__ng;
- }
- }
- // reverse it
- std::reverse(__t, __me);
- }
- break;
+void __money_put<_CharT>::__format(
+ char_type* __mb,
+ char_type*& __mi,
+ char_type*& __me,
+ ios_base::fmtflags __flags,
+ const char_type* __db,
+ const char_type* __de,
+ const ctype<char_type>& __ct,
+ bool __neg,
+ const money_base::pattern& __pat,
+ char_type __dp,
+ char_type __ts,
+ const string& __grp,
+ const string_type& __sym,
+ const string_type& __sn,
+ int __fd) {
+ __me = __mb;
+ for (char __p : __pat.field) {
+ switch (__p) {
+ case money_base::none:
+ __mi = __me;
+ break;
+ case money_base::space:
+ __mi = __me;
+ *__me++ = __ct.widen(' ');
+ break;
+ case money_base::sign:
+ if (!__sn.empty())
+ *__me++ = __sn[0];
+ break;
+ case money_base::symbol:
+ if (!__sym.empty() && (__flags & ios_base::showbase))
+ __me = std::copy(__sym.begin(), __sym.end(), __me);
+ break;
+ case money_base::value: {
+ // remember start of value so we can reverse it
+ char_type* __t = __me;
+ // find beginning of digits
+ if (__neg)
+ ++__db;
+ // find end of digits
+ const char_type* __d;
+ for (__d = __db; __d < __de; ++__d)
+ if (!__ct.is(ctype_base::digit, *__d))
+ break;
+ // print fractional part
+ if (__fd > 0) {
+ int __f;
+ for (__f = __fd; __d > __db && __f > 0; --__f)
+ *__me++ = *--__d;
+ char_type __z = __f > 0 ? __ct.widen('0') : char_type();
+ for (; __f > 0; --__f)
+ *__me++ = __z;
+ *__me++ = __dp;
+ }
+ // print units part
+ if (__d == __db) {
+ *__me++ = __ct.widen('0');
+ } else {
+ unsigned __ng = 0;
+ unsigned __ig = 0;
+ unsigned __gl = __grp.empty() ? numeric_limits<unsigned>::max() : static_cast<unsigned>(__grp[__ig]);
+ while (__d != __db) {
+ if (__ng == __gl) {
+ *__me++ = __ts;
+ __ng = 0;
+ if (++__ig < __grp.size())
+ __gl = __grp[__ig] == numeric_limits<char>::max()
+ ? numeric_limits<unsigned>::max()
+ : static_cast<unsigned>(__grp[__ig]);
+ }
+ *__me++ = *--__d;
+ ++__ng;
}
- }
- // print rest of sign, if any
- if (__sn.size() > 1)
- __me = std::copy(__sn.begin()+1, __sn.end(), __me);
- // set alignment
- if ((__flags & ios_base::adjustfield) == ios_base::left)
- __mi = __me;
- else if ((__flags & ios_base::adjustfield) != ios_base::internal)
- __mi = __mb;
+ }
+ // reverse it
+ std::reverse(__t, __me);
+ } break;
+ }
+ }
+ // print rest of sign, if any
+ if (__sn.size() > 1)
+ __me = std::copy(__sn.begin() + 1, __sn.end(), __me);
+ // set alignment
+ if ((__flags & ios_base::adjustfield) == ios_base::left)
+ __mi = __me;
+ else if ((__flags & ios_base::adjustfield) != ios_base::internal)
+ __mi = __mb;
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>;
@@ -3297,152 +2858,144 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>;
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
-class _LIBCPP_TEMPLATE_VIS money_put
- : public locale::facet,
- private __money_put<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS money_put : public locale::facet, private __money_put<_CharT> {
public:
- typedef _CharT char_type;
- typedef _OutputIterator iter_type;
- typedef basic_string<char_type> string_type;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit money_put(size_t __refs = 0)
- : locale::facet(__refs) {}
-
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl,
- long double __units) const
- {
- return do_put(__s, __intl, __iob, __fl, __units);
- }
+ typedef _CharT char_type;
+ typedef _OutputIterator iter_type;
+ typedef basic_string<char_type> string_type;
- _LIBCPP_HIDE_FROM_ABI
- iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl,
- const string_type& __digits) const
- {
- return do_put(__s, __intl, __iob, __fl, __digits);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit money_put(size_t __refs = 0) : locale::facet(__refs) {}
- static locale::id id;
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const {
+ return do_put(__s, __intl, __iob, __fl, __units);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iter_type
+ put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const {
+ return do_put(__s, __intl, __iob, __fl, __digits);
+ }
+
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_put() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_put() override {}
- virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
- char_type __fl, long double __units) const;
- virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
- char_type __fl, const string_type& __digits) const;
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const;
+ virtual iter_type
+ do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const;
};
template <class _CharT, class _OutputIterator>
-locale::id
-money_put<_CharT, _OutputIterator>::id;
+locale::id money_put<_CharT, _OutputIterator>::id;
template <class _CharT, class _OutputIterator>
-_OutputIterator
-money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
- ios_base& __iob, char_type __fl,
- long double __units) const
-{
- // convert to char
- const size_t __bs = 100;
- char __buf[__bs];
- char* __bb = __buf;
- char_type __digits[__bs];
- char_type* __db = __digits;
- int __n = snprintf(__bb, __bs, "%.0Lf", __units);
- unique_ptr<char, void(*)(void*)> __hn(nullptr, free);
- unique_ptr<char_type, void(*)(void*)> __hd(0, free);
- // secure memory for digit storage
- if (static_cast<size_t>(__n) > __bs-1)
- {
- __n = __libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
- if (__n == -1)
- __throw_bad_alloc();
- __hn.reset(__bb);
- __hd.reset((char_type*)malloc(static_cast<size_t>(__n) * sizeof(char_type)));
- if (__hd == nullptr)
- __throw_bad_alloc();
- __db = __hd.get();
- }
- // gather info
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- __ct.widen(__bb, __bb + __n, __db);
- bool __neg = __n > 0 && __bb[0] == '-';
- money_base::pattern __pat;
- char_type __dp;
- char_type __ts;
- string __grp;
- string_type __sym;
- string_type __sn;
- int __fd;
- this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- // secure memory for formatting
- char_type __mbuf[__bs];
- char_type* __mb = __mbuf;
- unique_ptr<char_type, void(*)(void*)> __hw(0, free);
- size_t __exn = __n > __fd ?
- (static_cast<size_t>(__n) - static_cast<size_t>(__fd)) * 2 +
- __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
- : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
- if (__exn > __bs)
- {
- __hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
- __mb = __hw.get();
- if (__mb == 0)
- __throw_bad_alloc();
- }
- // format
- char_type* __mi;
- char_type* __me;
- this->__format(__mb, __mi, __me, __iob.flags(),
- __db, __db + __n, __ct,
- __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+_OutputIterator money_put<_CharT, _OutputIterator>::do_put(
+ iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const {
+ // convert to char
+ const size_t __bs = 100;
+ char __buf[__bs];
+ char* __bb = __buf;
+ char_type __digits[__bs];
+ char_type* __db = __digits;
+ int __n = snprintf(__bb, __bs, "%.0Lf", __units);
+ unique_ptr<char, void (*)(void*)> __hn(nullptr, free);
+ unique_ptr<char_type, void (*)(void*)> __hd(0, free);
+ // secure memory for digit storage
+ if (static_cast<size_t>(__n) > __bs - 1) {
+ __n = __libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
+ if (__n == -1)
+ __throw_bad_alloc();
+ __hn.reset(__bb);
+ __hd.reset((char_type*)malloc(static_cast<size_t>(__n) * sizeof(char_type)));
+ if (__hd == nullptr)
+ __throw_bad_alloc();
+ __db = __hd.get();
+ }
+ // gather info
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ __ct.widen(__bb, __bb + __n, __db);
+ bool __neg = __n > 0 && __bb[0] == '-';
+ money_base::pattern __pat;
+ char_type __dp;
+ char_type __ts;
+ string __grp;
+ string_type __sym;
+ string_type __sn;
+ int __fd;
+ this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+ // secure memory for formatting
+ char_type __mbuf[__bs];
+ char_type* __mb = __mbuf;
+ unique_ptr<char_type, void (*)(void*)> __hw(0, free);
+ size_t __exn = __n > __fd ? (static_cast<size_t>(__n) - static_cast<size_t>(__fd)) * 2 + __sn.size() + __sym.size() +
+ static_cast<size_t>(__fd) + 1
+ : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
+ if (__exn > __bs) {
+ __hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
+ __mb = __hw.get();
+ if (__mb == 0)
+ __throw_bad_alloc();
+ }
+ // format
+ char_type* __mi;
+ char_type* __me;
+ this->__format(
+ __mb, __mi, __me, __iob.flags(), __db, __db + __n, __ct, __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+ return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
}
template <class _CharT, class _OutputIterator>
-_OutputIterator
-money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
- ios_base& __iob, char_type __fl,
- const string_type& __digits) const
-{
- // gather info
- locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
- bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-');
- money_base::pattern __pat;
- char_type __dp;
- char_type __ts;
- string __grp;
- string_type __sym;
- string_type __sn;
- int __fd;
- this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- // secure memory for formatting
- char_type __mbuf[100];
- char_type* __mb = __mbuf;
- unique_ptr<char_type, void(*)(void*)> __h(0, free);
- size_t __exn = static_cast<int>(__digits.size()) > __fd ?
- (__digits.size() - static_cast<size_t>(__fd)) * 2 +
- __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
- : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
- if (__exn > 100)
- {
- __h.reset((char_type*)malloc(__exn * sizeof(char_type)));
- __mb = __h.get();
- if (__mb == 0)
- __throw_bad_alloc();
- }
- // format
- char_type* __mi;
- char_type* __me;
- this->__format(__mb, __mi, __me, __iob.flags(),
- __digits.data(), __digits.data() + __digits.size(), __ct,
- __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+_OutputIterator money_put<_CharT, _OutputIterator>::do_put(
+ iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const {
+ // gather info
+ locale __loc = __iob.getloc();
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
+ bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-');
+ money_base::pattern __pat;
+ char_type __dp;
+ char_type __ts;
+ string __grp;
+ string_type __sym;
+ string_type __sn;
+ int __fd;
+ this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
+ // secure memory for formatting
+ char_type __mbuf[100];
+ char_type* __mb = __mbuf;
+ unique_ptr<char_type, void (*)(void*)> __h(0, free);
+ size_t __exn =
+ static_cast<int>(__digits.size()) > __fd
+ ? (__digits.size() - static_cast<size_t>(__fd)) * 2 + __sn.size() + __sym.size() + static_cast<size_t>(__fd) +
+ 1
+ : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
+ if (__exn > 100) {
+ __h.reset((char_type*)malloc(__exn * sizeof(char_type)));
+ __mb = __h.get();
+ if (__mb == 0)
+ __throw_bad_alloc();
+ }
+ // format
+ char_type* __mi;
+ char_type* __me;
+ this->__format(
+ __mb,
+ __mi,
+ __me,
+ __iob.flags(),
+ __digits.data(),
+ __digits.data() + __digits.size(),
+ __ct,
+ __neg,
+ __pat,
+ __dp,
+ __ts,
+ __grp,
+ __sym,
+ __sn,
+ __fd);
+ return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>;
@@ -3452,106 +3005,81 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>;
// messages
-class _LIBCPP_EXPORTED_FROM_ABI messages_base
-{
+class _LIBCPP_EXPORTED_FROM_ABI messages_base {
public:
- typedef intptr_t catalog;
+ typedef intptr_t catalog;
- _LIBCPP_HIDE_FROM_ABI messages_base() {}
+ _LIBCPP_HIDE_FROM_ABI messages_base() {}
};
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS messages
- : public locale::facet,
- public messages_base
-{
+class _LIBCPP_TEMPLATE_VIS messages : public locale::facet, public messages_base {
public:
- typedef _CharT char_type;
- typedef basic_string<_CharT> string_type;
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit messages(size_t __refs = 0)
- : locale::facet(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit messages(size_t __refs = 0) : locale::facet(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- catalog open(const basic_string<char>& __nm, const locale& __loc) const
- {
- return do_open(__nm, __loc);
- }
+ _LIBCPP_HIDE_FROM_ABI catalog open(const basic_string<char>& __nm, const locale& __loc) const {
+ return do_open(__nm, __loc);
+ }
- _LIBCPP_HIDE_FROM_ABI
- string_type get(catalog __c, int __set, int __msgid,
- const string_type& __dflt) const
- {
- return do_get(__c, __set, __msgid, __dflt);
- }
+ _LIBCPP_HIDE_FROM_ABI string_type get(catalog __c, int __set, int __msgid, const string_type& __dflt) const {
+ return do_get(__c, __set, __msgid, __dflt);
+ }
- _LIBCPP_HIDE_FROM_ABI
- void close(catalog __c) const
- {
- do_close(__c);
- }
+ _LIBCPP_HIDE_FROM_ABI void close(catalog __c) const { do_close(__c); }
- static locale::id id;
+ static locale::id id;
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages() override {}
- virtual catalog do_open(const basic_string<char>&, const locale&) const;
- virtual string_type do_get(catalog, int __set, int __msgid,
- const string_type& __dflt) const;
- virtual void do_close(catalog) const;
+ virtual catalog do_open(const basic_string<char>&, const locale&) const;
+ virtual string_type do_get(catalog, int __set, int __msgid, const string_type& __dflt) const;
+ virtual void do_close(catalog) const;
};
template <class _CharT>
-locale::id
-messages<_CharT>::id;
+locale::id messages<_CharT>::id;
template <class _CharT>
-typename messages<_CharT>::catalog
-messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
-{
+typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const {
#ifdef _LIBCPP_HAS_CATOPEN
- return (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
-#else // !_LIBCPP_HAS_CATOPEN
- (void)__nm;
- return -1;
+ return (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
+#else // !_LIBCPP_HAS_CATOPEN
+ (void)__nm;
+ return -1;
#endif // _LIBCPP_HAS_CATOPEN
}
template <class _CharT>
typename messages<_CharT>::string_type
-messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
- const string_type& __dflt) const
-{
+messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type& __dflt) const {
#ifdef _LIBCPP_HAS_CATOPEN
- string __ndflt;
- __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__ndflt),
- __dflt.c_str(),
- __dflt.c_str() + __dflt.size());
- nl_catd __cat = (nl_catd)__c;
- static_assert(sizeof(catalog) >= sizeof(nl_catd), "Unexpected nl_catd type");
- char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
- string_type __w;
- __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__w),
- __n, __n + std::strlen(__n));
- return __w;
-#else // !_LIBCPP_HAS_CATOPEN
- (void)__c;
- (void)__set;
- (void)__msgid;
- return __dflt;
+ string __ndflt;
+ __narrow_to_utf8<sizeof(char_type) * __CHAR_BIT__>()(
+ std::back_inserter(__ndflt), __dflt.c_str(), __dflt.c_str() + __dflt.size());
+ nl_catd __cat = (nl_catd)__c;
+ static_assert(sizeof(catalog) >= sizeof(nl_catd), "Unexpected nl_catd type");
+ char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
+ string_type __w;
+ __widen_from_utf8<sizeof(char_type) * __CHAR_BIT__>()(std::back_inserter(__w), __n, __n + std::strlen(__n));
+ return __w;
+#else // !_LIBCPP_HAS_CATOPEN
+ (void)__c;
+ (void)__set;
+ (void)__msgid;
+ return __dflt;
#endif // _LIBCPP_HAS_CATOPEN
}
template <class _CharT>
-void
-messages<_CharT>::do_close(catalog __c) const
-{
+void messages<_CharT>::do_close(catalog __c) const {
#ifdef _LIBCPP_HAS_CATOPEN
- catclose((nl_catd)__c);
-#else // !_LIBCPP_HAS_CATOPEN
- (void)__c;
+ catclose((nl_catd)__c);
+#else // !_LIBCPP_HAS_CATOPEN
+ (void)__c;
#endif // _LIBCPP_HAS_CATOPEN
}
@@ -3561,23 +3089,17 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>;
#endif
template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS messages_byname
- : public messages<_CharT>
-{
+class _LIBCPP_TEMPLATE_VIS messages_byname : public messages<_CharT> {
public:
- typedef messages_base::catalog catalog;
- typedef basic_string<_CharT> string_type;
+ typedef messages_base::catalog catalog;
+ typedef basic_string<_CharT> string_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit messages_byname(const char*, size_t __refs = 0)
- : messages<_CharT>(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit messages_byname(const char*, size_t __refs = 0) : messages<_CharT>(__refs) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit messages_byname(const string&, size_t __refs = 0)
- : messages<_CharT>(__refs) {}
+ _LIBCPP_HIDE_FROM_ABI explicit messages_byname(const string&, size_t __refs = 0) : messages<_CharT>(__refs) {}
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages_byname() override {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages_byname() override {}
};
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>;
@@ -3585,359 +3107,291 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>;
#endif
-template<class _Codecvt, class _Elem = wchar_t,
- class _WideAlloc = allocator<_Elem>,
- class _ByteAlloc = allocator<char> >
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert
-{
+template <class _Codecvt,
+ class _Elem = wchar_t,
+ class _WideAlloc = allocator<_Elem>,
+ class _ByteAlloc = allocator<char> >
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert {
public:
- typedef basic_string<char, char_traits<char>, _ByteAlloc> byte_string;
- typedef basic_string<_Elem, char_traits<_Elem>, _WideAlloc> wide_string;
- typedef typename _Codecvt::state_type state_type;
- typedef typename wide_string::traits_type::int_type int_type;
+ typedef basic_string<char, char_traits<char>, _ByteAlloc> byte_string;
+ typedef basic_string<_Elem, char_traits<_Elem>, _WideAlloc> wide_string;
+ typedef typename _Codecvt::state_type state_type;
+ typedef typename wide_string::traits_type::int_type int_type;
private:
- byte_string __byte_err_string_;
- wide_string __wide_err_string_;
- _Codecvt* __cvtptr_;
- state_type __cvtstate_;
- size_t __cvtcount_;
-
- wstring_convert(const wstring_convert& __wc);
- wstring_convert& operator=(const wstring_convert& __wc);
+ byte_string __byte_err_string_;
+ wide_string __wide_err_string_;
+ _Codecvt* __cvtptr_;
+ state_type __cvtstate_;
+ size_t __cvtcount_;
+
+ wstring_convert(const wstring_convert& __wc);
+ wstring_convert& operator=(const wstring_convert& __wc);
+
public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- wstring_convert() : wstring_convert(new _Codecvt) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit wstring_convert(_Codecvt* __pcvt);
+ _LIBCPP_HIDE_FROM_ABI wstring_convert() : wstring_convert(new _Codecvt) {}
+ _LIBCPP_HIDE_FROM_ABI explicit wstring_convert(_Codecvt* __pcvt);
#else
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_EXPLICIT_SINCE_CXX14
- wstring_convert(_Codecvt* __pcvt = new _Codecvt);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_EXPLICIT_SINCE_CXX14 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
#endif
- _LIBCPP_HIDE_FROM_ABI
- wstring_convert(_Codecvt* __pcvt, state_type __state);
- _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI wstring_convert(const byte_string& __byte_err,
- const wide_string& __wide_err = wide_string());
+ _LIBCPP_HIDE_FROM_ABI wstring_convert(_Codecvt* __pcvt, state_type __state);
+ _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
+ wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string());
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- wstring_convert(wstring_convert&& __wc);
+ _LIBCPP_HIDE_FROM_ABI wstring_convert(wstring_convert&& __wc);
#endif
- _LIBCPP_HIDE_FROM_ABI ~wstring_convert();
-
- _LIBCPP_HIDE_FROM_ABI
- wide_string from_bytes(char __byte)
- {return from_bytes(&__byte, &__byte+1);}
- _LIBCPP_HIDE_FROM_ABI
- wide_string from_bytes(const char* __ptr)
- {return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
- _LIBCPP_HIDE_FROM_ABI
- wide_string from_bytes(const byte_string& __str)
- {return from_bytes(__str.data(), __str.data() + __str.size());}
- _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last);
-
- _LIBCPP_HIDE_FROM_ABI
- byte_string to_bytes(_Elem __wchar)
- {return to_bytes(&__wchar, &__wchar+1);}
- _LIBCPP_HIDE_FROM_ABI
- byte_string to_bytes(const _Elem* __wptr)
- {return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
- _LIBCPP_HIDE_FROM_ABI
- byte_string to_bytes(const wide_string& __wstr)
- {return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
- _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last);
-
- _LIBCPP_HIDE_FROM_ABI
- size_t converted() const _NOEXCEPT {return __cvtcount_;}
- _LIBCPP_HIDE_FROM_ABI
- state_type state() const {return __cvtstate_;}
+ _LIBCPP_HIDE_FROM_ABI ~wstring_convert();
+
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { return from_bytes(&__byte, &__byte + 1); }
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) {
+ return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));
+ }
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const byte_string& __str) {
+ return from_bytes(__str.data(), __str.data() + __str.size());
+ }
+ _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last);
+
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(_Elem __wchar) { return to_bytes(&__wchar, &__wchar + 1); }
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __wptr) {
+ return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));
+ }
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const wide_string& __wstr) {
+ return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());
+ }
+ _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last);
+
+ _LIBCPP_HIDE_FROM_ABI size_t converted() const _NOEXCEPT { return __cvtcount_; }
+ _LIBCPP_HIDE_FROM_ABI state_type state() const { return __cvtstate_; }
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-inline
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(_Codecvt* __pcvt)
- : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
-{
-}
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(_Codecvt* __pcvt)
+ : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0) {}
_LIBCPP_SUPPRESS_DEPRECATED_POP
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-inline
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(_Codecvt* __pcvt, state_type __state)
- : __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
-{
-}
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(_Codecvt* __pcvt, state_type __state)
+ : __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0) {}
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err)
- : __byte_err_string_(__byte_err), __wide_err_string_(__wide_err),
- __cvtstate_(), __cvtcount_(0)
-{
- __cvtptr_ = new _Codecvt;
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(
+ const byte_string& __byte_err, const wide_string& __wide_err)
+ : __byte_err_string_(__byte_err), __wide_err_string_(__wide_err), __cvtstate_(), __cvtcount_(0) {
+ __cvtptr_ = new _Codecvt;
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-inline
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- wstring_convert(wstring_convert&& __wc)
- : __byte_err_string_(std::move(__wc.__byte_err_string_)),
- __wide_err_string_(std::move(__wc.__wide_err_string_)),
- __cvtptr_(__wc.__cvtptr_),
- __cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtcount_)
-{
- __wc.__cvtptr_ = nullptr;
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(wstring_convert&& __wc)
+ : __byte_err_string_(std::move(__wc.__byte_err_string_)),
+ __wide_err_string_(std::move(__wc.__wide_err_string_)),
+ __cvtptr_(__wc.__cvtptr_),
+ __cvtstate_(__wc.__cvtstate_),
+ __cvtcount_(__wc.__cvtcount_) {
+ __wc.__cvtptr_ = nullptr;
}
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::~wstring_convert()
-{
- delete __cvtptr_;
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::~wstring_convert() {
+ delete __cvtptr_;
}
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wide_string
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- from_bytes(const char* __frm, const char* __frm_end)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __cvtcount_ = 0;
- if (__cvtptr_ != nullptr)
- {
- wide_string __ws(2*(__frm_end - __frm), _Elem());
- if (__frm != __frm_end)
- __ws.resize(__ws.capacity());
- codecvt_base::result __r = codecvt_base::ok;
- state_type __st = __cvtstate_;
- if (__frm != __frm_end)
- {
- _Elem* __to = &__ws[0];
- _Elem* __to_end = __to + __ws.size();
- const char* __frm_nxt;
- do
- {
- _Elem* __to_nxt;
- __r = __cvtptr_->in(__st, __frm, __frm_end, __frm_nxt,
- __to, __to_end, __to_nxt);
- __cvtcount_ += __frm_nxt - __frm;
- if (__frm_nxt == __frm)
- {
- __r = codecvt_base::error;
- }
- else if (__r == codecvt_base::noconv)
- {
- __ws.resize(__to - &__ws[0]);
- // This only gets executed if _Elem is char
- __ws.append((const _Elem*)__frm, (const _Elem*)__frm_end);
- __frm = __frm_nxt;
- __r = codecvt_base::ok;
- }
- else if (__r == codecvt_base::ok)
- {
- __ws.resize(__to_nxt - &__ws[0]);
- __frm = __frm_nxt;
- }
- else if (__r == codecvt_base::partial)
- {
- ptrdiff_t __s = __to_nxt - &__ws[0];
- __ws.resize(2 * __s);
- __to = &__ws[0] + __s;
- __to_end = &__ws[0] + __ws.size();
- __frm = __frm_nxt;
- }
- } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::from_bytes(const char* __frm, const char* __frm_end) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __cvtcount_ = 0;
+ if (__cvtptr_ != nullptr) {
+ wide_string __ws(2 * (__frm_end - __frm), _Elem());
+ if (__frm != __frm_end)
+ __ws.resize(__ws.capacity());
+ codecvt_base::result __r = codecvt_base::ok;
+ state_type __st = __cvtstate_;
+ if (__frm != __frm_end) {
+ _Elem* __to = &__ws[0];
+ _Elem* __to_end = __to + __ws.size();
+ const char* __frm_nxt;
+ do {
+ _Elem* __to_nxt;
+ __r = __cvtptr_->in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ __cvtcount_ += __frm_nxt - __frm;
+ if (__frm_nxt == __frm) {
+ __r = codecvt_base::error;
+ } else if (__r == codecvt_base::noconv) {
+ __ws.resize(__to - &__ws[0]);
+ // This only gets executed if _Elem is char
+ __ws.append((const _Elem*)__frm, (const _Elem*)__frm_end);
+ __frm = __frm_nxt;
+ __r = codecvt_base::ok;
+ } else if (__r == codecvt_base::ok) {
+ __ws.resize(__to_nxt - &__ws[0]);
+ __frm = __frm_nxt;
+ } else if (__r == codecvt_base::partial) {
+ ptrdiff_t __s = __to_nxt - &__ws[0];
+ __ws.resize(2 * __s);
+ __to = &__ws[0] + __s;
+ __to_end = &__ws[0] + __ws.size();
+ __frm = __frm_nxt;
}
- if (__r == codecvt_base::ok)
- return __ws;
+ } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
}
+ if (__r == codecvt_base::ok)
+ return __ws;
+ }
- if (__wide_err_string_.empty())
- __throw_range_error("wstring_convert: from_bytes error");
+ if (__wide_err_string_.empty())
+ __throw_range_error("wstring_convert: from_bytes error");
- return __wide_err_string_;
+ return __wide_err_string_;
}
-template<class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
+template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::byte_string
-wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::
- to_bytes(const _Elem* __frm, const _Elem* __frm_end)
-{
- __cvtcount_ = 0;
- if (__cvtptr_ != nullptr)
- {
- byte_string __bs(2*(__frm_end - __frm), char());
- if (__frm != __frm_end)
- __bs.resize(__bs.capacity());
- codecvt_base::result __r = codecvt_base::ok;
- state_type __st = __cvtstate_;
- if (__frm != __frm_end)
- {
- char* __to = &__bs[0];
- char* __to_end = __to + __bs.size();
- const _Elem* __frm_nxt;
- do
- {
- char* __to_nxt;
- __r = __cvtptr_->out(__st, __frm, __frm_end, __frm_nxt,
- __to, __to_end, __to_nxt);
- __cvtcount_ += __frm_nxt - __frm;
- if (__frm_nxt == __frm)
- {
- __r = codecvt_base::error;
- }
- else if (__r == codecvt_base::noconv)
- {
- __bs.resize(__to - &__bs[0]);
- // This only gets executed if _Elem is char
- __bs.append((const char*)__frm, (const char*)__frm_end);
- __frm = __frm_nxt;
- __r = codecvt_base::ok;
- }
- else if (__r == codecvt_base::ok)
- {
- __bs.resize(__to_nxt - &__bs[0]);
- __frm = __frm_nxt;
- }
- else if (__r == codecvt_base::partial)
- {
- ptrdiff_t __s = __to_nxt - &__bs[0];
- __bs.resize(2 * __s);
- __to = &__bs[0] + __s;
- __to_end = &__bs[0] + __bs.size();
- __frm = __frm_nxt;
- }
- } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem* __frm, const _Elem* __frm_end) {
+ __cvtcount_ = 0;
+ if (__cvtptr_ != nullptr) {
+ byte_string __bs(2 * (__frm_end - __frm), char());
+ if (__frm != __frm_end)
+ __bs.resize(__bs.capacity());
+ codecvt_base::result __r = codecvt_base::ok;
+ state_type __st = __cvtstate_;
+ if (__frm != __frm_end) {
+ char* __to = &__bs[0];
+ char* __to_end = __to + __bs.size();
+ const _Elem* __frm_nxt;
+ do {
+ char* __to_nxt;
+ __r = __cvtptr_->out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
+ __cvtcount_ += __frm_nxt - __frm;
+ if (__frm_nxt == __frm) {
+ __r = codecvt_base::error;
+ } else if (__r == codecvt_base::noconv) {
+ __bs.resize(__to - &__bs[0]);
+ // This only gets executed if _Elem is char
+ __bs.append((const char*)__frm, (const char*)__frm_end);
+ __frm = __frm_nxt;
+ __r = codecvt_base::ok;
+ } else if (__r == codecvt_base::ok) {
+ __bs.resize(__to_nxt - &__bs[0]);
+ __frm = __frm_nxt;
+ } else if (__r == codecvt_base::partial) {
+ ptrdiff_t __s = __to_nxt - &__bs[0];
+ __bs.resize(2 * __s);
+ __to = &__bs[0] + __s;
+ __to_end = &__bs[0] + __bs.size();
+ __frm = __frm_nxt;
}
- if (__r == codecvt_base::ok)
- {
- size_t __s = __bs.size();
- __bs.resize(__bs.capacity());
- char* __to = &__bs[0] + __s;
- char* __to_end = __to + __bs.size();
- do
- {
- char* __to_nxt;
- __r = __cvtptr_->unshift(__st, __to, __to_end, __to_nxt);
- if (__r == codecvt_base::noconv)
- {
- __bs.resize(__to - &__bs[0]);
- __r = codecvt_base::ok;
- }
- else if (__r == codecvt_base::ok)
- {
- __bs.resize(__to_nxt - &__bs[0]);
- }
- else if (__r == codecvt_base::partial)
- {
- ptrdiff_t __sp = __to_nxt - &__bs[0];
- __bs.resize(2 * __sp);
- __to = &__bs[0] + __sp;
- __to_end = &__bs[0] + __bs.size();
- }
- } while (__r == codecvt_base::partial);
- if (__r == codecvt_base::ok)
- return __bs;
+ } while (__r == codecvt_base::partial && __frm_nxt < __frm_end);
+ }
+ if (__r == codecvt_base::ok) {
+ size_t __s = __bs.size();
+ __bs.resize(__bs.capacity());
+ char* __to = &__bs[0] + __s;
+ char* __to_end = __to + __bs.size();
+ do {
+ char* __to_nxt;
+ __r = __cvtptr_->unshift(__st, __to, __to_end, __to_nxt);
+ if (__r == codecvt_base::noconv) {
+ __bs.resize(__to - &__bs[0]);
+ __r = codecvt_base::ok;
+ } else if (__r == codecvt_base::ok) {
+ __bs.resize(__to_nxt - &__bs[0]);
+ } else if (__r == codecvt_base::partial) {
+ ptrdiff_t __sp = __to_nxt - &__bs[0];
+ __bs.resize(2 * __sp);
+ __to = &__bs[0] + __sp;
+ __to_end = &__bs[0] + __bs.size();
}
+ } while (__r == codecvt_base::partial);
+ if (__r == codecvt_base::ok)
+ return __bs;
}
+ }
- if (__byte_err_string_.empty())
- __throw_range_error("wstring_convert: to_bytes error");
+ if (__byte_err_string_.empty())
+ __throw_range_error("wstring_convert: to_bytes error");
- return __byte_err_string_;
+ return __byte_err_string_;
}
template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert
- : public basic_streambuf<_Elem, _Tr>
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert : public basic_streambuf<_Elem, _Tr> {
public:
- // types:
- typedef _Elem char_type;
- typedef _Tr traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef typename _Codecvt::state_type state_type;
+ // types:
+ typedef _Elem char_type;
+ typedef _Tr traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef typename _Codecvt::state_type state_type;
private:
- char* __extbuf_;
- const char* __extbufnext_;
- const char* __extbufend_;
- char __extbuf_min_[8];
- size_t __ebs_;
- char_type* __intbuf_;
- size_t __ibs_;
- streambuf* __bufptr_;
- _Codecvt* __cv_;
- state_type __st_;
- ios_base::openmode __cm_;
- bool __owns_eb_;
- bool __owns_ib_;
- bool __always_noconv_;
-
- wbuffer_convert(const wbuffer_convert&);
- wbuffer_convert& operator=(const wbuffer_convert&);
+ char* __extbuf_;
+ const char* __extbufnext_;
+ const char* __extbufend_;
+ char __extbuf_min_[8];
+ size_t __ebs_;
+ char_type* __intbuf_;
+ size_t __ibs_;
+ streambuf* __bufptr_;
+ _Codecvt* __cv_;
+ state_type __st_;
+ ios_base::openmode __cm_;
+ bool __owns_eb_;
+ bool __owns_ib_;
+ bool __always_noconv_;
+
+ wbuffer_convert(const wbuffer_convert&);
+ wbuffer_convert& operator=(const wbuffer_convert&);
public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {}
- explicit _LIBCPP_HIDE_FROM_ABI wbuffer_convert(streambuf* __bytebuf,
- _Codecvt* __pcvt = new _Codecvt,
- state_type __state = state_type());
+ _LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
#else
- _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- wbuffer_convert(streambuf* __bytebuf = nullptr,
- _Codecvt* __pcvt = new _Codecvt,
- state_type __state = state_type());
+ _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
+ wbuffer_convert(streambuf* __bytebuf = nullptr, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
#endif
- _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert();
+ _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert();
- _LIBCPP_HIDE_FROM_ABI
- streambuf* rdbuf() const {return __bufptr_;}
- _LIBCPP_HIDE_FROM_ABI
- streambuf* rdbuf(streambuf* __bytebuf)
- {
- streambuf* __r = __bufptr_;
- __bufptr_ = __bytebuf;
- return __r;
- }
+ _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf() const { return __bufptr_; }
+ _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf(streambuf* __bytebuf) {
+ streambuf* __r = __bufptr_;
+ __bufptr_ = __bytebuf;
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- state_type state() const {return __st_;}
+ _LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; }
protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type underflow();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type pbackfail(int_type __c = traits_type::eof());
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type overflow (int_type __c = traits_type::eof());
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s,
- streamsize __n);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __wch = ios_base::in | ios_base::out);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type seekpos(pos_type __sp,
- ios_base::openmode __wch = ios_base::in | ios_base::out);
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int sync();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type underflow();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type pbackfail(int_type __c = traits_type::eof());
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type overflow(int_type __c = traits_type::eof());
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual pos_type
+ seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out);
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int sync();
private:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __read_mode();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __write_mode();
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL wbuffer_convert* __close();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __read_mode();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __write_mode();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL wbuffer_convert* __close();
};
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-wbuffer_convert<_Codecvt, _Elem, _Tr>::
- wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
+wbuffer_convert<_Codecvt, _Elem, _Tr>::wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
: __extbuf_(nullptr),
__extbufnext_(nullptr),
__extbufend_(nullptr),
@@ -3950,389 +3404,310 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::
__cm_(0),
__owns_eb_(false),
__owns_ib_(false),
- __always_noconv_(__cv_ ? __cv_->always_noconv() : false)
-{
- setbuf(0, 4096);
+ __always_noconv_(__cv_ ? __cv_->always_noconv() : false) {
+ setbuf(0, 4096);
}
template <class _Codecvt, class _Elem, class _Tr>
-wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert()
-{
- __close();
- delete __cv_;
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
+wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert() {
+ __close();
+ delete __cv_;
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
}
template <class _Codecvt, class _Elem, class _Tr>
-typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
- return traits_type::eof();
- bool __initial = __read_mode();
- char_type __1buf;
- if (this->gptr() == 0)
- this->setg(&__1buf, &__1buf+1, &__1buf+1);
- const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
- int_type __c = traits_type::eof();
- if (this->gptr() == this->egptr())
- {
- std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
- if (__always_noconv_)
- {
- streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz);
- __nmemb = __bufptr_->sgetn((char*)this->eback() + __unget_sz, __nmemb);
- if (__nmemb != 0)
- {
- this->setg(this->eback(),
- this->eback() + __unget_sz,
- this->eback() + __unget_sz + __nmemb);
- __c = *this->gptr();
- }
- }
- else
- {
- if (__extbufend_ != __extbufnext_) {
- _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
- _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
- std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
- }
- __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
- __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
- streamsize __nmemb = std::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
- static_cast<streamsize>(__extbufend_ - __extbufnext_));
- codecvt_base::result __r;
- // FIXME: Do we ever need to restore the state here?
- //state_type __svs = __st_;
- streamsize __nr = __bufptr_->sgetn(const_cast<char*>(__extbufnext_), __nmemb);
- if (__nr != 0)
- {
- __extbufend_ = __extbufnext_ + __nr;
- char_type* __inext;
- __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
- this->eback() + __unget_sz,
- this->egptr(), __inext);
- if (__r == codecvt_base::noconv)
- {
- this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
- (char_type*) const_cast<char *>(__extbufend_));
- __c = *this->gptr();
- }
- else if (__inext != this->eback() + __unget_sz)
- {
- this->setg(this->eback(), this->eback() + __unget_sz, __inext);
- __c = *this->gptr();
- }
- }
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ == 0 || __bufptr_ == 0)
+ return traits_type::eof();
+ bool __initial = __read_mode();
+ char_type __1buf;
+ if (this->gptr() == 0)
+ this->setg(&__1buf, &__1buf + 1, &__1buf + 1);
+ const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
+ int_type __c = traits_type::eof();
+ if (this->gptr() == this->egptr()) {
+ std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
+ if (__always_noconv_) {
+ streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz);
+ __nmemb = __bufptr_->sgetn((char*)this->eback() + __unget_sz, __nmemb);
+ if (__nmemb != 0) {
+ this->setg(this->eback(), this->eback() + __unget_sz, this->eback() + __unget_sz + __nmemb);
+ __c = *this->gptr();
+ }
+ } else {
+ if (__extbufend_ != __extbufnext_) {
+ _LIBCPP_ASSERT_NON_NULL(__extbufnext_ != nullptr, "underflow moving from nullptr");
+ _LIBCPP_ASSERT_NON_NULL(__extbuf_ != nullptr, "underflow moving into nullptr");
+ std::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
+ }
+ __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
+ __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
+ streamsize __nmemb = std::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
+ static_cast<streamsize>(__extbufend_ - __extbufnext_));
+ codecvt_base::result __r;
+ // FIXME: Do we ever need to restore the state here?
+ // state_type __svs = __st_;
+ streamsize __nr = __bufptr_->sgetn(const_cast<char*>(__extbufnext_), __nmemb);
+ if (__nr != 0) {
+ __extbufend_ = __extbufnext_ + __nr;
+ char_type* __inext;
+ __r = __cv_->in(
+ __st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, this->egptr(), __inext);
+ if (__r == codecvt_base::noconv) {
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)const_cast<char*>(__extbufend_));
+ __c = *this->gptr();
+ } else if (__inext != this->eback() + __unget_sz) {
+ this->setg(this->eback(), this->eback() + __unget_sz, __inext);
+ __c = *this->gptr();
}
+ }
}
- else
- __c = *this->gptr();
- if (this->eback() == &__1buf)
- this->setg(0, 0, 0);
- return __c;
+ } else
+ __c = *this->gptr();
+ if (this->eback() == &__1buf)
+ this->setg(0, 0, 0);
+ return __c;
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr())
- {
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- {
- this->gbump(-1);
- return traits_type::not_eof(__c);
- }
- if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
- {
- this->gbump(-1);
- *this->gptr() = traits_type::to_char_type(__c);
- return __c;
- }
+wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) {
+ if (traits_type::eq_int_type(__c, traits_type::eof())) {
+ this->gbump(-1);
+ return traits_type::not_eof(__c);
}
- return traits_type::eof();
+ if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) {
+ this->gbump(-1);
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
+ }
+ }
+ return traits_type::eof();
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
+typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ == 0 || __bufptr_ == 0)
+ return traits_type::eof();
+ __write_mode();
+ char_type __1buf;
+ char_type* __pb_save = this->pbase();
+ char_type* __epb_save = this->epptr();
+ if (!traits_type::eq_int_type(__c, traits_type::eof())) {
+ if (this->pptr() == 0)
+ this->setp(&__1buf, &__1buf + 1);
+ *this->pptr() = traits_type::to_char_type(__c);
+ this->pbump(1);
+ }
+ if (this->pptr() != this->pbase()) {
+ if (__always_noconv_) {
+ streamsize __nmemb = static_cast<streamsize>(this->pptr() - this->pbase());
+ if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
return traits_type::eof();
- __write_mode();
- char_type __1buf;
- char_type* __pb_save = this->pbase();
- char_type* __epb_save = this->epptr();
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- {
- if (this->pptr() == 0)
- this->setp(&__1buf, &__1buf+1);
- *this->pptr() = traits_type::to_char_type(__c);
- this->pbump(1);
- }
- if (this->pptr() != this->pbase())
- {
- if (__always_noconv_)
- {
- streamsize __nmemb = static_cast<streamsize>(this->pptr() - this->pbase());
- if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
- return traits_type::eof();
- }
- else
- {
- char* __extbe = __extbuf_;
- codecvt_base::result __r;
- do
- {
- const char_type* __e;
- __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
- __extbuf_, __extbuf_ + __ebs_, __extbe);
- if (__e == this->pbase())
- return traits_type::eof();
- if (__r == codecvt_base::noconv)
- {
- streamsize __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
- return traits_type::eof();
- }
- else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
- {
- streamsize __nmemb = static_cast<size_t>(__extbe - __extbuf_);
- if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
- return traits_type::eof();
- if (__r == codecvt_base::partial)
- {
- this->setp(const_cast<char_type *>(__e), this->pptr());
- this->__pbump(this->epptr() - this->pbase());
- }
- }
- else
- return traits_type::eof();
- } while (__r == codecvt_base::partial);
- }
- this->setp(__pb_save, __epb_save);
- }
- return traits_type::not_eof(__c);
+ } else {
+ char* __extbe = __extbuf_;
+ codecvt_base::result __r;
+ do {
+ const char_type* __e;
+ __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ if (__e == this->pbase())
+ return traits_type::eof();
+ if (__r == codecvt_base::noconv) {
+ streamsize __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
+ if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb)
+ return traits_type::eof();
+ } else if (__r == codecvt_base::ok || __r == codecvt_base::partial) {
+ streamsize __nmemb = static_cast<size_t>(__extbe - __extbuf_);
+ if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
+ return traits_type::eof();
+ if (__r == codecvt_base::partial) {
+ this->setp(const_cast<char_type*>(__e), this->pptr());
+ this->__pbump(this->epptr() - this->pbase());
+ }
+ } else
+ return traits_type::eof();
+ } while (__r == codecvt_base::partial);
+ }
+ this->setp(__pb_save, __epb_save);
+ }
+ return traits_type::not_eof(__c);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-basic_streambuf<_Elem, _Tr>*
-wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n)
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- this->setg(0, 0, 0);
- this->setp(0, 0);
- if (__owns_eb_)
- delete [] __extbuf_;
- if (__owns_ib_)
- delete [] __intbuf_;
- __ebs_ = __n;
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_ && __s)
- {
- __extbuf_ = (char*)__s;
- __owns_eb_ = false;
- }
- else
- {
- __extbuf_ = new char[__ebs_];
- __owns_eb_ = true;
- }
- }
- else
- {
- __extbuf_ = __extbuf_min_;
- __ebs_ = sizeof(__extbuf_min_);
- __owns_eb_ = false;
- }
- if (!__always_noconv_)
- {
- __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
- if (__s && __ibs_ >= sizeof(__extbuf_min_))
- {
- __intbuf_ = __s;
- __owns_ib_ = false;
- }
- else
- {
- __intbuf_ = new char_type[__ibs_];
- __owns_ib_ = true;
- }
- }
- else
- {
- __ibs_ = 0;
- __intbuf_ = 0;
- __owns_ib_ = false;
- }
- return this;
+basic_streambuf<_Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n) {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+ if (__owns_eb_)
+ delete[] __extbuf_;
+ if (__owns_ib_)
+ delete[] __intbuf_;
+ __ebs_ = __n;
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_ && __s) {
+ __extbuf_ = (char*)__s;
+ __owns_eb_ = false;
+ } else {
+ __extbuf_ = new char[__ebs_];
+ __owns_eb_ = true;
+ }
+ } else {
+ __extbuf_ = __extbuf_min_;
+ __ebs_ = sizeof(__extbuf_min_);
+ __owns_eb_ = false;
+ }
+ if (!__always_noconv_) {
+ __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_));
+ if (__s && __ibs_ >= sizeof(__extbuf_min_)) {
+ __intbuf_ = __s;
+ __owns_ib_ = false;
+ } else {
+ __intbuf_ = new char_type[__ibs_];
+ __owns_ib_ = true;
+ }
+ } else {
+ __ibs_ = 0;
+ __intbuf_ = 0;
+ __owns_ib_ = false;
+ }
+ return this;
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __om)
-{
- int __width = __cv_->encoding();
- if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
- return pos_type(off_type(-1));
- // __width > 0 || __off == 0, now check __way
- if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
- return pos_type(off_type(-1));
- pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
- __r.state(__st_);
- return __r;
+wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __om) {
+ int __width = __cv_->encoding();
+ if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
+ return pos_type(off_type(-1));
+ // __width > 0 || __off == 0, now check __way
+ if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
+ return pos_type(off_type(-1));
+ pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
+ __r.state(__st_);
+ return __r;
}
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
-wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch)
-{
- if (__cv_ == 0 || __bufptr_ == 0 || sync())
- return pos_type(off_type(-1));
- if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1)))
- return pos_type(off_type(-1));
- return __sp;
+wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch) {
+ if (__cv_ == 0 || __bufptr_ == 0 || sync())
+ return pos_type(off_type(-1));
+ if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1)))
+ return pos_type(off_type(-1));
+ return __sp;
}
template <class _Codecvt, class _Elem, class _Tr>
-int
-wbuffer_convert<_Codecvt, _Elem, _Tr>::sync()
-{
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
- return 0;
- if (__cm_ & ios_base::out)
- {
- if (this->pptr() != this->pbase())
- if (overflow() == traits_type::eof())
- return -1;
- codecvt_base::result __r;
- do
- {
- char* __extbe;
- __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
- streamsize __nmemb = static_cast<streamsize>(__extbe - __extbuf_);
- if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
- return -1;
- } while (__r == codecvt_base::partial);
- if (__r == codecvt_base::error)
- return -1;
- if (__bufptr_->pubsync())
- return -1;
- }
- else if (__cm_ & ios_base::in)
- {
- off_type __c;
- if (__always_noconv_)
- __c = this->egptr() - this->gptr();
- else
- {
- int __width = __cv_->encoding();
- __c = __extbufend_ - __extbufnext_;
- if (__width > 0)
- __c += __width * (this->egptr() - this->gptr());
- else
- {
- if (this->gptr() != this->egptr())
- {
- std::reverse(this->gptr(), this->egptr());
- codecvt_base::result __r;
- const char_type* __e = this->gptr();
- char* __extbe;
- do
- {
- __r = __cv_->out(__st_, __e, this->egptr(), __e,
- __extbuf_, __extbuf_ + __ebs_, __extbe);
- switch (__r)
- {
- case codecvt_base::noconv:
- __c += this->egptr() - this->gptr();
- break;
- case codecvt_base::ok:
- case codecvt_base::partial:
- __c += __extbe - __extbuf_;
- break;
- default:
- return -1;
- }
- } while (__r == codecvt_base::partial);
- }
+int wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() {
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ if (__cv_ == 0 || __bufptr_ == 0)
+ return 0;
+ if (__cm_ & ios_base::out) {
+ if (this->pptr() != this->pbase())
+ if (overflow() == traits_type::eof())
+ return -1;
+ codecvt_base::result __r;
+ do {
+ char* __extbe;
+ __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ streamsize __nmemb = static_cast<streamsize>(__extbe - __extbuf_);
+ if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb)
+ return -1;
+ } while (__r == codecvt_base::partial);
+ if (__r == codecvt_base::error)
+ return -1;
+ if (__bufptr_->pubsync())
+ return -1;
+ } else if (__cm_ & ios_base::in) {
+ off_type __c;
+ if (__always_noconv_)
+ __c = this->egptr() - this->gptr();
+ else {
+ int __width = __cv_->encoding();
+ __c = __extbufend_ - __extbufnext_;
+ if (__width > 0)
+ __c += __width * (this->egptr() - this->gptr());
+ else {
+ if (this->gptr() != this->egptr()) {
+ std::reverse(this->gptr(), this->egptr());
+ codecvt_base::result __r;
+ const char_type* __e = this->gptr();
+ char* __extbe;
+ do {
+ __r = __cv_->out(__st_, __e, this->egptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe);
+ switch (__r) {
+ case codecvt_base::noconv:
+ __c += this->egptr() - this->gptr();
+ break;
+ case codecvt_base::ok:
+ case codecvt_base::partial:
+ __c += __extbe - __extbuf_;
+ break;
+ default:
+ return -1;
}
+ } while (__r == codecvt_base::partial);
}
- if (__bufptr_->pubseekoff(-__c, ios_base::cur, __cm_) == pos_type(off_type(-1)))
- return -1;
- this->setg(0, 0, 0);
- __cm_ = 0;
+ }
}
- return 0;
+ if (__bufptr_->pubseekoff(-__c, ios_base::cur, __cm_) == pos_type(off_type(-1)))
+ return -1;
+ this->setg(0, 0, 0);
+ __cm_ = 0;
+ }
+ return 0;
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
-bool
-wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode()
-{
- if (!(__cm_ & ios_base::in))
- {
- this->setp(0, 0);
- if (__always_noconv_)
- this->setg((char_type*)__extbuf_,
- (char_type*)__extbuf_ + __ebs_,
- (char_type*)__extbuf_ + __ebs_);
- else
- this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
- __cm_ = ios_base::in;
- return true;
- }
- return false;
+bool wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode() {
+ if (!(__cm_ & ios_base::in)) {
+ this->setp(0, 0);
+ if (__always_noconv_)
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_);
+ else
+ this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
+ __cm_ = ios_base::in;
+ return true;
+ }
+ return false;
}
template <class _Codecvt, class _Elem, class _Tr>
-void
-wbuffer_convert<_Codecvt, _Elem, _Tr>::__write_mode()
-{
- if (!(__cm_ & ios_base::out))
- {
- this->setg(0, 0, 0);
- if (__ebs_ > sizeof(__extbuf_min_))
- {
- if (__always_noconv_)
- this->setp((char_type*)__extbuf_,
- (char_type*)__extbuf_ + (__ebs_ - 1));
- else
- this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
- }
- else
- this->setp(0, 0);
- __cm_ = ios_base::out;
- }
+void wbuffer_convert<_Codecvt, _Elem, _Tr>::__write_mode() {
+ if (!(__cm_ & ios_base::out)) {
+ this->setg(0, 0, 0);
+ if (__ebs_ > sizeof(__extbuf_min_)) {
+ if (__always_noconv_)
+ this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__ebs_ - 1));
+ else
+ this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
+ } else
+ this->setp(0, 0);
+ __cm_ = ios_base::out;
+ }
}
template <class _Codecvt, class _Elem, class _Tr>
-wbuffer_convert<_Codecvt, _Elem, _Tr>*
-wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
-{
- wbuffer_convert* __rt = nullptr;
- if (__cv_ != nullptr && __bufptr_ != nullptr)
- {
- __rt = this;
- if ((__cm_ & ios_base::out) && sync())
- __rt = nullptr;
- }
- return __rt;
+wbuffer_convert<_Codecvt, _Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() {
+ wbuffer_convert* __rt = nullptr;
+ if (__cv_ != nullptr && __bufptr_ != nullptr) {
+ __rt = this;
+ if ((__cm_ & ios_base::out) && sync())
+ __rt = nullptr;
+ }
+ return __rt;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
diff --git a/contrib/llvm-project/libcxx/include/locale.h b/contrib/llvm-project/libcxx/include/locale.h
index 3fb812035a52..20910fa2f97e 100644
--- a/contrib/llvm-project/libcxx/include/locale.h
+++ b/contrib/llvm-project/libcxx/include/locale.h
@@ -36,7 +36,7 @@ Functions:
#include <__config>
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# error "<locale.h> is not supported since libc++ has been configured without support for localization."
+# error "<locale.h> is not supported since libc++ has been configured without support for localization."
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/contrib/llvm-project/libcxx/include/map b/contrib/llvm-project/libcxx/include/map
index 82a296f9cb8d..f122f2ebb15b 100644
--- a/contrib/llvm-project/libcxx/include/map
+++ b/contrib/llvm-project/libcxx/include/map
@@ -619,266 +619,220 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _CP, class _Compare,
+template <class _Key,
+ class _CP,
+ class _Compare,
bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
-class __map_value_compare
- : private _Compare
-{
+class __map_value_compare : private _Compare {
public:
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare()
- _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
- : _Compare() {}
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare(_Compare __c)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
- : _Compare(__c) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Compare& key_comp() const _NOEXCEPT {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _CP& __y) const
- {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _Key& __y) const
- {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _CP& __y) const
- {return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
- {
- using std::swap;
- swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
- }
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
+ : _Compare() {}
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
+ : _Compare(__c) {}
+ _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const {
+ return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const {
+ return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const {
+ return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) {
+ using std::swap;
+ swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _CP& __y) const
- {return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
-
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _K2& __y) const
- {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const {
+ return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);
+ }
+
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const {
+ return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);
+ }
#endif
};
template <class _Key, class _CP, class _Compare>
-class __map_value_compare<_Key, _CP, _Compare, false>
-{
- _Compare __comp_;
+class __map_value_compare<_Key, _CP, _Compare, false> {
+ _Compare __comp_;
public:
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare()
- _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
- : __comp_() {}
- _LIBCPP_HIDE_FROM_ABI
- __map_value_compare(_Compare __c)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
- : __comp_(__c) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Compare& key_comp() const _NOEXCEPT {return __comp_;}
-
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _CP& __y) const
- {return __comp_(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _Key& __y) const
- {return __comp_(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _CP& __y) const
- {return __comp_(__x, __y.__get_value().first);}
- void swap(__map_value_compare& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
- {
- using std::swap;
- swap(__comp_, __y.__comp_);
- }
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
+ : __comp_() {}
+ _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
+ : __comp_(__c) {}
+ _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return __comp_; }
+
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const {
+ return __comp_(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const {
+ return __comp_(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const {
+ return __comp_(__x, __y.__get_value().first);
+ }
+ void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) {
+ using std::swap;
+ swap(__comp_, __y.__comp_);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _CP& __y) const
- {return __comp_(__x, __y.__get_value().first);}
-
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _CP& __x, const _K2& __y) const
- {return __comp_(__x.__get_value().first, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const {
+ return __comp_(__x, __y.__get_value().first);
+ }
+
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const {
+ return __comp_(__x.__get_value().first, __y);
+ }
#endif
};
template <class _Key, class _CP, class _Compare, bool __b>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x,
- __map_value_compare<_Key, _CP, _Compare, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x, __map_value_compare<_Key, _CP, _Compare, __b>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Allocator>
-class __map_node_destructor
-{
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __map_node_destructor {
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
- typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::pointer pointer;
private:
- allocator_type& __na_;
+ allocator_type& __na_;
- __map_node_destructor& operator=(const __map_node_destructor&);
+ __map_node_destructor& operator=(const __map_node_destructor&);
public:
- bool __first_constructed;
- bool __second_constructed;
+ bool __first_constructed;
+ bool __second_constructed;
- _LIBCPP_HIDE_FROM_ABI
- explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
- : __na_(__na),
- __first_constructed(false),
- __second_constructed(false)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
+ : __na_(__na),
+ __first_constructed(false),
+ __second_constructed(false) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- __x.__value_constructed = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
+ : __na_(__x.__na_),
+ __first_constructed(__x.__value_constructed),
+ __second_constructed(__x.__value_constructed) {
+ __x.__value_constructed = false;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__second_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().second));
- if (__first_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().first));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__second_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().second));
+ if (__first_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().first));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
};
template <class _Key, class _Tp, class _Compare, class _Allocator>
- class map;
+class map;
template <class _Key, class _Tp, class _Compare, class _Allocator>
- class multimap;
-template <class _TreeIterator> class __map_const_iterator;
+class multimap;
+template <class _TreeIterator>
+class __map_const_iterator;
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp>
-struct _LIBCPP_STANDALONE_DEBUG __value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
- typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
+struct _LIBCPP_STANDALONE_DEBUG __value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
+ typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value()
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_ref_pair_type __ref()
- {
- value_type& __v = __get_value();
- return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_rref_pair_type __move()
- {
- value_type& __v = __get_value();
- return __nc_rref_pair_type(
- std::move(const_cast<key_type&>(__v.first)),
- std::move(__v.second));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __value_type& operator=(const __value_type& __v)
- {
- __ref() = __v.__get_value();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __value_type& operator=(__value_type&& __v)
- {
- __ref() = __v.__move();
- return *this;
- }
-
- template <class _ValueTp,
- class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- __value_type& operator=(_ValueTp&& __v)
- {
- __ref() = std::forward<_ValueTp>(__v);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_ref_pair_type __ref() {
+ value_type& __v = __get_value();
+ return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_rref_pair_type __move() {
+ value_type& __v = __get_value();
+ return __nc_rref_pair_type(std::move(const_cast<key_type&>(__v.first)), std::move(__v.second));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __value_type& operator=(const __value_type& __v) {
+ __ref() = __v.__get_value();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __value_type& operator=(__value_type&& __v) {
+ __ref() = __v.__move();
+ return *this;
+ }
+
+ template <class _ValueTp, class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI __value_type& operator=(_ValueTp&& __v) {
+ __ref() = std::forward<_ValueTp>(__v);
+ return *this;
+ }
private:
- __value_type() = delete;
- ~__value_type() = delete;
- __value_type(const __value_type&) = delete;
- __value_type(__value_type&&) = delete;
+ __value_type() = delete;
+ ~__value_type() = delete;
+ __value_type(const __value_type&) = delete;
+ __value_type(__value_type&&) = delete;
};
#else
template <class _Key, class _Tp>
-struct __value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
+struct __value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value() { return __cc_; }
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
private:
- __value_type();
- __value_type(__value_type const&);
- __value_type& operator=(__value_type const&);
- ~__value_type();
+ __value_type();
+ __value_type(__value_type const&);
+ __value_type& operator=(__value_type const&);
+ ~__value_type();
};
#endif // _LIBCPP_CXX03_LANG
@@ -887,937 +841,778 @@ template <class _Tp>
struct __extract_key_value_types;
template <class _Key, class _Tp>
-struct __extract_key_value_types<__value_type<_Key, _Tp> >
-{
+struct __extract_key_value_types<__value_type<_Key, _Tp> > {
typedef _Key const __key_type;
- typedef _Tp __mapped_type;
+ typedef _Tp __mapped_type;
};
template <class _TreeIterator>
-class _LIBCPP_TEMPLATE_VIS __map_iterator
-{
- typedef typename _TreeIterator::_NodeTypes _NodeTypes;
- typedef typename _TreeIterator::__pointer_traits __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __map_iterator {
+ typedef typename _TreeIterator::_NodeTypes _NodeTypes;
+ typedef typename _TreeIterator::__pointer_traits __pointer_traits;
- _TreeIterator __i_;
+ _TreeIterator __i_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _TreeIterator::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator operator++(int)
- {
- __map_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator& operator--() {--__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_iterator operator--(int)
- {
- __map_iterator __t(*this);
- --(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __map_iterator& __x, const __map_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _TreeIterator::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_iterator operator++(int) {
+ __map_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __map_iterator& operator--() {
+ --__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_iterator operator--(int) {
+ __map_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_iterator& __x, const __map_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_iterator& __x, const __map_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
};
template <class _TreeIterator>
-class _LIBCPP_TEMPLATE_VIS __map_const_iterator
-{
- typedef typename _TreeIterator::_NodeTypes _NodeTypes;
- typedef typename _TreeIterator::__pointer_traits __pointer_traits;
+class _LIBCPP_TEMPLATE_VIS __map_const_iterator {
+ typedef typename _TreeIterator::_NodeTypes _NodeTypes;
+ typedef typename _TreeIterator::__pointer_traits __pointer_traits;
- _TreeIterator __i_;
+ _TreeIterator __i_;
public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _TreeIterator::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator(__map_iterator<
- typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT
- : __i_(__i.__i_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator operator++(int)
- {
- __map_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator& operator--() {--__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __map_const_iterator operator--(int)
- {
- __map_const_iterator __t(*this);
- --(*this);
- return __t;
- }
-
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
- {return __x.__i_ == __y.__i_;}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
- {return __x.__i_ != __y.__i_;}
-
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
- template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
- template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _TreeIterator::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI
+ __map_const_iterator(__map_iterator< typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT : __i_(__i.__i_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator++(int) {
+ __map_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator--() {
+ --__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator--(int) {
+ __map_const_iterator __t(*this);
+ --(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
+
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
};
-template <class _Key, class _Tp, class _Compare = less<_Key>,
- class _Allocator = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS map
-{
+template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TEMPLATE_VIS map {
public:
- // types:
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
- class _LIBCPP_TEMPLATE_VIS value_compare
- : public __binary_function<value_type, value_type, bool>
- {
- friend class map;
- protected:
- key_compare comp;
+ class _LIBCPP_TEMPLATE_VIS value_compare : public __binary_function<value_type, value_type, bool> {
+ friend class map;
- _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
- public:
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const value_type& __x, const value_type& __y) const
- {return comp(__x.first, __y.first);}
- };
+ protected:
+ key_compare comp;
-private:
+ _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
- typedef std::__value_type<key_type, mapped_type> __value_type;
- typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
- typedef __tree<__value_type, __vc, __allocator_type> __base;
- typedef typename __base::__node_traits __node_traits;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ public:
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
+ return comp(__x.first, __y.first);
+ }
+ };
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+private:
+ typedef std::__value_type<key_type, mapped_type> __value_type;
+ typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+ typedef __tree<__value_type, __vc, __allocator_type> __base;
+ typedef typename __base::__node_traits __node_traits;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- __base __tree_;
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ __base __tree_;
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef __map_iterator<typename __base::iterator> iterator;
- typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef __map_iterator<typename __base::iterator> iterator;
+ typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS map;
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
- _LIBCPP_HIDE_FROM_ABI
- map()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(key_compare())) {}
+ _LIBCPP_HIDE_FROM_ABI map() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(key_compare())) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit map(const key_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(__comp)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit map(const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- map(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__f, __l);
- }
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- map(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__f, __l);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(__comp)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__f, __l);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ map(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- map(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ map(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : map(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : map(__f, __l, key_compare(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- map(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI map(from_range_t, _Range&& __range, const allocator_type& __a)
: map(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- map(const map& __m)
- : __tree_(__m.__tree_)
- {
- insert(__m.begin(), __m.end());
- }
+ _LIBCPP_HIDE_FROM_ABI map(const map& __m) : __tree_(__m.__tree_) { insert(__m.begin(), __m.end()); }
- _LIBCPP_HIDE_FROM_ABI
- map& operator=(const map& __m)
- {
+ _LIBCPP_HIDE_FROM_ABI map& operator=(const map& __m) {
#ifndef _LIBCPP_CXX03_LANG
- __tree_ = __m.__tree_;
+ __tree_ = __m.__tree_;
#else
- if (this != std::addressof(__m)) {
- __tree_.clear();
- __tree_.value_comp() = __m.__tree_.value_comp();
- __tree_.__copy_assign_alloc(__m.__tree_);
- insert(__m.begin(), __m.end());
- }
+ if (this != std::addressof(__m)) {
+ __tree_.clear();
+ __tree_.value_comp() = __m.__tree_.value_comp();
+ __tree_.__copy_assign_alloc(__m.__tree_);
+ insert(__m.begin(), __m.end());
+ }
#endif
- return *this;
- }
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- map(map&& __m)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__m.__tree_))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- map& operator=(map&& __m)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__m.__tree_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI map(map&& __m) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__m.__tree_)) {}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- map(initializer_list<value_type> __il, const allocator_type& __a)
- : map(__il, key_compare(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a);
+
+ _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__m.__tree_);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__il.begin(), __il.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const allocator_type& __a)
+ : map(__il, key_compare(), __a) {}
+# endif
- _LIBCPP_HIDE_FROM_ABI
- map& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_unique(__il.begin(), __il.end());
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI map& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_unique(__il.begin(), __il.end());
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit map(const allocator_type& __a)
- : __tree_(typename __base::allocator_type(__a))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI
- map(const map& __m, const allocator_type& __a)
- : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a))
- {
- insert(__m.begin(), __m.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ~map() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI explicit map(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
-#endif
+ _LIBCPP_HIDE_FROM_ABI map(const map& __m, const allocator_type& __a)
+ : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
+ insert(__m.begin(), __m.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
- _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
- _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__tree_.__alloc());}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp().key_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
#ifndef _LIBCPP_CXX03_LANG
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&& ...__args) {
- return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
+#endif
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&& ...__args) {
- return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(_Pp&& __p)
- {return __tree_.__insert_unique(std::forward<_Pp>(__p));}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __pos, _Pp&& __p)
- {return __tree_.__insert_unique(__pos.__i_, std::forward<_Pp>(__p));}
+#ifndef _LIBCPP_CXX03_LANG
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...);
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __p) {
+ return __tree_.__insert_unique(std::forward<_Pp>(__p));
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
+ return __tree_.__insert_unique(__pos.__i_, std::forward<_Pp>(__p));
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__insert_unique(__v); }
- _LIBCPP_HIDE_FROM_ABI
- iterator
- insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_unique(__p.__i_, __v);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_unique(__p.__i_, __v);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool>
- insert(value_type&& __v) {return __tree_.__insert_unique(std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
+ return __tree_.__insert_unique(std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_unique(__p.__i_, std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_unique(__p.__i_, std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- insert(__e.__i_, *__f);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ insert(__e.__i_, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- insert(__end.__i_, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ insert(__end.__i_, std::forward<decltype(__element)>(__element));
}
+ }
#endif
#if _LIBCPP_STD_VER >= 17
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
- {
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
- {
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
+ return __tree_.__emplace_unique_key_args(
+ __k,
+ std::piecewise_construct,
+ std::forward_as_tuple(__k),
+ std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
- {
- return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
+ return __tree_.__emplace_unique_key_args(
+ __k,
+ std::piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) {
+ return __tree_
+ .__emplace_hint_unique_key_args(
+ __h.__i_,
+ __k,
std::piecewise_construct,
std::forward_as_tuple(__k),
- std::forward_as_tuple(std::forward<_Args>(__args)...)).first;
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
- {
- return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
+ std::forward_as_tuple(std::forward<_Args>(__args)...))
+ .first;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) {
+ return __tree_
+ .__emplace_hint_unique_key_args(
+ __h.__i_,
+ __k,
std::piecewise_construct,
std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(std::forward<_Args>(__args)...)).first;
- }
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
- {
- iterator __p = lower_bound(__k);
- if ( __p != end() && !key_comp()(__k, __p->first))
- {
- __p->second = std::forward<_Vp>(__v);
- return std::make_pair(__p, false);
- }
- return std::make_pair(emplace_hint(__p, __k, std::forward<_Vp>(__v)), true);
+ std::forward_as_tuple(std::forward<_Args>(__args)...))
+ .first;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
+ iterator __p = lower_bound(__k);
+ if (__p != end() && !key_comp()(__k, __p->first)) {
+ __p->second = std::forward<_Vp>(__v);
+ return std::make_pair(__p, false);
}
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
- {
- iterator __p = lower_bound(__k);
- if ( __p != end() && !key_comp()(__k, __p->first))
- {
- __p->second = std::forward<_Vp>(__v);
- return std::make_pair(__p, false);
- }
- return std::make_pair(emplace_hint(__p, std::move(__k), std::forward<_Vp>(__v)), true);
+ return std::make_pair(emplace_hint(__p, __k, std::forward<_Vp>(__v)), true);
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
+ iterator __p = lower_bound(__k);
+ if (__p != end() && !key_comp()(__k, __p->first)) {
+ __p->second = std::forward<_Vp>(__v);
+ return std::make_pair(__p, false);
}
+ return std::make_pair(emplace_hint(__p, std::move(__k), std::forward<_Vp>(__v)), true);
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h,
- const key_type& __k,
- _Vp&& __v) {
- auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(
- __h.__i_, __k, __k, std::forward<_Vp>(__v));
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) {
+ auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, __k, std::forward<_Vp>(__v));
- if (!__inserted)
- __r->__get_value().second = std::forward<_Vp>(__v);
+ if (!__inserted)
+ __r->__get_value().second = std::forward<_Vp>(__v);
- return __r;
- }
+ return __r;
+ }
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h,
- key_type&& __k,
- _Vp&& __v) {
- auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(
- __h.__i_, __k, std::move(__k), std::forward<_Vp>(__v));
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) {
+ auto [__r, __inserted] =
+ __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, std::move(__k), std::forward<_Vp>(__v));
- if (!__inserted)
- __r->__get_value().second = std::forward<_Vp>(__v);
+ if (!__inserted)
+ __r->__get_value().second = std::forward<_Vp>(__v);
- return __r;
- }
+ return __r;
+ }
#endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k)
- {return __tree_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f.__i_, __l.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
+ return __tree_.erase(__f.__i_, __l.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to map::insert()");
- return __tree_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to map::insert()");
- return __tree_.template __node_handle_insert_unique<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it.__i_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to map::insert()");
+ return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to map::insert()");
+ return __tree_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(map& __m)
- _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__m.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__m.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
private:
- typedef typename __base::__node __node;
- typedef typename __base::__node_allocator __node_allocator;
- typedef typename __base::__node_pointer __node_pointer;
- typedef typename __base::__node_base_pointer __node_base_pointer;
- typedef typename __base::__parent_pointer __parent_pointer;
+ typedef typename __base::__node __node;
+ typedef typename __base::__node_allocator __node_allocator;
+ typedef typename __base::__node_pointer __node_pointer;
+ typedef typename __base::__node_base_pointer __node_base_pointer;
+ typedef typename __base::__parent_pointer __parent_pointer;
- typedef __map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef __map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
#ifdef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
+ -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<__range_key_type<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Compare = less<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Allocator)
- -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- less<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ less<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(from_range_t, _Range&&, _Allocator)
- -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
-#endif
+ -> map<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+ -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
- : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a))
-{
- if (__a != __m.get_allocator())
- {
- const_iterator __e = cend();
- while (!__m.empty())
- __tree_.__insert_unique(__e.__i_,
- __m.__tree_.remove(__m.begin().__i_)->__value_.__move());
- }
+ : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
+ if (__a != __m.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__m.empty())
+ __tree_.__insert_unique(__e.__i_, __m.__tree_.remove(__m.begin().__i_)->__value_.__move());
+ }
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
-{
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
+ return __tree_
+ .__emplace_unique_key_args(__k, std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
-{
- // TODO investigate this clang-tidy warning.
- // NOLINTNEXTLINE(bugprone-use-after-move)
- return __tree_.__emplace_unique_key_args(__k,
- std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) {
+ // TODO investigate this clang-tidy warning.
+ // NOLINTBEGIN(bugprone-use-after-move)
+ return __tree_
+ .__emplace_unique_key_args(
+ __k, std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
+ // NOLINTEND(bugprone-use-after-move)
}
#else // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
-map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k)
-{
- __node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().second));
- __h.get_deleter().__second_constructed = true;
- return __h;
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k) {
+ __node_allocator& __na = __tree_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().first), __k);
+ __h.get_deleter().__first_constructed = true;
+ __node_traits::construct(__na, std::addressof(__h->__value_.__get_value().second));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
- __node_pointer __r = static_cast<__node_pointer>(__child);
- if (__child == nullptr)
- {
- __node_holder __h = __construct_node_with_key(__k);
- __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- __r = __h.release();
- }
- return __r->__value_.__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
+ __node_pointer __r = static_cast<__node_pointer>(__child);
+ if (__child == nullptr) {
+ __node_holder __h = __construct_node_with_key(__k);
+ __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __r = __h.release();
+ }
+ return __r->__value_.__get_value().second;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
-{
- __parent_pointer __parent;
- __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
- if (__child == nullptr)
- __throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
+_Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
+ __parent_pointer __parent;
+ __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
+ if (__child == nullptr)
+ __throw_out_of_range("map::at: key not found");
+ return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-const _Tp&
-map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
-{
- __parent_pointer __parent;
- __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
- if (__child == nullptr)
- __throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
+const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
+ __parent_pointer __parent;
+ __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
+ if (__child == nullptr)
+ __throw_out_of_range("map::at: key not found");
+ return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
}
-
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
- const map<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // #if _LIBCPP_STD_VER <= 17
@@ -1825,654 +1620,519 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
template <class _Key, class _Tp, class _Compare, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(),
- __x.end(),
- __y.begin(),
- __y.end(),
- std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(),
+ __x.end(),
+ __y.begin(),
+ __y.end(),
+ std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
}
#endif // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
- map<_Key, _Tp, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Compare, class _Allocator,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename map<_Key, _Tp, _Compare, _Allocator>::size_type
- erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
+template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename map<_Key, _Tp, _Compare, _Allocator>::size_type
+erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
-
-template <class _Key, class _Tp, class _Compare = less<_Key>,
- class _Allocator = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS multimap
-{
+template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
+class _LIBCPP_TEMPLATE_VIS multimap {
public:
- // types:
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
+ // types:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
- class _LIBCPP_TEMPLATE_VIS value_compare
- : public __binary_function<value_type, value_type, bool>
- {
- friend class multimap;
- protected:
- key_compare comp;
+ class _LIBCPP_TEMPLATE_VIS value_compare : public __binary_function<value_type, value_type, bool> {
+ friend class multimap;
- _LIBCPP_HIDE_FROM_ABI
- value_compare(key_compare __c) : comp(__c) {}
- public:
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const value_type& __x, const value_type& __y) const
- {return comp(__x.first, __y.first);}
- };
+ protected:
+ key_compare comp;
-private:
+ _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
- typedef std::__value_type<key_type, mapped_type> __value_type;
- typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
- typedef __tree<__value_type, __vc, __allocator_type> __base;
- typedef typename __base::__node_traits __node_traits;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ public:
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
+ return comp(__x.first, __y.first);
+ }
+ };
+
+private:
+ typedef std::__value_type<key_type, mapped_type> __value_type;
+ typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+ typedef __tree<__value_type, __vc, __allocator_type> __base;
+ typedef typename __base::__node_traits __node_traits;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- __base __tree_;
+ __base __tree_;
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef __map_iterator<typename __base::iterator> iterator;
- typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef __map_iterator<typename __base::iterator> iterator;
+ typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
#endif
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS map;
- template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multimap;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS map;
+ template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multimap;
- _LIBCPP_HIDE_FROM_ABI
- multimap()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(key_compare())) {}
+ _LIBCPP_HIDE_FROM_ABI multimap() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(key_compare())) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit multimap(const key_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__vc(__comp)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit multimap(const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multimap(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__f, __l);
- }
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multimap(_InputIterator __f, _InputIterator __l,
- const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__f, __l);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__vc(__comp)) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__f, __l);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multimap(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ multimap(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : multimap(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : multimap(__f, __l, key_compare(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multimap(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI multimap(from_range_t, _Range&& __range, const allocator_type& __a)
: multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- multimap(const multimap& __m)
- : __tree_(__m.__tree_.value_comp(),
- __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
- {
- insert(__m.begin(), __m.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap& operator=(const multimap& __m)
- {
+ _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m)
+ : __tree_(__m.__tree_.value_comp(),
+ __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc())) {
+ insert(__m.begin(), __m.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multimap& operator=(const multimap& __m) {
#ifndef _LIBCPP_CXX03_LANG
- __tree_ = __m.__tree_;
+ __tree_ = __m.__tree_;
#else
- if (this != std::addressof(__m)) {
- __tree_.clear();
- __tree_.value_comp() = __m.__tree_.value_comp();
- __tree_.__copy_assign_alloc(__m.__tree_);
- insert(__m.begin(), __m.end());
- }
+ if (this != std::addressof(__m)) {
+ __tree_.clear();
+ __tree_.value_comp() = __m.__tree_.value_comp();
+ __tree_.__copy_assign_alloc(__m.__tree_);
+ insert(__m.begin(), __m.end());
+ }
#endif
- return *this;
- }
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- multimap(multimap&& __m)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__m.__tree_))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- multimap& operator=(multimap&& __m)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__m.__tree_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
- : __tree_(__vc(__comp))
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
- : __tree_(__vc(__comp), typename __base::allocator_type(__a))
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__m.__tree_)) {}
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- multimap(initializer_list<value_type> __il, const allocator_type& __a)
- : multimap(__il, key_compare(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI
- multimap& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_multi(__il.begin(), __il.end());
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__m.__tree_);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+ : __tree_(__vc(__comp)) {
+ insert(__il.begin(), __il.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI
+ multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
+ : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const allocator_type& __a)
+ : multimap(__il, key_compare(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI multimap& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_multi(__il.begin(), __il.end());
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit multimap(const allocator_type& __a)
- : __tree_(typename __base::allocator_type(__a))
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multimap(const multimap& __m, const allocator_type& __a)
- : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a))
- {
- insert(__m.begin(), __m.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ~multimap() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__tree_.__alloc());}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp().key_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const
- {return value_compare(__tree_.value_comp().key_comp());}
+ _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a)
+ : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
+ insert(__m.begin(), __m.end());
+ }
-#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI ~multimap() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace(_Args&& ...__args) {
- return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&& ...__args) {
- return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(_Pp&& __p)
- {return __tree_.__insert_multi(std::forward<_Pp>(__p));}
+#ifndef _LIBCPP_CXX03_LANG
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __pos, _Pp&& __p)
- {return __tree_.__insert_multi(__pos.__i_, std::forward<_Pp>(__p));}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __v)
- {return __tree_.__insert_multi(std::move(__v));}
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __p) {
+ return __tree_.__insert_multi(std::forward<_Pp>(__p));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_multi(__p.__i_, std::move(__v));}
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value>>
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
+ return __tree_.__insert_multi(__pos.__i_, std::forward<_Pp>(__p));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__insert_multi(std::move(__v)); }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_multi(__p.__i_, std::move(__v));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__insert_multi(__v); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_multi(__p.__i_, __v);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_multi(__p.__i_, __v);
+ }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_multi(__e.__i_, *__f);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ __tree_.__insert_multi(__e.__i_, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- __tree_.__insert_multi(__end.__i_, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ __tree_.__insert_multi(__end.__i_, std::forward<decltype(__element)>(__element));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __tree_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f.__i_, __l.__i_);}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
+ return __tree_.erase(__f.__i_, __l.__i_);
+ }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multimap::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multimap::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __tree_.__node_handle_merge_multi(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multimap::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multimap::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(multimap& __m)
- _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__m.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__m.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
private:
- typedef typename __base::__node __node;
- typedef typename __base::__node_allocator __node_allocator;
- typedef typename __base::__node_pointer __node_pointer;
+ typedef typename __base::__node __node;
+ typedef typename __base::__node_allocator __node_allocator;
+ typedef typename __base::__node_pointer __node_pointer;
- typedef __map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef __map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
+ -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<__range_key_type<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Compare = less<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Allocator)
- -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- less<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ less<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(from_range_t, _Range&&, _Allocator)
- -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
-#endif
+ -> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+ -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
- : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a))
-{
- if (__a != __m.get_allocator())
- {
- const_iterator __e = cend();
- while (!__m.empty())
- __tree_.__insert_multi(__e.__i_,
- std::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move()));
- }
+ : __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
+ if (__a != __m.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__m.empty())
+ __tree_.__insert_multi(__e.__i_, std::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move()));
+ }
}
#endif
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // #if _LIBCPP_STD_VER <= 17
@@ -2481,33 +2141,27 @@ template <class _Key, class _Tp, class _Compare, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(),
- __x.end(),
- __y.begin(),
- __y.end(),
- std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(),
+ __x.end(),
+ __y.begin(),
+ __y.end(),
+ std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
}
#endif // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
- multimap<_Key, _Tp, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Compare, class _Allocator,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
- erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c,
- _Predicate __pred) {
+template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
+erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
@@ -2518,10 +2172,12 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_BEGIN_NAMESPACE_STD
namespace pmr {
template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>>
-using map _LIBCPP_AVAILABILITY_PMR = std::map<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
+using map _LIBCPP_AVAILABILITY_PMR =
+ std::map<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>>
-using multimap _LIBCPP_AVAILABILITY_PMR = std::multimap<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
+using multimap _LIBCPP_AVAILABILITY_PMR =
+ std::multimap<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD
#endif
diff --git a/contrib/llvm-project/libcxx/include/math.h b/contrib/llvm-project/libcxx/include/math.h
index b068ea388f09..05989734c26c 100644
--- a/contrib/llvm-project/libcxx/include/math.h
+++ b/contrib/llvm-project/libcxx/include/math.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_MATH_H
-#define _LIBCPP_MATH_H
+# define _LIBCPP_MATH_H
/*
math.h synopsis
@@ -291,17 +291,17 @@ long double truncl(long double x);
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<math.h>)
# include_next <math.h>
# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
// We support including .h headers inside 'extern "C"' contexts, so switch
// back to C++ linkage before including these C++ headers.
@@ -355,30 +355,29 @@ extern "C++" {
# undef isunordered
# endif
-#include <__math/abs.h>
-#include <__math/copysign.h>
-#include <__math/error_functions.h>
-#include <__math/exponential_functions.h>
-#include <__math/fdim.h>
-#include <__math/fma.h>
-#include <__math/gamma.h>
-#include <__math/hyperbolic_functions.h>
-#include <__math/hypot.h>
-#include <__math/inverse_hyperbolic_functions.h>
-#include <__math/inverse_trigonometric_functions.h>
-#include <__math/logarithms.h>
-#include <__math/min_max.h>
-#include <__math/modulo.h>
-#include <__math/remainder.h>
-#include <__math/roots.h>
-#include <__math/rounding_functions.h>
-#include <__math/traits.h>
-#include <__math/trigonometric_functions.h>
-#include <__type_traits/enable_if.h>
-#include <__type_traits/is_floating_point.h>
-#include <__type_traits/is_integral.h>
-#include <stdlib.h>
-
+# include <__math/abs.h>
+# include <__math/copysign.h>
+# include <__math/error_functions.h>
+# include <__math/exponential_functions.h>
+# include <__math/fdim.h>
+# include <__math/fma.h>
+# include <__math/gamma.h>
+# include <__math/hyperbolic_functions.h>
+# include <__math/hypot.h>
+# include <__math/inverse_hyperbolic_functions.h>
+# include <__math/inverse_trigonometric_functions.h>
+# include <__math/logarithms.h>
+# include <__math/min_max.h>
+# include <__math/modulo.h>
+# include <__math/remainder.h>
+# include <__math/roots.h>
+# include <__math/rounding_functions.h>
+# include <__math/traits.h>
+# include <__math/trigonometric_functions.h>
+# include <__type_traits/enable_if.h>
+# include <__type_traits/is_floating_point.h>
+# include <__type_traits/is_integral.h>
+# include <stdlib.h>
// fpclassify relies on implementation-defined constants, so we can't move it to a detail header
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -416,7 +415,7 @@ using std::__math::fpclassify;
using std::__math::signbit;
// The MSVC runtime already provides these functions as templates
-#ifndef _LIBCPP_MSVCRT
+# ifndef _LIBCPP_MSVCRT
using std::__math::isfinite;
using std::__math::isgreater;
using std::__math::isgreaterequal;
@@ -427,7 +426,7 @@ using std::__math::islessgreater;
using std::__math::isnan;
using std::__math::isnormal;
using std::__math::isunordered;
-#endif // _LIBCPP_MSVCRT
+# endif // _LIBCPP_MSVCRT
// abs
//
@@ -442,13 +441,13 @@ using std::__math::isunordered;
// templates. Functions are preferred over function templates during overload resolution, which means that our overload
// will only be selected when the C library doesn't provide one.
-using std::__math::acosh;
using std::__math::acos;
-using std::__math::asinh;
+using std::__math::acosh;
using std::__math::asin;
-using std::__math::atanh;
+using std::__math::asinh;
using std::__math::atan;
using std::__math::atan2;
+using std::__math::atanh;
using std::__math::cbrt;
using std::__math::ceil;
using std::__math::copysign;
@@ -473,13 +472,13 @@ using std::__math::ldexp;
using std::__math::lgamma;
using std::__math::llrint;
using std::__math::llround;
-using std::__math::lrint;
-using std::__math::lround;
using std::__math::log;
using std::__math::log10;
using std::__math::log1p;
using std::__math::log2;
using std::__math::logb;
+using std::__math::lrint;
+using std::__math::lround;
using std::__math::modf;
using std::__math::nearbyint;
using std::__math::nextafter;
@@ -502,7 +501,7 @@ using std::__math::trunc;
} // extern "C++"
-#endif // __cplusplus
+# endif // __cplusplus
#else // _LIBCPP_MATH_H
@@ -514,8 +513,8 @@ using std::__math::trunc;
//
// and receive the definitions of mathematical constants, even if <math.h>
// has previously been included.
-#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
-#include_next <math.h>
-#endif
+# if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
+# include_next <math.h>
+# endif
#endif // _LIBCPP_MATH_H
diff --git a/contrib/llvm-project/libcxx/include/module.modulemap.in b/contrib/llvm-project/libcxx/include/module.modulemap.in
index 5f57a8a2b1bf..d10670d4faaf 100644
--- a/contrib/llvm-project/libcxx/include/module.modulemap.in
+++ b/contrib/llvm-project/libcxx/include/module.modulemap.in
@@ -530,10 +530,8 @@ module std_experimental [system] {
export *
}
module simd {
- module abi_tag { private header "experimental/__simd/abi_tag.h" }
module aligned_tag { private header "experimental/__simd/aligned_tag.h" }
module declaration { private header "experimental/__simd/declaration.h" }
- module internal_declaration { private header "experimental/__simd/internal_declaration.h" }
module reference { private header "experimental/__simd/reference.h" }
module scalar { private header "experimental/__simd/scalar.h" }
module simd { private header "experimental/__simd/simd.h" }
@@ -666,6 +664,7 @@ module std_private_algorithm_find_first_of [system
module std_private_algorithm_find_if [system] { header "__algorithm/find_if.h" }
module std_private_algorithm_find_if_not [system] { header "__algorithm/find_if_not.h" }
module std_private_algorithm_find_segment_if [system] { header "__algorithm/find_segment_if.h" }
+module std_private_algorithm_fold [system] { header "__algorithm/fold.h" }
module std_private_algorithm_for_each [system] { header "__algorithm/for_each.h" }
module std_private_algorithm_for_each_n [system] { header "__algorithm/for_each_n.h" }
module std_private_algorithm_for_each_segment [system] { header "__algorithm/for_each_segment.h" }
@@ -787,6 +786,7 @@ module std_private_algorithm_ranges_clamp [system
header "__algorithm/ranges_clamp.h"
export std_private_functional_ranges_operations
}
+module std_private_algorithm_ranges_contains [system] { header "__algorithm/ranges_contains.h" }
module std_private_algorithm_ranges_copy [system] {
header "__algorithm/ranges_copy.h"
export std_private_algorithm_in_out_result
diff --git a/contrib/llvm-project/libcxx/include/mutex b/contrib/llvm-project/libcxx/include/mutex
index a15e61de04c9..a16ef589c697 100644
--- a/contrib/llvm-project/libcxx/include/mutex
+++ b/contrib/llvm-project/libcxx/include/mutex
@@ -203,7 +203,7 @@ template<class Callable, class ...Args>
#include <cstddef>
#include <limits>
#ifndef _LIBCPP_CXX03_LANG
-# include <tuple>
+# include <tuple>
#endif
#include <version>
@@ -214,347 +214,300 @@ template<class Callable, class ...Args>
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
-class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex
-{
- __libcpp_recursive_mutex_t __m_;
+class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex {
+ __libcpp_recursive_mutex_t __m_;
public:
- recursive_mutex();
- ~recursive_mutex();
+ recursive_mutex();
+ ~recursive_mutex();
- recursive_mutex(const recursive_mutex&) = delete;
- recursive_mutex& operator=(const recursive_mutex&) = delete;
+ recursive_mutex(const recursive_mutex&) = delete;
+ recursive_mutex& operator=(const recursive_mutex&) = delete;
- void lock();
- bool try_lock() _NOEXCEPT;
- void unlock() _NOEXCEPT;
+ void lock();
+ bool try_lock() _NOEXCEPT;
+ void unlock() _NOEXCEPT;
- typedef __libcpp_recursive_mutex_t* native_handle_type;
+ typedef __libcpp_recursive_mutex_t* native_handle_type;
- _LIBCPP_HIDE_FROM_ABI
- native_handle_type native_handle() {return &__m_;}
+ _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; }
};
-class _LIBCPP_EXPORTED_FROM_ABI timed_mutex
-{
- mutex __m_;
- condition_variable __cv_;
- bool __locked_;
+class _LIBCPP_EXPORTED_FROM_ABI timed_mutex {
+ mutex __m_;
+ condition_variable __cv_;
+ bool __locked_;
+
public:
- timed_mutex();
- ~timed_mutex();
+ timed_mutex();
+ ~timed_mutex();
- timed_mutex(const timed_mutex&) = delete;
- timed_mutex& operator=(const timed_mutex&) = delete;
+ timed_mutex(const timed_mutex&) = delete;
+ timed_mutex& operator=(const timed_mutex&) = delete;
public:
- void lock();
- bool try_lock() _NOEXCEPT;
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
- {return try_lock_until(chrono::steady_clock::now() + __d);}
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
- void unlock() _NOEXCEPT;
+ void lock();
+ bool try_lock() _NOEXCEPT;
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
+ return try_lock_until(chrono::steady_clock::now() + __d);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
+ void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
-bool
-timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
-{
- using namespace chrono;
- unique_lock<mutex> __lk(__m_);
- bool __no_timeout = _Clock::now() < __t;
- while (__no_timeout && __locked_)
- __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
- if (!__locked_)
- {
- __locked_ = true;
- return true;
- }
- return false;
+bool timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
+ using namespace chrono;
+ unique_lock<mutex> __lk(__m_);
+ bool __no_timeout = _Clock::now() < __t;
+ while (__no_timeout && __locked_)
+ __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
+ if (!__locked_) {
+ __locked_ = true;
+ return true;
+ }
+ return false;
}
-class _LIBCPP_EXPORTED_FROM_ABI recursive_timed_mutex
-{
- mutex __m_;
- condition_variable __cv_;
- size_t __count_;
- __thread_id __id_;
-public:
- recursive_timed_mutex();
- ~recursive_timed_mutex();
-
- recursive_timed_mutex(const recursive_timed_mutex&) = delete;
- recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+class _LIBCPP_EXPORTED_FROM_ABI recursive_timed_mutex {
+ mutex __m_;
+ condition_variable __cv_;
+ size_t __count_;
+ __thread_id __id_;
- void lock();
- bool try_lock() _NOEXCEPT;
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI
- bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
- {return try_lock_until(chrono::steady_clock::now() + __d);}
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
- bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
- void unlock() _NOEXCEPT;
+public:
+ recursive_timed_mutex();
+ ~recursive_timed_mutex();
+
+ recursive_timed_mutex(const recursive_timed_mutex&) = delete;
+ recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+
+ void lock();
+ bool try_lock() _NOEXCEPT;
+ template <class _Rep, class _Period>
+ _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
+ return try_lock_until(chrono::steady_clock::now() + __d);
+ }
+ template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
+ void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
-bool
-recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
-{
- using namespace chrono;
- __thread_id __id = this_thread::get_id();
- unique_lock<mutex> __lk(__m_);
- if (__id == __id_)
- {
- if (__count_ == numeric_limits<size_t>::max())
- return false;
- ++__count_;
- return true;
- }
- bool __no_timeout = _Clock::now() < __t;
- while (__no_timeout && __count_ != 0)
- __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
- if (__count_ == 0)
- {
- __count_ = 1;
- __id_ = __id;
- return true;
- }
- return false;
+bool recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
+ using namespace chrono;
+ __thread_id __id = this_thread::get_id();
+ unique_lock<mutex> __lk(__m_);
+ if (__id == __id_) {
+ if (__count_ == numeric_limits<size_t>::max())
+ return false;
+ ++__count_;
+ return true;
+ }
+ bool __no_timeout = _Clock::now() < __t;
+ while (__no_timeout && __count_ != 0)
+ __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
+ if (__count_ == 0) {
+ __count_ = 1;
+ __id_ = __id;
+ return true;
+ }
+ return false;
}
template <class _L0, class _L1>
-_LIBCPP_HIDE_FROM_ABI int
-try_lock(_L0& __l0, _L1& __l1)
-{
- unique_lock<_L0> __u0(__l0, try_to_lock_t());
- if (__u0.owns_lock())
- {
- if (__l1.try_lock())
- {
- __u0.release();
- return -1;
- }
- else
- return 1;
- }
- return 0;
+_LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1) {
+ unique_lock<_L0> __u0(__l0, try_to_lock_t());
+ if (__u0.owns_lock()) {
+ if (__l1.try_lock()) {
+ __u0.release();
+ return -1;
+ } else
+ return 1;
+ }
+ return 0;
}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
template <class _L0, class _L1, class _L2, class... _L3>
-_LIBCPP_HIDE_FROM_ABI int
-try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
-{
- int __r = 0;
- unique_lock<_L0> __u0(__l0, try_to_lock);
- if (__u0.owns_lock())
- {
- __r = std::try_lock(__l1, __l2, __l3...);
- if (__r == -1)
- __u0.release();
- else
- ++__r;
- }
- return __r;
+_LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ int __r = 0;
+ unique_lock<_L0> __u0(__l0, try_to_lock);
+ if (__u0.owns_lock()) {
+ __r = std::try_lock(__l1, __l2, __l3...);
+ if (__r == -1)
+ __u0.release();
+ else
+ ++__r;
+ }
+ return __r;
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
template <class _L0, class _L1>
-_LIBCPP_HIDE_FROM_ABI void
-lock(_L0& __l0, _L1& __l1)
-{
- while (true)
+_LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1) {
+ while (true) {
{
- {
- unique_lock<_L0> __u0(__l0);
- if (__l1.try_lock())
- {
- __u0.release();
- break;
- }
- }
- __libcpp_thread_yield();
- {
- unique_lock<_L1> __u1(__l1);
- if (__l0.try_lock())
- {
- __u1.release();
- break;
- }
- }
- __libcpp_thread_yield();
+ unique_lock<_L0> __u0(__l0);
+ if (__l1.try_lock()) {
+ __u0.release();
+ break;
+ }
}
+ __libcpp_thread_yield();
+ {
+ unique_lock<_L1> __u1(__l1);
+ if (__l0.try_lock()) {
+ __u1.release();
+ break;
+ }
+ }
+ __libcpp_thread_yield();
+ }
}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
-template <class _L0, class _L1, class _L2, class ..._L3>
-void
-__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
-{
- while (true)
- {
- switch (__i)
- {
- case 0:
- {
- unique_lock<_L0> __u0(__l0);
- __i = std::try_lock(__l1, __l2, __l3...);
- if (__i == -1)
- {
- __u0.release();
- return;
- }
- }
- ++__i;
- __libcpp_thread_yield();
- break;
- case 1:
- {
- unique_lock<_L1> __u1(__l1);
- __i = std::try_lock(__l2, __l3..., __l0);
- if (__i == -1)
- {
- __u1.release();
- return;
- }
- }
- if (__i == sizeof...(_L3) + 1)
- __i = 0;
- else
- __i += 2;
- __libcpp_thread_yield();
- break;
- default:
- std::__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
- return;
- }
+template <class _L0, class _L1, class _L2, class... _L3>
+void __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ while (true) {
+ switch (__i) {
+ case 0: {
+ unique_lock<_L0> __u0(__l0);
+ __i = std::try_lock(__l1, __l2, __l3...);
+ if (__i == -1) {
+ __u0.release();
+ return;
+ }
+ }
+ ++__i;
+ __libcpp_thread_yield();
+ break;
+ case 1: {
+ unique_lock<_L1> __u1(__l1);
+ __i = std::try_lock(__l2, __l3..., __l0);
+ if (__i == -1) {
+ __u1.release();
+ return;
+ }
+ }
+ if (__i == sizeof...(_L3) + 1)
+ __i = 0;
+ else
+ __i += 2;
+ __libcpp_thread_yield();
+ break;
+ default:
+ std::__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
+ return;
}
+ }
}
-template <class _L0, class _L1, class _L2, class ..._L3>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
-{
- std::__lock_first(0, __l0, __l1, __l2, __l3...);
+template <class _L0, class _L1, class _L2, class... _L3>
+inline _LIBCPP_HIDE_FROM_ABI void lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ std::__lock_first(0, __l0, __l1, __l2, __l3...);
}
template <class _L0>
-inline _LIBCPP_HIDE_FROM_ABI
-void __unlock(_L0& __l0) {
- __l0.unlock();
+inline _LIBCPP_HIDE_FROM_ABI void __unlock(_L0& __l0) {
+ __l0.unlock();
}
template <class _L0, class _L1>
-inline _LIBCPP_HIDE_FROM_ABI
-void __unlock(_L0& __l0, _L1& __l1) {
- __l0.unlock();
- __l1.unlock();
+inline _LIBCPP_HIDE_FROM_ABI void __unlock(_L0& __l0, _L1& __l1) {
+ __l0.unlock();
+ __l1.unlock();
}
-template <class _L0, class _L1, class _L2, class ..._L3>
-inline _LIBCPP_HIDE_FROM_ABI
-void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
- __l0.unlock();
- __l1.unlock();
- std::__unlock(__l2, __l3...);
+template <class _L0, class _L1, class _L2, class... _L3>
+inline _LIBCPP_HIDE_FROM_ABI void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
+ __l0.unlock();
+ __l1.unlock();
+ std::__unlock(__l2, __l3...);
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER >= 17
-template <class ..._Mutexes>
+# if _LIBCPP_STD_VER >= 17
+template <class... _Mutexes>
class _LIBCPP_TEMPLATE_VIS scoped_lock;
template <>
class _LIBCPP_TEMPLATE_VIS scoped_lock<> {
public:
- explicit scoped_lock() {}
- ~scoped_lock() = default;
+ explicit scoped_lock() {}
+ ~scoped_lock() = default;
- _LIBCPP_HIDE_FROM_ABI
- explicit scoped_lock(adopt_lock_t) {}
+ _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(adopt_lock_t) {}
- scoped_lock(scoped_lock const&) = delete;
- scoped_lock& operator=(scoped_lock const&) = delete;
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
};
template <class _Mutex>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) scoped_lock<_Mutex> {
public:
- typedef _Mutex mutex_type;
+ typedef _Mutex mutex_type;
+
private:
- mutex_type& __m_;
+ mutex_type& __m_;
+
public:
- explicit scoped_lock(mutex_type & __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
- : __m_(__m) {__m_.lock();}
+ explicit scoped_lock(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) : __m_(__m) {
+ __m_.lock();
+ }
- ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();}
+ ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) { __m_.unlock(); }
- _LIBCPP_HIDE_FROM_ABI
- explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
- : __m_(__m) {}
+ _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(adopt_lock_t, mutex_type& __m)
+ _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
+ : __m_(__m) {}
- scoped_lock(scoped_lock const&) = delete;
- scoped_lock& operator=(scoped_lock const&) = delete;
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
};
-template <class ..._MArgs>
-class _LIBCPP_TEMPLATE_VIS scoped_lock
-{
- static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required");
- typedef tuple<_MArgs&...> _MutexTuple;
+template <class... _MArgs>
+class _LIBCPP_TEMPLATE_VIS scoped_lock {
+ static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required");
+ typedef tuple<_MArgs&...> _MutexTuple;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit scoped_lock(_MArgs&... __margs)
- : __t_(__margs...)
- {
- std::lock(__margs...);
- }
+ _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(_MArgs&... __margs) : __t_(__margs...) { std::lock(__margs...); }
- _LIBCPP_HIDE_FROM_ABI
- scoped_lock(adopt_lock_t, _MArgs&... __margs)
- : __t_(__margs...)
- {
- }
+ _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) {}
- _LIBCPP_HIDE_FROM_ABI
- ~scoped_lock() {
- typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
- __unlock_unpack(_Indices{}, __t_);
- }
+ _LIBCPP_HIDE_FROM_ABI ~scoped_lock() {
+ typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
+ __unlock_unpack(_Indices{}, __t_);
+ }
- scoped_lock(scoped_lock const&) = delete;
- scoped_lock& operator=(scoped_lock const&) = delete;
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
private:
- template <size_t ..._Indx>
- _LIBCPP_HIDE_FROM_ABI
- static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
- std::__unlock(std::get<_Indx>(__mt)...);
- }
+ template <size_t... _Indx>
+ _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
+ std::__unlock(std::get<_Indx>(__mt)...);
+ }
- _MutexTuple __t_;
+ _MutexTuple __t_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock);
-#endif // _LIBCPP_STD_VER >= 17
-#endif // !_LIBCPP_HAS_NO_THREADS
+# endif // _LIBCPP_STD_VER >= 17
+#endif // !_LIBCPP_HAS_NO_THREADS
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/new b/contrib/llvm-project/libcxx/include/new
index 18f397219c14..136adc41c24b 100644
--- a/contrib/llvm-project/libcxx/include/new
+++ b/contrib/llvm-project/libcxx/include/new
@@ -97,54 +97,50 @@ void operator delete[](void* ptr, void*) noexcept;
#include <version>
#if defined(_LIBCPP_ABI_VCRUNTIME)
-#include <new.h>
+# include <new.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if !defined(__cpp_sized_deallocation) || __cpp_sized_deallocation < 201309L
-#define _LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION
+#if !defined(__cpp_sized_deallocation) || __cpp_sized_deallocation < 201309L
+# define _LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION
#endif
-#if !defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_STD_VER < 14 && \
- defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
-# define _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+#if !defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_STD_VER < 14 && defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
+# define _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
#endif
-#if defined(_LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION) || \
- defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
-# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
+#if defined(_LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION) || defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
+# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#endif
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
#if !defined(_LIBCPP_ABI_VCRUNTIME)
-struct _LIBCPP_EXPORTED_FROM_ABI nothrow_t { explicit nothrow_t() = default; };
+struct _LIBCPP_EXPORTED_FROM_ABI nothrow_t {
+ explicit nothrow_t() = default;
+};
extern _LIBCPP_EXPORTED_FROM_ABI const nothrow_t nothrow;
-class _LIBCPP_EXPORTED_FROM_ABI bad_alloc
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_alloc : public exception {
public:
- bad_alloc() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_alloc(const bad_alloc&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_alloc& operator=(const bad_alloc&) _NOEXCEPT = default;
- ~bad_alloc() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ bad_alloc() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bad_alloc(const bad_alloc&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_alloc& operator=(const bad_alloc&) _NOEXCEPT = default;
+ ~bad_alloc() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
-class _LIBCPP_EXPORTED_FROM_ABI bad_array_new_length
- : public bad_alloc
-{
+class _LIBCPP_EXPORTED_FROM_ABI bad_array_new_length : public bad_alloc {
public:
- bad_array_new_length() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_array_new_length(const bad_array_new_length&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_array_new_length& operator=(const bad_array_new_length&) _NOEXCEPT = default;
- ~bad_array_new_length() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ bad_array_new_length() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI bad_array_new_length(const bad_array_new_length&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_array_new_length& operator=(const bad_array_new_length&) _NOEXCEPT = default;
+ ~bad_array_new_length() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
typedef void (*new_handler)();
@@ -171,25 +167,22 @@ public:
};
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
+_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_array_new_length()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_array_new_length();
+ throw bad_array_new_length();
#else
- _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode");
#endif
}
-#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \
- !defined(_LIBCPP_ABI_VCRUNTIME)
-#ifndef _LIBCPP_CXX03_LANG
-enum class align_val_t : size_t { };
-#else
+#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && !defined(_LIBCPP_ABI_VCRUNTIME)
+# ifndef _LIBCPP_CXX03_LANG
+enum class align_val_t : size_t {};
+# else
enum align_val_t { __zero = 0, __max = (size_t)-1 };
-#endif
+# endif
#endif
#if _LIBCPP_STD_VER >= 20
@@ -204,51 +197,61 @@ inline constexpr destroying_delete_t destroying_delete{};
} // namespace std
#if defined(_LIBCPP_CXX03_LANG)
-#define _THROW_BAD_ALLOC throw(std::bad_alloc)
+# define _THROW_BAD_ALLOC throw(std::bad_alloc)
#else
-#define _THROW_BAD_ALLOC
+# define _THROW_BAD_ALLOC
#endif
#if !defined(_LIBCPP_ABI_VCRUNTIME)
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
-#endif
+# endif
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
-#endif
-
-#ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+# endif
+
+# ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
-#endif
-
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
-#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
+# endif
+
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void*
+operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
-#endif
-#endif
+# endif
+# endif
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
-inline _LIBCPP_HIDE_FROM_ABI void operator delete (void*, void*) _NOEXCEPT {}
-inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {}
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT {
+ return __p;
+}
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new[](std::size_t, void* __p) _NOEXCEPT {
+ return __p;
+}
+inline _LIBCPP_HIDE_FROM_ABI void operator delete(void*, void*) _NOEXCEPT {}
+inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {}
#endif // !_LIBCPP_ABI_VCRUNTIME
@@ -262,9 +265,8 @@ _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI bool __is_overaligned_for_new(siz
#endif
}
-template <class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-void* __libcpp_operator_new(_Args ...__args) {
+template <class... _Args>
+_LIBCPP_HIDE_FROM_ABI void* __libcpp_operator_new(_Args... __args) {
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
return __builtin_operator_new(__args...);
#else
@@ -272,9 +274,8 @@ void* __libcpp_operator_new(_Args ...__args) {
#endif
}
-template <class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-void __libcpp_operator_delete(_Args ...__args) {
+template <class... _Args>
+_LIBCPP_HIDE_FROM_ABI void __libcpp_operator_delete(_Args... __args) {
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
__builtin_operator_delete(__args...);
#else
@@ -282,8 +283,7 @@ void __libcpp_operator_delete(_Args ...__args) {
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-void *__libcpp_allocate(size_t __size, size_t __align) {
+inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_allocate(size_t __size, size_t __align) {
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
if (__is_overaligned_for_new(__align)) {
const align_val_t __align_val = static_cast<align_val_t>(__align);
@@ -295,9 +295,8 @@ void *__libcpp_allocate(size_t __size, size_t __align) {
return __libcpp_operator_new(__size);
}
-template <class ..._Args>
-_LIBCPP_HIDE_FROM_ABI
-void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) {
+template <class... _Args>
+_LIBCPP_HIDE_FROM_ABI void __do_deallocate_handle_size(void* __ptr, size_t __size, _Args... __args) {
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
(void)__size;
return std::__libcpp_operator_delete(__ptr, __args...);
@@ -306,61 +305,56 @@ void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) {
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
- (void)__align;
- return __do_deallocate_handle_size(__ptr, __size);
+ (void)__align;
+ return __do_deallocate_handle_size(__ptr, __size);
#else
- if (__is_overaligned_for_new(__align)) {
- const align_val_t __align_val = static_cast<align_val_t>(__align);
- return __do_deallocate_handle_size(__ptr, __size, __align_val);
- } else {
- return __do_deallocate_handle_size(__ptr, __size);
- }
+ if (__is_overaligned_for_new(__align)) {
+ const align_val_t __align_val = static_cast<align_val_t>(__align);
+ return __do_deallocate_handle_size(__ptr, __size, __align_val);
+ } else {
+ return __do_deallocate_handle_size(__ptr, __size);
+ }
#endif
}
inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate_unsized(void* __ptr, size_t __align) {
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
- (void)__align;
- return __libcpp_operator_delete(__ptr);
+ (void)__align;
+ return __libcpp_operator_delete(__ptr);
#else
- if (__is_overaligned_for_new(__align)) {
- const align_val_t __align_val = static_cast<align_val_t>(__align);
- return __libcpp_operator_delete(__ptr, __align_val);
- } else {
- return __libcpp_operator_delete(__ptr);
- }
+ if (__is_overaligned_for_new(__align)) {
+ const align_val_t __align_val = static_cast<align_val_t>(__align);
+ return __libcpp_operator_delete(__ptr, __align_val);
+ } else {
+ return __libcpp_operator_delete(__ptr);
+ }
#endif
}
template <class _Tp>
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT
-{
- static_assert (!(is_function<_Tp>::value), "can't launder functions" );
- static_assert (!(is_same<void, __remove_cv_t<_Tp> >::value), "can't launder cv-void" );
- return __builtin_launder(__p);
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT {
+ static_assert(!(is_function<_Tp>::value), "can't launder functions");
+ static_assert(!(is_same<void, __remove_cv_t<_Tp> >::value), "can't launder cv-void");
+ return __builtin_launder(__p);
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
-_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI
-constexpr _Tp* launder(_Tp* __p) noexcept
-{
- return std::__launder(__p);
+_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp* launder(_Tp* __p) noexcept {
+ return std::__launder(__p);
}
#endif
#if _LIBCPP_STD_VER >= 17
-#if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
+# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
-inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE;
+inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE;
inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUCTIVE_SIZE;
-#endif // defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
+# endif // defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
#endif // _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/numbers b/contrib/llvm-project/libcxx/include/numbers
index ec9eea5df37e..0d834c6b863f 100644
--- a/contrib/llvm-project/libcxx/include/numbers
+++ b/contrib/llvm-project/libcxx/include/numbers
@@ -65,9 +65,9 @@ namespace std::numbers {
#if _LIBCPP_STD_VER >= 20
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -77,38 +77,65 @@ template <class _Tp>
inline constexpr bool __false = false;
template <class _Tp>
-struct __illformed
-{
- static_assert(__false<_Tp>, "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
+struct __illformed {
+ static_assert(
+ __false<_Tp>,
+ "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
};
-template <class _Tp> inline constexpr _Tp e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp log2e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp log10e_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp pi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_pi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp ln2_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp ln10_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp sqrt2_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp sqrt3_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp egamma_v = __illformed<_Tp>{};
-template <class _Tp> inline constexpr _Tp phi_v = __illformed<_Tp>{};
-
-template <floating_point _Tp> inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662;
-template <floating_point _Tp> inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892;
-template <floating_point _Tp> inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605;
-template <floating_point _Tp> inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502;
-template <floating_point _Tp> inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028;
-template <floating_point _Tp> inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772;
-template <floating_point _Tp> inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176;
-template <floating_point _Tp> inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364;
-template <floating_point _Tp> inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698;
-template <floating_point _Tp> inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872;
-template <floating_point _Tp> inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957;
-template <floating_point _Tp> inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402;
-template <floating_point _Tp> inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638;
+template <class _Tp>
+inline constexpr _Tp e_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp log2e_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp log10e_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp pi_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp inv_pi_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp ln2_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp ln10_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp sqrt2_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp sqrt3_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp egamma_v = __illformed<_Tp>{};
+template <class _Tp>
+inline constexpr _Tp phi_v = __illformed<_Tp>{};
+
+template <floating_point _Tp>
+inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662;
+template <floating_point _Tp>
+inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892;
+template <floating_point _Tp>
+inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605;
+template <floating_point _Tp>
+inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502;
+template <floating_point _Tp>
+inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028;
+template <floating_point _Tp>
+inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772;
+template <floating_point _Tp>
+inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176;
+template <floating_point _Tp>
+inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364;
+template <floating_point _Tp>
+inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698;
+template <floating_point _Tp>
+inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872;
+template <floating_point _Tp>
+inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957;
+template <floating_point _Tp>
+inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402;
+template <floating_point _Tp>
+inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638;
inline constexpr double e = e_v<double>;
inline constexpr double log2e = log2e_v<double>;
diff --git a/contrib/llvm-project/libcxx/include/optional b/contrib/llvm-project/libcxx/include/optional
index 3f505b2a8fac..73da0a8a5a7c 100644
--- a/contrib/llvm-project/libcxx/include/optional
+++ b/contrib/llvm-project/libcxx/include/optional
@@ -242,19 +242,17 @@ namespace std {
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access : public exception {
public:
- _LIBCPP_HIDE_FROM_ABI bad_optional_access() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_optional_access(const bad_optional_access&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
- // Get the key function ~bad_optional_access() into the dylib
- ~bad_optional_access() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI bad_optional_access() _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_optional_access(const bad_optional_access&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
+ // Get the key function ~bad_optional_access() into the dylib
+ ~bad_optional_access() _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
} // namespace std
@@ -263,21 +261,20 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NORETURN
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
-void __throw_bad_optional_access() {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_optional_access();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_optional_access was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
+__throw_bad_optional_access() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_optional_access();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_optional_access was thrown in -fno-exceptions mode");
+# endif
}
-struct nullopt_t
-{
- struct __secret_tag { explicit __secret_tag() = default; };
- _LIBCPP_HIDE_FROM_ABI constexpr explicit nullopt_t(__secret_tag, __secret_tag) noexcept {}
+struct nullopt_t {
+ struct __secret_tag {
+ explicit __secret_tag() = default;
+ };
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit nullopt_t(__secret_tag, __secret_tag) noexcept {}
};
inline constexpr nullopt_t nullopt{nullopt_t::__secret_tag{}, nullopt_t::__secret_tag{}};
@@ -288,398 +285,287 @@ template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
struct __optional_destruct_base;
template <class _Tp>
-struct __optional_destruct_base<_Tp, false>
-{
- typedef _Tp value_type;
- static_assert(is_object_v<value_type>,
- "instantiation of optional with a non-object type is undefined behavior");
- union
- {
- char __null_state_;
- value_type __val_;
- };
- bool __engaged_;
+struct __optional_destruct_base<_Tp, false> {
+ typedef _Tp value_type;
+ static_assert(is_object_v<value_type>, "instantiation of optional with a non-object type is undefined behavior");
+ union {
+ char __null_state_;
+ value_type __val_;
+ };
+ bool __engaged_;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__optional_destruct_base()
- {
- if (__engaged_)
- __val_.~value_type();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__optional_destruct_base() {
+ if (__engaged_)
+ __val_.~value_type();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base() noexcept
- : __null_state_(),
- __engaged_(false) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...),
- __engaged_(true) {}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
+ : __val_(std::forward<_Args>(__args)...), __engaged_(true) {}
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
template <class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base(
+ __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
: __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {}
-#endif
+# endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept
- {
- if (__engaged_)
- {
- __val_.~value_type();
- __engaged_ = false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept {
+ if (__engaged_) {
+ __val_.~value_type();
+ __engaged_ = false;
}
+ }
};
template <class _Tp>
-struct __optional_destruct_base<_Tp, true>
-{
- typedef _Tp value_type;
- static_assert(is_object_v<value_type>,
- "instantiation of optional with a non-object type is undefined behavior");
- union
- {
- char __null_state_;
- value_type __val_;
- };
- bool __engaged_;
+struct __optional_destruct_base<_Tp, true> {
+ typedef _Tp value_type;
+ static_assert(is_object_v<value_type>, "instantiation of optional with a non-object type is undefined behavior");
+ union {
+ char __null_state_;
+ value_type __val_;
+ };
+ bool __engaged_;
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base() noexcept
- : __null_state_(),
- __engaged_(false) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...),
- __engaged_(true) {}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
+ : __val_(std::forward<_Args>(__args)...), __engaged_(true) {}
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
template <class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_destruct_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base(
+ __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
: __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {}
-#endif
+# endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept
- {
- if (__engaged_)
- {
- __engaged_ = false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept {
+ if (__engaged_) {
+ __engaged_ = false;
}
+ }
};
template <class _Tp, bool = is_reference<_Tp>::value>
-struct __optional_storage_base : __optional_destruct_base<_Tp>
-{
- using __base = __optional_destruct_base<_Tp>;
- using value_type = _Tp;
- using __base::__base;
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool has_value() const noexcept
- {
- return this->__engaged_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type& __get() & noexcept
- {
- return this->__val_;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr const value_type& __get() const& noexcept
- {
- return this->__val_;
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type&& __get() && noexcept
- {
- return std::move(this->__val_);
- }
- _LIBCPP_HIDE_FROM_ABI
- constexpr const value_type&& __get() const&& noexcept
- {
- return std::move(this->__val_);
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args)
- {
- _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
- std::__construct_at(std::addressof(this->__val_), std::forward<_Args>(__args)...);
- this->__engaged_ = true;
- }
+struct __optional_storage_base : __optional_destruct_base<_Tp> {
+ using __base = __optional_destruct_base<_Tp>;
+ using value_type = _Tp;
+ using __base::__base;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__engaged_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() & noexcept { return this->__val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type& __get() const& noexcept { return this->__val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type&& __get() && noexcept { return std::move(this->__val_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type&& __get() const&& noexcept { return std::move(this->__val_); }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args) {
+ _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
+ std::__construct_at(std::addressof(this->__val_), std::forward<_Args>(__args)...);
+ this->__engaged_ = true;
+ }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt)
- {
- if (__opt.has_value())
- __construct(std::forward<_That>(__opt).__get());
- }
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) {
+ if (__opt.has_value())
+ __construct(std::forward<_That>(__opt).__get());
+ }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt)
- {
- if (this->__engaged_ == __opt.has_value())
- {
- if (this->__engaged_)
- this->__val_ = std::forward<_That>(__opt).__get();
- }
- else
- {
- if (this->__engaged_)
- this->reset();
- else
- __construct(std::forward<_That>(__opt).__get());
- }
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) {
+ if (this->__engaged_ == __opt.has_value()) {
+ if (this->__engaged_)
+ this->__val_ = std::forward<_That>(__opt).__get();
+ } else {
+ if (this->__engaged_)
+ this->reset();
+ else
+ __construct(std::forward<_That>(__opt).__get());
}
+ }
};
// optional<T&> is currently required to be ill-formed. However, it may
// be allowed in the future. For this reason, it has already been implemented
// to ensure we can make the change in an ABI-compatible manner.
template <class _Tp>
-struct __optional_storage_base<_Tp, true>
-{
- using value_type = _Tp;
- using __raw_type = remove_reference_t<_Tp>;
- __raw_type* __value_;
+struct __optional_storage_base<_Tp, true> {
+ using value_type = _Tp;
+ using __raw_type = remove_reference_t<_Tp>;
+ __raw_type* __value_;
+
+ template <class _Up>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
+ using _RawUp = __libcpp_remove_reference_t<_Up>;
+ using _UpPtr = _RawUp*;
+ using _RawTp = __libcpp_remove_reference_t<_Tp>;
+ using _TpPtr = _RawTp*;
+ using _CheckLValueArg =
+ integral_constant<bool,
+ (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value) ||
+ is_same<_RawUp, reference_wrapper<_RawTp>>::value ||
+ is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value >;
+ return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) ||
+ (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value &&
+ is_convertible<_UpPtr, _TpPtr>::value);
+ }
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
- using _RawUp = __libcpp_remove_reference_t<_Up>;
- using _UpPtr = _RawUp*;
- using _RawTp = __libcpp_remove_reference_t<_Tp>;
- using _TpPtr = _RawTp*;
- using _CheckLValueArg = integral_constant<bool,
- (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value)
- || is_same<_RawUp, reference_wrapper<_RawTp>>::value
- || is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value
- >;
- return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value)
- || (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value &&
- is_convertible<_UpPtr, _TpPtr>::value);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI
- constexpr __optional_storage_base() noexcept
- : __value_(nullptr) {}
-
- template <class _UArg>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg)
- : __value_(std::addressof(__uarg))
- {
- static_assert(__can_bind_reference<_UArg>(),
- "Attempted to construct a reference element in tuple from a "
- "possible temporary");
- }
+ template <class _UArg>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg)
+ : __value_(std::addressof(__uarg)) {
+ static_assert(__can_bind_reference<_UArg>(),
+ "Attempted to construct a reference element in tuple from a "
+ "possible temporary");
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool has_value() const noexcept
- { return __value_ != nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type& __get() const& noexcept
- { return *__value_; }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type&& __get() const&& noexcept
- { return std::forward<value_type>(*__value_); }
-
- template <class _UArg>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val)
- {
- _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
- static_assert(__can_bind_reference<_UArg>(),
- "Attempted to construct a reference element in tuple from a "
- "possible temporary");
- __value_ = std::addressof(__val);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt)
- {
- if (__opt.has_value())
- __construct(std::forward<_That>(__opt).__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() const& noexcept { return *__value_; }
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt)
- {
- if (has_value() == __opt.has_value())
- {
- if (has_value())
- *__value_ = std::forward<_That>(__opt).__get();
- }
- else
- {
- if (has_value())
- reset();
- else
- __construct(std::forward<_That>(__opt).__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type&& __get() const&& noexcept { return std::forward<value_type>(*__value_); }
+
+ template <class _UArg>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) {
+ _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
+ static_assert(__can_bind_reference<_UArg>(),
+ "Attempted to construct a reference element in tuple from a "
+ "possible temporary");
+ __value_ = std::addressof(__val);
+ }
+
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) {
+ if (__opt.has_value())
+ __construct(std::forward<_That>(__opt).__get());
+ }
+
+ template <class _That>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) {
+ if (has_value() == __opt.has_value()) {
+ if (has_value())
+ *__value_ = std::forward<_That>(__opt).__get();
+ } else {
+ if (has_value())
+ reset();
+ else
+ __construct(std::forward<_That>(__opt).__get());
}
+ }
};
template <class _Tp, bool = is_trivially_copy_constructible<_Tp>::value>
-struct __optional_copy_base : __optional_storage_base<_Tp>
-{
- using __optional_storage_base<_Tp>::__optional_storage_base;
+struct __optional_copy_base : __optional_storage_base<_Tp> {
+ using __optional_storage_base<_Tp>::__optional_storage_base;
};
template <class _Tp>
-struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp>
-{
- using __optional_storage_base<_Tp>::__optional_storage_base;
+struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> {
+ using __optional_storage_base<_Tp>::__optional_storage_base;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_base(const __optional_copy_base& __opt)
- {
- this->__construct_from(__opt);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_base(const __optional_copy_base& __opt) {
+ this->__construct_from(__opt);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base(__optional_copy_base&&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base& operator=(const __optional_copy_base&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_base& operator=(__optional_copy_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base(__optional_copy_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(const __optional_copy_base&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default;
};
template <class _Tp, bool = is_trivially_move_constructible<_Tp>::value>
-struct __optional_move_base : __optional_copy_base<_Tp>
-{
- using __optional_copy_base<_Tp>::__optional_copy_base;
+struct __optional_move_base : __optional_copy_base<_Tp> {
+ using __optional_copy_base<_Tp>::__optional_copy_base;
};
template <class _Tp>
-struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp>
-{
- using value_type = _Tp;
- using __optional_copy_base<_Tp>::__optional_copy_base;
-
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base(const __optional_move_base&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_base(__optional_move_base&& __opt)
- noexcept(is_nothrow_move_constructible_v<value_type>)
- {
- this->__construct_from(std::move(__opt));
- }
+struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> {
+ using value_type = _Tp;
+ using __optional_copy_base<_Tp>::__optional_copy_base;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base& operator=(const __optional_move_base&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_base& operator=(__optional_move_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base(const __optional_move_base&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ __optional_move_base(__optional_move_base&& __opt) noexcept(is_nothrow_move_constructible_v<value_type>) {
+ this->__construct_from(std::move(__opt));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base& operator=(const __optional_move_base&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_base& operator=(__optional_move_base&&) = default;
};
-template <class _Tp, bool =
- is_trivially_destructible<_Tp>::value &&
- is_trivially_copy_constructible<_Tp>::value &&
- is_trivially_copy_assignable<_Tp>::value>
-struct __optional_copy_assign_base : __optional_move_base<_Tp>
-{
- using __optional_move_base<_Tp>::__optional_move_base;
+template <class _Tp,
+ bool = is_trivially_destructible<_Tp>::value && is_trivially_copy_constructible<_Tp>::value &&
+ is_trivially_copy_assignable<_Tp>::value>
+struct __optional_copy_assign_base : __optional_move_base<_Tp> {
+ using __optional_move_base<_Tp>::__optional_move_base;
};
template <class _Tp>
-struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp>
-{
- using __optional_move_base<_Tp>::__optional_move_base;
-
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base(const __optional_copy_assign_base&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base(__optional_copy_assign_base&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt)
- {
- this->__assign_from(__opt);
- return *this;
- }
+struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> {
+ using __optional_move_base<_Tp>::__optional_move_base;
+
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base(const __optional_copy_assign_base&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base(__optional_copy_assign_base&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_assign_base&
+ operator=(const __optional_copy_assign_base& __opt) {
+ this->__assign_from(__opt);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = default;
};
-template <class _Tp, bool =
- is_trivially_destructible<_Tp>::value &&
- is_trivially_move_constructible<_Tp>::value &&
- is_trivially_move_assignable<_Tp>::value>
-struct __optional_move_assign_base : __optional_copy_assign_base<_Tp>
-{
- using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+template <class _Tp,
+ bool = is_trivially_destructible<_Tp>::value && is_trivially_move_constructible<_Tp>::value &&
+ is_trivially_move_assignable<_Tp>::value>
+struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> {
+ using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
};
template <class _Tp>
-struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp>
-{
- using value_type = _Tp;
- using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
-
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base() = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base(const __optional_move_assign_base& __opt) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base(__optional_move_assign_base&&) = default;
- _LIBCPP_HIDE_FROM_ABI
- __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt)
- noexcept(is_nothrow_move_assignable_v<value_type> &&
- is_nothrow_move_constructible_v<value_type>)
- {
- this->__assign_from(std::move(__opt));
- return *this;
- }
+struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp> {
+ using value_type = _Tp;
+ using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base() = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base(const __optional_move_assign_base& __opt) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base(__optional_move_assign_base&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_assign_base&
+ operator=(__optional_move_assign_base&& __opt) noexcept(
+ is_nothrow_move_assignable_v<value_type> && is_nothrow_move_constructible_v<value_type>) {
+ this->__assign_from(std::move(__opt));
+ return *this;
+ }
};
template <class _Tp>
-using __optional_sfinae_ctor_base_t = __sfinae_ctor_base<
- is_copy_constructible<_Tp>::value,
- is_move_constructible<_Tp>::value
->;
+using __optional_sfinae_ctor_base_t =
+ __sfinae_ctor_base< is_copy_constructible<_Tp>::value, is_move_constructible<_Tp>::value >;
template <class _Tp>
-using __optional_sfinae_assign_base_t = __sfinae_assign_base<
- (is_copy_constructible<_Tp>::value && is_copy_assignable<_Tp>::value),
- (is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value)
->;
+using __optional_sfinae_assign_base_t =
+ __sfinae_assign_base< (is_copy_constructible<_Tp>::value && is_copy_assignable<_Tp>::value),
+ (is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value) >;
-template<class _Tp>
+template <class _Tp>
class optional;
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp>
concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(const optional<_Up>&) {}(__t); };
@@ -688,433 +574,295 @@ concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(co
template <class _Tp>
struct __is_std_optional : false_type {};
-template <class _Tp> struct __is_std_optional<optional<_Tp>> : true_type {};
+template <class _Tp>
+struct __is_std_optional<optional<_Tp>> : true_type {};
template <class _Tp>
class _LIBCPP_DECLSPEC_EMPTY_BASES optional
- : private __optional_move_assign_base<_Tp>
- , private __optional_sfinae_ctor_base_t<_Tp>
- , private __optional_sfinae_assign_base_t<_Tp>
-{
- using __base = __optional_move_assign_base<_Tp>;
+ : private __optional_move_assign_base<_Tp>,
+ private __optional_sfinae_ctor_base_t<_Tp>,
+ private __optional_sfinae_assign_base_t<_Tp> {
+ using __base = __optional_move_assign_base<_Tp>;
+
public:
- using value_type = _Tp;
+ using value_type = _Tp;
private:
- // Disable the reference extension using this static assert.
- static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
- "instantiation of optional with in_place_t is ill-formed");
- static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>,
- "instantiation of optional with nullopt_t is ill-formed");
- static_assert(!is_reference_v<value_type>,
- "instantiation of optional with a reference type is ill-formed");
- static_assert(is_destructible_v<value_type>,
- "instantiation of optional with a non-destructible type is ill-formed");
- static_assert(!is_array_v<value_type>,
- "instantiation of optional with an array type is ill-formed");
-
- // LWG2756: conditionally explicit conversion from _Up
- struct _CheckOptionalArgsConstructor {
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
- return is_constructible_v<_Tp, _Up&&> &&
- is_convertible_v<_Up&&, _Tp>;
- }
+ // Disable the reference extension using this static assert.
+ static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
+ "instantiation of optional with in_place_t is ill-formed");
+ static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>,
+ "instantiation of optional with nullopt_t is ill-formed");
+ static_assert(!is_reference_v<value_type>, "instantiation of optional with a reference type is ill-formed");
+ static_assert(is_destructible_v<value_type>, "instantiation of optional with a non-destructible type is ill-formed");
+ static_assert(!is_array_v<value_type>, "instantiation of optional with an array type is ill-formed");
+
+ // LWG2756: conditionally explicit conversion from _Up
+ struct _CheckOptionalArgsConstructor {
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
+ return is_constructible_v<_Tp, _Up&&> && is_convertible_v<_Up&&, _Tp>;
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
- return is_constructible_v<_Tp, _Up&&> &&
- !is_convertible_v<_Up&&, _Tp>;
- }
- };
template <class _Up>
- using _CheckOptionalArgsCtor = _If<
- _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value &&
- _IsNotSame<__remove_cvref_t<_Up>, optional>::value &&
- (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_optional<__remove_cvref_t<_Up>>::value),
- _CheckOptionalArgsConstructor,
- __check_tuple_constructor_fail
- >;
- template <class _QualUp>
- struct _CheckOptionalLikeConstructor {
- template <class _Up, class _Opt = optional<_Up>>
- using __check_constructible_from_opt = _Or<
- is_constructible<_Tp, _Opt&>,
- is_constructible<_Tp, _Opt const&>,
- is_constructible<_Tp, _Opt&&>,
- is_constructible<_Tp, _Opt const&&>,
- is_convertible<_Opt&, _Tp>,
- is_convertible<_Opt const&, _Tp>,
- is_convertible<_Opt&&, _Tp>,
- is_convertible<_Opt const&&, _Tp>
- >;
- template <class _Up, class _Opt = optional<_Up>>
- using __check_assignable_from_opt = _Or<
- is_assignable<_Tp&, _Opt&>,
- is_assignable<_Tp&, _Opt const&>,
- is_assignable<_Tp&, _Opt&&>,
- is_assignable<_Tp&, _Opt const&&>
- >;
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
- return is_convertible<_QUp, _Tp>::value &&
- (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
- }
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
- return !is_convertible<_QUp, _Tp>::value &&
- (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
- }
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_assign() {
- // Construction and assignability of _QUp to _Tp has already been
- // checked.
- return !__check_constructible_from_opt<_Up>::value &&
- !__check_assignable_from_opt<_Up>::value;
- }
- };
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
+ return is_constructible_v<_Tp, _Up&&> && !is_convertible_v<_Up&&, _Tp>;
+ }
+ };
+ template <class _Up>
+ using _CheckOptionalArgsCtor =
+ _If< _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value && _IsNotSame<__remove_cvref_t<_Up>, optional>::value &&
+ (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_optional<__remove_cvref_t<_Up>>::value),
+ _CheckOptionalArgsConstructor,
+ __check_tuple_constructor_fail >;
+ template <class _QualUp>
+ struct _CheckOptionalLikeConstructor {
+ template <class _Up, class _Opt = optional<_Up>>
+ using __check_constructible_from_opt =
+ _Or< is_constructible<_Tp, _Opt&>,
+ is_constructible<_Tp, _Opt const&>,
+ is_constructible<_Tp, _Opt&&>,
+ is_constructible<_Tp, _Opt const&&>,
+ is_convertible<_Opt&, _Tp>,
+ is_convertible<_Opt const&, _Tp>,
+ is_convertible<_Opt&&, _Tp>,
+ is_convertible<_Opt const&&, _Tp> >;
+ template <class _Up, class _Opt = optional<_Up>>
+ using __check_assignable_from_opt =
+ _Or< is_assignable<_Tp&, _Opt&>,
+ is_assignable<_Tp&, _Opt const&>,
+ is_assignable<_Tp&, _Opt&&>,
+ is_assignable<_Tp&, _Opt const&&> >;
+ template <class _Up, class _QUp = _QualUp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
+ return is_convertible<_QUp, _Tp>::value &&
+ (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
+ }
+ template <class _Up, class _QUp = _QualUp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
+ return !is_convertible<_QUp, _Tp>::value &&
+ (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
+ }
+ template <class _Up, class _QUp = _QualUp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_assign() {
+ // Construction and assignability of _QUp to _Tp has already been
+ // checked.
+ return !__check_constructible_from_opt<_Up>::value && !__check_assignable_from_opt<_Up>::value;
+ }
+ };
- template <class _Up, class _QualUp>
- using _CheckOptionalLikeCtor = _If<
- _And<
- _IsNotSame<_Up, _Tp>,
- is_constructible<_Tp, _QualUp>
- >::value,
- _CheckOptionalLikeConstructor<_QualUp>,
- __check_tuple_constructor_fail
- >;
- template <class _Up, class _QualUp>
- using _CheckOptionalLikeAssign = _If<
- _And<
- _IsNotSame<_Up, _Tp>,
- is_constructible<_Tp, _QualUp>,
- is_assignable<_Tp&, _QualUp>
- >::value,
- _CheckOptionalLikeConstructor<_QualUp>,
- __check_tuple_constructor_fail
- >;
+ template <class _Up, class _QualUp>
+ using _CheckOptionalLikeCtor =
+ _If< _And< _IsNotSame<_Up, _Tp>, is_constructible<_Tp, _QualUp> >::value,
+ _CheckOptionalLikeConstructor<_QualUp>,
+ __check_tuple_constructor_fail >;
+ template <class _Up, class _QualUp>
+ using _CheckOptionalLikeAssign =
+ _If< _And< _IsNotSame<_Up, _Tp>, is_constructible<_Tp, _QualUp>, is_assignable<_Tp&, _QualUp> >::value,
+ _CheckOptionalLikeConstructor<_QualUp>,
+ __check_tuple_constructor_fail >;
public:
+ _LIBCPP_HIDE_FROM_ABI constexpr optional() noexcept {}
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(const optional&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
+
+ template <
+ class _InPlaceT,
+ class... _Args,
+ class = enable_if_t< _And< _IsSame<_InPlaceT, in_place_t>, is_constructible<value_type, _Args...> >::value > >
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args)
+ : __base(in_place, std::forward<_Args>(__args)...) {}
+
+ template <class _Up,
+ class... _Args,
+ class = enable_if_t< is_constructible_v<value_type, initializer_list<_Up>&, _Args...>> >
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
+ : __base(in_place, __il, std::forward<_Args>(__args)...) {}
+
+ template <class _Up = value_type,
+ enable_if_t< _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
+
+ template <class _Up, enable_if_t< _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
+
+ // LWG2756: conditionally explicit conversion from const optional<_Up>&
+ template <class _Up,
+ enable_if_t< _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) {
+ this->__construct_from(__v);
+ }
+ template <class _Up,
+ enable_if_t< _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) {
+ this->__construct_from(__v);
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr optional() noexcept {}
- _LIBCPP_HIDE_FROM_ABI constexpr optional(const optional&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
-
- template <class _InPlaceT, class... _Args, class = enable_if_t<
- _And<
- _IsSame<_InPlaceT, in_place_t>,
- is_constructible<value_type, _Args...>
- >::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(_InPlaceT, _Args&&... __args)
- : __base(in_place, std::forward<_Args>(__args)...) {}
-
- template <class _Up, class... _Args, class = enable_if_t<
- is_constructible_v<value_type, initializer_list<_Up>&, _Args...>>
- >
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
- : __base(in_place, __il, std::forward<_Args>(__args)...) {}
-
- template <class _Up = value_type, enable_if_t<
- _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr optional(_Up&& __v)
- : __base(in_place, std::forward<_Up>(__v)) {}
-
- template <class _Up, enable_if_t<
- _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(_Up&& __v)
- : __base(in_place, std::forward<_Up>(__v)) {}
-
- // LWG2756: conditionally explicit conversion from const optional<_Up>&
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v)
- {
- this->__construct_from(__v);
- }
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v)
- {
- this->__construct_from(__v);
- }
+ // LWG2756: conditionally explicit conversion from optional<_Up>&&
+ template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) {
+ this->__construct_from(std::move(__v));
+ }
+ template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) {
+ this->__construct_from(std::move(__v));
+ }
- // LWG2756: conditionally explicit conversion from optional<_Up>&&
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v)
- {
- this->__construct_from(std::move(__v));
- }
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v)
- {
- this->__construct_from(std::move(__v));
- }
+# if _LIBCPP_STD_VER >= 23
+ template <class _Fp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
+ : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {}
+# endif
-#if _LIBCPP_STD_VER >= 23
- template<class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit optional(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
- : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(nullopt_t) noexcept {
+ reset();
+ return *this;
}
-#endif
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(nullopt_t) noexcept
- {
- reset();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(const optional&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(optional&&) = default;
+
+ // LWG2756
+ template <
+ class _Up = value_type,
+ class = enable_if_t< _And< _IsNotSame<__remove_cvref_t<_Up>, optional>,
+ _Or< _IsNotSame<__remove_cvref_t<_Up>, value_type>, _Not<is_scalar<value_type>> >,
+ is_constructible<value_type, _Up>,
+ is_assignable<value_type&, _Up> >::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) {
+ if (this->has_value())
+ this->__get() = std::forward<_Up>(__v);
+ else
+ this->__construct(std::forward<_Up>(__v));
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(const optional&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(optional&&) = default;
-
- // LWG2756
- template <class _Up = value_type,
- class = enable_if_t<
- _And<
- _IsNotSame<__remove_cvref_t<_Up>, optional>,
- _Or<
- _IsNotSame<__remove_cvref_t<_Up>, value_type>,
- _Not<is_scalar<value_type>>
- >,
- is_constructible<value_type, _Up>,
- is_assignable<value_type&, _Up>
- >::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional&
- operator=(_Up&& __v)
- {
- if (this->has_value())
- this->__get() = std::forward<_Up>(__v);
- else
- this->__construct(std::forward<_Up>(__v));
- return *this;
- }
+ // LWG2756
+ template <class _Up,
+ enable_if_t< _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(const optional<_Up>& __v) {
+ this->__assign_from(__v);
+ return *this;
+ }
- // LWG2756
- template <class _Up, enable_if_t<
- _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional&
- operator=(const optional<_Up>& __v)
- {
- this->__assign_from(__v);
- return *this;
- }
+ // LWG2756
+ template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_assign<_Up>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(optional<_Up>&& __v) {
+ this->__assign_from(std::move(__v));
+ return *this;
+ }
- // LWG2756
- template <class _Up, enable_if_t<
- _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>()
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 optional&
- operator=(optional<_Up>&& __v)
- {
- this->__assign_from(std::move(__v));
- return *this;
- }
+ template <class... _Args, class = enable_if_t< is_constructible_v<value_type, _Args...> > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
+ reset();
+ this->__construct(std::forward<_Args>(__args)...);
+ return this->__get();
+ }
- template <class... _Args,
- class = enable_if_t
- <
- is_constructible_v<value_type, _Args...>
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp &
- emplace(_Args&&... __args)
- {
- reset();
- this->__construct(std::forward<_Args>(__args)...);
- return this->__get();
- }
+ template <class _Up,
+ class... _Args,
+ class = enable_if_t< is_constructible_v<value_type, initializer_list<_Up>&, _Args...> > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ reset();
+ this->__construct(__il, std::forward<_Args>(__args)...);
+ return this->__get();
+ }
- template <class _Up, class... _Args,
- class = enable_if_t
- <
- is_constructible_v<value_type, initializer_list<_Up>&, _Args...>
- >
- >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp &
- emplace(initializer_list<_Up> __il, _Args&&... __args)
- {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ swap(optional& __opt) noexcept(is_nothrow_move_constructible_v<value_type> && is_nothrow_swappable_v<value_type>) {
+ if (this->has_value() == __opt.has_value()) {
+ using std::swap;
+ if (this->has_value())
+ swap(this->__get(), __opt.__get());
+ } else {
+ if (this->has_value()) {
+ __opt.__construct(std::move(this->__get()));
reset();
- this->__construct(__il, std::forward<_Args>(__args)...);
- return this->__get();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt)
- noexcept(is_nothrow_move_constructible_v<value_type> &&
- is_nothrow_swappable_v<value_type>)
- {
- if (this->has_value() == __opt.has_value())
- {
- using std::swap;
- if (this->has_value())
- swap(this->__get(), __opt.__get());
- }
- else
- {
- if (this->has_value())
- {
- __opt.__construct(std::move(this->__get()));
- reset();
- }
- else
- {
- this->__construct(std::move(__opt.__get()));
- __opt.reset();
- }
- }
+ } else {
+ this->__construct(std::move(__opt.__get()));
+ __opt.reset();
+ }
}
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- add_pointer_t<value_type const>
- operator->() const
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
- return std::addressof(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type const> operator->() const {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
+ return std::addressof(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- add_pointer_t<value_type>
- operator->()
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
- return std::addressof(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type> operator->() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
+ return std::addressof(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- const value_type&
- operator*() const& noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type& operator*() const& noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- value_type&
- operator*() & noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type& operator*() & noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- value_type&&
- operator*() && noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type&& operator*() && noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return std::move(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr
- const value_type&&
- operator*() const&& noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const value_type&& operator*() const&& noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
+ return std::move(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit operator bool() const noexcept { return has_value(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return has_value(); }
- using __base::has_value;
- using __base::__get;
+ using __base::__get;
+ using __base::has_value;
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type const& value() const&
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const& value() const& {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type& value() &
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return this->__get();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type& value() & {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return this->__get();
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type&& value() &&
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type&& value() && {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return std::move(this->__get());
+ }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr value_type const&& value() const&&
- {
- if (!this->has_value())
- __throw_bad_optional_access();
- return std::move(this->__get());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const&& value() const&& {
+ if (!this->has_value())
+ __throw_bad_optional_access();
+ return std::move(this->__get());
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type value_or(_Up&& __v) const&
- {
- static_assert(is_copy_constructible_v<value_type>,
- "optional<T>::value_or: T must be copy constructible");
- static_assert(is_convertible_v<_Up, value_type>,
- "optional<T>::value_or: U must be convertible to T");
- return this->has_value() ? this->__get() :
- static_cast<value_type>(std::forward<_Up>(__v));
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) const& {
+ static_assert(is_copy_constructible_v<value_type>, "optional<T>::value_or: T must be copy constructible");
+ static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
+ return this->has_value() ? this->__get() : static_cast<value_type>(std::forward<_Up>(__v));
+ }
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI
- constexpr value_type value_or(_Up&& __v) &&
- {
- static_assert(is_move_constructible_v<value_type>,
- "optional<T>::value_or: T must be move constructible");
- static_assert(is_convertible_v<_Up, value_type>,
- "optional<T>::value_or: U must be convertible to T");
- return this->has_value() ? std::move(this->__get()) :
- static_cast<value_type>(std::forward<_Up>(__v));
- }
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) && {
+ static_assert(is_move_constructible_v<value_type>, "optional<T>::value_or: T must be move constructible");
+ static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
+ return this->has_value() ? std::move(this->__get()) : static_cast<value_type>(std::forward<_Up>(__v));
+ }
-#if _LIBCPP_STD_VER >= 23
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto and_then(_Func&& __f) & {
+# if _LIBCPP_STD_VER >= 23
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) & {
using _Up = invoke_result_t<_Func, value_type&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(value()) must be a specialization of std::optional");
@@ -1123,9 +871,8 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto and_then(_Func&& __f) const& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) const& {
using _Up = invoke_result_t<_Func, const value_type&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(value()) must be a specialization of std::optional");
@@ -1134,9 +881,8 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto and_then(_Func&& __f) && {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) && {
using _Up = invoke_result_t<_Func, value_type&&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(std::move(value())) must be a specialization of std::optional");
@@ -1145,9 +891,8 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto and_then(_Func&& __f) const&& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
using _Up = invoke_result_t<_Func, const value_type&&>;
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
"Result of f(std::move(value())) must be a specialization of std::optional");
@@ -1156,69 +901,58 @@ public:
return remove_cvref_t<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) & {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) & {
using _Up = remove_cv_t<invoke_result_t<_Func, value_type&>>;
static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(value()) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(value()) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
return optional<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) const& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) const& {
using _Up = remove_cv_t<invoke_result_t<_Func, const value_type&>>;
static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(value()) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(value()) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
return optional<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) && {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) && {
using _Up = remove_cv_t<invoke_result_t<_Func, value_type&&>>;
static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(std::move(value())) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(std::move(value())) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
return optional<_Up>();
}
- template<class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
- constexpr auto transform(_Func&& __f) const&& {
+ template <class _Func>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) const&& {
using _Up = remove_cvref_t<invoke_result_t<_Func, const value_type&&>>;
static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>,
- "Result of f(std::move(value())) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>,
- "Result of f(std::move(value())) should not be std::nullopt_t");
+ static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
+ static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
if (*this)
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
return optional<_Up>();
}
- template<invocable _Func>
- _LIBCPP_HIDE_FROM_ABI
- constexpr optional or_else(_Func&& __f) const& requires is_copy_constructible_v<value_type> {
+ template <invocable _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
+ requires is_copy_constructible_v<value_type>
+ {
static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
"Result of f() should be the same type as this optional");
if (*this)
@@ -1226,446 +960,323 @@ public:
return std::forward<_Func>(__f)();
}
- template<invocable _Func>
- _LIBCPP_HIDE_FROM_ABI
- constexpr optional or_else(_Func&& __f) && requires is_move_constructible_v<value_type> {
+ template <invocable _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
+ requires is_move_constructible_v<value_type>
+ {
static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
"Result of f() should be the same type as this optional");
if (*this)
return std::move(*this);
return std::forward<_Func>(__f)();
}
-#endif // _LIBCPP_STD_VER >= 23
+# endif // _LIBCPP_STD_VER >= 23
- using __base::reset;
+ using __base::reset;
};
-#if _LIBCPP_STD_VER >= 17
-template<class _Tp>
- optional(_Tp) -> optional<_Tp>;
-#endif
+# if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+optional(_Tp) -> optional<_Tp>;
+# endif
// Comparisons between optionals
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() ==
- std::declval<const _Up&>()), bool>,
- bool
->
-operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (static_cast<bool>(__x) != static_cast<bool>(__y))
- return false;
- if (!static_cast<bool>(__x))
- return true;
- return *__x == *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
+ bool >
+operator==(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (static_cast<bool>(__x) != static_cast<bool>(__y))
+ return false;
+ if (!static_cast<bool>(__x))
+ return true;
+ return *__x == *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() !=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (static_cast<bool>(__x) != static_cast<bool>(__y))
- return true;
- if (!static_cast<bool>(__x))
- return false;
- return *__x != *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
+ bool >
+operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (static_cast<bool>(__x) != static_cast<bool>(__y))
+ return true;
+ if (!static_cast<bool>(__x))
+ return false;
+ return *__x != *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__y))
- return false;
- if (!static_cast<bool>(__x))
- return true;
- return *__x < *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
+ bool >
+operator<(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__y))
+ return false;
+ if (!static_cast<bool>(__x))
+ return true;
+ return *__x < *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__x))
- return false;
- if (!static_cast<bool>(__y))
- return true;
- return *__x > *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
+ bool >
+operator>(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__x))
+ return false;
+ if (!static_cast<bool>(__y))
+ return true;
+ return *__x > *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__x))
- return true;
- if (!static_cast<bool>(__y))
- return false;
- return *__x <= *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
+ bool >
+operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__x))
+ return true;
+ if (!static_cast<bool>(__y))
+ return false;
+ return *__x <= *__y;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>=(const optional<_Tp>& __x, const optional<_Up>& __y)
-{
- if (!static_cast<bool>(__y))
- return true;
- if (!static_cast<bool>(__x))
- return false;
- return *__x >= *__y;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
+ bool >
+operator>=(const optional<_Tp>& __x, const optional<_Up>& __y) {
+ if (!static_cast<bool>(__y))
+ return true;
+ if (!static_cast<bool>(__x))
+ return false;
+ return *__x >= *__y;
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp, three_way_comparable_with<_Tp> _Up>
_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Tp, _Up>
operator<=>(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (__x && __y)
- return *__x <=> *__y;
- return __x.has_value() <=> __y.has_value();
+ if (__x && __y)
+ return *__x <=> *__y;
+ return __x.has_value() <=> __y.has_value();
}
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
// Comparisons with nullopt
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator==(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return !static_cast<bool>(__x);
}
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator==(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return !static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<(const optional<_Tp>&, nullopt_t) noexcept
-{
- return false;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const optional<_Tp>&, nullopt_t) noexcept {
+ return false;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return !static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator<=(nullopt_t, const optional<_Tp>&) noexcept
-{
- return true;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(nullopt_t, const optional<_Tp>&) noexcept {
+ return true;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>(const optional<_Tp>& __x, nullopt_t) noexcept
-{
- return static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const optional<_Tp>& __x, nullopt_t) noexcept {
+ return static_cast<bool>(__x);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>(nullopt_t, const optional<_Tp>&) noexcept
-{
- return false;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(nullopt_t, const optional<_Tp>&) noexcept {
+ return false;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>=(const optional<_Tp>&, nullopt_t) noexcept
-{
- return true;
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const optional<_Tp>&, nullopt_t) noexcept {
+ return true;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool
-operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
-{
- return !static_cast<bool>(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(nullopt_t, const optional<_Tp>& __x) noexcept {
+ return !static_cast<bool>(__x);
}
-#else // _LIBCPP_STD_VER <= 17
+# else // _LIBCPP_STD_VER <= 17
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const optional<_Tp>& __x, nullopt_t) noexcept {
- return __x.has_value() <=> false;
+ return __x.has_value() <=> false;
}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
// Comparisons with T
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() ==
- std::declval<const _Up&>()), bool>,
- bool
->
-operator==(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x == __v : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
+ bool >
+operator==(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x == __v : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() ==
- std::declval<const _Up&>()), bool>,
- bool
->
-operator==(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v == *__x : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
+ bool >
+operator==(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v == *__x : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() !=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator!=(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x != __v : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
+ bool >
+operator!=(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x != __v : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() !=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator!=(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v != *__x : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
+ bool >
+operator!=(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v != *__x : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x < __v : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
+ bool >
+operator<(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x < __v : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v < *__x : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
+ bool >
+operator<(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v < *__x : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<=(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x <= __v : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
+ bool >
+operator<=(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x <= __v : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator<=(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v <= *__x : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
+ bool >
+operator<=(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v <= *__x : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x > __v : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
+ bool >
+operator>(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x > __v : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v > *__x : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
+ bool >
+operator>(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v > *__x : true;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>=(const optional<_Tp>& __x, const _Up& __v)
-{
- return static_cast<bool>(__x) ? *__x >= __v : false;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
+ bool >
+operator>=(const optional<_Tp>& __x, const _Up& __v) {
+ return static_cast<bool>(__x) ? *__x >= __v : false;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >=
- std::declval<const _Up&>()), bool>,
- bool
->
-operator>=(const _Tp& __v, const optional<_Up>& __x)
-{
- return static_cast<bool>(__x) ? __v >= *__x : true;
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
+ is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
+ bool >
+operator>=(const _Tp& __v, const optional<_Up>& __x) {
+ return static_cast<bool>(__x) ? __v >= *__x : true;
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Up>
requires(!__is_derived_from_optional<_Up>) && three_way_comparable_with<_Tp, _Up>
_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Tp, _Up>
operator<=>(const optional<_Tp>& __x, const _Up& __v) {
- return __x.has_value() ? *__x <=> __v : strong_ordering::less;
+ return __x.has_value() ? *__x <=> __v : strong_ordering::less;
}
-#endif // _LIBCPP_STD_VER >= 20
-
+# endif // _LIBCPP_STD_VER >= 20
template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-enable_if_t<
- is_move_constructible_v<_Tp> && is_swappable_v<_Tp>,
- void
->
-swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
-{
- __x.swap(__y);
+ enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void >
+ swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-optional<decay_t<_Tp>> make_optional(_Tp&& __v)
-{
- return optional<decay_t<_Tp>>(std::forward<_Tp>(__v));
+_LIBCPP_HIDE_FROM_ABI constexpr optional<decay_t<_Tp>> make_optional(_Tp&& __v) {
+ return optional<decay_t<_Tp>>(std::forward<_Tp>(__v));
}
template <class _Tp, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr
-optional<_Tp> make_optional(_Args&&... __args)
-{
- return optional<_Tp>(in_place, std::forward<_Args>(__args)...);
+_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(_Args&&... __args) {
+ return optional<_Tp>(in_place, std::forward<_Args>(__args)...);
}
template <class _Tp, class _Up, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr
-optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args)
-{
- return optional<_Tp>(in_place, __il, std::forward<_Args>(__args)...);
+_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args) {
+ return optional<_Tp>(in_place, __il, std::forward<_Args>(__args)...);
}
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<
- __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>>
->
-{
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef optional<_Tp> argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
-#endif
-
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const optional<_Tp>& __opt) const
- {
- return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
- }
+struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>> > {
+# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef optional<_Tp> argument_type;
+ _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const optional<_Tp>& __opt) const {
+ return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/ostream b/contrib/llvm-project/libcxx/include/ostream
index ef74f5ddc66c..88ee9d93a1d3 100644
--- a/contrib/llvm-project/libcxx/include/ostream
+++ b/contrib/llvm-project/libcxx/include/ostream
@@ -159,13 +159,24 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
template<class traits>
basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, const char32_t*) = delete; // since C++20
+// [ostream.formatted.print], print functions
+template<class... Args> // since C++23
+ void print(ostream& os, format_string<Args...> fmt, Args&&... args);
+template<class... Args> // since C++23
+ void println(ostream& os, format_string<Args...> fmt, Args&&... args);
+
+void vprint_unicode(ostream& os, string_view fmt, format_args args); // since C++23
+void vprint_nonunicode(ostream& os, string_view fmt, format_args args); // since C++23
} // std
*/
#include <__assert> // all public C++ headers provide the assertion handler
+#include <__availability>
#include <__config>
#include <__exception/operations.h>
+#include <__format/format_args.h>
+#include <__format/format_functions.h>
#include <__fwd/ostream.h>
#include <__memory/shared_ptr.h>
#include <__memory/unique_ptr.h>
@@ -176,10 +187,13 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <bitset>
+#include <cstdio>
#include <ios>
#include <locale>
#include <new>
+#include <print>
#include <streambuf>
+#include <string_view>
#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -189,931 +203,743 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ostream
- : virtual public basic_ios<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ostream : virtual public basic_ios<_CharT, _Traits> {
public:
- // types (inherited from basic_ios (27.5.4)):
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
+ // types (inherited from basic_ios (27.5.4)):
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // 27.7.2.2 Constructor/destructor:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) {
+ this->init(__sb);
+ }
+ ~basic_ostream() override;
- // 27.7.2.2 Constructor/destructor:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb)
- { this->init(__sb); }
- ~basic_ostream() override;
protected:
- inline _LIBCPP_HIDE_FROM_ABI
- basic_ostream(basic_ostream&& __rhs);
+ inline _LIBCPP_HIDE_FROM_ABI basic_ostream(basic_ostream&& __rhs);
- // 27.7.2.3 Assign/swap
- inline _LIBCPP_HIDE_FROM_ABI
- basic_ostream& operator=(basic_ostream&& __rhs);
+ // 27.7.2.3 Assign/swap
+ inline _LIBCPP_HIDE_FROM_ABI basic_ostream& operator=(basic_ostream&& __rhs);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void swap(basic_ostream& __rhs)
- { basic_ios<char_type, traits_type>::swap(__rhs); }
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_ostream& __rhs) {
+ basic_ios<char_type, traits_type>::swap(__rhs);
+ }
- basic_ostream (const basic_ostream& __rhs) = delete;
- basic_ostream& operator=(const basic_ostream& __rhs) = delete;
+ basic_ostream(const basic_ostream& __rhs) = delete;
+ basic_ostream& operator=(const basic_ostream& __rhs) = delete;
public:
- // 27.7.2.4 Prefix/suffix:
- class _LIBCPP_TEMPLATE_VIS sentry;
+ // 27.7.2.4 Prefix/suffix:
+ class _LIBCPP_TEMPLATE_VIS sentry;
- // 27.7.2.6 Formatted output:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&))
- { return __pf(*this); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& operator<<(basic_ios<char_type, traits_type>&
- (*__pf)(basic_ios<char_type,traits_type>&))
- { __pf(*this); return *this; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& operator<<(ios_base& (*__pf)(ios_base&))
- { __pf(*this); return *this; }
-
- basic_ostream& operator<<(bool __n);
- basic_ostream& operator<<(short __n);
- basic_ostream& operator<<(unsigned short __n);
- basic_ostream& operator<<(int __n);
- basic_ostream& operator<<(unsigned int __n);
- basic_ostream& operator<<(long __n);
- basic_ostream& operator<<(unsigned long __n);
- basic_ostream& operator<<(long long __n);
- basic_ostream& operator<<(unsigned long long __n);
- basic_ostream& operator<<(float __f);
- basic_ostream& operator<<(double __f);
- basic_ostream& operator<<(long double __f);
- basic_ostream& operator<<(const void* __p);
+ // 27.7.2.6 Formatted output:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) {
+ return __pf(*this);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream&
+ operator<<(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) {
+ __pf(*this);
+ return *this;
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)) {
+ __pf(*this);
+ return *this;
+ }
+
+ basic_ostream& operator<<(bool __n);
+ basic_ostream& operator<<(short __n);
+ basic_ostream& operator<<(unsigned short __n);
+ basic_ostream& operator<<(int __n);
+ basic_ostream& operator<<(unsigned int __n);
+ basic_ostream& operator<<(long __n);
+ basic_ostream& operator<<(unsigned long __n);
+ basic_ostream& operator<<(long long __n);
+ basic_ostream& operator<<(unsigned long long __n);
+ basic_ostream& operator<<(float __f);
+ basic_ostream& operator<<(double __f);
+ basic_ostream& operator<<(long double __f);
+ basic_ostream& operator<<(const void* __p);
#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream& operator<<(const volatile void* __p) {
- return operator<<(const_cast<const void*>(__p));
- }
+ _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(const volatile void* __p) {
+ return operator<<(const_cast<const void*>(__p));
+ }
#endif
- basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
+ basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
#if _LIBCPP_STD_VER >= 17
-// LWG 2221 - nullptr. This is not backported to older standards modes.
-// See https://reviews.llvm.org/D127033 for more info on the rationale.
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream& operator<<(nullptr_t)
- { return *this << "nullptr"; }
+ // LWG 2221 - nullptr. This is not backported to older standards modes.
+ // See https://reviews.llvm.org/D127033 for more info on the rationale.
+ _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(nullptr_t) { return *this << "nullptr"; }
#endif
- // 27.7.2.7 Unformatted output:
- basic_ostream& put(char_type __c);
- basic_ostream& write(const char_type* __s, streamsize __n);
- basic_ostream& flush();
+ // 27.7.2.7 Unformatted output:
+ basic_ostream& put(char_type __c);
+ basic_ostream& write(const char_type* __s, streamsize __n);
+ basic_ostream& flush();
- // 27.7.2.5 seeks:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- pos_type tellp();
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& seekp(pos_type __pos);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
+ // 27.7.2.5 seeks:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type tellp();
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(pos_type __pos);
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
protected:
- _LIBCPP_HIDE_FROM_ABI
- basic_ostream() {} // extension, intentially does not initialize
+ _LIBCPP_HIDE_FROM_ABI basic_ostream() {} // extension, intentially does not initialize
};
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry
-{
- bool __ok_;
- basic_ostream<_CharT, _Traits>& __os_;
+class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry {
+ bool __ok_;
+ basic_ostream<_CharT, _Traits>& __os_;
public:
- explicit sentry(basic_ostream<_CharT, _Traits>& __os);
- ~sentry();
- sentry(const sentry&) = delete;
- sentry& operator=(const sentry&) = delete;
+ explicit sentry(basic_ostream<_CharT, _Traits>& __os);
+ ~sentry();
+ sentry(const sentry&) = delete;
+ sentry& operator=(const sentry&) = delete;
- _LIBCPP_HIDE_FROM_ABI
- explicit operator bool() const {return __ok_;}
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ok_; }
};
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os)
- : __ok_(false),
- __os_(__os)
-{
- if (__os.good())
- {
- if (__os.tie())
- __os.tie()->flush();
- __ok_ = true;
- }
+basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os) : __ok_(false), __os_(__os) {
+ if (__os.good()) {
+ if (__os.tie())
+ __os.tie()->flush();
+ __ok_ = true;
+ }
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::sentry::~sentry()
-{
- if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf)
- && !uncaught_exception())
- {
+basic_ostream<_CharT, _Traits>::sentry::~sentry() {
+ if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && !uncaught_exception()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__os_.rdbuf()->pubsync() == -1)
- __os_.setstate(ios_base::badbit);
+ if (__os_.rdbuf()->pubsync() == -1)
+ __os_.setstate(ios_base::badbit);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs)
-{
- this->move(__rhs);
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) {
+ this->move(__rhs);
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
-{
- swap(__rhs);
- return *this;
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) {
+ swap(__rhs);
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::~basic_ostream()
-{
-}
+basic_ostream<_CharT, _Traits>::~basic_ostream() {}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb)
-{
+basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- if (__sb)
- {
+ sentry __s(*this);
+ if (__s) {
+ if (__sb) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- _Ip __i(__sb);
- _Ip __eof;
- _Op __o(*this);
- size_t __c = 0;
- for (; __i != __eof; ++__i, ++__o, ++__c)
- {
- *__o = *__i;
- if (__o.failed())
- break;
- }
- if (__c == 0)
- this->setstate(ios_base::failbit);
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Ip __i(__sb);
+ _Ip __eof;
+ _Op __o(*this);
+ size_t __c = 0;
+ for (; __i != __eof; ++__i, ++__o, ++__c) {
+ *__o = *__i;
+ if (__o.failed())
+ break;
+ }
+ if (__c == 0)
+ this->setstate(ios_base::failbit);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_failbit_and_consider_rethrow();
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
- else
- this->setstate(ios_base::badbit);
+ } catch (...) {
+ this->__set_failbit_and_consider_rethrow();
}
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else
+ this->setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(bool __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(short __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(),
- __flags == ios_base::oct || __flags == ios_base::hex ?
- static_cast<long>(static_cast<unsigned short>(__n)) :
- static_cast<long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this,
+ *this,
+ this->fill(),
+ __flags == ios_base::oct || __flags == ios_base::hex
+ ? static_cast<long>(static_cast<unsigned short>(__n))
+ : static_cast<long>(__n))
+ .failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(int __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(),
- __flags == ios_base::oct || __flags == ios_base::hex ?
- static_cast<long>(static_cast<unsigned int>(__n)) :
- static_cast<long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this,
+ *this,
+ this->fill(),
+ __flags == ios_base::oct || __flags == ios_base::hex
+ ? static_cast<long>(static_cast<unsigned int>(__n))
+ : static_cast<long>(__n))
+ .failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(long long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(float __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(double __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(long double __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = std::use_facet<_Fp>(this->getloc());
- if (__f.put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-__put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
- const _CharT* __str, size_t __len)
-{
+__put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- if (std::__pad_and_output(_Ip(__os),
- __str,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- __str + __len :
- __str,
- __str + __len,
- __os,
- __os.fill()).failed())
- __os.setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __str,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,
+ __str + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
-
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
-{
- return std::__put_character_sequence(__os, &__c, 1);
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) {
+ return std::__put_character_sequence(__os, &__c, 1);
}
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
-{
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- _CharT __c = __os.widen(__cn);
- typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- if (std::__pad_and_output(_Ip(__os),
- &__c,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- &__c + 1 :
- &__c,
- &__c + 1,
- __os,
- __os.fill()).failed())
- __os.setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ _CharT __c = __os.widen(__cn);
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ &__c,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? &__c + 1 : &__c,
+ &__c + 1,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, char __c)
-{
- return std::__put_character_sequence(__os, &__c, 1);
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, char __c) {
+ return std::__put_character_sequence(__os, &__c, 1);
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
-{
- return std::__put_character_sequence(__os, (char *) &__c, 1);
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
+ return std::__put_character_sequence(__os, (char*)&__c, 1);
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
-{
- return std::__put_character_sequence(__os, (char *) &__c, 1);
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
+ return std::__put_character_sequence(__os, (char*)&__c, 1);
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
-{
- return std::__put_character_sequence(__os, __str, _Traits::length(__str));
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) {
+ return std::__put_character_sequence(__os, __str, _Traits::length(__str));
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
-{
+operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- size_t __len = char_traits<char>::length(__strn);
- const int __bs = 100;
- _CharT __wbb[__bs];
- _CharT* __wb = __wbb;
- unique_ptr<_CharT, void(*)(void*)> __h(0, free);
- if (__len > __bs)
- {
- __wb = (_CharT*)malloc(__len*sizeof(_CharT));
- if (__wb == 0)
- __throw_bad_alloc();
- __h.reset(__wb);
- }
- for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
- *__p = __os.widen(*__strn);
- if (std::__pad_and_output(_Ip(__os),
- __wb,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- __wb + __len :
- __wb,
- __wb + __len,
- __os,
- __os.fill()).failed())
- __os.setstate(ios_base::badbit | ios_base::failbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __os.__set_badbit_and_consider_rethrow();
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ size_t __len = char_traits<char>::length(__strn);
+ const int __bs = 100;
+ _CharT __wbb[__bs];
+ _CharT* __wb = __wbb;
+ unique_ptr<_CharT, void (*)(void*)> __h(0, free);
+ if (__len > __bs) {
+ __wb = (_CharT*)malloc(__len * sizeof(_CharT));
+ if (__wb == 0)
+ __throw_bad_alloc();
+ __h.reset(__wb);
+ }
+ for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
+ *__p = __os.widen(*__strn);
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __wb,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __wb + __len : __wb,
+ __wb + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return __os;
+ return __os;
}
-template<class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
-{
- return std::__put_character_sequence(__os, __str, _Traits::length(__str));
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, const char* __str) {
+ return std::__put_character_sequence(__os, __str, _Traits::length(__str));
}
-template<class _Traits>
+template <class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
-{
- const char *__s = (const char *) __str;
- return std::__put_character_sequence(__os, __s, _Traits::length(__s));
+operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) {
+ const char* __s = (const char*)__str;
+ return std::__put_character_sequence(__os, __s, _Traits::length(__s));
}
-template<class _Traits>
+template <class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
-{
- const char *__s = (const char *) __str;
- return std::__put_character_sequence(__os, __s, _Traits::length(__s));
+operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) {
+ const char* __s = (const char*)__str;
+ return std::__put_character_sequence(__os, __s, _Traits::length(__s));
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::put(char_type __c)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __c) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __s(*this);
- if (__s)
- {
- typedef ostreambuf_iterator<_CharT, _Traits> _Op;
- _Op __o(*this);
- *__o = __c;
- if (__o.failed())
- this->setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __s(*this);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Op __o(*this);
+ *__o = __c;
+ if (__o.failed())
+ this->setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- sentry __sen(*this);
- if (__sen && __n)
- {
- if (this->rdbuf()->sputn(__s, __n) != __n)
- this->setstate(ios_base::badbit);
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ sentry __sen(*this);
+ if (__sen && __n) {
+ if (this->rdbuf()->sputn(__s, __n) != __n)
+ this->setstate(ios_base::badbit);
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::flush()
-{
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (this->rdbuf())
- {
- sentry __s(*this);
- if (__s)
- {
- if (this->rdbuf()->pubsync() == -1)
- this->setstate(ios_base::badbit);
- }
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- this->__set_badbit_and_consider_rethrow();
+ if (this->rdbuf()) {
+ sentry __s(*this);
+ if (__s) {
+ if (this->rdbuf()->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ }
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- return *this;
+ return *this;
}
template <class _CharT, class _Traits>
-typename basic_ostream<_CharT, _Traits>::pos_type
-basic_ostream<_CharT, _Traits>::tellp()
-{
- if (this->fail())
- return pos_type(-1);
- return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
+typename basic_ostream<_CharT, _Traits>::pos_type basic_ostream<_CharT, _Traits>::tellp() {
+ if (this->fail())
+ return pos_type(-1);
+ return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
-{
- sentry __s(*this);
- if (!this->fail())
- {
- if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
- this->setstate(ios_base::failbit);
- }
- return *this;
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) {
+ sentry __s(*this);
+ if (!this->fail()) {
+ if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
-{
- sentry __s(*this);
- if (!this->fail())
- {
- if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
- this->setstate(ios_base::failbit);
- }
- return *this;
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) {
+ sentry __s(*this);
+ if (!this->fail()) {
+ if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline
-basic_ostream<_CharT, _Traits>&
-endl(basic_ostream<_CharT, _Traits>& __os)
-{
- __os.put(__os.widen('\n'));
- __os.flush();
- return __os;
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(__os.widen('\n'));
+ __os.flush();
+ return __os;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline
-basic_ostream<_CharT, _Traits>&
-ends(basic_ostream<_CharT, _Traits>& __os)
-{
- __os.put(_CharT());
- return __os;
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(_CharT());
+ return __os;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI inline
-basic_ostream<_CharT, _Traits>&
-flush(basic_ostream<_CharT, _Traits>& __os)
-{
- __os.flush();
- return __os;
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) {
+ __os.flush();
+ return __os;
}
template <class _Stream, class _Tp, class = void>
-struct __is_ostreamable : false_type { };
+struct __is_ostreamable : false_type {};
template <class _Stream, class _Tp>
-struct __is_ostreamable<_Stream, _Tp, decltype(
- std::declval<_Stream>() << std::declval<_Tp>(), void()
-)> : true_type { };
+struct __is_ostreamable<_Stream, _Tp, decltype(std::declval<_Stream>() << std::declval<_Tp>(), void())> : true_type {};
template <class _Stream,
class _Tp,
__enable_if_t<_And<is_base_of<ios_base, _Stream>, __is_ostreamable<_Stream&, const _Tp&> >::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI
-_Stream&& operator<<(_Stream&& __os, const _Tp& __x)
-{
- __os << __x;
- return std::move(__os);
+_LIBCPP_HIDE_FROM_ABI _Stream&& operator<<(_Stream&& __os, const _Tp& __x) {
+ __os << __x;
+ return std::move(__os);
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const basic_string<_CharT, _Traits, _Allocator>& __str)
-{
- return std::__put_character_sequence(__os, __str.data(), __str.size());
+operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str) {
+ return std::__put_character_sequence(__os, __str.data(), __str.size());
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- basic_string_view<_CharT, _Traits> __sv)
-{
- return std::__put_character_sequence(__os, __sv.data(), __sv.size());
+operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) {
+ return std::__put_character_sequence(__os, __sv.data(), __sv.size());
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
-{
- return __os << __ec.category().name() << ':' << __ec.value();
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec) {
+ return __os << __ec.category().name() << ':' << __ec.value();
}
-template<class _CharT, class _Traits, class _Yp>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
-{
- return __os << __p.get();
+template <class _CharT, class _Traits, class _Yp>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) {
+ return __os << __p.get();
}
template <
@@ -1127,21 +953,19 @@ template <
int> = 0>
inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) {
- return __os << __p.get();
+ return __os << __p.get();
}
template <class _CharT, class _Traits, size_t _Size>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
-{
- return __os << __x.template to_string<_CharT, _Traits>
- (std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
- std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) {
+ return __os << __x.template to_string<_CharT, _Traits>(std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
+ std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
#if _LIBCPP_STD_VER >= 20
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete;
@@ -1160,9 +984,9 @@ basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, co
template <class _Traits>
basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete;
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
template <class _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete;
@@ -1174,7 +998,7 @@ basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const ch
template <class _Traits>
basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete;
-#endif
+# endif
template <class _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char16_t) = delete;
@@ -1195,6 +1019,151 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>;
#endif
+#if _LIBCPP_STD_VER >= 23
+
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_HIDE_FROM_ABI inline void
+__vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
+ // [ostream.formatted.print]/3
+ // Effects: Behaves as a formatted output function
+ // ([ostream.formatted.reqmts]) of os, except that:
+ // - failure to generate output is reported as specified below, and
+ // - any exception thrown by the call to vformat is propagated without regard
+ // to the value of os.exceptions() and without turning on ios_base::badbit
+ // in the error state of os.
+ // After constructing a sentry object, the function initializes an automatic
+ // variable via
+ // string out = vformat(os.getloc(), fmt, args);
+
+ ostream::sentry __s(__os);
+ if (__s) {
+ string __o = std::vformat(__os.getloc(), __fmt, __args);
+ if (__write_nl)
+ __o += '\n';
+
+ const char* __str = __o.data();
+ size_t __len = __o.size();
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ typedef ostreambuf_iterator<char> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __str,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,
+ __str + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+}
+
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args) {
+ std::__vprint_nonunicode(__os, __fmt, __args, false);
+}
+
+// Returns the FILE* associated with the __os.
+// Returns a nullptr when no FILE* is associated with __os.
+// This function is in the dylib since the type of the buffer associated
+// with std::cout, std::cerr, and std::clog is only known in the dylib.
+//
+// This function implements part of the implementation-defined behavior
+// of [ostream.formatted.print]/3
+// If the function is vprint_unicode and os is a stream that refers to
+// a terminal capable of displaying Unicode which is determined in an
+// implementation-defined manner, writes out to the terminal using the
+// native Unicode API;
+// Whether the returned FILE* is "a terminal capable of displaying Unicode"
+// is determined in the same way as the print(FILE*, ...) overloads.
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os);
+
+# ifndef _LIBCPP_HAS_NO_UNICODE
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+__vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
+ FILE* __file = std::__get_ostream_file(__os);
+ if (!__file || !__print::__is_terminal(__file))
+ return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl);
+
+ // [ostream.formatted.print]/3
+ // If the function is vprint_unicode and os is a stream that refers to a
+ // terminal capable of displaying Unicode which is determined in an
+ // implementation-defined manner, writes out to the terminal using the
+ // native Unicode API; if out contains invalid code units, the behavior is
+ // undefined and implementations are encouraged to diagnose it. If the
+ // native Unicode API is used, the function flushes os before writing out.
+ //
+ // This is the path for the native API, start with flushing.
+ __os.flush();
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ ostream::sentry __s(__os);
+ if (__s) {
+# ifndef _LIBCPP_WIN32API
+ __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true);
+# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+ __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true);
+# else
+# error "Windows builds with wchar_t disabled are not supported."
+# endif
+ }
+
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+}
+
+template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI inline void
+vprint_unicode(ostream& __os, string_view __fmt, format_args __args) {
+ std::__vprint_unicode(__os, __fmt, __args, false);
+}
+# endif // _LIBCPP_HAS_NO_UNICODE
+
+template <class... _Args>
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
+# ifndef _LIBCPP_HAS_NO_UNICODE
+ if constexpr (__print::__use_unicode)
+ std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false);
+ else
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
+# else // _LIBCPP_HAS_NO_UNICODE
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
+# endif // _LIBCPP_HAS_NO_UNICODE
+}
+
+template <class... _Args>
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
+# ifndef _LIBCPP_HAS_NO_UNICODE
+ // Note the wording in the Standard is inefficient. The output of
+ // std::format is a std::string which is then copied. This solution
+ // just appends a newline at the end of the output.
+ if constexpr (__print::__use_unicode)
+ std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true);
+ else
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
+# else // _LIBCPP_HAS_NO_UNICODE
+ std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
+# endif // _LIBCPP_HAS_NO_UNICODE
+}
+
+#endif // _LIBCPP_STD_VER >= 23
+
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
diff --git a/contrib/llvm-project/libcxx/include/print b/contrib/llvm-project/libcxx/include/print
index d119c8bda749..0f8e73f8eb5c 100644
--- a/contrib/llvm-project/libcxx/include/print
+++ b/contrib/llvm-project/libcxx/include/print
@@ -59,7 +59,7 @@ namespace std {
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifdef _WIN32
+#ifdef _LIBCPP_WIN32API
_LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -75,7 +75,7 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
_LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view);
# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#endif // _WIN32
+#endif // _LIBCPP_WIN32API
#if _LIBCPP_STD_VER >= 23
@@ -198,7 +198,11 @@ inline constexpr bool __use_unicode = true;
# endif
_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) {
-# ifdef _WIN32
+ // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change
+ // the behavior in the test. This is not part of the public API.
+# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
+ return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
+# elif defined(_LIBCPP_WIN32API)
return std::__is_windows_terminal(__stream);
# elif __has_include(<unistd.h>)
return isatty(fileno(__stream));
@@ -271,7 +275,7 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args,
// the behavior in the test. This is not part of the public API.
# ifdef _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION
_LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION(__stream, __view);
-# elif defined(_WIN32)
+# elif defined(_LIBCPP_WIN32API)
std::__write_to_windows_console(__stream, __view);
# else
std::__throw_runtime_error("No defintion of _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION and "
@@ -309,7 +313,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
// so there the call can be forwarded to the non_unicode API. On
// Windows there is a different API. This API requires transcoding.
-# ifndef _WIN32
+# ifndef _LIBCPP_WIN32API
__print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
__print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
diff --git a/contrib/llvm-project/libcxx/include/queue b/contrib/llvm-project/libcxx/include/queue
index c9a4eb27a9a6..692e38bb3522 100644
--- a/contrib/llvm-project/libcxx/include/queue
+++ b/contrib/llvm-project/libcxx/include/queue
@@ -285,212 +285,170 @@ template <class T, class Container, class Compare>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS queue;
+template <class _Tp, class _Container = deque<_Tp> >
+class _LIBCPP_TEMPLATE_VIS queue;
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator==(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator<(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container /*= deque<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS queue
-{
+class _LIBCPP_TEMPLATE_VIS queue {
public:
- typedef _Container container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
+ typedef _Container container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ static_assert((is_same<_Tp, value_type>::value), "");
protected:
- container_type c;
+ container_type c;
public:
- _LIBCPP_HIDE_FROM_ABI
- queue()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
- : c() {}
+ _LIBCPP_HIDE_FROM_ABI queue() _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value) : c() {}
- _LIBCPP_HIDE_FROM_ABI
- queue(const queue& __q) : c(__q.c) {}
+ _LIBCPP_HIDE_FROM_ABI queue(const queue& __q) : c(__q.c) {}
#if _LIBCPP_STD_VER >= 23
- template <class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- queue(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
-
- template <class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc) : c(__first, __second, __alloc) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- queue(from_range_t, _Range&& __range, const _Alloc& __alloc)
+ template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+ _LIBCPP_HIDE_FROM_ABI queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
+
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI queue(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
+
+ template <class _InputIterator,
+ class _Alloc,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI queue(_InputIterator __first, _InputIterator __second, const _Alloc& __alloc)
+ : c(__first, __second, __alloc) {}
+
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI queue(from_range_t, _Range&& __range, const _Alloc& __alloc)
: c(from_range, std::forward<_Range>(__range), __alloc) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- queue& operator=(const queue& __q) {c = __q.c; return *this;}
+ _LIBCPP_HIDE_FROM_ABI queue& operator=(const queue& __q) {
+ c = __q.c;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- queue(queue&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
- : c(std::move(__q.c)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- queue& operator=(queue&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
- {c = std::move(__q.c); return *this;}
+ _LIBCPP_HIDE_FROM_ABI queue(queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+ : c(std::move(__q.c)) {}
+
+ _LIBCPP_HIDE_FROM_ABI queue& operator=(queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {
+ c = std::move(__q.c);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit queue(const container_type& __c) : c(__c) {}
+ _LIBCPP_HIDE_FROM_ABI explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit queue(container_type&& __c) : c(std::move(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit queue(container_type&& __c) : c(std::move(__c)) {}
#endif // _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- explicit queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(const queue& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__q.c, __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__c, __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI explicit queue(const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(const queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__q.c, __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(const container_type& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__c, __a) {}
#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__c), __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- queue(queue&& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__q.c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(container_type&& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ queue(queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__q.c), __a) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return c.empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return c.size();}
-
- _LIBCPP_HIDE_FROM_ABI
- reference front() {return c.front();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference front() const {return c.front();}
- _LIBCPP_HIDE_FROM_ABI
- reference back() {return c.back();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference back() const {return c.back();}
-
- _LIBCPP_HIDE_FROM_ABI
- void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void push(value_type&& __v) {c.push_back(std::move(__v));}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void push_range(_Range&& __range) {
- if constexpr (requires (container_type& __c) {
- __c.append_range(std::forward<_Range>(__range));
- }) {
- c.append_range(std::forward<_Range>(__range));
- } else {
- ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
- }
- }
-#endif
+ _LIBCPP_HIDE_FROM_ABI reference front() { return c.front(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference front() const { return c.front(); }
+ _LIBCPP_HIDE_FROM_ABI reference back() { return c.back(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference back() const { return c.back(); }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
-#if _LIBCPP_STD_VER >= 17
- decltype(auto) emplace(_Args&&... __args)
- { return c.emplace_back(std::forward<_Args>(__args)...);}
-#else
- void emplace(_Args&&... __args)
- { c.emplace_back(std::forward<_Args>(__args)...);}
-#endif
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void pop() {c.pop_front();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
- {
- using std::swap;
- swap(c, __q.c);
+ _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v) { c.push_back(__v); }
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v) { c.push_back(std::move(__v)); }
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
+ if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
+ c.append_range(std::forward<_Range>(__range));
+ } else {
+ ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
}
+ }
+# endif
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI
+# if _LIBCPP_STD_VER >= 17
+ decltype(auto)
+ emplace(_Args&&... __args) {
+ return c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# else
+ void
+ emplace(_Args&&... __args) {
+ c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# endif
+#endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void pop() { c.pop_front(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(queue& __q) _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) {
+ using std::swap;
+ swap(c, __q.c);
+ }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
- template <class _T1, class _OtherContainer>
- friend
- _LIBCPP_HIDE_FROM_ABI
- bool
- operator==(const queue<_T1, _OtherContainer>& __x,const queue<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const queue<_T1, _OtherContainer>& __x, const queue<_T1, _OtherContainer>& __y);
- template <class _T1, class _OtherContainer>
- friend
- _LIBCPP_HIDE_FROM_ABI
- bool
- operator< (const queue<_T1, _OtherContainer>& __x,const queue<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator<(const queue<_T1, _OtherContainer>& __x, const queue<_T1, _OtherContainer>& __y);
};
#if _LIBCPP_STD_VER >= 17
-template<class _Container,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-queue(_Container)
- -> queue<typename _Container::value_type, _Container>;
-
-template<class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
-queue(_Container, _Alloc)
- -> queue<typename _Container::value_type, _Container>;
+template <class _Container, class = enable_if_t<!__is_allocator<_Container>::value> >
+queue(_Container) -> queue<typename _Container::value_type, _Container>;
+
+template <class _Container,
+ class _Alloc,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
+queue(_Container, _Alloc) -> queue<typename _Container::value_type, _Container>;
#endif
#if _LIBCPP_STD_VER >= 23
-template <class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
-queue(_InputIterator, _InputIterator)
- -> queue<__iter_value_type<_InputIterator>>;
+template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+queue(_InputIterator, _InputIterator) -> queue<__iter_value_type<_InputIterator>>;
template <ranges::input_range _Range>
-queue(from_range_t, _Range&&)
- -> queue<ranges::range_value_t<_Range>>;
+queue(from_range_t, _Range&&) -> queue<ranges::range_value_t<_Range>>;
template <class _InputIterator,
class _Alloc,
@@ -499,59 +457,39 @@ template <class _InputIterator,
queue(_InputIterator, _InputIterator, _Alloc)
-> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
-template <ranges::input_range _Range,
- class _Alloc,
- class = __enable_if_t<__is_allocator<_Alloc>::value>>
+template <ranges::input_range _Range, class _Alloc, class = __enable_if_t<__is_allocator<_Alloc>::value>>
queue(from_range_t, _Range&&, _Alloc)
-> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __x.c == __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return __x.c == __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __x.c < __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return __x.c < __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
+ return !(__y < __x);
}
#if _LIBCPP_STD_VER >= 20
@@ -559,281 +497,255 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
template <class _Tp, three_way_comparable _Container>
_LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
operator<=>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y) {
- // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
- return __x.__get_container() <=> __y.__get_container();
+ // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
+ return __x.__get_container() <=> __y.__get_container();
}
#endif
template <class _Tp, class _Container, __enable_if_t<__is_swappable<_Container>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, class _Container, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc> : public uses_allocator<_Container, _Alloc> {
};
-template <class _Tp, class _Container = vector<_Tp>,
- class _Compare = less<typename _Container::value_type> >
-class _LIBCPP_TEMPLATE_VIS priority_queue
-{
+template <class _Tp, class _Container = vector<_Tp>, class _Compare = less<typename _Container::value_type> >
+class _LIBCPP_TEMPLATE_VIS priority_queue {
public:
- typedef _Container container_type;
- typedef _Compare value_compare;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
+ typedef _Container container_type;
+ typedef _Compare value_compare;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ static_assert((is_same<_Tp, value_type>::value), "");
protected:
- container_type c;
- value_compare comp;
+ container_type c;
+ value_compare comp;
public:
- _LIBCPP_HIDE_FROM_ABI
- priority_queue()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
- is_nothrow_default_constructible<value_compare>::value)
- : c(), comp() {}
+ _LIBCPP_HIDE_FROM_ABI priority_queue() _NOEXCEPT_(
+ is_nothrow_default_constructible<container_type>::value&& is_nothrow_default_constructible<value_compare>::value)
+ : c(), comp() {}
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
+ _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
- _LIBCPP_HIDE_FROM_ABI
- priority_queue& operator=(const priority_queue& __q)
- {c = __q.c; comp = __q.comp; return *this;}
+ _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(const priority_queue& __q) {
+ c = __q.c;
+ comp = __q.comp;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(priority_queue&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
- is_nothrow_move_constructible<value_compare>::value)
- : c(std::move(__q.c)), comp(std::move(__q.comp)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- priority_queue& operator=(priority_queue&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
- is_nothrow_move_assignable<value_compare>::value)
- {c = std::move(__q.c); comp = std::move(__q.comp); return *this;}
+ _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) _NOEXCEPT_(
+ is_nothrow_move_constructible<container_type>::value&& is_nothrow_move_constructible<value_compare>::value)
+ : c(std::move(__q.c)), comp(std::move(__q.comp)) {}
+
+ _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q)
+ _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value&& is_nothrow_move_assignable<value_compare>::value) {
+ c = std::move(__q.c);
+ comp = std::move(__q.comp);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit priority_queue(const value_compare& __comp)
- : c(), comp(__comp) {}
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, const container_type& __c);
+ _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {}
+ _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, container_type&& __c);
+ _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c);
#endif
- template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp = value_compare());
- template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c);
+ template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare());
+ template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_CXX03_LANG
- template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, container_type&& __c);
+ template <class _InputIter, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c);
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
- : c(from_range, std::forward<_Range>(__range)),
- comp(__comp) {
- std::make_heap(c.begin(), c.end(), comp);
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
+ : c(from_range, std::forward<_Range>(__range)), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
+ }
#endif
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- explicit priority_queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, const container_type& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const priority_queue& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ const priority_queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(const value_compare& __comp, container_type&& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(priority_queue&& __q, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ priority_queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#endif // _LIBCPP_CXX03_LANG
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f,
+ _InputIter __l,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
#ifndef _LIBCPP_CXX03_LANG
- template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp, container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
-#endif // _LIBCPP_CXX03_LANG
+ template <class _InputIter, class _Alloc, class = __enable_if_t<__has_input_iterator_category<_InputIter>::value> >
+ _LIBCPP_HIDE_FROM_ABI priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0);
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
- : c(from_range, std::forward<_Range>(__range), __a),
- comp(__comp) {
- std::make_heap(c.begin(), c.end(), comp);
- }
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
+ : c(from_range, std::forward<_Range>(__range), __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
+ }
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
- : c(from_range, std::forward<_Range>(__range), __a),
- comp() {
- std::make_heap(c.begin(), c.end(), comp);
- }
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
+ : c(from_range, std::forward<_Range>(__range), __a), comp() {
+ std::make_heap(c.begin(), c.end(), comp);
+ }
#endif
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return c.empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return c.size();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference top() const {return c.front();}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); }
- _LIBCPP_HIDE_FROM_ABI
- void push(const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void push(value_type&& __v);
-
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void push_range(_Range&& __range) {
- if constexpr (requires (container_type& __c) {
- __c.append_range(std::forward<_Range>(__range));
- }) {
- c.append_range(std::forward<_Range>(__range));
- } else {
- ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
- }
-
- std::make_heap(c.begin(), c.end(), comp);
+ _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v);
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
+ if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
+ c.append_range(std::forward<_Range>(__range));
+ } else {
+ ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
}
-#endif
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void emplace(_Args&&... __args);
+ std::make_heap(c.begin(), c.end(), comp);
+ }
+# endif
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void emplace(_Args&&... __args);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void pop();
+ _LIBCPP_HIDE_FROM_ABI void pop();
- _LIBCPP_HIDE_FROM_ABI
- void swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
- __is_nothrow_swappable<value_compare>::value);
+ _LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q)
+ _NOEXCEPT_(__is_nothrow_swappable<container_type>::value&& __is_nothrow_swappable<value_compare>::value);
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
};
#if _LIBCPP_STD_VER >= 17
template <class _Compare,
class _Container,
class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-priority_queue(_Compare, _Container)
- -> priority_queue<typename _Container::value_type, _Container, _Compare>;
+ class = enable_if_t<!__is_allocator<_Container>::value> >
+priority_queue(_Compare, _Container) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Container = vector<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
+template <class _InputIterator,
+ class _Compare = less<__iter_value_type<_InputIterator>>,
+ class _Container = vector<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
-> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
-template<class _Compare,
- class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
-priority_queue(_Compare, _Container, _Alloc)
- -> priority_queue<typename _Container::value_type, _Container, _Compare>;
+template <class _Compare,
+ class _Container,
+ class _Alloc,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
+priority_queue(_Compare, _Container, _Alloc) -> priority_queue<typename _Container::value_type, _Container, _Compare>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
->
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
priority_queue(_InputIterator, _InputIterator, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
vector<__iter_value_type<_InputIterator>, _Allocator>,
less<__iter_value_type<_InputIterator>>>;
-template<class _InputIterator, class _Compare, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
->
+template <class _InputIterator,
+ class _Compare,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
- vector<__iter_value_type<_InputIterator>, _Allocator>, _Compare>;
-
-template<class _InputIterator, class _Compare, class _Container, class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Compare>::value>,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
->
+ vector<__iter_value_type<_InputIterator>, _Allocator>,
+ _Compare>;
+
+template <class _InputIterator,
+ class _Compare,
+ class _Container,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
#endif
@@ -842,7 +754,7 @@ priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
template <ranges::input_range _Range,
class _Compare = less<ranges::range_value_t<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value>>
+ class = enable_if_t<!__is_allocator<_Compare>::value>>
priority_queue(from_range_t, _Range&&, _Compare = _Compare())
-> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>>, _Compare>;
@@ -852,278 +764,210 @@ template <ranges::input_range _Range,
class = enable_if_t<!__is_allocator<_Compare>::value>,
class = enable_if_t<__is_allocator<_Alloc>::value>>
priority_queue(from_range_t, _Range&&, _Compare, _Alloc)
- -> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>,
- _Compare>;
+ -> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>, _Compare>;
-template <ranges::input_range _Range,
- class _Alloc,
- class = enable_if_t<__is_allocator<_Alloc>::value>>
+template <ranges::input_range _Range, class _Alloc, class = enable_if_t<__is_allocator<_Alloc>::value>>
priority_queue(from_range_t, _Range&&, _Alloc)
-> priority_queue<ranges::range_value_t<_Range>, vector<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container, class _Compare>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
- const container_type& __c)
- : c(__c),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, const container_type& __c)
+ : c(__c), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- container_type&& __c)
- : c(std::move(__c)),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c)
+ : c(std::move(__c)), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp)
- : c(__f, __l),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const value_compare& __comp)
+ : c(__f, __l), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp,
- const container_type& __c)
- : c(__c),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c)
+ : c(__c), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
- const value_compare& __comp,
- container_type&& __c)
- : c(std::move(__c)),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c)
+ : c(std::move(__c)), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__a)
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__a) {}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__a),
- comp(__comp)
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__a), comp(__comp) {}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- const container_type& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__c, __a),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__c, __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__q.c, __a),
- comp(__q.comp)
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const priority_queue& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__q.c, __a), comp(__q.comp) {}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
- container_type&& __c,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(std::move(__c), __a),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(std::move(__c), __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
- const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(std::move(__q.c), __a),
- comp(std::move(__q.comp))
-{
-}
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ priority_queue&& __q, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(std::move(__q.c), __a), comp(std::move(__q.comp)) {}
-#endif // _LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__f, __l, __a),
- comp()
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__f, __l, __a), comp() {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l,
- const value_compare& __comp, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__f, __l, __a),
- comp(__comp)
-{
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__f, __l, __a), comp(__comp) {
+ std::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l,
- const value_compare& __comp, const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(__c, __a),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ const container_type& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(__c, __a), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, class _Alloc, class>
-inline
-priority_queue<_Tp, _Container, _Compare>::priority_queue(
- _InputIter __f, _InputIter __l, const value_compare& __comp,
- container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
- : c(std::move(__c), __a),
- comp(__comp)
-{
- c.insert(c.end(), __f, __l);
- std::make_heap(c.begin(), c.end(), comp);
+inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f,
+ _InputIter __l,
+ const value_compare& __comp,
+ container_type&& __c,
+ const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>*)
+ : c(std::move(__c), __a), comp(__comp) {
+ c.insert(c.end(), __f, __l);
+ std::make_heap(c.begin(), c.end(), comp);
}
-#endif // _LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
-{
- c.push_back(__v);
- std::push_heap(c.begin(), c.end(), comp);
+inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) {
+ c.push_back(__v);
+ std::push_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
-{
- c.push_back(std::move(__v));
- std::push_heap(c.begin(), c.end(), comp);
+inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) {
+ c.push_back(std::move(__v));
+ std::push_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
-{
- c.emplace_back(std::forward<_Args>(__args)...);
- std::push_heap(c.begin(), c.end(), comp);
+inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) {
+ c.emplace_back(std::forward<_Args>(__args)...);
+ std::push_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::pop()
-{
- std::pop_heap(c.begin(), c.end(), comp);
- c.pop_back();
+inline void priority_queue<_Tp, _Container, _Compare>::pop() {
+ std::pop_heap(c.begin(), c.end(), comp);
+ c.pop_back();
}
template <class _Tp, class _Container, class _Compare>
-inline
-void
-priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
- __is_nothrow_swappable<value_compare>::value)
-{
- using std::swap;
- swap(c, __q.c);
- swap(comp, __q.comp);
+inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
+ _NOEXCEPT_(__is_nothrow_swappable<container_type>::value&& __is_nothrow_swappable<value_compare>::value) {
+ using std::swap;
+ swap(c, __q.c);
+ swap(comp, __q.comp);
}
-template <class _Tp, class _Container, class _Compare,
+template <class _Tp,
+ class _Container,
+ class _Compare,
__enable_if_t<__is_swappable<_Container>::value && __is_swappable<_Compare>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(priority_queue<_Tp, _Container, _Compare>& __x,
- priority_queue<_Tp, _Container, _Compare>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, class _Container, class _Compare, class _Alloc>
struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
-};
+ : public uses_allocator<_Container, _Alloc> {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/ranges b/contrib/llvm-project/libcxx/include/ranges
index f71a92f8a660..660d533b2a78 100644
--- a/contrib/llvm-project/libcxx/include/ranges
+++ b/contrib/llvm-project/libcxx/include/ranges
@@ -417,7 +417,7 @@ namespace std {
#include <version>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-#include <__ranges/istream_view.h>
+# include <__ranges/istream_view.h>
#endif
// standard-mandated includes
diff --git a/contrib/llvm-project/libcxx/include/ratio b/contrib/llvm-project/libcxx/include/ratio
index c9637ab818cd..3b11a2aa5bf6 100644
--- a/contrib/llvm-project/libcxx/include/ratio
+++ b/contrib/llvm-project/libcxx/include/ratio
@@ -95,176 +95,164 @@ using quetta = ratio <1'000'000'000'000'000'000'000'000'000'000, 1>; // Since C+
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
// __static_gcd
template <intmax_t _Xp, intmax_t _Yp>
-struct __static_gcd
-{
- static const intmax_t value = __static_gcd<_Yp, _Xp % _Yp>::value;
+struct __static_gcd {
+ static const intmax_t value = __static_gcd<_Yp, _Xp % _Yp>::value;
};
template <intmax_t _Xp>
-struct __static_gcd<_Xp, 0>
-{
- static const intmax_t value = _Xp;
+struct __static_gcd<_Xp, 0> {
+ static const intmax_t value = _Xp;
};
template <>
-struct __static_gcd<0, 0>
-{
- static const intmax_t value = 1;
+struct __static_gcd<0, 0> {
+ static const intmax_t value = 1;
};
// __static_lcm
template <intmax_t _Xp, intmax_t _Yp>
-struct __static_lcm
-{
- static const intmax_t value = _Xp / __static_gcd<_Xp, _Yp>::value * _Yp;
+struct __static_lcm {
+ static const intmax_t value = _Xp / __static_gcd<_Xp, _Yp>::value * _Yp;
};
template <intmax_t _Xp>
-struct __static_abs
-{
- static const intmax_t value = _Xp < 0 ? -_Xp : _Xp;
+struct __static_abs {
+ static const intmax_t value = _Xp < 0 ? -_Xp : _Xp;
};
template <intmax_t _Xp>
-struct __static_sign
-{
- static const intmax_t value = _Xp == 0 ? 0 : (_Xp < 0 ? -1 : 1);
+struct __static_sign {
+ static const intmax_t value = _Xp == 0 ? 0 : (_Xp < 0 ? -1 : 1);
};
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
class __ll_add;
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_add<_Xp, _Yp, 1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_add<_Xp, _Yp, 1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
- static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
public:
- static const intmax_t value = _Xp + _Yp;
+ static const intmax_t value = _Xp + _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_add<_Xp, _Yp, 0>
-{
+class __ll_add<_Xp, _Yp, 0> {
public:
- static const intmax_t value = _Xp;
+ static const intmax_t value = _Xp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_add<_Xp, _Yp, -1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_add<_Xp, _Yp, -1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
- static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
public:
- static const intmax_t value = _Xp + _Yp;
+ static const intmax_t value = _Xp + _Yp;
};
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
class __ll_sub;
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_sub<_Xp, _Yp, 1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_sub<_Xp, _Yp, 1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
- static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
public:
- static const intmax_t value = _Xp - _Yp;
+ static const intmax_t value = _Xp - _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_sub<_Xp, _Yp, 0>
-{
+class __ll_sub<_Xp, _Yp, 0> {
public:
- static const intmax_t value = _Xp;
+ static const intmax_t value = _Xp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_sub<_Xp, _Yp, -1>
-{
- static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
- static const intmax_t max = -min;
+class __ll_sub<_Xp, _Yp, -1> {
+ static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
+ static const intmax_t max = -min;
+
+ static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
- static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
public:
- static const intmax_t value = _Xp - _Yp;
+ static const intmax_t value = _Xp - _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_mul
-{
- static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
- static const intmax_t min = nan + 1;
- static const intmax_t max = -min;
- static const intmax_t __a_x = __static_abs<_Xp>::value;
- static const intmax_t __a_y = __static_abs<_Yp>::value;
+class __ll_mul {
+ static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
+ static const intmax_t min = nan + 1;
+ static const intmax_t max = -min;
+ static const intmax_t __a_x = __static_abs<_Xp>::value;
+ static const intmax_t __a_y = __static_abs<_Yp>::value;
+
+ static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
- static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
public:
- static const intmax_t value = _Xp * _Yp;
+ static const intmax_t value = _Xp * _Yp;
};
template <intmax_t _Yp>
-class __ll_mul<0, _Yp>
-{
+class __ll_mul<0, _Yp> {
public:
- static const intmax_t value = 0;
+ static const intmax_t value = 0;
};
template <intmax_t _Xp>
-class __ll_mul<_Xp, 0>
-{
+class __ll_mul<_Xp, 0> {
public:
- static const intmax_t value = 0;
+ static const intmax_t value = 0;
};
template <>
-class __ll_mul<0, 0>
-{
+class __ll_mul<0, 0> {
public:
- static const intmax_t value = 0;
+ static const intmax_t value = 0;
};
// Not actually used but left here in case needed in future maintenance
template <intmax_t _Xp, intmax_t _Yp>
-class __ll_div
-{
- static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
- static const intmax_t min = nan + 1;
- static const intmax_t max = -min;
+class __ll_div {
+ static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
+ static const intmax_t min = nan + 1;
+ static const intmax_t max = -min;
+
+ static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
- static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
public:
- static const intmax_t value = _Xp / _Yp;
+ static const intmax_t value = _Xp / _Yp;
};
template <intmax_t _Num, intmax_t _Den = 1>
-class _LIBCPP_TEMPLATE_VIS ratio
-{
- static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
- static_assert(_Den != 0, "ratio divide by 0");
- static_assert(__static_abs<_Den>::value > 0, "ratio denominator is out of range");
- static _LIBCPP_CONSTEXPR const intmax_t __na = __static_abs<_Num>::value;
- static _LIBCPP_CONSTEXPR const intmax_t __da = __static_abs<_Den>::value;
- static _LIBCPP_CONSTEXPR const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
- static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>::value;
+class _LIBCPP_TEMPLATE_VIS ratio {
+ static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
+ static_assert(_Den != 0, "ratio divide by 0");
+ static_assert(__static_abs<_Den>::value > 0, "ratio denominator is out of range");
+ static _LIBCPP_CONSTEXPR const intmax_t __na = __static_abs<_Num>::value;
+ static _LIBCPP_CONSTEXPR const intmax_t __da = __static_abs<_Den>::value;
+ static _LIBCPP_CONSTEXPR const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
+ static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>::value;
+
public:
- static _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd;
- static _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd;
+ static _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd;
+ static _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd;
- typedef ratio<num, den> type;
+ typedef ratio<num, den> type;
};
template <intmax_t _Num, intmax_t _Den>
@@ -273,236 +261,200 @@ _LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::num;
template <intmax_t _Num, intmax_t _Den>
_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::den;
-template <class _Tp> struct __is_ratio : false_type {};
-template <intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den> > : true_type {};
+template <class _Tp>
+struct __is_ratio : false_type {};
+template <intmax_t _Num, intmax_t _Den>
+struct __is_ratio<ratio<_Num, _Den> > : true_type {};
typedef ratio<1LL, 1000000000000000000LL> atto;
-typedef ratio<1LL, 1000000000000000LL> femto;
-typedef ratio<1LL, 1000000000000LL> pico;
-typedef ratio<1LL, 1000000000LL> nano;
-typedef ratio<1LL, 1000000LL> micro;
-typedef ratio<1LL, 1000LL> milli;
-typedef ratio<1LL, 100LL> centi;
-typedef ratio<1LL, 10LL> deci;
-typedef ratio< 10LL, 1LL> deca;
-typedef ratio< 100LL, 1LL> hecto;
-typedef ratio< 1000LL, 1LL> kilo;
-typedef ratio< 1000000LL, 1LL> mega;
-typedef ratio< 1000000000LL, 1LL> giga;
-typedef ratio< 1000000000000LL, 1LL> tera;
-typedef ratio< 1000000000000000LL, 1LL> peta;
+typedef ratio<1LL, 1000000000000000LL> femto;
+typedef ratio<1LL, 1000000000000LL> pico;
+typedef ratio<1LL, 1000000000LL> nano;
+typedef ratio<1LL, 1000000LL> micro;
+typedef ratio<1LL, 1000LL> milli;
+typedef ratio<1LL, 100LL> centi;
+typedef ratio<1LL, 10LL> deci;
+typedef ratio< 10LL, 1LL> deca;
+typedef ratio< 100LL, 1LL> hecto;
+typedef ratio< 1000LL, 1LL> kilo;
+typedef ratio< 1000000LL, 1LL> mega;
+typedef ratio< 1000000000LL, 1LL> giga;
+typedef ratio< 1000000000000LL, 1LL> tera;
+typedef ratio< 1000000000000000LL, 1LL> peta;
typedef ratio<1000000000000000000LL, 1LL> exa;
template <class _R1, class _R2>
-struct __ratio_multiply
-{
+struct __ratio_multiply {
private:
- static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
- static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value;
+ static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
+ static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value;
+
public:
- typedef typename ratio
- <
- __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value,
- __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value
- >::type type;
+ typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value,
+ __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_multiply
- = typename __ratio_multiply<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_multiply
- : public __ratio_multiply<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_multiply : public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct __ratio_divide
-{
+struct __ratio_divide {
private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+
public:
- typedef typename ratio
- <
- __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
- __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
- >::type type;
+ typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+ __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_divide
- = typename __ratio_divide<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_divide = typename __ratio_divide<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_divide
- : public __ratio_divide<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_divide : public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct __ratio_add
-{
+struct __ratio_add {
private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+
public:
- typedef typename ratio_multiply
- <
- ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
- ratio
- <
- __ll_add
- <
- __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
- __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
- >::value,
- _R2::den
- >
- >::type type;
+ typedef typename ratio_multiply<
+ ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
+ ratio< __ll_add< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+ __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::value,
+ _R2::den > >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_add
- = typename __ratio_add<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_add = typename __ratio_add<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_add
- : public __ratio_add<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_add : public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct __ratio_subtract
-{
+struct __ratio_subtract {
private:
- static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
- static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
+
public:
- typedef typename ratio_multiply
- <
- ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
- ratio
- <
- __ll_sub
- <
- __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
- __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value
- >::value,
- _R2::den
- >
- >::type type;
+ typedef typename ratio_multiply<
+ ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
+ ratio< __ll_sub< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
+ __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::value,
+ _R2::den > >::type type;
};
#ifndef _LIBCPP_CXX03_LANG
-template <class _R1, class _R2> using ratio_subtract
- = typename __ratio_subtract<_R1, _R2>::type;
+template <class _R1, class _R2>
+using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type;
-#else // _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_subtract
- : public __ratio_subtract<_R1, _R2>::type {};
+struct _LIBCPP_TEMPLATE_VIS ratio_subtract : public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
// ratio_equal
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_equal
- : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_not_equal
- : _BoolConstant<!ratio_equal<_R1, _R2>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant<!ratio_equal<_R1, _R2>::value> {};
// ratio_less
-template <class _R1, class _R2, bool _Odd = false,
- intmax_t _Q1 = _R1::num / _R1::den, intmax_t _M1 = _R1::num % _R1::den,
- intmax_t _Q2 = _R2::num / _R2::den, intmax_t _M2 = _R2::num % _R2::den>
-struct __ratio_less1
-{
- static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
+template <class _R1,
+ class _R2,
+ bool _Odd = false,
+ intmax_t _Q1 = _R1::num / _R1::den,
+ intmax_t _M1 = _R1::num % _R1::den,
+ intmax_t _Q2 = _R2::num / _R2::den,
+ intmax_t _M2 = _R2::num % _R2::den>
+struct __ratio_less1 {
+ static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
-{
- static const bool value = false;
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0> {
+ static const bool value = false;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
-{
- static const bool value = !_Odd;
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2> {
+ static const bool value = !_Odd;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
-{
- static const bool value = _Odd;
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0> {
+ static const bool value = _Odd;
};
-template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
- intmax_t _M2>
-struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
-{
- static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
- ratio<_R2::den, _M2>, !_Odd>::value;
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1, intmax_t _M2>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2> {
+ static const bool value = __ratio_less1<ratio<_R1::den, _M1>, ratio<_R2::den, _M2>, !_Odd>::value;
};
-template <class _R1, class _R2, intmax_t _S1 = __static_sign<_R1::num>::value,
- intmax_t _S2 = __static_sign<_R2::num>::value>
-struct __ratio_less
-{
- static const bool value = _S1 < _S2;
+template <class _R1,
+ class _R2,
+ intmax_t _S1 = __static_sign<_R1::num>::value,
+ intmax_t _S2 = __static_sign<_R2::num>::value>
+struct __ratio_less {
+ static const bool value = _S1 < _S2;
};
template <class _R1, class _R2>
-struct __ratio_less<_R1, _R2, 1LL, 1LL>
-{
- static const bool value = __ratio_less1<_R1, _R2>::value;
+struct __ratio_less<_R1, _R2, 1LL, 1LL> {
+ static const bool value = __ratio_less1<_R1, _R2>::value;
};
template <class _R1, class _R2>
-struct __ratio_less<_R1, _R2, -1LL, -1LL>
-{
- static const bool value = __ratio_less1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::value;
+struct __ratio_less<_R1, _R2, -1LL, -1LL> {
+ static const bool value = __ratio_less1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::value;
};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_less
- : _BoolConstant<__ratio_less<_R1, _R2>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_less_equal
- : _BoolConstant<!ratio_less<_R2, _R1>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant<!ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_greater
- : _BoolConstant<ratio_less<_R2, _R1>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant<ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
-struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal
- : _BoolConstant<!ratio_less<_R1, _R2>::value> {};
+struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant<!ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
-struct __ratio_gcd
-{
- typedef ratio<__static_gcd<_R1::num, _R2::num>::value,
- __static_lcm<_R1::den, _R2::den>::value> type;
+struct __ratio_gcd {
+ typedef ratio<__static_gcd<_R1::num, _R2::num>::value, __static_lcm<_R1::den, _R2::den>::value> type;
};
#if _LIBCPP_STD_VER >= 17
diff --git a/contrib/llvm-project/libcxx/include/regex b/contrib/llvm-project/libcxx/include/regex
index 008fe70a0ca6..061194cb2eba 100644
--- a/contrib/llvm-project/libcxx/include/regex
+++ b/contrib/llvm-project/libcxx/include/regex
@@ -831,375 +831,289 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
#define _LIBCPP_REGEX_COMPLEXITY_FACTOR 4096
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace regex_constants
-{
+namespace regex_constants {
// syntax_option_type
-enum syntax_option_type
-{
- icase = 1 << 0,
- nosubs = 1 << 1,
- optimize = 1 << 2,
- collate = 1 << 3,
+enum syntax_option_type {
+ icase = 1 << 0,
+ nosubs = 1 << 1,
+ optimize = 1 << 2,
+ collate = 1 << 3,
#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
- ECMAScript = 1 << 9,
+ ECMAScript = 1 << 9,
#else
- ECMAScript = 0,
+ ECMAScript = 0,
#endif
- basic = 1 << 4,
- extended = 1 << 5,
- awk = 1 << 6,
- grep = 1 << 7,
- egrep = 1 << 8,
- // 1 << 9 may be used by ECMAScript
- multiline = 1 << 10
+ basic = 1 << 4,
+ extended = 1 << 5,
+ awk = 1 << 6,
+ grep = 1 << 7,
+ egrep = 1 << 8,
+ // 1 << 9 may be used by ECMAScript
+ multiline = 1 << 10
};
-_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR
-syntax_option_type __get_grammar(syntax_option_type __g)
-{
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR syntax_option_type __get_grammar(syntax_option_type __g) {
#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
- return static_cast<syntax_option_type>(__g & 0x3F0);
+ return static_cast<syntax_option_type>(__g & 0x3F0);
#else
- return static_cast<syntax_option_type>(__g & 0x1F0);
+ return static_cast<syntax_option_type>(__g & 0x1F0);
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator~(syntax_option_type __x)
-{
- return syntax_option_type(~int(__x) & 0x1FF);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type operator~(syntax_option_type __x) {
+ return syntax_option_type(~int(__x) & 0x1FF);
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator&(syntax_option_type __x, syntax_option_type __y)
-{
- return syntax_option_type(int(__x) & int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type
+operator&(syntax_option_type __x, syntax_option_type __y) {
+ return syntax_option_type(int(__x) & int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator|(syntax_option_type __x, syntax_option_type __y)
-{
- return syntax_option_type(int(__x) | int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type
+operator|(syntax_option_type __x, syntax_option_type __y) {
+ return syntax_option_type(int(__x) | int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-syntax_option_type
-operator^(syntax_option_type __x, syntax_option_type __y)
-{
- return syntax_option_type(int(__x) ^ int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR syntax_option_type
+operator^(syntax_option_type __x, syntax_option_type __y) {
+ return syntax_option_type(int(__x) ^ int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-syntax_option_type&
-operator&=(syntax_option_type& __x, syntax_option_type __y)
-{
- __x = __x & __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI syntax_option_type& operator&=(syntax_option_type& __x, syntax_option_type __y) {
+ __x = __x & __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-syntax_option_type&
-operator|=(syntax_option_type& __x, syntax_option_type __y)
-{
- __x = __x | __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI syntax_option_type& operator|=(syntax_option_type& __x, syntax_option_type __y) {
+ __x = __x | __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-syntax_option_type&
-operator^=(syntax_option_type& __x, syntax_option_type __y)
-{
- __x = __x ^ __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI syntax_option_type& operator^=(syntax_option_type& __x, syntax_option_type __y) {
+ __x = __x ^ __y;
+ return __x;
}
// match_flag_type
-enum match_flag_type
-{
- match_default = 0,
- match_not_bol = 1 << 0,
- match_not_eol = 1 << 1,
- match_not_bow = 1 << 2,
- match_not_eow = 1 << 3,
- match_any = 1 << 4,
- match_not_null = 1 << 5,
- match_continuous = 1 << 6,
- match_prev_avail = 1 << 7,
- format_default = 0,
- format_sed = 1 << 8,
- format_no_copy = 1 << 9,
- format_first_only = 1 << 10,
- __no_update_pos = 1 << 11,
- __full_match = 1 << 12
+enum match_flag_type {
+ match_default = 0,
+ match_not_bol = 1 << 0,
+ match_not_eol = 1 << 1,
+ match_not_bow = 1 << 2,
+ match_not_eow = 1 << 3,
+ match_any = 1 << 4,
+ match_not_null = 1 << 5,
+ match_continuous = 1 << 6,
+ match_prev_avail = 1 << 7,
+ format_default = 0,
+ format_sed = 1 << 8,
+ format_no_copy = 1 << 9,
+ format_first_only = 1 << 10,
+ __no_update_pos = 1 << 11,
+ __full_match = 1 << 12
};
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator~(match_flag_type __x)
-{
- return match_flag_type(~int(__x) & 0x0FFF);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator~(match_flag_type __x) {
+ return match_flag_type(~int(__x) & 0x0FFF);
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator&(match_flag_type __x, match_flag_type __y)
-{
- return match_flag_type(int(__x) & int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator&(match_flag_type __x, match_flag_type __y) {
+ return match_flag_type(int(__x) & int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator|(match_flag_type __x, match_flag_type __y)
-{
- return match_flag_type(int(__x) | int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator|(match_flag_type __x, match_flag_type __y) {
+ return match_flag_type(int(__x) | int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR
-match_flag_type
-operator^(match_flag_type __x, match_flag_type __y)
-{
- return match_flag_type(int(__x) ^ int(__y));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR match_flag_type operator^(match_flag_type __x, match_flag_type __y) {
+ return match_flag_type(int(__x) ^ int(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI
-match_flag_type&
-operator&=(match_flag_type& __x, match_flag_type __y)
-{
- __x = __x & __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI match_flag_type& operator&=(match_flag_type& __x, match_flag_type __y) {
+ __x = __x & __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-match_flag_type&
-operator|=(match_flag_type& __x, match_flag_type __y)
-{
- __x = __x | __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI match_flag_type& operator|=(match_flag_type& __x, match_flag_type __y) {
+ __x = __x | __y;
+ return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI
-match_flag_type&
-operator^=(match_flag_type& __x, match_flag_type __y)
-{
- __x = __x ^ __y;
- return __x;
+inline _LIBCPP_HIDE_FROM_ABI match_flag_type& operator^=(match_flag_type& __x, match_flag_type __y) {
+ __x = __x ^ __y;
+ return __x;
}
-enum error_type
-{
- error_collate = 1,
- error_ctype,
- error_escape,
- error_backref,
- error_brack,
- error_paren,
- error_brace,
- error_badbrace,
- error_range,
- error_space,
- error_badrepeat,
- error_complexity,
- error_stack,
- __re_err_grammar,
- __re_err_empty,
- __re_err_unknown,
- __re_err_parse
+enum error_type {
+ error_collate = 1,
+ error_ctype,
+ error_escape,
+ error_backref,
+ error_brack,
+ error_paren,
+ error_brace,
+ error_badbrace,
+ error_range,
+ error_space,
+ error_badrepeat,
+ error_complexity,
+ error_stack,
+ __re_err_grammar,
+ __re_err_empty,
+ __re_err_unknown,
+ __re_err_parse
};
} // namespace regex_constants
-class _LIBCPP_EXPORTED_FROM_ABI regex_error
- : public runtime_error
-{
- regex_constants::error_type __code_;
+class _LIBCPP_EXPORTED_FROM_ABI regex_error : public runtime_error {
+ regex_constants::error_type __code_;
+
public:
- explicit regex_error(regex_constants::error_type __ecode);
- _LIBCPP_HIDE_FROM_ABI regex_error(const regex_error&) _NOEXCEPT = default;
- ~regex_error() _NOEXCEPT override;
- _LIBCPP_HIDE_FROM_ABI
- regex_constants::error_type code() const {return __code_;}
+ explicit regex_error(regex_constants::error_type __ecode);
+ _LIBCPP_HIDE_FROM_ABI regex_error(const regex_error&) _NOEXCEPT = default;
+ ~regex_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI regex_constants::error_type code() const { return __code_; }
};
template <regex_constants::error_type _Ev>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_regex_error()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw regex_error(_Ev);
+ throw regex_error(_Ev);
#else
- _LIBCPP_VERBOSE_ABORT("regex_error was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("regex_error was thrown in -fno-exceptions mode");
#endif
}
template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS regex_traits
-{
+struct _LIBCPP_TEMPLATE_VIS regex_traits {
public:
- typedef _CharT char_type;
- typedef basic_string<char_type> string_type;
- typedef locale locale_type;
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+ typedef locale locale_type;
#if defined(__BIONIC__) || defined(_NEWLIB_VERSION)
- // Originally bionic's ctype_base used its own ctype masks because the
- // builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask
- // was only 8 bits wide and already saturated, so it used a wider type here
- // to make room for __regex_word (then a part of this class rather than
- // ctype_base). Bionic has since moved to the builtin ctype_base
- // implementation, but this was not updated to match. Since then Android has
- // needed to maintain a stable libc++ ABI, and this can't be changed without
- // an ABI break.
- // We also need this workaround for newlib since _NEWLIB_VERSION is not
- // defined yet inside __config, so we can't set the
- // _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE macro. Additionally, newlib is
- // often used for space constrained environments, so it makes sense not to
- // duplicate the ctype table.
- typedef uint16_t char_class_type;
+ // Originally bionic's ctype_base used its own ctype masks because the
+ // builtin ctype implementation wasn't in libc++ yet. Bionic's ctype mask
+ // was only 8 bits wide and already saturated, so it used a wider type here
+ // to make room for __regex_word (then a part of this class rather than
+ // ctype_base). Bionic has since moved to the builtin ctype_base
+ // implementation, but this was not updated to match. Since then Android has
+ // needed to maintain a stable libc++ ABI, and this can't be changed without
+ // an ABI break.
+ // We also need this workaround for newlib since _NEWLIB_VERSION is not
+ // defined yet inside __config, so we can't set the
+ // _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE macro. Additionally, newlib is
+ // often used for space constrained environments, so it makes sense not to
+ // duplicate the ctype table.
+ typedef uint16_t char_class_type;
#else
- typedef ctype_base::mask char_class_type;
+ typedef ctype_base::mask char_class_type;
#endif
- static const char_class_type __regex_word = ctype_base::__regex_word;
+ static const char_class_type __regex_word = ctype_base::__regex_word;
+
private:
- locale __loc_;
- const ctype<char_type>* __ct_;
- const collate<char_type>* __col_;
+ locale __loc_;
+ const ctype<char_type>* __ct_;
+ const collate<char_type>* __col_;
public:
- regex_traits();
-
- _LIBCPP_HIDE_FROM_ABI
- static size_t length(const char_type* __p)
- {return char_traits<char_type>::length(__p);}
- _LIBCPP_HIDE_FROM_ABI
- char_type translate(char_type __c) const {return __c;}
- char_type translate_nocase(char_type __c) const;
- template <class _ForwardIterator>
- string_type
- transform(_ForwardIterator __f, _ForwardIterator __l) const;
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- string_type
- transform_primary( _ForwardIterator __f, _ForwardIterator __l) const
- {return __transform_primary(__f, __l, char_type());}
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- string_type
- lookup_collatename(_ForwardIterator __f, _ForwardIterator __l) const
- {return __lookup_collatename(__f, __l, char_type());}
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- char_class_type
- lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
- bool __icase = false) const
- {return __lookup_classname(__f, __l, __icase, char_type());}
- bool isctype(char_type __c, char_class_type __m) const;
- _LIBCPP_HIDE_FROM_ABI
- int value(char_type __ch, int __radix) const
- {return __regex_traits_value(__ch, __radix);}
- locale_type imbue(locale_type __l);
- _LIBCPP_HIDE_FROM_ABI
- locale_type getloc()const {return __loc_;}
+ regex_traits();
+
+ _LIBCPP_HIDE_FROM_ABI static size_t length(const char_type* __p) { return char_traits<char_type>::length(__p); }
+ _LIBCPP_HIDE_FROM_ABI char_type translate(char_type __c) const { return __c; }
+ char_type translate_nocase(char_type __c) const;
+ template <class _ForwardIterator>
+ string_type transform(_ForwardIterator __f, _ForwardIterator __l) const;
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI string_type transform_primary(_ForwardIterator __f, _ForwardIterator __l) const {
+ return __transform_primary(__f, __l, char_type());
+ }
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI string_type lookup_collatename(_ForwardIterator __f, _ForwardIterator __l) const {
+ return __lookup_collatename(__f, __l, char_type());
+ }
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI char_class_type
+ lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase = false) const {
+ return __lookup_classname(__f, __l, __icase, char_type());
+ }
+ bool isctype(char_type __c, char_class_type __m) const;
+ _LIBCPP_HIDE_FROM_ABI int value(char_type __ch, int __radix) const { return __regex_traits_value(__ch, __radix); }
+ locale_type imbue(locale_type __l);
+ _LIBCPP_HIDE_FROM_ABI locale_type getloc() const { return __loc_; }
private:
- void __init();
+ void __init();
- template <class _ForwardIterator>
- string_type
- __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
+ template <class _ForwardIterator>
+ string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _ForwardIterator>
- string_type
- __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+ template <class _ForwardIterator>
+ string_type __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
#endif
- template <class _ForwardIterator>
- string_type
- __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
+ template <class _ForwardIterator>
+ string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _ForwardIterator>
- string_type
- __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+ template <class _ForwardIterator>
+ string_type __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
#endif
- template <class _ForwardIterator>
- char_class_type
- __lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
- bool __icase, char) const;
+ template <class _ForwardIterator>
+ char_class_type __lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _ForwardIterator>
- char_class_type
- __lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
- bool __icase, wchar_t) const;
+ template <class _ForwardIterator>
+ char_class_type __lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, wchar_t) const;
#endif
- static int __regex_traits_value(unsigned char __ch, int __radix);
- _LIBCPP_HIDE_FROM_ABI
- int __regex_traits_value(char __ch, int __radix) const
- {return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
+ static int __regex_traits_value(unsigned char __ch, int __radix);
+ _LIBCPP_HIDE_FROM_ABI int __regex_traits_value(char __ch, int __radix) const {
+ return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);
+ }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_HIDE_FROM_ABI
- int __regex_traits_value(wchar_t __ch, int __radix) const;
+ _LIBCPP_HIDE_FROM_ABI int __regex_traits_value(wchar_t __ch, int __radix) const;
#endif
};
template <class _CharT>
-const typename regex_traits<_CharT>::char_class_type
-regex_traits<_CharT>::__regex_word;
+const typename regex_traits<_CharT>::char_class_type regex_traits<_CharT>::__regex_word;
template <class _CharT>
-regex_traits<_CharT>::regex_traits()
-{
- __init();
+regex_traits<_CharT>::regex_traits() {
+ __init();
}
template <class _CharT>
-typename regex_traits<_CharT>::char_type
-regex_traits<_CharT>::translate_nocase(char_type __c) const
-{
- return __ct_->tolower(__c);
+typename regex_traits<_CharT>::char_type regex_traits<_CharT>::translate_nocase(char_type __c) const {
+ return __ct_->tolower(__c);
}
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::transform(_ForwardIterator __f, _ForwardIterator __l) const
-{
- string_type __s(__f, __l);
- return __col_->transform(__s.data(), __s.data() + __s.size());
+regex_traits<_CharT>::transform(_ForwardIterator __f, _ForwardIterator __l) const {
+ string_type __s(__f, __l);
+ return __col_->transform(__s.data(), __s.data() + __s.size());
}
template <class _CharT>
-void
-regex_traits<_CharT>::__init()
-{
- __ct_ = &std::use_facet<ctype<char_type> >(__loc_);
- __col_ = &std::use_facet<collate<char_type> >(__loc_);
+void regex_traits<_CharT>::__init() {
+ __ct_ = &std::use_facet<ctype<char_type> >(__loc_);
+ __col_ = &std::use_facet<collate<char_type> >(__loc_);
}
template <class _CharT>
-typename regex_traits<_CharT>::locale_type
-regex_traits<_CharT>::imbue(locale_type __l)
-{
- locale __r = __loc_;
- __loc_ = __l;
- __init();
- return __r;
+typename regex_traits<_CharT>::locale_type regex_traits<_CharT>::imbue(locale_type __l) {
+ locale __r = __loc_;
+ __loc_ = __l;
+ __init();
+ return __r;
}
// transform_primary is very FreeBSD-specific
@@ -1207,46 +1121,40 @@ regex_traits<_CharT>::imbue(locale_type __l)
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
- _ForwardIterator __l, char) const
-{
- const string_type __s(__f, __l);
- string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
- switch (__d.size())
- {
- case 1:
- break;
- case 12:
- __d[11] = __d[3];
- break;
- default:
- __d.clear();
- break;
- }
- return __d;
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const {
+ const string_type __s(__f, __l);
+ string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+ switch (__d.size()) {
+ case 1:
+ break;
+ case 12:
+ __d[11] = __d[3];
+ break;
+ default:
+ __d.clear();
+ break;
+ }
+ return __d;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
- _ForwardIterator __l, wchar_t) const
-{
- const string_type __s(__f, __l);
- string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
- switch (__d.size())
- {
- case 1:
- break;
- case 3:
- __d[2] = __d[0];
- break;
- default:
- __d.clear();
- break;
- }
- return __d;
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const {
+ const string_type __s(__f, __l);
+ string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+ switch (__d.size()) {
+ case 1:
+ break;
+ case 3:
+ __d[2] = __d[0];
+ break;
+ default:
+ __d.clear();
+ break;
+ }
+ return __d;
}
#endif
@@ -1257,59 +1165,49 @@ _LIBCPP_EXPORTED_FROM_ABI string __get_collation_name(const char* __s);
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
- _ForwardIterator __l, char) const
-{
- string_type __s(__f, __l);
- string_type __r;
- if (!__s.empty())
- {
- __r = std::__get_collation_name(__s.c_str());
- if (__r.empty() && __s.size() <= 2)
- {
- __r = __col_->transform(__s.data(), __s.data() + __s.size());
- if (__r.size() == 1 || __r.size() == 12)
- __r = __s;
- else
- __r.clear();
- }
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const {
+ string_type __s(__f, __l);
+ string_type __r;
+ if (!__s.empty()) {
+ __r = std::__get_collation_name(__s.c_str());
+ if (__r.empty() && __s.size() <= 2) {
+ __r = __col_->transform(__s.data(), __s.data() + __s.size());
+ if (__r.size() == 1 || __r.size() == 12)
+ __r = __s;
+ else
+ __r.clear();
}
- return __r;
+ }
+ return __r;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
-regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
- _ForwardIterator __l, wchar_t) const
-{
- string_type __s(__f, __l);
- string __n;
- __n.reserve(__s.size());
- for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end();
- __i != __e; ++__i)
- {
- if (static_cast<unsigned>(*__i) >= 127)
- return string_type();
- __n.push_back(char(*__i));
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const {
+ string_type __s(__f, __l);
+ string __n;
+ __n.reserve(__s.size());
+ for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end(); __i != __e; ++__i) {
+ if (static_cast<unsigned>(*__i) >= 127)
+ return string_type();
+ __n.push_back(char(*__i));
+ }
+ string_type __r;
+ if (!__s.empty()) {
+ __n = __get_collation_name(__n.c_str());
+ if (!__n.empty())
+ __r.assign(__n.begin(), __n.end());
+ else if (__s.size() <= 2) {
+ __r = __col_->transform(__s.data(), __s.data() + __s.size());
+ if (__r.size() == 1 || __r.size() == 3)
+ __r = __s;
+ else
+ __r.clear();
}
- string_type __r;
- if (!__s.empty())
- {
- __n = __get_collation_name(__n.c_str());
- if (!__n.empty())
- __r.assign(__n.begin(), __n.end());
- else if (__s.size() <= 2)
- {
- __r = __col_->transform(__s.data(), __s.data() + __s.size());
- if (__r.size() == 1 || __r.size() == 3)
- __r = __s;
- else
- __r.clear();
- }
- }
- return __r;
+ }
+ return __r;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -1320,5040 +1218,4064 @@ regex_traits<char>::char_class_type _LIBCPP_EXPORTED_FROM_ABI __get_classname(co
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::char_class_type
-regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
- _ForwardIterator __l,
- bool __icase, char) const
-{
- string_type __s(__f, __l);
- __ct_->tolower(&__s[0], &__s[0] + __s.size());
- return std::__get_classname(__s.c_str(), __icase);
+regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, char) const {
+ string_type __s(__f, __l);
+ __ct_->tolower(&__s[0], &__s[0] + __s.size());
+ return std::__get_classname(__s.c_str(), __icase);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::char_class_type
-regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
- _ForwardIterator __l,
- bool __icase, wchar_t) const
-{
- string_type __s(__f, __l);
- __ct_->tolower(&__s[0], &__s[0] + __s.size());
- string __n;
- __n.reserve(__s.size());
- for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end();
- __i != __e; ++__i)
- {
- if (static_cast<unsigned>(*__i) >= 127)
- return char_class_type();
- __n.push_back(char(*__i));
- }
- return __get_classname(__n.c_str(), __icase);
+regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f, _ForwardIterator __l, bool __icase, wchar_t) const {
+ string_type __s(__f, __l);
+ __ct_->tolower(&__s[0], &__s[0] + __s.size());
+ string __n;
+ __n.reserve(__s.size());
+ for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end(); __i != __e; ++__i) {
+ if (static_cast<unsigned>(*__i) >= 127)
+ return char_class_type();
+ __n.push_back(char(*__i));
+ }
+ return __get_classname(__n.c_str(), __icase);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
-bool
-regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const
-{
- if (__ct_->is(__m, __c))
- return true;
- return (__c == '_' && (__m & __regex_word));
+bool regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const {
+ if (__ct_->is(__m, __c))
+ return true;
+ return (__c == '_' && (__m & __regex_word));
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool __is_07(unsigned char __c)
-{
- return (__c & 0xF8u) ==
+inline _LIBCPP_HIDE_FROM_ABI bool __is_07(unsigned char __c) {
+ return (__c & 0xF8u) ==
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
- 0xF0;
+ 0xF0;
#else
- 0x30;
+ 0x30;
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-bool __is_89(unsigned char __c)
-{
- return (__c & 0xFEu) ==
+inline _LIBCPP_HIDE_FROM_ABI bool __is_89(unsigned char __c) {
+ return (__c & 0xFEu) ==
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
- 0xF8;
+ 0xF8;
#else
- 0x38;
+ 0x38;
#endif
}
-inline _LIBCPP_HIDE_FROM_ABI
-unsigned char __to_lower(unsigned char __c)
-{
+inline _LIBCPP_HIDE_FROM_ABI unsigned char __to_lower(unsigned char __c) {
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
- return __c & 0xBF;
+ return __c & 0xBF;
#else
- return __c | 0x20;
+ return __c | 0x20;
#endif
}
template <class _CharT>
-int
-regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
-{
- if (__is_07(__ch)) // '0' <= __ch && __ch <= '7'
- return __ch - '0';
- if (__radix != 8)
- {
- if (__is_89(__ch)) // '8' <= __ch && __ch <= '9'
- return __ch - '0';
- if (__radix == 16)
- {
- __ch = __to_lower(__ch); // tolower
- if ('a' <= __ch && __ch <= 'f')
- return __ch - ('a' - 10);
- }
+int regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix) {
+ if (__is_07(__ch)) // '0' <= __ch && __ch <= '7'
+ return __ch - '0';
+ if (__radix != 8) {
+ if (__is_89(__ch)) // '8' <= __ch && __ch <= '9'
+ return __ch - '0';
+ if (__radix == 16) {
+ __ch = __to_lower(__ch); // tolower
+ if ('a' <= __ch && __ch <= 'f')
+ return __ch - ('a' - 10);
}
- return -1;
+ }
+ return -1;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
-inline
-int
-regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
-{
- return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
+inline int regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const {
+ return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
}
#endif
-template <class _CharT> class __node;
+template <class _CharT>
+class __node;
-template <class _BidirectionalIterator> class _LIBCPP_TEMPLATE_VIS sub_match;
+template <class _BidirectionalIterator>
+class _LIBCPP_TEMPLATE_VIS sub_match;
-template <class _BidirectionalIterator,
- class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
+template <class _BidirectionalIterator, class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
class _LIBCPP_TEMPLATE_VIS match_results;
template <class _CharT>
-struct __state
-{
- enum
- {
- __end_state = -1000,
- __consume_input, // -999
- __begin_marked_expr, // -998
- __end_marked_expr, // -997
- __pop_state, // -996
- __accept_and_consume, // -995
- __accept_but_not_consume, // -994
- __reject, // -993
- __split,
- __repeat
- };
-
- int __do_;
- const _CharT* __first_;
- const _CharT* __current_;
- const _CharT* __last_;
- vector<sub_match<const _CharT*> > __sub_matches_;
- vector<pair<size_t, const _CharT*> > __loop_data_;
- const __node<_CharT>* __node_;
- regex_constants::match_flag_type __flags_;
- bool __at_first_;
-
- _LIBCPP_HIDE_FROM_ABI
- __state()
- : __do_(0), __first_(nullptr), __current_(nullptr), __last_(nullptr),
- __node_(nullptr), __flags_(), __at_first_(false) {}
+struct __state {
+ enum {
+ __end_state = -1000,
+ __consume_input, // -999
+ __begin_marked_expr, // -998
+ __end_marked_expr, // -997
+ __pop_state, // -996
+ __accept_and_consume, // -995
+ __accept_but_not_consume, // -994
+ __reject, // -993
+ __split,
+ __repeat
+ };
+
+ int __do_;
+ const _CharT* __first_;
+ const _CharT* __current_;
+ const _CharT* __last_;
+ vector<sub_match<const _CharT*> > __sub_matches_;
+ vector<pair<size_t, const _CharT*> > __loop_data_;
+ const __node<_CharT>* __node_;
+ regex_constants::match_flag_type __flags_;
+ bool __at_first_;
+
+ _LIBCPP_HIDE_FROM_ABI __state()
+ : __do_(0),
+ __first_(nullptr),
+ __current_(nullptr),
+ __last_(nullptr),
+ __node_(nullptr),
+ __flags_(),
+ __at_first_(false) {}
};
// __node
template <class _CharT>
-class __node
-{
- __node(const __node&);
- __node& operator=(const __node&);
+class __node {
+ __node(const __node&);
+ __node& operator=(const __node&);
+
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __node() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual ~__node() {}
+ _LIBCPP_HIDE_FROM_ABI __node() {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual ~__node() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual void __exec(__state&) const {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- virtual void __exec_split(bool, __state&) const {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual void __exec(__state&) const {}
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ virtual void __exec_split(bool, __state&) const {}
};
// __end_state
template <class _CharT>
-class __end_state
- : public __node<_CharT>
-{
+class __end_state : public __node<_CharT> {
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __end_state() {}
+ _LIBCPP_HIDE_FROM_ABI __end_state() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__end_state<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__end_state;
+void __end_state<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__end_state;
}
// __has_one_state
template <class _CharT>
-class __has_one_state
- : public __node<_CharT>
-{
- __node<_CharT>* __first_;
+class __has_one_state : public __node<_CharT> {
+ __node<_CharT>* __first_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __has_one_state(__node<_CharT>* __s)
- : __first_(__s) {}
-
- _LIBCPP_HIDE_FROM_ABI
- __node<_CharT>* first() const {return __first_;}
- _LIBCPP_HIDE_FROM_ABI
- __node<_CharT>*& first() {return __first_;}
+ _LIBCPP_HIDE_FROM_ABI explicit __has_one_state(__node<_CharT>* __s) : __first_(__s) {}
+
+ _LIBCPP_HIDE_FROM_ABI __node<_CharT>* first() const { return __first_; }
+ _LIBCPP_HIDE_FROM_ABI __node<_CharT>*& first() { return __first_; }
};
// __owns_one_state
template <class _CharT>
-class __owns_one_state
- : public __has_one_state<_CharT>
-{
- typedef __has_one_state<_CharT> base;
+class __owns_one_state : public __has_one_state<_CharT> {
+ typedef __has_one_state<_CharT> base;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __owns_one_state(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __owns_one_state(__node<_CharT>* __s) : base(__s) {}
- ~__owns_one_state() override;
+ ~__owns_one_state() override;
};
template <class _CharT>
-__owns_one_state<_CharT>::~__owns_one_state()
-{
- delete this->first();
+__owns_one_state<_CharT>::~__owns_one_state() {
+ delete this->first();
}
// __empty_state
template <class _CharT>
-class __empty_state
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __empty_state : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __empty_state(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __empty_state(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__empty_state<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
+void __empty_state<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
}
// __empty_non_own_state
template <class _CharT>
-class __empty_non_own_state
- : public __has_one_state<_CharT>
-{
- typedef __has_one_state<_CharT> base;
+class __empty_non_own_state : public __has_one_state<_CharT> {
+ typedef __has_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __empty_non_own_state(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __empty_non_own_state(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__empty_non_own_state<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
+void __empty_non_own_state<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
}
// __repeat_one_loop
template <class _CharT>
-class __repeat_one_loop
- : public __has_one_state<_CharT>
-{
- typedef __has_one_state<_CharT> base;
+class __repeat_one_loop : public __has_one_state<_CharT> {
+ typedef __has_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __repeat_one_loop(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __repeat_one_loop(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__repeat_one_loop<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__repeat;
- __s.__node_ = this->first();
+void __repeat_one_loop<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__repeat;
+ __s.__node_ = this->first();
}
// __owns_two_states
template <class _CharT>
-class __owns_two_states
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __owns_two_states : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- base* __second_;
+ base* __second_;
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __owns_two_states(__node<_CharT>* __s1, base* __s2)
- : base(__s1), __second_(__s2) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __owns_two_states(__node<_CharT>* __s1, base* __s2) : base(__s1), __second_(__s2) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__owns_two_states();
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__owns_two_states();
- _LIBCPP_HIDE_FROM_ABI
- base* second() const {return __second_;}
- _LIBCPP_HIDE_FROM_ABI
- base*& second() {return __second_;}
+ _LIBCPP_HIDE_FROM_ABI base* second() const { return __second_; }
+ _LIBCPP_HIDE_FROM_ABI base*& second() { return __second_; }
};
template <class _CharT>
-__owns_two_states<_CharT>::~__owns_two_states()
-{
- delete __second_;
+__owns_two_states<_CharT>::~__owns_two_states() {
+ delete __second_;
}
// __loop
template <class _CharT>
-class __loop
- : public __owns_two_states<_CharT>
-{
- typedef __owns_two_states<_CharT> base;
+class __loop : public __owns_two_states<_CharT> {
+ typedef __owns_two_states<_CharT> base;
- size_t __min_;
- size_t __max_;
- unsigned __loop_id_;
- unsigned __mexp_begin_;
- unsigned __mexp_end_;
- bool __greedy_;
+ size_t __min_;
+ size_t __max_;
+ unsigned __loop_id_;
+ unsigned __mexp_begin_;
+ unsigned __mexp_end_;
+ bool __greedy_;
public:
- typedef std::__state<_CharT> __state;
-
- _LIBCPP_HIDE_FROM_ABI
- explicit __loop(unsigned __loop_id,
- __node<_CharT>* __s1, __owns_one_state<_CharT>* __s2,
- unsigned __mexp_begin, unsigned __mexp_end,
- bool __greedy = true,
- size_t __min = 0,
- size_t __max = numeric_limits<size_t>::max())
- : base(__s1, __s2), __min_(__min), __max_(__max), __loop_id_(__loop_id),
- __mexp_begin_(__mexp_begin), __mexp_end_(__mexp_end),
- __greedy_(__greedy) {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
+ typedef std::__state<_CharT> __state;
+
+ _LIBCPP_HIDE_FROM_ABI explicit __loop(
+ unsigned __loop_id,
+ __node<_CharT>* __s1,
+ __owns_one_state<_CharT>* __s2,
+ unsigned __mexp_begin,
+ unsigned __mexp_end,
+ bool __greedy = true,
+ size_t __min = 0,
+ size_t __max = numeric_limits<size_t>::max())
+ : base(__s1, __s2),
+ __min_(__min),
+ __max_(__max),
+ __loop_id_(__loop_id),
+ __mexp_begin_(__mexp_begin),
+ __mexp_end_(__mexp_end),
+ __greedy_(__greedy) {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- void __init_repeat(__state& __s) const
- {
- __s.__loop_data_[__loop_id_].second = __s.__current_;
- for (size_t __i = __mexp_begin_-1; __i != __mexp_end_-1; ++__i)
- {
- __s.__sub_matches_[__i].first = __s.__last_;
- __s.__sub_matches_[__i].second = __s.__last_;
- __s.__sub_matches_[__i].matched = false;
- }
+ _LIBCPP_HIDE_FROM_ABI void __init_repeat(__state& __s) const {
+ __s.__loop_data_[__loop_id_].second = __s.__current_;
+ for (size_t __i = __mexp_begin_ - 1; __i != __mexp_end_ - 1; ++__i) {
+ __s.__sub_matches_[__i].first = __s.__last_;
+ __s.__sub_matches_[__i].second = __s.__last_;
+ __s.__sub_matches_[__i].matched = false;
}
+ }
};
template <class _CharT>
-void
-__loop<_CharT>::__exec(__state& __s) const
-{
- if (__s.__do_ == __state::__repeat)
- {
- bool __do_repeat = ++__s.__loop_data_[__loop_id_].first < __max_;
- bool __do_alt = __s.__loop_data_[__loop_id_].first >= __min_;
- if (__do_repeat && __do_alt &&
- __s.__loop_data_[__loop_id_].second == __s.__current_)
- __do_repeat = false;
- if (__do_repeat && __do_alt)
- __s.__do_ = __state::__split;
- else if (__do_repeat)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- __init_repeat(__s);
- }
- else
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->second();
- }
+void __loop<_CharT>::__exec(__state& __s) const {
+ if (__s.__do_ == __state::__repeat) {
+ bool __do_repeat = ++__s.__loop_data_[__loop_id_].first < __max_;
+ bool __do_alt = __s.__loop_data_[__loop_id_].first >= __min_;
+ if (__do_repeat && __do_alt && __s.__loop_data_[__loop_id_].second == __s.__current_)
+ __do_repeat = false;
+ if (__do_repeat && __do_alt)
+ __s.__do_ = __state::__split;
+ else if (__do_repeat) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ __init_repeat(__s);
+ } else {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->second();
}
- else
- {
- __s.__loop_data_[__loop_id_].first = 0;
- bool __do_repeat = 0 < __max_;
- bool __do_alt = 0 >= __min_;
- if (__do_repeat && __do_alt)
- __s.__do_ = __state::__split;
- else if (__do_repeat)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- __init_repeat(__s);
- }
- else
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->second();
- }
+ } else {
+ __s.__loop_data_[__loop_id_].first = 0;
+ bool __do_repeat = 0 < __max_;
+ bool __do_alt = 0 >= __min_;
+ if (__do_repeat && __do_alt)
+ __s.__do_ = __state::__split;
+ else if (__do_repeat) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ __init_repeat(__s);
+ } else {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->second();
}
+ }
}
template <class _CharT>
-void
-__loop<_CharT>::__exec_split(bool __second, __state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- if (__greedy_ != __second)
- {
- __s.__node_ = this->first();
- __init_repeat(__s);
- }
- else
- __s.__node_ = this->second();
+void __loop<_CharT>::__exec_split(bool __second, __state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ if (__greedy_ != __second) {
+ __s.__node_ = this->first();
+ __init_repeat(__s);
+ } else
+ __s.__node_ = this->second();
}
// __alternate
template <class _CharT>
-class __alternate
- : public __owns_two_states<_CharT>
-{
- typedef __owns_two_states<_CharT> base;
+class __alternate : public __owns_two_states<_CharT> {
+ typedef __owns_two_states<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __alternate(__owns_one_state<_CharT>* __s1,
- __owns_one_state<_CharT>* __s2)
- : base(__s1, __s2) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __alternate(__owns_one_state<_CharT>* __s1, __owns_one_state<_CharT>* __s2)
+ : base(__s1, __s2) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state& __s) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec_split(bool __second, __state& __s) const;
};
template <class _CharT>
-void
-__alternate<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__split;
+void __alternate<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__split;
}
template <class _CharT>
-void
-__alternate<_CharT>::__exec_split(bool __second, __state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- if (__second)
- __s.__node_ = this->second();
- else
- __s.__node_ = this->first();
+void __alternate<_CharT>::__exec_split(bool __second, __state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ if (__second)
+ __s.__node_ = this->second();
+ else
+ __s.__node_ = this->first();
}
// __begin_marked_subexpression
template <class _CharT>
-class __begin_marked_subexpression
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __begin_marked_subexpression : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ unsigned __mexp_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __begin_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
- : base(__s), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __begin_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__begin_marked_subexpression<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__sub_matches_[__mexp_-1].first = __s.__current_;
- __s.__node_ = this->first();
+void __begin_marked_subexpression<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__sub_matches_[__mexp_ - 1].first = __s.__current_;
+ __s.__node_ = this->first();
}
// __end_marked_subexpression
template <class _CharT>
-class __end_marked_subexpression
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __end_marked_subexpression : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ unsigned __mexp_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __end_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
- : base(__s), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __end_marked_subexpression(unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__end_marked_subexpression<_CharT>::__exec(__state& __s) const
-{
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__sub_matches_[__mexp_-1].second = __s.__current_;
- __s.__sub_matches_[__mexp_-1].matched = true;
- __s.__node_ = this->first();
+void __end_marked_subexpression<_CharT>::__exec(__state& __s) const {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__sub_matches_[__mexp_ - 1].second = __s.__current_;
+ __s.__sub_matches_[__mexp_ - 1].matched = true;
+ __s.__node_ = this->first();
}
// __back_ref
template <class _CharT>
-class __back_ref
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __back_ref : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ unsigned __mexp_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __back_ref(unsigned __mexp, __node<_CharT>* __s)
- : base(__s), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __back_ref(unsigned __mexp, __node<_CharT>* __s) : base(__s), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__back_ref<_CharT>::__exec(__state& __s) const
-{
- if (__mexp_ > __s.__sub_matches_.size())
- __throw_regex_error<regex_constants::error_backref>();
- sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
- if (__sm.matched)
- {
- ptrdiff_t __len = __sm.second - __sm.first;
- if (__s.__last_ - __s.__current_ >= __len &&
- std::equal(__sm.first, __sm.second, __s.__current_))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__current_ += __len;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __back_ref<_CharT>::__exec(__state& __s) const {
+ if (__mexp_ > __s.__sub_matches_.size())
+ __throw_regex_error<regex_constants::error_backref>();
+ sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_ - 1];
+ if (__sm.matched) {
+ ptrdiff_t __len = __sm.second - __sm.first;
+ if (__s.__last_ - __s.__current_ >= __len && std::equal(__sm.first, __sm.second, __s.__current_)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__current_ += __len;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
}
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __back_ref_icase
template <class _CharT, class _Traits>
-class __back_ref_icase
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __back_ref_icase : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ unsigned __mexp_;
- _Traits __traits_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __back_ref_icase(const _Traits& __traits, unsigned __mexp,
- __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __back_ref_icase(const _Traits& __traits, unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__back_ref_icase<_CharT, _Traits>::__exec(__state& __s) const
-{
- sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
- if (__sm.matched)
- {
- ptrdiff_t __len = __sm.second - __sm.first;
- if (__s.__last_ - __s.__current_ >= __len)
- {
- for (ptrdiff_t __i = 0; __i < __len; ++__i)
- {
- if (__traits_.translate_nocase(__sm.first[__i]) !=
- __traits_.translate_nocase(__s.__current_[__i]))
- goto __not_equal;
- }
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__current_ += __len;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
- }
- else
- {
-__not_equal:
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __back_ref_icase<_CharT, _Traits>::__exec(__state& __s) const {
+ sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_ - 1];
+ if (__sm.matched) {
+ ptrdiff_t __len = __sm.second - __sm.first;
+ if (__s.__last_ - __s.__current_ >= __len) {
+ for (ptrdiff_t __i = 0; __i < __len; ++__i) {
+ if (__traits_.translate_nocase(__sm.first[__i]) != __traits_.translate_nocase(__s.__current_[__i]))
+ goto __not_equal;
+ }
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__current_ += __len;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
}
+ } else {
+ __not_equal:
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __back_ref_collate
template <class _CharT, class _Traits>
-class __back_ref_collate
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __back_ref_collate : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ unsigned __mexp_;
- _Traits __traits_;
- unsigned __mexp_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __back_ref_collate(const _Traits& __traits, unsigned __mexp,
- __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __mexp_(__mexp) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __back_ref_collate(const _Traits& __traits, unsigned __mexp, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __mexp_(__mexp) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__back_ref_collate<_CharT, _Traits>::__exec(__state& __s) const
-{
- sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
- if (__sm.matched)
- {
- ptrdiff_t __len = __sm.second - __sm.first;
- if (__s.__last_ - __s.__current_ >= __len)
- {
- for (ptrdiff_t __i = 0; __i < __len; ++__i)
- {
- if (__traits_.translate(__sm.first[__i]) !=
- __traits_.translate(__s.__current_[__i]))
- goto __not_equal;
- }
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__current_ += __len;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
- }
- else
- {
-__not_equal:
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __back_ref_collate<_CharT, _Traits>::__exec(__state& __s) const {
+ sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_ - 1];
+ if (__sm.matched) {
+ ptrdiff_t __len = __sm.second - __sm.first;
+ if (__s.__last_ - __s.__current_ >= __len) {
+ for (ptrdiff_t __i = 0; __i < __len; ++__i) {
+ if (__traits_.translate(__sm.first[__i]) != __traits_.translate(__s.__current_[__i]))
+ goto __not_equal;
+ }
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__current_ += __len;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
}
+ } else {
+ __not_equal:
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __word_boundary
template <class _CharT, class _Traits>
-class __word_boundary
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __word_boundary : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ bool __invert_;
- _Traits __traits_;
- bool __invert_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- explicit __word_boundary(const _Traits& __traits, bool __invert,
- __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __invert_(__invert) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __word_boundary(const _Traits& __traits, bool __invert, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __invert_(__invert) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__word_boundary<_CharT, _Traits>::__exec(__state& __s) const
-{
- bool __is_word_b = false;
- if (__s.__first_ != __s.__last_)
- {
- if (__s.__current_ == __s.__last_)
- {
- if (!(__s.__flags_ & regex_constants::match_not_eow))
- {
- _CharT __c = __s.__current_[-1];
- __is_word_b = __c == '_' ||
- __traits_.isctype(__c, ctype_base::alnum);
- }
- }
- else if (__s.__current_ == __s.__first_ &&
- !(__s.__flags_ & regex_constants::match_prev_avail))
- {
- if (!(__s.__flags_ & regex_constants::match_not_bow))
- {
- _CharT __c = *__s.__current_;
- __is_word_b = __c == '_' ||
- __traits_.isctype(__c, ctype_base::alnum);
- }
- }
- else
- {
- _CharT __c1 = __s.__current_[-1];
- _CharT __c2 = *__s.__current_;
- bool __is_c1_b = __c1 == '_' ||
- __traits_.isctype(__c1, ctype_base::alnum);
- bool __is_c2_b = __c2 == '_' ||
- __traits_.isctype(__c2, ctype_base::alnum);
- __is_word_b = __is_c1_b != __is_c2_b;
- }
- }
- if (__is_word_b != __invert_)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __word_boundary<_CharT, _Traits>::__exec(__state& __s) const {
+ bool __is_word_b = false;
+ if (__s.__first_ != __s.__last_) {
+ if (__s.__current_ == __s.__last_) {
+ if (!(__s.__flags_ & regex_constants::match_not_eow)) {
+ _CharT __c = __s.__current_[-1];
+ __is_word_b = __c == '_' || __traits_.isctype(__c, ctype_base::alnum);
+ }
+ } else if (__s.__current_ == __s.__first_ && !(__s.__flags_ & regex_constants::match_prev_avail)) {
+ if (!(__s.__flags_ & regex_constants::match_not_bow)) {
+ _CharT __c = *__s.__current_;
+ __is_word_b = __c == '_' || __traits_.isctype(__c, ctype_base::alnum);
+ }
+ } else {
+ _CharT __c1 = __s.__current_[-1];
+ _CharT __c2 = *__s.__current_;
+ bool __is_c1_b = __c1 == '_' || __traits_.isctype(__c1, ctype_base::alnum);
+ bool __is_c2_b = __c2 == '_' || __traits_.isctype(__c2, ctype_base::alnum);
+ __is_word_b = __is_c1_b != __is_c2_b;
}
+ }
+ if (__is_word_b != __invert_) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __l_anchor
template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-bool __is_eol(_CharT __c)
-{
- return __c == '\r' || __c == '\n';
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __is_eol(_CharT __c) {
+ return __c == '\r' || __c == '\n';
}
template <class _CharT>
-class __l_anchor_multiline
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __l_anchor_multiline : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- bool __multiline_;
+ bool __multiline_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __l_anchor_multiline(bool __multiline, __node<_CharT>* __s)
- : base(__s), __multiline_(__multiline) {}
+ _LIBCPP_HIDE_FROM_ABI __l_anchor_multiline(bool __multiline, __node<_CharT>* __s)
+ : base(__s), __multiline_(__multiline) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__l_anchor_multiline<_CharT>::__exec(__state& __s) const
-{
- if (__s.__at_first_ && __s.__current_ == __s.__first_ &&
- !(__s.__flags_ & regex_constants::match_not_bol))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else if (__multiline_ &&
- !__s.__at_first_ &&
- std::__is_eol(*std::prev(__s.__current_)))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __l_anchor_multiline<_CharT>::__exec(__state& __s) const {
+ if (__s.__at_first_ && __s.__current_ == __s.__first_ && !(__s.__flags_ & regex_constants::match_not_bol)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else if (__multiline_ && !__s.__at_first_ && std::__is_eol(*std::prev(__s.__current_))) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __r_anchor
template <class _CharT>
-class __r_anchor_multiline
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __r_anchor_multiline : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- bool __multiline_;
+ bool __multiline_;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __r_anchor_multiline(bool __multiline, __node<_CharT>* __s)
- : base(__s), __multiline_(__multiline) {}
+ _LIBCPP_HIDE_FROM_ABI __r_anchor_multiline(bool __multiline, __node<_CharT>* __s)
+ : base(__s), __multiline_(__multiline) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__r_anchor_multiline<_CharT>::__exec(__state& __s) const
-{
- if (__s.__current_ == __s.__last_ &&
- !(__s.__flags_ & regex_constants::match_not_eol))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else if (__multiline_ && std::__is_eol(*__s.__current_))
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __r_anchor_multiline<_CharT>::__exec(__state& __s) const {
+ if (__s.__current_ == __s.__last_ && !(__s.__flags_ & regex_constants::match_not_eol)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else if (__multiline_ && std::__is_eol(*__s.__current_)) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_any
template <class _CharT>
-class __match_any
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_any : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_any(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI __match_any(__node<_CharT>* __s) : base(__s) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__match_any<_CharT>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ && *__s.__current_ != 0)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_any<_CharT>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && *__s.__current_ != 0) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_any_but_newline
template <class _CharT>
-class __match_any_but_newline
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_any_but_newline : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_any_but_newline(__node<_CharT>* __s)
- : base(__s) {}
+ _LIBCPP_HIDE_FROM_ABI __match_any_but_newline(__node<_CharT>* __s) : base(__s) {}
- void __exec(__state&) const override;
+ void __exec(__state&) const override;
};
-template <> _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<char>::__exec(__state&) const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<char>::__exec(__state&) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <> _LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<wchar_t>::__exec(__state&) const;
+template <>
+_LIBCPP_EXPORTED_FROM_ABI void __match_any_but_newline<wchar_t>::__exec(__state&) const;
#endif
// __match_char
template <class _CharT>
-class __match_char
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_char : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- _CharT __c_;
+ _CharT __c_;
+
+ __match_char(const __match_char&);
+ __match_char& operator=(const __match_char&);
- __match_char(const __match_char&);
- __match_char& operator=(const __match_char&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_char(_CharT __c, __node<_CharT>* __s)
- : base(__s), __c_(__c) {}
+ _LIBCPP_HIDE_FROM_ABI __match_char(_CharT __c, __node<_CharT>* __s) : base(__s), __c_(__c) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT>
-void
-__match_char<_CharT>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ && *__s.__current_ == __c_)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_char<_CharT>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && *__s.__current_ == __c_) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_char_icase
template <class _CharT, class _Traits>
-class __match_char_icase
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_char_icase : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
- _Traits __traits_;
- _CharT __c_;
+ _Traits __traits_;
+ _CharT __c_;
+
+ __match_char_icase(const __match_char_icase&);
+ __match_char_icase& operator=(const __match_char_icase&);
- __match_char_icase(const __match_char_icase&);
- __match_char_icase& operator=(const __match_char_icase&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__match_char_icase<_CharT, _Traits>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ &&
- __traits_.translate_nocase(*__s.__current_) == __c_)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_char_icase<_CharT, _Traits>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && __traits_.translate_nocase(*__s.__current_) == __c_) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __match_char_collate
template <class _CharT, class _Traits>
-class __match_char_collate
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __match_char_collate : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ _Traits __traits_;
+ _CharT __c_;
- _Traits __traits_;
- _CharT __c_;
+ __match_char_collate(const __match_char_collate&);
+ __match_char_collate& operator=(const __match_char_collate&);
- __match_char_collate(const __match_char_collate&);
- __match_char_collate& operator=(const __match_char_collate&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
- : base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
+ : base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__match_char_collate<_CharT, _Traits>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_ &&
- __traits_.translate(*__s.__current_) == __c_)
- {
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- }
+void __match_char_collate<_CharT, _Traits>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_ && __traits_.translate(*__s.__current_) == __c_) {
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
// __bracket_expression
template <class _CharT, class _Traits>
-class __bracket_expression
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
- typedef typename _Traits::string_type string_type;
-
- _Traits __traits_;
- vector<_CharT> __chars_;
- vector<_CharT> __neg_chars_;
- vector<pair<string_type, string_type> > __ranges_;
- vector<pair<_CharT, _CharT> > __digraphs_;
- vector<string_type> __equivalences_;
- typename regex_traits<_CharT>::char_class_type __mask_;
- typename regex_traits<_CharT>::char_class_type __neg_mask_;
- bool __negate_;
- bool __icase_;
- bool __collate_;
- bool __might_have_digraph_;
-
- __bracket_expression(const __bracket_expression&);
- __bracket_expression& operator=(const __bracket_expression&);
+class __bracket_expression : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+ typedef typename _Traits::string_type string_type;
+
+ _Traits __traits_;
+ vector<_CharT> __chars_;
+ vector<_CharT> __neg_chars_;
+ vector<pair<string_type, string_type> > __ranges_;
+ vector<pair<_CharT, _CharT> > __digraphs_;
+ vector<string_type> __equivalences_;
+ typename regex_traits<_CharT>::char_class_type __mask_;
+ typename regex_traits<_CharT>::char_class_type __neg_mask_;
+ bool __negate_;
+ bool __icase_;
+ bool __collate_;
+ bool __might_have_digraph_;
+
+ __bracket_expression(const __bracket_expression&);
+ __bracket_expression& operator=(const __bracket_expression&);
+
public:
- typedef std::__state<_CharT> __state;
-
- _LIBCPP_HIDE_FROM_ABI
- __bracket_expression(const _Traits& __traits, __node<_CharT>* __s,
- bool __negate, bool __icase, bool __collate)
- : base(__s), __traits_(__traits), __mask_(), __neg_mask_(),
- __negate_(__negate), __icase_(__icase), __collate_(__collate),
- __might_have_digraph_(__traits_.getloc().name() != "C") {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
-
- _LIBCPP_HIDE_FROM_ABI
- bool __negated() const {return __negate_;}
-
- _LIBCPP_HIDE_FROM_ABI
- void __add_char(_CharT __c)
- {
- if (__icase_)
- __chars_.push_back(__traits_.translate_nocase(__c));
- else if (__collate_)
- __chars_.push_back(__traits_.translate(__c));
- else
- __chars_.push_back(__c);
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_neg_char(_CharT __c)
- {
- if (__icase_)
- __neg_chars_.push_back(__traits_.translate_nocase(__c));
- else if (__collate_)
- __neg_chars_.push_back(__traits_.translate(__c));
- else
- __neg_chars_.push_back(__c);
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_range(string_type __b, string_type __e)
- {
- if (__collate_)
- {
- if (__icase_)
- {
- for (size_t __i = 0; __i < __b.size(); ++__i)
- __b[__i] = __traits_.translate_nocase(__b[__i]);
- for (size_t __i = 0; __i < __e.size(); ++__i)
- __e[__i] = __traits_.translate_nocase(__e[__i]);
- }
- else
- {
- for (size_t __i = 0; __i < __b.size(); ++__i)
- __b[__i] = __traits_.translate(__b[__i]);
- for (size_t __i = 0; __i < __e.size(); ++__i)
- __e[__i] = __traits_.translate(__e[__i]);
- }
- __ranges_.push_back(std::make_pair(
- __traits_.transform(__b.begin(), __b.end()),
- __traits_.transform(__e.begin(), __e.end())));
- }
- else
- {
- if (__b.size() != 1 || __e.size() != 1)
- __throw_regex_error<regex_constants::error_range>();
- if (__icase_)
- {
- __b[0] = __traits_.translate_nocase(__b[0]);
- __e[0] = __traits_.translate_nocase(__e[0]);
- }
- __ranges_.push_back(std::make_pair(std::move(__b), std::move(__e)));
- }
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_digraph(_CharT __c1, _CharT __c2)
- {
- if (__icase_)
- __digraphs_.push_back(std::make_pair(__traits_.translate_nocase(__c1),
- __traits_.translate_nocase(__c2)));
- else if (__collate_)
- __digraphs_.push_back(std::make_pair(__traits_.translate(__c1),
- __traits_.translate(__c2)));
- else
- __digraphs_.push_back(std::make_pair(__c1, __c2));
- }
- _LIBCPP_HIDE_FROM_ABI
- void __add_equivalence(const string_type& __s)
- {__equivalences_.push_back(__s);}
- _LIBCPP_HIDE_FROM_ABI
- void __add_class(typename regex_traits<_CharT>::char_class_type __mask)
- {__mask_ |= __mask;}
- _LIBCPP_HIDE_FROM_ABI
- void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask)
- {__neg_mask_ |= __mask;}
+ typedef std::__state<_CharT> __state;
+
+ _LIBCPP_HIDE_FROM_ABI
+ __bracket_expression(const _Traits& __traits, __node<_CharT>* __s, bool __negate, bool __icase, bool __collate)
+ : base(__s),
+ __traits_(__traits),
+ __mask_(),
+ __neg_mask_(),
+ __negate_(__negate),
+ __icase_(__icase),
+ __collate_(__collate),
+ __might_have_digraph_(__traits_.getloc().name() != "C") {}
+
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+
+ _LIBCPP_HIDE_FROM_ABI bool __negated() const { return __negate_; }
+
+ _LIBCPP_HIDE_FROM_ABI void __add_char(_CharT __c) {
+ if (__icase_)
+ __chars_.push_back(__traits_.translate_nocase(__c));
+ else if (__collate_)
+ __chars_.push_back(__traits_.translate(__c));
+ else
+ __chars_.push_back(__c);
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_neg_char(_CharT __c) {
+ if (__icase_)
+ __neg_chars_.push_back(__traits_.translate_nocase(__c));
+ else if (__collate_)
+ __neg_chars_.push_back(__traits_.translate(__c));
+ else
+ __neg_chars_.push_back(__c);
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_range(string_type __b, string_type __e) {
+ if (__collate_) {
+ if (__icase_) {
+ for (size_t __i = 0; __i < __b.size(); ++__i)
+ __b[__i] = __traits_.translate_nocase(__b[__i]);
+ for (size_t __i = 0; __i < __e.size(); ++__i)
+ __e[__i] = __traits_.translate_nocase(__e[__i]);
+ } else {
+ for (size_t __i = 0; __i < __b.size(); ++__i)
+ __b[__i] = __traits_.translate(__b[__i]);
+ for (size_t __i = 0; __i < __e.size(); ++__i)
+ __e[__i] = __traits_.translate(__e[__i]);
+ }
+ __ranges_.push_back(
+ std::make_pair(__traits_.transform(__b.begin(), __b.end()), __traits_.transform(__e.begin(), __e.end())));
+ } else {
+ if (__b.size() != 1 || __e.size() != 1)
+ __throw_regex_error<regex_constants::error_range>();
+ if (__icase_) {
+ __b[0] = __traits_.translate_nocase(__b[0]);
+ __e[0] = __traits_.translate_nocase(__e[0]);
+ }
+ __ranges_.push_back(std::make_pair(std::move(__b), std::move(__e)));
+ }
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_digraph(_CharT __c1, _CharT __c2) {
+ if (__icase_)
+ __digraphs_.push_back(std::make_pair(__traits_.translate_nocase(__c1), __traits_.translate_nocase(__c2)));
+ else if (__collate_)
+ __digraphs_.push_back(std::make_pair(__traits_.translate(__c1), __traits_.translate(__c2)));
+ else
+ __digraphs_.push_back(std::make_pair(__c1, __c2));
+ }
+ _LIBCPP_HIDE_FROM_ABI void __add_equivalence(const string_type& __s) { __equivalences_.push_back(__s); }
+ _LIBCPP_HIDE_FROM_ABI void __add_class(typename regex_traits<_CharT>::char_class_type __mask) { __mask_ |= __mask; }
+ _LIBCPP_HIDE_FROM_ABI void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask) {
+ __neg_mask_ |= __mask;
+ }
};
template <class _CharT, class _Traits>
-void
-__bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
-{
- bool __found = false;
- unsigned __consumed = 0;
- if (__s.__current_ != __s.__last_)
- {
- ++__consumed;
- if (__might_have_digraph_)
- {
- const _CharT* __next = std::next(__s.__current_);
- if (__next != __s.__last_)
- {
- pair<_CharT, _CharT> __ch2(*__s.__current_, *__next);
- if (__icase_)
- {
- __ch2.first = __traits_.translate_nocase(__ch2.first);
- __ch2.second = __traits_.translate_nocase(__ch2.second);
- }
- else if (__collate_)
- {
- __ch2.first = __traits_.translate(__ch2.first);
- __ch2.second = __traits_.translate(__ch2.second);
- }
- if (!__traits_.lookup_collatename(&__ch2.first, &__ch2.first+2).empty())
- {
- // __ch2 is a digraph in this locale
- ++__consumed;
- for (size_t __i = 0; __i < __digraphs_.size(); ++__i)
- {
- if (__ch2 == __digraphs_[__i])
- {
- __found = true;
- goto __exit;
- }
- }
- if (__collate_ && !__ranges_.empty())
- {
- string_type __s2 = __traits_.transform(&__ch2.first,
- &__ch2.first + 2);
- for (size_t __i = 0; __i < __ranges_.size(); ++__i)
- {
- if (__ranges_[__i].first <= __s2 &&
- __s2 <= __ranges_[__i].second)
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (!__equivalences_.empty())
- {
- string_type __s2 = __traits_.transform_primary(&__ch2.first,
- &__ch2.first + 2);
- for (size_t __i = 0; __i < __equivalences_.size(); ++__i)
- {
- if (__s2 == __equivalences_[__i])
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (__traits_.isctype(__ch2.first, __mask_) &&
- __traits_.isctype(__ch2.second, __mask_))
- {
- __found = true;
- goto __exit;
- }
- if (!__traits_.isctype(__ch2.first, __neg_mask_) &&
- !__traits_.isctype(__ch2.second, __neg_mask_))
- {
- __found = true;
- goto __exit;
- }
- goto __exit;
- }
- }
+void __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const {
+ bool __found = false;
+ unsigned __consumed = 0;
+ if (__s.__current_ != __s.__last_) {
+ ++__consumed;
+ if (__might_have_digraph_) {
+ const _CharT* __next = std::next(__s.__current_);
+ if (__next != __s.__last_) {
+ pair<_CharT, _CharT> __ch2(*__s.__current_, *__next);
+ if (__icase_) {
+ __ch2.first = __traits_.translate_nocase(__ch2.first);
+ __ch2.second = __traits_.translate_nocase(__ch2.second);
+ } else if (__collate_) {
+ __ch2.first = __traits_.translate(__ch2.first);
+ __ch2.second = __traits_.translate(__ch2.second);
}
- // test *__s.__current_ as not a digraph
- _CharT __ch = *__s.__current_;
- if (__icase_)
- __ch = __traits_.translate_nocase(__ch);
- else if (__collate_)
- __ch = __traits_.translate(__ch);
- for (size_t __i = 0; __i < __chars_.size(); ++__i)
- {
- if (__ch == __chars_[__i])
- {
+ if (!__traits_.lookup_collatename(&__ch2.first, &__ch2.first + 2).empty()) {
+ // __ch2 is a digraph in this locale
+ ++__consumed;
+ for (size_t __i = 0; __i < __digraphs_.size(); ++__i) {
+ if (__ch2 == __digraphs_[__i]) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ if (__collate_ && !__ranges_.empty()) {
+ string_type __s2 = __traits_.transform(&__ch2.first, &__ch2.first + 2);
+ for (size_t __i = 0; __i < __ranges_.size(); ++__i) {
+ if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second) {
__found = true;
goto __exit;
+ }
}
- }
- // When there's at least one of __neg_chars_ and __neg_mask_, the set
- // of "__found" chars is
- // union(complement(union(__neg_chars_, __neg_mask_)),
- // other cases...)
- //
- // It doesn't make sense to check this when there are no __neg_chars_
- // and no __neg_mask_.
- if (!(__neg_mask_ == 0 && __neg_chars_.empty()))
- {
- const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
- const bool __in_neg_chars =
- std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
- __neg_chars_.end();
- if (!(__in_neg_mask || __in_neg_chars))
- {
+ }
+ if (!__equivalences_.empty()) {
+ string_type __s2 = __traits_.transform_primary(&__ch2.first, &__ch2.first + 2);
+ for (size_t __i = 0; __i < __equivalences_.size(); ++__i) {
+ if (__s2 == __equivalences_[__i]) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ }
+ if (__traits_.isctype(__ch2.first, __mask_) && __traits_.isctype(__ch2.second, __mask_)) {
__found = true;
goto __exit;
}
- }
- if (!__ranges_.empty())
- {
- string_type __s2 = __collate_ ?
- __traits_.transform(&__ch, &__ch + 1) :
- string_type(1, __ch);
- for (size_t __i = 0; __i < __ranges_.size(); ++__i)
- {
- if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second)
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (!__equivalences_.empty())
- {
- string_type __s2 = __traits_.transform_primary(&__ch, &__ch + 1);
- for (size_t __i = 0; __i < __equivalences_.size(); ++__i)
- {
- if (__s2 == __equivalences_[__i])
- {
- __found = true;
- goto __exit;
- }
- }
- }
- if (__traits_.isctype(__ch, __mask_))
- {
+ if (!__traits_.isctype(__ch2.first, __neg_mask_) && !__traits_.isctype(__ch2.second, __neg_mask_)) {
__found = true;
goto __exit;
+ }
+ goto __exit;
}
+ }
}
- else
- __found = __negate_; // force reject
-__exit:
- if (__found != __negate_)
- {
- __s.__do_ = __state::__accept_and_consume;
- __s.__current_ += __consumed;
- __s.__node_ = this->first();
+ // test *__s.__current_ as not a digraph
+ _CharT __ch = *__s.__current_;
+ if (__icase_)
+ __ch = __traits_.translate_nocase(__ch);
+ else if (__collate_)
+ __ch = __traits_.translate(__ch);
+ for (size_t __i = 0; __i < __chars_.size(); ++__i) {
+ if (__ch == __chars_[__i]) {
+ __found = true;
+ goto __exit;
+ }
}
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+ // When there's at least one of __neg_chars_ and __neg_mask_, the set
+ // of "__found" chars is
+ // union(complement(union(__neg_chars_, __neg_mask_)),
+ // other cases...)
+ //
+ // It doesn't make sense to check this when there are no __neg_chars_
+ // and no __neg_mask_.
+ if (!(__neg_mask_ == 0 && __neg_chars_.empty())) {
+ const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
+ const bool __in_neg_chars = std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) != __neg_chars_.end();
+ if (!(__in_neg_mask || __in_neg_chars)) {
+ __found = true;
+ goto __exit;
+ }
}
+ if (!__ranges_.empty()) {
+ string_type __s2 = __collate_ ? __traits_.transform(&__ch, &__ch + 1) : string_type(1, __ch);
+ for (size_t __i = 0; __i < __ranges_.size(); ++__i) {
+ if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ }
+ if (!__equivalences_.empty()) {
+ string_type __s2 = __traits_.transform_primary(&__ch, &__ch + 1);
+ for (size_t __i = 0; __i < __equivalences_.size(); ++__i) {
+ if (__s2 == __equivalences_[__i]) {
+ __found = true;
+ goto __exit;
+ }
+ }
+ }
+ if (__traits_.isctype(__ch, __mask_)) {
+ __found = true;
+ goto __exit;
+ }
+ } else
+ __found = __negate_; // force reject
+__exit:
+ if (__found != __negate_) {
+ __s.__do_ = __state::__accept_and_consume;
+ __s.__current_ += __consumed;
+ __s.__node_ = this->first();
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
-template <class _CharT, class _Traits> class __lookahead;
+template <class _CharT, class _Traits>
+class __lookahead;
template <class _CharT, class _Traits = regex_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_regex;
+class _LIBCPP_TEMPLATE_VIS basic_regex;
-typedef basic_regex<char> regex;
+typedef basic_regex<char> regex;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_regex<wchar_t> wregex;
#endif
template <class _CharT, class _Traits>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(regex)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wregex))
- basic_regex
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(regex)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wregex)) basic_regex {
public:
- // types:
- typedef _CharT value_type;
- typedef _Traits traits_type;
- typedef typename _Traits::string_type string_type;
- typedef regex_constants::syntax_option_type flag_type;
- typedef typename _Traits::locale_type locale_type;
+ // types:
+ typedef _CharT value_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::string_type string_type;
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef typename _Traits::locale_type locale_type;
private:
- _Traits __traits_;
- flag_type __flags_;
- unsigned __marked_count_;
- unsigned __loop_count_;
- int __open_count_;
- shared_ptr<__empty_state<_CharT> > __start_;
- __owns_one_state<_CharT>* __end_;
+ _Traits __traits_;
+ flag_type __flags_;
+ unsigned __marked_count_;
+ unsigned __loop_count_;
+ int __open_count_;
+ shared_ptr<__empty_state<_CharT> > __start_;
+ __owns_one_state<_CharT>* __end_;
- typedef std::__state<_CharT> __state;
- typedef std::__node<_CharT> __node;
+ typedef std::__state<_CharT> __state;
+ typedef std::__node<_CharT> __node;
public:
- // constants:
- static const regex_constants::syntax_option_type icase = regex_constants::icase;
- static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
- static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
- static const regex_constants::syntax_option_type collate = regex_constants::collate;
- static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
- static const regex_constants::syntax_option_type basic = regex_constants::basic;
- static const regex_constants::syntax_option_type extended = regex_constants::extended;
- static const regex_constants::syntax_option_type awk = regex_constants::awk;
- static const regex_constants::syntax_option_type grep = regex_constants::grep;
- static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
- static const regex_constants::syntax_option_type multiline = regex_constants::multiline;
-
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- basic_regex()
- : __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__p, __p + __traits_.length(__p));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__p, __p + __len);
- }
-
-// basic_regex(const basic_regex&) = default;
-// basic_regex(basic_regex&&) = default;
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
- flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__p.begin(), __p.end());
- }
-
- template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex(_ForwardIterator __first, _ForwardIterator __last,
- flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__first, __last);
- }
+ // constants:
+ static const regex_constants::syntax_option_type icase = regex_constants::icase;
+ static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
+ static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
+ static const regex_constants::syntax_option_type collate = regex_constants::collate;
+ static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
+ static const regex_constants::syntax_option_type basic = regex_constants::basic;
+ static const regex_constants::syntax_option_type extended = regex_constants::extended;
+ static const regex_constants::syntax_option_type awk = regex_constants::awk;
+ static const regex_constants::syntax_option_type grep = regex_constants::grep;
+ static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
+ static const regex_constants::syntax_option_type multiline = regex_constants::multiline;
+
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI basic_regex()
+ : __flags_(regex_constants::ECMAScript),
+ __marked_count_(0),
+ __loop_count_(0),
+ __open_count_(0),
+ __end_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__p, __p + __traits_.length(__p));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__p, __p + __len);
+ }
+
+ // basic_regex(const basic_regex&) = default;
+ // basic_regex(basic_regex&&) = default;
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
+ flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__p.begin(), __p.end());
+ }
+
+ template <class _ForwardIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ basic_regex(_ForwardIterator __first, _ForwardIterator __last, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__first, __last);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex(initializer_list<value_type> __il,
- flag_type __f = regex_constants::ECMAScript)
- : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
- __end_(nullptr)
- {
- __init(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI basic_regex(initializer_list<value_type> __il, flag_type __f = regex_constants::ECMAScript)
+ : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(nullptr) {
+ __init(__il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
-// ~basic_regex() = default;
+ // ~basic_regex() = default;
-// basic_regex& operator=(const basic_regex&) = default;
-// basic_regex& operator=(basic_regex&&) = default;
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& operator=(const value_type* __p)
- {return assign(__p);}
+ // basic_regex& operator=(const basic_regex&) = default;
+ // basic_regex& operator=(basic_regex&&) = default;
+ _LIBCPP_HIDE_FROM_ABI basic_regex& operator=(const value_type* __p) { return assign(__p); }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& operator=(initializer_list<value_type> __il)
- {return assign(__il);}
+ _LIBCPP_HIDE_FROM_ABI basic_regex& operator=(initializer_list<value_type> __il) { return assign(__il); }
#endif // _LIBCPP_CXX03_LANG
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p)
- {return assign(__p);}
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p) {
+ return assign(__p);
+ }
- // assign:
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const basic_regex& __that)
- {return *this = __that;}
+ // assign:
+ _LIBCPP_HIDE_FROM_ABI basic_regex& assign(const basic_regex& __that) { return *this = __that; }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(basic_regex&& __that) _NOEXCEPT
- {return *this = std::move(__that);}
+ _LIBCPP_HIDE_FROM_ABI basic_regex& assign(basic_regex&& __that) _NOEXCEPT { return *this = std::move(__that); }
#endif
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
- {return assign(__p, __p + __traits_.length(__p), __f);}
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
- {return assign(__p, __p + __len, __f);}
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(const basic_string<value_type, _ST, _SA>& __s,
- flag_type __f = regex_constants::ECMAScript)
- {return assign(__s.begin(), __s.end(), __f);}
-
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex&
- assign(_InputIterator __first, _InputIterator __last,
- flag_type __f = regex_constants::ECMAScript)
- {
- basic_string<_CharT> __t(__first, __last);
- return assign(__t.begin(), __t.end(), __f);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__p, __p + __traits_.length(__p), __f);
+ }
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__p, __p + __len, __f);
+ }
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(const basic_string<value_type, _ST, _SA>& __s, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__s.begin(), __s.end(), __f);
+ }
+
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(_InputIterator __first, _InputIterator __last, flag_type __f = regex_constants::ECMAScript) {
+ basic_string<_CharT> __t(__first, __last);
+ return assign(__t.begin(), __t.end(), __f);
+ }
private:
- _LIBCPP_HIDE_FROM_ABI
- void __member_init(flag_type __f)
- {
- __flags_ = __f;
- __marked_count_ = 0;
- __loop_count_ = 0;
- __open_count_ = 0;
- __end_ = nullptr;
- }
-public:
+ _LIBCPP_HIDE_FROM_ABI void __member_init(flag_type __f) {
+ __flags_ = __f;
+ __marked_count_ = 0;
+ __loop_count_ = 0;
+ __open_count_ = 0;
+ __end_ = nullptr;
+ }
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- basic_regex&
- assign(_ForwardIterator __first, _ForwardIterator __last,
- flag_type __f = regex_constants::ECMAScript)
- {
- return assign(basic_regex(__first, __last, __f));
- }
+public:
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(_ForwardIterator __first, _ForwardIterator __last, flag_type __f = regex_constants::ECMAScript) {
+ return assign(basic_regex(__first, __last, __f));
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- basic_regex& assign(initializer_list<value_type> __il,
- flag_type __f = regex_constants::ECMAScript)
- {return assign(__il.begin(), __il.end(), __f);}
+ _LIBCPP_HIDE_FROM_ABI basic_regex&
+ assign(initializer_list<value_type> __il, flag_type __f = regex_constants::ECMAScript) {
+ return assign(__il.begin(), __il.end(), __f);
+ }
#endif // _LIBCPP_CXX03_LANG
- // const operations:
- _LIBCPP_HIDE_FROM_ABI
- unsigned mark_count() const {return __marked_count_;}
- _LIBCPP_HIDE_FROM_ABI
- flag_type flags() const {return __flags_;}
+ // const operations:
+ _LIBCPP_HIDE_FROM_ABI unsigned mark_count() const { return __marked_count_; }
+ _LIBCPP_HIDE_FROM_ABI flag_type flags() const { return __flags_; }
- // locale:
- _LIBCPP_HIDE_FROM_ABI
- locale_type imbue(locale_type __loc)
- {
- __member_init(ECMAScript);
- __start_.reset();
- return __traits_.imbue(__loc);
- }
- _LIBCPP_HIDE_FROM_ABI
- locale_type getloc() const {return __traits_.getloc();}
+ // locale:
+ _LIBCPP_HIDE_FROM_ABI locale_type imbue(locale_type __loc) {
+ __member_init(ECMAScript);
+ __start_.reset();
+ return __traits_.imbue(__loc);
+ }
+ _LIBCPP_HIDE_FROM_ABI locale_type getloc() const { return __traits_.getloc(); }
- // swap:
- void swap(basic_regex& __r);
+ // swap:
+ void swap(basic_regex& __r);
private:
- _LIBCPP_HIDE_FROM_ABI
- unsigned __loop_count() const {return __loop_count_;}
-
- _LIBCPP_HIDE_FROM_ABI
- bool __use_multiline() const
- {
- return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline);
- }
-
- template <class _ForwardIterator>
- void
- __init(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_basic_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_RE_expression(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_simple_RE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_nondupl_RE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_one_char_or_coll_elem_RE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_open_paren(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_close_paren(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_open_brace(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_Back_close_brace(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_BACKREF(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ORD_CHAR(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_QUOTED_CHAR(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_RE_dupl_symbol(_ForwardIterator __first, _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin, unsigned __mexp_end);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ERE_dupl_symbol(_ForwardIterator __first, _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin, unsigned __mexp_end);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_bracket_expression(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_follow_list(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_expression_term(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_equivalence_class(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_character_class(_ForwardIterator __first, _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_collating_symbol(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>& __col_sym);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_extended_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ERE_expression(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_one_char_or_coll_elem_ERE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ORD_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_QUOTED_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_ecma_exp(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_alternative(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_term(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_assertion(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_atom(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_atom_escape(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_decimal_escape(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_character_class_escape(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_character_escape(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>* __str = nullptr);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_pattern_character(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_grep(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_egrep(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_class_escape(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>& __str,
- __bracket_expression<_CharT, _Traits>* __ml);
- template <class _ForwardIterator>
- _ForwardIterator
- __parse_awk_escape(_ForwardIterator __first, _ForwardIterator __last,
- basic_string<_CharT>* __str = nullptr);
-
- bool __test_back_ref(_CharT);
-
- _LIBCPP_HIDE_FROM_ABI
- void __push_l_anchor();
- void __push_r_anchor();
- void __push_match_any();
- void __push_match_any_but_newline();
- _LIBCPP_HIDE_FROM_ABI
- void __push_greedy_inf_repeat(size_t __min, __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin = 0, unsigned __mexp_end = 0)
- {__push_loop(__min, numeric_limits<size_t>::max(), __s,
- __mexp_begin, __mexp_end);}
- _LIBCPP_HIDE_FROM_ABI
- void __push_nongreedy_inf_repeat(size_t __min, __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin = 0, unsigned __mexp_end = 0)
- {__push_loop(__min, numeric_limits<size_t>::max(), __s,
- __mexp_begin, __mexp_end, false);}
- void __push_loop(size_t __min, size_t __max, __owns_one_state<_CharT>* __s,
- size_t __mexp_begin = 0, size_t __mexp_end = 0,
- bool __greedy = true);
- __bracket_expression<_CharT, _Traits>* __start_matching_list(bool __negate);
- void __push_char(value_type __c);
- void __push_back_ref(int __i);
- void __push_alternation(__owns_one_state<_CharT>* __sa,
- __owns_one_state<_CharT>* __sb);
- void __push_begin_marked_subexpression();
- void __push_end_marked_subexpression(unsigned);
- void __push_empty();
- void __push_word_boundary(bool);
- void __push_lookahead(const basic_regex&, bool, unsigned);
-
- template <class _Allocator>
- bool
- __search(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags) const;
-
- template <class _Allocator>
- bool
- __match_at_start(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
- template <class _Allocator>
- bool
- __match_at_start_ecma(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
- template <class _Allocator>
- bool
- __match_at_start_posix_nosubs(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
- template <class _Allocator>
- bool
- __match_at_start_posix_subs(const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool) const;
-
- template <class _Bp, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
-
- template <class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&,
- const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
-
- template <class _Bp, class _Cp, class _Tp>
- friend
- bool
- regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
-
- template <class _Cp, class _Tp>
- friend
- bool
- regex_search(const _Cp*, const _Cp*,
- const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
-
- template <class _Cp, class _Ap, class _Tp>
- friend
- bool
- regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
-
- template <class _ST, class _SA, class _Cp, class _Tp>
- friend
- bool
- regex_search(const basic_string<_Cp, _ST, _SA>& __s,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags);
-
- template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(const basic_string<_Cp, _ST, _SA>& __s,
- match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags);
-
- template <class _Iter, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_search(__wrap_iter<_Iter> __first,
- __wrap_iter<_Iter> __last,
- match_results<__wrap_iter<_Iter>, _Ap>& __m,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags);
-
- template <class, class> friend class __lookahead;
+ _LIBCPP_HIDE_FROM_ABI unsigned __loop_count() const { return __loop_count_; }
+
+ _LIBCPP_HIDE_FROM_ABI bool __use_multiline() const {
+ return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline);
+ }
+
+ template <class _ForwardIterator>
+ void __init(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_basic_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_RE_expression(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_simple_RE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_nondupl_RE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_one_char_or_coll_elem_RE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_open_paren(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_close_paren(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_open_brace(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_Back_close_brace(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_BACKREF(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ORD_CHAR(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_QUOTED_CHAR(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_RE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ERE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_bracket_expression(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_follow_list(_ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_expression_term(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_equivalence_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_character_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_collating_symbol(_ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>& __col_sym);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_extended_reg_exp(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ERE_expression(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_one_char_or_coll_elem_ERE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ORD_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_QUOTED_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_ecma_exp(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_alternative(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_term(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_assertion(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_atom(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_atom_escape(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_decimal_escape(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_character_class_escape(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_character_escape(_ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str = nullptr);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_pattern_character(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_grep(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_egrep(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator>
+ _ForwardIterator __parse_class_escape(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ basic_string<_CharT>& __str,
+ __bracket_expression<_CharT, _Traits>* __ml);
+ template <class _ForwardIterator>
+ _ForwardIterator
+ __parse_awk_escape(_ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str = nullptr);
+
+ bool __test_back_ref(_CharT);
+
+ _LIBCPP_HIDE_FROM_ABI void __push_l_anchor();
+ void __push_r_anchor();
+ void __push_match_any();
+ void __push_match_any_but_newline();
+ _LIBCPP_HIDE_FROM_ABI void __push_greedy_inf_repeat(
+ size_t __min, __owns_one_state<_CharT>* __s, unsigned __mexp_begin = 0, unsigned __mexp_end = 0) {
+ __push_loop(__min, numeric_limits<size_t>::max(), __s, __mexp_begin, __mexp_end);
+ }
+ _LIBCPP_HIDE_FROM_ABI void __push_nongreedy_inf_repeat(
+ size_t __min, __owns_one_state<_CharT>* __s, unsigned __mexp_begin = 0, unsigned __mexp_end = 0) {
+ __push_loop(__min, numeric_limits<size_t>::max(), __s, __mexp_begin, __mexp_end, false);
+ }
+ void __push_loop(size_t __min,
+ size_t __max,
+ __owns_one_state<_CharT>* __s,
+ size_t __mexp_begin = 0,
+ size_t __mexp_end = 0,
+ bool __greedy = true);
+ __bracket_expression<_CharT, _Traits>* __start_matching_list(bool __negate);
+ void __push_char(value_type __c);
+ void __push_back_ref(int __i);
+ void __push_alternation(__owns_one_state<_CharT>* __sa, __owns_one_state<_CharT>* __sb);
+ void __push_begin_marked_subexpression();
+ void __push_end_marked_subexpression(unsigned);
+ void __push_empty();
+ void __push_word_boundary(bool);
+ void __push_lookahead(const basic_regex&, bool, unsigned);
+
+ template <class _Allocator>
+ bool __search(const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags) const;
+
+ template <class _Allocator>
+ bool __match_at_start(const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+ template <class _Allocator>
+ bool __match_at_start_ecma(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+ template <class _Allocator>
+ bool __match_at_start_posix_nosubs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+ template <class _Allocator>
+ bool __match_at_start_posix_subs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool) const;
+
+ template <class _Bp, class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_search(const _Cp*,
+ const _Cp*,
+ match_results<const _Cp*, _Ap>&,
+ const basic_regex<_Cp, _Tp>&,
+ regex_constants::match_flag_type);
+
+ template <class _Bp, class _Cp, class _Tp>
+ friend bool regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _Cp, class _Tp>
+ friend bool regex_search(const _Cp*, const _Cp*, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _Cp, class _Ap, class _Tp>
+ friend bool regex_search(
+ const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
+
+ template <class _ST, class _SA, class _Cp, class _Tp>
+ friend bool regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags);
+
+ template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
+ friend bool regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+ match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags);
+
+ template <class _Iter, class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_search(__wrap_iter<_Iter> __first,
+ __wrap_iter<_Iter> __last,
+ match_results<__wrap_iter<_Iter>, _Ap>& __m,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags);
+
+ template <class, class>
+ friend class __lookahead;
};
#if _LIBCPP_STD_VER >= 17
-template <class _ForwardIterator,
- __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
-basic_regex(_ForwardIterator, _ForwardIterator,
- regex_constants::syntax_option_type = regex_constants::ECMAScript)
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+basic_regex(_ForwardIterator, _ForwardIterator, regex_constants::syntax_option_type = regex_constants::ECMAScript)
-> basic_regex<typename iterator_traits<_ForwardIterator>::value_type>;
#endif
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
template <class _CharT, class _Traits>
- const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
+const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
-{
- using std::swap;
- swap(__traits_, __r.__traits_);
- swap(__flags_, __r.__flags_);
- swap(__marked_count_, __r.__marked_count_);
- swap(__loop_count_, __r.__loop_count_);
- swap(__open_count_, __r.__open_count_);
- swap(__start_, __r.__start_);
- swap(__end_, __r.__end_);
+void basic_regex<_CharT, _Traits>::swap(basic_regex& __r) {
+ using std::swap;
+ swap(__traits_, __r.__traits_);
+ swap(__flags_, __r.__flags_);
+ swap(__marked_count_, __r.__marked_count_);
+ swap(__loop_count_, __r.__loop_count_);
+ swap(__open_count_, __r.__open_count_);
+ swap(__start_, __r.__start_);
+ swap(__end_, __r.__end_);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_regex<_CharT, _Traits>& __x, basic_regex<_CharT, _Traits>& __y)
-{
- return __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(basic_regex<_CharT, _Traits>& __x, basic_regex<_CharT, _Traits>& __y) {
+ return __x.swap(__y);
}
// __lookahead
template <class _CharT, class _Traits>
-class __lookahead
- : public __owns_one_state<_CharT>
-{
- typedef __owns_one_state<_CharT> base;
+class __lookahead : public __owns_one_state<_CharT> {
+ typedef __owns_one_state<_CharT> base;
+
+ basic_regex<_CharT, _Traits> __exp_;
+ unsigned __mexp_;
+ bool __invert_;
- basic_regex<_CharT, _Traits> __exp_;
- unsigned __mexp_;
- bool __invert_;
+ __lookahead(const __lookahead&);
+ __lookahead& operator=(const __lookahead&);
- __lookahead(const __lookahead&);
- __lookahead& operator=(const __lookahead&);
public:
- typedef std::__state<_CharT> __state;
+ typedef std::__state<_CharT> __state;
- _LIBCPP_HIDE_FROM_ABI
- __lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
- : base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
+ _LIBCPP_HIDE_FROM_ABI
+ __lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
+ : base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
template <class _CharT, class _Traits>
-void
-__lookahead<_CharT, _Traits>::__exec(__state& __s) const
-{
- match_results<const _CharT*> __m;
- __m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
- bool __matched = __exp_.__match_at_start_ecma(
- __s.__current_, __s.__last_,
- __m,
- (__s.__flags_ | regex_constants::match_continuous) &
- ~regex_constants::__full_match,
- __s.__at_first_ && __s.__current_ == __s.__first_);
- if (__matched != __invert_)
- {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
- for (unsigned __i = 1; __i < __m.size(); ++__i) {
- __s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
- }
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __lookahead<_CharT, _Traits>::__exec(__state& __s) const {
+ match_results<const _CharT*> __m;
+ __m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
+ bool __matched = __exp_.__match_at_start_ecma(
+ __s.__current_,
+ __s.__last_,
+ __m,
+ (__s.__flags_ | regex_constants::match_continuous) & ~regex_constants::__full_match,
+ __s.__at_first_ && __s.__current_ == __s.__first_);
+ if (__matched != __invert_) {
+ __s.__do_ = __state::__accept_but_not_consume;
+ __s.__node_ = this->first();
+ for (unsigned __i = 1; __i < __m.size(); ++__i) {
+ __s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
}
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-void
-basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIterator __last)
-{
- if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
- _ForwardIterator __temp = __parse(__first, __last);
- if ( __temp != __last)
- __throw_regex_error<regex_constants::__re_err_parse>();
+void basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__get_grammar(__flags_) == 0)
+ __flags_ |= regex_constants::ECMAScript;
+ _ForwardIterator __temp = __parse(__first, __last);
+ if (__temp != __last)
+ __throw_regex_error<regex_constants::__re_err_parse>();
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- {
- unique_ptr<__node> __h(new __end_state<_CharT>);
- __start_.reset(new __empty_state<_CharT>(__h.get()));
- __h.release();
- __end_ = __start_.get();
- }
- switch (__get_grammar(__flags_))
- {
- case ECMAScript:
- __first = __parse_ecma_exp(__first, __last);
- break;
- case basic:
- __first = __parse_basic_reg_exp(__first, __last);
- break;
- case extended:
- case awk:
- __first = __parse_extended_reg_exp(__first, __last);
- break;
- case grep:
- __first = __parse_grep(__first, __last);
- break;
- case egrep:
- __first = __parse_egrep(__first, __last);
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_grammar>();
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first, _ForwardIterator __last) {
+ {
+ unique_ptr<__node> __h(new __end_state<_CharT>);
+ __start_.reset(new __empty_state<_CharT>(__h.get()));
+ __h.release();
+ __end_ = __start_.get();
+ }
+ switch (__get_grammar(__flags_)) {
+ case ECMAScript:
+ __first = __parse_ecma_exp(__first, __last);
+ break;
+ case basic:
+ __first = __parse_basic_reg_exp(__first, __last);
+ break;
+ case extended:
+ case awk:
+ __first = __parse_extended_reg_exp(__first, __last);
+ break;
+ case grep:
+ __first = __parse_grep(__first, __last);
+ break;
+ case egrep:
+ __first = __parse_egrep(__first, __last);
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_grammar>();
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- if (*__first == '^')
- {
- __push_l_anchor();
- ++__first;
- }
- if (__first != __last)
- {
- __first = __parse_RE_expression(__first, __last);
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp == __last && *__first == '$')
- {
- __push_r_anchor();
- ++__first;
- }
- }
+basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ if (*__first == '^') {
+ __push_l_anchor();
+ ++__first;
+ }
+ if (__first != __last) {
+ __first = __parse_RE_expression(__first, __last);
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp == __last && *__first == '$') {
+ __push_r_anchor();
+ ++__first;
}
- if (__first != __last)
- __throw_regex_error<regex_constants::__re_err_empty>();
+ }
}
- return __first;
+ if (__first != __last)
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __temp = __parse_ERE_branch(__first, __last);
+basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __temp = __parse_ERE_branch(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ __first = __temp;
+ while (__first != __last && *__first == '|') {
+ __owns_one_state<_CharT>* __sb = __end_;
+ __temp = __parse_ERE_branch(++__first, __last);
if (__temp == __first)
- __throw_regex_error<regex_constants::__re_err_empty>();
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ __push_alternation(__sa, __sb);
__first = __temp;
- while (__first != __last && *__first == '|')
- {
- __owns_one_state<_CharT>* __sb = __end_;
- __temp = __parse_ERE_branch(++__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::__re_err_empty>();
- __push_alternation(__sa, __sb);
- __first = __temp;
- }
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_ERE_expression(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::__re_err_empty>();
- do
- {
- __first = __temp;
- __temp = __parse_ERE_expression(__first, __last);
- } while (__temp != __first);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_ERE_expression(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::__re_err_empty>();
+ do {
+ __first = __temp;
+ __temp = __parse_ERE_expression(__first, __last);
+ } while (__temp != __first);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __e = __end_;
- unsigned __mexp_begin = __marked_count_;
- _ForwardIterator __temp = __parse_one_char_or_coll_elem_ERE(__first, __last);
- if (__temp == __first && __temp != __last)
- {
- switch (*__temp)
- {
- case '^':
- __push_l_anchor();
- ++__temp;
- break;
- case '$':
- __push_r_anchor();
- ++__temp;
- break;
- case '(':
- __push_begin_marked_subexpression();
- unsigned __temp_count = __marked_count_;
- ++__open_count_;
- __temp = __parse_extended_reg_exp(++__temp, __last);
- if (__temp == __last || *__temp != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __push_end_marked_subexpression(__temp_count);
- --__open_count_;
- ++__temp;
- break;
- }
+basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __e = __end_;
+ unsigned __mexp_begin = __marked_count_;
+ _ForwardIterator __temp = __parse_one_char_or_coll_elem_ERE(__first, __last);
+ if (__temp == __first && __temp != __last) {
+ switch (*__temp) {
+ case '^':
+ __push_l_anchor();
+ ++__temp;
+ break;
+ case '$':
+ __push_r_anchor();
+ ++__temp;
+ break;
+ case '(':
+ __push_begin_marked_subexpression();
+ unsigned __temp_count = __marked_count_;
+ ++__open_count_;
+ __temp = __parse_extended_reg_exp(++__temp, __last);
+ if (__temp == __last || *__temp != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __push_end_marked_subexpression(__temp_count);
+ --__open_count_;
+ ++__temp;
+ break;
}
- if (__temp != __first)
- __temp = __parse_ERE_dupl_symbol(__temp, __last, __e, __mexp_begin+1,
- __marked_count_+1);
- __first = __temp;
- return __first;
+ }
+ if (__temp != __first)
+ __temp = __parse_ERE_dupl_symbol(__temp, __last, __e, __mexp_begin + 1, __marked_count_ + 1);
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_RE_expression(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- while (true)
- {
- _ForwardIterator __temp = __parse_simple_RE(__first, __last);
- if (__temp == __first)
- break;
- __first = __temp;
- }
- return __first;
+basic_regex<_CharT, _Traits>::__parse_RE_expression(_ForwardIterator __first, _ForwardIterator __last) {
+ while (true) {
+ _ForwardIterator __temp = __parse_simple_RE(__first, __last);
+ if (__temp == __first)
+ break;
+ __first = __temp;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_simple_RE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- __owns_one_state<_CharT>* __e = __end_;
- unsigned __mexp_begin = __marked_count_;
- _ForwardIterator __temp = __parse_nondupl_RE(__first, __last);
- if (__temp != __first)
- __first = __parse_RE_dupl_symbol(__temp, __last, __e,
- __mexp_begin+1, __marked_count_+1);
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_simple_RE(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ __owns_one_state<_CharT>* __e = __end_;
+ unsigned __mexp_begin = __marked_count_;
+ _ForwardIterator __temp = __parse_nondupl_RE(__first, __last);
+ if (__temp != __first)
+ __first = __parse_RE_dupl_symbol(__temp, __last, __e, __mexp_begin + 1, __marked_count_ + 1);
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __first;
- __first = __parse_one_char_or_coll_elem_RE(__first, __last);
- if (__temp == __first)
- {
- __temp = __parse_Back_open_paren(__first, __last);
- if (__temp != __first)
- {
- __push_begin_marked_subexpression();
- unsigned __temp_count = __marked_count_;
- __first = __parse_RE_expression(__temp, __last);
- __temp = __parse_Back_close_paren(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_paren>();
- __push_end_marked_subexpression(__temp_count);
- __first = __temp;
- }
- else
- __first = __parse_BACKREF(__first, __last);
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __first;
+ __first = __parse_one_char_or_coll_elem_RE(__first, __last);
+ if (__temp == __first) {
+ __temp = __parse_Back_open_paren(__first, __last);
+ if (__temp != __first) {
+ __push_begin_marked_subexpression();
+ unsigned __temp_count = __marked_count_;
+ __first = __parse_RE_expression(__temp, __last);
+ __temp = __parse_Back_close_paren(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_paren>();
+ __push_end_marked_subexpression(__temp_count);
+ __first = __temp;
+ } else
+ __first = __parse_BACKREF(__first, __last);
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_RE(
- _ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_ORD_CHAR(__first, __last);
- if (__temp == __first)
- {
- __temp = __parse_QUOTED_CHAR(__first, __last);
- if (__temp == __first)
- {
- if (__temp != __last && *__temp == '.')
- {
- __push_match_any();
- ++__temp;
- }
- else
- __temp = __parse_bracket_expression(__first, __last);
- }
+basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_RE(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_ORD_CHAR(__first, __last);
+ if (__temp == __first) {
+ __temp = __parse_QUOTED_CHAR(__first, __last);
+ if (__temp == __first) {
+ if (__temp != __last && *__temp == '.') {
+ __push_match_any();
+ ++__temp;
+ } else
+ __temp = __parse_bracket_expression(__first, __last);
}
- __first = __temp;
- return __first;
+ }
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_ERE(
- _ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_ORD_CHAR_ERE(__first, __last);
- if (__temp == __first)
- {
- __temp = __parse_QUOTED_CHAR_ERE(__first, __last);
- if (__temp == __first)
- {
- if (__temp != __last && *__temp == '.')
- {
- __push_match_any();
- ++__temp;
- }
- else
- __temp = __parse_bracket_expression(__first, __last);
- }
+basic_regex<_CharT, _Traits>::__parse_one_char_or_coll_elem_ERE(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_ORD_CHAR_ERE(__first, __last);
+ if (__temp == __first) {
+ __temp = __parse_QUOTED_CHAR_ERE(__first, __last);
+ if (__temp == __first) {
+ if (__temp != __last && *__temp == '.') {
+ __push_match_any();
+ ++__temp;
+ } else
+ __temp = __parse_bracket_expression(__first, __last);
}
- __first = __temp;
- return __first;
+ }
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_open_paren(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == '(')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_open_paren(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == '(')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_close_paren(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == ')')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_close_paren(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == ')')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_open_brace(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == '{')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_open_brace(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == '{')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_Back_close_brace(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\' && *__temp == '}')
- __first = ++__temp;
- }
+basic_regex<_CharT, _Traits>::__parse_Back_close_brace(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\' && *__temp == '}')
+ __first = ++__temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last && *__first == '\\' && __test_back_ref(*__temp))
- __first = ++__temp;
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last && *__first == '\\' && __test_back_ref(*__temp))
+ __first = ++__temp;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ORD_CHAR(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp == __last && *__first == '$')
- return __first;
- // Not called inside a bracket
- if (*__first == '.' || *__first == '\\' || *__first == '[')
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ORD_CHAR(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp == __last && *__first == '$')
+ return __first;
+ // Not called inside a bracket
+ if (*__first == '.' || *__first == '\\' || *__first == '[')
+ return __first;
+ __push_char(*__first);
+ ++__first;
+ }
+ return __first;
+}
+
+template <class _CharT, class _Traits>
+template <class _ForwardIterator>
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ORD_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '^':
+ case '.':
+ case '[':
+ case '$':
+ case '(':
+ case '|':
+ case '*':
+ case '+':
+ case '?':
+ case '{':
+ case '\\':
+ break;
+ case ')':
+ if (__open_count_ == 0) {
__push_char(*__first);
++__first;
+ }
+ break;
+ default:
+ __push_char(*__first);
+ ++__first;
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ORD_CHAR_ERE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\') {
+ switch (*__temp) {
case '^':
case '.':
+ case '*':
case '[':
case '$':
- case '(':
- case '|':
- case '*':
- case '+':
- case '?':
- case '{':
case '\\':
- break;
- case ')':
- if (__open_count_ == 0)
- {
- __push_char(*__first);
- ++__first;
- }
- break;
- default:
- __push_char(*__first);
- ++__first;
- break;
- }
- }
- return __first;
-}
-
-template <class _CharT, class _Traits>
-template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\')
- {
- switch (*__temp)
- {
- case '^':
- case '.':
- case '*':
- case '[':
- case '$':
- case '\\':
- __push_char(*__temp);
- __first = ++__temp;
- break;
- }
- }
+ __push_char(*__temp);
+ __first = ++__temp;
+ break;
}
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__first == '\\')
- {
- switch (*__temp)
- {
- case '^':
- case '.':
- case '*':
- case '[':
- case '$':
- case '\\':
- case '(':
- case ')':
- case '|':
- case '+':
- case '?':
- case '{':
- case '}':
- __push_char(*__temp);
- __first = ++__temp;
- break;
- default:
- if (__get_grammar(__flags_) == awk)
- __first = __parse_awk_escape(++__first, __last);
- else if(__test_back_ref(*__temp))
- __first = ++__temp;
- break;
- }
- }
+basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__first == '\\') {
+ switch (*__temp) {
+ case '^':
+ case '.':
+ case '*':
+ case '[':
+ case '$':
+ case '\\':
+ case '(':
+ case ')':
+ case '|':
+ case '+':
+ case '?':
+ case '{':
+ case '}':
+ __push_char(*__temp);
+ __first = ++__temp;
+ break;
+ default:
+ if (__get_grammar(__flags_) == awk)
+ __first = __parse_awk_escape(++__first, __last);
+ else if (__test_back_ref(*__temp))
+ __first = ++__temp;
+ break;
}
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
- _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin,
- unsigned __mexp_end)
-{
- if (__first != __last)
- {
- if (*__first == '*')
- {
- __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
- ++__first;
- }
- else
- {
- _ForwardIterator __temp = __parse_Back_open_brace(__first, __last);
- if (__temp != __first)
- {
- int __min = 0;
- __first = __temp;
- __temp = __parse_DUP_COUNT(__first, __last, __min);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_badbrace>();
- __first = __temp;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brace>();
- if (*__first != ',')
- {
- __temp = __parse_Back_close_brace(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_brace>();
- __push_loop(__min, __min, __s, __mexp_begin, __mexp_end,
- true);
- __first = __temp;
- }
- else
- {
- ++__first; // consume ','
- int __max = -1;
- __first = __parse_DUP_COUNT(__first, __last, __max);
- __temp = __parse_Back_close_brace(__first, __last);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_brace>();
- if (__max == -1)
- __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
- else
- {
- if (__max < __min)
- __throw_regex_error<regex_constants::error_badbrace>();
- __push_loop(__min, __max, __s, __mexp_begin, __mexp_end,
- true);
- }
- __first = __temp;
- }
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end) {
+ if (__first != __last) {
+ if (*__first == '*') {
+ __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+ ++__first;
+ } else {
+ _ForwardIterator __temp = __parse_Back_open_brace(__first, __last);
+ if (__temp != __first) {
+ int __min = 0;
+ __first = __temp;
+ __temp = __parse_DUP_COUNT(__first, __last, __min);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __first = __temp;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brace>();
+ if (*__first != ',') {
+ __temp = __parse_Back_close_brace(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_brace>();
+ __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, true);
+ __first = __temp;
+ } else {
+ ++__first; // consume ','
+ int __max = -1;
+ __first = __parse_DUP_COUNT(__first, __last, __max);
+ __temp = __parse_Back_close_brace(__first, __last);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_brace>();
+ if (__max == -1)
+ __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+ else {
+ if (__max < __min)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, true);
+ }
+ __first = __temp;
}
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
- _ForwardIterator __last,
- __owns_one_state<_CharT>* __s,
- unsigned __mexp_begin,
- unsigned __mexp_end)
-{
- if (__first != __last)
- {
- unsigned __grammar = __get_grammar(__flags_);
- switch (*__first)
- {
- case '*':
- ++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_nongreedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
- }
- else
- __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
- break;
- case '+':
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ __owns_one_state<_CharT>* __s,
+ unsigned __mexp_begin,
+ unsigned __mexp_end) {
+ if (__first != __last) {
+ unsigned __grammar = __get_grammar(__flags_);
+ switch (*__first) {
+ case '*':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_nongreedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+ } else
+ __push_greedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
+ break;
+ case '+':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_nongreedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
+ } else
+ __push_greedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
+ break;
+ case '?':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_loop(0, 1, __s, __mexp_begin, __mexp_end, false);
+ } else
+ __push_loop(0, 1, __s, __mexp_begin, __mexp_end);
+ break;
+ case '{': {
+ int __min;
+ _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __first = __temp;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brace>();
+ switch (*__first) {
+ case '}':
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
+ ++__first;
+ __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, false);
+ } else
+ __push_loop(__min, __min, __s, __mexp_begin, __mexp_end);
+ break;
+ case ',':
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ if (*__first == '}') {
+ ++__first;
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_nongreedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
- }
- else
- __push_greedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
- break;
- case '?':
+ __push_nongreedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+ } else
+ __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
+ } else {
+ int __max = -1;
+ __temp = __parse_DUP_COUNT(__first, __last, __max);
+ if (__temp == __first)
+ __throw_regex_error<regex_constants::error_brace>();
+ __first = __temp;
+ if (__first == __last || *__first != '}')
+ __throw_regex_error<regex_constants::error_brace>();
+ ++__first;
+ if (__max < __min)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ if (__grammar == ECMAScript && __first != __last && *__first == '?') {
++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_loop(0, 1, __s, __mexp_begin, __mexp_end, false);
- }
- else
- __push_loop(0, 1, __s, __mexp_begin, __mexp_end);
- break;
- case '{':
- {
- int __min;
- _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_badbrace>();
- __first = __temp;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brace>();
- switch (*__first)
- {
- case '}':
- ++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, false);
- }
- else
- __push_loop(__min, __min, __s, __mexp_begin, __mexp_end);
- break;
- case ',':
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_badbrace>();
- if (*__first == '}')
- {
- ++__first;
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_nongreedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
- }
- else
- __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
- }
- else
- {
- int __max = -1;
- __temp = __parse_DUP_COUNT(__first, __last, __max);
- if (__temp == __first)
- __throw_regex_error<regex_constants::error_brace>();
- __first = __temp;
- if (__first == __last || *__first != '}')
- __throw_regex_error<regex_constants::error_brace>();
- ++__first;
- if (__max < __min)
- __throw_regex_error<regex_constants::error_badbrace>();
- if (__grammar == ECMAScript && __first != __last && *__first == '?')
- {
- ++__first;
- __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false);
- }
- else
- __push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
- }
- break;
- default:
- __throw_regex_error<regex_constants::error_badbrace>();
- }
- }
- break;
+ __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false);
+ } else
+ __push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
}
+ break;
+ default:
+ __throw_regex_error<regex_constants::error_badbrace>();
+ }
+ } break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last && *__first == '[')
- {
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brack>();
- bool __negate = false;
- if (*__first == '^')
- {
- ++__first;
- __negate = true;
- }
- __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
- // __ml owned by *this
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brack>();
- if (__get_grammar(__flags_) != ECMAScript && *__first == ']')
- {
- __ml->__add_char(']');
- ++__first;
- }
- __first = __parse_follow_list(__first, __last, __ml);
- if (__first == __last)
- __throw_regex_error<regex_constants::error_brack>();
- if (*__first == '-')
- {
- __ml->__add_char('-');
- ++__first;
- }
- if (__first == __last || *__first != ']')
- __throw_regex_error<regex_constants::error_brack>();
- ++__first;
+basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last && *__first == '[') {
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ bool __negate = false;
+ if (*__first == '^') {
+ ++__first;
+ __negate = true;
+ }
+ __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
+ // __ml owned by *this
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ if (__get_grammar(__flags_) != ECMAScript && *__first == ']') {
+ __ml->__add_char(']');
+ ++__first;
+ }
+ __first = __parse_follow_list(__first, __last, __ml);
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ if (*__first == '-') {
+ __ml->__add_char('-');
+ ++__first;
}
- return __first;
+ if (__first == __last || *__first != ']')
+ __throw_regex_error<regex_constants::error_brack>();
+ ++__first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_follow_list(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- if (__first != __last)
- {
- while (true)
- {
- _ForwardIterator __temp = __parse_expression_term(__first, __last,
- __ml);
- if (__temp == __first)
- break;
- __first = __temp;
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_follow_list(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ if (__first != __last) {
+ while (true) {
+ _ForwardIterator __temp = __parse_expression_term(__first, __last, __ml);
+ if (__temp == __first)
+ break;
+ __first = __temp;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- if (__first != __last && *__first != ']')
- {
- _ForwardIterator __temp = std::next(__first);
- basic_string<_CharT> __start_range;
- if (__temp != __last && *__first == '[')
- {
- if (*__temp == '=')
- return __parse_equivalence_class(++__temp, __last, __ml);
- else if (*__temp == ':')
- return __parse_character_class(++__temp, __last, __ml);
- else if (*__temp == '.')
- __first = __parse_collating_symbol(++__temp, __last, __start_range);
- }
- unsigned __grammar = __get_grammar(__flags_);
- if (__start_range.empty())
- {
- if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
- {
- if (__grammar == ECMAScript)
- __first = __parse_class_escape(++__first, __last, __start_range, __ml);
- else
- __first = __parse_awk_escape(++__first, __last, &__start_range);
- }
- else
- {
- __start_range = *__first;
- ++__first;
- }
- }
- if (__first != __last && *__first != ']')
- {
- __temp = std::next(__first);
- if (__temp != __last && *__first == '-' && *__temp != ']')
- {
- // parse a range
- basic_string<_CharT> __end_range;
- __first = __temp;
- ++__temp;
- if (__temp != __last && *__first == '[' && *__temp == '.')
- __first = __parse_collating_symbol(++__temp, __last, __end_range);
- else
- {
- if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
- {
- if (__grammar == ECMAScript)
- __first = __parse_class_escape(++__first, __last,
- __end_range, __ml);
- else
- __first = __parse_awk_escape(++__first, __last,
- &__end_range);
- }
- else
- {
- __end_range = *__first;
- ++__first;
- }
- }
- __ml->__add_range(std::move(__start_range), std::move(__end_range));
- }
- else if (!__start_range.empty())
- {
- if (__start_range.size() == 1)
- __ml->__add_char(__start_range[0]);
- else
- __ml->__add_digraph(__start_range[0], __start_range[1]);
- }
- }
- else if (!__start_range.empty())
- {
- if (__start_range.size() == 1)
- __ml->__add_char(__start_range[0]);
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_expression_term(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ if (__first != __last && *__first != ']') {
+ _ForwardIterator __temp = std::next(__first);
+ basic_string<_CharT> __start_range;
+ if (__temp != __last && *__first == '[') {
+ if (*__temp == '=')
+ return __parse_equivalence_class(++__temp, __last, __ml);
+ else if (*__temp == ':')
+ return __parse_character_class(++__temp, __last, __ml);
+ else if (*__temp == '.')
+ __first = __parse_collating_symbol(++__temp, __last, __start_range);
+ }
+ unsigned __grammar = __get_grammar(__flags_);
+ if (__start_range.empty()) {
+ if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\') {
+ if (__grammar == ECMAScript)
+ __first = __parse_class_escape(++__first, __last, __start_range, __ml);
+ else
+ __first = __parse_awk_escape(++__first, __last, &__start_range);
+ } else {
+ __start_range = *__first;
+ ++__first;
+ }
+ }
+ if (__first != __last && *__first != ']') {
+ __temp = std::next(__first);
+ if (__temp != __last && *__first == '-' && *__temp != ']') {
+ // parse a range
+ basic_string<_CharT> __end_range;
+ __first = __temp;
+ ++__temp;
+ if (__temp != __last && *__first == '[' && *__temp == '.')
+ __first = __parse_collating_symbol(++__temp, __last, __end_range);
+ else {
+ if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\') {
+ if (__grammar == ECMAScript)
+ __first = __parse_class_escape(++__first, __last, __end_range, __ml);
else
- __ml->__add_digraph(__start_range[0], __start_range[1]);
+ __first = __parse_awk_escape(++__first, __last, &__end_range);
+ } else {
+ __end_range = *__first;
+ ++__first;
+ }
}
+ __ml->__add_range(std::move(__start_range), std::move(__end_range));
+ } else if (!__start_range.empty()) {
+ if (__start_range.size() == 1)
+ __ml->__add_char(__start_range[0]);
+ else
+ __ml->__add_digraph(__start_range[0], __start_range[1]);
+ }
+ } else if (!__start_range.empty()) {
+ if (__start_range.size() == 1)
+ __ml->__add_char(__start_range[0]);
+ else
+ __ml->__add_digraph(__start_range[0], __start_range[1]);
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_class_escape(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>& __str,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- switch (*__first)
- {
- case 0:
- __str = *__first;
- return ++__first;
- case 'b':
- __str = _CharT(8);
- return ++__first;
- case 'd':
- __ml->__add_class(ctype_base::digit);
- return ++__first;
- case 'D':
- __ml->__add_neg_class(ctype_base::digit);
- return ++__first;
- case 's':
- __ml->__add_class(ctype_base::space);
- return ++__first;
- case 'S':
- __ml->__add_neg_class(ctype_base::space);
- return ++__first;
- case 'w':
- __ml->__add_class(ctype_base::alnum);
- __ml->__add_char('_');
- return ++__first;
- case 'W':
- __ml->__add_neg_class(ctype_base::alnum);
- __ml->__add_neg_char('_');
- return ++__first;
- }
- __first = __parse_character_escape(__first, __last, &__str);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_class_escape(
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ basic_string<_CharT>& __str,
+ __bracket_expression<_CharT, _Traits>* __ml) {
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ switch (*__first) {
+ case 0:
+ __str = *__first;
+ return ++__first;
+ case 'b':
+ __str = _CharT(8);
+ return ++__first;
+ case 'd':
+ __ml->__add_class(ctype_base::digit);
+ return ++__first;
+ case 'D':
+ __ml->__add_neg_class(ctype_base::digit);
+ return ++__first;
+ case 's':
+ __ml->__add_class(ctype_base::space);
+ return ++__first;
+ case 'S':
+ __ml->__add_neg_class(ctype_base::space);
+ return ++__first;
+ case 'w':
+ __ml->__add_class(ctype_base::alnum);
+ __ml->__add_char('_');
+ return ++__first;
+ case 'W':
+ __ml->__add_neg_class(ctype_base::alnum);
+ __ml->__add_neg_char('_');
+ return ++__first;
+ }
+ __first = __parse_character_escape(__first, __last, &__str);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>* __str)
-{
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- switch (*__first)
- {
- case '\\':
- case '"':
- case '/':
- if (__str)
- *__str = *__first;
- else
- __push_char(*__first);
- return ++__first;
- case 'a':
- if (__str)
- *__str = _CharT(7);
- else
- __push_char(_CharT(7));
- return ++__first;
- case 'b':
- if (__str)
- *__str = _CharT(8);
- else
- __push_char(_CharT(8));
- return ++__first;
- case 'f':
- if (__str)
- *__str = _CharT(0xC);
- else
- __push_char(_CharT(0xC));
- return ++__first;
- case 'n':
- if (__str)
- *__str = _CharT(0xA);
- else
- __push_char(_CharT(0xA));
- return ++__first;
- case 'r':
- if (__str)
- *__str = _CharT(0xD);
- else
- __push_char(_CharT(0xD));
- return ++__first;
- case 't':
- if (__str)
- *__str = _CharT(0x9);
- else
- __push_char(_CharT(0x9));
- return ++__first;
- case 'v':
- if (__str)
- *__str = _CharT(0xB);
- else
- __push_char(_CharT(0xB));
- return ++__first;
- }
- if ('0' <= *__first && *__first <= '7')
- {
- unsigned __val = *__first - '0';
- if (++__first != __last && ('0' <= *__first && *__first <= '7'))
- {
- __val = 8 * __val + *__first - '0';
- if (++__first != __last && ('0' <= *__first && *__first <= '7'))
- __val = 8 * __val + *__first++ - '0';
- }
- if (__str)
- *__str = _CharT(__val);
- else
- __push_char(_CharT(__val));
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_awk_escape(
+ _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str) {
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ switch (*__first) {
+ case '\\':
+ case '"':
+ case '/':
+ if (__str)
+ *__str = *__first;
+ else
+ __push_char(*__first);
+ return ++__first;
+ case 'a':
+ if (__str)
+ *__str = _CharT(7);
+ else
+ __push_char(_CharT(7));
+ return ++__first;
+ case 'b':
+ if (__str)
+ *__str = _CharT(8);
+ else
+ __push_char(_CharT(8));
+ return ++__first;
+ case 'f':
+ if (__str)
+ *__str = _CharT(0xC);
+ else
+ __push_char(_CharT(0xC));
+ return ++__first;
+ case 'n':
+ if (__str)
+ *__str = _CharT(0xA);
+ else
+ __push_char(_CharT(0xA));
+ return ++__first;
+ case 'r':
+ if (__str)
+ *__str = _CharT(0xD);
+ else
+ __push_char(_CharT(0xD));
+ return ++__first;
+ case 't':
+ if (__str)
+ *__str = _CharT(0x9);
+ else
+ __push_char(_CharT(0x9));
+ return ++__first;
+ case 'v':
+ if (__str)
+ *__str = _CharT(0xB);
+ else
+ __push_char(_CharT(0xB));
+ return ++__first;
+ }
+ if ('0' <= *__first && *__first <= '7') {
+ unsigned __val = *__first - '0';
+ if (++__first != __last && ('0' <= *__first && *__first <= '7')) {
+ __val = 8 * __val + *__first - '0';
+ if (++__first != __last && ('0' <= *__first && *__first <= '7'))
+ __val = 8 * __val + *__first++ - '0';
}
+ if (__str)
+ *__str = _CharT(__val);
else
- __throw_regex_error<regex_constants::error_escape>();
- return __first;
+ __push_char(_CharT(__val));
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- // Found [=
- // This means =] must exist
- value_type __equal_close[2] = {'=', ']'};
- _ForwardIterator __temp = std::search(__first, __last, __equal_close,
- __equal_close+2);
- if (__temp == __last)
- __throw_regex_error<regex_constants::error_brack>();
- // [__first, __temp) contains all text in [= ... =]
- string_type __collate_name =
- __traits_.lookup_collatename(__first, __temp);
- if (__collate_name.empty())
- __throw_regex_error<regex_constants::error_collate>();
- string_type __equiv_name =
- __traits_.transform_primary(__collate_name.begin(),
- __collate_name.end());
- if (!__equiv_name.empty())
- __ml->__add_equivalence(__equiv_name);
- else
- {
- switch (__collate_name.size())
- {
- case 1:
- __ml->__add_char(__collate_name[0]);
- break;
- case 2:
- __ml->__add_digraph(__collate_name[0], __collate_name[1]);
- break;
- default:
- __throw_regex_error<regex_constants::error_collate>();
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_equivalence_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ // Found [=
+ // This means =] must exist
+ value_type __equal_close[2] = {'=', ']'};
+ _ForwardIterator __temp = std::search(__first, __last, __equal_close, __equal_close + 2);
+ if (__temp == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ // [__first, __temp) contains all text in [= ... =]
+ string_type __collate_name = __traits_.lookup_collatename(__first, __temp);
+ if (__collate_name.empty())
+ __throw_regex_error<regex_constants::error_collate>();
+ string_type __equiv_name = __traits_.transform_primary(__collate_name.begin(), __collate_name.end());
+ if (!__equiv_name.empty())
+ __ml->__add_equivalence(__equiv_name);
+ else {
+ switch (__collate_name.size()) {
+ case 1:
+ __ml->__add_char(__collate_name[0]);
+ break;
+ case 2:
+ __ml->__add_digraph(__collate_name[0], __collate_name[1]);
+ break;
+ default:
+ __throw_regex_error<regex_constants::error_collate>();
}
- __first = std::next(__temp, 2);
- return __first;
+ }
+ __first = std::next(__temp, 2);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
- _ForwardIterator __last,
- __bracket_expression<_CharT, _Traits>* __ml)
-{
- // Found [:
- // This means :] must exist
- value_type __colon_close[2] = {':', ']'};
- _ForwardIterator __temp = std::search(__first, __last, __colon_close,
- __colon_close+2);
- if (__temp == __last)
- __throw_regex_error<regex_constants::error_brack>();
- // [__first, __temp) contains all text in [: ... :]
- typedef typename _Traits::char_class_type char_class_type;
- char_class_type __class_type =
- __traits_.lookup_classname(__first, __temp, __flags_ & icase);
- if (__class_type == 0)
- __throw_regex_error<regex_constants::error_ctype>();
- __ml->__add_class(__class_type);
- __first = std::next(__temp, 2);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_class(
+ _ForwardIterator __first, _ForwardIterator __last, __bracket_expression<_CharT, _Traits>* __ml) {
+ // Found [:
+ // This means :] must exist
+ value_type __colon_close[2] = {':', ']'};
+ _ForwardIterator __temp = std::search(__first, __last, __colon_close, __colon_close + 2);
+ if (__temp == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ // [__first, __temp) contains all text in [: ... :]
+ typedef typename _Traits::char_class_type char_class_type;
+ char_class_type __class_type = __traits_.lookup_classname(__first, __temp, __flags_ & icase);
+ if (__class_type == 0)
+ __throw_regex_error<regex_constants::error_ctype>();
+ __ml->__add_class(__class_type);
+ __first = std::next(__temp, 2);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>& __col_sym)
-{
- // Found [.
- // This means .] must exist
- value_type __dot_close[2] = {'.', ']'};
- _ForwardIterator __temp = std::search(__first, __last, __dot_close,
- __dot_close+2);
- if (__temp == __last)
- __throw_regex_error<regex_constants::error_brack>();
- // [__first, __temp) contains all text in [. ... .]
- __col_sym = __traits_.lookup_collatename(__first, __temp);
- switch (__col_sym.size())
- {
- case 1:
- case 2:
- break;
- default:
- __throw_regex_error<regex_constants::error_collate>();
- }
- __first = std::next(__temp, 2);
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_collating_symbol(
+ _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>& __col_sym) {
+ // Found [.
+ // This means .] must exist
+ value_type __dot_close[2] = {'.', ']'};
+ _ForwardIterator __temp = std::search(__first, __last, __dot_close, __dot_close + 2);
+ if (__temp == __last)
+ __throw_regex_error<regex_constants::error_brack>();
+ // [__first, __temp) contains all text in [. ... .]
+ __col_sym = __traits_.lookup_collatename(__first, __temp);
+ switch (__col_sym.size()) {
+ case 1:
+ case 2:
+ break;
+ default:
+ __throw_regex_error<regex_constants::error_collate>();
+ }
+ __first = std::next(__temp, 2);
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
- _ForwardIterator __last,
- int& __c)
-{
- if (__first != __last )
- {
- int __val = __traits_.value(*__first, 10);
- if ( __val != -1 )
- {
- __c = __val;
- for (++__first;
- __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
- ++__first)
- {
- if (__c >= numeric_limits<int>::max() / 10)
- __throw_regex_error<regex_constants::error_badbrace>();
- __c *= 10;
- __c += __val;
- }
- }
+basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c) {
+ if (__first != __last) {
+ int __val = __traits_.value(*__first, 10);
+ if (__val != -1) {
+ __c = __val;
+ for (++__first; __first != __last && (__val = __traits_.value(*__first, 10)) != -1; ++__first) {
+ if (__c >= numeric_limits<int>::max() / 10)
+ __throw_regex_error<regex_constants::error_badbrace>();
+ __c *= 10;
+ __c += __val;
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_ecma_exp(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __temp = __parse_alternative(__first, __last);
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_ecma_exp(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __temp = __parse_alternative(__first, __last);
+ if (__temp == __first)
+ __push_empty();
+ __first = __temp;
+ while (__first != __last && *__first == '|') {
+ __owns_one_state<_CharT>* __sb = __end_;
+ __temp = __parse_alternative(++__first, __last);
if (__temp == __first)
- __push_empty();
+ __push_empty();
+ __push_alternation(__sa, __sb);
__first = __temp;
- while (__first != __last && *__first == '|')
- {
- __owns_one_state<_CharT>* __sb = __end_;
- __temp = __parse_alternative(++__first, __last);
- if (__temp == __first)
- __push_empty();
- __push_alternation(__sa, __sb);
- __first = __temp;
- }
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_alternative(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- while (true)
- {
- _ForwardIterator __temp = __parse_term(__first, __last);
- if (__temp == __first)
- break;
- __first = __temp;
- }
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_alternative(_ForwardIterator __first, _ForwardIterator __last) {
+ while (true) {
+ _ForwardIterator __temp = __parse_term(__first, __last);
+ if (__temp == __first)
+ break;
+ __first = __temp;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_term(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- _ForwardIterator __temp = __parse_assertion(__first, __last);
- if (__temp == __first)
- {
- __owns_one_state<_CharT>* __e = __end_;
- unsigned __mexp_begin = __marked_count_;
- __temp = __parse_atom(__first, __last);
- if (__temp != __first)
- __first = __parse_ERE_dupl_symbol(__temp, __last, __e,
- __mexp_begin+1, __marked_count_+1);
- }
- else
- __first = __temp;
- return __first;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_term(_ForwardIterator __first, _ForwardIterator __last) {
+ _ForwardIterator __temp = __parse_assertion(__first, __last);
+ if (__temp == __first) {
+ __owns_one_state<_CharT>* __e = __end_;
+ unsigned __mexp_begin = __marked_count_;
+ __temp = __parse_atom(__first, __last);
+ if (__temp != __first)
+ __first = __parse_ERE_dupl_symbol(__temp, __last, __e, __mexp_begin + 1, __marked_count_ + 1);
+ } else
+ __first = __temp;
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
- case '^':
- __push_l_anchor();
- ++__first;
- break;
- case '$':
- __push_r_anchor();
- ++__first;
- break;
- case '\\':
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last)
- {
- if (*__temp == 'b')
- {
- __push_word_boundary(false);
- __first = ++__temp;
- }
- else if (*__temp == 'B')
- {
- __push_word_boundary(true);
- __first = ++__temp;
- }
- }
- }
- break;
- case '(':
- {
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last && *__temp == '?')
- {
- if (++__temp != __last)
- {
- switch (*__temp)
- {
- case '=':
- {
- basic_regex __exp;
- __exp.__flags_ = __flags_;
- __temp = __exp.__parse(++__temp, __last);
- unsigned __mexp = __exp.__marked_count_;
- __push_lookahead(std::move(__exp), false, __marked_count_);
- __marked_count_ += __mexp;
- if (__temp == __last || *__temp != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __first = ++__temp;
- }
- break;
- case '!':
- {
- basic_regex __exp;
- __exp.__flags_ = __flags_;
- __temp = __exp.__parse(++__temp, __last);
- unsigned __mexp = __exp.__marked_count_;
- __push_lookahead(std::move(__exp), true, __marked_count_);
- __marked_count_ += __mexp;
- if (__temp == __last || *__temp != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __first = ++__temp;
- }
- break;
- }
- }
- }
- }
- break;
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '^':
+ __push_l_anchor();
+ ++__first;
+ break;
+ case '$':
+ __push_r_anchor();
+ ++__first;
+ break;
+ case '\\': {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last) {
+ if (*__temp == 'b') {
+ __push_word_boundary(false);
+ __first = ++__temp;
+ } else if (*__temp == 'B') {
+ __push_word_boundary(true);
+ __first = ++__temp;
+ }
+ }
+ } break;
+ case '(': {
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last && *__temp == '?') {
+ if (++__temp != __last) {
+ switch (*__temp) {
+ case '=': {
+ basic_regex __exp;
+ __exp.__flags_ = __flags_;
+ __temp = __exp.__parse(++__temp, __last);
+ unsigned __mexp = __exp.__marked_count_;
+ __push_lookahead(std::move(__exp), false, __marked_count_);
+ __marked_count_ += __mexp;
+ if (__temp == __last || *__temp != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __first = ++__temp;
+ } break;
+ case '!': {
+ basic_regex __exp;
+ __exp.__flags_ = __flags_;
+ __temp = __exp.__parse(++__temp, __last);
+ unsigned __mexp = __exp.__marked_count_;
+ __push_lookahead(std::move(__exp), true, __marked_count_);
+ __marked_count_ += __mexp;
+ if (__temp == __last || *__temp != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __first = ++__temp;
+ } break;
+ }
}
+ }
+ } break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
- case '.':
- __push_match_any_but_newline();
- ++__first;
- break;
- case '\\':
- __first = __parse_atom_escape(__first, __last);
- break;
- case '[':
- __first = __parse_bracket_expression(__first, __last);
- break;
- case '(':
- {
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_paren>();
- _ForwardIterator __temp = std::next(__first);
- if (__temp != __last && *__first == '?' && *__temp == ':')
- {
- ++__open_count_;
- __first = __parse_ecma_exp(++__temp, __last);
- if (__first == __last || *__first != ')')
- __throw_regex_error<regex_constants::error_paren>();
- --__open_count_;
- ++__first;
- }
- else
- {
- __push_begin_marked_subexpression();
- unsigned __temp_count = __marked_count_;
- ++__open_count_;
- __first = __parse_ecma_exp(__first, __last);
- if (__first == __last || *__first != ')')
- __throw_regex_error<regex_constants::error_paren>();
- __push_end_marked_subexpression(__temp_count);
- --__open_count_;
- ++__first;
- }
- }
- break;
- case '*':
- case '+':
- case '?':
- case '{':
- __throw_regex_error<regex_constants::error_badrepeat>();
- break;
- default:
- __first = __parse_pattern_character(__first, __last);
- break;
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '.':
+ __push_match_any_but_newline();
+ ++__first;
+ break;
+ case '\\':
+ __first = __parse_atom_escape(__first, __last);
+ break;
+ case '[':
+ __first = __parse_bracket_expression(__first, __last);
+ break;
+ case '(': {
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_paren>();
+ _ForwardIterator __temp = std::next(__first);
+ if (__temp != __last && *__first == '?' && *__temp == ':') {
+ ++__open_count_;
+ __first = __parse_ecma_exp(++__temp, __last);
+ if (__first == __last || *__first != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ --__open_count_;
+ ++__first;
+ } else {
+ __push_begin_marked_subexpression();
+ unsigned __temp_count = __marked_count_;
+ ++__open_count_;
+ __first = __parse_ecma_exp(__first, __last);
+ if (__first == __last || *__first != ')')
+ __throw_regex_error<regex_constants::error_paren>();
+ __push_end_marked_subexpression(__temp_count);
+ --__open_count_;
+ ++__first;
+ }
+ } break;
+ case '*':
+ case '+':
+ case '?':
+ case '{':
+ __throw_regex_error<regex_constants::error_badrepeat>();
+ break;
+ default:
+ __first = __parse_pattern_character(__first, __last);
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last && *__first == '\\')
- {
- _ForwardIterator __t1 = std::next(__first);
- if (__t1 == __last)
- __throw_regex_error<regex_constants::error_escape>();
-
- _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last && *__first == '\\') {
+ _ForwardIterator __t1 = std::next(__first);
+ if (__t1 == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+
+ _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
+ if (__t2 != __t1)
+ __first = __t2;
+ else {
+ __t2 = __parse_character_class_escape(__t1, __last);
+ if (__t2 != __t1)
+ __first = __t2;
+ else {
+ __t2 = __parse_character_escape(__t1, __last);
if (__t2 != __t1)
- __first = __t2;
- else
- {
- __t2 = __parse_character_class_escape(__t1, __last);
- if (__t2 != __t1)
- __first = __t2;
- else
- {
- __t2 = __parse_character_escape(__t1, __last);
- if (__t2 != __t1)
- __first = __t2;
- }
- }
+ __first = __t2;
+ }
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- if (*__first == '0')
- {
- __push_char(_CharT());
- ++__first;
- }
- else if ('1' <= *__first && *__first <= '9')
- {
- unsigned __v = *__first - '0';
- for (++__first;
- __first != __last && '0' <= *__first && *__first <= '9'; ++__first)
- {
- if (__v >= numeric_limits<unsigned>::max() / 10)
- __throw_regex_error<regex_constants::error_backref>();
- __v = 10 * __v + *__first - '0';
- }
- if (__v == 0 || __v > mark_count())
- __throw_regex_error<regex_constants::error_backref>();
- __push_back_ref(__v);
- }
+basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ if (*__first == '0') {
+ __push_char(_CharT());
+ ++__first;
+ } else if ('1' <= *__first && *__first <= '9') {
+ unsigned __v = *__first - '0';
+ for (++__first; __first != __last && '0' <= *__first && *__first <= '9'; ++__first) {
+ if (__v >= numeric_limits<unsigned>::max() / 10)
+ __throw_regex_error<regex_constants::error_backref>();
+ __v = 10 * __v + *__first - '0';
+ }
+ if (__v == 0 || __v > mark_count())
+ __throw_regex_error<regex_constants::error_backref>();
+ __push_back_ref(__v);
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_character_class_escape(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- __bracket_expression<_CharT, _Traits>* __ml;
- switch (*__first)
- {
- case 'd':
- __ml = __start_matching_list(false);
- __ml->__add_class(ctype_base::digit);
- ++__first;
- break;
- case 'D':
- __ml = __start_matching_list(true);
- __ml->__add_class(ctype_base::digit);
- ++__first;
- break;
- case 's':
- __ml = __start_matching_list(false);
- __ml->__add_class(ctype_base::space);
- ++__first;
- break;
- case 'S':
- __ml = __start_matching_list(true);
- __ml->__add_class(ctype_base::space);
- ++__first;
- break;
- case 'w':
- __ml = __start_matching_list(false);
- __ml->__add_class(ctype_base::alnum);
- __ml->__add_char('_');
- ++__first;
- break;
- case 'W':
- __ml = __start_matching_list(true);
- __ml->__add_class(ctype_base::alnum);
- __ml->__add_char('_');
- ++__first;
- break;
- }
+basic_regex<_CharT, _Traits>::__parse_character_class_escape(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ __bracket_expression<_CharT, _Traits>* __ml;
+ switch (*__first) {
+ case 'd':
+ __ml = __start_matching_list(false);
+ __ml->__add_class(ctype_base::digit);
+ ++__first;
+ break;
+ case 'D':
+ __ml = __start_matching_list(true);
+ __ml->__add_class(ctype_base::digit);
+ ++__first;
+ break;
+ case 's':
+ __ml = __start_matching_list(false);
+ __ml->__add_class(ctype_base::space);
+ ++__first;
+ break;
+ case 'S':
+ __ml = __start_matching_list(true);
+ __ml->__add_class(ctype_base::space);
+ ++__first;
+ break;
+ case 'w':
+ __ml = __start_matching_list(false);
+ __ml->__add_class(ctype_base::alnum);
+ __ml->__add_char('_');
+ ++__first;
+ break;
+ case 'W':
+ __ml = __start_matching_list(true);
+ __ml->__add_class(ctype_base::alnum);
+ __ml->__add_char('_');
+ ++__first;
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
- _ForwardIterator __last,
- basic_string<_CharT>* __str)
-{
- if (__first != __last)
- {
- _ForwardIterator __t;
- unsigned __sum = 0;
- int __hd;
- switch (*__first)
- {
- case 'f':
- if (__str)
- *__str = _CharT(0xC);
- else
- __push_char(_CharT(0xC));
- ++__first;
- break;
- case 'n':
- if (__str)
- *__str = _CharT(0xA);
- else
- __push_char(_CharT(0xA));
- ++__first;
- break;
- case 'r':
- if (__str)
- *__str = _CharT(0xD);
- else
- __push_char(_CharT(0xD));
- ++__first;
- break;
- case 't':
- if (__str)
- *__str = _CharT(0x9);
- else
- __push_char(_CharT(0x9));
- ++__first;
- break;
- case 'v':
- if (__str)
- *__str = _CharT(0xB);
- else
- __push_char(_CharT(0xB));
- ++__first;
- break;
- case 'c':
- if ((__t = std::next(__first)) != __last)
- {
- if (('A' <= *__t && *__t <= 'Z') ||
- ('a' <= *__t && *__t <= 'z'))
- {
- if (__str)
- *__str = _CharT(*__t % 32);
- else
- __push_char(_CharT(*__t % 32));
- __first = ++__t;
- }
- else
- __throw_regex_error<regex_constants::error_escape>();
- }
- else
- __throw_regex_error<regex_constants::error_escape>();
- break;
- case 'u':
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- // fallthrough
- case 'x':
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- ++__first;
- if (__first == __last)
- __throw_regex_error<regex_constants::error_escape>();
- __hd = __traits_.value(*__first, 16);
- if (__hd == -1)
- __throw_regex_error<regex_constants::error_escape>();
- __sum = 16 * __sum + static_cast<unsigned>(__hd);
- if (__str)
- *__str = _CharT(__sum);
- else
- __push_char(_CharT(__sum));
- ++__first;
- break;
- case '0':
- if (__str)
- *__str = _CharT(0);
- else
- __push_char(_CharT(0));
- ++__first;
- break;
- default:
- if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum))
- {
- if (__str)
- *__str = *__first;
- else
- __push_char(*__first);
- ++__first;
- }
- else
- __throw_regex_error<regex_constants::error_escape>();
- break;
- }
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape(
+ _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str) {
+ if (__first != __last) {
+ _ForwardIterator __t;
+ unsigned __sum = 0;
+ int __hd;
+ switch (*__first) {
+ case 'f':
+ if (__str)
+ *__str = _CharT(0xC);
+ else
+ __push_char(_CharT(0xC));
+ ++__first;
+ break;
+ case 'n':
+ if (__str)
+ *__str = _CharT(0xA);
+ else
+ __push_char(_CharT(0xA));
+ ++__first;
+ break;
+ case 'r':
+ if (__str)
+ *__str = _CharT(0xD);
+ else
+ __push_char(_CharT(0xD));
+ ++__first;
+ break;
+ case 't':
+ if (__str)
+ *__str = _CharT(0x9);
+ else
+ __push_char(_CharT(0x9));
+ ++__first;
+ break;
+ case 'v':
+ if (__str)
+ *__str = _CharT(0xB);
+ else
+ __push_char(_CharT(0xB));
+ ++__first;
+ break;
+ case 'c':
+ if ((__t = std::next(__first)) != __last) {
+ if (('A' <= *__t && *__t <= 'Z') || ('a' <= *__t && *__t <= 'z')) {
+ if (__str)
+ *__str = _CharT(*__t % 32);
+ else
+ __push_char(_CharT(*__t % 32));
+ __first = ++__t;
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ break;
+ case 'u':
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ // fallthrough
+ case 'x':
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ ++__first;
+ if (__first == __last)
+ __throw_regex_error<regex_constants::error_escape>();
+ __hd = __traits_.value(*__first, 16);
+ if (__hd == -1)
+ __throw_regex_error<regex_constants::error_escape>();
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
+ if (__str)
+ *__str = _CharT(__sum);
+ else
+ __push_char(_CharT(__sum));
+ ++__first;
+ break;
+ case '0':
+ if (__str)
+ *__str = _CharT(0);
+ else
+ __push_char(_CharT(0));
+ ++__first;
+ break;
+ default:
+ if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum)) {
+ if (__str)
+ *__str = *__first;
+ else
+ __push_char(*__first);
+ ++__first;
+ } else
+ __throw_regex_error<regex_constants::error_escape>();
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_pattern_character(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- if (__first != __last)
- {
- switch (*__first)
- {
- case '^':
- case '$':
- case '\\':
- case '.':
- case '*':
- case '+':
- case '?':
- case '(':
- case ')':
- case '[':
- case ']':
- case '{':
- case '}':
- case '|':
- break;
- default:
- __push_char(*__first);
- ++__first;
- break;
- }
+basic_regex<_CharT, _Traits>::__parse_pattern_character(_ForwardIterator __first, _ForwardIterator __last) {
+ if (__first != __last) {
+ switch (*__first) {
+ case '^':
+ case '$':
+ case '\\':
+ case '.':
+ case '*':
+ case '+':
+ case '?':
+ case '(':
+ case ')':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '|':
+ break;
+ default:
+ __push_char(*__first);
+ ++__first;
+ break;
}
- return __first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_grep(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_grep(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+ if (__t1 != __first)
+ __parse_basic_reg_exp(__first, __t1);
+ else
+ __push_empty();
+ __first = __t1;
+ if (__first != __last)
+ ++__first;
+ while (__first != __last) {
+ __t1 = std::find(__first, __last, _CharT('\n'));
+ __owns_one_state<_CharT>* __sb = __end_;
if (__t1 != __first)
- __parse_basic_reg_exp(__first, __t1);
+ __parse_basic_reg_exp(__first, __t1);
else
- __push_empty();
+ __push_empty();
+ __push_alternation(__sa, __sb);
__first = __t1;
if (__first != __last)
- ++__first;
- while (__first != __last)
- {
- __t1 = std::find(__first, __last, _CharT('\n'));
- __owns_one_state<_CharT>* __sb = __end_;
- if (__t1 != __first)
- __parse_basic_reg_exp(__first, __t1);
- else
- __push_empty();
- __push_alternation(__sa, __sb);
- __first = __t1;
- if (__first != __last)
- ++__first;
- }
- return __first;
+ ++__first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
template <class _ForwardIterator>
-_ForwardIterator
-basic_regex<_CharT, _Traits>::__parse_egrep(_ForwardIterator __first,
- _ForwardIterator __last)
-{
- __owns_one_state<_CharT>* __sa = __end_;
- _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+_ForwardIterator basic_regex<_CharT, _Traits>::__parse_egrep(_ForwardIterator __first, _ForwardIterator __last) {
+ __owns_one_state<_CharT>* __sa = __end_;
+ _ForwardIterator __t1 = std::find(__first, __last, _CharT('\n'));
+ if (__t1 != __first)
+ __parse_extended_reg_exp(__first, __t1);
+ else
+ __push_empty();
+ __first = __t1;
+ if (__first != __last)
+ ++__first;
+ while (__first != __last) {
+ __t1 = std::find(__first, __last, _CharT('\n'));
+ __owns_one_state<_CharT>* __sb = __end_;
if (__t1 != __first)
- __parse_extended_reg_exp(__first, __t1);
+ __parse_extended_reg_exp(__first, __t1);
else
- __push_empty();
+ __push_empty();
+ __push_alternation(__sa, __sb);
__first = __t1;
if (__first != __last)
- ++__first;
- while (__first != __last)
- {
- __t1 = std::find(__first, __last, _CharT('\n'));
- __owns_one_state<_CharT>* __sb = __end_;
- if (__t1 != __first)
- __parse_extended_reg_exp(__first, __t1);
- else
- __push_empty();
- __push_alternation(__sa, __sb);
- __first = __t1;
- if (__first != __last)
- ++__first;
- }
- return __first;
+ ++__first;
+ }
+ return __first;
}
template <class _CharT, class _Traits>
-bool
-basic_regex<_CharT, _Traits>::__test_back_ref(_CharT __c)
-{
- unsigned __val = __traits_.value(__c, 10);
- if (__val >= 1 && __val <= 9)
- {
- if (__val > mark_count())
- __throw_regex_error<regex_constants::error_backref>();
- __push_back_ref(__val);
- return true;
- }
+bool basic_regex<_CharT, _Traits>::__test_back_ref(_CharT __c) {
+ unsigned __val = __traits_.value(__c, 10);
+ if (__val >= 1 && __val <= 9) {
+ if (__val > mark_count())
+ __throw_regex_error<regex_constants::error_backref>();
+ __push_back_ref(__val);
+ return true;
+ }
- return false;
+ return false;
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_loop(size_t __min, size_t __max,
- __owns_one_state<_CharT>* __s, size_t __mexp_begin, size_t __mexp_end,
- bool __greedy)
-{
- unique_ptr<__empty_state<_CharT> > __e1(new __empty_state<_CharT>(__end_->first()));
- __end_->first() = nullptr;
- unique_ptr<__loop<_CharT> > __e2(new __loop<_CharT>(__loop_count_,
- __s->first(), __e1.get(), __mexp_begin, __mexp_end, __greedy,
- __min, __max));
- __s->first() = nullptr;
- __e1.release();
- __end_->first() = new __repeat_one_loop<_CharT>(__e2.get());
- __end_ = __e2->second();
- __s->first() = __e2.release();
- ++__loop_count_;
+void basic_regex<_CharT, _Traits>::__push_loop(
+ size_t __min, size_t __max, __owns_one_state<_CharT>* __s, size_t __mexp_begin, size_t __mexp_end, bool __greedy) {
+ unique_ptr<__empty_state<_CharT> > __e1(new __empty_state<_CharT>(__end_->first()));
+ __end_->first() = nullptr;
+ unique_ptr<__loop<_CharT> > __e2(
+ new __loop<_CharT>(__loop_count_, __s->first(), __e1.get(), __mexp_begin, __mexp_end, __greedy, __min, __max));
+ __s->first() = nullptr;
+ __e1.release();
+ __end_->first() = new __repeat_one_loop<_CharT>(__e2.get());
+ __end_ = __e2->second();
+ __s->first() = __e2.release();
+ ++__loop_count_;
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_char(value_type __c)
-{
- if (flags() & icase)
- __end_->first() = new __match_char_icase<_CharT, _Traits>
- (__traits_, __c, __end_->first());
- else if (flags() & collate)
- __end_->first() = new __match_char_collate<_CharT, _Traits>
- (__traits_, __c, __end_->first());
- else
- __end_->first() = new __match_char<_CharT>(__c, __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_char(value_type __c) {
+ if (flags() & icase)
+ __end_->first() = new __match_char_icase<_CharT, _Traits>(__traits_, __c, __end_->first());
+ else if (flags() & collate)
+ __end_->first() = new __match_char_collate<_CharT, _Traits>(__traits_, __c, __end_->first());
+ else
+ __end_->first() = new __match_char<_CharT>(__c, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_begin_marked_subexpression()
-{
- if (!(__flags_ & nosubs))
- {
- __end_->first() =
- new __begin_marked_subexpression<_CharT>(++__marked_count_,
- __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
- }
+void basic_regex<_CharT, _Traits>::__push_begin_marked_subexpression() {
+ if (!(__flags_ & nosubs)) {
+ __end_->first() = new __begin_marked_subexpression<_CharT>(++__marked_count_, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+ }
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub)
-{
- if (!(__flags_ & nosubs))
- {
- __end_->first() =
- new __end_marked_subexpression<_CharT>(__sub, __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
- }
+void basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub) {
+ if (!(__flags_ & nosubs)) {
+ __end_->first() = new __end_marked_subexpression<_CharT>(__sub, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+ }
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_l_anchor()
-{
- __end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_l_anchor() {
+ __end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_r_anchor()
-{
- __end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_r_anchor() {
+ __end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_match_any()
-{
- __end_->first() = new __match_any<_CharT>(__end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_match_any() {
+ __end_->first() = new __match_any<_CharT>(__end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_match_any_but_newline()
-{
- __end_->first() = new __match_any_but_newline<_CharT>(__end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_match_any_but_newline() {
+ __end_->first() = new __match_any_but_newline<_CharT>(__end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_empty()
-{
- __end_->first() = new __empty_state<_CharT>(__end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_empty() {
+ __end_->first() = new __empty_state<_CharT>(__end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_word_boundary(bool __invert)
-{
- __end_->first() = new __word_boundary<_CharT, _Traits>(__traits_, __invert,
- __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_word_boundary(bool __invert) {
+ __end_->first() = new __word_boundary<_CharT, _Traits>(__traits_, __invert, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_back_ref(int __i)
-{
- if (flags() & icase)
- __end_->first() = new __back_ref_icase<_CharT, _Traits>
- (__traits_, __i, __end_->first());
- else if (flags() & collate)
- __end_->first() = new __back_ref_collate<_CharT, _Traits>
- (__traits_, __i, __end_->first());
- else
- __end_->first() = new __back_ref<_CharT>(__i, __end_->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_back_ref(int __i) {
+ if (flags() & icase)
+ __end_->first() = new __back_ref_icase<_CharT, _Traits>(__traits_, __i, __end_->first());
+ else if (flags() & collate)
+ __end_->first() = new __back_ref_collate<_CharT, _Traits>(__traits_, __i, __end_->first());
+ else
+ __end_->first() = new __back_ref<_CharT>(__i, __end_->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_alternation(__owns_one_state<_CharT>* __sa,
- __owns_one_state<_CharT>* __ea)
-{
- __sa->first() = new __alternate<_CharT>(
- static_cast<__owns_one_state<_CharT>*>(__sa->first()),
- static_cast<__owns_one_state<_CharT>*>(__ea->first()));
- __ea->first() = nullptr;
- __ea->first() = new __empty_state<_CharT>(__end_->first());
- __end_->first() = nullptr;
- __end_->first() = new __empty_non_own_state<_CharT>(__ea->first());
- __end_ = static_cast<__owns_one_state<_CharT>*>(__ea->first());
+void basic_regex<_CharT, _Traits>::__push_alternation(__owns_one_state<_CharT>* __sa, __owns_one_state<_CharT>* __ea) {
+ __sa->first() = new __alternate<_CharT>(
+ static_cast<__owns_one_state<_CharT>*>(__sa->first()), static_cast<__owns_one_state<_CharT>*>(__ea->first()));
+ __ea->first() = nullptr;
+ __ea->first() = new __empty_state<_CharT>(__end_->first());
+ __end_->first() = nullptr;
+ __end_->first() = new __empty_non_own_state<_CharT>(__ea->first());
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__ea->first());
}
template <class _CharT, class _Traits>
-__bracket_expression<_CharT, _Traits>*
-basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate)
-{
- __bracket_expression<_CharT, _Traits>* __r =
- new __bracket_expression<_CharT, _Traits>(__traits_, __end_->first(),
- __negate, __flags_ & icase,
- __flags_ & collate);
- __end_->first() = __r;
- __end_ = __r;
- return __r;
+__bracket_expression<_CharT, _Traits>* basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate) {
+ __bracket_expression<_CharT, _Traits>* __r = new __bracket_expression<_CharT, _Traits>(
+ __traits_, __end_->first(), __negate, __flags_ & icase, __flags_ & collate);
+ __end_->first() = __r;
+ __end_ = __r;
+ return __r;
}
template <class _CharT, class _Traits>
-void
-basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
- bool __invert,
- unsigned __mexp)
-{
- __end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert,
- __end_->first(), __mexp);
- __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
+void basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp, bool __invert, unsigned __mexp) {
+ __end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert, __end_->first(), __mexp);
+ __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
// sub_match
-typedef sub_match<const char*> csub_match;
-typedef sub_match<string::const_iterator> ssub_match;
+typedef sub_match<const char*> csub_match;
+typedef sub_match<string::const_iterator> ssub_match;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef sub_match<const wchar_t*> wcsub_match;
+typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<wstring::const_iterator> wssub_match;
#endif
template <class _BidirectionalIterator>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(csub_match)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcsub_match))
- _LIBCPP_PREFERRED_NAME(ssub_match)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wssub_match))
- sub_match
- : public pair<_BidirectionalIterator, _BidirectionalIterator>
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(csub_match)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcsub_match)) _LIBCPP_PREFERRED_NAME(ssub_match)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wssub_match)) sub_match
+ : public pair<_BidirectionalIterator, _BidirectionalIterator> {
public:
- typedef _BidirectionalIterator iterator;
- typedef typename iterator_traits<iterator>::value_type value_type;
- typedef typename iterator_traits<iterator>::difference_type difference_type;
- typedef basic_string<value_type> string_type;
+ typedef _BidirectionalIterator iterator;
+ typedef typename iterator_traits<iterator>::value_type value_type;
+ typedef typename iterator_traits<iterator>::difference_type difference_type;
+ typedef basic_string<value_type> string_type;
- bool matched;
+ bool matched;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR sub_match() : matched() {}
+
+ _LIBCPP_HIDE_FROM_ABI difference_type length() const {
+ return matched ? std::distance(this->first, this->second) : 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const {
+ return matched ? string_type(this->first, this->second) : string_type();
+ }
+ _LIBCPP_HIDE_FROM_ABI operator string_type() const { return str(); }
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR sub_match() : matched() {}
-
- _LIBCPP_HIDE_FROM_ABI
- difference_type length() const
- {return matched ? std::distance(this->first, this->second) : 0;}
- _LIBCPP_HIDE_FROM_ABI
- string_type str() const
- {return matched ? string_type(this->first, this->second) : string_type();}
- _LIBCPP_HIDE_FROM_ABI
- operator string_type() const
- {return str();}
-
- _LIBCPP_HIDE_FROM_ABI
- int compare(const sub_match& __s) const
- {return str().compare(__s.str());}
- _LIBCPP_HIDE_FROM_ABI
- int compare(const string_type& __s) const
- {return str().compare(__s);}
- _LIBCPP_HIDE_FROM_ABI
- int compare(const value_type* __s) const
- {return str().compare(__s);}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(sub_match& __s)
+ _LIBCPP_HIDE_FROM_ABI int compare(const sub_match& __s) const { return str().compare(__s.str()); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return str().compare(__s); }
+ _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return str().compare(__s); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(sub_match& __s)
#ifndef _LIBCPP_CXX03_LANG
- _NOEXCEPT(__is_nothrow_swappable<_BidirectionalIterator>::value)
+ _NOEXCEPT(__is_nothrow_swappable<_BidirectionalIterator>::value)
#endif // _LIBCPP_CXX03_LANG
- {
- this->pair<_BidirectionalIterator, _BidirectionalIterator>::swap(__s);
- std::swap(matched, __s.matched);
- }
+ {
+ this->pair<_BidirectionalIterator, _BidirectionalIterator>::swap(__s);
+ std::swap(matched, __s.matched);
+ }
};
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return __x.compare(__y) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return __x.compare(__y) == 0;
}
#if _LIBCPP_STD_VER >= 20
-template<class _BiIter>
+template <class _BiIter>
using __sub_match_cat = compare_three_way_result_t<basic_string<typename iterator_traits<_BiIter>::value_type>>;
template <class _BiIter>
_LIBCPP_HIDE_FROM_ABI auto operator<=>(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
- return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
+ return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return __x.compare(__y) < 0;
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return __x.compare(__y) < 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const sub_match<_BiIter>& __x, const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator==(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) == 0;
+ const sub_match<_BiIter>& __y) {
+ return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) == 0;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator!=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+ const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) > 0;
+ const sub_match<_BiIter>& __y) {
+ return __y.compare(typename sub_match<_BiIter>::string_type(__x.data(), __x.size())) > 0;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator>(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+ const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator>=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
+ const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<=(const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+ const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator==(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) == 0;
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) == 0;
}
#if _LIBCPP_STD_VER >= 20
template <class _BiIter, class _ST, class _SA>
-_LIBCPP_HIDE_FROM_ABI auto operator<=>(
- const sub_match<_BiIter>& __x, const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
- return static_cast<__sub_match_cat<_BiIter>>(
- __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) <=> 0);
+_LIBCPP_HIDE_FROM_ABI auto
+operator<=>(const sub_match<_BiIter>& __x,
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return static_cast<__sub_match_cat<_BiIter>>(
+ __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator!=(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return !(__x == __y);
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return !(__x == __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) < 0;
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return __x.compare(typename sub_match<_BiIter>::string_type(__y.data(), __y.size())) < 0;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool operator>(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const sub_match<_BiIter>& __x,
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return __y < __x;
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator>=(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return !(__x < __y);
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return !(__x < __y);
}
template <class _BiIter, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator<=(const sub_match<_BiIter>& __x,
- const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y)
-{
- return !(__y < __x);
+ const basic_string<typename iterator_traits<_BiIter>::value_type, _ST, _SA>& __y) {
+ return !(__y < __x);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(__x) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return __y.compare(__x) == 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return __y.compare(__x) > 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return __y.compare(__x) > 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(typename iterator_traits<_BiIter>::value_type const* __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(typename iterator_traits<_BiIter>::value_type const* __x, const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return __x.compare(__y) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return __x.compare(__y) == 0;
}
#if _LIBCPP_STD_VER >= 20
template <class _BiIter>
_LIBCPP_HIDE_FROM_ABI auto
operator<=>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
- return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
+ return static_cast<__sub_match_cat<_BiIter>>(__x.compare(__y) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return __x.compare(__y) < 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return __x.compare(__y) < 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const* __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const* __y) {
+ return !(__y < __x);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __y.compare(string_type(1, __x)) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __y.compare(string_type(1, __x)) == 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __y.compare(string_type(1, __x)) > 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __y.compare(string_type(1, __x)) > 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(typename iterator_traits<_BiIter>::value_type const& __x,
- const sub_match<_BiIter>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(typename iterator_traits<_BiIter>::value_type const& __x, const sub_match<_BiIter>& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __x.compare(string_type(1, __y)) == 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __x.compare(string_type(1, __y)) == 0;
}
#if _LIBCPP_STD_VER >= 20
template <class _BiIter>
_LIBCPP_HIDE_FROM_ABI auto
operator<=>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
- using string_type = basic_string<typename iterator_traits<_BiIter>::value_type>;
- return static_cast<__sub_match_cat<_BiIter>>(__x.compare(string_type(1, __y)) <=> 0);
+ using string_type = basic_string<typename iterator_traits<_BiIter>::value_type>;
+ return static_cast<__sub_match_cat<_BiIter>>(__x.compare(string_type(1, __y)) <=> 0);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return !(__x == __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
- return __x.compare(string_type(1, __y)) < 0;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ typedef basic_string<typename iterator_traits<_BiIter>::value_type> string_type;
+ return __x.compare(string_type(1, __y)) < 0;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return __y < __x;
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return !(__x < __y);
}
template <class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const sub_match<_BiIter>& __x,
- typename iterator_traits<_BiIter>::value_type const& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const sub_match<_BiIter>& __x, typename iterator_traits<_BiIter>::value_type const& __y) {
+ return !(__y < __x);
}
#endif // _LIBCPP_STD_VER >= 20
template <class _CharT, class _ST, class _BiIter>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_ostream<_CharT, _ST>&
-operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
-{
- return __os << __m.str();
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _ST>&
+operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m) {
+ return __os << __m.str();
}
-typedef match_results<const char*> cmatch;
-typedef match_results<string::const_iterator> smatch;
+typedef match_results<const char*> cmatch;
+typedef match_results<string::const_iterator> smatch;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef match_results<const wchar_t*> wcmatch;
+typedef match_results<const wchar_t*> wcmatch;
typedef match_results<wstring::const_iterator> wsmatch;
#endif
template <class _BidirectionalIterator, class _Allocator>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(cmatch)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcmatch))
- _LIBCPP_PREFERRED_NAME(smatch)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsmatch))
- match_results
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(cmatch) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcmatch))
+ _LIBCPP_PREFERRED_NAME(smatch) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsmatch)) match_results {
public:
- typedef _Allocator allocator_type;
- typedef sub_match<_BidirectionalIterator> value_type;
+ typedef _Allocator allocator_type;
+ typedef sub_match<_BidirectionalIterator> value_type;
+
private:
- typedef vector<value_type, allocator_type> __container_type;
+ typedef vector<value_type, allocator_type> __container_type;
- __container_type __matches_;
- value_type __unmatched_;
- value_type __prefix_;
- value_type __suffix_;
- bool __ready_;
-public:
- _BidirectionalIterator __position_start_;
- typedef const value_type& const_reference;
- typedef value_type& reference;
- typedef typename __container_type::const_iterator const_iterator;
- typedef const_iterator iterator;
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
- typedef typename allocator_traits<allocator_type>::size_type size_type;
- typedef typename iterator_traits<_BidirectionalIterator>::value_type char_type;
- typedef basic_string<char_type> string_type;
+ __container_type __matches_;
+ value_type __unmatched_;
+ value_type __prefix_;
+ value_type __suffix_;
+ bool __ready_;
- // construct/copy/destroy:
+public:
+ _BidirectionalIterator __position_start_;
+ typedef const value_type& const_reference;
+ typedef value_type& reference;
+ typedef typename __container_type::const_iterator const_iterator;
+ typedef const_iterator iterator;
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
+ typedef typename allocator_traits<allocator_type>::size_type size_type;
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type char_type;
+ typedef basic_string<char_type> string_type;
+
+ // construct/copy/destroy:
#ifndef _LIBCPP_CXX03_LANG
- match_results() : match_results(allocator_type()) {}
- explicit match_results(const allocator_type& __a);
+ match_results() : match_results(allocator_type()) {}
+ explicit match_results(const allocator_type& __a);
#else
- explicit match_results(const allocator_type& __a = allocator_type());
+ explicit match_results(const allocator_type& __a = allocator_type());
#endif
-// match_results(const match_results&) = default;
-// match_results& operator=(const match_results&) = default;
-// match_results(match_results&& __m) = default;
-// match_results& operator=(match_results&& __m) = default;
-// ~match_results() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- bool ready() const {return __ready_;}
-
- // size:
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __matches_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __matches_.max_size();}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return size() == 0;}
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI
- difference_type length(size_type __sub = 0) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready");
- return (*this)[__sub].length();
- }
- _LIBCPP_HIDE_FROM_ABI
- difference_type position(size_type __sub = 0) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::position() called when not ready");
- return std::distance(__position_start_, (*this)[__sub].first);
- }
- _LIBCPP_HIDE_FROM_ABI
- string_type str(size_type __sub = 0) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::str() called when not ready");
- return (*this)[__sub].str();
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference operator[](size_type __n) const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::operator[]() called when not ready");
- return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const_reference prefix() const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::prefix() called when not ready");
- return __prefix_;
- }
- _LIBCPP_HIDE_FROM_ABI
- const_reference suffix() const
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::suffix() called when not ready");
- return __suffix_;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const {return __matches_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const {return __matches_.end();}
-
- // format:
- template <class _OutputIter>
- _OutputIter
- format(_OutputIter __output_iter, const char_type* __fmt_first,
- const char_type* __fmt_last,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const;
- template <class _OutputIter, class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- _OutputIter
- format(_OutputIter __output_iter, const basic_string<char_type, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const
- {return format(__output_iter, __fmt.data(), __fmt.data() + __fmt.size(), __flags);}
- template <class _ST, class _SA>
- _LIBCPP_HIDE_FROM_ABI
- basic_string<char_type, _ST, _SA>
- format(const basic_string<char_type, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const
- {
- basic_string<char_type, _ST, _SA> __r;
- format(std::back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(),
- __flags);
- return __r;
- }
- _LIBCPP_HIDE_FROM_ABI
- string_type
- format(const char_type* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::format_default) const
- {
- string_type __r;
- format(std::back_inserter(__r), __fmt,
- __fmt + char_traits<char_type>::length(__fmt), __flags);
- return __r;
- }
-
- // allocator:
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const {return __matches_.get_allocator();}
-
- // swap:
- void swap(match_results& __m);
-
- template <class _Bp, class _Ap>
- _LIBCPP_HIDE_FROM_ABI
- void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
- const match_results<_Bp, _Ap>& __m, bool __no_update_pos)
- {
- _Bp __mf = __m.prefix().first;
- __matches_.resize(__m.size());
- for (size_type __i = 0; __i < __matches_.size(); ++__i)
- {
- __matches_[__i].first = std::next(__f, std::distance(__mf, __m[__i].first));
- __matches_[__i].second = std::next(__f, std::distance(__mf, __m[__i].second));
- __matches_[__i].matched = __m[__i].matched;
- }
- __unmatched_.first = __l;
- __unmatched_.second = __l;
- __unmatched_.matched = false;
- __prefix_.first = std::next(__f, std::distance(__mf, __m.prefix().first));
- __prefix_.second = std::next(__f, std::distance(__mf, __m.prefix().second));
- __prefix_.matched = __m.prefix().matched;
- __suffix_.first = std::next(__f, std::distance(__mf, __m.suffix().first));
- __suffix_.second = std::next(__f, std::distance(__mf, __m.suffix().second));
- __suffix_.matched = __m.suffix().matched;
- if (!__no_update_pos)
- __position_start_ = __prefix_.first;
- __ready_ = __m.ready();
+ // match_results(const match_results&) = default;
+ // match_results& operator=(const match_results&) = default;
+ // match_results(match_results&& __m) = default;
+ // match_results& operator=(match_results&& __m) = default;
+ // ~match_results() = default;
+
+ _LIBCPP_HIDE_FROM_ABI bool ready() const { return __ready_; }
+
+ // size:
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __matches_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __matches_.max_size(); }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; }
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI difference_type length(size_type __sub = 0) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready");
+ return (*this)[__sub].length();
+ }
+ _LIBCPP_HIDE_FROM_ABI difference_type position(size_type __sub = 0) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::position() called when not ready");
+ return std::distance(__position_start_, (*this)[__sub].first);
+ }
+ _LIBCPP_HIDE_FROM_ABI string_type str(size_type __sub = 0) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::str() called when not ready");
+ return (*this)[__sub].str();
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::operator[]() called when not ready");
+ return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const_reference prefix() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::prefix() called when not ready");
+ return __prefix_;
+ }
+ _LIBCPP_HIDE_FROM_ABI const_reference suffix() const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::suffix() called when not ready");
+ return __suffix_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return empty() ? __matches_.end() : __matches_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __matches_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const { return empty() ? __matches_.end() : __matches_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const { return __matches_.end(); }
+
+ // format:
+ template <class _OutputIter>
+ _OutputIter format(_OutputIter __output_iter,
+ const char_type* __fmt_first,
+ const char_type* __fmt_last,
+ regex_constants::match_flag_type __flags = regex_constants::format_default) const;
+ template <class _OutputIter, class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI _OutputIter
+ format(_OutputIter __output_iter,
+ const basic_string<char_type, _ST, _SA>& __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::format_default) const {
+ return format(__output_iter, __fmt.data(), __fmt.data() + __fmt.size(), __flags);
+ }
+ template <class _ST, class _SA>
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, _ST, _SA>
+ format(const basic_string<char_type, _ST, _SA>& __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::format_default) const {
+ basic_string<char_type, _ST, _SA> __r;
+ format(std::back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(), __flags);
+ return __r;
+ }
+ _LIBCPP_HIDE_FROM_ABI string_type
+ format(const char_type* __fmt, regex_constants::match_flag_type __flags = regex_constants::format_default) const {
+ string_type __r;
+ format(std::back_inserter(__r), __fmt, __fmt + char_traits<char_type>::length(__fmt), __flags);
+ return __r;
+ }
+
+ // allocator:
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return __matches_.get_allocator(); }
+
+ // swap:
+ void swap(match_results& __m);
+
+ template <class _Bp, class _Ap>
+ _LIBCPP_HIDE_FROM_ABI void
+ __assign(_BidirectionalIterator __f,
+ _BidirectionalIterator __l,
+ const match_results<_Bp, _Ap>& __m,
+ bool __no_update_pos) {
+ _Bp __mf = __m.prefix().first;
+ __matches_.resize(__m.size());
+ for (size_type __i = 0; __i < __matches_.size(); ++__i) {
+ __matches_[__i].first = std::next(__f, std::distance(__mf, __m[__i].first));
+ __matches_[__i].second = std::next(__f, std::distance(__mf, __m[__i].second));
+ __matches_[__i].matched = __m[__i].matched;
}
+ __unmatched_.first = __l;
+ __unmatched_.second = __l;
+ __unmatched_.matched = false;
+ __prefix_.first = std::next(__f, std::distance(__mf, __m.prefix().first));
+ __prefix_.second = std::next(__f, std::distance(__mf, __m.prefix().second));
+ __prefix_.matched = __m.prefix().matched;
+ __suffix_.first = std::next(__f, std::distance(__mf, __m.suffix().first));
+ __suffix_.second = std::next(__f, std::distance(__mf, __m.suffix().second));
+ __suffix_.matched = __m.suffix().matched;
+ if (!__no_update_pos)
+ __position_start_ = __prefix_.first;
+ __ready_ = __m.ready();
+ }
private:
- void __init(unsigned __s,
- _BidirectionalIterator __f, _BidirectionalIterator __l,
- bool __no_update_pos = false);
+ void __init(unsigned __s, _BidirectionalIterator __f, _BidirectionalIterator __l, bool __no_update_pos = false);
- template <class, class> friend class basic_regex;
+ template <class, class>
+ friend class basic_regex;
- template <class _Bp, class _Ap, class _Cp, class _Tp>
- friend
- bool
- regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
- regex_constants::match_flag_type);
+ template <class _Bp, class _Ap, class _Cp, class _Tp>
+ friend bool
+ regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
- template <class _Bp, class _Ap>
- friend
- bool
- operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
+ template <class _Bp, class _Ap>
+ friend bool operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
- template <class, class> friend class __lookahead;
+ template <class, class>
+ friend class __lookahead;
};
template <class _BidirectionalIterator, class _Allocator>
-match_results<_BidirectionalIterator, _Allocator>::match_results(
- const allocator_type& __a)
- : __matches_(__a),
- __unmatched_(),
- __prefix_(),
- __suffix_(),
- __ready_(false),
- __position_start_()
-{
-}
+match_results<_BidirectionalIterator, _Allocator>::match_results(const allocator_type& __a)
+ : __matches_(__a), __unmatched_(), __prefix_(), __suffix_(), __ready_(false), __position_start_() {}
template <class _BidirectionalIterator, class _Allocator>
-void
-match_results<_BidirectionalIterator, _Allocator>::__init(unsigned __s,
- _BidirectionalIterator __f, _BidirectionalIterator __l,
- bool __no_update_pos)
-{
- __unmatched_.first = __l;
- __unmatched_.second = __l;
- __unmatched_.matched = false;
- __matches_.assign(__s, __unmatched_);
- __prefix_.first = __f;
- __prefix_.second = __f;
- __prefix_.matched = false;
- __suffix_ = __unmatched_;
- if (!__no_update_pos)
- __position_start_ = __prefix_.first;
- __ready_ = true;
+void match_results<_BidirectionalIterator, _Allocator>::__init(
+ unsigned __s, _BidirectionalIterator __f, _BidirectionalIterator __l, bool __no_update_pos) {
+ __unmatched_.first = __l;
+ __unmatched_.second = __l;
+ __unmatched_.matched = false;
+ __matches_.assign(__s, __unmatched_);
+ __prefix_.first = __f;
+ __prefix_.second = __f;
+ __prefix_.matched = false;
+ __suffix_ = __unmatched_;
+ if (!__no_update_pos)
+ __position_start_ = __prefix_.first;
+ __ready_ = true;
}
template <class _BidirectionalIterator, class _Allocator>
template <class _OutputIter>
-_OutputIter
-match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_iter,
- const char_type* __fmt_first, const char_type* __fmt_last,
- regex_constants::match_flag_type __flags) const
-{
- _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::format() called when not ready");
- if (__flags & regex_constants::format_sed)
- {
- for (; __fmt_first != __fmt_last; ++__fmt_first)
- {
- if (*__fmt_first == '&')
- __output_iter = std::copy(__matches_[0].first, __matches_[0].second,
- __output_iter);
- else if (*__fmt_first == '\\' && __fmt_first + 1 != __fmt_last)
- {
- ++__fmt_first;
- if ('0' <= *__fmt_first && *__fmt_first <= '9')
- {
- size_t __i = *__fmt_first - '0';
- __output_iter = std::copy((*this)[__i].first,
- (*this)[__i].second, __output_iter);
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
- }
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
- }
+_OutputIter match_results<_BidirectionalIterator, _Allocator>::format(
+ _OutputIter __output_iter,
+ const char_type* __fmt_first,
+ const char_type* __fmt_last,
+ regex_constants::match_flag_type __flags) const {
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::format() called when not ready");
+ if (__flags & regex_constants::format_sed) {
+ for (; __fmt_first != __fmt_last; ++__fmt_first) {
+ if (*__fmt_first == '&')
+ __output_iter = std::copy(__matches_[0].first, __matches_[0].second, __output_iter);
+ else if (*__fmt_first == '\\' && __fmt_first + 1 != __fmt_last) {
+ ++__fmt_first;
+ if ('0' <= *__fmt_first && *__fmt_first <= '9') {
+ size_t __i = *__fmt_first - '0';
+ __output_iter = std::copy((*this)[__i].first, (*this)[__i].second, __output_iter);
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
}
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
+ }
}
- else
- {
- for (; __fmt_first != __fmt_last; ++__fmt_first)
- {
- if (*__fmt_first == '$' && __fmt_first + 1 != __fmt_last)
- {
- switch (__fmt_first[1])
- {
- case '$':
- *__output_iter = *++__fmt_first;
- ++__output_iter;
- break;
- case '&':
- ++__fmt_first;
- __output_iter = std::copy(__matches_[0].first, __matches_[0].second,
- __output_iter);
- break;
- case '`':
- ++__fmt_first;
- __output_iter = std::copy(__prefix_.first, __prefix_.second, __output_iter);
- break;
- case '\'':
- ++__fmt_first;
- __output_iter = std::copy(__suffix_.first, __suffix_.second, __output_iter);
- break;
- default:
- if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9')
- {
- ++__fmt_first;
- size_t __idx = *__fmt_first - '0';
- if (__fmt_first + 1 != __fmt_last &&
- '0' <= __fmt_first[1] && __fmt_first[1] <= '9')
- {
- ++__fmt_first;
- if (__idx >= numeric_limits<size_t>::max() / 10)
- __throw_regex_error<regex_constants::error_escape>();
- __idx = 10 * __idx + *__fmt_first - '0';
- }
- __output_iter = std::copy((*this)[__idx].first,
- (*this)[__idx].second, __output_iter);
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
- }
- break;
- }
- }
- else
- {
- *__output_iter = *__fmt_first;
- ++__output_iter;
+ } else {
+ for (; __fmt_first != __fmt_last; ++__fmt_first) {
+ if (*__fmt_first == '$' && __fmt_first + 1 != __fmt_last) {
+ switch (__fmt_first[1]) {
+ case '$':
+ *__output_iter = *++__fmt_first;
+ ++__output_iter;
+ break;
+ case '&':
+ ++__fmt_first;
+ __output_iter = std::copy(__matches_[0].first, __matches_[0].second, __output_iter);
+ break;
+ case '`':
+ ++__fmt_first;
+ __output_iter = std::copy(__prefix_.first, __prefix_.second, __output_iter);
+ break;
+ case '\'':
+ ++__fmt_first;
+ __output_iter = std::copy(__suffix_.first, __suffix_.second, __output_iter);
+ break;
+ default:
+ if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9') {
+ ++__fmt_first;
+ size_t __idx = *__fmt_first - '0';
+ if (__fmt_first + 1 != __fmt_last && '0' <= __fmt_first[1] && __fmt_first[1] <= '9') {
+ ++__fmt_first;
+ if (__idx >= numeric_limits<size_t>::max() / 10)
+ __throw_regex_error<regex_constants::error_escape>();
+ __idx = 10 * __idx + *__fmt_first - '0';
}
+ __output_iter = std::copy((*this)[__idx].first, (*this)[__idx].second, __output_iter);
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
+ }
+ break;
}
+ } else {
+ *__output_iter = *__fmt_first;
+ ++__output_iter;
+ }
}
- return __output_iter;
+ }
+ return __output_iter;
}
template <class _BidirectionalIterator, class _Allocator>
-void
-match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
-{
- using std::swap;
- swap(__matches_, __m.__matches_);
- swap(__unmatched_, __m.__unmatched_);
- swap(__prefix_, __m.__prefix_);
- swap(__suffix_, __m.__suffix_);
- swap(__position_start_, __m.__position_start_);
- swap(__ready_, __m.__ready_);
+void match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m) {
+ using std::swap;
+ swap(__matches_, __m.__matches_);
+ swap(__unmatched_, __m.__unmatched_);
+ swap(__prefix_, __m.__prefix_);
+ swap(__suffix_, __m.__suffix_);
+ swap(__position_start_, __m.__position_start_);
+ swap(__ready_, __m.__ready_);
}
template <class _BidirectionalIterator, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
- const match_results<_BidirectionalIterator, _Allocator>& __y)
-{
- if (__x.__ready_ != __y.__ready_)
- return false;
- if (!__x.__ready_)
- return true;
- return __x.__matches_ == __y.__matches_ &&
- __x.__prefix_ == __y.__prefix_ &&
- __x.__suffix_ == __y.__suffix_;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
+ const match_results<_BidirectionalIterator, _Allocator>& __y) {
+ if (__x.__ready_ != __y.__ready_)
+ return false;
+ if (!__x.__ready_)
+ return true;
+ return __x.__matches_ == __y.__matches_ && __x.__prefix_ == __y.__prefix_ && __x.__suffix_ == __y.__suffix_;
}
#if _LIBCPP_STD_VER < 20
template <class _BidirectionalIterator, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const match_results<_BidirectionalIterator, _Allocator>& __x,
- const match_results<_BidirectionalIterator, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const match_results<_BidirectionalIterator, _Allocator>& __x,
+ const match_results<_BidirectionalIterator, _Allocator>& __y) {
+ return !(__x == __y);
}
#endif
template <class _BidirectionalIterator, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(match_results<_BidirectionalIterator, _Allocator>& __x,
- match_results<_BidirectionalIterator, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(match_results<_BidirectionalIterator, _Allocator>& __x, match_results<_BidirectionalIterator, _Allocator>& __y) {
+ __x.swap(__y);
}
// regex_search
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start_ecma(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- vector<__state> __states;
- __node* __st = __start_.get();
- if (__st)
- {
- sub_match<const _CharT*> __unmatched;
- __unmatched.first = __last;
- __unmatched.second = __last;
- __unmatched.matched = false;
-
- __states.push_back(__state());
- __states.back().__do_ = 0;
- __states.back().__first_ = __first;
- __states.back().__current_ = __first;
- __states.back().__last_ = __last;
- __states.back().__sub_matches_.resize(mark_count(), __unmatched);
- __states.back().__loop_data_.resize(__loop_count());
- __states.back().__node_ = __st;
- __states.back().__flags_ = __flags;
- __states.back().__at_first_ = __at_first;
- int __counter = 0;
- int __length = __last - __first;
- do
- {
- ++__counter;
- if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 &&
- __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
- __throw_regex_error<regex_constants::error_complexity>();
- __state& __s = __states.back();
- if (__s.__node_)
- __s.__node_->__exec(__s);
- switch (__s.__do_)
- {
- case __state::__end_state:
- if ((__flags & regex_constants::match_not_null) &&
- __s.__current_ == __first)
- {
- __states.pop_back();
- break;
- }
- if ((__flags & regex_constants::__full_match) &&
- __s.__current_ != __last)
- {
- __states.pop_back();
- break;
- }
- __m.__matches_[0].first = __first;
- __m.__matches_[0].second = std::next(__first, __s.__current_ - __first);
- __m.__matches_[0].matched = true;
- for (unsigned __i = 0; __i < __s.__sub_matches_.size(); ++__i)
- __m.__matches_[__i+1] = __s.__sub_matches_[__i];
- return true;
- case __state::__accept_and_consume:
- case __state::__repeat:
- case __state::__accept_but_not_consume:
- break;
- case __state::__split:
- {
- __state __snext = __s;
- __s.__node_->__exec_split(true, __s);
- __snext.__node_->__exec_split(false, __snext);
- __states.push_back(std::move(__snext));
- }
- break;
- case __state::__reject:
- __states.pop_back();
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_unknown>();
- break;
-
- }
- } while (!__states.empty());
- }
- return false;
+bool basic_regex<_CharT, _Traits>::__match_at_start_ecma(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ vector<__state> __states;
+ __node* __st = __start_.get();
+ if (__st) {
+ sub_match<const _CharT*> __unmatched;
+ __unmatched.first = __last;
+ __unmatched.second = __last;
+ __unmatched.matched = false;
+
+ __states.push_back(__state());
+ __states.back().__do_ = 0;
+ __states.back().__first_ = __first;
+ __states.back().__current_ = __first;
+ __states.back().__last_ = __last;
+ __states.back().__sub_matches_.resize(mark_count(), __unmatched);
+ __states.back().__loop_data_.resize(__loop_count());
+ __states.back().__node_ = __st;
+ __states.back().__flags_ = __flags;
+ __states.back().__at_first_ = __at_first;
+ int __counter = 0;
+ int __length = __last - __first;
+ do {
+ ++__counter;
+ if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
+ __throw_regex_error<regex_constants::error_complexity>();
+ __state& __s = __states.back();
+ if (__s.__node_)
+ __s.__node_->__exec(__s);
+ switch (__s.__do_) {
+ case __state::__end_state:
+ if ((__flags & regex_constants::match_not_null) && __s.__current_ == __first) {
+ __states.pop_back();
+ break;
+ }
+ if ((__flags & regex_constants::__full_match) && __s.__current_ != __last) {
+ __states.pop_back();
+ break;
+ }
+ __m.__matches_[0].first = __first;
+ __m.__matches_[0].second = std::next(__first, __s.__current_ - __first);
+ __m.__matches_[0].matched = true;
+ for (unsigned __i = 0; __i < __s.__sub_matches_.size(); ++__i)
+ __m.__matches_[__i + 1] = __s.__sub_matches_[__i];
+ return true;
+ case __state::__accept_and_consume:
+ case __state::__repeat:
+ case __state::__accept_but_not_consume:
+ break;
+ case __state::__split: {
+ __state __snext = __s;
+ __s.__node_->__exec_split(true, __s);
+ __snext.__node_->__exec_split(false, __snext);
+ __states.push_back(std::move(__snext));
+ } break;
+ case __state::__reject:
+ __states.pop_back();
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_unknown>();
+ break;
+ }
+ } while (!__states.empty());
+ }
+ return false;
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- deque<__state> __states;
- ptrdiff_t __highest_j = 0;
- ptrdiff_t __np = std::distance(__first, __last);
- __node* __st = __start_.get();
- if (__st)
- {
- __states.push_back(__state());
- __states.back().__do_ = 0;
- __states.back().__first_ = __first;
- __states.back().__current_ = __first;
- __states.back().__last_ = __last;
- __states.back().__loop_data_.resize(__loop_count());
- __states.back().__node_ = __st;
- __states.back().__flags_ = __flags;
- __states.back().__at_first_ = __at_first;
- bool __matched = false;
- int __counter = 0;
- int __length = __last - __first;
- do
- {
- ++__counter;
- if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 &&
- __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
- __throw_regex_error<regex_constants::error_complexity>();
- __state& __s = __states.back();
- if (__s.__node_)
- __s.__node_->__exec(__s);
- switch (__s.__do_)
- {
- case __state::__end_state:
- if ((__flags & regex_constants::match_not_null) &&
- __s.__current_ == __first)
- {
- __states.pop_back();
- break;
- }
- if ((__flags & regex_constants::__full_match) &&
- __s.__current_ != __last)
- {
- __states.pop_back();
- break;
- }
- if (!__matched || __highest_j < __s.__current_ - __s.__first_)
- __highest_j = __s.__current_ - __s.__first_;
- __matched = true;
- if (__highest_j == __np)
- __states.clear();
- else
- __states.pop_back();
- break;
- case __state::__consume_input:
- break;
- case __state::__accept_and_consume:
- __states.push_front(std::move(__s));
- __states.pop_back();
- break;
- case __state::__repeat:
- case __state::__accept_but_not_consume:
- break;
- case __state::__split:
- {
- __state __snext = __s;
- __s.__node_->__exec_split(true, __s);
- __snext.__node_->__exec_split(false, __snext);
- __states.push_back(std::move(__snext));
- }
- break;
- case __state::__reject:
- __states.pop_back();
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_unknown>();
- break;
- }
- } while (!__states.empty());
- if (__matched)
- {
- __m.__matches_[0].first = __first;
- __m.__matches_[0].second = std::next(__first, __highest_j);
- __m.__matches_[0].matched = true;
- return true;
+bool basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ deque<__state> __states;
+ ptrdiff_t __highest_j = 0;
+ ptrdiff_t __np = std::distance(__first, __last);
+ __node* __st = __start_.get();
+ if (__st) {
+ __states.push_back(__state());
+ __states.back().__do_ = 0;
+ __states.back().__first_ = __first;
+ __states.back().__current_ = __first;
+ __states.back().__last_ = __last;
+ __states.back().__loop_data_.resize(__loop_count());
+ __states.back().__node_ = __st;
+ __states.back().__flags_ = __flags;
+ __states.back().__at_first_ = __at_first;
+ bool __matched = false;
+ int __counter = 0;
+ int __length = __last - __first;
+ do {
+ ++__counter;
+ if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
+ __throw_regex_error<regex_constants::error_complexity>();
+ __state& __s = __states.back();
+ if (__s.__node_)
+ __s.__node_->__exec(__s);
+ switch (__s.__do_) {
+ case __state::__end_state:
+ if ((__flags & regex_constants::match_not_null) && __s.__current_ == __first) {
+ __states.pop_back();
+ break;
+ }
+ if ((__flags & regex_constants::__full_match) && __s.__current_ != __last) {
+ __states.pop_back();
+ break;
}
+ if (!__matched || __highest_j < __s.__current_ - __s.__first_)
+ __highest_j = __s.__current_ - __s.__first_;
+ __matched = true;
+ if (__highest_j == __np)
+ __states.clear();
+ else
+ __states.pop_back();
+ break;
+ case __state::__consume_input:
+ break;
+ case __state::__accept_and_consume:
+ __states.push_front(std::move(__s));
+ __states.pop_back();
+ break;
+ case __state::__repeat:
+ case __state::__accept_but_not_consume:
+ break;
+ case __state::__split: {
+ __state __snext = __s;
+ __s.__node_->__exec_split(true, __s);
+ __snext.__node_->__exec_split(false, __snext);
+ __states.push_back(std::move(__snext));
+ } break;
+ case __state::__reject:
+ __states.pop_back();
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_unknown>();
+ break;
+ }
+ } while (!__states.empty());
+ if (__matched) {
+ __m.__matches_[0].first = __first;
+ __m.__matches_[0].second = std::next(__first, __highest_j);
+ __m.__matches_[0].matched = true;
+ return true;
}
- return false;
+ }
+ return false;
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- vector<__state> __states;
- __state __best_state;
- ptrdiff_t __highest_j = 0;
- ptrdiff_t __np = std::distance(__first, __last);
- __node* __st = __start_.get();
- if (__st)
- {
- sub_match<const _CharT*> __unmatched;
- __unmatched.first = __last;
- __unmatched.second = __last;
- __unmatched.matched = false;
-
- __states.push_back(__state());
- __states.back().__do_ = 0;
- __states.back().__first_ = __first;
- __states.back().__current_ = __first;
- __states.back().__last_ = __last;
- __states.back().__sub_matches_.resize(mark_count(), __unmatched);
- __states.back().__loop_data_.resize(__loop_count());
- __states.back().__node_ = __st;
- __states.back().__flags_ = __flags;
- __states.back().__at_first_ = __at_first;
- bool __matched = false;
- int __counter = 0;
- int __length = __last - __first;
- do
- {
- ++__counter;
- if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 &&
- __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
- __throw_regex_error<regex_constants::error_complexity>();
- __state& __s = __states.back();
- if (__s.__node_)
- __s.__node_->__exec(__s);
- switch (__s.__do_)
- {
- case __state::__end_state:
- if ((__flags & regex_constants::match_not_null) &&
- __s.__current_ == __first)
- {
- __states.pop_back();
- break;
- }
- if ((__flags & regex_constants::__full_match) &&
- __s.__current_ != __last)
- {
- __states.pop_back();
- break;
- }
- if (!__matched || __highest_j < __s.__current_ - __s.__first_)
- {
- __highest_j = __s.__current_ - __s.__first_;
- __best_state = __s;
- }
- __matched = true;
- if (__highest_j == __np)
- __states.clear();
- else
- __states.pop_back();
- break;
- case __state::__accept_and_consume:
- case __state::__repeat:
- case __state::__accept_but_not_consume:
- break;
- case __state::__split:
- {
- __state __snext = __s;
- __s.__node_->__exec_split(true, __s);
- __snext.__node_->__exec_split(false, __snext);
- __states.push_back(std::move(__snext));
- }
- break;
- case __state::__reject:
- __states.pop_back();
- break;
- default:
- __throw_regex_error<regex_constants::__re_err_unknown>();
- break;
- }
- } while (!__states.empty());
- if (__matched)
- {
- __m.__matches_[0].first = __first;
- __m.__matches_[0].second = std::next(__first, __highest_j);
- __m.__matches_[0].matched = true;
- for (unsigned __i = 0; __i < __best_state.__sub_matches_.size(); ++__i)
- __m.__matches_[__i+1] = __best_state.__sub_matches_[__i];
- return true;
+bool basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ vector<__state> __states;
+ __state __best_state;
+ ptrdiff_t __highest_j = 0;
+ ptrdiff_t __np = std::distance(__first, __last);
+ __node* __st = __start_.get();
+ if (__st) {
+ sub_match<const _CharT*> __unmatched;
+ __unmatched.first = __last;
+ __unmatched.second = __last;
+ __unmatched.matched = false;
+
+ __states.push_back(__state());
+ __states.back().__do_ = 0;
+ __states.back().__first_ = __first;
+ __states.back().__current_ = __first;
+ __states.back().__last_ = __last;
+ __states.back().__sub_matches_.resize(mark_count(), __unmatched);
+ __states.back().__loop_data_.resize(__loop_count());
+ __states.back().__node_ = __st;
+ __states.back().__flags_ = __flags;
+ __states.back().__at_first_ = __at_first;
+ bool __matched = false;
+ int __counter = 0;
+ int __length = __last - __first;
+ do {
+ ++__counter;
+ if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
+ __throw_regex_error<regex_constants::error_complexity>();
+ __state& __s = __states.back();
+ if (__s.__node_)
+ __s.__node_->__exec(__s);
+ switch (__s.__do_) {
+ case __state::__end_state:
+ if ((__flags & regex_constants::match_not_null) && __s.__current_ == __first) {
+ __states.pop_back();
+ break;
+ }
+ if ((__flags & regex_constants::__full_match) && __s.__current_ != __last) {
+ __states.pop_back();
+ break;
}
+ if (!__matched || __highest_j < __s.__current_ - __s.__first_) {
+ __highest_j = __s.__current_ - __s.__first_;
+ __best_state = __s;
+ }
+ __matched = true;
+ if (__highest_j == __np)
+ __states.clear();
+ else
+ __states.pop_back();
+ break;
+ case __state::__accept_and_consume:
+ case __state::__repeat:
+ case __state::__accept_but_not_consume:
+ break;
+ case __state::__split: {
+ __state __snext = __s;
+ __s.__node_->__exec_split(true, __s);
+ __snext.__node_->__exec_split(false, __snext);
+ __states.push_back(std::move(__snext));
+ } break;
+ case __state::__reject:
+ __states.pop_back();
+ break;
+ default:
+ __throw_regex_error<regex_constants::__re_err_unknown>();
+ break;
+ }
+ } while (!__states.empty());
+ if (__matched) {
+ __m.__matches_[0].first = __first;
+ __m.__matches_[0].second = std::next(__first, __highest_j);
+ __m.__matches_[0].matched = true;
+ for (unsigned __i = 0; __i < __best_state.__sub_matches_.size(); ++__i)
+ __m.__matches_[__i + 1] = __best_state.__sub_matches_[__i];
+ return true;
}
- return false;
+ }
+ return false;
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__match_at_start(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags, bool __at_first) const
-{
- if (__get_grammar(__flags_) == ECMAScript)
- return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
- if (mark_count() == 0)
- return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
- return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
+bool basic_regex<_CharT, _Traits>::__match_at_start(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags,
+ bool __at_first) const {
+ if (__get_grammar(__flags_) == ECMAScript)
+ return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
+ if (mark_count() == 0)
+ return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
+ return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
}
template <class _CharT, class _Traits>
template <class _Allocator>
-bool
-basic_regex<_CharT, _Traits>::__search(
- const _CharT* __first, const _CharT* __last,
- match_results<const _CharT*, _Allocator>& __m,
- regex_constants::match_flag_type __flags) const
-{
- if (__flags & regex_constants::match_prev_avail)
- __flags &= ~(regex_constants::match_not_bol | regex_constants::match_not_bow);
-
- __m.__init(1 + mark_count(), __first, __last,
- __flags & regex_constants::__no_update_pos);
- if (__match_at_start(__first, __last, __m, __flags,
- !(__flags & regex_constants::__no_update_pos)))
- {
- __m.__prefix_.second = __m[0].first;
+bool basic_regex<_CharT, _Traits>::__search(
+ const _CharT* __first,
+ const _CharT* __last,
+ match_results<const _CharT*, _Allocator>& __m,
+ regex_constants::match_flag_type __flags) const {
+ if (__flags & regex_constants::match_prev_avail)
+ __flags &= ~(regex_constants::match_not_bol | regex_constants::match_not_bow);
+
+ __m.__init(1 + mark_count(), __first, __last, __flags & regex_constants::__no_update_pos);
+ if (__match_at_start(__first, __last, __m, __flags, !(__flags & regex_constants::__no_update_pos))) {
+ __m.__prefix_.second = __m[0].first;
+ __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
+ __m.__suffix_.first = __m[0].second;
+ __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
+ return true;
+ }
+ if (__first != __last && !(__flags & regex_constants::match_continuous)) {
+ __flags |= regex_constants::match_prev_avail;
+ for (++__first; __first != __last; ++__first) {
+ __m.__matches_.assign(__m.size(), __m.__unmatched_);
+ if (__match_at_start(__first, __last, __m, __flags, false)) {
+ __m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
- __m.__suffix_.first = __m[0].second;
+ __m.__suffix_.first = __m[0].second;
__m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
return true;
+ }
+ __m.__matches_.assign(__m.size(), __m.__unmatched_);
}
- if (__first != __last && !(__flags & regex_constants::match_continuous))
- {
- __flags |= regex_constants::match_prev_avail;
- for (++__first; __first != __last; ++__first)
- {
- __m.__matches_.assign(__m.size(), __m.__unmatched_);
- if (__match_at_start(__first, __last, __m, __flags, false))
- {
- __m.__prefix_.second = __m[0].first;
- __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
- __m.__suffix_.first = __m[0].second;
- __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
- return true;
- }
- __m.__matches_.assign(__m.size(), __m.__unmatched_);
- }
- }
- __m.__matches_.clear();
- return false;
+ }
+ __m.__matches_.clear();
+ return false;
}
template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
match_results<_BidirectionalIterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
- basic_string<_CharT> __s(std::prev(__first, __offset), __last);
- match_results<const _CharT*> __mc;
- bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
- __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
+ basic_string<_CharT> __s(std::prev(__first, __offset), __last);
+ match_results<const _CharT*> __mc;
+ bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
+ __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
+ return __r;
}
template <class _Iter, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_search(__wrap_iter<_Iter> __first,
__wrap_iter<_Iter> __last,
match_results<__wrap_iter<_Iter>, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
- __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
+ __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
+ return __r;
}
template <class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __first, const _CharT* __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __first,
+ const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return __e.__search(__first, __last, __m, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return __e.__search(__first, __last, __m, __flags);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT> __s(__first, __last);
- match_results<const _CharT*> __mc;
- return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT> __s(__first, __last);
+ match_results<const _CharT*> __mc;
+ return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __first, const _CharT* __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __first,
+ const _CharT* __last,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- return __e.__search(__first, __last, __mc, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ return __e.__search(__first, __last, __mc, __flags);
}
template <class _CharT, class _Allocator, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __str, match_results<const _CharT*, _Allocator>& __m,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __str,
+ match_results<const _CharT*, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return __e.__search(__str, __str + _Traits::length(__str), __m, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return __e.__search(__str, __str + _Traits::length(__str), __m, __flags);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_search(const _CharT* __str, const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __m;
- return std::regex_search(__str, __m, __e, __flags);
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_search(const _CharT* __str,
+ const basic_regex<_CharT, _Traits>& __e,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __m;
+ return std::regex_search(__str, __m, __e, __flags);
}
template <class _ST, class _SA, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_search(const basic_string<_CharT, _ST, _SA>& __s,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ return __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
}
template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_search(const basic_string<_CharT, _ST, _SA>& __s,
match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<const _CharT*> __mc;
- bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
- __m.__assign(__s.begin(), __s.end(), __mc, __flags & regex_constants::__no_update_pos);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<const _CharT*> __mc;
+ bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
+ __m.__assign(__s.begin(), __s.end(), __mc, __flags & regex_constants::__no_update_pos);
+ return __r;
}
#if _LIBCPP_STD_VER >= 14
template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
-bool
-regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
- match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
- const basic_regex<_Cp, _Tp>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
+bool regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
+ match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
+ const basic_regex<_Cp, _Tp>& __e,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
#endif
// regex_match
template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI bool
-regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last,
+regex_match(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
match_results<_BidirectionalIterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- bool __r = std::regex_search(
- __first, __last, __m, __e,
- __flags | regex_constants::match_continuous |
- regex_constants::__full_match);
- if (__r)
- {
- __r = !__m.suffix().matched;
- if (!__r)
- __m.__matches_.clear();
- }
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ bool __r = std::regex_search(
+ __first, __last, __m, __e, __flags | regex_constants::match_continuous | regex_constants::__full_match);
+ if (__r) {
+ __r = !__m.suffix().matched;
+ if (!__r)
+ __m.__matches_.clear();
+ }
+ return __r;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_match(_BidirectionalIterator __first, _BidirectionalIterator __last,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_match(_BidirectionalIterator __first,
+ _BidirectionalIterator __last,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- match_results<_BidirectionalIterator> __m;
- return std::regex_match(__first, __last, __m, __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ match_results<_BidirectionalIterator> __m;
+ return std::regex_match(__first, __last, __m, __e, __flags);
}
template <class _CharT, class _Allocator, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_match(const _CharT* __str, match_results<const _CharT*, _Allocator>& __m,
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_match(const _CharT* __str,
+ match_results<const _CharT*, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__str, __str + _Traits::length(__str), __m, __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__str, __str + _Traits::length(__str), __m, __e, __flags);
}
template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_match(const basic_string<_CharT, _ST, _SA>& __s,
match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__s.begin(), __s.end(), __m, __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__s.begin(), __s.end(), __m, __e, __flags);
}
#if _LIBCPP_STD_VER >= 14
template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
@@ -6361,576 +5283,491 @@ regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
#endif
template <class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-regex_match(const _CharT* __str, const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__str, __str + _Traits::length(__str), __e, __flags);
+inline _LIBCPP_HIDE_FROM_ABI bool
+regex_match(const _CharT* __str,
+ const basic_regex<_CharT, _Traits>& __e,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__str, __str + _Traits::length(__str), __e, __flags);
}
template <class _ST, class _SA, class _CharT, class _Traits>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
regex_match(const basic_string<_CharT, _ST, _SA>& __s,
const basic_regex<_CharT, _Traits>& __e,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_match(__s.begin(), __s.end(), __e, __flags);
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_match(__s.begin(), __s.end(), __e, __flags);
}
// regex_iterator
template <class _BidirectionalIterator,
- class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
+ class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS regex_iterator;
+class _LIBCPP_TEMPLATE_VIS regex_iterator;
-typedef regex_iterator<const char*> cregex_iterator;
-typedef regex_iterator<string::const_iterator> sregex_iterator;
+typedef regex_iterator<const char*> cregex_iterator;
+typedef regex_iterator<string::const_iterator> sregex_iterator;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef regex_iterator<const wchar_t*> wcregex_iterator;
+typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
#endif
template <class _BidirectionalIterator, class _CharT, class _Traits>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(cregex_iterator)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_iterator))
- _LIBCPP_PREFERRED_NAME(sregex_iterator)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator))
- regex_iterator
-{
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(cregex_iterator)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_iterator)) _LIBCPP_PREFERRED_NAME(sregex_iterator)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator)) regex_iterator {
public:
- typedef basic_regex<_CharT, _Traits> regex_type;
- typedef match_results<_BidirectionalIterator> value_type;
- typedef ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef forward_iterator_tag iterator_category;
+ typedef basic_regex<_CharT, _Traits> regex_type;
+ typedef match_results<_BidirectionalIterator> value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef forward_iterator_tag iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef input_iterator_tag iterator_concept;
+ typedef input_iterator_tag iterator_concept;
#endif
private:
- _BidirectionalIterator __begin_;
- _BidirectionalIterator __end_;
- const regex_type* __pregex_;
- regex_constants::match_flag_type __flags_;
- value_type __match_;
+ _BidirectionalIterator __begin_;
+ _BidirectionalIterator __end_;
+ const regex_type* __pregex_;
+ regex_constants::match_flag_type __flags_;
+ value_type __match_;
public:
- regex_iterator();
- regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- regex_constants::match_flag_type __m
- = regex_constants::match_default);
+ regex_iterator();
+ regex_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re,
- regex_constants::match_flag_type __m
- = regex_constants::match_default) = delete;
+ regex_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
- _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_iterator& __x) const;
+ _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_iterator& __x) const;
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const { return *this == regex_iterator(); }
+ _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const { return *this == regex_iterator(); }
#endif
#if _LIBCPP_STD_VER < 20
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const regex_iterator& __x) const {return !(*this == __x);}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const regex_iterator& __x) const { return !(*this == __x); }
#endif
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __match_;}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return std::addressof(__match_);}
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __match_; }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return std::addressof(__match_); }
- regex_iterator& operator++();
- _LIBCPP_HIDE_FROM_ABI
- regex_iterator operator++(int)
- {
- regex_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ regex_iterator& operator++();
+ _LIBCPP_HIDE_FROM_ABI regex_iterator operator++(int) {
+ regex_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
};
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_iterator()
- : __begin_(), __end_(), __pregex_(nullptr), __flags_(), __match_()
-{
-}
+ : __begin_(), __end_(), __pregex_(nullptr), __flags_(), __match_() {}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, regex_constants::match_flag_type __m)
- : __begin_(__a),
- __end_(__b),
- __pregex_(std::addressof(__re)),
- __flags_(__m)
-{
- std::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ regex_constants::match_flag_type __m)
+ : __begin_(__a), __end_(__b), __pregex_(std::addressof(__re)), __flags_(__m) {
+ std::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-bool
-regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
- operator==(const regex_iterator& __x) const
-{
- if (__match_.empty() && __x.__match_.empty())
- return true;
- if (__match_.empty() || __x.__match_.empty())
- return false;
- return __begin_ == __x.__begin_ &&
- __end_ == __x.__end_ &&
- __pregex_ == __x.__pregex_ &&
- __flags_ == __x.__flags_ &&
- __match_[0] == __x.__match_[0];
+bool regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator==(const regex_iterator& __x) const {
+ if (__match_.empty() && __x.__match_.empty())
+ return true;
+ if (__match_.empty() || __x.__match_.empty())
+ return false;
+ return __begin_ == __x.__begin_ && __end_ == __x.__end_ && __pregex_ == __x.__pregex_ && __flags_ == __x.__flags_ &&
+ __match_[0] == __x.__match_[0];
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_iterator<_BidirectionalIterator, _CharT, _Traits>&
-regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
-{
- __flags_ |= regex_constants::__no_update_pos;
- _BidirectionalIterator __start = __match_[0].second;
- if (__match_[0].first == __match_[0].second)
- {
- if (__start == __end_)
- {
- __match_ = value_type();
- return *this;
- }
- else if (std::regex_search(__start, __end_, __match_, *__pregex_,
- __flags_ | regex_constants::match_not_null |
- regex_constants::match_continuous))
- return *this;
- else
- ++__start;
- }
- __flags_ |= regex_constants::match_prev_avail;
- if (!std::regex_search(__start, __end_, __match_, *__pregex_, __flags_))
- __match_ = value_type();
- return *this;
+regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() {
+ __flags_ |= regex_constants::__no_update_pos;
+ _BidirectionalIterator __start = __match_[0].second;
+ if (__match_[0].first == __match_[0].second) {
+ if (__start == __end_) {
+ __match_ = value_type();
+ return *this;
+ } else if (std::regex_search(__start,
+ __end_,
+ __match_,
+ *__pregex_,
+ __flags_ | regex_constants::match_not_null | regex_constants::match_continuous))
+ return *this;
+ else
+ ++__start;
+ }
+ __flags_ |= regex_constants::match_prev_avail;
+ if (!std::regex_search(__start, __end_, __match_, *__pregex_, __flags_))
+ __match_ = value_type();
+ return *this;
}
// regex_token_iterator
template <class _BidirectionalIterator,
- class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
+ class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
+class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
-typedef regex_token_iterator<const char*> cregex_token_iterator;
-typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
+typedef regex_token_iterator<const char*> cregex_token_iterator;
+typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#endif
template <class _BidirectionalIterator, class _CharT, class _Traits>
-class
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(cregex_token_iterator)
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_PREFERRED_NAME(cregex_token_iterator)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_token_iterator))
- _LIBCPP_PREFERRED_NAME(sregex_token_iterator)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_token_iterator))
- regex_token_iterator
-{
+ _LIBCPP_PREFERRED_NAME(sregex_token_iterator)
+ _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_token_iterator)) regex_token_iterator {
public:
- typedef basic_regex<_CharT, _Traits> regex_type;
- typedef sub_match<_BidirectionalIterator> value_type;
- typedef ptrdiff_t difference_type;
- typedef const value_type* pointer;
- typedef const value_type& reference;
- typedef forward_iterator_tag iterator_category;
+ typedef basic_regex<_CharT, _Traits> regex_type;
+ typedef sub_match<_BidirectionalIterator> value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef forward_iterator_tag iterator_category;
#if _LIBCPP_STD_VER >= 20
- typedef input_iterator_tag iterator_concept;
+ typedef input_iterator_tag iterator_concept;
#endif
private:
- typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Position;
+ typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Position;
- _Position __position_;
- const value_type* __result_;
- value_type __suffix_;
- ptrdiff_t __n_;
- vector<int> __subs_;
+ _Position __position_;
+ const value_type* __result_;
+ value_type __suffix_;
+ ptrdiff_t __n_;
+ vector<int> __subs_;
public:
- regex_token_iterator();
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, int __submatch = 0,
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
+ regex_token_iterator();
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ int __submatch = 0,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re, int __submatch = 0,
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ int __submatch = 0,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, const vector<int>& __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const vector<int>& __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re, const vector<int>& __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ const vector<int>& __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
#ifndef _LIBCPP_CXX03_LANG
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- initializer_list<int> __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
-
-#if _LIBCPP_STD_VER >= 14
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type&& __re,
- initializer_list<int> __submatches,
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
-#endif
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ initializer_list<int> __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default);
+
+# if _LIBCPP_STD_VER >= 14
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ initializer_list<int> __submatches,
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
+# endif
#endif // _LIBCPP_CXX03_LANG
- template <size_t _Np>
- regex_token_iterator(_BidirectionalIterator __a,
- _BidirectionalIterator __b,
- const regex_type& __re,
- const int (&__submatches)[_Np],
- regex_constants::match_flag_type __m =
- regex_constants::match_default);
+ template <size_t _Np>
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const int (&__submatches)[_Np],
+ regex_constants::match_flag_type __m = regex_constants::match_default);
#if _LIBCPP_STD_VER >= 14
- template <size_t _Np>
- regex_token_iterator(_BidirectionalIterator __a,
- _BidirectionalIterator __b,
- const regex_type&& __re,
- const int (&__submatches)[_Np],
- regex_constants::match_flag_type __m =
- regex_constants::match_default) = delete;
+ template <size_t _Np>
+ regex_token_iterator(_BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type&& __re,
+ const int (&__submatches)[_Np],
+ regex_constants::match_flag_type __m = regex_constants::match_default) = delete;
#endif
- regex_token_iterator(const regex_token_iterator&);
- regex_token_iterator& operator=(const regex_token_iterator&);
+ regex_token_iterator(const regex_token_iterator&);
+ regex_token_iterator& operator=(const regex_token_iterator&);
- _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_token_iterator& __x) const;
+ _LIBCPP_HIDE_FROM_ABI bool operator==(const regex_token_iterator& __x) const;
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const {
- return *this == regex_token_iterator();
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const {
+ return *this == regex_token_iterator();
+ }
#endif
#if _LIBCPP_STD_VER < 20
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const regex_token_iterator& __x) const {return !(*this == __x);}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const regex_token_iterator& __x) const { return !(*this == __x); }
#endif
- _LIBCPP_HIDE_FROM_ABI
- const value_type& operator*() const {return *__result_;}
- _LIBCPP_HIDE_FROM_ABI
- const value_type* operator->() const {return __result_;}
+ _LIBCPP_HIDE_FROM_ABI const value_type& operator*() const { return *__result_; }
+ _LIBCPP_HIDE_FROM_ABI const value_type* operator->() const { return __result_; }
- regex_token_iterator& operator++();
- _LIBCPP_HIDE_FROM_ABI
- regex_token_iterator operator++(int)
- {
- regex_token_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ regex_token_iterator& operator++();
+ _LIBCPP_HIDE_FROM_ABI regex_token_iterator operator++(int) {
+ regex_token_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
private:
- void __init(_BidirectionalIterator __a, _BidirectionalIterator __b);
- void __establish_result () {
- if (__subs_[__n_] == -1)
- __result_ = &__position_->prefix();
- else
- __result_ = &(*__position_)[__subs_[__n_]];
- }
+ void __init(_BidirectionalIterator __a, _BidirectionalIterator __b);
+ void __establish_result() {
+ if (__subs_[__n_] == -1)
+ __result_ = &__position_->prefix();
+ else
+ __result_ = &(*__position_)[__subs_[__n_]];
+ }
};
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator()
- : __result_(nullptr),
- __suffix_(),
- __n_(0)
-{
-}
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator()
+ : __result_(nullptr), __suffix_(), __n_(0) {}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-void
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- __init(_BidirectionalIterator __a, _BidirectionalIterator __b)
-{
- if (__position_ != _Position())
- __establish_result ();
- else if (__subs_[__n_] == -1)
- {
- __suffix_.matched = true;
- __suffix_.first = __a;
- __suffix_.second = __b;
- __result_ = &__suffix_;
- }
- else
- __result_ = nullptr;
+void regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::__init(
+ _BidirectionalIterator __a, _BidirectionalIterator __b) {
+ if (__position_ != _Position())
+ __establish_result();
+ else if (__subs_[__n_] == -1) {
+ __suffix_.matched = true;
+ __suffix_.first = __a;
+ __suffix_.second = __b;
+ __result_ = &__suffix_;
+ } else
+ __result_ = nullptr;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, int __submatch,
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(1, __submatch)
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ int __submatch,
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(1, __submatch) {
+ __init(__a, __b);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re, const vector<int>& __submatches,
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(__submatches)
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const vector<int>& __submatches,
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(__submatches) {
+ __init(__a, __b);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- initializer_list<int> __submatches,
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(__submatches)
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ initializer_list<int> __submatches,
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(__submatches) {
+ __init(__a, __b);
}
#endif // _LIBCPP_CXX03_LANG
template <class _BidirectionalIterator, class _CharT, class _Traits>
template <size_t _Np>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
- const regex_type& __re,
- const int (&__submatches)[_Np],
- regex_constants::match_flag_type __m)
- : __position_(__a, __b, __re, __m),
- __n_(0),
- __subs_(begin(__submatches), end(__submatches))
-{
- __init(__a, __b);
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(
+ _BidirectionalIterator __a,
+ _BidirectionalIterator __b,
+ const regex_type& __re,
+ const int (&__submatches)[_Np],
+ regex_constants::match_flag_type __m)
+ : __position_(__a, __b, __re, __m), __n_(0), __subs_(begin(__submatches), end(__submatches)) {
+ __init(__a, __b);
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- regex_token_iterator(const regex_token_iterator& __x)
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::regex_token_iterator(const regex_token_iterator& __x)
: __position_(__x.__position_),
__result_(__x.__result_),
__suffix_(__x.__suffix_),
__n_(__x.__n_),
- __subs_(__x.__subs_)
-{
- if (__x.__result_ == &__x.__suffix_)
- __result_ = &__suffix_;
- else if ( __result_ != nullptr )
- __establish_result ();
+ __subs_(__x.__subs_) {
+ if (__x.__result_ == &__x.__suffix_)
+ __result_ = &__suffix_;
+ else if (__result_ != nullptr)
+ __establish_result();
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>&
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- operator=(const regex_token_iterator& __x)
-{
- if (this != &__x)
- {
- __position_ = __x.__position_;
- if (__x.__result_ == &__x.__suffix_)
- __result_ = &__suffix_;
- else
- __result_ = __x.__result_;
- __suffix_ = __x.__suffix_;
- __n_ = __x.__n_;
- __subs_ = __x.__subs_;
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator=(const regex_token_iterator& __x) {
+ if (this != &__x) {
+ __position_ = __x.__position_;
+ if (__x.__result_ == &__x.__suffix_)
+ __result_ = &__suffix_;
+ else
+ __result_ = __x.__result_;
+ __suffix_ = __x.__suffix_;
+ __n_ = __x.__n_;
+ __subs_ = __x.__subs_;
- if ( __result_ != nullptr && __result_ != &__suffix_ )
- __establish_result();
- }
- return *this;
+ if (__result_ != nullptr && __result_ != &__suffix_)
+ __establish_result();
+ }
+ return *this;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
-bool
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
- operator==(const regex_token_iterator& __x) const
-{
- if (__result_ == nullptr && __x.__result_ == nullptr)
- return true;
- if (__result_ == &__suffix_ && __x.__result_ == &__x.__suffix_ &&
- __suffix_ == __x.__suffix_)
- return true;
- if (__result_ == nullptr || __x.__result_ == nullptr)
- return false;
- if (__result_ == &__suffix_ || __x.__result_ == &__x.__suffix_)
- return false;
- return __position_ == __x.__position_ && __n_ == __x.__n_ &&
- __subs_ == __x.__subs_;
+bool regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator==(const regex_token_iterator& __x) const {
+ if (__result_ == nullptr && __x.__result_ == nullptr)
+ return true;
+ if (__result_ == &__suffix_ && __x.__result_ == &__x.__suffix_ && __suffix_ == __x.__suffix_)
+ return true;
+ if (__result_ == nullptr || __x.__result_ == nullptr)
+ return false;
+ if (__result_ == &__suffix_ || __x.__result_ == &__x.__suffix_)
+ return false;
+ return __position_ == __x.__position_ && __n_ == __x.__n_ && __subs_ == __x.__subs_;
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>&
-regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
-{
- _Position __prev = __position_;
- if (__result_ == &__suffix_)
+regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() {
+ _Position __prev = __position_;
+ if (__result_ == &__suffix_)
+ __result_ = nullptr;
+ else if (static_cast<size_t>(__n_ + 1) < __subs_.size()) {
+ ++__n_;
+ __establish_result();
+ } else {
+ __n_ = 0;
+ ++__position_;
+ if (__position_ != _Position())
+ __establish_result();
+ else {
+ if (std::find(__subs_.begin(), __subs_.end(), -1) != __subs_.end() && __prev->suffix().length() != 0) {
+ __suffix_.matched = true;
+ __suffix_.first = __prev->suffix().first;
+ __suffix_.second = __prev->suffix().second;
+ __result_ = &__suffix_;
+ } else
__result_ = nullptr;
- else if (static_cast<size_t>(__n_ + 1) < __subs_.size())
- {
- ++__n_;
- __establish_result();
}
- else
- {
- __n_ = 0;
- ++__position_;
- if (__position_ != _Position())
- __establish_result();
- else
- {
- if (std::find(__subs_.begin(), __subs_.end(), -1) != __subs_.end()
- && __prev->suffix().length() != 0)
- {
- __suffix_.matched = true;
- __suffix_.first = __prev->suffix().first;
- __suffix_.second = __prev->suffix().second;
- __result_ = &__suffix_;
- }
- else
- __result_ = nullptr;
- }
- }
- return *this;
+ }
+ return *this;
}
// regex_replace
-template <class _OutputIterator, class _BidirectionalIterator,
- class _Traits, class _CharT>
-_LIBCPP_HIDE_FROM_ABI _OutputIterator
-regex_replace(_OutputIterator __output_iter,
- _BidirectionalIterator __first, _BidirectionalIterator __last,
- const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Iter;
- _Iter __i(__first, __last, __e, __flags);
- _Iter __eof;
- if (__i == __eof)
- {
- if (!(__flags & regex_constants::format_no_copy))
- __output_iter = std::copy(__first, __last, __output_iter);
- }
- else
- {
- sub_match<_BidirectionalIterator> __lm;
- for (size_t __len = char_traits<_CharT>::length(__fmt); __i != __eof; ++__i)
- {
- if (!(__flags & regex_constants::format_no_copy))
- __output_iter = std::copy(__i->prefix().first, __i->prefix().second, __output_iter);
- __output_iter = __i->format(__output_iter, __fmt, __fmt + __len, __flags);
- __lm = __i->suffix();
- if (__flags & regex_constants::format_first_only)
- break;
- }
- if (!(__flags & regex_constants::format_no_copy))
- __output_iter = std::copy(__lm.first, __lm.second, __output_iter);
+template <class _OutputIterator, class _BidirectionalIterator, class _Traits, class _CharT>
+_LIBCPP_HIDE_FROM_ABI _OutputIterator regex_replace(
+ _OutputIterator __output_iter,
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __last,
+ const basic_regex<_CharT, _Traits>& __e,
+ const _CharT* __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ typedef regex_iterator<_BidirectionalIterator, _CharT, _Traits> _Iter;
+ _Iter __i(__first, __last, __e, __flags);
+ _Iter __eof;
+ if (__i == __eof) {
+ if (!(__flags & regex_constants::format_no_copy))
+ __output_iter = std::copy(__first, __last, __output_iter);
+ } else {
+ sub_match<_BidirectionalIterator> __lm;
+ for (size_t __len = char_traits<_CharT>::length(__fmt); __i != __eof; ++__i) {
+ if (!(__flags & regex_constants::format_no_copy))
+ __output_iter = std::copy(__i->prefix().first, __i->prefix().second, __output_iter);
+ __output_iter = __i->format(__output_iter, __fmt, __fmt + __len, __flags);
+ __lm = __i->suffix();
+ if (__flags & regex_constants::format_first_only)
+ break;
}
- return __output_iter;
+ if (!(__flags & regex_constants::format_no_copy))
+ __output_iter = std::copy(__lm.first, __lm.second, __output_iter);
+ }
+ return __output_iter;
}
-template <class _OutputIterator, class _BidirectionalIterator,
- class _Traits, class _CharT, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-_OutputIterator
-regex_replace(_OutputIterator __output_iter,
- _BidirectionalIterator __first, _BidirectionalIterator __last,
- const basic_regex<_CharT, _Traits>& __e,
- const basic_string<_CharT, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- return std::regex_replace(__output_iter, __first, __last, __e, __fmt.c_str(), __flags);
+template <class _OutputIterator, class _BidirectionalIterator, class _Traits, class _CharT, class _ST, class _SA>
+inline _LIBCPP_HIDE_FROM_ABI _OutputIterator regex_replace(
+ _OutputIterator __output_iter,
+ _BidirectionalIterator __first,
+ _BidirectionalIterator __last,
+ const basic_regex<_CharT, _Traits>& __e,
+ const basic_string<_CharT, _ST, _SA>& __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ return std::regex_replace(__output_iter, __first, __last, __e, __fmt.c_str(), __flags);
}
-template <class _Traits, class _CharT, class _ST, class _SA, class _FST,
- class _FSA>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT, _ST, _SA>
+template <class _Traits, class _CharT, class _ST, class _SA, class _FST, class _FSA>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT, _ST, _SA>
regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
const basic_regex<_CharT, _Traits>& __e,
const basic_string<_CharT, _FST, _FSA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT, _ST, _SA> __r;
- std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e,
- __fmt.c_str(), __flags);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT, _ST, _SA> __r;
+ std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e, __fmt.c_str(), __flags);
+ return __r;
}
template <class _Traits, class _CharT, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT, _ST, _SA>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT, _ST, _SA>
regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
- const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT, _ST, _SA> __r;
- std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e,
- __fmt, __flags);
- return __r;
+ const basic_regex<_CharT, _Traits>& __e,
+ const _CharT* __fmt,
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT, _ST, _SA> __r;
+ std::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e, __fmt, __flags);
+ return __r;
}
template <class _Traits, class _CharT, class _ST, class _SA>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT>
regex_replace(const _CharT* __s,
const basic_regex<_CharT, _Traits>& __e,
const basic_string<_CharT, _ST, _SA>& __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT> __r;
- std::regex_replace(std::back_inserter(__r), __s,
- __s + char_traits<_CharT>::length(__s), __e,
- __fmt.c_str(), __flags);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT> __r;
+ std::regex_replace(std::back_inserter(__r), __s, __s + char_traits<_CharT>::length(__s), __e, __fmt.c_str(), __flags);
+ return __r;
}
template <class _Traits, class _CharT>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_string<_CharT>
+inline _LIBCPP_HIDE_FROM_ABI basic_string<_CharT>
regex_replace(const _CharT* __s,
const basic_regex<_CharT, _Traits>& __e,
const _CharT* __fmt,
- regex_constants::match_flag_type __flags = regex_constants::match_default)
-{
- basic_string<_CharT> __r;
- std::regex_replace(std::back_inserter(__r), __s,
- __s + char_traits<_CharT>::length(__s), __e,
- __fmt, __flags);
- return __r;
+ regex_constants::match_flag_type __flags = regex_constants::match_default) {
+ basic_string<_CharT> __r;
+ std::regex_replace(std::back_inserter(__r), __s, __s + char_traits<_CharT>::length(__s), __e, __fmt, __flags);
+ return __r;
}
_LIBCPP_END_NAMESPACE_STD
@@ -6939,15 +5776,16 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_BEGIN_NAMESPACE_STD
namespace pmr {
template <class _BidirT>
-using match_results _LIBCPP_AVAILABILITY_PMR = std::match_results<_BidirT, polymorphic_allocator<std::sub_match<_BidirT>>>;
+using match_results _LIBCPP_AVAILABILITY_PMR =
+ std::match_results<_BidirT, polymorphic_allocator<std::sub_match<_BidirT>>>;
-using cmatch _LIBCPP_AVAILABILITY_PMR = match_results<const char*>;
-using smatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::string::const_iterator>;
+using cmatch _LIBCPP_AVAILABILITY_PMR = match_results<const char*>;
+using smatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::string::const_iterator>;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wcmatch _LIBCPP_AVAILABILITY_PMR = match_results<const wchar_t*>;
using wsmatch _LIBCPP_AVAILABILITY_PMR = match_results<std::pmr::wstring::const_iterator>;
-#endif
+# endif
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD
#endif
diff --git a/contrib/llvm-project/libcxx/include/scoped_allocator b/contrib/llvm-project/libcxx/include/scoped_allocator
index d0bc847332e8..6078906e9224 100644
--- a/contrib/llvm-project/libcxx/include/scoped_allocator
+++ b/contrib/llvm-project/libcxx/include/scoped_allocator
@@ -139,563 +139,418 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// scoped_allocator_adaptor
-template <class ..._Allocs>
+template <class... _Allocs>
class scoped_allocator_adaptor;
-template <class ..._Allocs> struct __get_poc_copy_assignment;
+template <class... _Allocs>
+struct __get_poc_copy_assignment;
template <class _A0>
-struct __get_poc_copy_assignment<_A0>
-{
- static const bool value = allocator_traits<_A0>::
- propagate_on_container_copy_assignment::value;
+struct __get_poc_copy_assignment<_A0> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_copy_assignment::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_poc_copy_assignment<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
- __get_poc_copy_assignment<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_poc_copy_assignment<_A0, _Allocs...> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
+ __get_poc_copy_assignment<_Allocs...>::value;
};
-template <class ..._Allocs> struct __get_poc_move_assignment;
+template <class... _Allocs>
+struct __get_poc_move_assignment;
template <class _A0>
-struct __get_poc_move_assignment<_A0>
-{
- static const bool value = allocator_traits<_A0>::
- propagate_on_container_move_assignment::value;
+struct __get_poc_move_assignment<_A0> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_move_assignment::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_poc_move_assignment<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
- __get_poc_move_assignment<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_poc_move_assignment<_A0, _Allocs...> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
+ __get_poc_move_assignment<_Allocs...>::value;
};
-template <class ..._Allocs> struct __get_poc_swap;
+template <class... _Allocs>
+struct __get_poc_swap;
template <class _A0>
-struct __get_poc_swap<_A0>
-{
- static const bool value = allocator_traits<_A0>::
- propagate_on_container_swap::value;
+struct __get_poc_swap<_A0> {
+ static const bool value = allocator_traits<_A0>::propagate_on_container_swap::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_poc_swap<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::propagate_on_container_swap::value ||
- __get_poc_swap<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_poc_swap<_A0, _Allocs...> {
+ static const bool value =
+ allocator_traits<_A0>::propagate_on_container_swap::value || __get_poc_swap<_Allocs...>::value;
};
-template <class ..._Allocs> struct __get_is_always_equal;
+template <class... _Allocs>
+struct __get_is_always_equal;
template <class _A0>
-struct __get_is_always_equal<_A0>
-{
- static const bool value = allocator_traits<_A0>::is_always_equal::value;
+struct __get_is_always_equal<_A0> {
+ static const bool value = allocator_traits<_A0>::is_always_equal::value;
};
-template <class _A0, class ..._Allocs>
-struct __get_is_always_equal<_A0, _Allocs...>
-{
- static const bool value =
- allocator_traits<_A0>::is_always_equal::value &&
- __get_is_always_equal<_Allocs...>::value;
+template <class _A0, class... _Allocs>
+struct __get_is_always_equal<_A0, _Allocs...> {
+ static const bool value = allocator_traits<_A0>::is_always_equal::value && __get_is_always_equal<_Allocs...>::value;
};
-template <class ..._Allocs>
+template <class... _Allocs>
class __scoped_allocator_storage;
template <class _OuterAlloc, class... _InnerAllocs>
-class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
- : public _OuterAlloc
-{
- typedef _OuterAlloc outer_allocator_type;
+class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> : public _OuterAlloc {
+ typedef _OuterAlloc outer_allocator_type;
+
protected:
- typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
+ typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
private:
- inner_allocator_type __inner_;
+ inner_allocator_type __inner_;
protected:
-
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage() _NOEXCEPT {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(_OuterA2&& __outer_alloc,
- const _InnerAllocs& ...__inner_allocs) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)),
- __inner_(__inner_allocs...) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
- : outer_allocator_type(__other.outer_allocator()),
- __inner_(__other.inner_allocator()) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- __scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
- : outer_allocator_type(std::move(__other.outer_allocator())),
- __inner_(std::move(__other.inner_allocator())) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(_OuterA2&& __o,
- const inner_allocator_type& __i) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__o)),
- __inner_(__i)
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI
- inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
- _LIBCPP_HIDE_FROM_ABI
- const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
-
- _LIBCPP_HIDE_FROM_ABI
- outer_allocator_type& outer_allocator() _NOEXCEPT
- {return static_cast<outer_allocator_type&>(*this);}
- _LIBCPP_HIDE_FROM_ABI
- const outer_allocator_type& outer_allocator() const _NOEXCEPT
- {return static_cast<const outer_allocator_type&>(*this);}
-
- scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
- _LIBCPP_HIDE_FROM_ABI
- select_on_container_copy_construction() const _NOEXCEPT
- {
- return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
- (
- allocator_traits<outer_allocator_type>::
- select_on_container_copy_construction(outer_allocator()),
- allocator_traits<inner_allocator_type>::
- select_on_container_copy_construction(inner_allocator())
- );
- }
-
- template <class...> friend class __scoped_allocator_storage;
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage() _NOEXCEPT {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __scoped_allocator_storage(_OuterA2&& __outer_alloc, const _InnerAllocs&... __inner_allocs) _NOEXCEPT
+ : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)),
+ __inner_(__inner_allocs...) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __scoped_allocator_storage(const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
+ : outer_allocator_type(__other.outer_allocator()),
+ __inner_(__other.inner_allocator()) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ __scoped_allocator_storage(__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
+ : outer_allocator_type(std::move(__other.outer_allocator())),
+ __inner_(std::move(__other.inner_allocator())) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(_OuterA2&& __o, const inner_allocator_type& __i) _NOEXCEPT
+ : outer_allocator_type(std::forward<_OuterA2>(__o)),
+ __inner_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return __inner_; }
+ _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT { return __inner_; }
+
+ _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT {
+ return static_cast<outer_allocator_type&>(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
+ return static_cast<const outer_allocator_type&>(*this);
+ }
+
+ scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> _LIBCPP_HIDE_FROM_ABI
+ select_on_container_copy_construction() const _NOEXCEPT {
+ return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>(
+ allocator_traits<outer_allocator_type>::select_on_container_copy_construction(outer_allocator()),
+ allocator_traits<inner_allocator_type>::select_on_container_copy_construction(inner_allocator()));
+ }
+
+ template <class...>
+ friend class __scoped_allocator_storage;
};
template <class _OuterAlloc>
-class __scoped_allocator_storage<_OuterAlloc>
- : public _OuterAlloc
-{
- typedef _OuterAlloc outer_allocator_type;
+class __scoped_allocator_storage<_OuterAlloc> : public _OuterAlloc {
+ typedef _OuterAlloc outer_allocator_type;
+
protected:
- typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
-
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage() _NOEXCEPT {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(_OuterA2&& __outer_alloc) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
- : outer_allocator_type(__other.outer_allocator()) {}
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(
- __scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
- : outer_allocator_type(std::move(__other.outer_allocator())) {}
-
- _LIBCPP_HIDE_FROM_ABI
- inner_allocator_type& inner_allocator() _NOEXCEPT
- {return static_cast<inner_allocator_type&>(*this);}
- _LIBCPP_HIDE_FROM_ABI
- const inner_allocator_type& inner_allocator() const _NOEXCEPT
- {return static_cast<const inner_allocator_type&>(*this);}
-
- _LIBCPP_HIDE_FROM_ABI
- outer_allocator_type& outer_allocator() _NOEXCEPT
- {return static_cast<outer_allocator_type&>(*this);}
- _LIBCPP_HIDE_FROM_ABI
- const outer_allocator_type& outer_allocator() const _NOEXCEPT
- {return static_cast<const outer_allocator_type&>(*this);}
-
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor<outer_allocator_type>
- select_on_container_copy_construction() const _NOEXCEPT
- {return scoped_allocator_adaptor<outer_allocator_type>(
- allocator_traits<outer_allocator_type>::
- select_on_container_copy_construction(outer_allocator())
- );}
-
- __scoped_allocator_storage(const outer_allocator_type& __o,
- const inner_allocator_type& __i) _NOEXCEPT;
-
- template <class...> friend class __scoped_allocator_storage;
+ typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
+
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage() _NOEXCEPT {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(_OuterA2&& __outer_alloc) _NOEXCEPT
+ : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
+ : outer_allocator_type(__other.outer_allocator()) {}
+
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
+ : outer_allocator_type(std::move(__other.outer_allocator())) {}
+
+ _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT {
+ return static_cast<inner_allocator_type&>(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
+ return static_cast<const inner_allocator_type&>(*this);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT {
+ return static_cast<outer_allocator_type&>(*this);
+ }
+ _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
+ return static_cast<const outer_allocator_type&>(*this);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor<outer_allocator_type>
+ select_on_container_copy_construction() const _NOEXCEPT {
+ return scoped_allocator_adaptor<outer_allocator_type>(
+ allocator_traits<outer_allocator_type>::select_on_container_copy_construction(outer_allocator()));
+ }
+
+ __scoped_allocator_storage(const outer_allocator_type& __o, const inner_allocator_type& __i) _NOEXCEPT;
+
+ template <class...>
+ friend class __scoped_allocator_storage;
};
// __outermost
template <class _Alloc>
-decltype(std::declval<_Alloc>().outer_allocator(), true_type())
-__has_outer_allocator_test(_Alloc&& __a);
+decltype(std::declval<_Alloc>().outer_allocator(), true_type()) __has_outer_allocator_test(_Alloc&& __a);
template <class _Alloc>
-false_type
-__has_outer_allocator_test(const volatile _Alloc& __a);
+false_type __has_outer_allocator_test(const volatile _Alloc& __a);
template <class _Alloc>
struct __has_outer_allocator
- : public common_type
- <
- decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>()))
- >::type
-{
-};
+ : public common_type< decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>())) >::type {};
template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
-struct __outermost
-{
- typedef _Alloc type;
- _LIBCPP_HIDE_FROM_ABI
- type& operator()(type& __a) const _NOEXCEPT {return __a;}
+struct __outermost {
+ typedef _Alloc type;
+ _LIBCPP_HIDE_FROM_ABI type& operator()(type& __a) const _NOEXCEPT { return __a; }
};
template <class _Alloc>
-struct __outermost<_Alloc, true>
-{
- typedef __libcpp_remove_reference_t
- <
- decltype(std::declval<_Alloc>().outer_allocator())
- > _OuterAlloc;
- typedef typename __outermost<_OuterAlloc>::type type;
- _LIBCPP_HIDE_FROM_ABI
- type& operator()(_Alloc& __a) const _NOEXCEPT
- {return __outermost<_OuterAlloc>()(__a.outer_allocator());}
+struct __outermost<_Alloc, true> {
+ typedef __libcpp_remove_reference_t< decltype(std::declval<_Alloc>().outer_allocator()) > _OuterAlloc;
+ typedef typename __outermost<_OuterAlloc>::type type;
+ _LIBCPP_HIDE_FROM_ABI type& operator()(_Alloc& __a) const _NOEXCEPT {
+ return __outermost<_OuterAlloc>()(__a.outer_allocator());
+ }
};
template <class _OuterAlloc, class... _InnerAllocs>
class _LIBCPP_TEMPLATE_VIS scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
- : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
-{
- typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
- typedef allocator_traits<_OuterAlloc> _OuterTraits;
-public:
- typedef _OuterAlloc outer_allocator_type;
- typedef typename base::inner_allocator_type inner_allocator_type;
- typedef typename _OuterTraits::size_type size_type;
- typedef typename _OuterTraits::difference_type difference_type;
- typedef typename _OuterTraits::pointer pointer;
- typedef typename _OuterTraits::const_pointer const_pointer;
- typedef typename _OuterTraits::void_pointer void_pointer;
- typedef typename _OuterTraits::const_void_pointer const_void_pointer;
-
- typedef integral_constant
- <
- bool,
- __get_poc_copy_assignment<outer_allocator_type,
- _InnerAllocs...>::value
- > propagate_on_container_copy_assignment;
- typedef integral_constant
- <
- bool,
- __get_poc_move_assignment<outer_allocator_type,
- _InnerAllocs...>::value
- > propagate_on_container_move_assignment;
- typedef integral_constant
- <
- bool,
- __get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
- > propagate_on_container_swap;
- typedef integral_constant
- <
- bool,
- __get_is_always_equal<outer_allocator_type, _InnerAllocs...>::value
- > is_always_equal;
-
- template <class _Tp>
- struct rebind
- {
- typedef scoped_allocator_adaptor
- <
- typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs...
- > other;
- };
-
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor() _NOEXCEPT {}
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(_OuterA2&& __outer_alloc,
- const _InnerAllocs& ...__inner_allocs) _NOEXCEPT
- : base(std::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {}
- // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(
- const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
- : base(__other) {}
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(
- scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
- : base(std::move(__other)) {}
-
- // scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
- // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
- // ~scoped_allocator_adaptor() = default;
-
- _LIBCPP_HIDE_FROM_ABI
- inner_allocator_type& inner_allocator() _NOEXCEPT
- {return base::inner_allocator();}
- _LIBCPP_HIDE_FROM_ABI
- const inner_allocator_type& inner_allocator() const _NOEXCEPT
- {return base::inner_allocator();}
-
- _LIBCPP_HIDE_FROM_ABI
- outer_allocator_type& outer_allocator() _NOEXCEPT
- {return base::outer_allocator();}
- _LIBCPP_HIDE_FROM_ABI
- const outer_allocator_type& outer_allocator() const _NOEXCEPT
- {return base::outer_allocator();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- pointer allocate(size_type __n)
- {return allocator_traits<outer_allocator_type>::
- allocate(outer_allocator(), __n);}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- pointer allocate(size_type __n, const_void_pointer __hint)
- {return allocator_traits<outer_allocator_type>::
- allocate(outer_allocator(), __n, __hint);}
-
- _LIBCPP_HIDE_FROM_ABI
- void deallocate(pointer __p, size_type __n) _NOEXCEPT
- {allocator_traits<outer_allocator_type>::
- deallocate(outer_allocator(), __p, __n);}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const
- {return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
-
-#if _LIBCPP_STD_VER >= 20
- template <class _Type, class... _Args>
- _LIBCPP_HIDE_FROM_ABI void construct(_Type* __ptr, _Args&&... __args) {
- using _OM = __outermost<outer_allocator_type>;
- std::apply(
- [__ptr, this](auto&&... __newargs) {
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()), __ptr, std::forward<decltype(__newargs)>(__newargs)...);
- },
- std::uses_allocator_construction_args<_Type>(inner_allocator(), std::forward<_Args>(__args)...));
- }
-#else
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void construct(_Tp* __p, _Args&& ...__args)
- {__construct(__uses_alloc_ctor<_Tp, inner_allocator_type&, _Args...>(),
- __p, std::forward<_Args>(__args)...);}
-
- template <class _T1, class _T2, class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, piecewise_construct_t,
- tuple<_Args1...> __x, tuple<_Args2...> __y)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()), __p, piecewise_construct
- , __transform_tuple(
- typename __uses_alloc_ctor<
- _T1, inner_allocator_type&, _Args1...
- >::type()
- , std::move(__x)
- , typename __make_tuple_indices<sizeof...(_Args1)>::type{}
- )
- , __transform_tuple(
- typename __uses_alloc_ctor<
- _T2, inner_allocator_type&, _Args2...
- >::type()
- , std::move(__y)
- , typename __make_tuple_indices<sizeof...(_Args2)>::type{}
- )
- );
- }
-
- template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p)
- { construct(__p, piecewise_construct, tuple<>{}, tuple<>{}); }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, _Up&& __x, _Vp&& __y) {
- construct(__p, piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__x)),
- std::forward_as_tuple(std::forward<_Vp>(__y)));
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, const pair<_Up, _Vp>& __x) {
- construct(__p, piecewise_construct,
- std::forward_as_tuple(__x.first),
- std::forward_as_tuple(__x.second));
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, pair<_Up, _Vp>&& __x) {
- construct(__p, piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__x.first)),
- std::forward_as_tuple(std::forward<_Vp>(__x.second)));
- }
-#endif
+ : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> {
+ typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
+ typedef allocator_traits<_OuterAlloc> _OuterTraits;
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI
- void destroy(_Tp* __p)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::
- destroy(_OM()(outer_allocator()), __p);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
- {return base::select_on_container_copy_construction();}
+public:
+ typedef _OuterAlloc outer_allocator_type;
+ typedef typename base::inner_allocator_type inner_allocator_type;
+ typedef typename _OuterTraits::size_type size_type;
+ typedef typename _OuterTraits::difference_type difference_type;
+ typedef typename _OuterTraits::pointer pointer;
+ typedef typename _OuterTraits::const_pointer const_pointer;
+ typedef typename _OuterTraits::void_pointer void_pointer;
+ typedef typename _OuterTraits::const_void_pointer const_void_pointer;
+
+ typedef integral_constant< bool, __get_poc_copy_assignment<outer_allocator_type, _InnerAllocs...>::value >
+ propagate_on_container_copy_assignment;
+ typedef integral_constant< bool, __get_poc_move_assignment<outer_allocator_type, _InnerAllocs...>::value >
+ propagate_on_container_move_assignment;
+ typedef integral_constant< bool, __get_poc_swap<outer_allocator_type, _InnerAllocs...>::value >
+ propagate_on_container_swap;
+ typedef integral_constant< bool, __get_is_always_equal<outer_allocator_type, _InnerAllocs...>::value >
+ is_always_equal;
+
+ template <class _Tp>
+ struct rebind {
+ typedef scoped_allocator_adaptor< typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs... > other;
+ };
+
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor() _NOEXCEPT {}
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ scoped_allocator_adaptor(_OuterA2&& __outer_alloc, const _InnerAllocs&... __inner_allocs) _NOEXCEPT
+ : base(std::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {}
+ // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ scoped_allocator_adaptor(const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
+ : base(__other) {}
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ scoped_allocator_adaptor(scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
+ : base(std::move(__other)) {}
+
+ // scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
+ // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
+ // ~scoped_allocator_adaptor() = default;
+
+ _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return base::inner_allocator(); }
+ _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
+ return base::inner_allocator();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT { return base::outer_allocator(); }
+ _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
+ return base::outer_allocator();
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n) {
+ return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n);
+ }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n, const_void_pointer __hint) {
+ return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n, __hint);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void deallocate(pointer __p, size_type __n) _NOEXCEPT {
+ allocator_traits<outer_allocator_type>::deallocate(outer_allocator(), __p, __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const {
+ return allocator_traits<outer_allocator_type>::max_size(outer_allocator());
+ }
+
+# if _LIBCPP_STD_VER >= 20
+ template <class _Type, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void construct(_Type* __ptr, _Args&&... __args) {
+ using _OM = __outermost<outer_allocator_type>;
+ std::apply(
+ [__ptr, this](auto&&... __newargs) {
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()), __ptr, std::forward<decltype(__newargs)>(__newargs)...);
+ },
+ std::uses_allocator_construction_args<_Type>(inner_allocator(), std::forward<_Args>(__args)...));
+ }
+# else
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Args&&... __args) {
+ __construct(__uses_alloc_ctor<_Tp, inner_allocator_type&, _Args...>(), __p, std::forward<_Args>(__args)...);
+ }
+
+ template <class _T1, class _T2, class... _Args1, class... _Args2>
+ _LIBCPP_HIDE_FROM_ABI void
+ construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()),
+ __p,
+ piecewise_construct,
+ __transform_tuple(typename __uses_alloc_ctor< _T1, inner_allocator_type&, _Args1... >::type(),
+ std::move(__x),
+ typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
+ __transform_tuple(typename __uses_alloc_ctor< _T2, inner_allocator_type&, _Args2... >::type(),
+ std::move(__y),
+ typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
+ }
+
+ template <class _T1, class _T2>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p) {
+ construct(__p, piecewise_construct, tuple<>{}, tuple<>{});
+ }
+
+ template <class _T1, class _T2, class _Up, class _Vp>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, _Up&& __x, _Vp&& __y) {
+ construct(__p,
+ piecewise_construct,
+ std::forward_as_tuple(std::forward<_Up>(__x)),
+ std::forward_as_tuple(std::forward<_Vp>(__y)));
+ }
+
+ template <class _T1, class _T2, class _Up, class _Vp>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, const pair<_Up, _Vp>& __x) {
+ construct(__p, piecewise_construct, std::forward_as_tuple(__x.first), std::forward_as_tuple(__x.second));
+ }
+
+ template <class _T1, class _T2, class _Up, class _Vp>
+ _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, pair<_Up, _Vp>&& __x) {
+ construct(__p,
+ piecewise_construct,
+ std::forward_as_tuple(std::forward<_Up>(__x.first)),
+ std::forward_as_tuple(std::forward<_Vp>(__x.second)));
+ }
+# endif
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI void destroy(_Tp* __p) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::destroy(_OM()(outer_allocator()), __p);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT {
+ return base::select_on_container_copy_construction();
+ }
private:
-
-
- template <class _OuterA2,
- __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(_OuterA2&& __o,
- const inner_allocator_type& __i) _NOEXCEPT
- : base(std::forward<_OuterA2>(__o), __i) {}
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct
- (
- _OM()(outer_allocator()),
- __p,
- std::forward<_Args>(__args)...
- );
- }
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct
- (
- _OM()(outer_allocator()),
- __p, allocator_arg, inner_allocator(),
- std::forward<_Args>(__args)...
- );
- }
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
- {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct
- (
- _OM()(outer_allocator()),
- __p,
- std::forward<_Args>(__args)...,
- inner_allocator()
- );
- }
-
- template <class ..._Args, size_t ..._Idx>
- _LIBCPP_HIDE_FROM_ABI
- tuple<_Args&&...>
- __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t,
- __tuple_indices<_Idx...>)
- {
- return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
- }
-
- template <class ..._Args, size_t ..._Idx>
- _LIBCPP_HIDE_FROM_ABI
- tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
- __transform_tuple(integral_constant<int, 1>, tuple<_Args...> && __t,
- __tuple_indices<_Idx...>)
- {
- using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
- return _Tup(allocator_arg, inner_allocator(),
- std::get<_Idx>(std::move(__t))...);
- }
-
- template <class ..._Args, size_t ..._Idx>
- _LIBCPP_HIDE_FROM_ABI
- tuple<_Args&&..., inner_allocator_type&>
- __transform_tuple(integral_constant<int, 2>, tuple<_Args...> && __t,
- __tuple_indices<_Idx...>)
- {
- using _Tup = tuple<_Args&&..., inner_allocator_type&>;
- return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
- }
-
- template <class...> friend class __scoped_allocator_storage;
+ template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor(_OuterA2&& __o, const inner_allocator_type& __i) _NOEXCEPT
+ : base(std::forward<_OuterA2>(__o), __i) {}
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 0>, _Tp* __p, _Args&&... __args) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(_OM()(outer_allocator()), __p, std::forward<_Args>(__args)...);
+ }
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 1>, _Tp* __p, _Args&&... __args) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()), __p, allocator_arg, inner_allocator(), std::forward<_Args>(__args)...);
+ }
+
+ template <class _Tp, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 2>, _Tp* __p, _Args&&... __args) {
+ typedef __outermost<outer_allocator_type> _OM;
+ allocator_traits<typename _OM::type>::construct(
+ _OM()(outer_allocator()), __p, std::forward<_Args>(__args)..., inner_allocator());
+ }
+
+ template <class... _Args, size_t... _Idx>
+ _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
+ __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
+ }
+
+ template <class... _Args, size_t... _Idx>
+ _LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
+ __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
+ return _Tup(allocator_arg, inner_allocator(), std::get<_Idx>(std::move(__t))...);
+ }
+
+ template <class... _Args, size_t... _Idx>
+ _LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., inner_allocator_type&>
+ __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ using _Tup = tuple<_Args&&..., inner_allocator_type&>;
+ return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
+ }
+
+ template <class...>
+ friend class __scoped_allocator_storage;
};
-#if _LIBCPP_STD_VER >= 17
-template<class _OuterAlloc, class... _InnerAllocs>
- scoped_allocator_adaptor(_OuterAlloc, _InnerAllocs...)
- -> scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>;
-#endif
+# if _LIBCPP_STD_VER >= 17
+template <class _OuterAlloc, class... _InnerAllocs>
+scoped_allocator_adaptor(_OuterAlloc, _InnerAllocs...) -> scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>;
+# endif
template <class _OuterA1, class _OuterA2>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
- const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
-{
- return __a.outer_allocator() == __b.outer_allocator();
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const scoped_allocator_adaptor<_OuterA1>& __a, const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT {
+ return __a.outer_allocator() == __b.outer_allocator();
}
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
+inline _LIBCPP_HIDE_FROM_ABI bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
- const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
-{
- return __a.outer_allocator() == __b.outer_allocator() &&
- __a.inner_allocator() == __b.inner_allocator();
+ const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT {
+ return __a.outer_allocator() == __b.outer_allocator() && __a.inner_allocator() == __b.inner_allocator();
}
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
- const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
-{
- return !(__a == __b);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
+ const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT {
+ return !(__a == __b);
}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
#endif // !defined(_LIBCPP_CXX03_LANG)
diff --git a/contrib/llvm-project/libcxx/include/semaphore b/contrib/llvm-project/libcxx/include/semaphore
index 81f3cd2a7945..de45b8b5db10 100644
--- a/contrib/llvm-project/libcxx/include/semaphore
+++ b/contrib/llvm-project/libcxx/include/semaphore
@@ -64,7 +64,7 @@ using binary_semaphore = counting_semaphore<1>;
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<semaphore> is not supported since libc++ has been configured without support for threads."
+# error "<semaphore> is not supported since libc++ has been configured without support for threads."
#endif
_LIBCPP_PUSH_MACROS
@@ -82,124 +82,95 @@ functions. It avoids contention against users' own use of those facilities.
*/
-#define _LIBCPP_SEMAPHORE_MAX (numeric_limits<ptrdiff_t>::max())
+# define _LIBCPP_SEMAPHORE_MAX (numeric_limits<ptrdiff_t>::max())
-class __atomic_semaphore_base
-{
- __atomic_base<ptrdiff_t> __a_;
+class __atomic_semaphore_base {
+ __atomic_base<ptrdiff_t> __a_;
public:
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count)
- {
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void release(ptrdiff_t __update = 1)
- {
- auto __old = __a_.fetch_add(__update, memory_order_release);
- _LIBCPP_ASSERT_UNCATEGORIZED(__update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value");
-
- if (__old > 0)
- {
- // Nothing to do
- }
- else if (__update > 1)
- __a_.notify_all();
- else
- __a_.notify_one();
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void acquire()
- {
- auto const __test_fn = [this]() -> bool {
- auto __old = __a_.load(memory_order_relaxed);
- return (__old != 0) && __a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed);
- };
- __cxx_atomic_wait(&__a_.__a_, __test_fn);
- }
- template <class _Rep, class _Period>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time)
- {
- if (__rel_time == chrono::duration<_Rep, _Period>::zero())
- return try_acquire();
- auto const __test_fn = [this]() { return try_acquire(); };
- return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire()
- {
- auto __old = __a_.load(memory_order_acquire);
- while (true) {
- if (__old == 0)
- return false;
- if (__a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed))
- return true;
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) {}
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
+ auto __old = __a_.fetch_add(__update, memory_order_release);
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value");
+
+ if (__old > 0) {
+ // Nothing to do
+ } else if (__update > 1)
+ __a_.notify_all();
+ else
+ __a_.notify_one();
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() {
+ auto const __test_fn = [this]() -> bool {
+ auto __old = __a_.load(memory_order_relaxed);
+ return (__old != 0) && __a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed);
+ };
+ __cxx_atomic_wait(&__a_.__a_, __test_fn);
+ }
+ template <class _Rep, class _Period>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
+ if (__rel_time == chrono::duration<_Rep, _Period>::zero())
+ return try_acquire();
+ auto const __test_fn = [this]() { return try_acquire(); };
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() {
+ auto __old = __a_.load(memory_order_acquire);
+ while (true) {
+ if (__old == 0)
+ return false;
+ if (__a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed))
+ return true;
}
+ }
};
-template<ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX>
-class counting_semaphore
-{
- __atomic_semaphore_base __semaphore_;
+template <ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX>
+class counting_semaphore {
+ __atomic_semaphore_base __semaphore_;
public:
- static_assert(__least_max_value >= 0, "The least maximum value must be a positive number");
-
- static constexpr ptrdiff_t max() noexcept {
- return __least_max_value;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count >= 0,
- "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
- "initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __count <= max(),
- "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
- "initialized with a value greater than max()");
- }
- ~counting_semaphore() = default;
-
- counting_semaphore(const counting_semaphore&) = delete;
- counting_semaphore& operator=(const counting_semaphore&) = delete;
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void release(ptrdiff_t __update = 1)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "counting_semaphore:release called with a negative value");
- __semaphore_.release(__update);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- void acquire()
- {
- __semaphore_.acquire();
- }
- template<class _Rep, class _Period>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time)
- {
- return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire()
- {
- return __semaphore_.try_acquire();
- }
- template <class _Clock, class _Duration>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- bool try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time)
- {
- auto const __current = _Clock::now();
- if (__current >= __abs_time)
- return try_acquire();
- else
- return try_acquire_for(__abs_time - __current);
- }
+ static_assert(__least_max_value >= 0, "The least maximum value must be a positive number");
+
+ static constexpr ptrdiff_t max() noexcept { return __least_max_value; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count >= 0,
+ "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
+ "initialized with a negative value");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __count <= max(),
+ "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
+ "initialized with a value greater than max()");
+ }
+ ~counting_semaphore() = default;
+
+ counting_semaphore(const counting_semaphore&) = delete;
+ counting_semaphore& operator=(const counting_semaphore&) = delete;
+
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "counting_semaphore:release called with a negative value");
+ __semaphore_.release(__update);
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() { __semaphore_.acquire(); }
+ template <class _Rep, class _Period>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
+ return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time));
+ }
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() { return __semaphore_.try_acquire(); }
+ template <class _Clock, class _Duration>
+ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
+ try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time) {
+ auto const __current = _Clock::now();
+ if (__current >= __abs_time)
+ return try_acquire();
+ else
+ return try_acquire_for(__abs_time - __current);
+ }
};
using binary_semaphore = counting_semaphore<1>;
diff --git a/contrib/llvm-project/libcxx/include/set b/contrib/llvm-project/libcxx/include/set
index b2d87b93f38d..08677a94054f 100644
--- a/contrib/llvm-project/libcxx/include/set
+++ b/contrib/llvm-project/libcxx/include/set
@@ -557,567 +557,435 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare, class _Allocator>
class multiset;
-template <class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key> >
-class _LIBCPP_TEMPLATE_VIS set
-{
+template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
+class _LIBCPP_TEMPLATE_VIS set {
public:
- // types:
- typedef _Key key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef key_compare value_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types:
+ typedef _Key key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef key_compare value_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __tree<value_type, value_compare, allocator_type> __base;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef __tree<value_type, value_compare, allocator_type> __base;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- __base __tree_;
+ __base __tree_;
public:
- typedef typename __base::pointer pointer;
- typedef typename __base::const_pointer const_pointer;
- typedef typename __base::size_type size_type;
- typedef typename __base::difference_type difference_type;
- typedef typename __base::const_iterator iterator;
- typedef typename __base::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __base::pointer pointer;
+ typedef typename __base::const_pointer const_pointer;
+ typedef typename __base::size_type size_type;
+ typedef typename __base::difference_type difference_type;
+ typedef typename __base::const_iterator iterator;
+ typedef typename __base::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS set;
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multiset;
-
- _LIBCPP_HIDE_FROM_ABI
- set()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(value_compare()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit set(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__comp) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit set(const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- set(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__f, __l);
- }
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__f, __l);
- }
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
+
+ _LIBCPP_HIDE_FROM_ABI set() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(value_compare()) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__comp) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__f, __l);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- set(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ set(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__comp, __a) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : set(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : set(__f, __l, key_compare(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- set(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI set(from_range_t, _Range&& __range, const allocator_type& __a)
: set(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- set(const set& __s)
- : __tree_(__s.__tree_)
- {
- insert(__s.begin(), __s.end());
- }
+ _LIBCPP_HIDE_FROM_ABI set(const set& __s) : __tree_(__s.__tree_) { insert(__s.begin(), __s.end()); }
- _LIBCPP_HIDE_FROM_ABI
- set& operator=(const set& __s)
- {
- __tree_ = __s.__tree_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) {
+ __tree_ = __s.__tree_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- set(set&& __s)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__s.__tree_)) {}
+ _LIBCPP_HIDE_FROM_ABI set(set&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__s.__tree_)) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit set(const allocator_type& __a)
- : __tree_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {}
- _LIBCPP_HIDE_FROM_ABI
- set(const set& __s, const allocator_type& __a)
- : __tree_(__s.__tree_.value_comp(), __a)
- {
- insert(__s.begin(), __s.end());
- }
+ _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __a) : __tree_(__s.__tree_.value_comp(), __a) {
+ insert(__s.begin(), __s.end());
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __a);
-
- _LIBCPP_HIDE_FROM_ABI
- set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- set(initializer_list<value_type> __il, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __a);
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- set(initializer_list<value_type> __il, const allocator_type& __a)
- : set(__il, key_compare(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__il.begin(), __il.end());
+ }
- _LIBCPP_HIDE_FROM_ABI
- set& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_unique(__il.begin(), __il.end());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- set& operator=(set&& __s)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__s.__tree_);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const allocator_type& __a)
+ : set(__il, key_compare(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_unique(__il.begin(), __il.end());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__s.__tree_);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~set() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- // modifiers:
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+
+ // modifiers:
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&&... __args)
- {return __tree_.__emplace_unique(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...);}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...);
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,bool> insert(const value_type& __v)
- {return __tree_.__insert_unique(__v);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_unique(__p, __v);}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_unique(__e, *__f);
- }
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__insert_unique(__v); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_unique(__p, __v);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ __tree_.__insert_unique(__e, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- __tree_.__insert_unique(__end, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ __tree_.__insert_unique(__end, std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,bool> insert(value_type&& __v)
- {return __tree_.__insert_unique(std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
+ return __tree_.__insert_unique(std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_unique(__p, std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_unique(__p, std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k)
- {return __tree_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f, __l);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to set::insert()");
- return __tree_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to set::insert()");
- return __tree_.template __node_handle_insert_unique<node_type>(
- __hint, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_unique(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to set::insert()");
+ return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to set::insert()");
+ return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_unique(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__s.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__s.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const {return __tree_.value_comp();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
- // set operations:
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ // set operations:
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
+ -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<ranges::range_value_t<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
set(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<ranges::range_value_t<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> set<_Key, _Compare, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ -> set<ranges::range_value_t<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Compare = less<_Key>,
+ class _Allocator = allocator<_Key>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) -> set<_Key, _Compare, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
set(_InputIterator, _InputIterator, _Allocator)
- -> set<__iter_value_type<_InputIterator>,
- less<__iter_value_type<_InputIterator>>, _Allocator>;
+ -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
set(from_range_t, _Range&&, _Allocator)
- -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+ -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(initializer_list<_Key>, _Allocator)
- -> set<_Key, less<_Key>, _Allocator>;
+template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+set(initializer_list<_Key>, _Allocator) -> set<_Key, less<_Key>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
-set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
- : __tree_(std::move(__s.__tree_), __a)
-{
- if (__a != __s.get_allocator())
- {
- const_iterator __e = cend();
- while (!__s.empty())
- insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
- }
+set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) {
+ if (__a != __s.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__s.empty())
+ insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const set<_Key, _Compare, _Allocator>& __x,
- const set<_Key, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -1125,590 +993,459 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
operator<=>(const set<_Key, _Allocator>& __x, const set<_Key, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
}
#endif // _LIBCPP_STD_VER <= 17
// specialized algorithms:
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(set<_Key, _Compare, _Allocator>& __x,
- set<_Key, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Key, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename set<_Key, _Compare, _Allocator>::size_type
- erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename set<_Key, _Compare, _Allocator>::size_type
+erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
-template <class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key> >
-class _LIBCPP_TEMPLATE_VIS multiset
-{
+template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
+class _LIBCPP_TEMPLATE_VIS multiset {
public:
- // types:
- typedef _Key key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Compare> key_compare;
- typedef key_compare value_compare;
- typedef __type_identity_t<_Allocator> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types:
+ typedef _Key key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Compare> key_compare;
+ typedef key_compare value_compare;
+ typedef __type_identity_t<_Allocator> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __tree<value_type, value_compare, allocator_type> __base;
- typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef __tree<value_type, value_compare, allocator_type> __base;
+ typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- __base __tree_;
+ __base __tree_;
public:
- typedef typename __base::pointer pointer;
- typedef typename __base::const_pointer const_pointer;
- typedef typename __base::size_type size_type;
- typedef typename __base::difference_type difference_type;
- typedef typename __base::const_iterator iterator;
- typedef typename __base::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef typename __base::pointer pointer;
+ typedef typename __base::const_pointer const_pointer;
+ typedef typename __base::size_type size_type;
+ typedef typename __base::difference_type difference_type;
+ typedef typename __base::const_iterator iterator;
+ typedef typename __base::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
+ typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
#endif
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS set;
- template <class _Key2, class _Compare2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS multiset;
-
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI
- multiset()
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(value_compare()) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit multiset(const value_compare& __comp)
- _NOEXCEPT_(
- is_nothrow_default_constructible<allocator_type>::value &&
- is_nothrow_copy_constructible<key_compare>::value)
- : __tree_(__comp) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit multiset(const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multiset(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__f, __l);
- }
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS set;
+ template <class _Key2, class _Compare2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS multiset;
+
+ // construct/copy/destroy:
+ _LIBCPP_HIDE_FROM_ABI multiset() _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
+ is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(value_compare()) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp) _NOEXCEPT_(
+ is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
+ : __tree_(__comp) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
- : multiset(__f, __l, key_compare(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : multiset(__f, __l, key_compare(), __a) {}
#endif
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- multiset(_InputIterator __f, _InputIterator __l,
- const value_compare& __comp, const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__f, __l);
- }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__f, __l);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multiset(from_range_t, _Range&& __range, const key_compare& __comp = key_compare(),
- const allocator_type& __a = allocator_type())
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ multiset(from_range_t,
+ _Range&& __range,
+ const key_compare& __comp = key_compare(),
+ const allocator_type& __a = allocator_type())
: __tree_(__comp, __a) {
- insert_range(std::forward<_Range>(__range));
- }
+ insert_range(std::forward<_Range>(__range));
+ }
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- multiset(from_range_t, _Range&& __range, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI multiset(from_range_t, _Range&& __range, const allocator_type& __a)
: multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- multiset(const multiset& __s)
- : __tree_(__s.__tree_.value_comp(),
- __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
- {
- insert(__s.begin(), __s.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multiset& operator=(const multiset& __s)
- {
- __tree_ = __s.__tree_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s)
+ : __tree_(__s.__tree_.value_comp(),
+ __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) {
+ insert(__s.begin(), __s.end());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) {
+ __tree_ = __s.__tree_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- multiset(multiset&& __s)
- _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
- : __tree_(std::move(__s.__tree_)) {}
+ _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ : __tree_(std::move(__s.__tree_)) {}
- _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit multiset(const allocator_type& __a)
- : __tree_(__a) {}
- _LIBCPP_HIDE_FROM_ABI
- multiset(const multiset& __s, const allocator_type& __a)
- : __tree_(__s.__tree_.value_comp(), __a)
- {
- insert(__s.begin(), __s.end());
- }
+ _LIBCPP_HIDE_FROM_ABI explicit multiset(const allocator_type& __a) : __tree_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a)
+ : __tree_(__s.__tree_.value_comp(), __a) {
+ insert(__s.begin(), __s.end());
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
- : __tree_(__comp)
- {
- insert(__il.begin(), __il.end());
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multiset(initializer_list<value_type> __il, const value_compare& __comp,
- const allocator_type& __a)
- : __tree_(__comp, __a)
- {
- insert(__il.begin(), __il.end());
- }
+ _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+ : __tree_(__comp) {
+ insert(__il.begin(), __il.end());
+ }
-#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- multiset(initializer_list<value_type> __il, const allocator_type& __a)
- : multiset(__il, key_compare(), __a) {}
-#endif
-
- _LIBCPP_HIDE_FROM_ABI
- multiset& operator=(initializer_list<value_type> __il)
- {
- __tree_.__assign_multi(__il.begin(), __il.end());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI
- multiset& operator=(multiset&& __s)
- _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
- {
- __tree_ = std::move(__s.__tree_);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI
+ multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
+ : __tree_(__comp, __a) {
+ insert(__il.begin(), __il.end());
+ }
+
+# if _LIBCPP_STD_VER >= 14
+ _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const allocator_type& __a)
+ : multiset(__il, key_compare(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI multiset& operator=(initializer_list<value_type> __il) {
+ __tree_.__assign_multi(__il.begin(), __il.end());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ __tree_ = std::move(__s.__tree_);
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~multiset() {
- static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~multiset() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __tree_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __tree_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return end();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT {return rend();}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __tree_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- // modifiers:
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
+ _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+
+ // modifiers:
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace(_Args&&... __args)
- {return __tree_.__emplace_multi(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __v)
- {return __tree_.__insert_multi(__v);}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __v)
- {return __tree_.__insert_multi(__p, __v);}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __f, _InputIterator __l)
- {
- for (const_iterator __e = cend(); __f != __l; ++__f)
- __tree_.__insert_multi(__e, *__f);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__insert_multi(__v); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __tree_.__insert_multi(__p, __v);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ for (const_iterator __e = cend(); __f != __l; ++__f)
+ __tree_.__insert_multi(__e, *__f);
+ }
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- const_iterator __end = cend();
- for (auto&& __element : __range) {
- __tree_.__insert_multi(__end, std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ const_iterator __end = cend();
+ for (auto&& __element : __range) {
+ __tree_.__insert_multi(__end, std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __v)
- {return __tree_.__insert_multi(std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__insert_multi(std::move(__v)); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_multi(__p, std::move(__v));}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __tree_.__insert_multi(__p, std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __tree_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __f, const_iterator __l)
- {return __tree_.erase(__f, __l);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__tree_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multiset::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to multiset::insert()");
- return __tree_.template __node_handle_insert_multi<node_type>(
- __hint, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __tree_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __tree_.template __node_handle_extract<node_type>(__it);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
- template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(set<key_type, _Compare2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __tree_.__node_handle_merge_multi(__source.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multiset::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to multiset::insert()");
+ return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __tree_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __tree_.template __node_handle_extract<node_type>(__it);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
+ template <class _Compare2>
+ _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __tree_.__node_handle_merge_multi(__source.__tree_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(multiset& __s)
- _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
- {__tree_.swap(__s.__tree_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ __tree_.swap(__s.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
- _LIBCPP_HIDE_FROM_ABI
- key_compare key_comp() const {return __tree_.value_comp();}
- _LIBCPP_HIDE_FROM_ABI
- value_compare value_comp() const {return __tree_.value_comp();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
+ _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
+ _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
- // set operations:
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __tree_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
+ // set operations:
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- find(const _K2& __k) {return __tree_.find(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- find(const _K2& __k) const {return __tree_.find(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __tree_.find(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __tree_.find(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const
- {return __tree_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- size_type
- count(const _K2& __k) const {return __tree_.__count_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __tree_.__count_multi(__k);
+ }
#endif
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- bool
- contains(const _K2& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- iterator lower_bound(const key_type& __k)
- {return __tree_.lower_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator lower_bound(const key_type& __k) const
- {return __tree_.lower_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
-
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
+ }
+
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator upper_bound(const key_type& __k)
- {return __tree_.upper_bound(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator upper_bound(const key_type& __k) const
- {return __tree_.upper_bound(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- iterator
- upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator
- upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator> equal_range(const key_type& __k)
- {return __tree_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
- {return __tree_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 14
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator,iterator>
- equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
- template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator,const_iterator>
- equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __tree_.__equal_range_multi(__k);
+ }
+ template <typename _K2, enable_if_t<__is_transparent<_Compare, _K2>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __tree_.__equal_range_multi(__k);
+ }
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Compare = less<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+template <class _InputIterator,
+ class _Compare = less<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
+ -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Compare = less<ranges::range_value_t<_Range>>,
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range,
+ class _Compare = less<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<ranges::range_value_t<_Range>, _Compare, _Allocator>;
-#endif
-
-template<class _Key, class _Compare = less<_Key>,
- class _Allocator = allocator<_Key>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>>
+ -> multiset<ranges::range_value_t<_Range>, _Compare, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Compare = less<_Key>,
+ class _Allocator = allocator<_Key>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<_Key, _Compare, _Allocator>;
+ -> multiset<_Key, _Compare, _Allocator>;
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multiset(_InputIterator, _InputIterator, _Allocator)
- -> multiset<__iter_value_type<_InputIterator>,
- less<__iter_value_type<_InputIterator>>, _Allocator>;
+ -> multiset<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+# if _LIBCPP_STD_VER >= 23
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multiset(from_range_t, _Range&&, _Allocator)
- -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+ -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+# endif
-template<class _Key, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multiset(initializer_list<_Key>, _Allocator)
- -> multiset<_Key, less<_Key>, _Allocator>;
+template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multiset(initializer_list<_Key>, _Allocator) -> multiset<_Key, less<_Key>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
- : __tree_(std::move(__s.__tree_), __a)
-{
- if (__a != __s.get_allocator())
- {
- const_iterator __e = cend();
- while (!__s.empty())
- insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
- }
+ : __tree_(std::move(__s.__tree_), __a) {
+ if (__a != __s.get_allocator()) {
+ const_iterator __e = cend();
+ while (!__s.empty())
+ insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_));
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
- const multiset<_Key, _Compare, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -1716,27 +1453,23 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
operator<=>(const multiset<_Key, _Allocator>& __x, const multiset<_Key, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(multiset<_Key, _Compare, _Allocator>& __x,
- multiset<_Key, _Compare, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Key, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename multiset<_Key, _Compare, _Allocator>::size_type
- erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename multiset<_Key, _Compare, _Allocator>::size_type
+erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/span b/contrib/llvm-project/libcxx/include/span
index f94bda40fa73..7dd53110ac29 100644
--- a/contrib/llvm-project/libcxx/include/span
+++ b/contrib/llvm-project/libcxx/include/span
@@ -144,8 +144,8 @@ template<class R>
#include <__type_traits/remove_reference.h>
#include <__type_traits/type_identity.h>
#include <__utility/forward.h>
-#include <array> // for array
-#include <cstddef> // for byte
+#include <array> // for array
+#include <cstddef> // for byte
#include <version>
// standard-mandated includes
@@ -182,19 +182,20 @@ struct __is_std_span<span<_Tp, _Sz>> : true_type {};
template <class _Range, class _ElementType>
concept __span_compatible_range =
- ranges::contiguous_range<_Range> && //
- ranges::sized_range<_Range> && //
- (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && //
- !__is_std_span<remove_cvref_t<_Range>>::value && //
- !__is_std_array<remove_cvref_t<_Range>>::value && //
- !is_array_v<remove_cvref_t<_Range>> && //
- is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>;
+ ranges::contiguous_range<_Range> && //
+ ranges::sized_range<_Range> && //
+ (ranges::borrowed_range<_Range> || is_const_v<_ElementType>)&& //
+ !__is_std_span<remove_cvref_t<_Range>>::value && //
+ !__is_std_array<remove_cvref_t<_Range>>::value && //
+ !is_array_v<remove_cvref_t<_Range>> && //
+ is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>> (*)[], _ElementType (*)[]>;
template <class _From, class _To>
-concept __span_array_convertible = is_convertible_v<_From(*)[], _To(*)[]>;
+concept __span_array_convertible = is_convertible_v<_From (*)[], _To (*)[]>;
template <class _It, class _Tp>
-concept __span_compatible_iterator = contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>;
+concept __span_compatible_iterator =
+ contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>;
template <class _Sentinel, class _It>
concept __span_compatible_sentinel_for = sized_sentinel_for<_Sentinel, _It> && !is_convertible_v<_Sentinel, size_t>;
@@ -202,356 +203,313 @@ concept __span_compatible_sentinel_for = sized_sentinel_for<_Sentinel, _It> && !
template <typename _Tp, size_t _Extent>
class _LIBCPP_TEMPLATE_VIS span {
public:
-// constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp *;
- using const_pointer = const _Tp *;
- using reference = _Tp &;
- using const_reference = const _Tp &;
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using iterator = __bounded_iter<pointer>;
-#else
- using iterator = __wrap_iter<pointer>;
-#endif
- using reverse_iterator = std::reverse_iterator<iterator>;
-
- static constexpr size_type extent = _Extent;
-
-// [span.cons], span constructors, copy, assignment, and destructor
- template <size_t _Sz = _Extent> requires(_Sz == 0)
- _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
-
- constexpr span (const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
- template <__span_compatible_iterator<element_type> _It>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(_It __first, size_type __count)
- : __data_{std::to_address(__first)} {
- (void)__count;
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __count, "size mismatch in span's constructor (iterator, len)");
- }
-
- template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(_It __first, _End __last) : __data_{std::to_address(__first)} {
- // [span.cons]/10
- // Throws: When and what last - first throws.
- [[maybe_unused]] auto __dist = __last - __first;
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data_{__arr} {}
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
-
- template <class _OtherElementType>
- requires __span_array_convertible<const _OtherElementType, element_type>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
-
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)");
- }
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const span<_OtherElementType, _Extent>& __other)
- : __data_{__other.data()} {}
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI
- constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept
- : __data_{__other.data()} {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- _Extent == __other.size(), "size mismatch in span's constructor (other span)");
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> first() const noexcept
- {
- static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> last() const noexcept
- {
- static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of range");
- return {data(), __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of range");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto subspan() const noexcept
- -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
- {
- static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
- static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset, "span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
-
- using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
- return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent>
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return _Extent == 0; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of range");
- return __data_[__idx];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span");
- return __data_[0];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::back() on empty span");
- return __data_[size()-1];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
-
-// [span.iter], span iterator support
- _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
-#else
- return iterator(data());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
-#else
- return iterator(data() + size());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- _LIBCPP_HIDE_FROM_ABI span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
- { return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte *>(data()), size_bytes()}; }
-
- _LIBCPP_HIDE_FROM_ABI span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept
- { return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte *>(data()), size_bytes()}; }
+ // constants and types
+ using element_type = _Tp;
+ using value_type = remove_cv_t<_Tp>;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ using pointer = _Tp*;
+ using const_pointer = const _Tp*;
+ using reference = _Tp&;
+ using const_reference = const _Tp&;
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ using iterator = __bounded_iter<pointer>;
+# else
+ using iterator = __wrap_iter<pointer>;
+# endif
+ using reverse_iterator = std::reverse_iterator<iterator>;
+
+ static constexpr size_type extent = _Extent;
+
+ // [span.cons], span constructors, copy, assignment, and destructor
+ template <size_t _Sz = _Extent>
+ requires(_Sz == 0)
+ _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
+
+ constexpr span(const span&) noexcept = default;
+ constexpr span& operator=(const span&) noexcept = default;
+
+ template <__span_compatible_iterator<element_type> _It>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, size_type __count) : __data_{std::to_address(__first)} {
+ (void)__count;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __count, "size mismatch in span's constructor (iterator, len)");
+ }
+
+ template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, _End __last) : __data_{std::to_address(__first)} {
+ // [span.cons]/10
+ // Throws: When and what last - first throws.
+ [[maybe_unused]] auto __dist = __last - __first;
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data_{__arr} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
+
+ template <class _OtherElementType>
+ requires __span_array_convertible<const _OtherElementType, element_type>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept
+ : __data_{__arr.data()} {}
+
+ template <__span_compatible_range<element_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)");
+ }
+
+ template <__span_array_convertible<element_type> _OtherElementType>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _Extent>& __other) : __data_{__other.data()} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept
+ : __data_{__other.data()} {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __other.size(), "size mismatch in span's constructor (other span)");
+ }
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
+ static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
+ return span<element_type, _Count>{data(), _Count};
+ }
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
+ static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
+ return span<element_type, _Count>{data() + size() - _Count, _Count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of range");
+ return {data(), __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of range");
+ return {data() + size() - __count, __count};
+ }
+
+ template <size_t _Offset, size_t _Count = dynamic_extent>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto subspan() const noexcept
+ -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
+ static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
+ static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
+ "span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
+
+ using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
+ return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
+ subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
+ if (__count == dynamic_extent)
+ return {data() + __offset, size() - __offset};
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
+ return {data() + __offset, __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return _Extent == 0; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of range");
+ return __data_[__idx];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span");
+ return __data_[0];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::back() on empty span");
+ return __data_[size() - 1];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
+
+ // [span.iter], span iterator support
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data(), data(), data() + size());
+# else
+ return iterator(data());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data() + size(), data(), data() + size());
+# else
+ return iterator(data() + size());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept {
+ return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte*>(data()), size_bytes()};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept {
+ return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte*>(data()), size_bytes()};
+ }
private:
- pointer __data_;
+ pointer __data_;
};
-
template <typename _Tp>
class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
public:
-// constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp *;
- using const_pointer = const _Tp *;
- using reference = _Tp &;
- using const_reference = const _Tp &;
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using iterator = __bounded_iter<pointer>;
-#else
- using iterator = __wrap_iter<pointer>;
-#endif
- using reverse_iterator = std::reverse_iterator<iterator>;
-
- static constexpr size_type extent = dynamic_extent;
-
-// [span.cons], span constructors, copy, assignment, and destructor
- _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
-
- constexpr span (const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
- template <__span_compatible_iterator<element_type> _It>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(_It __first, size_type __count)
- : __data_{std::to_address(__first)}, __size_{__count} {}
-
- template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
- _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, _End __last)
- : __data_(std::to_address(__first)), __size_(__last - __first) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(
- __last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)");
- }
-
- template <size_t _Sz>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data_{__arr}, __size_{_Sz} {}
-
- template <__span_array_convertible<element_type> _OtherElementType, size_t _Sz>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __size_{_Sz} {}
-
- template <class _OtherElementType, size_t _Sz>
- requires __span_array_convertible<const _OtherElementType, element_type>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data_{__arr.data()}, __size_{_Sz} {}
-
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {}
-
- template <__span_array_convertible<element_type> _OtherElementType, size_t _OtherExtent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
- : __data_{__other.data()}, __size_{__other.size()} {}
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> first() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> last() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range");
- return {data(), __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI
- constexpr span<element_type, _Count> subspan() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- _Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count == dynamic_extent || _Count <= size() - _Offset,
- "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
- return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
- constexpr span<element_type, dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return __size_ * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return __size_ == 0; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of range");
- return __data_[__idx];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span");
- return __data_[0];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::back() on empty span");
- return __data_[size()-1];
- }
-
-
- _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
-
-// [span.iter], span iterator support
- _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
-#else
- return iterator(data());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
-#else
- return iterator(data() + size());
-#endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- _LIBCPP_HIDE_FROM_ABI span<const byte, dynamic_extent> __as_bytes() const noexcept
- { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
-
- _LIBCPP_HIDE_FROM_ABI span<byte, dynamic_extent> __as_writable_bytes() const noexcept
- { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
+ // constants and types
+ using element_type = _Tp;
+ using value_type = remove_cv_t<_Tp>;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ using pointer = _Tp*;
+ using const_pointer = const _Tp*;
+ using reference = _Tp&;
+ using const_reference = const _Tp&;
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ using iterator = __bounded_iter<pointer>;
+# else
+ using iterator = __wrap_iter<pointer>;
+# endif
+ using reverse_iterator = std::reverse_iterator<iterator>;
+
+ static constexpr size_type extent = dynamic_extent;
+
+ // [span.cons], span constructors, copy, assignment, and destructor
+ _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
+
+ constexpr span(const span&) noexcept = default;
+ constexpr span& operator=(const span&) noexcept = default;
+
+ template <__span_compatible_iterator<element_type> _It>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, size_type __count)
+ : __data_{std::to_address(__first)}, __size_{__count} {}
+
+ template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, _End __last)
+ : __data_(std::to_address(__first)), __size_(__last - __first) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)");
+ }
+
+ template <size_t _Sz>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept
+ : __data_{__arr}, __size_{_Sz} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType, size_t _Sz>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept
+ : __data_{__arr.data()}, __size_{_Sz} {}
+
+ template <class _OtherElementType, size_t _Sz>
+ requires __span_array_convertible<const _OtherElementType, element_type>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept
+ : __data_{__arr.data()}, __size_{_Sz} {}
+
+ template <__span_compatible_range<element_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {}
+
+ template <__span_array_convertible<element_type> _OtherElementType, size_t _OtherExtent>
+ _LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
+ : __data_{__other.data()}, __size_{__other.size()} {}
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range");
+ return span<element_type, _Count>{data(), _Count};
+ }
+
+ template <size_t _Count>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range");
+ return span<element_type, _Count>{data() + size() - _Count, _Count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range");
+ return {data(), __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
+ return {data() + size() - __count, __count};
+ }
+
+ template <size_t _Offset, size_t _Count = dynamic_extent>
+ _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> subspan() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count == dynamic_extent || _Count <= size() - _Offset,
+ "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
+ return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
+ }
+
+ constexpr span<element_type, dynamic_extent> _LIBCPP_HIDE_FROM_ABI
+ subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
+ if (__count == dynamic_extent)
+ return {data() + __offset, size() - __offset};
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
+ return {data() + __offset, __count};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return __size_ * sizeof(element_type); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return __size_ == 0; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of range");
+ return __data_[__idx];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span");
+ return __data_[0];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::back() on empty span");
+ return __data_[size() - 1];
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
+
+ // [span.iter], span iterator support
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data(), data(), data() + size());
+# else
+ return iterator(data());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
+# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
+ return std::__make_bounded_iter(data() + size(), data(), data() + size());
+# else
+ return iterator(data() + size());
+# endif
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI span<const byte, dynamic_extent> __as_bytes() const noexcept {
+ return {reinterpret_cast<const byte*>(data()), size_bytes()};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI span<byte, dynamic_extent> __as_writable_bytes() const noexcept {
+ return {reinterpret_cast<byte*>(data()), size_bytes()};
+ }
private:
- pointer __data_;
- size_type __size_;
+ pointer __data_;
+ size_type __size_;
};
template <class _Tp, size_t _Extent>
@@ -562,31 +520,32 @@ inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
// as_bytes & as_writable_bytes
template <class _Tp, size_t _Extent>
-_LIBCPP_HIDE_FROM_ABI
-auto as_bytes(span<_Tp, _Extent> __s) noexcept
-{ return __s.__as_bytes(); }
+_LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept {
+ return __s.__as_bytes();
+}
-template <class _Tp, size_t _Extent> requires(!is_const_v<_Tp>)
-_LIBCPP_HIDE_FROM_ABI
-auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
-{ return __s.__as_writable_bytes(); }
+template <class _Tp, size_t _Extent>
+ requires(!is_const_v<_Tp>)
+_LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept {
+ return __s.__as_writable_bytes();
+}
-#if _LIBCPP_STD_VER >= 20
-template<contiguous_iterator _It, class _EndOrSize>
- span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
-#endif // _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
+template <contiguous_iterator _It, class _EndOrSize>
+span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
+# endif // _LIBCPP_STD_VER >= 20
-template<class _Tp, size_t _Sz>
- span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
+template <class _Tp, size_t _Sz>
+span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
-template<class _Tp, size_t _Sz>
- span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
+template <class _Tp, size_t _Sz>
+span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
-template<class _Tp, size_t _Sz>
- span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
+template <class _Tp, size_t _Sz>
+span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
-template<ranges::contiguous_range _Range>
- span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
+template <ranges::contiguous_range _Range>
+span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/contrib/llvm-project/libcxx/include/sstream b/contrib/llvm-project/libcxx/include/sstream
index 0f4fb33a66fd..bd5cea9a5e94 100644
--- a/contrib/llvm-project/libcxx/include/sstream
+++ b/contrib/llvm-project/libcxx/include/sstream
@@ -287,13 +287,12 @@ typedef basic_stringstream<wchar_t> wstringstream;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
// TODO(LLVM-19): Remove this once we drop support for Clang 16,
// which had this bug: https://github.com/llvm/llvm-project/issues/40363
#ifdef _WIN32
-#define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_ALWAYS_INLINE
+# define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_ALWAYS_INLINE
#else
-#define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_HIDE_FROM_ABI
+# define _LIBCPP_HIDE_FROM_ABI_SSTREAM _LIBCPP_HIDE_FROM_ABI
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -301,900 +300,801 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Class template basic_stringbuf [stringbuf]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_stringbuf
- : public basic_streambuf<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_stringbuf : public basic_streambuf<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
-
- string_type __str_;
- mutable char_type* __hm_;
- ios_base::openmode __mode_;
- _LIBCPP_HIDE_FROM_ABI void __init_buf_ptrs();
- _LIBCPP_HIDE_FROM_ABI void __move_init(basic_stringbuf&& __rhs);
+ string_type __str_;
+ mutable char_type* __hm_;
+ ios_base::openmode __mode_;
+ _LIBCPP_HIDE_FROM_ABI void __init_buf_ptrs();
+ _LIBCPP_HIDE_FROM_ABI void __move_init(basic_stringbuf&& __rhs);
public:
- // [stringbuf.cons] constructors:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf()
- : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringbuf(ios_base::openmode __wch)
- : __hm_(nullptr), __mode_(__wch) {}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringbuf(const string_type& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __str_(__s.get_allocator()), __hm_(nullptr), __mode_(__wch)
- {
- str(__s);
- }
+ // [stringbuf.cons] constructors:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf() : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {}
-#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const allocator_type& __a)
- : basic_stringbuf(ios_base::in | ios_base::out, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI basic_stringbuf(ios_base::openmode __wch, const allocator_type& __a)
- : __str_(__a), __hm_(nullptr), __mode_(__wch) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(string_type&& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __str_(std::move(__s)), __hm_(nullptr), __mode_(__wch) {
- __init_buf_ptrs();
- }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(ios_base::openmode __wch) : __hm_(nullptr), __mode_(__wch) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s, const allocator_type& __a)
- : basic_stringbuf(__s, ios_base::in | ios_base::out, __a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const string_type& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : __str_(__s.get_allocator()), __hm_(nullptr), __mode_(__wch) {
+ str(__s);
+ }
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_stringbuf(
- const basic_string<char_type, traits_type, _SAlloc>& __s, ios_base::openmode __wch, const allocator_type& __a)
- : __str_(__s, __a), __hm_(nullptr), __mode_(__wch) {
- __init_buf_ptrs();
- }
-
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : __str_(__s), __hm_(nullptr), __mode_(__wch) {
- __init_buf_ptrs();
- }
+#if _LIBCPP_STD_VER >= 20
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const allocator_type& __a)
+ : basic_stringbuf(ios_base::in | ios_base::out, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(ios_base::openmode __wch, const allocator_type& __a)
+ : __str_(__a), __hm_(nullptr), __mode_(__wch) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(string_type&& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : __str_(std::move(__s)), __hm_(nullptr), __mode_(__wch) {
+ __init_buf_ptrs();
+ }
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI
+ basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s, const allocator_type& __a)
+ : basic_stringbuf(__s, ios_base::in | ios_base::out, __a) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(
+ const basic_string<char_type, traits_type, _SAlloc>& __s, ios_base::openmode __wch, const allocator_type& __a)
+ : __str_(__s, __a), __hm_(nullptr), __mode_(__wch) {
+ __init_buf_ptrs();
+ }
+
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const basic_string<char_type, traits_type, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : __str_(__s), __hm_(nullptr), __mode_(__wch) {
+ __init_buf_ptrs();
+ }
#endif // _LIBCPP_STD_VER >= 20
- basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { __move_init(std::move(__rhs)); }
+ basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { __move_init(std::move(__rhs)); }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a)
- : basic_stringbuf(__rhs.__mode_, __a) {
- __move_init(std::move(__rhs));
- }
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a)
+ : basic_stringbuf(__rhs.__mode_, __a) {
+ __move_init(std::move(__rhs));
+ }
#endif
- // [stringbuf.assign] Assign and swap:
- basic_stringbuf& operator=(basic_stringbuf&& __rhs);
- void swap(basic_stringbuf& __rhs)
+ // [stringbuf.assign] Assign and swap:
+ basic_stringbuf& operator=(basic_stringbuf&& __rhs);
+ void swap(basic_stringbuf& __rhs)
#if _LIBCPP_STD_VER >= 20
- noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
- allocator_traits<allocator_type>::is_always_equal::value)
+ noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
+ allocator_traits<allocator_type>::is_always_equal::value)
#endif
- ;
+ ;
- // [stringbuf.members] Member functions:
+ // [stringbuf.members] Member functions:
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
#endif
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- string_type str() const;
+ string_type str() const;
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return str(__str_.get_allocator()); }
-
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && {
- const basic_string_view<_CharT, _Traits> __view = view();
- typename string_type::size_type __pos = __view.empty() ? 0 : __view.data() - __str_.data();
- // In C++23, this is just string_type(std::move(__str_), __pos, __view.size(), __str_.get_allocator());
- // But we need something that works in C++20 also.
- string_type __result(__str_.get_allocator());
- __result.__move_assign(std::move(__str_), __pos, __view.size());
- __str_.clear();
- __init_buf_ptrs();
- return __result;
- }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return str(__str_.get_allocator()); }
+
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && {
+ const basic_string_view<_CharT, _Traits> __view = view();
+ typename string_type::size_type __pos = __view.empty() ? 0 : __view.data() - __str_.data();
+ // In C++23, this is just string_type(std::move(__str_), __pos, __view.size(), __str_.get_allocator());
+ // But we need something that works in C++20 also.
+ string_type __result(__str_.get_allocator());
+ __result.__move_assign(std::move(__str_), __pos, __view.size());
+ __str_.clear();
+ __init_buf_ptrs();
+ return __result;
+ }
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return basic_string<_CharT, _Traits, _SAlloc>(view(), __sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return basic_string<_CharT, _Traits, _SAlloc>(view(), __sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept;
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept;
#endif // _LIBCPP_STD_VER >= 20
- void str(const string_type& __s) {
- __str_ = __s;
- __init_buf_ptrs();
- }
+ void str(const string_type& __s) {
+ __str_ = __s;
+ __init_buf_ptrs();
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __str_ = __s;
- __init_buf_ptrs();
- }
-
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) {
- __str_ = std::move(__s);
- __init_buf_ptrs();
- }
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __str_ = __s;
+ __init_buf_ptrs();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) {
+ __str_ = std::move(__s);
+ __init_buf_ptrs();
+ }
#endif // _LIBCPP_STD_VER >= 20
protected:
- // [stringbuf.virtuals] Overridden virtual functions:
- int_type underflow() override;
- int_type pbackfail(int_type __c = traits_type::eof()) override;
- int_type overflow (int_type __c = traits_type::eof()) override;
- pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- pos_type seekpos(pos_type __sp,
- ios_base::openmode __wch = ios_base::in | ios_base::out) override {
- return seekoff(__sp, ios_base::beg, __wch);
- }
+ // [stringbuf.virtuals] Overridden virtual functions:
+ int_type underflow() override;
+ int_type pbackfail(int_type __c = traits_type::eof()) override;
+ int_type overflow(int_type __c = traits_type::eof()) override;
+ pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out) override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ pos_type seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out) override {
+ return seekoff(__sp, ios_base::beg, __wch);
+ }
};
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI void basic_stringbuf<_CharT, _Traits, _Allocator>::__move_init(basic_stringbuf&& __rhs) {
- char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
- ptrdiff_t __binp = -1;
- ptrdiff_t __ninp = -1;
- ptrdiff_t __einp = -1;
- if (__rhs.eback() != nullptr)
- {
- __binp = __rhs.eback() - __p;
- __ninp = __rhs.gptr() - __p;
- __einp = __rhs.egptr() - __p;
- }
- ptrdiff_t __bout = -1;
- ptrdiff_t __nout = -1;
- ptrdiff_t __eout = -1;
- if (__rhs.pbase() != nullptr)
- {
- __bout = __rhs.pbase() - __p;
- __nout = __rhs.pptr() - __p;
- __eout = __rhs.epptr() - __p;
- }
- ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
- __str_ = std::move(__rhs.__str_);
- __p = const_cast<char_type*>(__str_.data());
- if (__binp != -1)
- this->setg(__p + __binp, __p + __ninp, __p + __einp);
- if (__bout != -1)
- {
- this->setp(__p + __bout, __p + __eout);
- this->__pbump(__nout);
- }
- __hm_ = __hm == -1 ? nullptr : __p + __hm;
- __p = const_cast<char_type*>(__rhs.__str_.data());
- __rhs.setg(__p, __p, __p);
- __rhs.setp(__p, __p);
- __rhs.__hm_ = __p;
- this->pubimbue(__rhs.getloc());
+ char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+ ptrdiff_t __binp = -1;
+ ptrdiff_t __ninp = -1;
+ ptrdiff_t __einp = -1;
+ if (__rhs.eback() != nullptr) {
+ __binp = __rhs.eback() - __p;
+ __ninp = __rhs.gptr() - __p;
+ __einp = __rhs.egptr() - __p;
+ }
+ ptrdiff_t __bout = -1;
+ ptrdiff_t __nout = -1;
+ ptrdiff_t __eout = -1;
+ if (__rhs.pbase() != nullptr) {
+ __bout = __rhs.pbase() - __p;
+ __nout = __rhs.pptr() - __p;
+ __eout = __rhs.epptr() - __p;
+ }
+ ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+ __str_ = std::move(__rhs.__str_);
+ __p = const_cast<char_type*>(__str_.data());
+ if (__binp != -1)
+ this->setg(__p + __binp, __p + __ninp, __p + __einp);
+ if (__bout != -1) {
+ this->setp(__p + __bout, __p + __eout);
+ this->__pbump(__nout);
+ }
+ __hm_ = __hm == -1 ? nullptr : __p + __hm;
+ __p = const_cast<char_type*>(__rhs.__str_.data());
+ __rhs.setg(__p, __p, __p);
+ __rhs.setp(__p, __p);
+ __rhs.__hm_ = __p;
+ this->pubimbue(__rhs.getloc());
}
template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>&
-basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
-{
- char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
- ptrdiff_t __binp = -1;
- ptrdiff_t __ninp = -1;
- ptrdiff_t __einp = -1;
- if (__rhs.eback() != nullptr)
- {
- __binp = __rhs.eback() - __p;
- __ninp = __rhs.gptr() - __p;
- __einp = __rhs.egptr() - __p;
- }
- ptrdiff_t __bout = -1;
- ptrdiff_t __nout = -1;
- ptrdiff_t __eout = -1;
- if (__rhs.pbase() != nullptr)
- {
- __bout = __rhs.pbase() - __p;
- __nout = __rhs.pptr() - __p;
- __eout = __rhs.epptr() - __p;
- }
- ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
- __str_ = std::move(__rhs.__str_);
- __p = const_cast<char_type*>(__str_.data());
- if (__binp != -1)
- this->setg(__p + __binp, __p + __ninp, __p + __einp);
- else
- this->setg(nullptr, nullptr, nullptr);
- if (__bout != -1)
- {
- this->setp(__p + __bout, __p + __eout);
- this->__pbump(__nout);
- }
- else
- this->setp(nullptr, nullptr);
-
- __hm_ = __hm == -1 ? nullptr : __p + __hm;
- __mode_ = __rhs.__mode_;
- __p = const_cast<char_type*>(__rhs.__str_.data());
- __rhs.setg(__p, __p, __p);
- __rhs.setp(__p, __p);
- __rhs.__hm_ = __p;
- this->pubimbue(__rhs.getloc());
- return *this;
+basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) {
+ char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+ ptrdiff_t __binp = -1;
+ ptrdiff_t __ninp = -1;
+ ptrdiff_t __einp = -1;
+ if (__rhs.eback() != nullptr) {
+ __binp = __rhs.eback() - __p;
+ __ninp = __rhs.gptr() - __p;
+ __einp = __rhs.egptr() - __p;
+ }
+ ptrdiff_t __bout = -1;
+ ptrdiff_t __nout = -1;
+ ptrdiff_t __eout = -1;
+ if (__rhs.pbase() != nullptr) {
+ __bout = __rhs.pbase() - __p;
+ __nout = __rhs.pptr() - __p;
+ __eout = __rhs.epptr() - __p;
+ }
+ ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+ __str_ = std::move(__rhs.__str_);
+ __p = const_cast<char_type*>(__str_.data());
+ if (__binp != -1)
+ this->setg(__p + __binp, __p + __ninp, __p + __einp);
+ else
+ this->setg(nullptr, nullptr, nullptr);
+ if (__bout != -1) {
+ this->setp(__p + __bout, __p + __eout);
+ this->__pbump(__nout);
+ } else
+ this->setp(nullptr, nullptr);
+
+ __hm_ = __hm == -1 ? nullptr : __p + __hm;
+ __mode_ = __rhs.__mode_;
+ __p = const_cast<char_type*>(__rhs.__str_.data());
+ __rhs.setg(__p, __p, __p);
+ __rhs.setp(__p, __p);
+ __rhs.__hm_ = __p;
+ this->pubimbue(__rhs.getloc());
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-void
-basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
+void basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
#if _LIBCPP_STD_VER >= 20
noexcept(allocator_traits<_Allocator>::propagate_on_container_swap::value ||
allocator_traits<_Allocator>::is_always_equal::value)
#endif
{
- char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
- ptrdiff_t __rbinp = -1;
- ptrdiff_t __rninp = -1;
- ptrdiff_t __reinp = -1;
- if (__rhs.eback() != nullptr)
- {
- __rbinp = __rhs.eback() - __p;
- __rninp = __rhs.gptr() - __p;
- __reinp = __rhs.egptr() - __p;
- }
- ptrdiff_t __rbout = -1;
- ptrdiff_t __rnout = -1;
- ptrdiff_t __reout = -1;
- if (__rhs.pbase() != nullptr)
- {
- __rbout = __rhs.pbase() - __p;
- __rnout = __rhs.pptr() - __p;
- __reout = __rhs.epptr() - __p;
- }
- ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
- __p = const_cast<char_type*>(__str_.data());
- ptrdiff_t __lbinp = -1;
- ptrdiff_t __lninp = -1;
- ptrdiff_t __leinp = -1;
- if (this->eback() != nullptr)
- {
- __lbinp = this->eback() - __p;
- __lninp = this->gptr() - __p;
- __leinp = this->egptr() - __p;
- }
- ptrdiff_t __lbout = -1;
- ptrdiff_t __lnout = -1;
- ptrdiff_t __leout = -1;
- if (this->pbase() != nullptr)
- {
- __lbout = this->pbase() - __p;
- __lnout = this->pptr() - __p;
- __leout = this->epptr() - __p;
- }
- ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
- std::swap(__mode_, __rhs.__mode_);
- __str_.swap(__rhs.__str_);
- __p = const_cast<char_type*>(__str_.data());
- if (__rbinp != -1)
- this->setg(__p + __rbinp, __p + __rninp, __p + __reinp);
- else
- this->setg(nullptr, nullptr, nullptr);
- if (__rbout != -1)
- {
- this->setp(__p + __rbout, __p + __reout);
- this->__pbump(__rnout);
- }
- else
- this->setp(nullptr, nullptr);
- __hm_ = __rhm == -1 ? nullptr : __p + __rhm;
- __p = const_cast<char_type*>(__rhs.__str_.data());
- if (__lbinp != -1)
- __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp);
- else
- __rhs.setg(nullptr, nullptr, nullptr);
- if (__lbout != -1)
- {
- __rhs.setp(__p + __lbout, __p + __leout);
- __rhs.__pbump(__lnout);
- }
- else
- __rhs.setp(nullptr, nullptr);
- __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
- locale __tl = __rhs.getloc();
- __rhs.pubimbue(this->getloc());
- this->pubimbue(__tl);
+ char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
+ ptrdiff_t __rbinp = -1;
+ ptrdiff_t __rninp = -1;
+ ptrdiff_t __reinp = -1;
+ if (__rhs.eback() != nullptr) {
+ __rbinp = __rhs.eback() - __p;
+ __rninp = __rhs.gptr() - __p;
+ __reinp = __rhs.egptr() - __p;
+ }
+ ptrdiff_t __rbout = -1;
+ ptrdiff_t __rnout = -1;
+ ptrdiff_t __reout = -1;
+ if (__rhs.pbase() != nullptr) {
+ __rbout = __rhs.pbase() - __p;
+ __rnout = __rhs.pptr() - __p;
+ __reout = __rhs.epptr() - __p;
+ }
+ ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
+ __p = const_cast<char_type*>(__str_.data());
+ ptrdiff_t __lbinp = -1;
+ ptrdiff_t __lninp = -1;
+ ptrdiff_t __leinp = -1;
+ if (this->eback() != nullptr) {
+ __lbinp = this->eback() - __p;
+ __lninp = this->gptr() - __p;
+ __leinp = this->egptr() - __p;
+ }
+ ptrdiff_t __lbout = -1;
+ ptrdiff_t __lnout = -1;
+ ptrdiff_t __leout = -1;
+ if (this->pbase() != nullptr) {
+ __lbout = this->pbase() - __p;
+ __lnout = this->pptr() - __p;
+ __leout = this->epptr() - __p;
+ }
+ ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
+ std::swap(__mode_, __rhs.__mode_);
+ __str_.swap(__rhs.__str_);
+ __p = const_cast<char_type*>(__str_.data());
+ if (__rbinp != -1)
+ this->setg(__p + __rbinp, __p + __rninp, __p + __reinp);
+ else
+ this->setg(nullptr, nullptr, nullptr);
+ if (__rbout != -1) {
+ this->setp(__p + __rbout, __p + __reout);
+ this->__pbump(__rnout);
+ } else
+ this->setp(nullptr, nullptr);
+ __hm_ = __rhm == -1 ? nullptr : __p + __rhm;
+ __p = const_cast<char_type*>(__rhs.__str_.data());
+ if (__lbinp != -1)
+ __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp);
+ else
+ __rhs.setg(nullptr, nullptr, nullptr);
+ if (__lbout != -1) {
+ __rhs.setp(__p + __lbout, __p + __leout);
+ __rhs.__pbump(__lnout);
+ } else
+ __rhs.setp(nullptr, nullptr);
+ __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
+ locale __tl = __rhs.getloc();
+ __rhs.pubimbue(this->getloc());
+ this->pubimbue(__tl);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
- basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
#if _LIBCPP_STD_VER >= 20
noexcept(noexcept(__x.swap(__y)))
#endif
{
- __x.swap(__y);
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
template <class _CharT, class _Traits, class _Allocator>
-basic_string<_CharT, _Traits, _Allocator>
-basic_stringbuf<_CharT, _Traits, _Allocator>::str() const {
- if (__mode_ & ios_base::out) {
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- return string_type(this->pbase(), __hm_, __str_.get_allocator());
- } else if (__mode_ & ios_base::in)
- return string_type(this->eback(), this->egptr(), __str_.get_allocator());
- return string_type(__str_.get_allocator());
+basic_string<_CharT, _Traits, _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::str() const {
+ if (__mode_ & ios_base::out) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ return string_type(this->pbase(), __hm_, __str_.get_allocator());
+ } else if (__mode_ & ios_base::in)
+ return string_type(this->eback(), this->egptr(), __str_.get_allocator());
+ return string_type(__str_.get_allocator());
}
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI void basic_stringbuf<_CharT, _Traits, _Allocator>::__init_buf_ptrs() {
- __hm_ = nullptr;
- char_type* __data = const_cast<char_type*>(__str_.data());
- typename string_type::size_type __sz = __str_.size();
- if (__mode_ & ios_base::in) {
- __hm_ = __data + __sz;
- this->setg(__data, __data, __hm_);
- }
- if (__mode_ & ios_base::out) {
- __hm_ = __data + __sz;
- __str_.resize(__str_.capacity());
- this->setp(__data, __data + __str_.size());
- if (__mode_ & (ios_base::app | ios_base::ate)) {
- while (__sz > INT_MAX) {
- this->pbump(INT_MAX);
- __sz -= INT_MAX;
- }
- if (__sz > 0)
- this->pbump(__sz);
- }
+ __hm_ = nullptr;
+ char_type* __data = const_cast<char_type*>(__str_.data());
+ typename string_type::size_type __sz = __str_.size();
+ if (__mode_ & ios_base::in) {
+ __hm_ = __data + __sz;
+ this->setg(__data, __data, __hm_);
+ }
+ if (__mode_ & ios_base::out) {
+ __hm_ = __data + __sz;
+ __str_.resize(__str_.capacity());
+ this->setp(__data, __data + __str_.size());
+ if (__mode_ & (ios_base::app | ios_base::ate)) {
+ while (__sz > INT_MAX) {
+ this->pbump(INT_MAX);
+ __sz -= INT_MAX;
+ }
+ if (__sz > 0)
+ this->pbump(__sz);
}
+ }
}
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_string_view<_CharT, _Traits>
basic_stringbuf<_CharT, _Traits, _Allocator>::view() const noexcept {
- if (__mode_ & ios_base::out) {
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- return basic_string_view<_CharT, _Traits>(this->pbase(), __hm_);
- } else if (__mode_ & ios_base::in)
- return basic_string_view<_CharT, _Traits>(this->eback(), this->egptr());
- return basic_string_view<_CharT, _Traits>();
+ if (__mode_ & ios_base::out) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ return basic_string_view<_CharT, _Traits>(this->pbase(), __hm_);
+ } else if (__mode_ & ios_base::in)
+ return basic_string_view<_CharT, _Traits>(this->eback(), this->egptr());
+ return basic_string_view<_CharT, _Traits>();
}
#endif // _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator>
typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::underflow()
-{
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- if (__mode_ & ios_base::in)
- {
- if (this->egptr() < __hm_)
- this->setg(this->eback(), this->gptr(), __hm_);
- if (this->gptr() < this->egptr())
- return traits_type::to_int_type(*this->gptr());
- }
- return traits_type::eof();
+basic_stringbuf<_CharT, _Traits, _Allocator>::underflow() {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ if (__mode_ & ios_base::in) {
+ if (this->egptr() < __hm_)
+ this->setg(this->eback(), this->gptr(), __hm_);
+ if (this->gptr() < this->egptr())
+ return traits_type::to_int_type(*this->gptr());
+ }
+ return traits_type::eof();
}
template <class _CharT, class _Traits, class _Allocator>
typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c)
-{
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- if (this->eback() < this->gptr())
- {
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- {
- this->setg(this->eback(), this->gptr()-1, __hm_);
- return traits_type::not_eof(__c);
- }
- if ((__mode_ & ios_base::out) ||
- traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
- {
- this->setg(this->eback(), this->gptr()-1, __hm_);
- *this->gptr() = traits_type::to_char_type(__c);
- return __c;
- }
+basic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ if (this->eback() < this->gptr()) {
+ if (traits_type::eq_int_type(__c, traits_type::eof())) {
+ this->setg(this->eback(), this->gptr() - 1, __hm_);
+ return traits_type::not_eof(__c);
+ }
+ if ((__mode_ & ios_base::out) || traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) {
+ this->setg(this->eback(), this->gptr() - 1, __hm_);
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
}
- return traits_type::eof();
+ }
+ return traits_type::eof();
}
template <class _CharT, class _Traits, class _Allocator>
typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
-{
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- {
- ptrdiff_t __ninp = this->gptr() - this->eback();
- if (this->pptr() == this->epptr())
- {
- if (!(__mode_ & ios_base::out))
- return traits_type::eof();
+basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) {
+ if (!traits_type::eq_int_type(__c, traits_type::eof())) {
+ ptrdiff_t __ninp = this->gptr() - this->eback();
+ if (this->pptr() == this->epptr()) {
+ if (!(__mode_ & ios_base::out))
+ return traits_type::eof();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- ptrdiff_t __nout = this->pptr() - this->pbase();
- ptrdiff_t __hm = __hm_ - this->pbase();
- __str_.push_back(char_type());
- __str_.resize(__str_.capacity());
- char_type* __p = const_cast<char_type*>(__str_.data());
- this->setp(__p, __p + __str_.size());
- this->__pbump(__nout);
- __hm_ = this->pbase() + __hm;
+ ptrdiff_t __nout = this->pptr() - this->pbase();
+ ptrdiff_t __hm = __hm_ - this->pbase();
+ __str_.push_back(char_type());
+ __str_.resize(__str_.capacity());
+ char_type* __p = const_cast<char_type*>(__str_.data());
+ this->setp(__p, __p + __str_.size());
+ this->__pbump(__nout);
+ __hm_ = this->pbase() + __hm;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- return traits_type::eof();
- }
+ } catch (...) {
+ return traits_type::eof();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
- __hm_ = std::max(this->pptr() + 1, __hm_);
- if (__mode_ & ios_base::in)
- {
- char_type* __p = const_cast<char_type*>(__str_.data());
- this->setg(__p, __p + __ninp, __hm_);
- }
- return this->sputc(traits_type::to_char_type(__c));
}
- return traits_type::not_eof(__c);
+ __hm_ = std::max(this->pptr() + 1, __hm_);
+ if (__mode_ & ios_base::in) {
+ char_type* __p = const_cast<char_type*>(__str_.data());
+ this->setg(__p, __p + __ninp, __hm_);
+ }
+ return this->sputc(traits_type::to_char_type(__c));
+ }
+ return traits_type::not_eof(__c);
}
template <class _CharT, class _Traits, class _Allocator>
-typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
-basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
- ios_base::seekdir __way,
- ios_base::openmode __wch)
-{
- if (__hm_ < this->pptr())
- __hm_ = this->pptr();
- if ((__wch & (ios_base::in | ios_base::out)) == 0)
- return pos_type(-1);
- if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out)
- && __way == ios_base::cur)
- return pos_type(-1);
- const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data();
- off_type __noff;
- switch (__way)
- {
- case ios_base::beg:
- __noff = 0;
- break;
- case ios_base::cur:
- if (__wch & ios_base::in)
- __noff = this->gptr() - this->eback();
- else
- __noff = this->pptr() - this->pbase();
- break;
- case ios_base::end:
- __noff = __hm;
- break;
- default:
- return pos_type(-1);
- }
- __noff += __off;
- if (__noff < 0 || __hm < __noff)
- return pos_type(-1);
- if (__noff != 0)
- {
- if ((__wch & ios_base::in) && this->gptr() == nullptr)
- return pos_type(-1);
- if ((__wch & ios_base::out) && this->pptr() == nullptr)
- return pos_type(-1);
- }
+typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(
+ off_type __off, ios_base::seekdir __way, ios_base::openmode __wch) {
+ if (__hm_ < this->pptr())
+ __hm_ = this->pptr();
+ if ((__wch & (ios_base::in | ios_base::out)) == 0)
+ return pos_type(-1);
+ if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) && __way == ios_base::cur)
+ return pos_type(-1);
+ const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data();
+ off_type __noff;
+ switch (__way) {
+ case ios_base::beg:
+ __noff = 0;
+ break;
+ case ios_base::cur:
if (__wch & ios_base::in)
- this->setg(this->eback(), this->eback() + __noff, __hm_);
- if (__wch & ios_base::out)
- {
- this->setp(this->pbase(), this->epptr());
- this->__pbump(__noff);
- }
- return pos_type(__noff);
+ __noff = this->gptr() - this->eback();
+ else
+ __noff = this->pptr() - this->pbase();
+ break;
+ case ios_base::end:
+ __noff = __hm;
+ break;
+ default:
+ return pos_type(-1);
+ }
+ __noff += __off;
+ if (__noff < 0 || __hm < __noff)
+ return pos_type(-1);
+ if (__noff != 0) {
+ if ((__wch & ios_base::in) && this->gptr() == nullptr)
+ return pos_type(-1);
+ if ((__wch & ios_base::out) && this->pptr() == nullptr)
+ return pos_type(-1);
+ }
+ if (__wch & ios_base::in)
+ this->setg(this->eback(), this->eback() + __noff, __hm_);
+ if (__wch & ios_base::out) {
+ this->setp(this->pbase(), this->epptr());
+ this->__pbump(__noff);
+ }
+ return pos_type(__noff);
}
// Class template basic_istringstream [istringstream]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_istringstream
- : public basic_istream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_istringstream : public basic_istream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
- basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+ basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // [istringstream.cons] Constructors:
- _LIBCPP_HIDE_FROM_ABI
- basic_istringstream()
- : basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {}
+ // [istringstream.cons] Constructors:
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream() : basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_istringstream(ios_base::openmode __wch)
- : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(ios_base::openmode __wch)
+ : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_istringstream(const string_type& __s,
- ios_base::openmode __wch = ios_base::in)
- : basic_istream<_CharT, _Traits>(&__sb_)
- , __sb_(__s, __wch | ios_base::in)
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in)
+ : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::in) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_istringstream(ios_base::openmode __wch, const _Allocator& __a)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::in, __a) {}
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(ios_base::openmode __wch, const _Allocator& __a)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::in, __a) {}
- _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(string_type&& __s, ios_base::openmode __wch = ios_base::in)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::in) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(string_type&& __s, ios_base::openmode __wch = ios_base::in)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::in) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
- : basic_istringstream(__s, ios_base::in, __a) {}
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
+ : basic_istringstream(__s, ios_base::in, __a) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_istringstream(
- const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in, __a) {}
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(
+ const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in, __a) {}
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::in)
- : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {}
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::in)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- basic_istringstream(basic_istringstream&& __rhs)
- : basic_istream<_CharT, _Traits>(std::move(__rhs))
- , __sb_(std::move(__rhs.__sb_))
- {
- basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(basic_istringstream&& __rhs)
+ : basic_istream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
+ }
- // [istringstream.assign] Assign and swap:
- basic_istringstream& operator=(basic_istringstream&& __rhs) {
- basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_istringstream& __rhs) {
- basic_istream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ // [istringstream.assign] Assign and swap:
+ basic_istringstream& operator=(basic_istringstream&& __rhs) {
+ basic_istream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_istringstream& __rhs) {
+ basic_istream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // [istringstream.members] Member functions:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
- return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
- }
+ // [istringstream.members] Member functions:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
+ return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+ }
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return __sb_.str(); }
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
#endif
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return __sb_.str(__sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return __sb_.str(__sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
+ _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __sb_.str(__s);
- }
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __sb_.str(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
- basic_istringstream<_CharT, _Traits, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, basic_istringstream<_CharT, _Traits, _Allocator>& __y) {
+ __x.swap(__y);
}
// Class template basic_ostringstream [ostringstream]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_ostringstream
- : public basic_ostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_ostringstream : public basic_ostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
- basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+ basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // [ostringstream.cons] Constructors:
- _LIBCPP_HIDE_FROM_ABI
- basic_ostringstream()
- : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {}
+ // [ostringstream.cons] Constructors:
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream() : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ostringstream(ios_base::openmode __wch)
- : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::out) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(ios_base::openmode __wch)
+ : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::out) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_ostringstream(const string_type& __s,
- ios_base::openmode __wch = ios_base::out)
- : basic_ostream<_CharT, _Traits>(&__sb_)
- , __sb_(__s, __wch | ios_base::out)
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const string_type& __s, ios_base::openmode __wch = ios_base::out)
+ : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::out) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_ostringstream(ios_base::openmode __wch, const _Allocator& __a)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::out, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(string_type&& __s, ios_base::openmode __wch = ios_base::out)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::out) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
- : basic_ostringstream(__s, ios_base::out, __a) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_ostringstream(
- const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out, __a) {}
-
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::out)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {}
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(ios_base::openmode __wch, const _Allocator& __a)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::out, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(string_type&& __s, ios_base::openmode __wch = ios_base::out)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::out) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
+ : basic_ostringstream(__s, ios_base::out, __a) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(
+ const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out, __a) {}
+
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::out)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- basic_ostringstream(basic_ostringstream&& __rhs)
- : basic_ostream<_CharT, _Traits>(std::move(__rhs))
- , __sb_(std::move(__rhs.__sb_))
- {
- basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(basic_ostringstream&& __rhs)
+ : basic_ostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
+ }
- // [ostringstream.assign] Assign and swap:
- basic_ostringstream& operator=(basic_ostringstream&& __rhs) {
- basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
- }
+ // [ostringstream.assign] Assign and swap:
+ basic_ostringstream& operator=(basic_ostringstream&& __rhs) {
+ basic_ostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_ostringstream& __rhs) {
- basic_ostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_ostringstream& __rhs) {
+ basic_ostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // [ostringstream.members] Member functions:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
- return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
- }
+ // [ostringstream.members] Member functions:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
+ return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+ }
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return __sb_.str(); }
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
#endif
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return __sb_.str(__sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return __sb_.str(__sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
+ _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __sb_.str(__s);
- }
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __sb_.str(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
- basic_ostringstream<_CharT, _Traits, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, basic_ostringstream<_CharT, _Traits, _Allocator>& __y) {
+ __x.swap(__y);
}
// Class template basic_stringstream [stringstream]
template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_stringstream
- : public basic_iostream<_CharT, _Traits>
-{
+class _LIBCPP_TEMPLATE_VIS basic_stringstream : public basic_iostream<_CharT, _Traits> {
public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef _Allocator allocator_type;
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef _Allocator allocator_type;
- typedef basic_string<char_type, traits_type, allocator_type> string_type;
+ typedef basic_string<char_type, traits_type, allocator_type> string_type;
private:
- basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
+ basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // [stringstream.cons] constructors
- _LIBCPP_HIDE_FROM_ABI
- basic_stringstream()
- : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {}
+ // [stringstream.cons] constructors
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream()
+ : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringstream(ios_base::openmode __wch)
- : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) {}
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(ios_base::openmode __wch)
+ : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit basic_stringstream(const string_type& __s,
- ios_base::openmode __wch = ios_base::in | ios_base::out)
- : basic_iostream<_CharT, _Traits>(&__sb_)
- , __sb_(__s, __wch)
- { }
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const string_type& __s,
+ ios_base::openmode __wch = ios_base::in | ios_base::out)
+ : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch) {}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI basic_stringstream(ios_base::openmode __wch, const _Allocator& __a)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(string_type&& __s, ios_base::openmode __wch = ios_base::out | ios_base::in)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
- : basic_stringstream(__s, ios_base::out | ios_base::in, __a) {}
-
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI basic_stringstream(
- const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch, __a) {}
-
- template <class _SAlloc>
- requires (!is_same_v<_SAlloc, allocator_type>)
- _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
- ios_base::openmode __wch = ios_base::out | ios_base::in)
- : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {}
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(ios_base::openmode __wch, const _Allocator& __a)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch, __a) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(string_type&& __s,
+ ios_base::openmode __wch = ios_base::out | ios_base::in)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
+ : basic_stringstream(__s, ios_base::out | ios_base::in, __a) {}
+
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI
+ basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch, __a) {}
+
+ template <class _SAlloc>
+ requires(!is_same_v<_SAlloc, allocator_type>)
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s,
+ ios_base::openmode __wch = ios_base::out | ios_base::in)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {}
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- basic_stringstream(basic_stringstream&& __rhs)
- : basic_iostream<_CharT, _Traits>(std::move(__rhs))
- , __sb_(std::move(__rhs.__sb_))
- {
- basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(basic_stringstream&& __rhs)
+ : basic_iostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
+ basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
+ }
- // [stringstream.assign] Assign and swap:
- basic_stringstream& operator=(basic_stringstream&& __rhs) {
- basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
- __sb_ = std::move(__rhs.__sb_);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI
- void swap(basic_stringstream& __rhs) {
- basic_iostream<char_type, traits_type>::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ // [stringstream.assign] Assign and swap:
+ basic_stringstream& operator=(basic_stringstream&& __rhs) {
+ basic_iostream<char_type, traits_type>::operator=(std::move(__rhs));
+ __sb_ = std::move(__rhs.__sb_);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI void swap(basic_stringstream& __rhs) {
+ basic_iostream<char_type, traits_type>::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // [stringstream.members] Member functions:
- _LIBCPP_HIDE_FROM_ABI
- basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
- return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
- }
+ // [stringstream.members] Member functions:
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
+ return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
+ }
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY)
- _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); }
#else
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const& { return __sb_.str(); }
- _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
+ _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { return std::move(__sb_).str(); }
#endif
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- requires __is_allocator<_SAlloc>::value
- _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
- return __sb_.str(__sa);
- }
+ template <class _SAlloc>
+ requires __is_allocator<_SAlloc>::value
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const {
+ return __sb_.str(__sa);
+ }
- _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
+ _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); }
#if _LIBCPP_STD_VER >= 20
- template <class _SAlloc>
- _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
- __sb_.str(__s);
- }
+ template <class _SAlloc>
+ _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) {
+ __sb_.str(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
+ _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
- basic_stringstream<_CharT, _Traits, _Allocator>& __y)
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, basic_stringstream<_CharT, _Traits, _Allocator>& __y) {
+ __x.swap(__y);
}
#if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
diff --git a/contrib/llvm-project/libcxx/include/stack b/contrib/llvm-project/libcxx/include/stack
index 63cd7dead78e..546380b0aacd 100644
--- a/contrib/llvm-project/libcxx/include/stack
+++ b/contrib/llvm-project/libcxx/include/stack
@@ -140,267 +140,207 @@ template <class T, class Container>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS stack;
+template <class _Tp, class _Container = deque<_Tp> >
+class _LIBCPP_TEMPLATE_VIS stack;
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container>
-_LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
+_LIBCPP_HIDE_FROM_ABI bool operator<(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container /*= deque<_Tp>*/>
-class _LIBCPP_TEMPLATE_VIS stack
-{
+class _LIBCPP_TEMPLATE_VIS stack {
public:
- typedef _Container container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::reference reference;
- typedef typename container_type::const_reference const_reference;
- typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "" );
+ typedef _Container container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ static_assert((is_same<_Tp, value_type>::value), "");
protected:
- container_type c;
+ container_type c;
public:
- _LIBCPP_HIDE_FROM_ABI
- stack()
- _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
- : c() {}
-
- _LIBCPP_HIDE_FROM_ABI
- stack(const stack& __q) : c(__q.c) {}
+ _LIBCPP_HIDE_FROM_ABI stack() _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value) : c() {}
- _LIBCPP_HIDE_FROM_ABI
- stack& operator=(const stack& __q) {c = __q.c; return *this;}
+ _LIBCPP_HIDE_FROM_ABI stack(const stack& __q) : c(__q.c) {}
+ _LIBCPP_HIDE_FROM_ABI stack& operator=(const stack& __q) {
+ c = __q.c;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- stack(stack&& __q)
- _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
- : c(std::move(__q.c)) {}
-
- _LIBCPP_HIDE_FROM_ABI
- stack& operator=(stack&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
- {c = std::move(__q.c); return *this;}
-
- _LIBCPP_HIDE_FROM_ABI
- explicit stack(container_type&& __c) : c(std::move(__c)) {}
+ _LIBCPP_HIDE_FROM_ABI stack(stack&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+ : c(std::move(__q.c)) {}
+
+ _LIBCPP_HIDE_FROM_ABI stack& operator=(stack&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {
+ c = std::move(__q.c);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI explicit stack(container_type&& __c) : c(std::move(__c)) {}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- explicit stack(const container_type& __c) : c(__c) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- explicit stack(const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(const container_type& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__c, __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(const stack& __s, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(__s.c, __a) {}
+ _LIBCPP_HIDE_FROM_ABI explicit stack(const container_type& __c) : c(__c) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI explicit stack(const _Alloc& __a,
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(const container_type& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__c, __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(const stack& __s, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(__s.c, __a) {}
#ifndef _LIBCPP_CXX03_LANG
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(container_type&& __c, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__c), __a) {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- stack(stack&& __s, const _Alloc& __a,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
- : c(std::move(__s.c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(container_type&& __c, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__c), __a) {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(stack&& __s, const _Alloc& __a, __enable_if_t<uses_allocator<container_type, _Alloc>::value>* = 0)
+ : c(std::move(__s.c), __a) {}
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 23
- template <class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
- _LIBCPP_HIDE_FROM_ABI
- stack(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- stack(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
-
- template <class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- stack(_InputIterator __first, _InputIterator __last, const _Alloc& __alloc) : c(__first, __last, __alloc) {}
-
- template <_ContainerCompatibleRange<_Tp> _Range,
- class _Alloc,
- class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI
- stack(from_range_t, _Range&& __range, const _Alloc& __alloc)
- : c(from_range, std::forward<_Range>(__range), __alloc) {}
+ template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+ _LIBCPP_HIDE_FROM_ABI stack(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
-#endif
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI stack(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const {return c.empty();}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const {return c.size();}
- _LIBCPP_HIDE_FROM_ABI
- reference top() {return c.back();}
- _LIBCPP_HIDE_FROM_ABI
- const_reference top() const {return c.back();}
-
- _LIBCPP_HIDE_FROM_ABI
- void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void push(value_type&& __v) {c.push_back(std::move(__v));}
+ template <class _InputIterator,
+ class _Alloc,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI stack(_InputIterator __first, _InputIterator __last, const _Alloc& __alloc)
+ : c(__first, __last, __alloc) {}
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void push_range(_Range&& __range) {
- if constexpr (requires (container_type& __c) {
- __c.append_range(std::forward<_Range>(__range));
- }) {
- c.append_range(std::forward<_Range>(__range));
- } else {
- ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
- }
- }
-#endif
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI stack(from_range_t, _Range&& __range, const _Alloc& __alloc)
+ : c(from_range, std::forward<_Range>(__range), __alloc) {}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
-#if _LIBCPP_STD_VER >= 17
- decltype(auto) emplace(_Args&&... __args)
- { return c.emplace_back(std::forward<_Args>(__args)...);}
-#else
- void emplace(_Args&&... __args)
- { c.emplace_back(std::forward<_Args>(__args)...);}
#endif
-#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void pop() {c.pop_back();}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
+ _LIBCPP_HIDE_FROM_ABI reference top() { return c.back(); }
+ _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.back(); }
- _LIBCPP_HIDE_FROM_ABI
- void swap(stack& __s)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
- {
- using std::swap;
- swap(c, __s.c);
+ _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v) { c.push_back(__v); }
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v) { c.push_back(std::move(__v)); }
+
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
+ if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
+ c.append_range(std::forward<_Range>(__range));
+ } else {
+ ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
}
+ }
+# endif
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI
+# if _LIBCPP_STD_VER >= 17
+ decltype(auto)
+ emplace(_Args&&... __args) {
+ return c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# else
+ void
+ emplace(_Args&&... __args) {
+ c.emplace_back(std::forward<_Args>(__args)...);
+ }
+# endif
+#endif // _LIBCPP_CXX03_LANG
+
+ _LIBCPP_HIDE_FROM_ABI void pop() { c.pop_back(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(stack& __s) _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) {
+ using std::swap;
+ swap(c, __s.c);
+ }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
- template <class _T1, class _OtherContainer>
- friend
- bool
- operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend bool operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
- template <class _T1, class _OtherContainer>
- friend
- bool
- operator< (const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
+ template <class _T1, class _OtherContainer>
+ friend bool operator<(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
};
#if _LIBCPP_STD_VER >= 17
-template<class _Container,
- class = enable_if_t<!__is_allocator<_Container>::value>
->
-stack(_Container)
- -> stack<typename _Container::value_type, _Container>;
-
-template<class _Container,
- class _Alloc,
- class = enable_if_t<!__is_allocator<_Container>::value>,
- class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
- >
-stack(_Container, _Alloc)
- -> stack<typename _Container::value_type, _Container>;
+template <class _Container, class = enable_if_t<!__is_allocator<_Container>::value> >
+stack(_Container) -> stack<typename _Container::value_type, _Container>;
+
+template <class _Container,
+ class _Alloc,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value> >
+stack(_Container, _Alloc) -> stack<typename _Container::value_type, _Container>;
#endif
#if _LIBCPP_STD_VER >= 23
-template<class _InputIterator,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
-stack(_InputIterator, _InputIterator)
- -> stack<__iter_value_type<_InputIterator>>;
+template <class _InputIterator, class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
+stack(_InputIterator, _InputIterator) -> stack<__iter_value_type<_InputIterator>>;
template <ranges::input_range _Range>
stack(from_range_t, _Range&&) -> stack<ranges::range_value_t<_Range>>;
-template<class _InputIterator,
- class _Alloc,
- class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = __enable_if_t<__is_allocator<_Alloc>::value>>
+template <class _InputIterator,
+ class _Alloc,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = __enable_if_t<__is_allocator<_Alloc>::value>>
stack(_InputIterator, _InputIterator, _Alloc)
-> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
-template <ranges::input_range _Range,
- class _Alloc,
- class = __enable_if_t<__is_allocator<_Alloc>::value>>
+template <ranges::input_range _Range, class _Alloc, class = __enable_if_t<__is_allocator<_Alloc>::value>>
stack(from_range_t, _Range&&, _Alloc)
- -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
+ -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
#endif
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return __x.c == __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return __x.c == __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return __x.c < __y.c;
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return __x.c < __y.c;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Container>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return !(__y < __x);
}
#if _LIBCPP_STD_VER >= 20
@@ -408,25 +348,20 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
template <class _Tp, three_way_comparable _Container>
_LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
operator<=>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
- // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
- return __x.__get_container() <=> __y.__get_container();
+ // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
+ return __x.__get_container() <=> __y.__get_container();
}
#endif
template <class _Tp, class _Container, __enable_if_t<__is_swappable<_Container>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Tp, class _Container, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc>
- : public uses_allocator<_Container, _Alloc>
-{
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc> : public uses_allocator<_Container, _Alloc> {
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/stdatomic.h b/contrib/llvm-project/libcxx/include/stdatomic.h
index 9c002e52918e..79772eb7fce1 100644
--- a/contrib/llvm-project/libcxx/include/stdatomic.h
+++ b/contrib/llvm-project/libcxx/include/stdatomic.h
@@ -123,14 +123,14 @@ using std::atomic_signal_fence // see below
#if defined(__cplusplus) && _LIBCPP_STD_VER >= 23
-#include <atomic>
-#include <version>
+# include <atomic>
+# include <version>
-#ifdef _Atomic
-# undef _Atomic
-#endif
+# ifdef _Atomic
+# undef _Atomic
+# endif
-#define _Atomic(_Tp) ::std::atomic<_Tp>
+# define _Atomic(_Tp) ::std::atomic<_Tp>
using std::memory_order _LIBCPP_USING_IF_EXISTS;
using std::memory_order_relaxed _LIBCPP_USING_IF_EXISTS;
@@ -226,9 +226,9 @@ using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
// the header. We do this because Clang has historically shipped a <stdatomic.h>
// header that would be available in all Standard modes, and we don't want to
// break that use case.
-# if __has_include_next(<stdatomic.h>)
-# include_next <stdatomic.h>
-# endif
+# if __has_include_next(<stdatomic.h>)
+# include_next <stdatomic.h>
+# endif
#endif // defined(__cplusplus) && _LIBCPP_STD_VER >= 23
diff --git a/contrib/llvm-project/libcxx/include/stdbool.h b/contrib/llvm-project/libcxx/include/stdbool.h
index 74869b46d561..e74d91f45945 100644
--- a/contrib/llvm-project/libcxx/include/stdbool.h
+++ b/contrib/llvm-project/libcxx/include/stdbool.h
@@ -30,11 +30,11 @@ Macros:
#endif
#ifdef __cplusplus
-#undef bool
-#undef true
-#undef false
-#undef __bool_true_false_are_defined
-#define __bool_true_false_are_defined 1
+# undef bool
+# undef true
+# undef false
+# undef __bool_true_false_are_defined
+# define __bool_true_false_are_defined 1
#endif
#endif // _LIBCPP_STDBOOL_H
diff --git a/contrib/llvm-project/libcxx/include/stddef.h b/contrib/llvm-project/libcxx/include/stddef.h
index f1725db06212..887776b150e4 100644
--- a/contrib/llvm-project/libcxx/include/stddef.h
+++ b/contrib/llvm-project/libcxx/include/stddef.h
@@ -7,17 +7,17 @@
//
//===----------------------------------------------------------------------===//
-#if defined(__need_ptrdiff_t) || defined(__need_size_t) || \
- defined(__need_wchar_t) || defined(__need_NULL) || defined(__need_wint_t)
+#if defined(__need_ptrdiff_t) || defined(__need_size_t) || defined(__need_wchar_t) || defined(__need_NULL) || \
+ defined(__need_wint_t)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <stddef.h>
+# include_next <stddef.h>
#elif !defined(_LIBCPP_STDDEF_H)
-#define _LIBCPP_STDDEF_H
+# define _LIBCPP_STDDEF_H
/*
stddef.h synopsis
@@ -36,18 +36,18 @@ Types:
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<stddef.h>)
# include_next <stddef.h>
# endif
-#ifdef __cplusplus
- typedef decltype(nullptr) nullptr_t;
-#endif
+# ifdef __cplusplus
+typedef decltype(nullptr) nullptr_t;
+# endif
#endif // _LIBCPP_STDDEF_H
diff --git a/contrib/llvm-project/libcxx/include/stdexcept b/contrib/llvm-project/libcxx/include/stdexcept
index d41e94a5f9e8..3016c130a91b 100644
--- a/contrib/llvm-project/libcxx/include/stdexcept
+++ b/contrib/llvm-project/libcxx/include/stdexcept
@@ -54,166 +54,154 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_ABI_VCRUNTIME
-class _LIBCPP_HIDDEN __libcpp_refstring
-{
- const char* __imp_;
+class _LIBCPP_HIDDEN __libcpp_refstring {
+ const char* __imp_;
+
+ bool __uses_refcount() const;
- bool __uses_refcount() const;
public:
- explicit __libcpp_refstring(const char* __msg);
- __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT;
- __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT;
- ~__libcpp_refstring();
+ explicit __libcpp_refstring(const char* __msg);
+ __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT;
+ __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT;
+ ~__libcpp_refstring();
- _LIBCPP_HIDE_FROM_ABI const char* c_str() const _NOEXCEPT {return __imp_;}
+ _LIBCPP_HIDE_FROM_ABI const char* c_str() const _NOEXCEPT { return __imp_; }
};
#endif // !_LIBCPP_ABI_VCRUNTIME
_LIBCPP_END_NAMESPACE_STD
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
-class _LIBCPP_EXPORTED_FROM_ABI logic_error
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI logic_error : public exception {
#ifndef _LIBCPP_ABI_VCRUNTIME
+
private:
- std::__libcpp_refstring __imp_;
+ std::__libcpp_refstring __imp_;
+
public:
- explicit logic_error(const string&);
- explicit logic_error(const char*);
+ explicit logic_error(const string&);
+ explicit logic_error(const char*);
- logic_error(const logic_error&) _NOEXCEPT;
- logic_error& operator=(const logic_error&) _NOEXCEPT;
+ logic_error(const logic_error&) _NOEXCEPT;
+ logic_error& operator=(const logic_error&) _NOEXCEPT;
- ~logic_error() _NOEXCEPT override;
+ ~logic_error() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
#else
+
public:
- explicit logic_error(const std::string&); // Symbol uses versioned std::string
- _LIBCPP_HIDE_FROM_ABI explicit logic_error(const char* __s) : exception(__s) {}
+ explicit logic_error(const std::string&); // Symbol uses versioned std::string
+ _LIBCPP_HIDE_FROM_ABI explicit logic_error(const char* __s) : exception(__s) {}
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI runtime_error
- : public exception
-{
+class _LIBCPP_EXPORTED_FROM_ABI runtime_error : public exception {
#ifndef _LIBCPP_ABI_VCRUNTIME
+
private:
- std::__libcpp_refstring __imp_;
+ std::__libcpp_refstring __imp_;
+
public:
- explicit runtime_error(const string&);
- explicit runtime_error(const char*);
+ explicit runtime_error(const string&);
+ explicit runtime_error(const char*);
- runtime_error(const runtime_error&) _NOEXCEPT;
- runtime_error& operator=(const runtime_error&) _NOEXCEPT;
+ runtime_error(const runtime_error&) _NOEXCEPT;
+ runtime_error& operator=(const runtime_error&) _NOEXCEPT;
- ~runtime_error() _NOEXCEPT override;
+ ~runtime_error() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
#else
+
public:
- explicit runtime_error(const std::string&); // Symbol uses versioned std::string
- _LIBCPP_HIDE_FROM_ABI explicit runtime_error(const char* __s) : exception(__s) {}
+ explicit runtime_error(const std::string&); // Symbol uses versioned std::string
+ _LIBCPP_HIDE_FROM_ABI explicit runtime_error(const char* __s) : exception(__s) {}
#endif // _LIBCPP_ABI_VCRUNTIME
};
-class _LIBCPP_EXPORTED_FROM_ABI domain_error
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI domain_error : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit domain_error(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit domain_error(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit domain_error(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit domain_error(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI domain_error(const domain_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI domain_error& operator=(const domain_error&) _NOEXCEPT = default;
- ~domain_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI domain_error(const domain_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI domain_error& operator=(const domain_error&) _NOEXCEPT = default;
+ ~domain_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI invalid_argument
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI invalid_argument : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit invalid_argument(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI invalid_argument(const invalid_argument&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI invalid_argument& operator=(const invalid_argument&) _NOEXCEPT = default;
- ~invalid_argument() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI invalid_argument(const invalid_argument&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI invalid_argument& operator=(const invalid_argument&) _NOEXCEPT = default;
+ ~invalid_argument() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI length_error
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI length_error : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit length_error(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit length_error(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit length_error(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit length_error(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI length_error(const length_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI length_error& operator=(const length_error&) _NOEXCEPT = default;
- ~length_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI length_error(const length_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI length_error& operator=(const length_error&) _NOEXCEPT = default;
+ ~length_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI out_of_range
- : public logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI out_of_range : public logic_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const string& __s) : logic_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const char* __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const string& __s) : logic_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit out_of_range(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI out_of_range(const out_of_range&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI out_of_range& operator=(const out_of_range&) _NOEXCEPT = default;
- ~out_of_range() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI out_of_range(const out_of_range&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI out_of_range& operator=(const out_of_range&) _NOEXCEPT = default;
+ ~out_of_range() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI range_error
- : public runtime_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI range_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit range_error(const string& __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit range_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit range_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit range_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI range_error(const range_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI range_error& operator=(const range_error&) _NOEXCEPT = default;
- ~range_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI range_error(const range_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI range_error& operator=(const range_error&) _NOEXCEPT = default;
+ ~range_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI overflow_error
- : public runtime_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI overflow_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const string& __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit overflow_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI overflow_error(const overflow_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI overflow_error& operator=(const overflow_error&) _NOEXCEPT = default;
- ~overflow_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI overflow_error(const overflow_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI overflow_error& operator=(const overflow_error&) _NOEXCEPT = default;
+ ~overflow_error() _NOEXCEPT override;
#endif
};
-class _LIBCPP_EXPORTED_FROM_ABI underflow_error
- : public runtime_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI underflow_error : public runtime_error {
public:
- _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const string& __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const char* __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const string& __s) : runtime_error(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit underflow_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
- _LIBCPP_HIDE_FROM_ABI underflow_error(const underflow_error&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI underflow_error& operator=(const underflow_error&) _NOEXCEPT = default;
- ~underflow_error() _NOEXCEPT override;
+ _LIBCPP_HIDE_FROM_ABI underflow_error(const underflow_error&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI underflow_error& operator=(const underflow_error&) _NOEXCEPT = default;
+ ~underflow_error() _NOEXCEPT override;
#endif
};
@@ -224,83 +212,67 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// in the dylib
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_logic_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw logic_error(__msg);
+ throw logic_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_domain_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw domain_error(__msg);
+ throw domain_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_invalid_argument(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw invalid_argument(__msg);
+ throw invalid_argument(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_length_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw length_error(__msg);
+ throw length_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_out_of_range(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw out_of_range(__msg);
+ throw out_of_range(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_range_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw range_error(__msg);
+ throw range_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_overflow_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw overflow_error(__msg);
+ throw overflow_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_underflow_error(const char*__msg)
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw underflow_error(__msg);
+ throw underflow_error(__msg);
#else
- _LIBCPP_VERBOSE_ABORT("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
+ _LIBCPP_VERBOSE_ABORT("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
diff --git a/contrib/llvm-project/libcxx/include/stdint.h b/contrib/llvm-project/libcxx/include/stdint.h
index fa7b011c71ae..35e5b8cbdad2 100644
--- a/contrib/llvm-project/libcxx/include/stdint.h
+++ b/contrib/llvm-project/libcxx/include/stdint.h
@@ -12,7 +12,7 @@
// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
// case the header guard macro is defined.
#if !defined(_AIX) || !defined(_STD_TYPES_T)
-#define _LIBCPP_STDINT_H
+# define _LIBCPP_STDINT_H
#endif // _STD_TYPES_T
/*
@@ -114,10 +114,10 @@ Macros:
are defined
*/
#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS)
-# define __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
#endif
#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
-# define __STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
#endif
#if __has_include_next(<stdint.h>)
diff --git a/contrib/llvm-project/libcxx/include/stdio.h b/contrib/llvm-project/libcxx/include/stdio.h
index 72ed5c9f94af..3aa559393f18 100644
--- a/contrib/llvm-project/libcxx/include/stdio.h
+++ b/contrib/llvm-project/libcxx/include/stdio.h
@@ -9,14 +9,14 @@
#if defined(__need_FILE) || defined(__need___FILE)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <stdio.h>
+# include_next <stdio.h>
#elif !defined(_LIBCPP_STDIO_H)
-#define _LIBCPP_STDIO_H
+# define _LIBCPP_STDIO_H
/*
stdio.h synopsis
@@ -98,26 +98,26 @@ int ferror(FILE* stream);
void perror(const char* s);
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<stdio.h>)
# include_next <stdio.h>
# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
-#undef getc
-#undef putc
-#undef clearerr
-#undef feof
-#undef ferror
-#undef putchar
-#undef getchar
+# undef getc
+# undef putc
+# undef clearerr
+# undef feof
+# undef ferror
+# undef putchar
+# undef getchar
-#endif
+# endif
#endif // _LIBCPP_STDIO_H
diff --git a/contrib/llvm-project/libcxx/include/stdlib.h b/contrib/llvm-project/libcxx/include/stdlib.h
index 712f12149c13..a9ba438a2c42 100644
--- a/contrib/llvm-project/libcxx/include/stdlib.h
+++ b/contrib/llvm-project/libcxx/include/stdlib.h
@@ -9,14 +9,14 @@
#if defined(__need_malloc_and_calloc)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <stdlib.h>
+# include_next <stdlib.h>
#elif !defined(_LIBCPP_STDLIB_H)
-#define _LIBCPP_STDLIB_H
+# define _LIBCPP_STDLIB_H
/*
stdlib.h synopsis
@@ -84,39 +84,37 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
*/
-#include <__config>
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
# if __has_include_next(<stdlib.h>)
# include_next <stdlib.h>
# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
extern "C++" {
// abs
-#ifdef abs
-# undef abs
-#endif
-#ifdef labs
-# undef labs
-#endif
-#ifdef llabs
-# undef llabs
-#endif
+# ifdef abs
+# undef abs
+# endif
+# ifdef labs
+# undef labs
+# endif
+# ifdef llabs
+# undef llabs
+# endif
// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
-#if !defined(_LIBCPP_MSVCRT)
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT {
- return __builtin_labs(__x);
-}
+# if !defined(_LIBCPP_MSVCRT)
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); }
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long long abs(long long __x) _NOEXCEPT {
return __builtin_llabs(__x);
}
-#endif // !defined(_LIBCPP_MSVCRT)
+# endif // !defined(_LIBCPP_MSVCRT)
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float abs(float __lcpp_x) _NOEXCEPT {
return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h
@@ -126,36 +124,30 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI double abs(double __lcpp_x) _
return __builtin_fabs(__lcpp_x);
}
-_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double
-abs(long double __lcpp_x) _NOEXCEPT {
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT {
return __builtin_fabsl(__lcpp_x);
}
// div
-#ifdef div
-# undef div
-#endif
-#ifdef ldiv
-# undef ldiv
-#endif
-#ifdef lldiv
-# undef lldiv
-#endif
+# ifdef div
+# undef div
+# endif
+# ifdef ldiv
+# undef ldiv
+# endif
+# ifdef lldiv
+# undef lldiv
+# endif
// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
-#if !defined(_LIBCPP_MSVCRT)
-inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT {
- return ::ldiv(__x, __y);
-}
-#if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED))
-inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x,
- long long __y) _NOEXCEPT {
- return ::lldiv(__x, __y);
-}
-#endif
-#endif // _LIBCPP_MSVCRT
+# if !defined(_LIBCPP_MSVCRT)
+inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); }
+# if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED))
+inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); }
+# endif
+# endif // _LIBCPP_MSVCRT
} // extern "C++"
-#endif // __cplusplus
+# endif // __cplusplus
#endif // _LIBCPP_STDLIB_H
diff --git a/contrib/llvm-project/libcxx/include/streambuf b/contrib/llvm-project/libcxx/include/streambuf
index b0e65b13151f..577ad340d033 100644
--- a/contrib/llvm-project/libcxx/include/streambuf
+++ b/contrib/llvm-project/libcxx/include/streambuf
@@ -125,201 +125,173 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TEMPLATE_VIS basic_streambuf
-{
+class _LIBCPP_TEMPLATE_VIS basic_streambuf {
public:
- // types:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
-
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
-
- virtual ~basic_streambuf();
-
- // 27.6.2.2.1 locales:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- locale pubimbue(const locale& __loc) {
- imbue(__loc);
- locale __r = __loc_;
- __loc_ = __loc;
- return __r;
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- locale getloc() const { return __loc_; }
-
- // 27.6.2.2.2 buffer and positioning:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- basic_streambuf* pubsetbuf(char_type* __s, streamsize __n)
- { return setbuf(__s, __n); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- pos_type pubseekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out)
- { return seekoff(__off, __way, __which); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- pos_type pubseekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out)
- { return seekpos(__sp, __which); }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int pubsync() { return sync(); }
-
- // Get and put areas:
- // 27.6.2.2.3 Get area:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- streamsize in_avail() {
- if (__ninp_ < __einp_)
- return static_cast<streamsize>(__einp_ - __ninp_);
- return showmanyc();
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type snextc() {
- if (sbumpc() == traits_type::eof())
- return traits_type::eof();
- return sgetc();
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sbumpc() {
- if (__ninp_ == __einp_)
- return uflow();
- return traits_type::to_int_type(*__ninp_++);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sgetc() {
- if (__ninp_ == __einp_)
- return underflow();
- return traits_type::to_int_type(*__ninp_);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- streamsize sgetn(char_type* __s, streamsize __n)
- { return xsgetn(__s, __n); }
-
- // 27.6.2.2.4 Putback:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sputbackc(char_type __c) {
- if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1]))
- return pbackfail(traits_type::to_int_type(__c));
- return traits_type::to_int_type(*--__ninp_);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sungetc() {
- if (__binp_ == __ninp_)
- return pbackfail();
- return traits_type::to_int_type(*--__ninp_);
- }
-
- // 27.6.2.2.5 Put area:
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- int_type sputc(char_type __c) {
- if (__nout_ == __eout_)
- return overflow(traits_type::to_int_type(__c));
- *__nout_++ = __c;
- return traits_type::to_int_type(__c);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- streamsize sputn(const char_type* __s, streamsize __n)
- { return xsputn(__s, __n); }
+ // types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
+
+ virtual ~basic_streambuf();
+
+ // 27.6.2.2.1 locales:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 locale pubimbue(const locale& __loc) {
+ imbue(__loc);
+ locale __r = __loc_;
+ __loc_ = __loc;
+ return __r;
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 locale getloc() const { return __loc_; }
+
+ // 27.6.2.2.2 buffer and positioning:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) {
+ return setbuf(__s, __n);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type
+ pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) {
+ return seekoff(__off, __way, __which);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type
+ pubseekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) {
+ return seekpos(__sp, __which);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int pubsync() { return sync(); }
+
+ // Get and put areas:
+ // 27.6.2.2.3 Get area:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize in_avail() {
+ if (__ninp_ < __einp_)
+ return static_cast<streamsize>(__einp_ - __ninp_);
+ return showmanyc();
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type snextc() {
+ if (sbumpc() == traits_type::eof())
+ return traits_type::eof();
+ return sgetc();
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sbumpc() {
+ if (__ninp_ == __einp_)
+ return uflow();
+ return traits_type::to_int_type(*__ninp_++);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sgetc() {
+ if (__ninp_ == __einp_)
+ return underflow();
+ return traits_type::to_int_type(*__ninp_);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize sgetn(char_type* __s, streamsize __n) { return xsgetn(__s, __n); }
+
+ // 27.6.2.2.4 Putback:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sputbackc(char_type __c) {
+ if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1]))
+ return pbackfail(traits_type::to_int_type(__c));
+ return traits_type::to_int_type(*--__ninp_);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sungetc() {
+ if (__binp_ == __ninp_)
+ return pbackfail();
+ return traits_type::to_int_type(*--__ninp_);
+ }
+
+ // 27.6.2.2.5 Put area:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 int_type sputc(char_type __c) {
+ if (__nout_ == __eout_)
+ return overflow(traits_type::to_int_type(__c));
+ *__nout_++ = __c;
+ return traits_type::to_int_type(__c);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 streamsize sputn(const char_type* __s, streamsize __n) {
+ return xsputn(__s, __n);
+ }
protected:
- basic_streambuf();
- basic_streambuf(const basic_streambuf& __rhs);
- basic_streambuf& operator=(const basic_streambuf& __rhs);
- void swap(basic_streambuf& __rhs);
-
- // 27.6.2.3.2 Get area:
- _LIBCPP_HIDE_FROM_ABI char_type* eback() const {return __binp_;}
- _LIBCPP_HIDE_FROM_ABI char_type* gptr() const {return __ninp_;}
- _LIBCPP_HIDE_FROM_ABI char_type* egptr() const {return __einp_;}
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void gbump(int __n) { __ninp_ += __n; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) {
- __binp_ = __gbeg;
- __ninp_ = __gnext;
- __einp_ = __gend;
- }
-
- // 27.6.2.3.3 Put area:
- _LIBCPP_HIDE_FROM_ABI char_type* pbase() const {return __bout_;}
- _LIBCPP_HIDE_FROM_ABI char_type* pptr() const {return __nout_;}
- _LIBCPP_HIDE_FROM_ABI char_type* epptr() const {return __eout_;}
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void pbump(int __n) { __nout_ += __n; }
-
- _LIBCPP_HIDE_FROM_ABI
- void __pbump(streamsize __n) { __nout_ += __n; }
-
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- void setp(char_type* __pbeg, char_type* __pend) {
- __bout_ = __nout_ = __pbeg;
- __eout_ = __pend;
- }
-
- // 27.6.2.4 virtual functions:
- // 27.6.2.4.1 Locales:
- virtual void imbue(const locale& __loc);
-
- // 27.6.2.4.2 Buffer management and positioning:
- virtual basic_streambuf* setbuf(char_type* __s, streamsize __n);
- virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out);
- virtual pos_type seekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out);
- virtual int sync();
-
- // 27.6.2.4.3 Get area:
- virtual streamsize showmanyc();
- virtual streamsize xsgetn(char_type* __s, streamsize __n);
- virtual int_type underflow();
- virtual int_type uflow();
-
- // 27.6.2.4.4 Putback:
- virtual int_type pbackfail(int_type __c = traits_type::eof());
-
- // 27.6.2.4.5 Put area:
- virtual streamsize xsputn(const char_type* __s, streamsize __n);
- virtual int_type overflow(int_type __c = traits_type::eof());
+ basic_streambuf();
+ basic_streambuf(const basic_streambuf& __rhs);
+ basic_streambuf& operator=(const basic_streambuf& __rhs);
+ void swap(basic_streambuf& __rhs);
+
+ // 27.6.2.3.2 Get area:
+ _LIBCPP_HIDE_FROM_ABI char_type* eback() const { return __binp_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* gptr() const { return __ninp_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* egptr() const { return __einp_; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void gbump(int __n) { __ninp_ += __n; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) {
+ __binp_ = __gbeg;
+ __ninp_ = __gnext;
+ __einp_ = __gend;
+ }
+
+ // 27.6.2.3.3 Put area:
+ _LIBCPP_HIDE_FROM_ABI char_type* pbase() const { return __bout_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* pptr() const { return __nout_; }
+ _LIBCPP_HIDE_FROM_ABI char_type* epptr() const { return __eout_; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void pbump(int __n) { __nout_ += __n; }
+
+ _LIBCPP_HIDE_FROM_ABI void __pbump(streamsize __n) { __nout_ += __n; }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void setp(char_type* __pbeg, char_type* __pend) {
+ __bout_ = __nout_ = __pbeg;
+ __eout_ = __pend;
+ }
+
+ // 27.6.2.4 virtual functions:
+ // 27.6.2.4.1 Locales:
+ virtual void imbue(const locale& __loc);
+
+ // 27.6.2.4.2 Buffer management and positioning:
+ virtual basic_streambuf* setbuf(char_type* __s, streamsize __n);
+ virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out);
+ virtual int sync();
+
+ // 27.6.2.4.3 Get area:
+ virtual streamsize showmanyc();
+ virtual streamsize xsgetn(char_type* __s, streamsize __n);
+ virtual int_type underflow();
+ virtual int_type uflow();
+
+ // 27.6.2.4.4 Putback:
+ virtual int_type pbackfail(int_type __c = traits_type::eof());
+
+ // 27.6.2.4.5 Put area:
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+ virtual int_type overflow(int_type __c = traits_type::eof());
private:
- locale __loc_;
- char_type* __binp_;
- char_type* __ninp_;
- char_type* __einp_;
- char_type* __bout_;
- char_type* __nout_;
- char_type* __eout_;
+ locale __loc_;
+ char_type* __binp_;
+ char_type* __ninp_;
+ char_type* __einp_;
+ char_type* __bout_;
+ char_type* __nout_;
+ char_type* __eout_;
};
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>::~basic_streambuf()
-{
-}
+basic_streambuf<_CharT, _Traits>::~basic_streambuf() {}
template <class _CharT, class _Traits>
basic_streambuf<_CharT, _Traits>::basic_streambuf()
- : __binp_(nullptr),
- __ninp_(nullptr),
- __einp_(nullptr),
- __bout_(nullptr),
- __nout_(nullptr),
- __eout_(nullptr)
-{
-}
+ : __binp_(nullptr), __ninp_(nullptr), __einp_(nullptr), __bout_(nullptr), __nout_(nullptr), __eout_(nullptr) {}
template <class _CharT, class _Traits>
basic_streambuf<_CharT, _Traits>::basic_streambuf(const basic_streambuf& __sb)
@@ -329,164 +301,124 @@ basic_streambuf<_CharT, _Traits>::basic_streambuf(const basic_streambuf& __sb)
__einp_(__sb.__einp_),
__bout_(__sb.__bout_),
__nout_(__sb.__nout_),
- __eout_(__sb.__eout_)
-{
-}
+ __eout_(__sb.__eout_) {}
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>&
-basic_streambuf<_CharT, _Traits>::operator=(const basic_streambuf& __sb)
-{
- __loc_ = __sb.__loc_;
- __binp_ = __sb.__binp_;
- __ninp_ = __sb.__ninp_;
- __einp_ = __sb.__einp_;
- __bout_ = __sb.__bout_;
- __nout_ = __sb.__nout_;
- __eout_ = __sb.__eout_;
- return *this;
+basic_streambuf<_CharT, _Traits>& basic_streambuf<_CharT, _Traits>::operator=(const basic_streambuf& __sb) {
+ __loc_ = __sb.__loc_;
+ __binp_ = __sb.__binp_;
+ __ninp_ = __sb.__ninp_;
+ __einp_ = __sb.__einp_;
+ __bout_ = __sb.__bout_;
+ __nout_ = __sb.__nout_;
+ __eout_ = __sb.__eout_;
+ return *this;
}
template <class _CharT, class _Traits>
-void
-basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
-{
- std::swap(__loc_, __sb.__loc_);
- std::swap(__binp_, __sb.__binp_);
- std::swap(__ninp_, __sb.__ninp_);
- std::swap(__einp_, __sb.__einp_);
- std::swap(__bout_, __sb.__bout_);
- std::swap(__nout_, __sb.__nout_);
- std::swap(__eout_, __sb.__eout_);
+void basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb) {
+ std::swap(__loc_, __sb.__loc_);
+ std::swap(__binp_, __sb.__binp_);
+ std::swap(__ninp_, __sb.__ninp_);
+ std::swap(__einp_, __sb.__einp_);
+ std::swap(__bout_, __sb.__bout_);
+ std::swap(__nout_, __sb.__nout_);
+ std::swap(__eout_, __sb.__eout_);
}
template <class _CharT, class _Traits>
-void
-basic_streambuf<_CharT, _Traits>::imbue(const locale&)
-{
-}
+void basic_streambuf<_CharT, _Traits>::imbue(const locale&) {}
template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>*
-basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
-{
- return this;
+basic_streambuf<_CharT, _Traits>* basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize) {
+ return this;
}
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
- ios_base::openmode)
-{
- return pos_type(off_type(-1));
+basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, ios_base::openmode) {
+ return pos_type(off_type(-1));
}
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
-{
- return pos_type(off_type(-1));
+basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) {
+ return pos_type(off_type(-1));
}
template <class _CharT, class _Traits>
-int
-basic_streambuf<_CharT, _Traits>::sync()
-{
- return 0;
+int basic_streambuf<_CharT, _Traits>::sync() {
+ return 0;
}
template <class _CharT, class _Traits>
-streamsize
-basic_streambuf<_CharT, _Traits>::showmanyc()
-{
- return 0;
+streamsize basic_streambuf<_CharT, _Traits>::showmanyc() {
+ return 0;
}
template <class _CharT, class _Traits>
-streamsize
-basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n)
-{
- const int_type __eof = traits_type::eof();
- int_type __c;
- streamsize __i = 0;
- while(__i < __n)
- {
- if (__ninp_ < __einp_)
- {
- const streamsize __len = std::min(static_cast<streamsize>(INT_MAX),
- std::min(__einp_ - __ninp_, __n - __i));
- traits_type::copy(__s, __ninp_, __len);
- __s += __len;
- __i += __len;
- this->gbump(__len);
- }
- else if ((__c = uflow()) != __eof)
- {
- *__s = traits_type::to_char_type(__c);
- ++__s;
- ++__i;
- }
- else
- break;
- }
- return __i;
+streamsize basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n) {
+ const int_type __eof = traits_type::eof();
+ int_type __c;
+ streamsize __i = 0;
+ while (__i < __n) {
+ if (__ninp_ < __einp_) {
+ const streamsize __len = std::min(static_cast<streamsize>(INT_MAX), std::min(__einp_ - __ninp_, __n - __i));
+ traits_type::copy(__s, __ninp_, __len);
+ __s += __len;
+ __i += __len;
+ this->gbump(__len);
+ } else if ((__c = uflow()) != __eof) {
+ *__s = traits_type::to_char_type(__c);
+ ++__s;
+ ++__i;
+ } else
+ break;
+ }
+ return __i;
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::underflow()
-{
- return traits_type::eof();
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::underflow() {
+ return traits_type::eof();
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::uflow()
-{
- if (underflow() == traits_type::eof())
- return traits_type::eof();
- return traits_type::to_int_type(*__ninp_++);
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::uflow() {
+ if (underflow() == traits_type::eof())
+ return traits_type::eof();
+ return traits_type::to_int_type(*__ninp_++);
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::pbackfail(int_type)
-{
- return traits_type::eof();
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::pbackfail(int_type) {
+ return traits_type::eof();
}
template <class _CharT, class _Traits>
-streamsize
-basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
-{
- streamsize __i = 0;
- int_type __eof = traits_type::eof();
- while( __i < __n)
- {
- if (__nout_ >= __eout_)
- {
- if (overflow(traits_type::to_int_type(*__s)) == __eof)
- break;
- ++__s;
- ++__i;
- }
- else
- {
- streamsize __chunk_size = std::min(__eout_ - __nout_, __n - __i);
- traits_type::copy(__nout_, __s, __chunk_size);
- __nout_ += __chunk_size;
- __s += __chunk_size;
- __i += __chunk_size;
- }
+streamsize basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n) {
+ streamsize __i = 0;
+ int_type __eof = traits_type::eof();
+ while (__i < __n) {
+ if (__nout_ >= __eout_) {
+ if (overflow(traits_type::to_int_type(*__s)) == __eof)
+ break;
+ ++__s;
+ ++__i;
+ } else {
+ streamsize __chunk_size = std::min(__eout_ - __nout_, __n - __i);
+ traits_type::copy(__nout_, __s, __chunk_size);
+ __nout_ += __chunk_size;
+ __s += __chunk_size;
+ __i += __chunk_size;
}
- return __i;
+ }
+ return __i;
}
template <class _CharT, class _Traits>
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::overflow(int_type)
-{
- return traits_type::eof();
+typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::overflow(int_type) {
+ return traits_type::eof();
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>;
diff --git a/contrib/llvm-project/libcxx/include/string b/contrib/llvm-project/libcxx/include/string
index 5bb4e941af36..c676182fba8b 100644
--- a/contrib/llvm-project/libcxx/include/string
+++ b/contrib/llvm-project/libcxx/include/string
@@ -618,7 +618,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
#include <__utility/swap.h>
#include <__utility/unreachable.h>
#include <climits>
-#include <cstdio> // EOF
+#include <cstdio> // EOF
#include <cstring>
#include <limits>
#include <stdexcept>
@@ -665,30 +665,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// basic_string
-template<class _CharT, class _Traits, class _Allocator>
-basic_string<_CharT, _Traits, _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
- const basic_string<_CharT, _Traits, _Allocator>& __y);
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const basic_string<_CharT, _Traits, _Allocator>& __y);
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __x, const basic_string<_CharT, _Traits, _Allocator>& __y);
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __x, const basic_string<_CharT, _Traits, _Allocator>& __y);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
extern template _LIBCPP_EXPORTED_FROM_ABI string operator+
@@ -698,199 +692,187 @@ template <class _Iter>
struct __string_is_trivial_iterator : public false_type {};
template <class _Tp>
-struct __string_is_trivial_iterator<_Tp*>
- : public is_arithmetic<_Tp> {};
+struct __string_is_trivial_iterator<_Tp*> : public is_arithmetic<_Tp> {};
template <class _Iter>
-struct __string_is_trivial_iterator<__wrap_iter<_Iter> >
- : public __string_is_trivial_iterator<_Iter> {};
+struct __string_is_trivial_iterator<__wrap_iter<_Iter> > : public __string_is_trivial_iterator<_Iter> {};
template <class _CharT, class _Traits, class _Tp>
-struct __can_be_converted_to_string_view : public _BoolConstant<
- is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
- !is_convertible<const _Tp&, const _CharT*>::value
- > {};
+struct __can_be_converted_to_string_view
+ : public _BoolConstant< is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
+ !is_convertible<const _Tp&, const _CharT*>::value > {};
struct __uninitialized_size_tag {};
struct __init_with_sentinel_tag {};
-template<class _CharT, class _Traits, class _Allocator>
-class basic_string
-{
+template <class _CharT, class _Traits, class _Allocator>
+class basic_string {
private:
using __default_allocator_type = allocator<_CharT>;
public:
- typedef basic_string __self;
- typedef basic_string_view<_CharT, _Traits> __self_view;
- typedef _Traits traits_type;
- typedef _CharT value_type;
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
-
- static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array");
- static_assert(( is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout");
- static_assert(( is_trivial<value_type>::value), "Character type of basic_string must be trivial");
- static_assert(( is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
- static_assert(( is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- // TODO: Implement iterator bounds checking without requiring the global database.
- typedef __wrap_iter<pointer> iterator;
- typedef __wrap_iter<const_pointer> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef basic_string __self;
+ typedef basic_string_view<_CharT, _Traits> __self_view;
+ typedef _Traits traits_type;
+ typedef _CharT value_type;
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+
+ static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array");
+ static_assert((is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout");
+ static_assert((is_trivial<value_type>::value), "Character type of basic_string must be trivial");
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ // TODO: Implement iterator bounds checking without requiring the global database.
+ typedef __wrap_iter<pointer> iterator;
+ typedef __wrap_iter<const_pointer> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
- static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");
+ static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
- struct __long
- {
- pointer __data_;
- size_type __size_;
- size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
- size_type __is_long_ : 1;
- };
-
- enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
- (sizeof(__long) - 1)/sizeof(value_type) : 2};
-
- struct __short
- {
- value_type __data_[__min_cap];
- unsigned char __padding_[sizeof(value_type) - 1];
- unsigned char __size_ : 7;
- unsigned char __is_long_ : 1;
- };
-
-// The __endian_factor is required because the field we use to store the size
-// has one fewer bit than it would if it were not a bitfield.
-//
-// If the LSB is used to store the short-flag in the short string representation,
-// we have to multiply the size by two when it is stored and divide it by two when
-// it is loaded to make sure that we always store an even number. In the long string
-// representation, we can ignore this because we can assume that we always allocate
-// an even amount of value_types.
-//
-// If the MSB is used for the short-flag, the max_size() is numeric_limits<size_type>::max() / 2.
-// This does not impact the short string representation, since we never need the MSB
-// for representing the size of a short string anyway.
-
-#ifdef _LIBCPP_BIG_ENDIAN
- static const size_type __endian_factor = 2;
-#else
- static const size_type __endian_factor = 1;
-#endif
+ struct __long {
+ pointer __data_;
+ size_type __size_;
+ size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
+ size_type __is_long_ : 1;
+ };
+
+ enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 };
+
+ struct __short {
+ value_type __data_[__min_cap];
+ unsigned char __padding_[sizeof(value_type) - 1];
+ unsigned char __size_ : 7;
+ unsigned char __is_long_ : 1;
+ };
+
+ // The __endian_factor is required because the field we use to store the size
+ // has one fewer bit than it would if it were not a bitfield.
+ //
+ // If the LSB is used to store the short-flag in the short string representation,
+ // we have to multiply the size by two when it is stored and divide it by two when
+ // it is loaded to make sure that we always store an even number. In the long string
+ // representation, we can ignore this because we can assume that we always allocate
+ // an even amount of value_types.
+ //
+ // If the MSB is used for the short-flag, the max_size() is numeric_limits<size_type>::max() / 2.
+ // This does not impact the short string representation, since we never need the MSB
+ // for representing the size of a short string anyway.
+
+# ifdef _LIBCPP_BIG_ENDIAN
+ static const size_type __endian_factor = 2;
+# else
+ static const size_type __endian_factor = 1;
+# endif
#else // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-#ifdef _LIBCPP_BIG_ENDIAN
- static const size_type __endian_factor = 1;
-#else
- static const size_type __endian_factor = 2;
-#endif
+# ifdef _LIBCPP_BIG_ENDIAN
+ static const size_type __endian_factor = 1;
+# else
+ static const size_type __endian_factor = 2;
+# endif
- // Attribute 'packed' is used to keep the layout compatible with the
- // previous definition that did not use bit fields. This is because on
- // some platforms bit fields have a default size rather than the actual
- // size used, e.g., it is 4 bytes on AIX. See D128285 for details.
- struct __long
- {
- struct _LIBCPP_PACKED {
- size_type __is_long_ : 1;
- size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
- };
- size_type __size_;
- pointer __data_;
+ // Attribute 'packed' is used to keep the layout compatible with the
+ // previous definition that did not use bit fields. This is because on
+ // some platforms bit fields have a default size rather than the actual
+ // size used, e.g., it is 4 bytes on AIX. See D128285 for details.
+ struct __long {
+ struct _LIBCPP_PACKED {
+ size_type __is_long_ : 1;
+ size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
};
+ size_type __size_;
+ pointer __data_;
+ };
- enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
- (sizeof(__long) - 1)/sizeof(value_type) : 2};
-
- struct __short
- {
- struct _LIBCPP_PACKED {
- unsigned char __is_long_ : 1;
- unsigned char __size_ : 7;
- };
- char __padding_[sizeof(value_type) - 1];
- value_type __data_[__min_cap];
+ enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 };
+
+ struct __short {
+ struct _LIBCPP_PACKED {
+ unsigned char __is_long_ : 1;
+ unsigned char __size_ : 7;
};
+ char __padding_[sizeof(value_type) - 1];
+ value_type __data_[__min_cap];
+ };
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
- static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size.");
+ static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size.");
- union __ulx{__long __lx; __short __lxx;};
+ union __ulx {
+ __long __lx;
+ __short __lxx;
+ };
- enum {__n_words = sizeof(__ulx) / sizeof(size_type)};
+ enum { __n_words = sizeof(__ulx) / sizeof(size_type) };
- struct __raw
- {
- size_type __words[__n_words];
- };
+ struct __raw {
+ size_type __words[__n_words];
+ };
- struct __rep
- {
- union
- {
- __short __s;
- __long __l;
- __raw __r;
- };
+ struct __rep {
+ union {
+ __short __s;
+ __long __l;
+ __raw __r;
};
+ };
- __compressed_pair<__rep, allocator_type> __r_;
-
- // Construct a string with the given allocator and enough storage to hold `__size` characters, but
- // don't initialize the characters. The contents of the string, including the null terminator, must be
- // initialized separately.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a)
- : __r_(__default_init_tag(), __a) {
- if (__size > max_size())
- __throw_length_error();
- if (__fits_in_sso(__size)) {
- __r_.first() = __rep();
- __set_short_size(__size);
- } else {
- auto __capacity = __recommend(__size) + 1;
- auto __allocation = __alloc_traits::allocate(__alloc(), __capacity);
- __begin_lifetime(__allocation, __capacity);
- __set_long_cap(__capacity);
- __set_long_pointer(__allocation);
- __set_long_size(__size);
- }
- __annotate_new(__size);
- }
+ __compressed_pair<__rep, allocator_type> __r_;
- template <class _Iter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string(__init_with_sentinel_tag, _Iter __first, _Sent __last, const allocator_type& __a)
- : __r_(__default_init_tag(), __a) {
- __init_with_sentinel(std::move(__first), std::move(__last));
+ // Construct a string with the given allocator and enough storage to hold `__size` characters, but
+ // don't initialize the characters. The contents of the string, including the null terminator, must be
+ // initialized separately.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(
+ __uninitialized_size_tag, size_type __size, const allocator_type& __a)
+ : __r_(__default_init_tag(), __a) {
+ if (__size > max_size())
+ __throw_length_error();
+ if (__fits_in_sso(__size)) {
+ __r_.first() = __rep();
+ __set_short_size(__size);
+ } else {
+ auto __capacity = __recommend(__size) + 1;
+ auto __allocation = __alloc_traits::allocate(__alloc(), __capacity);
+ __begin_lifetime(__allocation, __capacity);
+ __set_long_cap(__capacity);
+ __set_long_pointer(__allocation);
+ __set_long_size(__size);
}
+ __annotate_new(__size);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) {
- return iterator(__p);
- }
+ template <class _Iter, class _Sent>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ basic_string(__init_with_sentinel_tag, _Iter __first, _Sent __last, const allocator_type& __a)
+ : __r_(__default_init_tag(), __a) {
+ __init_with_sentinel(std::move(__first), std::move(__last));
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const {
- return const_iterator(__p);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) { return iterator(__p); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const {
+ return const_iterator(__p);
+ }
public:
_LIBCPP_TEMPLATE_DATA_VIS static const size_type npos = -1;
@@ -898,7 +880,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __r_(__value_init_tag(), __default_init_tag()) {
- __annotate_new(0);
+ __annotate_new(0);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const allocator_type& __a)
@@ -908,34 +890,30 @@ public:
_NOEXCEPT
#endif
: __r_(__value_init_tag(), __a) {
- __annotate_new(0);
+ __annotate_new(0);
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str)
: __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) {
- if (!__str.__is_long())
- {
+ if (!__str.__is_long()) {
__r_.first() = __str.__r_.first();
__annotate_new(__get_short_size());
- }
- else
+ } else
__init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str, const allocator_type& __a)
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
+ basic_string(const basic_string& __str, const allocator_type& __a)
: __r_(__default_init_tag(), __a) {
- if (!__str.__is_long())
- {
+ if (!__str.__is_long()) {
__r_.first() = __str.__r_.first();
__annotate_new(__get_short_size());
- }
- else
+ } else
__init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string(basic_string&& __str)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str)
# if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
# else
@@ -944,15 +922,14 @@ public:
// Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
// does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first.
// __str's memory needs to be unpoisoned only in the case where it's a short string.
- : __r_( ( (__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)), std::move(__str.__r_)) ) {
+ : __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)), std::move(__str.__r_))) {
__str.__r_.first() = __rep();
__str.__annotate_new(0);
- if(!__is_long())
+ if (!__is_long())
__annotate_new(size());
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string(basic_string&& __str, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str, const allocator_type& __a)
: __r_(__default_init_tag(), __a) {
if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
__init(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
@@ -961,10 +938,10 @@ public:
__r_.first() = __rep();
if (!__str.__is_long())
__str.__annotate_delete();
- __r_.first() = __str.__r_.first();
+ __r_.first() = __str.__r_.first();
__str.__r_.first() = __rep();
__str.__annotate_new(0);
- if(!__is_long() && this != &__str)
+ if (!__is_long() && this != &__str)
__annotate_new(size());
}
}
@@ -1007,12 +984,12 @@ public:
}
#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string(basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator())
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string(
+ basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator())
: basic_string(std::move(__str), __pos, npos, __alloc) {}
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string(basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator())
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string(
+ basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator())
: __r_(__default_init_tag(), __alloc) {
if (__pos > __str.size())
__throw_out_of_range();
@@ -1099,8 +1076,8 @@ public:
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string(
+ from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
: __r_(__default_init_tag(), __a) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
__init_with_size(ranges::begin(__range), ranges::end(__range), ranges::distance(__range));
@@ -1128,116 +1105,117 @@ public:
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view() const _NOEXCEPT {
+ return __self_view(data(), size());
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(const basic_string& __str);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string&
+ operator=(const basic_string& __str);
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value, int> = 0>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {
- __self_view __sv = __t;
- return assign(__sv);
- }
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {
+ __self_view __sv = __t;
+ return assign(__sv);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- operator=(basic_string&& __str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(basic_string&& __str)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
__move_assign(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(initializer_list<value_type> __il) {
+ return assign(__il.begin(), __il.size());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& operator=(const value_type* __s) {return assign(__s);}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const value_type* __s) {
+ return assign(__s);
+ }
#if _LIBCPP_STD_VER >= 23
- basic_string& operator=(nullptr_t) = delete;
+ basic_string& operator=(nullptr_t) = delete;
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(value_type __c);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator begin() _NOEXCEPT
- {return __make_iterator(__get_pointer());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator begin() const _NOEXCEPT
- {return __make_const_iterator(__get_pointer());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator end() _NOEXCEPT
- {return __make_iterator(__get_pointer() + size());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator end() const _NOEXCEPT
- {return __make_const_iterator(__get_pointer() + size());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cbegin() const _NOEXCEPT
- {return begin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cend() const _NOEXCEPT
- {return end();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crend() const _NOEXCEPT
- {return rend();}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT
- {return __is_long() ? __get_long_size() : __get_short_size();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT {return size();}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& operator=(value_type __c);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
+ return __make_iterator(__get_pointer());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
+ return __make_const_iterator(__get_pointer());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
+ return __make_iterator(__get_pointer() + size());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
+ return __make_const_iterator(__get_pointer() + size());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT {
+ return __is_long() ? __get_long_size() : __get_short_size();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT { return size(); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT {
size_type __m = __alloc_traits::max_size(__alloc());
if (__m <= std::numeric_limits<size_type>::max() / 2) {
return __m - __alignment;
} else {
- bool __uses_lsb = __endian_factor == 2;
+ bool __uses_lsb = __endian_factor == 2;
return __uses_lsb ? __m - __alignment : (__m / 2) - __alignment;
}
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
- return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
+ return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n, value_type __c);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __n) { resize(__n, value_type()); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __requested_capacity);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __requested_capacity);
#if _LIBCPP_STD_VER >= 23
- template <class _Op>
- _LIBCPP_HIDE_FROM_ABI constexpr
- void resize_and_overwrite(size_type __n, _Op __op) {
- __resize_default_init(__n);
- __erase_to_end(std::move(__op)(data(), _LIBCPP_AUTO_CAST(__n)));
- }
+ template <class _Op>
+ _LIBCPP_HIDE_FROM_ABI constexpr void resize_and_overwrite(size_type __n, _Op __op) {
+ __resize_default_init(__n);
+ __erase_to_end(std::move(__op)(data(), _LIBCPP_AUTO_CAST(__n)));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);
#if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE)
- _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); }
+ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT;
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- bool empty() const _NOEXCEPT {return size() == 0;}
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT {
+ return size() == 0;
+ }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __pos) const _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos <= size(), "string index out of bounds");
@@ -1255,38 +1233,40 @@ public:
return *(__get_pointer() + __pos);
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) {
- return append(__str);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) {
+ return append(__str);
+ }
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string >::value,
- int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- operator+=(const _Tp& __t) {
- __self_view __sv = __t; return append(__sv);
- }
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string >::value,
+ int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ operator+=(const _Tp& __t) {
+ __self_view __sv = __t;
+ return append(__sv);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const value_type* __s) {
- return append(__s);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const value_type* __s) {
+ return append(__s);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(value_type __c) {
- push_back(__c);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(value_type __c) {
+ push_back(__c);
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& operator+=(initializer_list<value_type> __il) { return append(__il); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(initializer_list<value_type> __il) {
+ return append(__il);
+ }
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str) {
- return append(__str.data(), __str.size());
+ return append(__str.data(), __str.size());
}
template <class _Tp,
@@ -1295,56 +1275,55 @@ public:
int> = 0>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
append(const _Tp& __t) {
- __self_view __sv = __t;
- return append(__sv.data(), __sv.size());
+ __self_view __sv = __t;
+ return append(__sv.data(), __sv.size());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n = npos);
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
- int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string&
- append(const _Tp& __t, size_type __pos, size_type __n = npos);
+ basic_string&
+ append(const _Tp& __t, size_type __pos, size_type __n = npos);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __append_default_init(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append_default_init(size_type __n);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- append(_InputIterator __first, _InputIterator __last) {
- const basic_string __temp(__first, __last, __alloc());
- append(__temp.data(), __temp.size());
- return *this;
- }
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ append(_InputIterator __first, _InputIterator __last) {
+ const basic_string __temp(__first, __last, __alloc());
+ append(__temp.data(), __temp.size());
+ return *this;
+ }
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- append(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ append(_ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr basic_string& append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- return *this;
- }
+ template <_ContainerCompatibleRange<_CharT> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string& append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ return *this;
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(initializer_list<value_type> __il) {
+ return append(__il.begin(), __il.size());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back();
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back();
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::front(): string is empty");
@@ -1374,14 +1353,13 @@ public:
}
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI constexpr
- void __move_assign(basic_string&& __str, size_type __pos, size_type __len) {
+ _LIBCPP_HIDE_FROM_ABI constexpr void __move_assign(basic_string&& __str, size_type __pos, size_type __len) {
// Pilfer the allocation from __str.
_LIBCPP_ASSERT_INTERNAL(__alloc() == __str.__alloc(), "__move_assign called with wrong allocator");
size_type __old_sz = __str.size();
if (!__str.__is_long())
__str.__annotate_delete();
- __r_.first() = __str.__r_.first();
+ __r_.first() = __str.__r_.first();
__str.__r_.first() = __rep();
__str.__annotate_new(0);
@@ -1391,60 +1369,62 @@ public:
if (!__is_long()) {
__annotate_new(__len);
- } else if(__old_sz > __len) {
+ } else if (__old_sz > __len) {
__annotate_shrink(__old_sz);
}
}
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& assign(const basic_string& __str) { return *this = __str; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str) {
+ return *this = __str;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& assign(basic_string&& __str)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
- {*this = std::move(__str); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(basic_string&& __str)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ *this = std::move(__str);
+ return *this;
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
-
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
- int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- assign(const _Tp& __t, size_type __pos, size_type __n = npos);
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- assign(_InputIterator __first, _InputIterator __last);
-
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
- assign(_ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n = npos);
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr basic_string& assign_range(_Range&& __range) {
- if constexpr (__string_is_trivial_iterator<ranges::iterator_t<_Range>>::value &&
- (ranges::forward_range<_Range> || ranges::sized_range<_Range>)) {
- size_type __n = static_cast<size_type>(ranges::distance(__range));
- __assign_trivial(ranges::begin(__range), ranges::end(__range), __n);
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ assign(const _Tp& __t, size_type __pos, size_type __n = npos);
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ assign(_InputIterator __first, _InputIterator __last);
- return *this;
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ assign(_ForwardIterator __first, _ForwardIterator __last);
+
+#if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_CharT> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string& assign_range(_Range&& __range) {
+ if constexpr (__string_is_trivial_iterator<ranges::iterator_t<_Range>>::value &&
+ (ranges::forward_range<_Range> || ranges::sized_range<_Range>)) {
+ size_type __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_trivial(ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+
+ return *this;
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(initializer_list<value_type> __il) {
+ return assign(__il.begin(), __il.size());
+ }
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
@@ -1474,18 +1454,17 @@ public:
_LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, value_type __c);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
+ template <_ContainerCompatibleRange<_CharT> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
- } else {
- basic_string __temp(from_range, std::forward<_Range>(__range), __alloc());
- return insert(__position, __temp.data(), __temp.data() + __temp.size());
- }
+ } else {
+ basic_string __temp(from_range, std::forward<_Range>(__range), __alloc());
+ return insert(__position, __temp.data(), __temp.data() + __temp.size());
}
+ }
#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
@@ -1504,16 +1483,15 @@ public:
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator insert(const_iterator __pos, initializer_list<value_type> __il)
- {return insert(__pos, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ insert(const_iterator __pos, initializer_list<value_type> __il) {
+ return insert(__pos, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& erase(size_type __pos = 0, size_type __n = npos);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator erase(const_iterator __pos);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator erase(const_iterator __first, const_iterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& erase(size_type __pos = 0, size_type __n = npos);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __pos);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
replace(size_type __pos1, size_type __n1, const basic_string& __str) {
@@ -1576,707 +1554,682 @@ public:
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_CharT> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr basic_string& replace_with_range(const_iterator __i1, const_iterator __i2, _Range&& __range) {
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string&
+ replace_with_range(const_iterator __i1, const_iterator __i2, _Range&& __range) {
basic_string __temp(from_range, std::forward<_Range>(__range), __alloc());
return replace(__i1, __i2, __temp);
}
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
- {return replace(__i1, __i2, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il) {
+ return replace(__i1, __i2, __il.begin(), __il.end());
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
#if _LIBCPP_STD_VER <= 20
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string substr(size_type __pos = 0, size_type __n = npos) const {
- return basic_string(*this, __pos, __n);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string
+ substr(size_type __pos = 0, size_type __n = npos) const {
+ return basic_string(*this, __pos, __n);
+ }
#else
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
- return basic_string(*this, __pos, __n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
+ return basic_string(*this, __pos, __n);
+ }
- _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string substr(size_type __pos = 0, size_type __n = npos) && {
- return basic_string(std::move(*this), __pos, __n);
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) && {
+ return basic_string(std::move(*this), __pos, __n);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(basic_string& __str)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const value_type* c_str() const _NOEXCEPT {return data();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const value_type* data() const _NOEXCEPT {return std::__to_address(__get_pointer());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT { return data(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* data() const _NOEXCEPT {
+ return std::__to_address(__get_pointer());
+ }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- value_type* data() _NOEXCEPT {return std::__to_address(__get_pointer());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {
+ return std::__to_address(__get_pointer());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
- find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(const basic_string& __str) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
- compare(const _Tp& __t) const _NOEXCEPT;
-
- template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
- compare(size_type __pos1, size_type __n1, const _Tp& __t) const;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2,
- size_type __n2 = npos) const;
-
- template <class _Tp,
- __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
- int> = 0>
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
- compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* __s) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
+ return __alloc();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const basic_string& __str) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(const _Tp& __t) const _NOEXCEPT;
+
+ template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const _Tp& __t) const;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos) const;
+
+ template <class _Tp,
+ __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value,
+ int> = 0>
+ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* __s) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+ compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
#if _LIBCPP_STD_VER >= 20
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(__self_view __sv) const noexcept
- { return __self_view(data(), size()).starts_with(__sv); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept {
+ return __self_view(data(), size()).starts_with(__sv);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(front(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(front(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(const value_type* __s) const noexcept
- { return starts_with(__self_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(const value_type* __s) const noexcept {
+ return starts_with(__self_view(__s));
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(__self_view __sv) const noexcept
- { return __self_view(data(), size()).ends_with( __sv); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(__self_view __sv) const noexcept {
+ return __self_view(data(), size()).ends_with(__sv);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(back(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(back(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(const value_type* __s) const noexcept
- { return ends_with(__self_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* __s) const noexcept {
+ return ends_with(__self_view(__s));
+ }
#endif
#if _LIBCPP_STD_VER >= 23
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(__self_view __sv) const noexcept
- { return __self_view(data(), size()).contains(__sv); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept {
+ return __self_view(data(), size()).contains(__sv);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(value_type __c) const noexcept
- { return __self_view(data(), size()).contains(__c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept {
+ return __self_view(data(), size()).contains(__c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(const value_type* __s) const
- { return __self_view(data(), size()).contains(__s); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* __s) const {
+ return __self_view(data(), size()).contains(__s);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __clear_and_shrink() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __clear_and_shrink() _NOEXCEPT;
private:
- template<class _Alloc>
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- bool friend operator==(const basic_string<char, char_traits<char>, _Alloc>& __lhs,
- const basic_string<char, char_traits<char>, _Alloc>& __rhs) _NOEXCEPT;
+ template <class _Alloc>
+ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool friend
+ operator==(const basic_string<char, char_traits<char>, _Alloc>& __lhs,
+ const basic_string<char, char_traits<char>, _Alloc>& __rhs) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __shrink_or_extend(size_type __target_capacity);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __shrink_or_extend(size_type __target_capacity);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- bool __is_long() const _NOEXCEPT {
- if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__r_.first().__l.__is_long_)) {
- return __r_.first().__l.__is_long_;
- }
- return __r_.first().__s.__is_long_;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS bool
+ __is_long() const _NOEXCEPT {
+ if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__r_.first().__l.__is_long_)) {
+ return __r_.first().__l.__is_long_;
}
+ return __r_.first().__s.__is_long_;
+ }
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) {
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) {
#if _LIBCPP_STD_VER >= 20
- if (__libcpp_is_constant_evaluated()) {
- for (size_type __i = 0; __i != __n; ++__i)
- std::construct_at(std::addressof(__begin[__i]));
- }
+ if (__libcpp_is_constant_evaluated()) {
+ for (size_type __i = 0; __i != __n; ++__i)
+ std::construct_at(std::addressof(__begin[__i]));
+ }
#else
- (void)__begin;
- (void)__n;
+ (void)__begin;
+ (void)__n;
#endif // _LIBCPP_STD_VER >= 20
- }
+ }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) {
- return __sz < __min_cap;
- }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) { return __sz < __min_cap; }
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_trivial(_Iterator __first, _Sentinel __last, size_type __n);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
-
- template <class _ForwardIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- iterator __insert_from_safe_copy(size_type __n, size_type __ip, _ForwardIterator __first, _Sentinel __last) {
- size_type __sz = size();
- size_type __cap = capacity();
- value_type* __p;
- if (__cap - __sz >= __n)
- {
- __annotate_increase(__n);
- __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __ip;
- if (__n_move != 0)
- traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
- }
- else
- {
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
- __p = std::__to_address(__get_long_pointer());
- }
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- for (__p += __ip; __first != __last; ++__p, ++__first)
- traits_type::assign(*__p, *__first);
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __assign_trivial(_Iterator __first, _Sentinel __last, size_type __n);
- return begin() + __ip;
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
+
+ template <class _ForwardIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator
+ __insert_from_safe_copy(size_type __n, size_type __ip, _ForwardIterator __first, _Sentinel __last) {
+ size_type __sz = size();
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap - __sz >= __n) {
+ __annotate_increase(__n);
+ __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __ip;
+ if (__n_move != 0)
+ traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
+ } else {
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
+ __p = std::__to_address(__get_long_pointer());
}
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ for (__p += __ip; __first != __last; ++__p, ++__first)
+ traits_type::assign(*__p, *__first);
- template<class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator __insert_with_size(const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n);
+ return begin() + __ip;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); }
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ __insert_with_size(const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- void __set_short_size(size_type __s) _NOEXCEPT {
- _LIBCPP_ASSERT_INTERNAL(
- __s < __min_cap, "__s should never be greater than or equal to the short string capacity");
- __r_.first().__s.__size_ = __s;
- __r_.first().__s.__is_long_ = false;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- size_type __get_short_size() const _NOEXCEPT {
- _LIBCPP_ASSERT_INTERNAL(
- !__r_.first().__s.__is_long_, "String has to be short when trying to get the short size");
- return __r_.first().__s.__size_;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
+ __set_short_size(size_type __s) _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity");
+ __r_.first().__s.__size_ = __s;
+ __r_.first().__s.__is_long_ = false;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_long_size(size_type __s) _NOEXCEPT
- {__r_.first().__l.__size_ = __s;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __get_long_size() const _NOEXCEPT
- {return __r_.first().__l.__size_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_size(size_type __s) _NOEXCEPT
- {if (__is_long()) __set_long_size(__s); else __set_short_size(__s);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_long_cap(size_type __s) _NOEXCEPT {
- __r_.first().__l.__cap_ = __s / __endian_factor;
- __r_.first().__l.__is_long_ = true;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS size_type
+ __get_short_size() const _NOEXCEPT {
+ _LIBCPP_ASSERT_INTERNAL(!__r_.first().__s.__is_long_, "String has to be short when trying to get the short size");
+ return __r_.first().__s.__size_;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __get_long_cap() const _NOEXCEPT {
- return __r_.first().__l.__cap_ * __endian_factor;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_size(size_type __s) _NOEXCEPT {
+ __r_.first().__l.__size_ = __s;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_size() const _NOEXCEPT {
+ return __r_.first().__l.__size_;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_size(size_type __s) _NOEXCEPT {
+ if (__is_long())
+ __set_long_size(__s);
+ else
+ __set_short_size(__s);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_cap(size_type __s) _NOEXCEPT {
+ __r_.first().__l.__cap_ = __s / __endian_factor;
+ __r_.first().__l.__is_long_ = true;
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __set_long_pointer(pointer __p) _NOEXCEPT
- {__r_.first().__l.__data_ = __p;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pointer __get_long_pointer() _NOEXCEPT
- {return __r_.first().__l.__data_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_pointer __get_long_pointer() const _NOEXCEPT
- {return __r_.first().__l.__data_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pointer __get_short_pointer() _NOEXCEPT
- {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_pointer __get_short_pointer() const _NOEXCEPT
- {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pointer __get_pointer() _NOEXCEPT
- {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_pointer __get_pointer() const _NOEXCEPT
- {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
-
- // The following functions are no-ops outside of AddressSanitizer mode.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
- (void)__old_mid;
- (void)__new_mid;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_cap() const _NOEXCEPT {
+ return __r_.first().__l.__cap_ * __endian_factor;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_pointer(pointer __p) _NOEXCEPT {
+ __r_.first().__l.__data_ = __p;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT {
+ return __r_.first().__l.__data_;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer() const _NOEXCEPT {
+ return __r_.first().__l.__data_;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_short_pointer() _NOEXCEPT {
+ return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_short_pointer() const _NOEXCEPT {
+ return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_pointer() _NOEXCEPT {
+ return __is_long() ? __get_long_pointer() : __get_short_pointer();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_pointer() const _NOEXCEPT {
+ return __is_long() ? __get_long_pointer() : __get_short_pointer();
+ }
+
+ // The following functions are no-ops outside of AddressSanitizer mode.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
+ (void)__old_mid;
+ (void)__new_mid;
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
- const void* __begin = data();
- const void* __end = data() + capacity() + 1;
- if (!__libcpp_is_constant_evaluated() && __begin != nullptr && is_same<allocator_type, __default_allocator_type>::value)
- __sanitizer_annotate_contiguous_container(__begin, __end, __old_mid, __new_mid);
+ const void* __begin = data();
+ const void* __end = data() + capacity() + 1;
+ if (!__libcpp_is_constant_evaluated() && __begin != nullptr &&
+ is_same<allocator_type, __default_allocator_type>::value)
+ __sanitizer_annotate_contiguous_container(__begin, __end, __old_mid, __new_mid);
#endif
- }
+ }
- // ASan: short string is poisoned if and only if this function returns true.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __asan_short_string_is_annotated() const _NOEXCEPT {
- return _LIBCPP_SHORT_STRING_ANNOTATIONS_ALLOWED && !__libcpp_is_constant_evaluated();
- }
+ // ASan: short string is poisoned if and only if this function returns true.
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __asan_short_string_is_annotated() const _NOEXCEPT {
+ return _LIBCPP_SHORT_STRING_ANNOTATIONS_ALLOWED && !__libcpp_is_constant_evaluated();
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT {
+ (void) __current_size;
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_delete() const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_delete() const _NOEXCEPT {
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT {
+ (void) __n;
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n);
+#endif
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
- if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
- __annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1);
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
+ (void) __old_size;
+#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
+ if (!__libcpp_is_constant_evaluated() && (__asan_short_string_is_annotated() || __is_long()))
+ __annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1);
+#endif
+ }
- template <size_type __a> static
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __align_it(size_type __s) _NOEXCEPT
- {return (__s + (__a-1)) & ~(__a-1);}
- enum {
- __alignment =
+ template <size_type __a>
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __align_it(size_type __s) _NOEXCEPT {
+ return (__s + (__a - 1)) & ~(__a - 1);
+ }
+ enum {
+ __alignment =
#ifdef _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT
- 8
+ 8
#else
- 16
+ 16
#endif
- };
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type __recommend(size_type __s) _NOEXCEPT
- {
- if (__s < __min_cap) {
- return static_cast<size_type>(__min_cap) - 1;
- }
- size_type __guess = __align_it<sizeof(value_type) < __alignment ?
- __alignment/sizeof(value_type) : 1 > (__s+1) - 1;
- if (__guess == __min_cap) ++__guess;
- return __guess;
+ };
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __s) _NOEXCEPT {
+ if (__s < __min_cap) {
+ return static_cast<size_type>(__min_cap) - 1;
}
+ size_type __guess =
+ __align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1;
+ if (__guess == __min_cap)
+ ++__guess;
+ return __guess;
+ }
+
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(const value_type* __s, size_type __sz, size_type __reserve);
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(const value_type* __s, size_type __sz);
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(size_type __n, value_type __c);
+
+ // Slow path for the (inlined) copy constructor for 'long' strings.
+ // Always externally instantiated and not inlined.
+ // Requires that __s is zero terminated.
+ // The main reason for this function to exist is because for unstable, we
+ // want to allow inlining of the copy constructor. However, we don't want
+ // to call the __init() functions as those are marked as inline which may
+ // result in over-aggressive inlining by the compiler, where our aim is
+ // to only inline the fast path code directly in the ctor.
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __init_copy_ctor_external(const value_type* __s, size_type __sz);
+
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_InputIterator __first, _InputIterator __last);
+
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_ForwardIterator __first, _ForwardIterator __last);
+
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_sentinel(_InputIterator __first, _Sentinel __last);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz);
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init(const value_type* __s, size_type __sz, size_type __reserve);
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init(const value_type* __s, size_type __sz);
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init(size_type __n, value_type __c);
-
- // Slow path for the (inlined) copy constructor for 'long' strings.
- // Always externally instantiated and not inlined.
- // Requires that __s is zero terminated.
- // The main reason for this function to exist is because for unstable, we
- // want to allow inlining of the copy constructor. However, we don't want
- // to call the __init() functions as those are marked as inline which may
- // result in over-aggressive inlining by the compiler, where our aim is
- // to only inline the fast path code directly in the ctor.
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __init_copy_ctor_external(const value_type* __s, size_type __sz);
-
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_InputIterator __first, _InputIterator __last);
-
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_ForwardIterator __first, _ForwardIterator __last);
-
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_sentinel(_InputIterator __first, _Sentinel __last);
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz);
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20
+ _LIBCPP_CONSTEXPR_SINCE_CXX20
#if _LIBCPP_ABI_VERSION >= 2 // We want to use the function in the dylib in ABIv1
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI
#endif
- _LIBCPP_DEPRECATED_("use __grow_by_without_replace")
- void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add = 0);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __grow_by_without_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add = 0);
- _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del,
- size_type __n_add, const value_type* __p_new_stuff);
-
- // __assign_no_alias is invoked for assignment operations where we
- // have proof that the input does not alias the current instance.
- // For example, operator=(basic_string) performs a 'self' check.
- template <bool __is_short>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_no_alias(const value_type* __s, size_type __n);
+ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") void __grow_by(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add = 0);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __grow_by_without_replace(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add = 0);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __grow_by_and_replace(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add,
+ const value_type* __p_new_stuff);
+
+ // __assign_no_alias is invoked for assignment operations where we
+ // have proof that the input does not alias the current instance.
+ // For example, operator=(basic_string) performs a 'self' check.
+ template <bool __is_short>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_no_alias(const value_type* __s, size_type __n);
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end(size_type __pos) {
__null_terminate_at(std::__to_address(__get_pointer()), __pos);
}
- // __erase_external_with_move is invoked for erase() invocations where
- // `n ~= npos`, likely requiring memory moves on the string data.
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __erase_external_with_move(size_type __pos, size_type __n);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const basic_string& __str)
- {__copy_assign_alloc(__str, integral_constant<bool,
- __alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const basic_string& __str, true_type)
- {
- if (__alloc() == __str.__alloc())
- __alloc() = __str.__alloc();
- else
- {
- if (!__str.__is_long())
- {
- __clear_and_shrink();
- __alloc() = __str.__alloc();
- }
- else
- {
- __annotate_delete();
- allocator_type __a = __str.__alloc();
- auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());
- __begin_lifetime(__allocation.ptr, __allocation.count);
- if (__is_long())
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
- __alloc() = std::move(__a);
- __set_long_pointer(__allocation.ptr);
- __set_long_cap(__allocation.count);
- __set_long_size(__str.size());
- __annotate_new(__get_long_size());
- }
- }
- }
+ // __erase_external_with_move is invoked for erase() invocations where
+ // `n ~= npos`, likely requiring memory moves on the string data.
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __erase_external_with_move(size_type __pos, size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const basic_string& __str) {
+ __copy_assign_alloc(
+ __str, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const basic_string& __str, true_type) {
+ if (__alloc() == __str.__alloc())
+ __alloc() = __str.__alloc();
+ else {
+ if (!__str.__is_long()) {
+ __clear_and_shrink();
+ __alloc() = __str.__alloc();
+ } else {
+ __annotate_delete();
+ allocator_type __a = __str.__alloc();
+ auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());
+ __begin_lifetime(__allocation.ptr, __allocation.count);
+ if (__is_long())
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+ __alloc() = std::move(__a);
+ __set_long_pointer(__allocation.ptr);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__str.size());
+ __annotate_new(__get_long_size());
+ }
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign(basic_string& __str, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
- void __move_assign(basic_string& __str, true_type)
-#if _LIBCPP_STD_VER >= 17
- _NOEXCEPT;
-#else
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
-#endif
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(basic_string& __str, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
+ __move_assign(basic_string& __str, true_type)
+# if _LIBCPP_STD_VER >= 17
+ _NOEXCEPT;
+# else
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+# endif
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void
- __move_assign_alloc(basic_string& __str)
- _NOEXCEPT_(
- !__alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__str, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(basic_string& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
- __alloc() = std::move(__c.__alloc());
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(basic_string& __str)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(
+ __str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(basic_string&, false_type)
- _NOEXCEPT
- {}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s, size_type __n);
-
- // Assigns the value in __s, guaranteed to be __n < __min_cap in length.
- inline _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_short(const value_type* __s, size_type __n) {
- size_type __old_size = size();
- if (__n > __old_size)
- __annotate_increase(__n - __old_size);
- pointer __p = __is_long()
- ? (__set_long_size(__n), __get_long_pointer())
- : (__set_short_size(__n), __get_short_pointer());
- traits_type::move(std::__to_address(__p), __s, __n);
- traits_type::assign(__p[__n], value_type());
- if (__old_size > __n)
- __annotate_shrink(__old_size);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(basic_string& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __alloc() = std::move(__c.__alloc());
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string& __null_terminate_at(value_type* __p, size_type __newsz) {
- size_type __old_size = size();
- if (__newsz > __old_size)
- __annotate_increase(__newsz - __old_size);
- __set_size(__newsz);
- traits_type::assign(__p[__newsz], value_type());
- if (__old_size > __newsz)
- __annotate_shrink(__old_size);
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(basic_string&, false_type) _NOEXCEPT {}
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __addr_in_range(const _Tp& __v) const {
- return std::__is_pointer_in_range(data(), data() + size() + 1, std::addressof(__v));
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string& __assign_external(const value_type* __s, size_type __n);
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_length_error() const {
- std::__throw_length_error("basic_string");
- }
+ // Assigns the value in __s, guaranteed to be __n < __min_cap in length.
+ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& __assign_short(const value_type* __s, size_type __n) {
+ size_type __old_size = size();
+ if (__n > __old_size)
+ __annotate_increase(__n - __old_size);
+ pointer __p =
+ __is_long() ? (__set_long_size(__n), __get_long_pointer()) : (__set_short_size(__n), __get_short_pointer());
+ traits_type::move(std::__to_address(__p), __s, __n);
+ traits_type::assign(__p[__n], value_type());
+ if (__old_size > __n)
+ __annotate_shrink(__old_size);
+ return *this;
+ }
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_out_of_range() const {
- std::__throw_out_of_range("basic_string");
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ __null_terminate_at(value_type* __p, size_type __newsz) {
+ size_type __old_size = size();
+ if (__newsz > __old_size)
+ __annotate_increase(__newsz - __old_size);
+ __set_size(__newsz);
+ traits_type::assign(__p[__newsz], value_type());
+ if (__old_size > __newsz)
+ __annotate_shrink(__old_size);
+ return *this;
+ }
+
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __addr_in_range(const _Tp& __v) const {
+ return std::__is_pointer_in_range(data(), data() + size() + 1, std::addressof(__v));
+ }
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const basic_string&);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const value_type*, const basic_string&);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(value_type, const basic_string&);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, const value_type*);
- friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+<>(const basic_string&, value_type);
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const {
+ std::__throw_length_error("basic_string");
+ }
+
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const {
+ std::__throw_out_of_range("basic_string");
+ }
+
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const value_type*, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(value_type, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, const value_type*);
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, value_type);
};
// These declarations must appear before any functions are implicitly used
// so that they have the correct visibility specifier.
#define _LIBCPP_DECLARE(...) extern template __VA_ARGS__;
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
- _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
-# endif
+_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
+# endif
#else
- _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
-# endif
+_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char)
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
+# endif
#endif
#undef _LIBCPP_DECLARE
-
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _CharT = __iter_value_type<_InputIterator>,
- class _Allocator = allocator<_CharT>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
- >
+template <class _InputIterator,
+ class _CharT = __iter_value_type<_InputIterator>,
+ class _Allocator = allocator<_CharT>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
- -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
+ -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
-template<class _CharT,
- class _Traits,
- class _Allocator = allocator<_CharT>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
- >
+template <class _CharT,
+ class _Traits,
+ class _Allocator = allocator<_CharT>,
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
- -> basic_string<_CharT, _Traits, _Allocator>;
-
-template<class _CharT,
- class _Traits,
- class _Allocator = allocator<_CharT>,
- class = enable_if_t<__is_allocator<_Allocator>::value>,
- class _Sz = typename allocator_traits<_Allocator>::size_type
- >
+ -> basic_string<_CharT, _Traits, _Allocator>;
+
+template <class _CharT,
+ class _Traits,
+ class _Allocator = allocator<_CharT>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>,
+ class _Sz = typename allocator_traits<_Allocator>::size_type >
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _Allocator())
- -> basic_string<_CharT, _Traits, _Allocator>;
+ -> basic_string<_CharT, _Traits, _Allocator>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Allocator>::value>
- >
+ class = enable_if_t<__is_allocator<_Allocator>::value> >
basic_string(from_range_t, _Range&&, _Allocator = _Allocator())
- -> basic_string<ranges::range_value_t<_Range>, char_traits<ranges::range_value_t<_Range>>, _Allocator>;
+ -> basic_string<ranges::range_value_t<_Range>, char_traits<ranges::range_value_t<_Range>>, _Allocator>;
#endif
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
- size_type __sz,
- size_type __reserve)
-{
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
- if (__reserve > max_size())
- __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__reserve))
- {
- __set_short_size(__sz);
- __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__reserve) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__sz);
- }
- traits_type::copy(std::__to_address(__p), __s, __sz);
- traits_type::assign(__p[__sz], value_type());
- __annotate_new(__sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
+ if (__reserve > max_size())
+ __throw_length_error();
+ pointer __p;
+ if (__fits_in_sso(__reserve)) {
+ __set_short_size(__sz);
+ __p = __get_short_pointer();
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__reserve) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__sz);
+ }
+ traits_type::copy(std::__to_address(__p), __s, __sz);
+ traits_type::assign(__p[__sz], value_type());
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
-{
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
- if (__sz > max_size())
- __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__sz))
- {
- __set_short_size(__sz);
- __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__sz);
- }
- traits_type::copy(std::__to_address(__p), __s, __sz);
- traits_type::assign(__p[__sz], value_type());
- __annotate_new(__sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
+ if (__sz > max_size())
+ __throw_length_error();
+ pointer __p;
+ if (__fits_in_sso(__sz)) {
+ __set_short_size(__sz);
+ __p = __get_short_pointer();
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__sz);
+ }
+ traits_type::copy(std::__to_address(__p), __s, __sz);
+ traits_type::assign(__p[__sz], value_type());
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
- const value_type* __s, size_type __sz) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
+basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value_type* __s, size_type __sz) {
if (__libcpp_is_constant_evaluated())
__r_.first() = __rep();
@@ -2288,7 +2241,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
if (__sz > max_size())
__throw_length_error();
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
- __p = __allocation.ptr;
+ __p = __allocation.ptr;
__begin_lifetime(__p, __allocation.count);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
@@ -2299,197 +2252,178 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
-{
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
- if (__n > max_size())
- __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__n))
- {
- __set_short_size(__n);
- __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__n) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__n);
- }
- traits_type::assign(std::__to_address(__p), __n, __c);
- traits_type::assign(__p[__n], value_type());
- __annotate_new(__n);
+ if (__n > max_size())
+ __throw_length_error();
+ pointer __p;
+ if (__fits_in_sso(__n)) {
+ __set_short_size(__n);
+ __p = __get_short_pointer();
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__n) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__n);
+ }
+ traits_type::assign(std::__to_address(__p), __n, __c);
+ traits_type::assign(__p[__n], value_type());
+ __annotate_new(__n);
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last) {
__init_with_sentinel(std::move(__first), std::move(__last));
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator __first, _Sentinel __last) {
- __r_.first() = __rep();
- __annotate_new(0);
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator __first, _Sentinel __last) {
+ __r_.first() = __rep();
+ __annotate_new(0);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
for (; __first != __last; ++__first)
- push_back(*__first);
+ push_back(*__first);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __annotate_delete();
- if (__is_long())
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
- throw;
- }
+ } catch (...) {
+ __annotate_delete();
+ if (__is_long())
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+ throw;
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
template <class _CharT, class _Traits, class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last) {
size_type __sz = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __sz);
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void basic_string<_CharT, _Traits, _Allocator>::__init_with_size(
- _InputIterator __first, _Sentinel __last, size_type __sz) {
- if (__libcpp_is_constant_evaluated())
- __r_.first() = __rep();
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz) {
+ if (__libcpp_is_constant_evaluated())
+ __r_.first() = __rep();
- if (__sz > max_size())
- __throw_length_error();
+ if (__sz > max_size())
+ __throw_length_error();
- pointer __p;
- if (__fits_in_sso(__sz))
- {
- __set_short_size(__sz);
- __p = __get_short_pointer();
+ pointer __p;
+ if (__fits_in_sso(__sz)) {
+ __set_short_size(__sz);
+ __p = __get_short_pointer();
- }
- else
- {
- auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
- __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __set_long_size(__sz);
- }
+ } else {
+ auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
+ __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __set_long_size(__sz);
+ }
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __first != __last; ++__first, (void) ++__p)
- traits_type::assign(*__p, *__first);
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ for (; __first != __last; ++__first, (void)++__p)
+ traits_type::assign(*__p, *__first);
traits_type::assign(*__p, value_type());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- if (__is_long())
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __annotate_new(__sz);
+ } catch (...) {
+ if (__is_long())
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+ throw;
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
- (size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add, const value_type* __p_new_stuff)
-{
- size_type __ms = max_size();
- if (__delta_cap > __ms - __old_cap - 1)
- __throw_length_error();
- pointer __old_p = __get_pointer();
- size_type __cap = __old_cap < __ms / 2 - __alignment ?
- __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) :
- __ms - 1;
- __annotate_delete();
- auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
- pointer __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- if (__n_copy != 0)
- traits_type::copy(std::__to_address(__p),
- std::__to_address(__old_p), __n_copy);
- if (__n_add != 0)
- traits_type::copy(std::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
- size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
- if (__sec_cp_sz != 0)
- traits_type::copy(std::__to_address(__p) + __n_copy + __n_add,
- std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
- if (__old_cap+1 != __min_cap)
- __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
- __old_sz = __n_copy + __n_add + __sec_cp_sz;
- __set_long_size(__old_sz);
- traits_type::assign(__p[__old_sz], value_type());
- __annotate_new(__old_cap + __delta_cap);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add,
+ const value_type* __p_new_stuff) {
+ size_type __ms = max_size();
+ if (__delta_cap > __ms - __old_cap - 1)
+ __throw_length_error();
+ pointer __old_p = __get_pointer();
+ size_type __cap =
+ __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
+ __annotate_delete();
+ auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
+ pointer __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ if (__n_copy != 0)
+ traits_type::copy(std::__to_address(__p), std::__to_address(__old_p), __n_copy);
+ if (__n_add != 0)
+ traits_type::copy(std::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
+ size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
+ if (__sec_cp_sz != 0)
+ traits_type::copy(
+ std::__to_address(__p) + __n_copy + __n_add, std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
+ if (__old_cap + 1 != __min_cap)
+ __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
+ __old_sz = __n_copy + __n_add + __sec_cp_sz;
+ __set_long_size(__old_sz);
+ traits_type::assign(__p[__old_sz], value_type());
+ __annotate_new(__old_cap + __delta_cap);
}
// __grow_by is deprecated because it does not set the size. It may not update the size when the size is changed, and it
// may also not set the size at all when the string was short initially. This leads to unpredictable size value. It is
// not removed or changed to avoid breaking the ABI.
template <class _CharT, class _Traits, class _Allocator>
-void
-_LIBCPP_CONSTEXPR_SINCE_CXX20
+void _LIBCPP_CONSTEXPR_SINCE_CXX20
#if _LIBCPP_ABI_VERSION >= 2 // We want to use the function in the dylib in ABIv1
_LIBCPP_HIDE_FROM_ABI
#endif
- _LIBCPP_DEPRECATED_("use __grow_by_without_replace")
-basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
- size_type __n_copy, size_type __n_del, size_type __n_add)
-{
- size_type __ms = max_size();
- if (__delta_cap > __ms - __old_cap)
- __throw_length_error();
- pointer __old_p = __get_pointer();
- size_type __cap = __old_cap < __ms / 2 - __alignment ?
- __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) :
- __ms - 1;
- __annotate_delete();
- auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
- pointer __p = __allocation.ptr;
- __begin_lifetime(__p, __allocation.count);
- if (__n_copy != 0)
- traits_type::copy(std::__to_address(__p),
- std::__to_address(__old_p), __n_copy);
- size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
- if (__sec_cp_sz != 0)
- traits_type::copy(std::__to_address(__p) + __n_copy + __n_add,
- std::__to_address(__old_p) + __n_copy + __n_del,
- __sec_cp_sz);
- if (__old_cap + 1 != __min_cap)
- __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1);
- __set_long_pointer(__p);
- __set_long_cap(__allocation.count);
+ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Traits, _Allocator>::__grow_by(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add) {
+ size_type __ms = max_size();
+ if (__delta_cap > __ms - __old_cap)
+ __throw_length_error();
+ pointer __old_p = __get_pointer();
+ size_type __cap =
+ __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
+ __annotate_delete();
+ auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
+ pointer __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
+ if (__n_copy != 0)
+ traits_type::copy(std::__to_address(__p), std::__to_address(__old_p), __n_copy);
+ size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
+ if (__sec_cp_sz != 0)
+ traits_type::copy(
+ std::__to_address(__p) + __n_copy + __n_add, std::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
+ if (__old_cap + 1 != __min_cap)
+ __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1);
+ __set_long_pointer(__p);
+ __set_long_cap(__allocation.count);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2501,21 +2435,19 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_without_replace(
size_type __n_copy,
size_type __n_del,
size_type __n_add) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __grow_by(__old_cap, __delta_cap, __old_sz, __n_copy, __n_del, __n_add);
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __set_long_size(__old_sz - __n_del + __n_add);
- __annotate_new(__old_sz - __n_del + __n_add);
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ __grow_by(__old_cap, __delta_cap, __old_sz, __n_copy, __n_del, __n_add);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
+ __set_long_size(__old_sz - __n_del + __n_add);
+ __annotate_new(__old_sz - __n_del + __n_add);
}
// assign
template <class _CharT, class _Traits, class _Allocator>
template <bool __is_short>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
- const value_type* __s, size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(const value_type* __s, size_type __n) {
size_type __cap = __is_short ? static_cast<size_type>(__min_cap) : __get_long_cap();
if (__n < __cap) {
size_type __old_size = __is_short ? __get_short_size() : __get_long_size();
@@ -2535,10 +2467,8 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::__assign_external(
- const value_type* __s, size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* __s, size_type __n) {
size_type __cap = capacity();
if (__cap >= __n) {
size_type __old_size = size();
@@ -2555,41 +2485,31 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external(
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::assign received nullptr");
- return (__builtin_constant_p(__n) && __fits_in_sso(__n))
- ? __assign_short(__s, __n)
- : __assign_external(__s, __n);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::assign received nullptr");
+ return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
-{
- size_type __cap = capacity();
- size_type __old_size = size();
- if (__cap < __n)
- {
- size_type __sz = size();
- __grow_by_without_replace(__cap, __n - __cap, __sz, 0, __sz);
- __annotate_increase(__n);
- }
- else if(__n > __old_size)
- __annotate_increase(__n - __old_size);
- value_type* __p = std::__to_address(__get_pointer());
- traits_type::assign(__p, __n, __c);
- return __null_terminate_at(__p, __n);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) {
+ size_type __cap = capacity();
+ size_type __old_size = size();
+ if (__cap < __n) {
+ size_type __sz = size();
+ __grow_by_without_replace(__cap, __n - __cap, __sz, 0, __sz);
+ __annotate_increase(__n);
+ } else if (__n > __old_size)
+ __annotate_increase(__n - __old_size);
+ value_type* __p = std::__to_address(__get_pointer());
+ traits_type::assign(__p, __n, __c);
+ return __null_terminate_at(__p, __n);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) {
pointer __p;
size_type __old_size = size();
if (__old_size == 0)
@@ -2609,10 +2529,8 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) {
if (this != std::addressof(__str)) {
__copy_assign_alloc(__str);
if (!__is_long()) {
@@ -2636,41 +2554,37 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value)
-{
- if (__alloc() != __str.__alloc())
- assign(__str);
- else
- __move_assign(__str, true_type());
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value) {
+ if (__alloc() != __str.__alloc())
+ assign(__str);
+ else
+ __move_assign(__str, true_type());
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
-void
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
_NOEXCEPT
-#else
+# else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-#endif
+# endif
{
__annotate_delete();
if (__is_long()) {
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
- __get_long_cap());
-#if _LIBCPP_STD_VER <= 14
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+# if _LIBCPP_STD_VER <= 14
if (!is_nothrow_move_assignable<allocator_type>::value) {
__set_short_size(0);
traits_type::assign(__get_short_pointer()[0], value_type());
__annotate_new(0);
}
-#endif
+# endif
}
size_type __str_old_size = __str.size();
- bool __str_was_short = !__str.__is_long();
+ bool __str_was_short = !__str.__is_long();
__move_assign_alloc(__str);
__r_.first() = __str.__r_.first();
@@ -2699,28 +2613,25 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
#endif
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
+template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last) {
__assign_with_sentinel(__first, __last);
return *this;
}
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
basic_string<_CharT, _Traits, _Allocator>::__assign_with_sentinel(_InputIterator __first, _Sentinel __last) {
const basic_string __temp(__init_with_sentinel_tag(), std::move(__first), std::move(__last), __alloc());
assign(__temp.data(), __temp.size());
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) {
if (__string_is_trivial_iterator<_ForwardIterator>::value) {
size_type __n = static_cast<size_type>(std::distance(__first, __last));
__assign_trivial(__first, __last, __n);
@@ -2733,14 +2644,13 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _For
template <class _CharT, class _Traits, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
basic_string<_CharT, _Traits, _Allocator>::__assign_trivial(_Iterator __first, _Sentinel __last, size_type __n) {
_LIBCPP_ASSERT_INTERNAL(
__string_is_trivial_iterator<_Iterator>::value, "The iterator type given to `__assign_trivial` must be trivial");
size_type __old_size = size();
- size_type __cap = capacity();
+ size_type __cap = capacity();
if (__cap < __n) {
// Unlike `append` functions, if the input range points into the string itself, there is no case that the input
// range could get invalidated by reallocation:
@@ -2751,27 +2661,24 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_trivial(_Iterator __first, _
size_type __sz = size();
__grow_by_without_replace(__cap, __n - __cap, __sz, 0, __sz);
__annotate_increase(__n);
- }
- else if (__n > __old_size)
- __annotate_increase(__n - __old_size);
- pointer __p = __get_pointer();
- for (; __first != __last; ++__p, (void) ++__first)
- traits_type::assign(*__p, *__first);
- traits_type::assign(*__p, value_type());
- __set_size(__n);
- if (__n < __old_size)
- __annotate_shrink(__old_size);
+ } else if (__n > __old_size)
+ __annotate_increase(__n - __old_size);
+ pointer __p = __get_pointer();
+ for (; __first != __last; ++__p, (void)++__first)
+ traits_type::assign(*__p, *__first);
+ traits_type::assign(*__p, value_type());
+ __set_size(__n);
+ if (__n < __old_size)
+ __annotate_shrink(__old_size);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)
-{
- size_type __sz = __str.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return assign(__str.data() + __pos, std::min(__n, __sz - __pos));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n) {
+ size_type __sz = __str.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return assign(__str.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2781,179 +2688,146 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp& __t, size_type __pos, size_type __n) {
- __self_view __sv = __t;
- size_type __sz = __sv.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return assign(__sv.data() + __pos, std::min(__n, __sz - __pos));
+ __self_view __sv = __t;
+ size_type __sz = __sv.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return assign(__sv.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-basic_string<_CharT, _Traits, _Allocator>&
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* __s) {
return __assign_external(__s, traits_type::length(__s));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::assign received nullptr");
- return __builtin_constant_p(*__s)
- ? (__fits_in_sso(traits_type::length(__s))
- ? __assign_short(__s, traits_type::length(__s))
- : __assign_external(__s, traits_type::length(__s)))
- : __assign_external(__s);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::assign received nullptr");
+ return __builtin_constant_p(*__s)
+ ? (__fits_in_sso(traits_type::length(__s)) ? __assign_short(__s, traits_type::length(__s))
+ : __assign_external(__s, traits_type::length(__s)))
+ : __assign_external(__s);
}
// append
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr");
- size_type __cap = capacity();
- size_type __sz = size();
- if (__cap - __sz >= __n)
- {
- if (__n)
- {
- __annotate_increase(__n);
- value_type* __p = std::__to_address(__get_pointer());
- traits_type::copy(__p + __sz, __s, __n);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr");
+ size_type __cap = capacity();
+ size_type __sz = size();
+ if (__cap - __sz >= __n) {
+ if (__n) {
+ __annotate_increase(__n);
+ value_type* __p = std::__to_address(__get_pointer());
+ traits_type::copy(__p + __sz, __s, __n);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
}
- else
- __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
- return *this;
+ } else
+ __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
-{
- if (__n)
- {
- size_type __cap = capacity();
- size_type __sz = size();
- if (__cap - __sz < __n)
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
- __annotate_increase(__n);
- pointer __p = __get_pointer();
- traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
- return *this;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) {
+ if (__n) {
+ size_type __cap = capacity();
+ size_type __sz = size();
+ if (__cap - __sz < __n)
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
+ __annotate_increase(__n);
+ pointer __p = __get_pointer();
+ traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ }
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
-basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)
-{
- if (__n)
- {
- size_type __cap = capacity();
- size_type __sz = size();
- if (__cap - __sz < __n)
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
- __annotate_increase(__n);
- pointer __p = __get_pointer();
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
+basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) {
+ if (__n) {
+ size_type __cap = capacity();
+ size_type __sz = size();
+ if (__cap - __sz < __n)
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
+ __annotate_increase(__n);
+ pointer __p = __get_pointer();
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ }
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
-{
- bool __is_short = !__is_long();
- size_type __cap;
- size_type __sz;
- if (__is_short)
- {
- __cap = __min_cap - 1;
- __sz = __get_short_size();
- }
- else
- {
- __cap = __get_long_cap() - 1;
- __sz = __get_long_size();
- }
- if (__sz == __cap)
- {
- __grow_by_without_replace(__cap, 1, __sz, __sz, 0);
- __annotate_increase(1);
- __is_short = false; // the string is always long after __grow_by
- } else
- __annotate_increase(1);
- pointer __p = __get_pointer();
- if (__is_short)
- {
- __p = __get_short_pointer() + __sz;
- __set_short_size(__sz+1);
- }
- else
- {
- __p = __get_long_pointer() + __sz;
- __set_long_size(__sz+1);
- }
- traits_type::assign(*__p, __c);
- traits_type::assign(*++__p, value_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) {
+ bool __is_short = !__is_long();
+ size_type __cap;
+ size_type __sz;
+ if (__is_short) {
+ __cap = __min_cap - 1;
+ __sz = __get_short_size();
+ } else {
+ __cap = __get_long_cap() - 1;
+ __sz = __get_long_size();
+ }
+ if (__sz == __cap) {
+ __grow_by_without_replace(__cap, 1, __sz, __sz, 0);
+ __annotate_increase(1);
+ __is_short = false; // the string is always long after __grow_by
+ } else
+ __annotate_increase(1);
+ pointer __p = __get_pointer();
+ if (__is_short) {
+ __p = __get_short_pointer() + __sz;
+ __set_short_size(__sz + 1);
+ } else {
+ __p = __get_long_pointer() + __sz;
+ __set_long_size(__sz + 1);
+ }
+ traits_type::assign(*__p, __c);
+ traits_type::assign(*++__p, value_type());
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(
- _ForwardIterator __first, _ForwardIterator __last)
-{
- size_type __sz = size();
- size_type __cap = capacity();
- size_type __n = static_cast<size_type>(std::distance(__first, __last));
- if (__n)
- {
- if (__string_is_trivial_iterator<_ForwardIterator>::value &&
- !__addr_in_range(*__first))
- {
- if (__cap - __sz < __n)
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
- __annotate_increase(__n);
- pointer __p = __get_pointer() + __sz;
- for (; __first != __last; ++__p, (void) ++__first)
- traits_type::assign(*__p, *__first);
- traits_type::assign(*__p, value_type());
- __set_size(__sz + __n);
- }
- else
- {
- const basic_string __temp(__first, __last, __alloc());
- append(__temp.data(), __temp.size());
- }
+basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _ForwardIterator __last) {
+ size_type __sz = size();
+ size_type __cap = capacity();
+ size_type __n = static_cast<size_type>(std::distance(__first, __last));
+ if (__n) {
+ if (__string_is_trivial_iterator<_ForwardIterator>::value && !__addr_in_range(*__first)) {
+ if (__cap - __sz < __n)
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
+ __annotate_increase(__n);
+ pointer __p = __get_pointer() + __sz;
+ for (; __first != __last; ++__p, (void)++__first)
+ traits_type::assign(*__p, *__first);
+ traits_type::assign(*__p, value_type());
+ __set_size(__sz + __n);
+ } else {
+ const basic_string __temp(__first, __last, __alloc());
+ append(__temp.data(), __temp.size());
}
- return *this;
+ }
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n)
-{
- size_type __sz = __str.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return append(__str.data() + __pos, std::min(__n, __sz - __pos));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n) {
+ size_type __sz = __str.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return append(__str.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2963,140 +2837,119 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const _Tp& __t, size_type __pos, size_type __n) {
- __self_view __sv = __t;
- size_type __sz = __sv.size();
- if (__pos > __sz)
- __throw_out_of_range();
- return append(__sv.data() + __pos, std::min(__n, __sz - __pos));
+ __self_view __sv = __t;
+ size_type __sz = __sv.size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ return append(__sv.data() + __pos, std::min(__n, __sz - __pos));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::append received nullptr");
- return append(__s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::append received nullptr");
+ return append(__s, traits_type::length(__s));
}
// insert
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::insert received nullptr");
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- size_type __cap = capacity();
- if (__cap - __sz >= __n)
- {
- if (__n)
- {
- __annotate_increase(__n);
- value_type* __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __pos;
- if (__n_move != 0)
- {
- if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
- __s += __n;
- traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
- }
- traits_type::move(__p + __pos, __s, __n);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::insert received nullptr");
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ size_type __cap = capacity();
+ if (__cap - __sz >= __n) {
+ if (__n) {
+ __annotate_increase(__n);
+ value_type* __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __pos;
+ if (__n_move != 0) {
+ if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
+ __s += __n;
+ traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
+ }
+ traits_type::move(__p + __pos, __s, __n);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
}
- else
- __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
- return *this;
+ } else
+ __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c)
-{
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- if (__n)
- {
- size_type __cap = capacity();
- value_type* __p;
- if (__cap - __sz >= __n)
- {
- __annotate_increase(__n);
- __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __pos;
- if (__n_move != 0)
- traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
- }
- else
- {
- __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
- __p = std::__to_address(__get_long_pointer());
- }
- traits_type::assign(__p + __pos, __n, __c);
- __sz += __n;
- __set_size(__sz);
- traits_type::assign(__p[__sz], value_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c) {
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ if (__n) {
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap - __sz >= __n) {
+ __annotate_increase(__n);
+ __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __pos;
+ if (__n_move != 0)
+ traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
+ } else {
+ __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
+ __p = std::__to_address(__get_long_pointer());
}
- return *this;
+ traits_type::assign(__p + __pos, __n, __c);
+ __sz += __n;
+ __set_size(__sz);
+ traits_type::assign(__p[__sz], value_type());
+ }
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
+template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
-{
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last) {
const basic_string __temp(__first, __last, __alloc());
return insert(__pos, __temp.data(), __temp.data() + __temp.size());
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
+template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
-{
- auto __n = static_cast<size_type>(std::distance(__first, __last));
- return __insert_with_size(__pos, __first, __last, __n);
+basic_string<_CharT, _Traits, _Allocator>::insert(
+ const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last) {
+ auto __n = static_cast<size_type>(std::distance(__first, __last));
+ return __insert_with_size(__pos, __first, __last, __n);
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
+template <class _Iterator, class _Sentinel>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
basic_string<_CharT, _Traits, _Allocator>::__insert_with_size(
const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n) {
- size_type __ip = static_cast<size_type>(__pos - begin());
- if (__n == 0)
- return begin() + __ip;
+ size_type __ip = static_cast<size_type>(__pos - begin());
+ if (__n == 0)
+ return begin() + __ip;
- if (__string_is_trivial_iterator<_Iterator>::value && !__addr_in_range(*__first))
- {
- return __insert_from_safe_copy(__n, __ip, __first, __last);
- }
- else
- {
- const basic_string __temp(__init_with_sentinel_tag(), __first, __last, __alloc());
- return __insert_from_safe_copy(__n, __ip, __temp.begin(), __temp.end());
- }
+ if (__string_is_trivial_iterator<_Iterator>::value && !__addr_in_range(*__first)) {
+ return __insert_from_safe_copy(__n, __ip, __first, __last);
+ } else {
+ const basic_string __temp(__init_with_sentinel_tag(), __first, __last, __alloc());
+ return __insert_from_safe_copy(__n, __ip, __temp.begin(), __temp.end());
+ }
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str,
- size_type __pos2, size_type __n)
-{
- size_type __str_sz = __str.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return insert(__pos1, __str.data() + __pos2, std::min(__n, __str_sz - __pos2));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(
+ size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) {
+ size_type __str_sz = __str.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return insert(__pos1, __str.data() + __pos2, std::min(__n, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3106,152 +2959,133 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n) {
- __self_view __sv = __t;
- size_type __str_sz = __sv.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return insert(__pos1, __sv.data() + __pos2, std::min(__n, __str_sz - __pos2));
+ __self_view __sv = __t;
+ size_type __str_sz = __sv.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return insert(__pos1, __sv.data() + __pos2, std::min(__n, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::insert received nullptr");
- return insert(__pos, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::insert received nullptr");
+ return insert(__pos, __s, traits_type::length(__s));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)
-{
- size_type __ip = static_cast<size_type>(__pos - begin());
- size_type __sz = size();
- size_type __cap = capacity();
- value_type* __p;
- if (__cap == __sz)
- {
- __grow_by_without_replace(__cap, 1, __sz, __ip, 0, 1);
- __p = std::__to_address(__get_long_pointer());
- }
- else
- {
- __annotate_increase(1);
- __p = std::__to_address(__get_pointer());
- size_type __n_move = __sz - __ip;
- if (__n_move != 0)
- traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
- }
- traits_type::assign(__p[__ip], __c);
- traits_type::assign(__p[++__sz], value_type());
- __set_size(__sz);
- return begin() + static_cast<difference_type>(__ip);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c) {
+ size_type __ip = static_cast<size_type>(__pos - begin());
+ size_type __sz = size();
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap == __sz) {
+ __grow_by_without_replace(__cap, 1, __sz, __ip, 0, 1);
+ __p = std::__to_address(__get_long_pointer());
+ } else {
+ __annotate_increase(1);
+ __p = std::__to_address(__get_pointer());
+ size_type __n_move = __sz - __ip;
+ if (__n_move != 0)
+ traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
+ }
+ traits_type::assign(__p[__ip], __c);
+ traits_type::assign(__p[++__sz], value_type());
+ __set_size(__sz);
+ return begin() + static_cast<difference_type>(__ip);
}
// replace
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
- _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- __n1 = std::min(__n1, __sz - __pos);
- size_type __cap = capacity();
- if (__cap - __sz + __n1 >= __n2)
- {
- value_type* __p = std::__to_address(__get_pointer());
- if (__n1 != __n2)
- {
- if (__n2 > __n1)
- __annotate_increase(__n2 - __n1);
- size_type __n_move = __sz - __pos - __n1;
- if (__n_move != 0)
- {
- if (__n1 > __n2)
- {
- traits_type::move(__p + __pos, __s, __n2);
- traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
- return __null_terminate_at(__p, __sz + (__n2 - __n1));
- }
- if (std::__is_pointer_in_range(__p + __pos + 1, __p + __sz, __s))
- {
- if (__p + __pos + __n1 <= __s)
- __s += __n2 - __n1;
- else // __p + __pos < __s < __p + __pos + __n1
- {
- traits_type::move(__p + __pos, __s, __n1);
- __pos += __n1;
- __s += __n2;
- __n2 -= __n1;
- __n1 = 0;
- }
- }
- traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(
+ size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
+ _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ __n1 = std::min(__n1, __sz - __pos);
+ size_type __cap = capacity();
+ if (__cap - __sz + __n1 >= __n2) {
+ value_type* __p = std::__to_address(__get_pointer());
+ if (__n1 != __n2) {
+ if (__n2 > __n1)
+ __annotate_increase(__n2 - __n1);
+ size_type __n_move = __sz - __pos - __n1;
+ if (__n_move != 0) {
+ if (__n1 > __n2) {
+ traits_type::move(__p + __pos, __s, __n2);
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
+ return __null_terminate_at(__p, __sz + (__n2 - __n1));
+ }
+ if (std::__is_pointer_in_range(__p + __pos + 1, __p + __sz, __s)) {
+ if (__p + __pos + __n1 <= __s)
+ __s += __n2 - __n1;
+ else // __p + __pos < __s < __p + __pos + __n1
+ {
+ traits_type::move(__p + __pos, __s, __n1);
+ __pos += __n1;
+ __s += __n2;
+ __n2 -= __n1;
+ __n1 = 0;
+ }
}
- traits_type::move(__p + __pos, __s, __n2);
- return __null_terminate_at(__p, __sz + (__n2 - __n1));
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
+ }
}
- else
- __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
- return *this;
+ traits_type::move(__p + __pos, __s, __n2);
+ return __null_terminate_at(__p, __sz + (__n2 - __n1));
+ } else
+ __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
-{
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- __n1 = std::min(__n1, __sz - __pos);
- size_type __cap = capacity();
- value_type* __p;
- if (__cap - __sz + __n1 >= __n2) {
- __p = std::__to_address(__get_pointer());
- if (__n1 != __n2) {
- if (__n2 > __n1)
- __annotate_increase(__n2 - __n1);
- size_type __n_move = __sz - __pos - __n1;
- if (__n_move != 0)
- traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
- }
- } else {
- __grow_by_without_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
- __p = std::__to_address(__get_long_pointer());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) {
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ __n1 = std::min(__n1, __sz - __pos);
+ size_type __cap = capacity();
+ value_type* __p;
+ if (__cap - __sz + __n1 >= __n2) {
+ __p = std::__to_address(__get_pointer());
+ if (__n1 != __n2) {
+ if (__n2 > __n1)
+ __annotate_increase(__n2 - __n1);
+ size_type __n_move = __sz - __pos - __n1;
+ if (__n_move != 0)
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
}
- traits_type::assign(__p + __pos, __n2, __c);
- return __null_terminate_at(__p, __sz - (__n1 - __n2));
+ } else {
+ __grow_by_without_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
+ __p = std::__to_address(__get_long_pointer());
+ }
+ traits_type::assign(__p + __pos, __n2, __c);
+ return __null_terminate_at(__p, __sz - (__n1 - __n2));
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
+template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
- _InputIterator __j1, _InputIterator __j2)
-{
- const basic_string __temp(__j1, __j2, __alloc());
- return replace(__i1, __i2, __temp);
+basic_string<_CharT, _Traits, _Allocator>::replace(
+ const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2) {
+ const basic_string __temp(__j1, __j2, __alloc());
+ return replace(__i1, __i2, __temp);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str,
- size_type __pos2, size_type __n2)
-{
- size_type __str_sz = __str.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return replace(__pos1, __n1, __str.data() + __pos2, std::min(__n2, __str_sz - __pos2));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(
+ size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) {
+ size_type __str_sz = __str.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return replace(__pos1, __n1, __str.data() + __pos2, std::min(__n2, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3262,20 +3096,18 @@ template <class _Tp,
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(
size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) {
- __self_view __sv = __t;
- size_type __str_sz = __sv.size();
- if (__pos2 > __str_sz)
- __throw_out_of_range();
- return replace(__pos1, __n1, __sv.data() + __pos2, std::min(__n2, __str_sz - __pos2));
+ __self_view __sv = __t;
+ size_type __str_sz = __sv.size();
+ if (__pos2 > __str_sz)
+ __throw_out_of_range();
+ return replace(__pos1, __n1, __sv.data() + __pos2, std::min(__n2, __str_sz - __pos2));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::replace received nullptr");
- return replace(__pos, __n1, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::replace received nullptr");
+ return replace(__pos, __n1, __s, traits_type::length(__s));
}
// erase
@@ -3283,28 +3115,22 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
// 'externally instantiated' erase() implementation, called when __n != npos.
// Does not check __pos against size()
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE
-void
-basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(
- size_type __pos, size_type __n)
-{
- if (__n)
- {
- size_type __sz = size();
- value_type* __p = std::__to_address(__get_pointer());
- __n = std::min(__n, __sz - __pos);
- size_type __n_move = __sz - __pos - __n;
- if (__n_move != 0)
- traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
- __null_terminate_at(__p, __sz - __n);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
+basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) {
+ if (__n) {
+ size_type __sz = size();
+ value_type* __p = std::__to_address(__get_pointer());
+ __n = std::min(__n, __sz - __pos);
+ size_type __n_move = __sz - __pos - __n;
+ if (__n_move != 0)
+ traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
+ __null_terminate_at(__p, __sz - __n);
+ }
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>&
-basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,
- size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) {
if (__pos > size())
__throw_out_of_range();
if (__n == npos) {
@@ -3316,653 +3142,494 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
-{
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__pos != end(), "string::erase(iterator) called with a non-dereferenceable iterator");
- iterator __b = begin();
+ iterator __b = begin();
size_type __r = static_cast<size_type>(__pos - __b);
erase(__r, 1);
return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::iterator
-basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
-{
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
+basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last) {
_LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "string::erase(first, last) called with invalid range");
- iterator __b = begin();
+ iterator __b = begin();
size_type __r = static_cast<size_type>(__first - __b);
erase(__r, static_cast<size_type>(__last - __first));
return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::pop_back(): string is already empty");
- __erase_to_end(size() - 1);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::pop_back(): string is already empty");
+ __erase_to_end(size() - 1);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
-{
- size_type __old_size = size();
- if (__is_long())
- {
- traits_type::assign(*__get_long_pointer(), value_type());
- __set_long_size(0);
- }
- else
- {
- traits_type::assign(*__get_short_pointer(), value_type());
- __set_short_size(0);
- }
- __annotate_shrink(__old_size);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT {
+ size_type __old_size = size();
+ if (__is_long()) {
+ traits_type::assign(*__get_long_pointer(), value_type());
+ __set_long_size(0);
+ } else {
+ traits_type::assign(*__get_short_pointer(), value_type());
+ __set_short_size(0);
+ }
+ __annotate_shrink(__old_size);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
-{
- size_type __sz = size();
- if (__n > __sz)
- append(__n - __sz, __c);
- else
- __erase_to_end(__n);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c) {
+ size_type __sz = size();
+ if (__n > __sz)
+ append(__n - __sz, __c);
+ else
+ __erase_to_end(__n);
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
-basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)
-{
- size_type __sz = size();
- if (__n > __sz) {
- __append_default_init(__n - __sz);
- } else
- __erase_to_end(__n);
+basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) {
+ size_type __sz = size();
+ if (__n > __sz) {
+ __append_default_init(__n - __sz);
+ } else
+ __erase_to_end(__n);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity)
-{
- if (__requested_capacity > max_size())
- __throw_length_error();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) {
+ if (__requested_capacity > max_size())
+ __throw_length_error();
- // Make sure reserve(n) never shrinks. This is technically only required in C++20
- // and later (since P0966R1), however we provide consistent behavior in all Standard
- // modes because this function is instantiated in the shared library.
- if (__requested_capacity <= capacity())
- return;
+ // Make sure reserve(n) never shrinks. This is technically only required in C++20
+ // and later (since P0966R1), however we provide consistent behavior in all Standard
+ // modes because this function is instantiated in the shared library.
+ if (__requested_capacity <= capacity())
+ return;
- size_type __target_capacity = std::max(__requested_capacity, size());
- __target_capacity = __recommend(__target_capacity);
- if (__target_capacity == capacity()) return;
+ size_type __target_capacity = std::max(__requested_capacity, size());
+ __target_capacity = __recommend(__target_capacity);
+ if (__target_capacity == capacity())
+ return;
- __shrink_or_extend(__target_capacity);
+ __shrink_or_extend(__target_capacity);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- size_type __target_capacity = __recommend(size());
- if (__target_capacity == capacity()) return;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ size_type __target_capacity = __recommend(size());
+ if (__target_capacity == capacity())
+ return;
- __shrink_or_extend(__target_capacity);
+ __shrink_or_extend(__target_capacity);
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity)
-{
- __annotate_delete();
- size_type __cap = capacity();
- size_type __sz = size();
-
- pointer __new_data, __p;
- bool __was_long, __now_long;
- if (__fits_in_sso(__target_capacity))
- {
- __was_long = true;
- __now_long = false;
- __new_data = __get_short_pointer();
- __p = __get_long_pointer();
- }
- else
- {
- if (__target_capacity > __cap) {
- auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
- __new_data = __allocation.ptr;
- __target_capacity = __allocation.count - 1;
- }
- else
- {
- #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
- #endif // _LIBCPP_HAS_NO_EXCEPTIONS
- auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
- __new_data = __allocation.ptr;
- __target_capacity = __allocation.count - 1;
- #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- return;
- }
- #else // _LIBCPP_HAS_NO_EXCEPTIONS
- if (__new_data == nullptr)
- return;
- #endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
- __begin_lifetime(__new_data, __target_capacity + 1);
- __now_long = true;
- __was_long = __is_long();
- __p = __get_pointer();
- }
- traits_type::copy(std::__to_address(__new_data),
- std::__to_address(__p), size()+1);
- if (__was_long)
- __alloc_traits::deallocate(__alloc(), __p, __cap+1);
- if (__now_long)
- {
- __set_long_cap(__target_capacity+1);
- __set_long_size(__sz);
- __set_long_pointer(__new_data);
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity) {
+ __annotate_delete();
+ size_type __cap = capacity();
+ size_type __sz = size();
+
+ pointer __new_data, __p;
+ bool __was_long, __now_long;
+ if (__fits_in_sso(__target_capacity)) {
+ __was_long = true;
+ __now_long = false;
+ __new_data = __get_short_pointer();
+ __p = __get_long_pointer();
+ } else {
+ if (__target_capacity > __cap) {
+ auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
+ __new_data = __allocation.ptr;
+ __target_capacity = __allocation.count - 1;
+ } else {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1);
+ __new_data = __allocation.ptr;
+ __target_capacity = __allocation.count - 1;
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ return;
+ }
+#else // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__new_data == nullptr)
+ return;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
- else
- __set_short_size(__sz);
- __annotate_new(__sz);
+ __begin_lifetime(__new_data, __target_capacity + 1);
+ __now_long = true;
+ __was_long = __is_long();
+ __p = __get_pointer();
+ }
+ traits_type::copy(std::__to_address(__new_data), std::__to_address(__p), size() + 1);
+ if (__was_long)
+ __alloc_traits::deallocate(__alloc(), __p, __cap + 1);
+ if (__now_long) {
+ __set_long_cap(__target_capacity + 1);
+ __set_long_size(__sz);
+ __set_long_pointer(__new_data);
+ } else
+ __set_short_size(__sz);
+ __annotate_new(__sz);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::const_reference
-basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
-{
- if (__n >= size())
- __throw_out_of_range();
- return (*this)[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::const_reference
+basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const {
+ if (__n >= size())
+ __throw_out_of_range();
+ return (*this)[__n];
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::reference
-basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
-{
- if (__n >= size())
- __throw_out_of_range();
- return (*this)[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::reference
+basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) {
+ if (__n >= size())
+ __throw_out_of_range();
+ return (*this)[__n];
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const
-{
- size_type __sz = size();
- if (__pos > __sz)
- __throw_out_of_range();
- size_type __rlen = std::min(__n, __sz - __pos);
- traits_type::copy(__s, data() + __pos, __rlen);
- return __rlen;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const {
+ size_type __sz = size();
+ if (__pos > __sz)
+ __throw_out_of_range();
+ size_type __rlen = std::min(__n, __sz - __pos);
+ traits_type::copy(__s, data() + __pos, __rlen);
+ return __rlen;
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
- __alloc_traits::propagate_on_container_swap::value ||
- __alloc_traits::is_always_equal::value ||
- __alloc() == __str.__alloc(), "swapping non-equal allocators");
- if (!__is_long())
- __annotate_delete();
- if (this != &__str && !__str.__is_long())
- __str.__annotate_delete();
- std::swap(__r_.first(), __str.__r_.first());
- std::__swap_allocator(__alloc(), __str.__alloc());
- if (!__is_long())
- __annotate_new(__get_short_size());
- if (this != &__str && !__str.__is_long())
- __str.__annotate_new(__str.__get_short_size());
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value ||
+ __alloc() == __str.__alloc(),
+ "swapping non-equal allocators");
+ if (!__is_long())
+ __annotate_delete();
+ if (this != &__str && !__str.__is_long())
+ __str.__annotate_delete();
+ std::swap(__r_.first(), __str.__r_.first());
+ std::__swap_allocator(__alloc(), __str.__alloc());
+ if (!__is_long())
+ __annotate_new(__get_short_size());
+ if (this != &__str && !__str.__is_long())
+ __str.__annotate_new(__str.__get_short_size());
}
// find
template <class _Traits>
-struct _LIBCPP_HIDDEN __traits_eq
-{
- typedef typename _Traits::char_type char_type;
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT
- {return _Traits::eq(__x, __y);}
+struct _LIBCPP_HIDDEN __traits_eq {
+ typedef typename _Traits::char_type char_type;
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT {
+ return _Traits::eq(__x, __y);
+ }
};
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// rfind
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// find_first_of
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return find(__c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return find(__c, __pos);
}
// find_last_of
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return rfind(__c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return rfind(__c, __pos);
}
// find_first_not_of
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(
+ const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// find_last_not_of
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
- size_type __pos,
- size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(
+ const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __str.data(), __pos, __str.size());
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(
+ const basic_string& __str, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __str.data(), __pos, __str.size());
}
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,
- size_type __pos) const _NOEXCEPT
-{
- __self_view __sv = __t;
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __sv.data(), __pos, __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t, size_type __pos) const _NOEXCEPT {
+ __self_view __sv = __t;
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __sv.data(), __pos, __sv.size());
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
- size_type __pos) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename basic_string<_CharT, _Traits, _Allocator>::size_type
-basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
- size_type __pos) const _NOEXCEPT
-{
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type
+basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c, size_type __pos) const _NOEXCEPT {
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
}
// compare
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20 int
-basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCEPT
-{
- __self_view __sv = __t;
- size_t __lhs_sz = size();
- size_t __rhs_sz = __sv.size();
- int __result = traits_type::compare(data(), __sv.data(),
- std::min(__lhs_sz, __rhs_sz));
- if (__result != 0)
- return __result;
- if (__lhs_sz < __rhs_sz)
- return -1;
- if (__lhs_sz > __rhs_sz)
- return 1;
- return 0;
-}
-
-template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
-{
- return compare(__self_view(__str));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCEPT {
+ __self_view __sv = __t;
+ size_t __lhs_sz = size();
+ size_t __rhs_sz = __sv.size();
+ int __result = traits_type::compare(data(), __sv.data(), std::min(__lhs_sz, __rhs_sz));
+ if (__result != 0)
+ return __result;
+ if (__lhs_sz < __rhs_sz)
+ return -1;
+ if (__lhs_sz > __rhs_sz)
+ return 1;
+ return 0;
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const value_type* __s,
- size_type __n2) const
-{
- _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
- size_type __sz = size();
- if (__pos1 > __sz || __n2 == npos)
- __throw_out_of_range();
- size_type __rlen = std::min(__n1, __sz - __pos1);
- int __r = traits_type::compare(data() + __pos1, __s, std::min(__rlen, __n2));
- if (__r == 0)
- {
- if (__rlen < __n2)
- __r = -1;
- else if (__rlen > __n2)
- __r = 1;
- }
- return __r;
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT {
+ return compare(__self_view(__str));
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(
+ size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const {
+ _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
+ size_type __sz = size();
+ if (__pos1 > __sz || __n2 == npos)
+ __throw_out_of_range();
+ size_type __rlen = std::min(__n1, __sz - __pos1);
+ int __r = traits_type::compare(data() + __pos1, __s, std::min(__rlen, __n2));
+ if (__r == 0) {
+ if (__rlen < __n2)
+ __r = -1;
+ else if (__rlen > __n2)
+ __r = 1;
+ }
+ return __r;
}
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const _Tp& __t) const
-{
- __self_view __sv = __t;
- return compare(__pos1, __n1, __sv.data(), __sv.size());
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const _Tp& __t) const {
+ __self_view __sv = __t;
+ return compare(__pos1, __n1, __sv.data(), __sv.size());
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const basic_string& __str) const
-{
- return compare(__pos1, __n1, __str.data(), __str.size());
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const basic_string& __str) const {
+ return compare(__pos1, __n1, __str.data(), __str.size());
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3972,67 +3639,49 @@ template <class _Tp,
int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(
size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) const {
- __self_view __sv = __t;
- return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
+ __self_view __sv = __t;
+ return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const basic_string& __str,
- size_type __pos2,
- size_type __n2) const
-{
- return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(
+ size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const {
+ return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
- return compare(0, npos, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
+ return compare(0, npos, __s, traits_type::length(__s));
}
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-int
-basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
- size_type __n1,
- const value_type* __s) const
-{
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
- return compare(__pos1, __n1, __s, traits_type::length(__s));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 int
+basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const value_type* __s) const {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
+ return compare(__pos1, __n1, __s, traits_type::length(__s));
}
// __invariants
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-basic_string<_CharT, _Traits, _Allocator>::__invariants() const
-{
- if (size() > capacity())
- return false;
- if (capacity() < __min_cap - 1)
- return false;
- if (data() == nullptr)
- return false;
- if (!_Traits::eq(data()[size()], value_type()))
- return false;
- return true;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 bool basic_string<_CharT, _Traits, _Allocator>::__invariants() const {
+ if (size() > capacity())
+ return false;
+ if (capacity() < __min_cap - 1)
+ return false;
+ if (data() == nullptr)
+ return false;
+ if (!_Traits::eq(data()[size()], value_type()))
+ return false;
+ return true;
}
// __clear_and_shrink
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
-{
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT {
clear();
if (__is_long()) {
__annotate_delete();
@@ -4043,407 +3692,324 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
// operator==
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-bool
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
#if _LIBCPP_STD_VER >= 20
- return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
+ return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
#else
- size_t __lhs_sz = __lhs.size();
- return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(),
- __rhs.data(),
- __lhs_sz) == 0;
+ size_t __lhs_sz = __lhs.size();
+ return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(), __rhs.data(), __lhs_sz) == 0;
#endif
}
-template<class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-bool
+template <class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
- const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
-{
- size_t __lhs_sz = __lhs.size();
- if (__lhs_sz != __rhs.size())
- return false;
- const char* __lp = __lhs.data();
- const char* __rp = __rhs.data();
- if (__lhs.__is_long())
- return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
- for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
- if (*__lp != *__rp)
- return false;
- return true;
+ const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT {
+ size_t __lhs_sz = __lhs.size();
+ if (__lhs_sz != __rhs.size())
+ return false;
+ const char* __lp = __lhs.data();
+ const char* __rp = __rhs.data();
+ if (__lhs.__is_long())
+ return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
+ for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
+ if (*__lp != *__rp)
+ return false;
+ return true;
}
#if _LIBCPP_STD_VER <= 17
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- typedef basic_string<_CharT, _Traits, _Allocator> _String;
- _LIBCPP_ASSERT_NON_NULL(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
- size_t __lhs_len = _Traits::length(__lhs);
- if (__lhs_len != __rhs.size()) return false;
- return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ typedef basic_string<_CharT, _Traits, _Allocator> _String;
+ _LIBCPP_ASSERT_NON_NULL(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
+ size_t __lhs_len = _Traits::length(__lhs);
+ if (__lhs_len != __rhs.size())
+ return false;
+ return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
}
#endif // _LIBCPP_STD_VER <= 17
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
+operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
#if _LIBCPP_STD_VER >= 20
- return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
+ return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs);
#else
- typedef basic_string<_CharT, _Traits, _Allocator> _String;
- _LIBCPP_ASSERT_NON_NULL(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
- size_t __rhs_len = _Traits::length(__rhs);
- if (__rhs_len != __lhs.size()) return false;
- return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
+ typedef basic_string<_CharT, _Traits, _Allocator> _String;
+ _LIBCPP_ASSERT_NON_NULL(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
+ size_t __rhs_len = _Traits::length(__rhs);
+ if (__rhs_len != __lhs.size())
+ return false;
+ return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
#endif
}
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
- const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept {
- return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
+_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept {
+ return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI constexpr auto
operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
- return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
+ return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs);
}
-#else // _LIBCPP_STD_VER >= 20
+#else // _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs == __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs == __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs == __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs == __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return !(__lhs == __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return !(__lhs == __rhs);
}
// operator<
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __rhs.compare(__lhs) > 0;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __rhs.compare(__lhs) > 0;
}
// operator>
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __rhs < __lhs;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __rhs < __lhs;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return __rhs < __lhs;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return __rhs < __lhs;
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return __rhs < __lhs;
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return __rhs < __lhs;
}
// operator<=
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__rhs < __lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__rhs < __lhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return !(__rhs < __lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return !(__rhs < __lhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__rhs < __lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__rhs < __lhs);
}
// operator>=
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs < __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs < __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const _CharT* __rhs) _NOEXCEPT
-{
- return !(__lhs < __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT {
+ return !(__lhs < __rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const _CharT* __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
-{
- return !(__lhs < __rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
+ return !(__lhs < __rhs);
}
#endif // _LIBCPP_STD_VER >= 20
// operator +
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
- const basic_string<_CharT, _Traits, _Allocator>& __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- auto __lhs_sz = __lhs.size();
- auto __rhs_sz = __rhs.size();
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + __rhs_sz,
- _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
- _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
- _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- auto __lhs_sz = _Traits::length(__lhs);
- auto __rhs_sz = __rhs.size();
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + __rhs_sz,
- _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs, __lhs_sz);
- _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
- _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- typename _String::size_type __rhs_sz = __rhs.size();
- _String __r(__uninitialized_size_tag(),
- __rhs_sz + 1,
- _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::assign(__ptr, 1, __lhs);
- _Traits::copy(__ptr + 1, __rhs.data(), __rhs_sz);
- _Traits::assign(__ptr + 1 + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- typename _String::size_type __lhs_sz = __lhs.size();
- typename _String::size_type __rhs_sz = _Traits::length(__rhs);
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + __rhs_sz,
- _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
- _Traits::copy(__ptr + __lhs_sz, __rhs, __rhs_sz);
- _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
- return __r;
-}
-
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
-{
- using _String = basic_string<_CharT, _Traits, _Allocator>;
- typename _String::size_type __lhs_sz = __lhs.size();
- _String __r(__uninitialized_size_tag(),
- __lhs_sz + 1,
- _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
- auto __ptr = std::__to_address(__r.__get_pointer());
- _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
- _Traits::assign(__ptr + __lhs_sz, 1, __rhs);
- _Traits::assign(__ptr + 1 + __lhs_sz, 1, _CharT());
- return __r;
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ auto __lhs_sz = __lhs.size();
+ auto __rhs_sz = __rhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + __rhs_sz,
+ _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
+ _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
+ _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ auto __lhs_sz = _Traits::length(__lhs);
+ auto __rhs_sz = __rhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + __rhs_sz,
+ _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs, __lhs_sz);
+ _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz);
+ _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ typename _String::size_type __rhs_sz = __rhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __rhs_sz + 1,
+ _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::assign(__ptr, 1, __lhs);
+ _Traits::copy(__ptr + 1, __rhs.data(), __rhs_sz);
+ _Traits::assign(__ptr + 1 + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ typename _String::size_type __lhs_sz = __lhs.size();
+ typename _String::size_type __rhs_sz = _Traits::length(__rhs);
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + __rhs_sz,
+ _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
+ _Traits::copy(__ptr + __lhs_sz, __rhs, __rhs_sz);
+ _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT());
+ return __r;
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) {
+ using _String = basic_string<_CharT, _Traits, _Allocator>;
+ typename _String::size_type __lhs_sz = __lhs.size();
+ _String __r(__uninitialized_size_tag(),
+ __lhs_sz + 1,
+ _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator()));
+ auto __ptr = std::__to_address(__r.__get_pointer());
+ _Traits::copy(__ptr, __lhs.data(), __lhs_sz);
+ _Traits::assign(__ptr + __lhs_sz, 1, __rhs);
+ _Traits::assign(__ptr + 1 + __lhs_sz, 1, _CharT());
+ return __r;
}
#ifndef _LIBCPP_CXX03_LANG
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs)
-{
- return std::move(__lhs.append(__rhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
+ return std::move(__lhs.append(__rhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
-{
- return std::move(__rhs.insert(0, __lhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ return std::move(__rhs.insert(0, __lhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
-{
- return std::move(__lhs.append(__rhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ return std::move(__lhs.append(__rhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)
-{
- return std::move(__rhs.insert(0, __lhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(const _CharT* __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ return std::move(__rhs.insert(0, __lhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)
-{
- __rhs.insert(__rhs.begin(), __lhs);
- return std::move(__rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(_CharT __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
+ __rhs.insert(__rhs.begin(), __lhs);
+ return std::move(__rhs);
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs)
-{
- return std::move(__lhs.append(__rhs));
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs) {
+ return std::move(__lhs.append(__rhs));
}
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-basic_string<_CharT, _Traits, _Allocator>
-operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
-{
- __lhs.push_back(__rhs);
- return std::move(__lhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
+operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) {
+ __lhs.push_back(__rhs);
+ return std::move(__lhs);
}
#endif // _LIBCPP_CXX03_LANG
// swap
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,
- basic_string<_CharT, _Traits, _Allocator>& __rhs)
- _NOEXCEPT_(_NOEXCEPT_(__lhs.swap(__rhs)))
-{
- __lhs.swap(__rhs);
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>& __rhs)
+ _NOEXCEPT_(_NOEXCEPT_(__lhs.swap(__rhs))) {
+ __lhs.swap(__rhs);
}
-_LIBCPP_EXPORTED_FROM_ABI int stoi (const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long stol (const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul (const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long long stoll (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI int stoi(const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long stol(const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul(const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long long stoll(const string& __str, size_t* __idx = nullptr, int __base = 10);
_LIBCPP_EXPORTED_FROM_ABI unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI float stof (const string& __str, size_t* __idx = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI double stod (const string& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI float stof(const string& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI double stod(const string& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI long double stold(const string& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI string to_string(int __val);
@@ -4457,14 +4023,14 @@ _LIBCPP_EXPORTED_FROM_ABI string to_string(double __val);
_LIBCPP_EXPORTED_FROM_ABI string to_string(long double __val);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_LIBCPP_EXPORTED_FROM_ABI int stoi (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long stol (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI long long stoll (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI int stoi(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long stol(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI unsigned long stoul(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_EXPORTED_FROM_ABI long long stoll(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
_LIBCPP_EXPORTED_FROM_ABI unsigned long long stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
-_LIBCPP_EXPORTED_FROM_ABI float stof (const wstring& __str, size_t* __idx = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI double stod (const wstring& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI float stof(const wstring& __str, size_t* __idx = nullptr);
+_LIBCPP_EXPORTED_FROM_ABI double stod(const wstring& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI long double stold(const wstring& __str, size_t* __idx = nullptr);
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(int __val);
@@ -4478,17 +4044,16 @@ _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(double __val);
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long double __val);
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_TEMPLATE_DATA_VIS
-const typename basic_string<_CharT, _Traits, _Allocator>::size_type
- basic_string<_CharT, _Traits, _Allocator>::npos;
+template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_TEMPLATE_DATA_VIS const typename basic_string<_CharT, _Traits, _Allocator>::size_type
+ basic_string<_CharT, _Traits, _Allocator>::npos;
template <class _CharT, class _Allocator>
struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> {
- _LIBCPP_HIDE_FROM_ABI size_t
- operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT {
- return std::__do_string_hash(__val.data(), __val.data() + __val.size());
- }
+ _LIBCPP_HIDE_FROM_ABI size_t
+ operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT {
+ return std::__do_string_hash(__val.data(), __val.data() + __val.size());
+ }
};
template <class _Allocator>
@@ -4510,111 +4075,90 @@ template <class _Allocator>
struct hash<basic_string<wchar_t, char_traits<wchar_t>, _Allocator> > : __string_hash<wchar_t, _Allocator> {};
#endif
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const basic_string<_CharT, _Traits, _Allocator>& __str);
+operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str);
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str);
+operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str);
-template<class _CharT, class _Traits, class _Allocator>
+template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
-
-template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-basic_istream<_CharT, _Traits>&
-getline(basic_istream<_CharT, _Traits>&& __is,
- basic_string<_CharT, _Traits, _Allocator>& __str);
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
+
+template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
+getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str);
#if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI
- typename basic_string<_CharT, _Traits, _Allocator>::size_type
- erase(basic_string<_CharT, _Traits, _Allocator>& __str, const _Up& __v) {
+inline _LIBCPP_HIDE_FROM_ABI typename basic_string<_CharT, _Traits, _Allocator>::size_type
+erase(basic_string<_CharT, _Traits, _Allocator>& __str, const _Up& __v) {
auto __old_size = __str.size();
__str.erase(std::remove(__str.begin(), __str.end(), __v), __str.end());
return __old_size - __str.size();
}
template <class _CharT, class _Traits, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename basic_string<_CharT, _Traits, _Allocator>::size_type
- erase_if(basic_string<_CharT, _Traits, _Allocator>& __str,
- _Predicate __pred) {
+inline _LIBCPP_HIDE_FROM_ABI typename basic_string<_CharT, _Traits, _Allocator>::size_type
+erase_if(basic_string<_CharT, _Traits, _Allocator>& __str, _Predicate __pred) {
auto __old_size = __str.size();
- __str.erase(std::remove_if(__str.begin(), __str.end(), __pred),
- __str.end());
+ __str.erase(std::remove_if(__str.begin(), __str.end(), __pred), __str.end());
return __old_size - __str.size();
}
#endif
#if _LIBCPP_STD_VER >= 14
// Literal suffixes for basic_string [basic.string.literals]
-inline namespace literals
-{
- inline namespace string_literals
- {
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<char> operator""s( const char *__str, size_t __len )
- {
- return basic_string<char> (__str, __len);
- }
+inline namespace literals {
+inline namespace string_literals {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char>
+operator""s(const char* __str, size_t __len) {
+ return basic_string<char>(__str, __len);
+}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<wchar_t> operator""s( const wchar_t *__str, size_t __len )
- {
- return basic_string<wchar_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<wchar_t>
+operator""s(const wchar_t* __str, size_t __len) {
+ return basic_string<wchar_t>(__str, __len);
+}
+# endif
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
- inline _LIBCPP_HIDE_FROM_ABI constexpr
- basic_string<char8_t> operator""s(const char8_t *__str, size_t __len)
- {
- return basic_string<char8_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string<char8_t> operator""s(const char8_t* __str, size_t __len) {
+ return basic_string<char8_t>(__str, __len);
+}
+# endif
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<char16_t> operator""s( const char16_t *__str, size_t __len )
- {
- return basic_string<char16_t> (__str, __len);
- }
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char16_t>
+operator""s(const char16_t* __str, size_t __len) {
+ return basic_string<char16_t>(__str, __len);
+}
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string<char32_t> operator""s( const char32_t *__str, size_t __len )
- {
- return basic_string<char32_t> (__str, __len);
- }
- } // namespace string_literals
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char32_t>
+operator""s(const char32_t* __str, size_t __len) {
+ return basic_string<char32_t>(__str, __len);
+}
+} // namespace string_literals
} // namespace literals
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <>
inline constexpr bool __format::__enable_insertable<std::basic_string<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>> = true;
-#endif
-#endif
+# endif
+# endif
#endif
diff --git a/contrib/llvm-project/libcxx/include/string.h b/contrib/llvm-project/libcxx/include/string.h
index 673d90316d00..ae10d5ad2c76 100644
--- a/contrib/llvm-project/libcxx/include/string.h
+++ b/contrib/llvm-project/libcxx/include/string.h
@@ -65,7 +65,7 @@ size_t strlen(const char* s);
// <string.h>. This macro can be defined by users if their C library provides
// the right signature.
#if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
-#define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
+# define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
#endif
#if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
diff --git a/contrib/llvm-project/libcxx/include/string_view b/contrib/llvm-project/libcxx/include/string_view
index 3712584a6666..909224fe7e3d 100644
--- a/contrib/llvm-project/libcxx/include/string_view
+++ b/contrib/llvm-project/libcxx/include/string_view
@@ -255,505 +255,421 @@ namespace std {
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
// TODO: This is a workaround for some vendors to carry a downstream diff to accept `nullptr` in
// string_view constructors. This can be refactored when this exact form isn't needed anymore.
template <class _Traits>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
-inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR inline size_t
+__char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
// This needs to be a single statement for C++11 constexpr
return _LIBCPP_ASSERT_NON_NULL(
__s != nullptr, "null pointer passed to non-null argument of char_traits<...>::length"),
_Traits::length(__s);
}
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
class basic_string_view {
public:
- // types
- using traits_type = _Traits;
- using value_type = _CharT;
- using pointer = _CharT*;
- using const_pointer = const _CharT*;
- using reference = _CharT&;
- using const_reference = const _CharT&;
+ // types
+ using traits_type = _Traits;
+ using value_type = _CharT;
+ using pointer = _CharT*;
+ using const_pointer = const _CharT*;
+ using reference = _CharT&;
+ using const_reference = const _CharT&;
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using const_iterator = __bounded_iter<const_pointer>;
+ using const_iterator = __bounded_iter<const_pointer>;
#else
- using const_iterator = const_pointer; // See [string.view.iterators]
+ using const_iterator = const_pointer; // See [string.view.iterators]
#endif
- using iterator = const_iterator;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
- using reverse_iterator = const_reverse_iterator;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
-
- static_assert((!is_array<value_type>::value), "Character type of basic_string_view must not be an array");
- static_assert(( is_standard_layout<value_type>::value), "Character type of basic_string_view must be standard-layout");
- static_assert(( is_trivial<value_type>::value), "Character type of basic_string_view must be trivial");
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
- "traits_type::char_type must be the same type as CharT");
-
- // [string.view.cons], construct/copy
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view() _NOEXCEPT : __data_(nullptr), __size_(0) {}
-
- _LIBCPP_HIDE_FROM_ABI
- basic_string_view(const basic_string_view&) _NOEXCEPT = default;
-
- _LIBCPP_HIDE_FROM_ABI
- basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
- : __data_(__s), __size_(__len)
- {
+ using iterator = const_iterator;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+ using reverse_iterator = const_reverse_iterator;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
+
+ static_assert((!is_array<value_type>::value), "Character type of basic_string_view must not be an array");
+ static_assert((is_standard_layout<value_type>::value), "Character type of basic_string_view must be standard-layout");
+ static_assert((is_trivial<value_type>::value), "Character type of basic_string_view must be trivial");
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
+
+ // [string.view.cons], construct/copy
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view() _NOEXCEPT : __data_(nullptr), __size_(0) {}
+
+ _LIBCPP_HIDE_FROM_ABI basic_string_view(const basic_string_view&) _NOEXCEPT = default;
+
+ _LIBCPP_HIDE_FROM_ABI basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
+ : __data_(__s),
+ __size_(__len) {
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __len <= static_cast<size_type>(numeric_limits<difference_type>::max()),
- "string_view::string_view(_CharT *, size_t): length does not fit in difference_type");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__len <= static_cast<size_type>(numeric_limits<difference_type>::max()),
+ "string_view::string_view(_CharT *, size_t): length does not fit in difference_type");
_LIBCPP_ASSERT_NON_NULL(
__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
#endif
- }
+ }
#if _LIBCPP_STD_VER >= 20
- template <contiguous_iterator _It, sized_sentinel_for<_It> _End>
- requires (is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>)
- constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end)
- : __data_(std::to_address(__begin)), __size_(__end - __begin)
- {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE((__end - __begin) >= 0,
- "std::string_view::string_view(iterator, sentinel) received invalid range");
- }
+ template <contiguous_iterator _It, sized_sentinel_for<_It> _End>
+ requires(is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>)
+ constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end)
+ : __data_(std::to_address(__begin)), __size_(__end - __begin) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(
+ (__end - __begin) >= 0, "std::string_view::string_view(iterator, sentinel) received invalid range");
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 23
- template <class _Range>
- requires (
- !is_same_v<remove_cvref_t<_Range>, basic_string_view> &&
- ranges::contiguous_range<_Range> &&
- ranges::sized_range<_Range> &&
- is_same_v<ranges::range_value_t<_Range>, _CharT> &&
- !is_convertible_v<_Range, const _CharT*> &&
- (!requires(remove_cvref_t<_Range>& __d) {
- __d.operator std::basic_string_view<_CharT, _Traits>();
- })
- )
- constexpr explicit _LIBCPP_HIDE_FROM_ABI
- basic_string_view(_Range&& __r) : __data_(ranges::data(__r)), __size_(ranges::size(__r)) {}
+ template <class _Range>
+ requires(!is_same_v<remove_cvref_t<_Range>, basic_string_view> && ranges::contiguous_range<_Range> &&
+ ranges::sized_range<_Range> && is_same_v<ranges::range_value_t<_Range>, _CharT> &&
+ !is_convertible_v<_Range, const _CharT*> &&
+ (!requires(remove_cvref_t<_Range>& __d) { __d.operator std::basic_string_view<_CharT, _Traits>(); }))
+ constexpr explicit _LIBCPP_HIDE_FROM_ABI basic_string_view(_Range&& __r)
+ : __data_(ranges::data(__r)), __size_(ranges::size(__r)) {}
#endif // _LIBCPP_STD_VER >= 23
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view(const _CharT* __s)
- : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {}
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view(const _CharT* __s)
+ : __data_(__s), __size_(std::__char_traits_length_checked<_Traits>(__s)) {}
#if _LIBCPP_STD_VER >= 23
- basic_string_view(nullptr_t) = delete;
+ basic_string_view(nullptr_t) = delete;
#endif
- // [string.view.iterators], iterators
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT { return cbegin(); }
+ // [string.view.iterators], iterators
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return cbegin(); }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT { return cend(); }
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return cend(); }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
+ return std::__make_bounded_iter(data(), data(), data() + size());
#else
- return __data_;
+ return __data_;
#endif
- }
+ }
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
+ return std::__make_bounded_iter(data() + size(), data(), data() + size());
#else
- return __data_ + __size_;
+ return __data_ + __size_;
#endif
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
-
- // [string.view.capacity], capacity
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT { return __size_; }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- size_type length() const _NOEXCEPT { return __size_; }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT { return numeric_limits<size_type>::max() / sizeof(value_type); }
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- bool empty() const _NOEXCEPT { return __size_ == 0; }
-
- // [string.view.access], element access
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference operator[](size_type __pos) const _NOEXCEPT {
- return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos < size(), "string_view[] index out of bounds"), __data_[__pos];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference at(size_type __pos) const
- {
- return __pos >= size()
- ? (__throw_out_of_range("string_view::at"), __data_[0])
- : __data_[__pos];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference front() const _NOEXCEPT
- {
- return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::front(): string is empty"), __data_[0];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_reference back() const _NOEXCEPT
- {
- return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::back(): string is empty"),
- __data_[__size_ - 1];
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- const_pointer data() const _NOEXCEPT { return __data_; }
-
- // [string.view.modifiers], modifiers:
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- void remove_prefix(size_type __n) _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_prefix() can't remove more than size()");
- __data_ += __n;
- __size_ -= __n;
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- void remove_suffix(size_type __n) _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_suffix() can't remove more than size()");
- __size_ -= __n;
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- void swap(basic_string_view& __other) _NOEXCEPT
- {
- const value_type *__p = __data_;
- __data_ = __other.__data_;
- __other.__data_ = __p;
-
- size_type __sz = __size_;
- __size_ = __other.__size_;
- __other.__size_ = __sz;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
- {
- if (__pos > size())
- __throw_out_of_range("string_view::copy");
- size_type __rlen = std::min(__n, size() - __pos);
- _Traits::copy(__s, data() + __pos, __rlen);
- return __rlen;
- }
-
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
- basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
- {
- return __pos > size()
- ? (__throw_out_of_range("string_view::substr"), basic_string_view())
- : basic_string_view(data() + __pos, std::min(__n, size() - __pos));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT
- {
- size_type __rlen = std::min(size(), __sv.size());
- int __retval = _Traits::compare(data(), __sv.data(), __rlen);
- if (__retval == 0) // first __rlen chars matched
- __retval = size() == __sv.size() ? 0 : (size() < __sv.size() ? -1 : 1);
- return __retval;
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
- {
- return substr(__pos1, __n1).compare(__sv);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare( size_type __pos1, size_type __n1,
- basic_string_view __sv, size_type __pos2, size_type __n2) const
- {
- return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(const _CharT* __s) const _NOEXCEPT
- {
- return compare(basic_string_view(__s));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
- {
- return substr(__pos1, __n1).compare(basic_string_view(__s));
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
- {
- return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
- }
-
- // find
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
- {
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find(): received nullptr");
- return std::__str_find<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // rfind
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
- {
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type rfind(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::rfind(): received nullptr");
- return std::__str_rfind<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_first_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
- { return find(__c, __pos); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_of(): received nullptr");
- return std::__str_find_first_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_last_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
- { return rfind(__c, __pos); }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_of(): received nullptr");
- return std::__str_find_last_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_first_not_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
- {
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
- return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
-
- // find_last_not_of
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(
- __s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s.data(), __pos, __s.size());
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
- {
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __c, __pos);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, __n);
- }
-
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
- {
- _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
- return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
- (data(), size(), __s, __pos, traits_type::length(__s));
- }
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(cend());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(cbegin());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
+ return const_reverse_iterator(cend());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
+ return const_reverse_iterator(cbegin());
+ }
+
+ // [string.view.capacity], capacity
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type length() const _NOEXCEPT { return __size_; }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ return numeric_limits<size_type>::max() / sizeof(value_type);
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {
+ return __size_ == 0;
+ }
+
+ // [string.view.access], element access
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __pos) const _NOEXCEPT {
+ return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos < size(), "string_view[] index out of bounds"), __data_[__pos];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __pos) const {
+ return __pos >= size() ? (__throw_out_of_range("string_view::at"), __data_[0]) : __data_[__pos];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
+ return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::front(): string is empty"), __data_[0];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
+ return _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string_view::back(): string is empty"), __data_[__size_ - 1];
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_pointer data() const _NOEXCEPT { return __data_; }
+
+ // [string.view.modifiers], modifiers:
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI void remove_prefix(size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_prefix() can't remove more than size()");
+ __data_ += __n;
+ __size_ -= __n;
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI void remove_suffix(size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n <= size(), "remove_suffix() can't remove more than size()");
+ __size_ -= __n;
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI void swap(basic_string_view& __other) _NOEXCEPT {
+ const value_type* __p = __data_;
+ __data_ = __other.__data_;
+ __other.__data_ = __p;
+
+ size_type __sz = __size_;
+ __size_ = __other.__size_;
+ __other.__size_ = __sz;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
+ copy(_CharT* __s, size_type __n, size_type __pos = 0) const {
+ if (__pos > size())
+ __throw_out_of_range("string_view::copy");
+ size_type __rlen = std::min(__n, size() - __pos);
+ _Traits::copy(__s, data() + __pos, __rlen);
+ return __rlen;
+ }
+
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view substr(size_type __pos = 0, size_type __n = npos) const {
+ return __pos > size() ? (__throw_out_of_range("string_view::substr"), basic_string_view())
+ : basic_string_view(data() + __pos, std::min(__n, size() - __pos));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT {
+ size_type __rlen = std::min(size(), __sv.size());
+ int __retval = _Traits::compare(data(), __sv.data(), __rlen);
+ if (__retval == 0) // first __rlen chars matched
+ __retval = size() == __sv.size() ? 0 : (size() < __sv.size() ? -1 : 1);
+ return __retval;
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, basic_string_view __sv) const {
+ return substr(__pos1, __n1).compare(__sv);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, basic_string_view __sv, size_type __pos2, size_type __n2) const {
+ return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int compare(const _CharT* __s) const _NOEXCEPT {
+ return compare(basic_string_view(__s));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, const _CharT* __s) const {
+ return substr(__pos1, __n1).compare(basic_string_view(__s));
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI int
+ compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const {
+ return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
+ }
+
+ // find
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find(): received nullptr");
+ return std::__str_find<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // rfind
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ rfind(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::rfind(): received nullptr");
+ return std::__str_rfind<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_first_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
+ return find(__c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_of(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_of(): received nullptr");
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_last_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
+ return rfind(__c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_of(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_of(): received nullptr");
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_first_not_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(
+ __s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT {
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_first_not_of(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
+
+ // find_last_not_of
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(
+ __s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s.data(), __pos, __s.size());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT {
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI size_type
+ find_last_not_of(const _CharT* __s, size_type __pos = npos) const _NOEXCEPT {
+ _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
+ data(), size(), __s, __pos, traits_type::length(__s));
+ }
#if _LIBCPP_STD_VER >= 20
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(basic_string_view __s) const noexcept
- { return size() >= __s.size() && compare(0, __s.size(), __s) == 0; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(basic_string_view __s) const noexcept {
+ return size() >= __s.size() && compare(0, __s.size(), __s) == 0;
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(front(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(front(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool starts_with(const value_type* __s) const noexcept
- { return starts_with(basic_string_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(const value_type* __s) const noexcept {
+ return starts_with(basic_string_view(__s));
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(basic_string_view __s) const noexcept
- { return size() >= __s.size() && compare(size() - __s.size(), npos, __s) == 0; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(basic_string_view __s) const noexcept {
+ return size() >= __s.size() && compare(size() - __s.size(), npos, __s) == 0;
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(value_type __c) const noexcept
- { return !empty() && _Traits::eq(back(), __c); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
+ return !empty() && _Traits::eq(back(), __c);
+ }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool ends_with(const value_type* __s) const noexcept
- { return ends_with(basic_string_view(__s)); }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* __s) const noexcept {
+ return ends_with(basic_string_view(__s));
+ }
#endif
#if _LIBCPP_STD_VER >= 23
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(basic_string_view __sv) const noexcept
- { return find(__sv) != npos; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(basic_string_view __sv) const noexcept { return find(__sv) != npos; }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(value_type __c) const noexcept
- { return find(__c) != npos; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept { return find(__c) != npos; }
- constexpr _LIBCPP_HIDE_FROM_ABI
- bool contains(const value_type* __s) const
- { return find(__s) != npos; }
+ constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* __s) const { return find(__s) != npos; }
#endif
private:
- const value_type* __data_;
- size_type __size_;
+ const value_type* __data_;
+ size_type __size_;
};
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_string_view);
@@ -769,220 +685,194 @@ inline constexpr bool ranges::enable_borrowed_range<basic_string_view<_CharT, _T
#if _LIBCPP_STD_VER >= 20
template <contiguous_iterator _It, sized_sentinel_for<_It> _End>
- basic_string_view(_It, _End) -> basic_string_view<iter_value_t<_It>>;
+basic_string_view(_It, _End) -> basic_string_view<iter_value_t<_It>>;
#endif // _LIBCPP_STD_VER >= 20
-
#if _LIBCPP_STD_VER >= 23
template <ranges::contiguous_range _Range>
- basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>;
+basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>;
#endif
// [string.view.comparison]
#if _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI constexpr
-bool operator==(basic_string_view<_CharT, _Traits> __lhs,
- type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(basic_string_view<_CharT, _Traits> __lhs,
+ type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
- basic_string_view<_CharT, _Traits> __lhs, type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
- if constexpr (requires { typename _Traits::comparison_category; }) {
- // [string.view]/4
- static_assert(
- __comparison_category<typename _Traits::comparison_category>,
- "return type is not a comparison category type");
- return static_cast<typename _Traits::comparison_category>(__lhs.compare(__rhs) <=> 0);
- } else {
- return static_cast<weak_ordering>(__lhs.compare(__rhs) <=> 0);
- }
+_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(basic_string_view<_CharT, _Traits> __lhs,
+ type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) noexcept {
+ if constexpr (requires { typename _Traits::comparison_category; }) {
+ // [string.view]/4
+ static_assert(
+ __comparison_category<typename _Traits::comparison_category>, "return type is not a comparison category type");
+ return static_cast<typename _Traits::comparison_category>(__lhs.compare(__rhs) <=> 0);
+ } else {
+ return static_cast<weak_ordering>(__lhs.compare(__rhs) <=> 0);
+ }
}
#else
// operator ==
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator==(basic_string_view<_CharT, _Traits> __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator==(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
// The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409326 for details.
// This applies to the other sufficient overloads below for the other comparison operators.
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator==(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator==(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator==(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size()) return false;
- return __lhs.compare(__rhs) == 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator==(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return false;
+ return __lhs.compare(__rhs) == 0;
}
// operator !=
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size())
- return true;
- return __lhs.compare(__rhs) != 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return true;
+ return __lhs.compare(__rhs) != 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size())
- return true;
- return __lhs.compare(__rhs) != 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator!=(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return true;
+ return __lhs.compare(__rhs) != 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- if (__lhs.size() != __rhs.size())
- return true;
- return __lhs.compare(__rhs) != 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ if (__lhs.size() != __rhs.size())
+ return true;
+ return __lhs.compare(__rhs) != 0;
}
-
// operator <
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) < 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) < 0;
}
-
// operator >
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) > 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) > 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) > 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) > 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) > 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) > 0;
}
-
// operator <=
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) <= 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) <= 0;
}
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) <= 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<=(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) <= 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) <= 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) <= 0;
}
-
// operator >=
-template<class _CharT, class _Traits>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) >= 0;
+template <class _CharT, class _Traits>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) >= 0;
}
-
-template<class _CharT, class _Traits, int = 1>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
- __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) >= 0;
+template <class _CharT, class _Traits, int = 1>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>=(basic_string_view<_CharT, _Traits> __lhs,
+ __type_identity_t<basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) >= 0;
}
-template<class _CharT, class _Traits, int = 2>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
-bool operator>=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
- basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
-{
- return __lhs.compare(__rhs) >= 0;
+template <class _CharT, class _Traits, int = 2>
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
+operator>=(__type_identity_t<basic_string_view<_CharT, _Traits> > __lhs,
+ basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
+ return __lhs.compare(__rhs) >= 0;
}
#endif // _LIBCPP_STD_VER >= 20
-template<class _CharT, class _Traits>
+template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- basic_string_view<_CharT, _Traits> __str);
+operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __str);
// [string.view.hash]
-template<class _CharT>
-struct __string_view_hash : public __unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
- return std::__do_string_hash(__val.data(), __val.data() + __val.size());
- }
+template <class _CharT>
+struct __string_view_hash : public __unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
+ return std::__do_string_hash(__val.data(), __val.data() + __val.size());
+ }
};
template <>
@@ -1005,44 +895,37 @@ struct hash<basic_string_view<wchar_t, char_traits<wchar_t> > > : __string_view_
#endif
#if _LIBCPP_STD_VER >= 14
-inline namespace literals
-{
- inline namespace string_view_literals
- {
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char> operator""sv(const char *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char> (__str, __len);
- }
+inline namespace literals {
+inline namespace string_view_literals {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char>
+operator""sv(const char* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char>(__str, __len);
+}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<wchar_t> operator""sv(const wchar_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<wchar_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<wchar_t>
+operator""sv(const wchar_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<wchar_t>(__str, __len);
+}
+# endif
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char8_t> operator""sv(const char8_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char8_t> (__str, __len);
- }
-#endif
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char8_t>
+operator""sv(const char8_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char8_t>(__str, __len);
+}
+# endif
+
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char16_t>
+operator""sv(const char16_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char16_t>(__str, __len);
+}
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char16_t> operator""sv(const char16_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char16_t> (__str, __len);
- }
-
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- basic_string_view<char32_t> operator""sv(const char32_t *__str, size_t __len) _NOEXCEPT
- {
- return basic_string_view<char32_t> (__str, __len);
- }
- } // namespace string_view_literals
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char32_t>
+operator""sv(const char32_t* __str, size_t __len) _NOEXCEPT {
+ return basic_string_view<char32_t>(__str, __len);
+}
+} // namespace string_view_literals
} // namespace literals
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/strstream b/contrib/llvm-project/libcxx/include/strstream
index d42ca7e9271c..7843184e4da4 100644
--- a/contrib/llvm-project/libcxx/include/strstream
+++ b/contrib/llvm-project/libcxx/include/strstream
@@ -141,267 +141,201 @@ private:
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf
- : public streambuf
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf {
public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
- explicit strstreambuf(streamsize __alsize);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
+ explicit strstreambuf(streamsize __alsize);
#else
- explicit strstreambuf(streamsize __alsize = 0);
+ explicit strstreambuf(streamsize __alsize = 0);
#endif
- strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
- strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
- strstreambuf(const char* __gnext, streamsize __n);
+ strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
+ strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
+ strstreambuf(const char* __gnext, streamsize __n);
- strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
- strstreambuf(const signed char* __gnext, streamsize __n);
- strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
- strstreambuf(const unsigned char* __gnext, streamsize __n);
+ strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
+ strstreambuf(const signed char* __gnext, streamsize __n);
+ strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
+ strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf(strstreambuf&& __rhs);
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf& operator=(strstreambuf&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf(strstreambuf&& __rhs);
+ _LIBCPP_HIDE_FROM_ABI strstreambuf& operator=(strstreambuf&& __rhs);
#endif // _LIBCPP_CXX03_LANG
- ~strstreambuf() override;
+ ~strstreambuf() override;
- void swap(strstreambuf& __rhs);
+ void swap(strstreambuf& __rhs);
- void freeze(bool __freezefl = true);
- char* str();
- int pcount() const;
+ void freeze(bool __freezefl = true);
+ char* str();
+ int pcount() const;
protected:
- int_type overflow (int_type __c = EOF) override;
- int_type pbackfail(int_type __c = EOF) override;
- int_type underflow() override;
- pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out) override;
- pos_type seekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out) override;
+ int_type overflow(int_type __c = EOF) override;
+ int_type pbackfail(int_type __c = EOF) override;
+ int_type underflow() override;
+ pos_type
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) override;
+ pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) override;
private:
- typedef unsigned __mode_type;
- static const __mode_type __allocated = 0x01;
- static const __mode_type __constant = 0x02;
- static const __mode_type __dynamic = 0x04;
- static const __mode_type __frozen = 0x08;
- static const streamsize __default_alsize = 4096;
-
- __mode_type __strmode_;
- streamsize __alsize_;
- void* (*__palloc_)(size_t);
- void (*__pfree_)(void*);
-
- void __init(char* __gnext, streamsize __n, char* __pbeg);
+ typedef unsigned __mode_type;
+ static const __mode_type __allocated = 0x01;
+ static const __mode_type __constant = 0x02;
+ static const __mode_type __dynamic = 0x04;
+ static const __mode_type __frozen = 0x08;
+ static const streamsize __default_alsize = 4096;
+
+ __mode_type __strmode_;
+ streamsize __alsize_;
+ void* (*__palloc_)(size_t);
+ void (*__pfree_)(void*);
+
+ void __init(char* __gnext, streamsize __n, char* __pbeg);
};
#ifndef _LIBCPP_CXX03_LANG
-inline _LIBCPP_HIDE_FROM_ABI
-strstreambuf::strstreambuf(strstreambuf&& __rhs)
+inline _LIBCPP_HIDE_FROM_ABI strstreambuf::strstreambuf(strstreambuf&& __rhs)
: streambuf(__rhs),
__strmode_(__rhs.__strmode_),
__alsize_(__rhs.__alsize_),
__palloc_(__rhs.__palloc_),
- __pfree_(__rhs.__pfree_)
-{
- __rhs.setg(nullptr, nullptr, nullptr);
- __rhs.setp(nullptr, nullptr);
+ __pfree_(__rhs.__pfree_) {
+ __rhs.setg(nullptr, nullptr, nullptr);
+ __rhs.setp(nullptr, nullptr);
}
-inline _LIBCPP_HIDE_FROM_ABI
-strstreambuf&
-strstreambuf::operator=(strstreambuf&& __rhs)
-{
- if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
- {
- if (__pfree_)
- __pfree_(eback());
- else
- delete [] eback();
- }
- streambuf::operator=(__rhs);
- __strmode_ = __rhs.__strmode_;
- __alsize_ = __rhs.__alsize_;
- __palloc_ = __rhs.__palloc_;
- __pfree_ = __rhs.__pfree_;
- __rhs.setg(nullptr, nullptr, nullptr);
- __rhs.setp(nullptr, nullptr);
- return *this;
+inline _LIBCPP_HIDE_FROM_ABI strstreambuf& strstreambuf::operator=(strstreambuf&& __rhs) {
+ if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0) {
+ if (__pfree_)
+ __pfree_(eback());
+ else
+ delete[] eback();
+ }
+ streambuf::operator=(__rhs);
+ __strmode_ = __rhs.__strmode_;
+ __alsize_ = __rhs.__alsize_;
+ __palloc_ = __rhs.__palloc_;
+ __pfree_ = __rhs.__pfree_;
+ __rhs.setg(nullptr, nullptr, nullptr);
+ __rhs.setp(nullptr, nullptr);
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream
- : public istream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream : public istream {
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit istrstream(const char* __s)
- : istream(&__sb_), __sb_(__s, 0) {}
- _LIBCPP_HIDE_FROM_ABI
- explicit istrstream(char* __s)
- : istream(&__sb_), __sb_(__s, 0) {}
- _LIBCPP_HIDE_FROM_ABI
- istrstream(const char* __s, streamsize __n)
- : istream(&__sb_), __sb_(__s, __n) {}
- _LIBCPP_HIDE_FROM_ABI
- istrstream(char* __s, streamsize __n)
- : istream(&__sb_), __sb_(__s, __n) {}
+ _LIBCPP_HIDE_FROM_ABI explicit istrstream(const char* __s) : istream(&__sb_), __sb_(__s, 0) {}
+ _LIBCPP_HIDE_FROM_ABI explicit istrstream(char* __s) : istream(&__sb_), __sb_(__s, 0) {}
+ _LIBCPP_HIDE_FROM_ABI istrstream(const char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
+ _LIBCPP_HIDE_FROM_ABI istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- istrstream(istrstream&& __rhs) // extension
- : istream(std::move(static_cast<istream&>(__rhs))),
- __sb_(std::move(__rhs.__sb_))
- {
- istream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- istrstream& operator=(istrstream&& __rhs)
- {
- __sb_ = std::move(__rhs.__sb_);
- istream::operator=(std::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI istrstream(istrstream&& __rhs) // extension
+ : istream(std::move(static_cast<istream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ istream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI istrstream& operator=(istrstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ istream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~istrstream() override;
+ ~istrstream() override;
- _LIBCPP_HIDE_FROM_ABI
- void swap(istrstream& __rhs)
- {
- istream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(istrstream& __rhs) {
+ istream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_HIDE_FROM_ABI
- char *str() {return __sb_.str();}
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
private:
- strstreambuf __sb_;
+ strstreambuf __sb_;
};
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream
- : public ostream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream : public ostream {
public:
- _LIBCPP_HIDE_FROM_ABI
- ostrstream()
- : ostream(&__sb_) {}
- _LIBCPP_HIDE_FROM_ABI
- ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
- : ostream(&__sb_),
- __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0))
- {}
+ _LIBCPP_HIDE_FROM_ABI ostrstream() : ostream(&__sb_) {}
+ _LIBCPP_HIDE_FROM_ABI ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
+ : ostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ostrstream(ostrstream&& __rhs) // extension
- : ostream(std::move(static_cast<ostream&>(__rhs))),
- __sb_(std::move(__rhs.__sb_))
- {
- ostream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- ostrstream& operator=(ostrstream&& __rhs)
- {
- __sb_ = std::move(__rhs.__sb_);
- ostream::operator=(std::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI ostrstream(ostrstream&& __rhs) // extension
+ : ostream(std::move(static_cast<ostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ ostream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ostrstream& operator=(ostrstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ ostream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~ostrstream() override;
+ ~ostrstream() override;
- _LIBCPP_HIDE_FROM_ABI
- void swap(ostrstream& __rhs)
- {
- ostream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(ostrstream& __rhs) {
+ ostream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_HIDE_FROM_ABI
- void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
- _LIBCPP_HIDE_FROM_ABI
- char* str() {return __sb_.str();}
- _LIBCPP_HIDE_FROM_ABI
- int pcount() const {return __sb_.pcount();}
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
+ _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
private:
- strstreambuf __sb_; // exposition only
+ strstreambuf __sb_; // exposition only
};
-class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream
- : public iostream
-{
+class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream : public iostream {
public:
- // Types
- typedef char char_type;
- typedef char_traits<char>::int_type int_type;
- typedef char_traits<char>::pos_type pos_type;
- typedef char_traits<char>::off_type off_type;
+ // Types
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
- // constructors/destructor
- _LIBCPP_HIDE_FROM_ABI
- strstream()
- : iostream(&__sb_) {}
- _LIBCPP_HIDE_FROM_ABI
- strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
- : iostream(&__sb_),
- __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0))
- {}
+ // constructors/destructor
+ _LIBCPP_HIDE_FROM_ABI strstream() : iostream(&__sb_) {}
+ _LIBCPP_HIDE_FROM_ABI strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : iostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- strstream(strstream&& __rhs) // extension
- : iostream(std::move(static_cast<iostream&>(__rhs))),
- __sb_(std::move(__rhs.__sb_))
- {
- iostream::set_rdbuf(&__sb_);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- strstream& operator=(strstream&& __rhs)
- {
- __sb_ = std::move(__rhs.__sb_);
- iostream::operator=(std::move(__rhs));
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI strstream(strstream&& __rhs) // extension
+ : iostream(std::move(static_cast<iostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
+ iostream::set_rdbuf(&__sb_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI strstream& operator=(strstream&& __rhs) {
+ __sb_ = std::move(__rhs.__sb_);
+ iostream::operator=(std::move(__rhs));
+ return *this;
+ }
#endif // _LIBCPP_CXX03_LANG
- ~strstream() override;
+ ~strstream() override;
- _LIBCPP_HIDE_FROM_ABI
- void swap(strstream& __rhs)
- {
- iostream::swap(__rhs);
- __sb_.swap(__rhs.__sb_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(strstream& __rhs) {
+ iostream::swap(__rhs);
+ __sb_.swap(__rhs.__sb_);
+ }
- // Members:
- _LIBCPP_HIDE_FROM_ABI
- strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
- _LIBCPP_HIDE_FROM_ABI
- void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
- _LIBCPP_HIDE_FROM_ABI
- int pcount() const {return __sb_.pcount();}
- _LIBCPP_HIDE_FROM_ABI
- char* str() {return __sb_.str();}
+ // Members:
+ _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
+ _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
+ _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
+ _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
private:
- strstreambuf __sb_; // exposition only
+ strstreambuf __sb_; // exposition only
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/thread b/contrib/llvm-project/libcxx/include/thread
index 943085b7af03..1cf22bf6aaf9 100644
--- a/contrib/llvm-project/libcxx/include/thread
+++ b/contrib/llvm-project/libcxx/include/thread
@@ -106,7 +106,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<thread> is not supported since libc++ has been configured without support for threads."
+# error "<thread> is not supported since libc++ has been configured without support for threads."
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
diff --git a/contrib/llvm-project/libcxx/include/tuple b/contrib/llvm-project/libcxx/include/tuple
index 194138f7076c..8c954fc72c37 100644
--- a/contrib/llvm-project/libcxx/include/tuple
+++ b/contrib/llvm-project/libcxx/include/tuple
@@ -282,1400 +282,1170 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
-
// __tuple_leaf
-template <size_t _Ip, class _Hp,
- bool=is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value
- >
+template <size_t _Ip, class _Hp, bool = is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value >
class __tuple_leaf;
template <size_t _Ip, class _Hp, bool _Ep>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value)
-{
- swap(__x.get(), __y.get());
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) {
+ swap(__x.get(), __y.get());
}
template <size_t _Ip, class _Hp, bool _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x, const __tuple_leaf<_Ip, _Hp, _Ep>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<const _Hp>::value) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x, const __tuple_leaf<_Ip, _Hp, _Ep>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<const _Hp>::value) {
swap(__x.get(), __y.get());
}
template <size_t _Ip, class _Hp, bool>
-class __tuple_leaf
-{
- _Hp __value_;
+class __tuple_leaf {
+ _Hp __value_;
- template <class _Tp>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
-#if __has_keyword(__reference_binds_to_temporary)
- return !__reference_binds_to_temporary(_Hp, _Tp);
-#else
- return true;
-#endif
- }
+ template <class _Tp>
+ static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
+# if __has_keyword(__reference_binds_to_temporary)
+ return !__reference_binds_to_temporary(_Hp, _Tp);
+# else
+ return true;
+# endif
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&);
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_leaf& operator=(const __tuple_leaf&);
public:
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_()
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 0>, const _Alloc&)
- : __value_()
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
- : __value_(allocator_arg_t(), __a)
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
- : __value_(__a)
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to default construct a reference element in a tuple");}
-
- template <class _Tp,
- class = __enable_if_t<
- _And<
- _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>,
- is_constructible<_Hp, _Tp>
- >::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
- : __value_(std::forward<_Tp>(__t))
- {static_assert(__can_bind_reference<_Tp&&>(),
- "Attempted construction of reference element binds to a temporary whose lifetime has ended");}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
- : __value_(std::forward<_Tp>(__t))
- {static_assert(__can_bind_reference<_Tp&&>(),
- "Attempted construction of reference element binds to a temporary whose lifetime has ended");}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
- : __value_(allocator_arg_t(), __a, std::forward<_Tp>(__t))
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to uses-allocator construct a reference element in a tuple");}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
- : __value_(std::forward<_Tp>(__t), __a)
- {static_assert(!is_reference<_Hp>::value,
- "Attempted to uses-allocator construct a reference element in a tuple");}
-
- _LIBCPP_HIDE_FROM_ABI __tuple_leaf(const __tuple_leaf& __t) = default;
- _LIBCPP_HIDE_FROM_ABI __tuple_leaf(__tuple_leaf&& __t) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
- {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int swap(const __tuple_leaf& __t) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT {return __value_;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {return __value_;}
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) : __value_() {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
+ : __value_(allocator_arg_t(), __a) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : __value_(__a) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
+ }
+
+ template <class _Tp,
+ class = __enable_if_t<
+ _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
+ : __value_(std::forward<_Tp>(__t)) {
+ static_assert(__can_bind_reference<_Tp&&>(),
+ "Attempted construction of reference element binds to a temporary whose lifetime has ended");
+ }
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
+ integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
+ : __value_(std::forward<_Tp>(__t)) {
+ static_assert(__can_bind_reference<_Tp&&>(),
+ "Attempted construction of reference element binds to a temporary whose lifetime has ended");
+ }
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
+ integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
+ : __value_(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
+ }
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
+ integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
+ : __value_(std::forward<_Tp>(__t), __a) {
+ static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __tuple_leaf(const __tuple_leaf& __t) = default;
+ _LIBCPP_HIDE_FROM_ABI __tuple_leaf(__tuple_leaf&& __t) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(__tuple_leaf& __t)
+ _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) {
+ std::swap(*this, __t);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __t) const
+ _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
+ std::swap(*this, __t);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT { return __value_; }
};
template <size_t _Ip, class _Hp>
-class __tuple_leaf<_Ip, _Hp, true>
- : private _Hp
-{
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_leaf& operator=(const __tuple_leaf&);
+class __tuple_leaf<_Ip, _Hp, true> : private _Hp {
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&);
+
public:
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
- : _Hp(allocator_arg_t(), __a) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
- : _Hp(__a) {}
-
- template <class _Tp,
- class = __enable_if_t<
- _And<
- _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>,
- is_constructible<_Hp, _Tp>
- >::value
- >
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
- : _Hp(std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
- : _Hp(std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
- : _Hp(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
- : _Hp(std::forward<_Tp>(__t), __a) {}
-
- __tuple_leaf(__tuple_leaf const &) = default;
- __tuple_leaf(__tuple_leaf &&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int
- swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
- {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- int swap(const __tuple_leaf& __rhs) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
- std::swap(*this, __rhs);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
+ : _Hp(allocator_arg_t(), __a) {}
+
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : _Hp(__a) {}
+
+ template <class _Tp,
+ class = __enable_if_t<
+ _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
+ : _Hp(std::forward<_Tp>(__t)) {}
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
+ : _Hp(std::forward<_Tp>(__t)) {}
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
+ : _Hp(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {}
+
+ template <class _Tp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
+ : _Hp(std::forward<_Tp>(__t), __a) {}
+
+ __tuple_leaf(__tuple_leaf const&) = default;
+ __tuple_leaf(__tuple_leaf&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(__tuple_leaf& __t)
+ _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) {
+ std::swap(*this, __t);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __rhs) const
+ _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
+ std::swap(*this, __rhs);
+ return 0;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT { return static_cast<_Hp&>(*this); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {
+ return static_cast<const _Hp&>(*this);
+ }
};
-template <class ..._Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __swallow(_Tp&&...) _NOEXCEPT {}
+template <class... _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swallow(_Tp&&...) _NOEXCEPT {}
template <class _Tp>
struct __all_default_constructible;
-template <class ..._Tp>
-struct __all_default_constructible<__tuple_types<_Tp...>>
- : __all<is_default_constructible<_Tp>::value...>
-{ };
+template <class... _Tp>
+struct __all_default_constructible<__tuple_types<_Tp...>> : __all<is_default_constructible<_Tp>::value...> {};
// __tuple_impl
-template<class _Indx, class ..._Tp> struct __tuple_impl;
+template <class _Indx, class... _Tp>
+struct __tuple_impl;
-template<size_t ..._Indx, class ..._Tp>
+template <size_t... _Indx, class... _Tp>
struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
- : public __tuple_leaf<_Indx, _Tp>...
-{
- _LIBCPP_HIDE_FROM_ABI
- constexpr __tuple_impl()
- _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
-
- template <size_t ..._Uf, class ..._Tf,
- size_t ..._Ul, class ..._Tl, class ..._Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
- __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
- _Up&&... __u)
- _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
- __all<is_nothrow_default_constructible<_Tl>::value...>::value)) :
- __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))...,
- __tuple_leaf<_Ul, _Tl>()...
- {}
-
- template <class _Alloc, size_t ..._Uf, class ..._Tf,
- size_t ..._Ul, class ..._Tl, class ..._Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit
- __tuple_impl(allocator_arg_t, const _Alloc& __a,
- __tuple_indices<_Uf...>, __tuple_types<_Tf...>,
- __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
- _Up&&... __u) :
- __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a,
- std::forward<_Up>(__u))...,
- __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)...
- {}
-
- template <class _Tuple,
- class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value>
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
- : __tuple_leaf<_Indx, _Tp>(std::forward<typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>(std::get<_Indx>(__t)))...
- {}
-
- template <class _Alloc, class _Tuple,
- class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value>
- >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
- : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>(), __a,
- std::forward<typename tuple_element<_Indx,
- typename __make_tuple_types<_Tuple>::type>::type>(std::get<_Indx>(__t)))...
- {}
-
- __tuple_impl(const __tuple_impl&) = default;
- __tuple_impl(__tuple_impl&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- void swap(__tuple_impl& __t)
- _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
- {
- std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- void swap(const __tuple_impl& __t) const
- _NOEXCEPT_(__all<__is_nothrow_swappable<const _Tp>::value...>::value)
- {
- std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t))...);
- }
+ : public __tuple_leaf<_Indx, _Tp>... {
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl()
+ _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
+ template <size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
+ __tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u)
+ _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
+ __all<is_nothrow_default_constructible<_Tl>::value...>::value))
+ : __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {}
+
+ template <class _Alloc, size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
+ allocator_arg_t,
+ const _Alloc& __a,
+ __tuple_indices<_Uf...>,
+ __tuple_types<_Tf...>,
+ __tuple_indices<_Ul...>,
+ __tuple_types<_Tl...>,
+ _Up&&... __u)
+ : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::forward<_Up>(__u))...,
+ __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {}
+
+ template <class _Tuple, class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(_Tuple&& __t) _NOEXCEPT_(
+ (__all<is_nothrow_constructible<
+ _Tp,
+ typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
+ : __tuple_leaf<_Indx, _Tp>(
+ std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
+ std::get<_Indx>(__t)))... {}
+
+ template <class _Alloc, class _Tuple, class = __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value> >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
+ : __tuple_leaf<_Indx, _Tp>(
+ __uses_alloc_ctor<_Tp,
+ _Alloc,
+ typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(),
+ __a,
+ std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
+ std::get<_Indx>(__t)))... {}
+
+ __tuple_impl(const __tuple_impl&) = default;
+ __tuple_impl(__tuple_impl&&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(__tuple_impl& __t)
+ _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(const __tuple_impl& __t) const
+ _NOEXCEPT_(__all<__is_nothrow_swappable<const _Tp>::value...>::value) {
+ std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t))...);
+ }
};
-template<class _Dest, class _Source, size_t ..._Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) {
- std::__swallow(((std::get<_Np>(__dest) = std::get<_Np>(__source)), void(), 0)...);
+template <class _Dest, class _Source, size_t... _Np>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) {
+ std::__swallow(((std::get<_Np>(__dest) = std::get<_Np>(__source)), void(), 0)...);
}
-template<class _Dest, class _Source, class ..._Up, size_t ..._Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-void __memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) {
- std::__swallow(((
- std::get<_Np>(__dest) = std::forward<_Up>(std::get<_Np>(__source))
- ), void(), 0)...);
+template <class _Dest, class _Source, class... _Up, size_t... _Np>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+__memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) {
+ std::__swallow(((std::get<_Np>(__dest) = std::forward<_Up>(std::get<_Np>(__source))), void(), 0)...);
}
-template <class ..._Tp>
-class _LIBCPP_TEMPLATE_VIS tuple
-{
- typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
-
- _BaseT __base_;
-
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
- template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_SINCE_CXX14
- const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
+template <class... _Tp>
+class _LIBCPP_TEMPLATE_VIS tuple {
+ typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
+
+ _BaseT __base_;
+
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type&
+ get(const tuple<_Up...>&) _NOEXCEPT;
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type&&
+ get(tuple<_Up...>&&) _NOEXCEPT;
+ template <size_t _Jp, class... _Up>
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type&&
+ get(const tuple<_Up...>&&) _NOEXCEPT;
+
public:
- // [tuple.cnstr]
-
-_LIBCPP_DIAGNOSTIC_PUSH
-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
-_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
-
- // tuple() constructors (including allocator_arg_t variants)
- template <template<class...> class _IsImpDefault = __is_implicitly_default_constructible,
- template<class...> class _IsDefault = is_default_constructible, __enable_if_t<
- _And<
- _IsDefault<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) tuple()
- _NOEXCEPT_(_And<is_nothrow_default_constructible<_Tp>...>::value)
- { }
-
- template <class _Alloc,
- template<class...> class _IsImpDefault = __is_implicitly_default_constructible,
- template<class...> class _IsDefault = is_default_constructible, __enable_if_t<
- _And<
- _IsDefault<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) tuple(allocator_arg_t, _Alloc const& __a)
- : __base_(allocator_arg_t(), __a,
- __tuple_indices<>(), __tuple_types<>(),
- typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
- __tuple_types<_Tp...>()) {}
-
- // tuple(const T&...) constructors (including allocator_arg_t variants)
- template <template<class...> class _And = _And, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) >= 1>,
- is_copy_constructible<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) tuple(const _Tp& ... __t)
- _NOEXCEPT_(_And<is_nothrow_copy_constructible<_Tp>...>::value)
- : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+ // [tuple.cnstr]
+
+ _LIBCPP_DIAGNOSTIC_PUSH
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions")
+
+ // tuple() constructors (including allocator_arg_t variants)
+ template <template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
+ template <class...> class _IsDefault = is_default_constructible,
+ __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) tuple()
+ _NOEXCEPT_(_And<is_nothrow_default_constructible<_Tp>...>::value) {}
+
+ template <class _Alloc,
+ template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
+ template <class...> class _IsDefault = is_default_constructible,
+ __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
+ tuple(allocator_arg_t, _Alloc const& __a)
+ : __base_(allocator_arg_t(),
+ __a,
+ __tuple_indices<>(),
+ __tuple_types<>(),
+ typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
+ __tuple_types<_Tp...>()) {}
+
+ // tuple(const T&...) constructors (including allocator_arg_t variants)
+ template <template <class...> class _And = _And,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) tuple(const _Tp&... __t)
+ _NOEXCEPT_(_And<is_nothrow_copy_constructible<_Tp>...>::value)
+ : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
typename __make_tuple_types<tuple, 0>::type(),
- __t...
- ) {}
-
- template <class _Alloc, template<class...> class _And = _And, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) >= 1>,
- is_copy_constructible<_Tp>...
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
- : __base_(allocator_arg_t(), __a,
+ __t...) {}
+
+ template <class _Alloc,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t)
+ : __base_(allocator_arg_t(),
+ __a,
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
typename __make_tuple_types<tuple, 0>::type(),
- __t...
- ) {}
-
- // tuple(U&& ...) constructors (including allocator_arg_t variants)
- template <class ..._Up> struct _IsThisTuple : false_type { };
- template <class _Up> struct _IsThisTuple<_Up> : is_same<__remove_cvref_t<_Up>, tuple> { };
-
- template <class ..._Up>
- struct _EnableUTypesCtor : _And<
- _BoolConstant<sizeof...(_Tp) >= 1>,
- _Not<_IsThisTuple<_Up...> >, // extension to allow mis-behaved user constructors
- is_constructible<_Tp, _Up>...
- > { };
-
- template <class ..._Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>,
- _EnableUTypesCtor<_Up...>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(_Up&&... __u)
- _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
- : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
- std::forward<_Up>(__u)...) {}
-
- template <class _Alloc, class ..._Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>,
- _EnableUTypesCtor<_Up...>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
- : __base_(allocator_arg_t(), __a,
- typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
- std::forward<_Up>(__u)...) {}
-
- // Copy and move constructors (including the allocator_arg_t variants)
- tuple(const tuple&) = default;
- tuple(tuple&&) = default;
-
- template <class _Alloc, template<class...> class _And = _And, __enable_if_t<
- _And<is_copy_constructible<_Tp>...>::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t)
- : __base_(allocator_arg_t(), __alloc, __t)
- { }
-
- template <class _Alloc, template<class...> class _And = _And, __enable_if_t<
- _And<is_move_constructible<_Tp>...>::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t)
- : __base_(allocator_arg_t(), __alloc, std::move(__t))
- { }
-
- // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants)
-
- template <class _OtherTuple, class _DecayedOtherTuple = __remove_cvref_t<_OtherTuple>, class = void>
- struct _EnableCtorFromUTypesTuple : false_type {};
-
- template <class _OtherTuple, class... _Up>
- struct _EnableCtorFromUTypesTuple<_OtherTuple, tuple<_Up...>,
- // the length of the packs needs to checked first otherwise the 2 packs cannot be expanded simultaneously below
- __enable_if_t<sizeof...(_Up) == sizeof...(_Tp)>> : _And<
- // the two conditions below are not in spec. The purpose is to disable the UTypes Ctor when copy/move Ctor can work.
- // Otherwise, is_constructible can trigger hard error in those cases https://godbolt.org/z/M94cGdKcE
- _Not<is_same<_OtherTuple, const tuple&> >,
- _Not<is_same<_OtherTuple, tuple&&> >,
- is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >...,
- _Lazy<_Or, _BoolConstant<sizeof...(_Tp) != 1>,
- // _Tp and _Up are 1-element packs - the pack expansions look
- // weird to avoid tripping up the type traits in degenerate cases
- _Lazy<_And,
- _Not<is_same<_Tp, _Up> >...,
- _Not<is_convertible<_OtherTuple, _Tp> >...,
- _Not<is_constructible<_Tp, _OtherTuple> >...
- >
- >
- > {};
-
- template <class ..._Up, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(const tuple<_Up...>& __t)
- _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, const _Up&>...>::value))
- : __base_(__t)
- { }
-
- template <class ..._Up, class _Alloc, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
- : __base_(allocator_arg_t(), __a, __t)
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(tuple<U...>&) constructors (including allocator_arg_t variants)
-
- template <class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
- tuple(tuple<_Up...>& __t) : __base_(__t) {}
-
- template <class _Alloc, class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t) : __base_(allocator_arg_t(), __alloc, __t) {}
-#endif // _LIBCPP_STD_VER >= 23
-
- // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
- template <class ..._Up, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(tuple<_Up...>&& __t)
- _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
- : __base_(std::move(__t))
- { }
-
- template <class _Alloc, class ..._Up, __enable_if_t<
- _And<
- _EnableCtorFromUTypesTuple<tuple<_Up...>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value) tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t)
- : __base_(allocator_arg_t(), __a, std::move(__t))
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants)
-
- template <class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
- tuple(const tuple<_Up...>&& __t) : __base_(std::move(__t)) {}
-
- template <class _Alloc, class... _Up, enable_if_t<
- _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t)
- : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
-#endif // _LIBCPP_STD_VER >= 23
-
- // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants)
-
- template <template <class...> class _Pred, class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
- struct _CtorPredicateFromPair : false_type{};
-
- template <template <class...> class _Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _CtorPredicateFromPair<_Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And<
- _Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >,
- _Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> >
- > {};
-
- template <class _Pair>
- struct _EnableCtorFromPair : _CtorPredicateFromPair<is_constructible, _Pair>{};
-
- template <class _Pair>
- struct _NothrowConstructibleFromPair : _CtorPredicateFromPair<is_nothrow_constructible, _Pair>{};
-
- template <class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
- struct _BothImplicitlyConvertible : false_type{};
-
- template <class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _BothImplicitlyConvertible<_Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And<
- is_convertible<__copy_cvref_t<_Pair, _Up1>, _Tp1>,
- is_convertible<__copy_cvref_t<_Pair, _Up2>, _Tp2>
- > {};
-
- template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<const pair<_Up1, _Up2>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(const pair<_Up1, _Up2>& __p)
- _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value))
- : __base_(__p)
- { }
-
- template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<const pair<_Up1, _Up2>&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p)
- : __base_(allocator_arg_t(), __a, __p)
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants)
-
- template <class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
- tuple(pair<_U1, _U2>& __p) : __base_(__p) {}
-
- template <class _Alloc, class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<std::pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, pair<_U1, _U2>& __p) : __base_(allocator_arg_t(), __alloc, __p) {}
-#endif
+ __t...) {}
+
+ // tuple(U&& ...) constructors (including allocator_arg_t variants)
+ template <class... _Up>
+ struct _IsThisTuple : false_type {};
+ template <class _Up>
+ struct _IsThisTuple<_Up> : is_same<__remove_cvref_t<_Up>, tuple> {};
+
+ template <class... _Up>
+ struct _EnableUTypesCtor
+ : _And< _BoolConstant<sizeof...(_Tp) >= 1>,
+ _Not<_IsThisTuple<_Up...> >, // extension to allow mis-behaved user constructors
+ is_constructible<_Tp, _Up>... > {};
+
+ template <class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(_Up&&... __u) _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
+ : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+ std::forward<_Up>(__u)...) {}
+
+ template <class _Alloc,
+ class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
+ : __base_(allocator_arg_t(),
+ __a,
+ typename __make_tuple_indices<sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+ std::forward<_Up>(__u)...) {}
+
+ // Copy and move constructors (including the allocator_arg_t variants)
+ tuple(const tuple&) = default;
+ tuple(tuple&&) = default;
+
+ template <class _Alloc,
+ template <class...> class _And = _And,
+ __enable_if_t< _And<is_copy_constructible<_Tp>...>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t)
+ : __base_(allocator_arg_t(), __alloc, __t) {}
+
+ template <class _Alloc,
+ template <class...> class _And = _And,
+ __enable_if_t< _And<is_move_constructible<_Tp>...>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t)
+ : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
+
+ // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants)
+
+ template <class _OtherTuple, class _DecayedOtherTuple = __remove_cvref_t<_OtherTuple>, class = void>
+ struct _EnableCtorFromUTypesTuple : false_type {};
+
+ template <class _OtherTuple, class... _Up>
+ struct _EnableCtorFromUTypesTuple<
+ _OtherTuple,
+ tuple<_Up...>,
+ // the length of the packs needs to checked first otherwise the 2 packs cannot be expanded simultaneously below
+ __enable_if_t<sizeof...(_Up) == sizeof...(_Tp)>>
+ : _And<
+ // the two conditions below are not in spec. The purpose is to disable the UTypes Ctor when copy/move Ctor
+ // can work. Otherwise, is_constructible can trigger hard error in those cases
+ // https://godbolt.org/z/M94cGdKcE
+ _Not<is_same<_OtherTuple, const tuple&> >,
+ _Not<is_same<_OtherTuple, tuple&&> >,
+ is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >...,
+ _Lazy<_Or,
+ _BoolConstant<sizeof...(_Tp) != 1>,
+ // _Tp and _Up are 1-element packs - the pack expansions look
+ // weird to avoid tripping up the type traits in degenerate cases
+ _Lazy<_And,
+ _Not<is_same<_Tp, _Up> >...,
+ _Not<is_convertible<_OtherTuple, _Tp> >...,
+ _Not<is_constructible<_Tp, _OtherTuple> >... > > > {};
+
+ template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(const tuple<_Up...>& __t)
+ _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, const _Up&>...>::value))
+ : __base_(__t) {}
+
+ template <class... _Up,
+ class _Alloc,
+ __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
+ : __base_(allocator_arg_t(), __a, __t) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(tuple<U...>&) constructors (including allocator_arg_t variants)
+
+ template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t)
+ : __base_(__t) {}
+
+ template <class _Alloc, class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t)
+ : __base_(allocator_arg_t(), __alloc, __t) {}
+# endif // _LIBCPP_STD_VER >= 23
+
+ // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
+ template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(tuple<_Up...>&& __t) _NOEXCEPT_((_And<is_nothrow_constructible<_Tp, _Up>...>::value))
+ : __base_(std::move(__t)) {}
+
+ template <class _Alloc,
+ class... _Up,
+ __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t)
+ : __base_(allocator_arg_t(), __a, std::move(__t)) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants)
+
+ template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
+ tuple(const tuple<_Up...>&& __t)
+ : __base_(std::move(__t)) {}
+
+ template <class _Alloc,
+ class... _Up,
+ enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t)
+ : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
+# endif // _LIBCPP_STD_VER >= 23
+
+ // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants)
+
+ template <template <class...> class _Pred,
+ class _Pair,
+ class _DecayedPair = __remove_cvref_t<_Pair>,
+ class _Tuple = tuple>
+ struct _CtorPredicateFromPair : false_type {};
+
+ template <template <class...> class _Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
+ struct _CtorPredicateFromPair<_Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
+ : _And< _Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >, _Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> > > {};
+
+ template <class _Pair>
+ struct _EnableCtorFromPair : _CtorPredicateFromPair<is_constructible, _Pair> {};
+
+ template <class _Pair>
+ struct _NothrowConstructibleFromPair : _CtorPredicateFromPair<is_nothrow_constructible, _Pair> {};
+
+ template <class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
+ struct _BothImplicitlyConvertible : false_type {};
+
+ template <class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
+ struct _BothImplicitlyConvertible<_Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
+ : _And< is_convertible<__copy_cvref_t<_Pair, _Up1>, _Tp1>, is_convertible<__copy_cvref_t<_Pair, _Up2>, _Tp2> > {};
+
+ template <class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(const pair<_Up1, _Up2>& __p)
+ _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value))
+ : __base_(__p) {}
+
+ template <class _Alloc,
+ class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p)
+ : __base_(allocator_arg_t(), __a, __p) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants)
+
+ template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<pair<_U1, _U2>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
+ tuple(pair<_U1, _U2>& __p)
+ : __base_(__p) {}
+
+ template <class _Alloc,
+ class _U1,
+ class _U2,
+ enable_if_t< _EnableCtorFromPair<std::pair<_U1, _U2>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, pair<_U1, _U2>& __p)
+ : __base_(allocator_arg_t(), __alloc, __p) {}
+# endif
- // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants)
-
- template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<pair<_Up1, _Up2>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(pair<_Up1, _Up2>&& __p)
- _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value))
- : __base_(std::move(__p))
- { }
-
- template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t<
- _And<
- _EnableCtorFromPair<pair<_Up1, _Up2>&&>
- >::value
- , int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p)
- : __base_(allocator_arg_t(), __a, std::move(__p))
- { }
-
-#if _LIBCPP_STD_VER >= 23
- // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants)
-
- template <class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
- tuple(const pair<_U1, _U2>&& __p) : __base_(std::move(__p)) {}
-
- template <class _Alloc, class _U1, class _U2, enable_if_t<
- _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p)
- : __base_(allocator_arg_t(), __alloc, std::move(__p)) {}
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_DIAGNOSTIC_POP
-
- // [tuple.assign]
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple)
- _NOEXCEPT_((_And<is_nothrow_copy_assignable<_Tp>...>::value))
- {
- std::__memberwise_copy_assign(*this, __tuple,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
-#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(tuple const& __tuple) const
- requires (_And<is_copy_assignable<const _Tp>...>::value) {
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(tuple&& __tuple) const
- requires (_And<is_assignable<const _Tp&, _Tp>...>::value) {
- std::__memberwise_forward_assign(*this,
- std::move(__tuple),
- __tuple_types<_Tp...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-#endif // _LIBCPP_STD_VER >= 23
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple)
- _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value))
- {
- std::__memberwise_forward_assign(*this, std::move(__tuple),
- __tuple_types<_Tp...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template<class... _Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>,
- is_assignable<_Tp&, _Up const&>...
- >::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(tuple<_Up...> const& __tuple)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value))
- {
- std::__memberwise_copy_assign(*this, __tuple,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template<class... _Up, __enable_if_t<
- _And<
- _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>,
- is_assignable<_Tp&, _Up>...
- >::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(tuple<_Up...>&& __tuple)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value))
- {
- std::__memberwise_forward_assign(*this, std::move(__tuple),
- __tuple_types<_Up...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
-
-#if _LIBCPP_STD_VER >= 23
- template <class... _UTypes, enable_if_t<
- _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
- is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(const tuple<_UTypes...>& __u) const {
- std::__memberwise_copy_assign(*this,
- __u,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template <class... _UTypes, enable_if_t<
- _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
- is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(tuple<_UTypes...>&& __u) const {
- std::__memberwise_forward_assign(*this,
- __u,
- __tuple_types<_UTypes...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-#endif // _LIBCPP_STD_VER >= 23
-
- template <template<class...> class _Pred, bool _Const,
- class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
- struct _AssignPredicateFromPair : false_type {};
-
- template <template<class...> class _Pred, bool _Const,
- class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _AssignPredicateFromPair<_Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > :
- _And<_Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >,
- _Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> >
- > {};
-
- template <bool _Const, class _Pair>
- struct _EnableAssignFromPair : _AssignPredicateFromPair<is_assignable, _Const, _Pair> {};
-
- template <bool _Const, class _Pair>
- struct _NothrowAssignFromPair : _AssignPredicateFromPair<is_nothrow_assignable, _Const, _Pair> {};
-
-#if _LIBCPP_STD_VER >= 23
- template <class _U1, class _U2, enable_if_t<
- _EnableAssignFromPair<true, const pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(const pair<_U1, _U2>& __pair) const
+ // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants)
+
+ template <class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
+ _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(pair<_Up1, _Up2>&& __p)
+ _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value))
+ : __base_(std::move(__p)) {}
+
+ template <class _Alloc,
+ class _Up1,
+ class _Up2,
+ template <class...> class _And = _And,
+ __enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
+ _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
+ tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p)
+ : __base_(allocator_arg_t(), __a, std::move(__p)) {}
+
+# if _LIBCPP_STD_VER >= 23
+ // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants)
+
+ template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
+ tuple(const pair<_U1, _U2>&& __p)
+ : __base_(std::move(__p)) {}
+
+ template <class _Alloc,
+ class _U1,
+ class _U2,
+ enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
+ tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p)
+ : __base_(allocator_arg_t(), __alloc, std::move(__p)) {}
+# endif // _LIBCPP_STD_VER >= 23
+
+ _LIBCPP_DIAGNOSTIC_POP
+
+ // [tuple.assign]
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
+ operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_copy_assignable<_Tp>...>::value)) {
+ std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+# if _LIBCPP_STD_VER >= 23
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple const& __tuple) const
+ requires(_And<is_copy_assignable<const _Tp>...>::value)
+ {
+ std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple&& __tuple) const
+ requires(_And<is_assignable<const _Tp&, _Tp>...>::value)
+ {
+ std::__memberwise_forward_assign(
+ *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER >= 23
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
+ operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value)) {
+ std::__memberwise_forward_assign(
+ *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ template <
+ class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up const&>... >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...> const& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) {
+ std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ template <class... _Up,
+ __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up>... >::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...>&& __tuple)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) {
+ std::__memberwise_forward_assign(
+ *this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+# if _LIBCPP_STD_VER >= 23
+ template <class... _UTypes,
+ enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
+ is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const tuple<_UTypes...>& __u) const {
+ std::__memberwise_copy_assign(*this, __u, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ template <class... _UTypes,
+ enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
+ is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple<_UTypes...>&& __u) const {
+ std::__memberwise_forward_assign(
+ *this, __u, __tuple_types<_UTypes...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER >= 23
+
+ template <template <class...> class _Pred,
+ bool _Const,
+ class _Pair,
+ class _DecayedPair = __remove_cvref_t<_Pair>,
+ class _Tuple = tuple>
+ struct _AssignPredicateFromPair : false_type {};
+
+ template <template <class...> class _Pred, bool _Const, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
+ struct _AssignPredicateFromPair<_Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
+ : _And<_Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >,
+ _Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> > > {};
+
+ template <bool _Const, class _Pair>
+ struct _EnableAssignFromPair : _AssignPredicateFromPair<is_assignable, _Const, _Pair> {};
+
+ template <bool _Const, class _Pair>
+ struct _NothrowAssignFromPair : _AssignPredicateFromPair<is_nothrow_assignable, _Const, _Pair> {};
+
+# if _LIBCPP_STD_VER >= 23
+ template <class _U1, class _U2, enable_if_t< _EnableAssignFromPair<true, const pair<_U1, _U2>&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const pair<_U1, _U2>& __pair) const
noexcept(_NothrowAssignFromPair<true, const pair<_U1, _U2>&>::value) {
- std::get<0>(*this) = __pair.first;
- std::get<1>(*this) = __pair.second;
- return *this;
- }
-
- template <class _U1, class _U2, enable_if_t<
- _EnableAssignFromPair<true, pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr
- const tuple& operator=(pair<_U1, _U2>&& __pair) const
+ std::get<0>(*this) = __pair.first;
+ std::get<1>(*this) = __pair.second;
+ return *this;
+ }
+
+ template <class _U1, class _U2, enable_if_t< _EnableAssignFromPair<true, pair<_U1, _U2>&&>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(pair<_U1, _U2>&& __pair) const
noexcept(_NothrowAssignFromPair<true, pair<_U1, _U2>&&>::value) {
- std::get<0>(*this) = std::move(__pair.first);
- std::get<1>(*this) = std::move(__pair.second);
- return *this;
- }
-#endif // _LIBCPP_STD_VER >= 23
-
- template<class _Up1, class _Up2, __enable_if_t<
- _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(pair<_Up1, _Up2> const& __pair)
- _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value))
- {
- std::get<0>(*this) = __pair.first;
- std::get<1>(*this) = __pair.second;
- return *this;
- }
-
- template<class _Up1, class _Up2, __enable_if_t<
- _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value
- ,int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(pair<_Up1, _Up2>&& __pair)
- _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value))
- {
- std::get<0>(*this) = std::forward<_Up1>(__pair.first);
- std::get<1>(*this) = std::forward<_Up2>(__pair.second);
- return *this;
- }
-
- // EXTENSION
- template<class _Up, size_t _Np, class = __enable_if_t<
- _And<
- _BoolConstant<_Np == sizeof...(_Tp)>,
- is_assignable<_Tp&, _Up const&>...
- >::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(array<_Up, _Np> const& __array)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value))
- {
- std::__memberwise_copy_assign(*this, __array,
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- // EXTENSION
- template<class _Up, size_t _Np, class = void, class = __enable_if_t<
- _And<
- _BoolConstant<_Np == sizeof...(_Tp)>,
- is_assignable<_Tp&, _Up>...
- >::value
- > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple& operator=(array<_Up, _Np>&& __array)
- _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value))
- {
- std::__memberwise_forward_assign(*this, std::move(__array),
- __tuple_types<_If<true, _Up, _Tp>...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- // [tuple.swap]
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
- {__base_.swap(__t.__base_);}
-
-#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr
- void swap(const tuple& __t) const noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) {
- __base_.swap(__t.__base_);
- }
-#endif // _LIBCPP_STD_VER >= 23
+ std::get<0>(*this) = std::move(__pair.first);
+ std::get<1>(*this) = std::move(__pair.second);
+ return *this;
+ }
+# endif // _LIBCPP_STD_VER >= 23
+
+ template <class _Up1,
+ class _Up2,
+ __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2> const& __pair)
+ _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value)) {
+ std::get<0>(*this) = __pair.first;
+ std::get<1>(*this) = __pair.second;
+ return *this;
+ }
+
+ template <class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2>&& __pair)
+ _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value)) {
+ std::get<0>(*this) = std::forward<_Up1>(__pair.first);
+ std::get<1>(*this) = std::forward<_Up2>(__pair.second);
+ return *this;
+ }
+
+ // EXTENSION
+ template <
+ class _Up,
+ size_t _Np,
+ class = __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np> const& __array)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value)) {
+ std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ // EXTENSION
+ template <class _Up,
+ size_t _Np,
+ class = void,
+ class = __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up>... >::value > >
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np>&& __array)
+ _NOEXCEPT_((_And<is_nothrow_assignable<_Tp&, _Up>...>::value)) {
+ std::__memberwise_forward_assign(
+ *this,
+ std::move(__array),
+ __tuple_types<_If<true, _Up, _Tp>...>(),
+ typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ return *this;
+ }
+
+ // [tuple.swap]
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple& __t)
+ _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ __base_.swap(__t.__base_);
+ }
+
+# if _LIBCPP_STD_VER >= 23
+ _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple& __t) const
+ noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) {
+ __base_.swap(__t.__base_);
+ }
+# endif // _LIBCPP_STD_VER >= 23
};
template <>
-class _LIBCPP_TEMPLATE_VIS tuple<>
-{
+class _LIBCPP_TEMPLATE_VIS tuple<> {
public:
- constexpr tuple() _NOEXCEPT = default;
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(array<_Up, 0>) _NOEXCEPT {}
- template <class _Alloc, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void swap(tuple&) _NOEXCEPT {}
-#if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {}
-#endif
+ constexpr tuple() _NOEXCEPT = default;
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
+ template <class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(array<_Up, 0>) _NOEXCEPT {}
+ template <class _Alloc, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple&) _NOEXCEPT {}
+# if _LIBCPP_STD_VER >= 23
+ _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {}
+# endif
};
-#if _LIBCPP_STD_VER >= 23
-template <class... _TTypes, class... _UTypes, template<class> class _TQual, template<class> class _UQual>
- requires requires { typename tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>; }
+# if _LIBCPP_STD_VER >= 23
+template <class... _TTypes, class... _UTypes, template <class> class _TQual, template <class> class _UQual>
+ requires requires { typename tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>; }
struct basic_common_reference<tuple<_TTypes...>, tuple<_UTypes...>, _TQual, _UQual> {
- using type = tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>;
+ using type = tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>;
};
template <class... _TTypes, class... _UTypes>
- requires requires { typename tuple<common_type_t<_TTypes, _UTypes>...>; }
+ requires requires { typename tuple<common_type_t<_TTypes, _UTypes>...>; }
struct common_type<tuple<_TTypes...>, tuple<_UTypes...>> {
- using type = tuple<common_type_t<_TTypes, _UTypes>...>;
+ using type = tuple<common_type_t<_TTypes, _UTypes>...>;
};
-#endif // _LIBCPP_STD_VER >= 23
+# endif // _LIBCPP_STD_VER >= 23
-#if _LIBCPP_STD_VER >= 17
-template <class ..._Tp>
+# if _LIBCPP_STD_VER >= 17
+template <class... _Tp>
tuple(_Tp...) -> tuple<_Tp...>;
template <class _Tp1, class _Tp2>
tuple(pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
-template <class _Alloc, class ..._Tp>
+template <class _Alloc, class... _Tp>
tuple(allocator_arg_t, _Alloc, _Tp...) -> tuple<_Tp...>;
template <class _Alloc, class _Tp1, class _Tp2>
tuple(allocator_arg_t, _Alloc, pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
-template <class _Alloc, class ..._Tp>
+template <class _Alloc, class... _Tp>
tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>;
-#endif
+# endif
-template <class ..._Tp, __enable_if_t<__all<__is_swappable<_Tp>::value...>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
- _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
- {__t.swap(__u);}
+template <class... _Tp, __enable_if_t<__all<__is_swappable<_Tp>::value...>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
+ _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ __t.swap(__u);
+}
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
template <class... _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-enable_if_t<__all<is_swappable_v<const _Tp>...>::value, void>
-swap(const tuple<_Tp...>& __lhs, const tuple<_Tp...>& __rhs)
- noexcept(__all<is_nothrow_swappable_v<const _Tp>...>::value) {
- __lhs.swap(__rhs);
+_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<__all<is_swappable_v<const _Tp>...>::value, void>
+swap(const tuple<_Tp...>& __lhs,
+ const tuple<_Tp...>& __rhs) noexcept(__all<is_nothrow_swappable_v<const _Tp>...>::value) {
+ __lhs.swap(__rhs);
}
-#endif
+# endif
// get
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(tuple<_Tp...>& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(tuple<_Tp...>& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
}
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(const tuple<_Tp...>& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
+get(const tuple<_Tp...>& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
}
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(tuple<_Tp...>&& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<type&&>(
- static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(tuple<_Tp...>&& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<type&&>(static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
}
-template <size_t _Ip, class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(const tuple<_Tp...>&& __t) _NOEXCEPT
-{
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<const type&&>(
- static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
+template <size_t _Ip, class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(const tuple<_Tp...>&& __t) _NOEXCEPT {
+ typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<const type&&>(static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
}
-#if _LIBCPP_STD_VER >= 14
+# if _LIBCPP_STD_VER >= 14
namespace __find_detail {
static constexpr size_t __not_found = static_cast<size_t>(-1);
static constexpr size_t __ambiguous = __not_found - 1;
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr size_t __find_idx_return(size_t __curr_i, size_t __res, bool __matches) {
- return !__matches ? __res :
- (__res == __not_found ? __curr_i : __ambiguous);
+inline _LIBCPP_HIDE_FROM_ABI constexpr size_t __find_idx_return(size_t __curr_i, size_t __res, bool __matches) {
+ return !__matches ? __res : (__res == __not_found ? __curr_i : __ambiguous);
}
template <size_t _Nx>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) {
- return __i == _Nx ? __not_found :
- __find_detail::__find_idx_return(__i, __find_detail::__find_idx(__i + 1, __matches), __matches[__i]);
+inline _LIBCPP_HIDE_FROM_ABI constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) {
+ return __i == _Nx
+ ? __not_found
+ : __find_detail::__find_idx_return(__i, __find_detail::__find_idx(__i + 1, __matches), __matches[__i]);
}
-template <class _T1, class ..._Args>
+template <class _T1, class... _Args>
struct __find_exactly_one_checked {
- static constexpr bool __matches[sizeof...(_Args)] = {is_same<_T1, _Args>::value...};
- static constexpr size_t value = __find_detail::__find_idx(0, __matches);
- static_assert(value != __not_found, "type not found in type list" );
- static_assert(value != __ambiguous, "type occurs more than once in type list");
+ static constexpr bool __matches[sizeof...(_Args)] = {is_same<_T1, _Args>::value...};
+ static constexpr size_t value = __find_detail::__find_idx(0, __matches);
+ static_assert(value != __not_found, "type not found in type list");
+ static_assert(value != __ambiguous, "type occurs more than once in type list");
};
template <class _T1>
struct __find_exactly_one_checked<_T1> {
- static_assert(!is_same<_T1, _T1>::value, "type not in empty type list");
+ static_assert(!is_same<_T1, _T1>::value, "type not in empty type list");
};
} // namespace __find_detail
template <typename _T1, typename... _Args>
-struct __find_exactly_one_t
- : public __find_detail::__find_exactly_one_checked<_T1, _Args...> {
-};
+struct __find_exactly_one_t : public __find_detail::__find_exactly_one_checked<_T1, _Args...> {};
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1& get(tuple<_Args...>& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(tuple<_Args...>& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
}
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
}
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
}
template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept
-{
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
+inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept {
+ return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
}
-#endif
+# endif
// tie
-template <class ..._Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<_Tp&...>
-tie(_Tp&... __t) _NOEXCEPT
-{
- return tuple<_Tp&...>(__t...);
+template <class... _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&...> tie(_Tp&... __t) _NOEXCEPT {
+ return tuple<_Tp&...>(__t...);
}
template <class _Up>
-struct __ignore_t
-{
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- const __ignore_t& operator=(_Tp&&) const {return *this;}
+struct __ignore_t {
+ template <class _Tp>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const __ignore_t& operator=(_Tp&&) const {
+ return *this;
+ }
};
# if _LIBCPP_STD_VER >= 17
inline constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
# else
namespace {
- constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
+constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
} // namespace
# endif
template <class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<typename __unwrap_ref_decay<_Tp>::type...>
-make_tuple(_Tp&&... __t)
-{
- return tuple<typename __unwrap_ref_decay<_Tp>::type...>(std::forward<_Tp>(__t)...);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<typename __unwrap_ref_decay<_Tp>::type...>
+make_tuple(_Tp&&... __t) {
+ return tuple<typename __unwrap_ref_decay<_Tp>::type...>(std::forward<_Tp>(__t)...);
}
template <class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<_Tp&&...>
-forward_as_tuple(_Tp&&... __t) _NOEXCEPT
-{
- return tuple<_Tp&&...>(std::forward<_Tp>(__t)...);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) _NOEXCEPT {
+ return tuple<_Tp&&...>(std::forward<_Tp>(__t)...);
}
template <size_t _Ip>
-struct __tuple_equal
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp& __x, const _Up& __y)
- {
- return __tuple_equal<_Ip - 1>()(__x, __y) && std::get<_Ip-1>(__x) == std::get<_Ip-1>(__y);
- }
+struct __tuple_equal {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __x, const _Up& __y) {
+ return __tuple_equal<_Ip - 1>()(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y);
+ }
};
template <>
-struct __tuple_equal<0>
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp&, const _Up&)
- {
- return true;
- }
+struct __tuple_equal<0> {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp&, const _Up&) {
+ return true;
+ }
};
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
- return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
+ return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
// operator<=>
-template <class ..._Tp, class ..._Up, size_t ..._Is>
-_LIBCPP_HIDE_FROM_ABI constexpr
-auto
+template <class... _Tp, class... _Up, size_t... _Is>
+_LIBCPP_HIDE_FROM_ABI constexpr auto
__tuple_compare_three_way(const tuple<_Tp...>& __x, const tuple<_Up...>& __y, index_sequence<_Is...>) {
- common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> __result = strong_ordering::equal;
- static_cast<void>(((__result = std::__synth_three_way(std::get<_Is>(__x), std::get<_Is>(__y)), __result != 0) || ...));
- return __result;
+ common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> __result = strong_ordering::equal;
+ static_cast<void>(
+ ((__result = std::__synth_three_way(std::get<_Is>(__x), std::get<_Is>(__y)), __result != 0) || ...));
+ return __result;
}
-template <class ..._Tp, class ..._Up>
-requires (sizeof...(_Tp) == sizeof...(_Up))
-_LIBCPP_HIDE_FROM_ABI constexpr
-common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>
-operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return std::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{});
+template <class... _Tp, class... _Up>
+ requires(sizeof...(_Tp) == sizeof...(_Up))
+_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>
+operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return std::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{});
}
-#else // _LIBCPP_STD_VER >= 20
+# else // _LIBCPP_STD_VER >= 20
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return !(__x == __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return !(__x == __y);
}
template <size_t _Ip>
-struct __tuple_less
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp& __x, const _Up& __y)
- {
- const size_t __idx = tuple_size<_Tp>::value - _Ip;
- if (std::get<__idx>(__x) < std::get<__idx>(__y))
- return true;
- if (std::get<__idx>(__y) < std::get<__idx>(__x))
- return false;
- return __tuple_less<_Ip-1>()(__x, __y);
- }
+struct __tuple_less {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __x, const _Up& __y) {
+ const size_t __idx = tuple_size<_Tp>::value - _Ip;
+ if (std::get<__idx>(__x) < std::get<__idx>(__y))
+ return true;
+ if (std::get<__idx>(__y) < std::get<__idx>(__x))
+ return false;
+ return __tuple_less<_Ip - 1>()(__x, __y);
+ }
};
template <>
-struct __tuple_less<0>
-{
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- bool operator()(const _Tp&, const _Up&)
- {
- return false;
- }
+struct __tuple_less<0> {
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp&, const _Up&) {
+ return false;
+ }
};
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
- return __tuple_less<sizeof...(_Tp)>()(__x, __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
+ return __tuple_less<sizeof...(_Tp)>()(__x, __y);
}
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return __y < __x;
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return __y < __x;
}
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return !(__x < __y);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return !(__x < __y);
}
-template <class ..._Tp, class ..._Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-bool
-operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
-{
- return !(__y < __x);
+template <class... _Tp, class... _Up>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+ return !(__y < __x);
}
-#endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
// tuple_cat
-template <class _Tp, class _Up> struct __tuple_cat_type;
+template <class _Tp, class _Up>
+struct __tuple_cat_type;
-template <class ..._Ttypes, class ..._Utypes>
-struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
-{
- typedef _LIBCPP_NODEBUG tuple<_Ttypes..., _Utypes...> type;
+template <class... _Ttypes, class... _Utypes>
+struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> > {
+ typedef _LIBCPP_NODEBUG tuple<_Ttypes..., _Utypes...> type;
};
-template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
-struct __tuple_cat_return_1
-{
-};
+template <class _ResultTuple, bool _Is_Tuple0TupleLike, class... _Tuples>
+struct __tuple_cat_return_1 {};
-template <class ..._Types, class _Tuple0>
-struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
-{
- using type _LIBCPP_NODEBUG = typename __tuple_cat_type<
- tuple<_Types...>,
- typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type
- >::type;
+template <class... _Types, class _Tuple0>
+struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0> {
+ using type _LIBCPP_NODEBUG =
+ typename __tuple_cat_type< tuple<_Types...>,
+ typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type;
};
-template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
+template <class... _Types, class _Tuple0, class _Tuple1, class... _Tuples>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_1<
- typename __tuple_cat_type<
- tuple<_Types...>,
- typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type
- >::type,
- __tuple_like_ext<__libcpp_remove_reference_t<_Tuple1> >::value,
- _Tuple1, _Tuples...>
-{
-};
+ typename __tuple_cat_type< tuple<_Types...>,
+ typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type,
+ __tuple_like_ext<__libcpp_remove_reference_t<_Tuple1> >::value,
+ _Tuple1,
+ _Tuples...> {};
-template <class ..._Tuples> struct __tuple_cat_return;
+template <class... _Tuples>
+struct __tuple_cat_return;
-template <class _Tuple0, class ..._Tuples>
+template <class _Tuple0, class... _Tuples>
struct __tuple_cat_return<_Tuple0, _Tuples...>
: public __tuple_cat_return_1<tuple<>,
- __tuple_like_ext<__libcpp_remove_reference_t<_Tuple0> >::value, _Tuple0,
- _Tuples...>
-{
-};
+ __tuple_like_ext<__libcpp_remove_reference_t<_Tuple0> >::value,
+ _Tuple0,
+ _Tuples...> {};
template <>
-struct __tuple_cat_return<>
-{
- typedef _LIBCPP_NODEBUG tuple<> type;
+struct __tuple_cat_return<> {
+ typedef _LIBCPP_NODEBUG tuple<> type;
};
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-tuple<>
-tuple_cat()
-{
- return tuple<>();
-}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<> tuple_cat() { return tuple<>(); }
-template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples>
+template <class _Rp, class _Indices, class _Tuple0, class... _Tuples>
struct __tuple_cat_return_ref_imp;
-template <class ..._Types, size_t ..._I0, class _Tuple0>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
-{
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- typedef tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
+template <class... _Types, size_t... _I0, class _Tuple0>
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> {
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
+ typedef tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
};
-template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
- _Tuple0, _Tuple1, _Tuples...>
+template <class... _Types, size_t... _I0, class _Tuple0, class _Tuple1, class... _Tuples>
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_ref_imp<
- tuple<_Types..., __apply_cv_t<_Tuple0,
- typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
- typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
- _Tuple1, _Tuples...>
-{
-};
+ tuple<_Types...,
+ __apply_cv_t<_Tuple0, typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
+ typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
+ _Tuple1,
+ _Tuples...> {};
-template <class _Tuple0, class ..._Tuples>
+template <class _Tuple0, class... _Tuples>
struct __tuple_cat_return_ref
- : public __tuple_cat_return_ref_imp<tuple<>,
- typename __make_tuple_indices<
- tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value
- >::type, _Tuple0, _Tuples...>
-{
-};
+ : public __tuple_cat_return_ref_imp<
+ tuple<>,
+ typename __make_tuple_indices< tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value >::type,
+ _Tuple0,
+ _Tuples...> {};
template <class _Types, class _I0, class _J0>
struct __tuple_cat;
-template <class ..._Types, size_t ..._I0, size_t ..._J0>
-struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
-{
- template <class _Tuple0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0)
- {
- (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
- return std::forward_as_tuple(
- std::forward<_Types>(std::get<_I0>(__t))...,
- std::get<_J0>(std::forward<_Tuple0>(__t0))...);
- }
-
- template <class _Tuple0, class _Tuple1, class ..._Tuples>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
- {
- (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
- return __tuple_cat<tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
- typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
- typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
- std::forward_as_tuple(
- std::forward<_Types>(std::get<_I0>(__t))...,
- std::get<_J0>(std::forward<_Tuple0>(__t0))...),
- std::forward<_Tuple1>(__t1), std::forward<_Tuples>(__tpls)...);
- }
+template <class... _Types, size_t... _I0, size_t... _J0>
+struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > {
+ template <class _Tuple0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
+ typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
+ operator()(tuple<_Types...> __t, _Tuple0&& __t0) {
+ (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
+ return std::forward_as_tuple(
+ std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...);
+ }
+
+ template <class _Tuple0, class _Tuple1, class... _Tuples>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
+ typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
+ operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&&... __tpls) {
+ (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
+ return __tuple_cat<tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
+ typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
+ typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
+ std::forward_as_tuple(
+ std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...),
+ std::forward<_Tuple1>(__t1),
+ std::forward<_Tuples>(__tpls)...);
+ }
};
template <class _Tuple0, class... _Tuples>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
-typename __tuple_cat_return<_Tuple0, _Tuples...>::type
-tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
-{
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- return __tuple_cat<tuple<>, __tuple_indices<>,
- typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
- (tuple<>(), std::forward<_Tuple0>(__t0),
- std::forward<_Tuples>(__tpls)...);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __tuple_cat_return<_Tuple0, _Tuples...>::type
+tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) {
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
+ return __tuple_cat<tuple<>, __tuple_indices<>, typename __make_tuple_indices<tuple_size<_T0>::value>::type>()(
+ tuple<>(), std::forward<_Tuple0>(__t0), std::forward<_Tuples>(__tpls)...);
}
-template <class ..._Tp, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc>
- : true_type {};
+template <class... _Tp, class _Alloc>
+struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc> : true_type {};
template <class _T1, class _T2>
-template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-pair<_T1, _T2>::pair(piecewise_construct_t,
- tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
- __tuple_indices<_I1...>, __tuple_indices<_I2...>)
- : first(std::forward<_Args1>(std::get<_I1>( __first_args))...),
- second(std::forward<_Args2>(std::get<_I2>(__second_args))...)
-{
-}
+template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_T1, _T2>::pair(
+ piecewise_construct_t,
+ tuple<_Args1...>& __first_args,
+ tuple<_Args2...>& __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>)
+ : first(std::forward<_Args1>(std::get<_I1>(__first_args))...),
+ second(std::forward<_Args2>(std::get<_I2>(__second_args))...) {}
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
-#define _LIBCPP_NOEXCEPT_RETURN(...) noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
-
-template <class _Fn, class _Tuple, size_t ..._Id>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t,
- __tuple_indices<_Id...>)
-_LIBCPP_NOEXCEPT_RETURN(
- std::__invoke(
- std::forward<_Fn>(__f),
- std::get<_Id>(std::forward<_Tuple>(__t))...)
-)
-
-template <class _Fn, class _Tuple>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr decltype(auto) apply(_Fn && __f, _Tuple && __t)
-_LIBCPP_NOEXCEPT_RETURN(
- std::__apply_tuple_impl(
- std::forward<_Fn>(__f), std::forward<_Tuple>(__t),
- typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})
-)
-
-template <class _Tp, class _Tuple, size_t... _Idx>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
-_LIBCPP_NOEXCEPT_RETURN(
- _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...)
-)
-
-template <class _Tp, class _Tuple>
-inline _LIBCPP_HIDE_FROM_ABI
-constexpr _Tp make_from_tuple(_Tuple&& __t)
-_LIBCPP_NOEXCEPT_RETURN(
- std::__make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t),
- typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})
-)
-
-#undef _LIBCPP_NOEXCEPT_RETURN
-
-#endif // _LIBCPP_STD_VER >= 17
+# define _LIBCPP_NOEXCEPT_RETURN(...) \
+ noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
+
+template <class _Fn, class _Tuple, size_t... _Id>
+inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
+__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>)
+ _LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...))
+
+ template <class _Fn, class _Tuple>
+ inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN(
+ std::__apply_tuple_impl(std::forward<_Fn>(__f),
+ std::forward<_Tuple>(__t),
+ typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
+
+ template <class _Tp, class _Tuple, size_t... _Idx>
+ inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp
+ __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
+ _LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
+
+ template <class _Tp, class _Tuple>
+ inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp
+ make_from_tuple(_Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>(
+ std::forward<_Tuple>(__t), typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
+
+# undef _LIBCPP_NOEXCEPT_RETURN
+
+# endif // _LIBCPP_STD_VER >= 17
#endif // !defined(_LIBCPP_CXX03_LANG)
-_LIBCPP_END_NAMESPACE_STD
+ _LIBCPP_END_NAMESPACE_STD
-_LIBCPP_POP_MACROS
+ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <exception>
diff --git a/contrib/llvm-project/libcxx/include/typeindex b/contrib/llvm-project/libcxx/include/typeindex
index 36bf90722c21..e6ea12afd524 100644
--- a/contrib/llvm-project/libcxx/include/typeindex
+++ b/contrib/llvm-project/libcxx/include/typeindex
@@ -60,59 +60,40 @@ struct hash<type_index>
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_TEMPLATE_VIS type_index
-{
- const type_info* __t_;
+class _LIBCPP_TEMPLATE_VIS type_index {
+ const type_info* __t_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
+ _LIBCPP_HIDE_FROM_ABI type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
- _LIBCPP_HIDE_FROM_ABI
- bool operator==(const type_index& __y) const _NOEXCEPT
- {return *__t_ == *__y.__t_;}
+ _LIBCPP_HIDE_FROM_ABI bool operator==(const type_index& __y) const _NOEXCEPT { return *__t_ == *__y.__t_; }
#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const type_index& __y) const _NOEXCEPT
- {return *__t_ != *__y.__t_;}
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_index& __y) const _NOEXCEPT { return *__t_ != *__y.__t_; }
#endif
- _LIBCPP_HIDE_FROM_ABI
- bool operator< (const type_index& __y) const _NOEXCEPT
- {return __t_->before(*__y.__t_);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator<=(const type_index& __y) const _NOEXCEPT
- {return !__y.__t_->before(*__t_);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator> (const type_index& __y) const _NOEXCEPT
- {return __y.__t_->before(*__t_);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator>=(const type_index& __y) const _NOEXCEPT
- {return !__t_->before(*__y.__t_);}
+ _LIBCPP_HIDE_FROM_ABI bool operator<(const type_index& __y) const _NOEXCEPT { return __t_->before(*__y.__t_); }
+ _LIBCPP_HIDE_FROM_ABI bool operator<=(const type_index& __y) const _NOEXCEPT { return !__y.__t_->before(*__t_); }
+ _LIBCPP_HIDE_FROM_ABI bool operator>(const type_index& __y) const _NOEXCEPT { return __y.__t_->before(*__t_); }
+ _LIBCPP_HIDE_FROM_ABI bool operator>=(const type_index& __y) const _NOEXCEPT { return !__t_->before(*__y.__t_); }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- strong_ordering operator<=>(const type_index& __y) const noexcept {
- if (*__t_ == *__y.__t_)
- return strong_ordering::equal;
- if (__t_->before(*__y.__t_))
- return strong_ordering::less;
- return strong_ordering::greater;
- }
+ _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const type_index& __y) const noexcept {
+ if (*__t_ == *__y.__t_)
+ return strong_ordering::equal;
+ if (__t_->before(*__y.__t_))
+ return strong_ordering::less;
+ return strong_ordering::greater;
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- size_t hash_code() const _NOEXCEPT {return __t_->hash_code();}
- _LIBCPP_HIDE_FROM_ABI
- const char* name() const _NOEXCEPT {return __t_->name();}
+ _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __t_->hash_code(); }
+ _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __t_->name(); }
};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash;
template <>
-struct _LIBCPP_TEMPLATE_VIS hash<type_index>
- : public __unary_function<type_index, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(type_index __index) const _NOEXCEPT
- {return __index.hash_code();}
+struct _LIBCPP_TEMPLATE_VIS hash<type_index> : public __unary_function<type_index, size_t> {
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(type_index __index) const _NOEXCEPT { return __index.hash_code(); }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/typeinfo b/contrib/llvm-project/libcxx/include/typeinfo
index e8b75734f2ec..39a90676cc44 100644
--- a/contrib/llvm-project/libcxx/include/typeinfo
+++ b/contrib/llvm-project/libcxx/include/typeinfo
@@ -70,57 +70,49 @@ public:
#endif
#if defined(_LIBCPP_ABI_VCRUNTIME)
-#include <vcruntime_typeinfo.h>
+# include <vcruntime_typeinfo.h>
#else
-namespace std // purposefully not using versioning namespace
+namespace std // purposefully not using versioning namespace
{
+# if defined(_LIBCPP_ABI_MICROSOFT)
-#if defined(_LIBCPP_ABI_MICROSOFT)
-
-class _LIBCPP_EXPORTED_FROM_ABI type_info
-{
- type_info& operator=(const type_info&);
- type_info(const type_info&);
+class _LIBCPP_EXPORTED_FROM_ABI type_info {
+ type_info& operator=(const type_info&);
+ type_info(const type_info&);
- mutable struct {
- const char *__undecorated_name;
- const char __decorated_name[1];
- } __data;
+ mutable struct {
+ const char* __undecorated_name;
+ const char __decorated_name[1];
+ } __data;
- int __compare(const type_info &__rhs) const _NOEXCEPT;
+ int __compare(const type_info& __rhs) const _NOEXCEPT;
public:
- virtual ~type_info();
+ virtual ~type_info();
- const char *name() const _NOEXCEPT;
+ const char* name() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- bool before(const type_info& __arg) const _NOEXCEPT {
- return __compare(__arg) < 0;
- }
+ _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT { return __compare(__arg) < 0; }
- size_t hash_code() const _NOEXCEPT;
+ size_t hash_code() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool operator==(const type_info& __arg) const _NOEXCEPT {
- // When evaluated in a constant expression, both type infos simply can't come
- // from different translation units, so it is sufficient to compare their addresses.
- if (__libcpp_is_constant_evaluated()) {
- return this == &__arg;
- }
- return __compare(__arg) == 0;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT {
+ // When evaluated in a constant expression, both type infos simply can't come
+ // from different translation units, so it is sufficient to compare their addresses.
+ if (__libcpp_is_constant_evaluated()) {
+ return this == &__arg;
}
+ return __compare(__arg) == 0;
+ }
-#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const type_info& __arg) const _NOEXCEPT
- { return !operator==(__arg); }
-#endif
+# if _LIBCPP_STD_VER <= 17
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_info& __arg) const _NOEXCEPT { return !operator==(__arg); }
+# endif
};
-#else // !defined(_LIBCPP_ABI_MICROSOFT)
+# else // !defined(_LIBCPP_ABI_MICROSOFT)
// ========================================================================== //
// Implementations
@@ -175,64 +167,58 @@ public:
// This value can be overriden in the __config_site. When it's not overriden,
// we pick a default implementation based on the platform here.
-#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
+# ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
- // Windows and AIX binaries can't merge typeinfos, so use the NonUnique implementation.
-# if defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)
-# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2
+// Windows and AIX binaries can't merge typeinfos, so use the NonUnique implementation.
+# if defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)
+# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2
- // On arm64 on Apple platforms, use the special NonUniqueARMRTTIBit implementation.
-# elif defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
-# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 3
+// On arm64 on Apple platforms, use the special NonUniqueARMRTTIBit implementation.
+# elif defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
+# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 3
- // On all other platforms, assume the Itanium C++ ABI and use the Unique implementation.
-# else
-# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
-# endif
-#endif
+// On all other platforms, assume the Itanium C++ ABI and use the Unique implementation.
+# else
+# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
+# endif
+# endif
struct __type_info_implementations {
struct __string_impl_base {
typedef const char* __type_name_t;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static const char*
+ __type_name_to_string(__type_name_t __v) _NOEXCEPT {
return __v;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static __type_name_t
+ __string_to_type_name(const char* __v) _NOEXCEPT {
return __v;
}
};
struct __unique_impl : __string_impl_base {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static size_t __hash(__type_name_t __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
return reinterpret_cast<size_t>(__v);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __lhs == __rhs;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __lhs < __rhs;
}
};
struct __non_unique_impl : __string_impl_base {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
size_t __hash = 5381;
while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
__hash = (__hash * 33) ^ __c;
return __hash;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __lhs == __rhs || __builtin_strcmp(__lhs, __rhs) == 0;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
return __builtin_strcmp(__lhs, __rhs) < 0;
}
};
@@ -240,24 +226,19 @@ struct __type_info_implementations {
struct __non_unique_arm_rtti_bit_impl {
typedef uintptr_t __type_name_t;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
- return reinterpret_cast<const char*>(__v &
- ~__non_unique_rtti_bit::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
+ return reinterpret_cast<const char*>(__v & ~__non_unique_rtti_bit::value);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
return reinterpret_cast<__type_name_t>(__v);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static size_t __hash(__type_name_t __v) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
if (__is_type_name_unique(__v))
return __v;
return __non_unique_impl::__hash(__type_name_to_string(__v));
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
if (__lhs == __rhs)
return true;
if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
@@ -266,109 +247,86 @@ struct __type_info_implementations {
return false;
return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE
- static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
if (__is_type_name_unique(__lhs) || __is_type_name_unique(__rhs))
return __lhs < __rhs;
return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0;
}
- private:
+ private:
// The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
// this implementation is actually used.
- typedef integral_constant<__type_name_t,
- (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit;
+ typedef integral_constant<__type_name_t, (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))>
+ __non_unique_rtti_bit;
- _LIBCPP_HIDE_FROM_ABI
- static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
return !(__lhs & __non_unique_rtti_bit::value);
}
};
typedef
-#if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1
- __unique_impl
-#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2
- __non_unique_impl
-#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3
- __non_unique_arm_rtti_bit_impl
-#else
-# error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
-#endif
- __impl;
+# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1
+ __unique_impl
+# elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2
+ __non_unique_impl
+# elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3
+ __non_unique_arm_rtti_bit_impl
+# else
+# error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
+# endif
+ __impl;
};
-class _LIBCPP_EXPORTED_FROM_ABI type_info
-{
+class _LIBCPP_EXPORTED_FROM_ABI type_info {
type_info& operator=(const type_info&);
type_info(const type_info&);
- protected:
- typedef __type_info_implementations::__impl __impl;
+protected:
+ typedef __type_info_implementations::__impl __impl;
- __impl::__type_name_t __type_name;
+ __impl::__type_name_t __type_name;
- _LIBCPP_HIDE_FROM_ABI
- explicit type_info(const char* __n)
- : __type_name(__impl::__string_to_type_name(__n)) {}
+ _LIBCPP_HIDE_FROM_ABI explicit type_info(const char* __n) : __type_name(__impl::__string_to_type_name(__n)) {}
public:
- virtual ~type_info();
+ virtual ~type_info();
- _LIBCPP_HIDE_FROM_ABI
- const char* name() const _NOEXCEPT
- {
- return __impl::__type_name_to_string(__type_name);
- }
+ _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT { return __impl::__type_name_to_string(__type_name); }
- _LIBCPP_HIDE_FROM_ABI
- bool before(const type_info& __arg) const _NOEXCEPT
- {
- return __impl::__lt(__type_name, __arg.__type_name);
- }
+ _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT {
+ return __impl::__lt(__type_name, __arg.__type_name);
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t hash_code() const _NOEXCEPT
- {
- return __impl::__hash(__type_name);
- }
+ _LIBCPP_HIDE_FROM_ABI size_t hash_code() const _NOEXCEPT { return __impl::__hash(__type_name); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
- bool operator==(const type_info& __arg) const _NOEXCEPT
- {
- // When evaluated in a constant expression, both type infos simply can't come
- // from different translation units, so it is sufficient to compare their addresses.
- if (__libcpp_is_constant_evaluated()) {
- return this == &__arg;
- }
- return __impl::__eq(__type_name, __arg.__type_name);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT {
+ // When evaluated in a constant expression, both type infos simply can't come
+ // from different translation units, so it is sufficient to compare their addresses.
+ if (__libcpp_is_constant_evaluated()) {
+ return this == &__arg;
}
+ return __impl::__eq(__type_name, __arg.__type_name);
+ }
-#if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const type_info& __arg) const _NOEXCEPT
- { return !operator==(__arg); }
-#endif
+# if _LIBCPP_STD_VER <= 17
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const type_info& __arg) const _NOEXCEPT { return !operator==(__arg); }
+# endif
};
-#endif // defined(_LIBCPP_ABI_MICROSOFT)
+# endif // defined(_LIBCPP_ABI_MICROSOFT)
-class _LIBCPP_EXPORTED_FROM_ABI bad_cast
- : public exception
-{
- public:
+class _LIBCPP_EXPORTED_FROM_ABI bad_cast : public exception {
+public:
bad_cast() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_cast(const bad_cast&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_cast(const bad_cast&) _NOEXCEPT = default;
_LIBCPP_HIDE_FROM_ABI bad_cast& operator=(const bad_cast&) _NOEXCEPT = default;
~bad_cast() _NOEXCEPT override;
const char* what() const _NOEXCEPT override;
};
-class _LIBCPP_EXPORTED_FROM_ABI bad_typeid
- : public exception
-{
- public:
+class _LIBCPP_EXPORTED_FROM_ABI bad_typeid : public exception {
+public:
bad_typeid() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bad_typeid(const bad_typeid&) _NOEXCEPT = default;
+ _LIBCPP_HIDE_FROM_ABI bad_typeid(const bad_typeid&) _NOEXCEPT = default;
_LIBCPP_HIDE_FROM_ABI bad_typeid& operator=(const bad_typeid&) _NOEXCEPT = default;
~bad_typeid() _NOEXCEPT override;
const char* what() const _NOEXCEPT override;
@@ -403,13 +361,11 @@ private:
#endif // defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI
-void __throw_bad_cast()
-{
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_cast();
+ throw bad_cast();
#else
- _LIBCPP_VERBOSE_ABORT("bad_cast was thrown in -fno-exceptions mode");
+ _LIBCPP_VERBOSE_ABORT("bad_cast was thrown in -fno-exceptions mode");
#endif
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/uchar.h b/contrib/llvm-project/libcxx/include/uchar.h
index 546113f7eab4..07b78611406d 100644
--- a/contrib/llvm-project/libcxx/include/uchar.h
+++ b/contrib/llvm-project/libcxx/include/uchar.h
@@ -44,12 +44,12 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps);
// error on those platforms. When the platform doesn't provide <uchar.h>, at
// least include <stddef.h> so we get the declaration for size_t, and try to
// get the declaration of mbstate_t too.
-#if __has_include_next(<uchar.h>)
-# include_next <uchar.h>
-#else
-# include <__mbstate_t.h>
-# include <stddef.h>
-#endif
+# if __has_include_next(<uchar.h>)
+# include_next <uchar.h>
+# else
+# include <__mbstate_t.h>
+# include <stddef.h>
+# endif
#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/llvm-project/libcxx/include/unordered_map b/contrib/llvm-project/libcxx/include/unordered_map
index c8abefd9ead5..4be25fc1cdd8 100644
--- a/contrib/llvm-project/libcxx/include/unordered_map
+++ b/contrib/llvm-project/libcxx/include/unordered_map
@@ -627,2152 +627,1903 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _Cp, class _Hash, class _Pred,
+template <class _Key,
+ class _Cp,
+ class _Hash,
+ class _Pred,
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
-class __unordered_map_hasher
- : private _Hash
-{
+class __unordered_map_hasher : private _Hash {
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
- : _Hash() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher(const _Hash& __h)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
- : _Hash(__h) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Hash& hash_function() const _NOEXCEPT {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Cp& __x) const
- {return static_cast<const _Hash&>(*this)(__x.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Key& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher() _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) : _Hash() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher(const _Hash& __h) _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
+ : _Hash(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Cp& __x) const {
+ return static_cast<const _Hash&>(*this)(__x.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Key& __x) const { return static_cast<const _Hash&>(*this)(__x); }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _K2& __x) const
- {return static_cast<const _Hash&>(*this)(__x);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _K2& __x) const {
+ return static_cast<const _Hash&>(*this)(__x);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_hasher& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
- {
- using std::swap;
- swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) {
+ using std::swap;
+ swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
+ }
};
template <class _Key, class _Cp, class _Hash, class _Pred>
-class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false>
-{
- _Hash __hash_;
+class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false> {
+ _Hash __hash_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
- : __hash_() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_hasher(const _Hash& __h)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
- : __hash_(__h) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Hash& hash_function() const _NOEXCEPT {return __hash_;}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Cp& __x) const
- {return __hash_(__x.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _Key& __x) const
- {return __hash_(__x);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher() _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
+ : __hash_() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_hasher(const _Hash& __h) _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
+ : __hash_(__h) {}
+ _LIBCPP_HIDE_FROM_ABI const _Hash& hash_function() const _NOEXCEPT { return __hash_; }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Cp& __x) const { return __hash_(__x.__get_value().first); }
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _Key& __x) const { return __hash_(__x); }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- size_t operator()(const _K2& __x) const
- {return __hash_(__x);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI size_t operator()(const _K2& __x) const {
+ return __hash_(__x);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_hasher& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
- {
- using std::swap;
- swap(__hash_, __y.__hash_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) {
+ using std::swap;
+ swap(__hash_, __y.__hash_);
+ }
};
template <class _Key, class _Cp, class _Hash, class _Pred, bool __b>
-inline _LIBCPP_HIDE_FROM_ABI
-void
+inline _LIBCPP_HIDE_FROM_ABI void
swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x,
- __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+ __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
-template <class _Key, class _Cp, class _Pred, class _Hash,
+template <class _Key,
+ class _Cp,
+ class _Pred,
+ class _Hash,
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value>
-class __unordered_map_equal
- : private _Pred
-{
+class __unordered_map_equal : private _Pred {
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal()
- _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
- : _Pred() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal(const _Pred& __p)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
- : _Pred(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Pred& key_eq() const _NOEXCEPT {return *this;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Key& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal() _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) : _Pred() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal(const _Pred& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
+ : _Pred(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const _NOEXCEPT { return *this; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Cp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Key& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _Cp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);
+ }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _K2& __y) const
- {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Cp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _K2& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Key& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _K2& __y) const {
+ return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Cp& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _K2& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Key& __y) const {
+ return static_cast<const _Pred&>(*this)(__x, __y);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_equal& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
- {
- using std::swap;
- swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) {
+ using std::swap;
+ swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
+ }
};
template <class _Key, class _Cp, class _Pred, class _Hash>
-class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false>
-{
- _Pred __pred_;
+class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false> {
+ _Pred __pred_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal()
- _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
- : __pred_() {}
- _LIBCPP_HIDE_FROM_ABI
- __unordered_map_equal(const _Pred& __p)
- _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
- : __pred_(__p) {}
- _LIBCPP_HIDE_FROM_ABI
- const _Pred& key_eq() const _NOEXCEPT {return __pred_;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Cp& __y) const
- {return __pred_(__x.__get_value().first, __y.__get_value().first);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _Key& __y) const
- {return __pred_(__x.__get_value().first, __y);}
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _Cp& __y) const
- {return __pred_(__x, __y.__get_value().first);}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal() _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
+ : __pred_() {}
+ _LIBCPP_HIDE_FROM_ABI __unordered_map_equal(const _Pred& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
+ : __pred_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI const _Pred& key_eq() const _NOEXCEPT { return __pred_; }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Cp& __y) const {
+ return __pred_(__x.__get_value().first, __y.__get_value().first);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _Key& __y) const {
+ return __pred_(__x.__get_value().first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _Cp& __y) const {
+ return __pred_(__x, __y.__get_value().first);
+ }
#if _LIBCPP_STD_VER >= 20
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Cp& __x, const _K2& __y) const
- {return __pred_(__x.__get_value().first, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Cp& __y) const
- {return __pred_(__x, __y.__get_value().first);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Key& __x, const _K2& __y) const
- {return __pred_(__x, __y);}
- template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _K2& __x, const _Key& __y) const
- {return __pred_(__x, __y);}
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Cp& __x, const _K2& __y) const {
+ return __pred_(__x.__get_value().first, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Cp& __y) const {
+ return __pred_(__x, __y.__get_value().first);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _K2& __y) const {
+ return __pred_(__x, __y);
+ }
+ template <typename _K2>
+ _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _Key& __y) const {
+ return __pred_(__x, __y);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(__unordered_map_equal& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
- {
- using std::swap;
- swap(__pred_, __y.__pred_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) {
+ using std::swap;
+ swap(__pred_, __y.__pred_);
+ }
};
template <class _Key, class _Cp, class _Pred, class _Hash, bool __b>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x,
- __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x, __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
template <class _Alloc>
-class __hash_map_node_destructor
-{
- typedef _Alloc allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
+class __hash_map_node_destructor {
+ typedef _Alloc allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
public:
+ typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::pointer pointer;
private:
+ allocator_type& __na_;
- allocator_type& __na_;
-
- __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
+ __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
public:
- bool __first_constructed;
- bool __second_constructed;
+ bool __first_constructed;
+ bool __second_constructed;
- _LIBCPP_HIDE_FROM_ABI
- explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
- : __na_(__na),
- __first_constructed(false),
- __second_constructed(false)
- {}
+ _LIBCPP_HIDE_FROM_ABI explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
+ : __na_(__na),
+ __first_constructed(false),
+ __second_constructed(false) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
- _NOEXCEPT
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- __x.__value_constructed = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) _NOEXCEPT
+ : __na_(__x.__na_),
+ __first_constructed(__x.__value_constructed),
+ __second_constructed(__x.__value_constructed) {
+ __x.__value_constructed = false;
+ }
#else // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
- : __na_(__x.__na_),
- __first_constructed(__x.__value_constructed),
- __second_constructed(__x.__value_constructed)
- {
- const_cast<bool&>(__x.__value_constructed) = false;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
+ : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) {
+ const_cast<bool&>(__x.__value_constructed) = false;
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void operator()(pointer __p) _NOEXCEPT
- {
- if (__second_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().second));
- if (__first_constructed)
- __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().first));
- if (__p)
- __alloc_traits::deallocate(__na_, __p, 1);
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ if (__second_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().second));
+ if (__first_constructed)
+ __alloc_traits::destroy(__na_, std::addressof(__p->__get_value().__get_value().first));
+ if (__p)
+ __alloc_traits::deallocate(__na_, __p, 1);
+ }
};
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp>
-struct _LIBCPP_STANDALONE_DEBUG __hash_value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
- typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
+struct _LIBCPP_STANDALONE_DEBUG __hash_value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef pair<key_type&, mapped_type&> __nc_ref_pair_type;
+ typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value()
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const
- {
-#if _LIBCPP_STD_VER >= 17
- return *std::launder(std::addressof(__cc_));
-#else
- return __cc_;
-#endif
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_ref_pair_type __ref()
- {
- value_type& __v = __get_value();
- return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __nc_rref_pair_type __move()
- {
- value_type& __v = __get_value();
- return __nc_rref_pair_type(
- std::move(const_cast<key_type&>(__v.first)),
- std::move(__v.second));
- }
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_value_type& operator=(const __hash_value_type& __v)
- {
- __ref() = __v.__get_value();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const {
+# if _LIBCPP_STD_VER >= 17
+ return *std::launder(std::addressof(__cc_));
+# else
+ return __cc_;
+# endif
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_ref_pair_type __ref() {
+ value_type& __v = __get_value();
+ return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __nc_rref_pair_type __move() {
+ value_type& __v = __get_value();
+ return __nc_rref_pair_type(std::move(const_cast<key_type&>(__v.first)), std::move(__v.second));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_value_type& operator=(const __hash_value_type& __v) {
+ __ref() = __v.__get_value();
+ return *this;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __hash_value_type& operator=(__hash_value_type&& __v)
- {
- __ref() = __v.__move();
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI __hash_value_type& operator=(__hash_value_type&& __v) {
+ __ref() = __v.__move();
+ return *this;
+ }
- template <class _ValueTp,
- class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value>
- >
- _LIBCPP_HIDE_FROM_ABI
- __hash_value_type& operator=(_ValueTp&& __v)
- {
- __ref() = std::forward<_ValueTp>(__v);
- return *this;
- }
+ template <class _ValueTp, class = __enable_if_t<__is_same_uncvref<_ValueTp, value_type>::value> >
+ _LIBCPP_HIDE_FROM_ABI __hash_value_type& operator=(_ValueTp&& __v) {
+ __ref() = std::forward<_ValueTp>(__v);
+ return *this;
+ }
private:
- __hash_value_type(const __hash_value_type& __v) = delete;
- __hash_value_type(__hash_value_type&& __v) = delete;
- template <class ..._Args>
- explicit __hash_value_type(_Args&& ...__args) = delete;
+ __hash_value_type(const __hash_value_type& __v) = delete;
+ __hash_value_type(__hash_value_type&& __v) = delete;
+ template <class... _Args>
+ explicit __hash_value_type(_Args&&... __args) = delete;
- ~__hash_value_type() = delete;
+ ~__hash_value_type() = delete;
};
#else
template <class _Key, class _Tp>
-struct __hash_value_type
-{
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef pair<const key_type, mapped_type> value_type;
+struct __hash_value_type {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef pair<const key_type, mapped_type> value_type;
private:
- value_type __cc_;
+ value_type __cc_;
public:
- _LIBCPP_HIDE_FROM_ABI
- value_type& __get_value() { return __cc_; }
- _LIBCPP_HIDE_FROM_ABI
- const value_type& __get_value() const { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
+ _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
private:
- ~__hash_value_type();
+ ~__hash_value_type();
};
#endif
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_iterator {
+ _HashIterator __i_;
- typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
+ typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef value_type& reference;
- typedef typename _NodeTypes::__map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_iterator operator++(int)
- {
- __hash_map_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef value_type& reference;
+ typedef typename _NodeTypes::__map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator() _NOEXCEPT {}
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ == __y.__i_;}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_iterator operator++(int) {
+ __hash_map_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
#if _LIBCPP_STD_VER <= 17
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
- {return __x.__i_ != __y.__i_;}
+ friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
#endif
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
};
template <class _HashIterator>
-class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator
-{
- _HashIterator __i_;
+class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator {
+ _HashIterator __i_;
- typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
+ typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes;
public:
- typedef forward_iterator_tag iterator_category;
- typedef typename _NodeTypes::__map_value_type value_type;
- typedef typename _NodeTypes::difference_type difference_type;
- typedef const value_type& reference;
- typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator() _NOEXCEPT {}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator(
- __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
- _NOEXCEPT
- : __i_(__i.__i_) {}
-
- _LIBCPP_HIDE_FROM_ABI
- reference operator*() const {return __i_->__get_value();}
- _LIBCPP_HIDE_FROM_ABI
- pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
-
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator& operator++() {++__i_; return *this;}
- _LIBCPP_HIDE_FROM_ABI
- __hash_map_const_iterator operator++(int)
- {
- __hash_map_const_iterator __t(*this);
- ++(*this);
- return __t;
- }
+ typedef forward_iterator_tag iterator_category;
+ typedef typename _NodeTypes::__map_value_type value_type;
+ typedef typename _NodeTypes::difference_type difference_type;
+ typedef const value_type& reference;
+ typedef typename _NodeTypes::__const_map_value_type_pointer pointer;
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator() _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI
+ __hash_map_const_iterator(__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i) _NOEXCEPT
+ : __i_(__i.__i_) {}
+
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __i_->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(__i_->__get_value()); }
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ == __y.__i_;}
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator& operator++() {
+ ++__i_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI __hash_map_const_iterator operator++(int) {
+ __hash_map_const_iterator __t(*this);
+ ++(*this);
+ return __t;
+ }
+
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ == __y.__i_;
+ }
#if _LIBCPP_STD_VER <= 17
- friend _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
- {return __x.__i_ != __y.__i_;}
+ friend _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {
+ return __x.__i_ != __y.__i_;
+ }
#endif
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
- template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class, class, class, class, class>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
class unordered_multimap;
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS unordered_map
-{
+class _LIBCPP_TEMPLATE_VIS unordered_map {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __hash_value_type<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
- typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef __hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::_NodeTypes _NodeTypes;
- typedef typename __table::__node_pointer __node_pointer;
- typedef typename __table::__node_const_pointer __node_const_pointer;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
- typedef allocator_traits<allocator_type> __alloc_traits;
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- static_assert((is_same<typename __table::__container_value_type, value_type>::value), "");
- static_assert((is_same<typename __table::__node_value_type, __value_type>::value), "");
+ typedef __hash_value_type<key_type, mapped_type> __value_type;
+ typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
+ typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::_NodeTypes _NodeTypes;
+ typedef typename __table::__node_pointer __node_pointer;
+ typedef typename __table::__node_const_pointer __node_const_pointer;
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ static_assert((is_same<typename __table::__container_value_type, value_type>::value), "");
+ static_assert((is_same<typename __table::__node_value_type, __value_type>::value), "");
+
public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
- typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
- typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+ typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
+ typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __map_node_handle<__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
-
- _LIBCPP_HIDE_FROM_ABI
- unordered_map()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+
+ _LIBCPP_HIDE_FROM_ABI unordered_map() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_map(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
- if (__n > 0) {
- __table_.__rehash_unique(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ if (__n > 0) {
+ __table_.__rehash_unique(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_map(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_map(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(const unordered_map& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(unordered_map&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(size_type __n, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const allocator_type& __a)
: unordered_map(__n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_map(__n, __hf, key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
: unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_map(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_map(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
-#endif
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_map(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_map(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_map(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
: unordered_map(__il, __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_map(__il, __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_map() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_map() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_map& operator=(const unordered_map& __u)
- {
+ _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(const unordered_map& __u) {
#ifndef _LIBCPP_CXX03_LANG
- __table_ = __u.__table_;
+ __table_ = __u.__table_;
#else
- if (this != std::addressof(__u)) {
- __table_.clear();
- __table_.hash_function() = __u.__table_.hash_function();
- __table_.key_eq() = __u.__table_.key_eq();
- __table_.max_load_factor() = __u.__table_.max_load_factor();
- __table_.__copy_assign_alloc(__u.__table_);
- insert(__u.begin(), __u.end());
- }
-#endif
- return *this;
+ if (this != std::addressof(__u)) {
+ __table_.clear();
+ __table_.hash_function() = __u.__table_.hash_function();
+ __table_.key_eq() = __u.__table_.key_eq();
+ __table_.max_load_factor() = __u.__table_.max_load_factor();
+ __table_.__copy_assign_alloc(__u.__table_);
+ insert(__u.begin(), __u.end());
}
+#endif
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_map& operator=(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI
- unordered_map& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(unordered_map&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_map& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
-
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) {
- return insert(__x).first;
- }
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __x) { return __table_.__insert_unique(__x); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_unique(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_unique(std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(value_type&& __x)
- {return __table_.__insert_unique(std::move(__x));}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __x) {
+ return __table_.__insert_unique(std::move(__x));
+ }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, value_type&& __x) {
- return __table_.__insert_unique(std::move(__x)).first;
- }
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(_Pp&& __x)
- {return __table_.__insert_unique(std::forward<_Pp>(__x));}
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, _Pp&& __x)
- {
- return insert(std::forward<_Pp>(__x)).first;
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&&... __args) {
- return __table_.__emplace_unique(std::forward<_Args>(__args)...);
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator, _Args&&... __args) {
- return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, value_type&& __x) {
+ return __table_.__insert_unique(std::move(__x)).first;
+ }
-#endif // _LIBCPP_CXX03_LANG
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __x) {
+ return __table_.__insert_unique(std::forward<_Pp>(__x));
+ }
-#if _LIBCPP_STD_VER >= 17
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
- {
- return __table_.__emplace_unique_key_args(__k, piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, _Pp&& __x) {
+ return insert(std::forward<_Pp>(__x)).first;
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
- {
- return __table_.__emplace_unique_key_args(__k, piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(std::forward<_Args>(__args)...));
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator, const key_type& __k, _Args&&... __args)
- {
- return try_emplace(__k, std::forward<_Args>(__args)...).first;
- }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator, _Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
+ }
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator try_emplace(const_iterator, key_type&& __k, _Args&&... __args)
- {
- return try_emplace(std::move(__k), std::forward<_Args>(__args)...).first;
- }
+#endif // _LIBCPP_CXX03_LANG
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
- {
- pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k,
- __k, std::forward<_Vp>(__v));
- if (!__res.second) {
- __res.first->second = std::forward<_Vp>(__v);
- }
- return __res;
+#if _LIBCPP_STD_VER >= 17
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
+ return __table_.__emplace_unique_key_args(
+ __k, piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
+ return __table_.__emplace_unique_key_args(
+ __k,
+ piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(std::forward<_Args>(__args)...));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator, const key_type& __k, _Args&&... __args) {
+ return try_emplace(__k, std::forward<_Args>(__args)...).first;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator, key_type&& __k, _Args&&... __args) {
+ return try_emplace(std::move(__k), std::forward<_Args>(__args)...).first;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
+ pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, __k, std::forward<_Vp>(__v));
+ if (!__res.second) {
+ __res.first->second = std::forward<_Vp>(__v);
}
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
- {
- pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k,
- std::move(__k), std::forward<_Vp>(__v));
- if (!__res.second) {
- __res.first->second = std::forward<_Vp>(__v);
- }
- return __res;
+ return __res;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
+ pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, std::move(__k), std::forward<_Vp>(__v));
+ if (!__res.second) {
+ __res.first->second = std::forward<_Vp>(__v);
}
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v)
- {
- return insert_or_assign(__k, std::forward<_Vp>(__v)).first;
- }
-
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v)
- {
- return insert_or_assign(std::move(__k), std::forward<_Vp>(__v)).first;
- }
+ return __res;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v) {
+ return insert_or_assign(__k, std::forward<_Vp>(__v)).first;
+ }
+
+ template <class _Vp>
+ _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v) {
+ return insert_or_assign(std::move(__k), std::forward<_Vp>(__v)).first;
+ }
#endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_map::insert()");
- return __table_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_map::insert()");
- return __table_.template __node_handle_insert_unique<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_unique(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_map::insert()");
+ return __table_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_map::insert()");
+ return __table_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __table_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_map& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- { __table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_map& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_unique(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
+ _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
#endif
- _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
- _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const
- {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_unique(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_unique(__n);}
+ _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
-private:
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
+
+private:
#ifdef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node_with_key(const key_type& __k);
#endif
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_key_type<_InputIterator>>,
- class _Pred = equal_to<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_key_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_map(_InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<__range_key_type<_Range>>,
- class _Pred = equal_to<__range_key_type<_Range>>,
+ class _Hash = hash<__range_key_type<_Range>>,
+ class _Pred = equal_to<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_map(from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>; // C++23
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<remove_const_t<_Key>>,
+ class _Pred = equal_to<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>; // C++23
-#endif
-
-template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
- class _Pred = equal_to<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> unordered_map<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ _Hash,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_map<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(from_range_t, _Range&&, _Allocator)
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_map<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_map<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ _Hash,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-#endif
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>;
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>;
+
+template <class _Key,
+ class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_map<remove_const_t<_Key>, _Tp, _Hash,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>;
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const allocator_type& __a)
- : __table_(typename __table::allocator_type(__a))
-{
-}
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const allocator_type& __a)
+ : __table_(typename __table::allocator_type(__a)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const unordered_map& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const unordered_map& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- const unordered_map& __u, const allocator_type& __a)
- : __table_(__u.__table_, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const unordered_map& __u, const allocator_type& __a)
+ : __table_(__u.__table_, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- unordered_map&& __u)
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(unordered_map&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- unordered_map&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), typename __table::allocator_type(__a))
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0) {
- __table_.__emplace_unique(
- __u.__table_.remove((__i++).__i_)->__get_value().__move());
- }
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(unordered_map&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), typename __table::allocator_type(__a)) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0) {
+ __table_.__emplace_unique(__u.__table_.remove((__i++).__i_)->__get_value().__move());
}
+ }
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_unique(__il.begin(), __il.end());
- return *this;
+inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_unique(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- return __table_.__emplace_unique_key_args(__k,
- piecewise_construct, std::forward_as_tuple(__k),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) {
+ return __table_
+ .__emplace_unique_key_args(__k, piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
-{
- return __table_.__emplace_unique_key_args(__k,
- piecewise_construct, std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple()).first->__get_value().second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) {
+ return __table_
+ .__emplace_unique_key_args(
+ __k, piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
+ .first->__get_value()
+ .second;
}
#else // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k)
-{
- __node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().second));
- __h.get_deleter().__second_constructed = true;
- return __h;
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) {
+ __node_allocator& __na = __table_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().first), __k);
+ __h.get_deleter().__first_constructed = true;
+ __node_traits::construct(__na, std::addressof(__h->__get_value().__get_value().second));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i != end())
- return __i->second;
- __node_holder __h = __construct_node_with_key(__k);
- pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
- __h.release();
- return __r.first->second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) {
+ iterator __i = find(__k);
+ if (__i != end())
+ return __i->second;
+ __node_holder __h = __construct_node_with_key(__k);
+ pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+ __h.release();
+ return __r.first->second;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i == end())
- __throw_out_of_range("unordered_map::at: key not found");
- return __i->second;
+_Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) {
+ iterator __i = find(__k);
+ if (__i == end())
+ __throw_out_of_range("unordered_map::at: key not found");
+ return __i->second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-const _Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
-{
- const_iterator __i = find(__k);
- if (__i == end())
- __throw_out_of_range("unordered_map::at: key not found");
- return __i->second;
+const _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const {
+ const_iterator __i = find(__k);
+ if (__i == end())
+ __throw_out_of_range("unordered_map::at: key not found");
+ return __i->second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(__i->first);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(__i->first);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
-template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
-class _LIBCPP_TEMPLATE_VIS unordered_multimap
-{
+class _LIBCPP_TEMPLATE_VIS unordered_multimap {
public:
- // types
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef pair<const key_type, mapped_type> value_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef pair<const key_type, mapped_type> value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __hash_value_type<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
- typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
-
- typedef __hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
-
- __table __table_;
-
- typedef typename __table::_NodeTypes _NodeTypes;
- typedef typename __table::__node_traits __node_traits;
- typedef typename __table::__node_allocator __node_allocator;
- typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _Dp;
- typedef unique_ptr<__node, _Dp> __node_holder;
- typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert((is_same<typename __node_traits::size_type,
- typename __alloc_traits::size_type>::value),
- "Allocator uses different size_type for different types");
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- public:
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
-
- typedef __hash_map_iterator<typename __table::iterator> iterator;
- typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
- typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
- typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
+ typedef __hash_value_type<key_type, mapped_type> __value_type;
+ typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
+ typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
+ typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
+
+ typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table;
+
+ __table __table_;
+
+ typedef typename __table::_NodeTypes _NodeTypes;
+ typedef typename __table::__node_traits __node_traits;
+ typedef typename __table::__node_allocator __node_allocator;
+ typedef typename __table::__node __node;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ static_assert((is_same<typename __node_traits::size_type, typename __alloc_traits::size_type>::value),
+ "Allocator uses different size_type for different types");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+public:
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
+
+ typedef __hash_map_iterator<typename __table::iterator> iterator;
+ typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
+ typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
+ typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __map_node_handle<__node, allocator_type> node_type;
+ typedef __map_node_handle<__node, allocator_type> node_type;
#endif
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_map;
- template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
-
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf,
- const key_equal& __eql,
- const allocator_type& __a);
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
- if (__n > 0) {
- __table_.__rehash_multi(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ if (__n > 0) {
+ __table_.__rehash_multi(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_multimap(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_multimap(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u)
+ _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(size_type __n, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const allocator_type& __a)
: unordered_multimap(__n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multimap(__n, __hf, key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
: unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}
-#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_multimap(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multimap(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
-#endif
+# if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_multimap(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multimap(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+# endif
+
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
: unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multimap(__il, __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_multimap() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_multimap() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap& operator=(const unordered_multimap& __u)
- {
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(const unordered_multimap& __u) {
#ifndef _LIBCPP_CXX03_LANG
- __table_ = __u.__table_;
+ __table_ = __u.__table_;
#else
- if (this != std::addressof(__u)) {
- __table_.clear();
- __table_.hash_function() = __u.__table_.hash_function();
- __table_.key_eq() = __u.__table_.key_eq();
- __table_.max_load_factor() = __u.__table_.max_load_factor();
- __table_.__copy_assign_alloc(__u.__table_);
- insert(__u.begin(), __u.end());
- }
-#endif
- return *this;
+ if (this != std::addressof(__u)) {
+ __table_.clear();
+ __table_.hash_function() = __u.__table_.hash_function();
+ __table_.key_eq() = __u.__table_.key_eq();
+ __table_.max_load_factor() = __u.__table_.max_load_factor();
+ __table_.__copy_assign_alloc(__u.__table_);
+ insert(__u.begin(), __u.end());
}
+#endif
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap& operator=(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI
- unordered_multimap& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(unordered_multimap&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multimap& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __x)
- {return __table_.__insert_multi(__p.__i_, __x);}
-
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x) {
+ return __table_.__insert_multi(__p.__i_, __x);
+ }
+
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_multi(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_multi(std::forward<decltype(__element)>(__element));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __x) {return __table_.__insert_multi(std::move(__x));}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __x)
- {return __table_.__insert_multi(__p.__i_, std::move(__x));}
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(_Pp&& __x)
- {return __table_.__insert_multi(std::forward<_Pp>(__x));}
-
- template <class _Pp,
- class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, _Pp&& __x)
- {return __table_.__insert_multi(__p.__i_, std::forward<_Pp>(__x));}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
- return __table_.__emplace_multi(std::forward<_Args>(__args)...);
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
- return __table_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
- }
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __x) { return __table_.__insert_multi(std::move(__x)); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x) {
+ return __table_.__insert_multi(__p.__i_, std::move(__x));
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __x) {
+ return __table_.__insert_multi(std::forward<_Pp>(__x));
+ }
+
+ template <class _Pp, class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _Pp&& __x) {
+ return __table_.__insert_multi(__p.__i_, std::forward<_Pp>(__x));
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __table_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __table_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
+ }
#endif // _LIBCPP_CXX03_LANG
-
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first.__i_, __last.__i_);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __table_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first.__i_, __last.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multimap::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multimap::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- __hint.__i_, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(
- __it.__i_);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multimap::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multimap::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __table_.template __node_handle_extract<node_type>(__it.__i_);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_multimap& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const
- {return __table_.hash_function().hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const
- {return __table_.key_eq().key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_multimap& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function().hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq().key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_multi(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT
- {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const
- {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_multi(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_multi(__n);}
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_multi(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_multi(__n); }
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_key_type<_InputIterator>>,
- class _Pred = equal_to<__iter_key_type<_InputIterator>>,
- class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_key_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_key_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(_InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ _Hash,
+ _Pred,
+ _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<__range_key_type<_Range>>,
- class _Pred = equal_to<__range_key_type<_Range>>,
+ class _Hash = hash<__range_key_type<_Range>>,
+ class _Pred = equal_to<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>;
+# endif
+
+template <class _Key,
+ class _Tp,
+ class _Hash = hash<remove_const_t<_Key>>,
+ class _Pred = equal_to<remove_const_t<_Key>>,
+ class _Allocator = allocator<pair<const _Key, _Tp>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash, _Pred, _Allocator>;
-#endif
-
-template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
- class _Pred = equal_to<remove_const_t<_Key>>,
- class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ hash<__iter_key_type<_InputIterator>>,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
- _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
+ -> unordered_multimap<__iter_key_type<_InputIterator>,
+ __iter_mapped_type<_InputIterator>,
+ _Hash,
+ equal_to<__iter_key_type<_InputIterator>>,
+ _Allocator>;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_multimap<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(from_range_t, _Range&&, _Allocator)
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, hash<__range_key_type<_Range>>,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_multimap<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ hash<__range_key_type<_Range>>,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Hash,
- equal_to<__range_key_type<_Range>>, _Allocator>;
+ -> unordered_multimap<__range_key_type<_Range>,
+ __range_mapped_type<_Range>,
+ _Hash,
+ equal_to<__range_key_type<_Range>>,
+ _Allocator>;
-#endif
+# endif
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_multimap<remove_const_t<_Key>,
+ _Tp,
+ hash<remove_const_t<_Key>>,
+ equal_to<remove_const_t<_Key>>,
+ _Allocator>;
-template<class _Key, class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp,
- hash<remove_const_t<_Key>>,
- equal_to<remove_const_t<_Key>>, _Allocator>;
-
-template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash,
- equal_to<remove_const_t<_Key>>, _Allocator>;
+ -> unordered_multimap<remove_const_t<_Key>,
+ _Tp,
+ hash<remove_const_t<_Key>>,
+ equal_to<remove_const_t<_Key>>,
+ _Allocator>;
+
+template <class _Key,
+ class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multimap(
+ initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
+ -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>;
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__n);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const allocator_type& __a)
- : __table_(typename __table::allocator_type(__a))
-{
-}
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const allocator_type& __a)
+ : __table_(typename __table::allocator_type(__a)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const unordered_multimap& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const unordered_multimap& __u)
+ : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- const unordered_multimap& __u, const allocator_type& __a)
- : __table_(__u.__table_, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+ const unordered_multimap& __u, const allocator_type& __a)
+ : __table_(__u.__table_, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- unordered_multimap&& __u)
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(unordered_multimap&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- unordered_multimap&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), typename __table::allocator_type(__a))
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- {
- __table_.__insert_multi(
- __u.__table_.remove((__i++).__i_)->__get_value().__move());
- }
+ unordered_multimap&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), typename __table::allocator_type(__a)) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0) {
+ __table_.__insert_multi(__u.__table_.remove((__i++).__i_)->__get_value().__move());
}
+ }
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, typename __table::allocator_type(__a))
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, typename __table::allocator_type(__a)) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_multi(__il.begin(), __il.end());
- return *this;
+inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_multi(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
-
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(__i->first);
- _EqRng __yeq = __y.equal_range(__i->first);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(__i->first);
+ _EqRng __yeq = __y.equal_range(__i->first);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
- const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
diff --git a/contrib/llvm-project/libcxx/include/unordered_set b/contrib/llvm-project/libcxx/include/unordered_set
index 4f78bfde11af..6414885f4c51 100644
--- a/contrib/llvm-project/libcxx/include/unordered_set
+++ b/contrib/llvm-project/libcxx/include/unordered_set
@@ -575,1388 +575,1222 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Value, class _Hash, class _Pred, class _Alloc>
class unordered_multiset;
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
- class _Alloc = allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS unordered_set
-{
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> >
+class _LIBCPP_TEMPLATE_VIS unordered_set {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- private:
- typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+private:
+ typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
- typedef typename __table::const_local_iterator local_iterator;
- typedef typename __table::const_local_iterator const_local_iterator;
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+ typedef typename __table::const_local_iterator local_iterator;
+ typedef typename __table::const_local_iterator const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
- typedef __insert_return_type<iterator, node_type> insert_return_type;
+ typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
+ typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_set;
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_set;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
- _LIBCPP_HIDE_FROM_ABI
- unordered_set()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_set() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(size_type __n, const allocator_type& __a)
- : unordered_set(__n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(__n, __hf, key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const allocator_type& __a)
+ : unordered_set(__n, hasher(), key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(__n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(_InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, __a) {
- if (__n > 0) {
- __table_.__rehash_unique(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, __a) {
+ if (__n > 0) {
+ __table_.__rehash_unique(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const allocator_type& __a)
- : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
+ template <class _InputIterator>
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_set(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_set(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_set(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_set(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
+
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_set(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_set(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_set(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const allocator_type& __a)
- : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_set(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const allocator_type& __a)
- : unordered_set(__il, __n, __hf, key_equal(), __a) {}
-#endif
+ _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(unordered_set&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_set(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_set(initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_set(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+# if _LIBCPP_STD_VER >= 14
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_set(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_set(__il, __n, __hf, key_equal(), __a) {}
+# endif
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_set() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_set() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_set& operator=(const unordered_set& __u)
- {
- __table_ = __u.__table_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(const unordered_set& __u) {
+ __table_ = __u.__table_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_set& operator=(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI
- unordered_set& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(unordered_set&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
-#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> emplace(_Args&&... __args)
- {return __table_.__emplace_unique(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator, _Args&&... __args) {
- return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
- }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(value_type&& __x)
- {return __table_.__insert_unique(std::move(__x));}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, value_type&& __x) {
- return insert(std::move(__x)).first;
- }
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+#ifndef _LIBCPP_CXX03_LANG
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator, _Args&&... __args) {
+ return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __x) {
+ return __table_.__insert_unique(std::move(__x));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, value_type&& __x) { return insert(std::move(__x)).first; }
+
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __x) { return __table_.__insert_unique(__x); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator, const value_type& __x) {
- return insert(__x).first;
- }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_unique(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_unique(std::forward<decltype(__element)>(__element));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first, __last);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- insert_return_type insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_set::insert()");
- return __table_.template __node_handle_insert_unique<
- node_type, insert_return_type>(std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __h, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_set::insert()");
- return __table_.template __node_handle_insert_unique<node_type>(
- __h, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __it)
- {
- return __table_.template __node_handle_extract<node_type>(__it);
- }
-
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
- template<class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- __table_.__node_handle_merge_unique(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_set::insert()");
+ return __table_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __h, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_set::insert()");
+ return __table_.template __node_handle_insert_unique<node_type>(__h, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ return __table_.template __node_handle_extract<node_type>(__it);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ __table_.__node_handle_merge_unique(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_set& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_set& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_unique(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_unique(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_unique(__k);}
- template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_unique(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_unique(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_unique(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_unique(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_unique(__n);}
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_value_type<_InputIterator>>,
- class _Pred = equal_to<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_value_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(_InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<ranges::range_value_t<_Range>>,
- class _Pred = equal_to<ranges::range_value_t<_Range>>,
+ class _Hash = hash<ranges::range_value_t<_Range>>,
+ class _Pred = equal_to<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
+# endif
+
+template <class _Tp,
+ class _Hash = hash<_Tp>,
+ class _Pred = equal_to<_Tp>,
+ class _Allocator = allocator<_Tp>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(initializer_list<_Tp>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
+ -> unordered_set<__iter_value_type<_InputIterator>,
+ hash<__iter_value_type<_InputIterator>>,
+ equal_to<__iter_value_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
-#endif
-
-template<class _Tp, class _Hash = hash<_Tp>,
- class _Pred = equal_to<_Tp>,
- class _Allocator = allocator<_Tp>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator,
- typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<__iter_value_type<_InputIterator>,
- hash<__iter_value_type<_InputIterator>>,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(_InputIterator, _InputIterator,
- typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<__iter_value_type<_InputIterator>, _Hash,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
+unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
+ -> unordered_set<__iter_value_type<_InputIterator>, _Hash, equal_to<__iter_value_type<_InputIterator>>, _Allocator>;
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_set<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(from_range_t, _Range&&, _Allocator)
- -> unordered_set<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_set<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_set<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+# endif
-template<class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+ -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
-template<class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+ -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const allocator_type& __a)
- : __table_(__a)
-{
-}
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const allocator_type& __a) : __table_(__a) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const unordered_set& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u) : __table_(__u.__table_) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- const unordered_set& __u, const allocator_type& __a)
- : __table_(__u.__table_, __a)
-{
- __table_.__rehash_unique(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u, const allocator_type& __a)
+ : __table_(__u.__table_, __a) {
+ __table_.__rehash_unique(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- unordered_set&& __u)
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(unordered_set&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- unordered_set&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), __a)
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- __table_.__insert_unique(std::move(__u.__table_.remove(__i++)->__get_value()));
- }
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(unordered_set&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), __a) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0)
+ __table_.__insert_unique(std::move(__u.__table_.remove(__i++)->__get_value()));
+ }
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_unique(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_unique(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>&
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>&
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_set<_Value, _Hash, _Pred, _Alloc>&
-unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_unique(__il.begin(), __il.end());
- return *this;
+inline unordered_set<_Value, _Hash, _Pred, _Alloc>&
+unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_unique(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_unique(*__first);
+inline void unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_unique(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Value, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
- __i != __ex; ++__i)
- {
- const_iterator __j = __y.find(*__i);
- if (__j == __ey || !(*__i == *__j))
- return false;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
+ const_iterator __j = __y.find(*__i);
+ if (__j == __ey || !(*__i == *__j))
+ return false;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
-template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
- class _Alloc = allocator<_Value> >
-class _LIBCPP_TEMPLATE_VIS unordered_multiset
-{
+template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> >
+class _LIBCPP_TEMPLATE_VIS unordered_multiset {
public:
- // types
- typedef _Value key_type;
- typedef key_type value_type;
- typedef __type_identity_t<_Hash> hasher;
- typedef __type_identity_t<_Pred> key_equal;
- typedef __type_identity_t<_Alloc> allocator_type;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
- "Allocator::value_type must be same type as value_type");
+ // types
+ typedef _Value key_type;
+ typedef key_type value_type;
+ typedef __type_identity_t<_Hash> hasher;
+ typedef __type_identity_t<_Pred> key_equal;
+ typedef __type_identity_t<_Alloc> allocator_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ "Allocator::value_type must be same type as value_type");
private:
- typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
+ typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
- __table __table_;
+ __table __table_;
public:
- typedef typename __table::pointer pointer;
- typedef typename __table::const_pointer const_pointer;
- typedef typename __table::size_type size_type;
- typedef typename __table::difference_type difference_type;
+ typedef typename __table::pointer pointer;
+ typedef typename __table::const_pointer const_pointer;
+ typedef typename __table::size_type size_type;
+ typedef typename __table::difference_type difference_type;
- typedef typename __table::const_iterator iterator;
- typedef typename __table::const_iterator const_iterator;
- typedef typename __table::const_local_iterator local_iterator;
- typedef typename __table::const_local_iterator const_local_iterator;
+ typedef typename __table::const_iterator iterator;
+ typedef typename __table::const_iterator const_iterator;
+ typedef typename __table::const_local_iterator local_iterator;
+ typedef typename __table::const_local_iterator const_local_iterator;
#if _LIBCPP_STD_VER >= 17
- typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
+ typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
#endif
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_set;
- template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
- friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_set;
+ template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset()
- _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
- {
- }
- explicit _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
+ explicit _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(size_type __n, const allocator_type& __a)
- : unordered_multiset(__n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(__n, __hf, key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const allocator_type& __a)
+ : unordered_multiset(__n, hasher(), key_equal(), __a) {}
+ inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multiset(__n, __hf, key_equal(), __a) {}
#endif
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n , const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(from_range_t, _Range&& __range, size_type __n = /*implementation-defined*/0,
- const hasher& __hf = hasher(), const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : __table_(__hf, __eql, __a) {
- if (__n > 0) {
- __table_.__rehash_multi(__n);
- }
- insert_range(std::forward<_Range>(__range));
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ from_range_t,
+ _Range&& __range,
+ size_type __n = /*implementation-defined*/ 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : __table_(__hf, __eql, __a) {
+ if (__n > 0) {
+ __table_.__rehash_multi(__n);
}
+ insert_range(std::forward<_Range>(__range));
+ }
#endif
#if _LIBCPP_STD_VER >= 14
- template <class _InputIterator>
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const allocator_type& __a)
- : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
- template <class _InputIterator>
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(_InputIterator __first, _InputIterator __last,
- size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
+ template <class _InputIterator>
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
+ : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
+ template <class _InputIterator>
+ inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
- : unordered_multiset(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
-
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
- : unordered_multiset(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
+ : unordered_multiset(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
+
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
+ : unordered_multiset(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
#endif
- _LIBCPP_HIDE_FROM_ABI
- explicit unordered_multiset(const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI explicit unordered_multiset(const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal());
- _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a);
-#if _LIBCPP_STD_VER >= 14
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u)
+ _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal());
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset(
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a);
+# if _LIBCPP_STD_VER >= 14
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
: unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}
- inline _LIBCPP_HIDE_FROM_ABI
- unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
+ inline _LIBCPP_HIDE_FROM_ABI
+ unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
-#endif
+# endif
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- ~unordered_multiset() {
- static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
- }
+ _LIBCPP_HIDE_FROM_ABI ~unordered_multiset() {
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
+ }
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset& operator=(const unordered_multiset& __u)
- {
- __table_ = __u.__table_;
- return *this;
- }
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(const unordered_multiset& __u) {
+ __table_ = __u.__table_;
+ return *this;
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- unordered_multiset& operator=(unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
- _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(unordered_multiset&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
+ _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(__table_.__node_alloc());}
-
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT {return __table_.size() == 0;}
- _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT {return __table_.size();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_size() const _NOEXCEPT {return __table_.max_size();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator begin() _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- iterator end() _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator begin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator end() const _NOEXCEPT {return __table_.end();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT {return __table_.end();}
+ _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__table_.__node_alloc());
+ }
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
+ _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
#ifndef _LIBCPP_CXX03_LANG
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace(_Args&&... __args)
- {return __table_.__emplace_multi(std::forward<_Args>(__args)...);}
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- iterator emplace_hint(const_iterator __p, _Args&&... __args)
- {return __table_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(value_type&& __x) {return __table_.__insert_multi(std::move(__x));}
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, value_type&& __x)
- {return __table_.__insert_multi(__p, std::move(__x));}
- _LIBCPP_HIDE_FROM_ABI
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ return __table_.__emplace_multi(std::forward<_Args>(__args)...);
+ }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ return __table_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __x) { return __table_.__insert_multi(std::move(__x)); }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x) {
+ return __table_.__insert_multi(__p, std::move(__x));
+ }
+ _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __p, const value_type& __x)
- {return __table_.__insert_multi(__p, __x);}
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x) {
+ return __table_.__insert_multi(__p, __x);
+ }
- template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
- void insert(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator>
+ _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
- void insert_range(_Range&& __range) {
- for (auto&& __element : __range) {
- __table_.__insert_multi(std::forward<decltype(__element)>(__element));
- }
+ template <_ContainerCompatibleRange<value_type> _Range>
+ _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ for (auto&& __element : __range) {
+ __table_.__insert_multi(std::forward<decltype(__element)>(__element));
}
+ }
#endif
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multiset::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __hint, node_type&& __nh)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
- "node_type with incompatible allocator passed to unordered_multiset::insert()");
- return __table_.template __node_handle_insert_multi<node_type>(
- __hint, std::move(__nh));
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(const_iterator __position)
- {
- return __table_.template __node_handle_extract<node_type>(
- __position);
- }
- _LIBCPP_HIDE_FROM_ABI
- node_type extract(key_type const& __key)
- {
- return __table_.template __node_handle_extract<node_type>(__key);
- }
-
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
- template <class _H2, class _P2>
- _LIBCPP_HIDE_FROM_ABI
- void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
- {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__source.get_allocator() == get_allocator(),
- "merging container with incompatible allocator");
- return __table_.__node_handle_merge_multi(__source.__table_);
- }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multiset::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
+ "node_type with incompatible allocator passed to unordered_multiset::insert()");
+ return __table_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __position) {
+ return __table_.template __node_handle_extract<node_type>(__position);
+ }
+ _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ return __table_.template __node_handle_extract<node_type>(__key);
+ }
+
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_HIDE_FROM_ABI void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) {
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __p) {return __table_.erase(__p);}
- _LIBCPP_HIDE_FROM_ABI
- size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- iterator erase(const_iterator __first, const_iterator __last)
- {return __table_.erase(__first, __last);}
- _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT {__table_.clear();}
-
- _LIBCPP_HIDE_FROM_ABI
- void swap(unordered_multiset& __u)
- _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
-
- _LIBCPP_HIDE_FROM_ABI
- hasher hash_function() const {return __table_.hash_function();}
- _LIBCPP_HIDE_FROM_ABI
- key_equal key_eq() const {return __table_.key_eq();}
-
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const key_type& __k) {return __table_.find(__k);}
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const key_type& __k) const {return __table_.find(__k);}
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
+ return __table_.erase(__first, __last);
+ }
+ _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
+
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_multiset& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ __table_.swap(__u.__table_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
+ _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
+
+ _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
#if _LIBCPP_STD_VER >= 20
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- iterator find(const _K2& __k) {return __table_.find(__k);}
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- const_iterator find(const _K2& __k) const {return __table_.find(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ return __table_.find(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ return __table_.find(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
#if _LIBCPP_STD_VER >= 20
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- size_type count(const _K2& __k) const {return __table_.__count_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ return __table_.__count_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const key_type& __k) const {return find(__k) != end();}
+ _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- bool contains(const _K2& __k) const {return find(__k) != end();}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ return find(__k) != end();
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const key_type& __k)
- {return __table_.__equal_range_multi(__k);}
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
- {return __table_.__equal_range_multi(__k);}
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#if _LIBCPP_STD_VER >= 20
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<iterator, iterator> equal_range(const _K2& __k)
- {return __table_.__equal_range_multi(__k);}
- template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI
- pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
- {return __table_.__equal_range_multi(__k);}
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ return __table_.__equal_range_multi(__k);
+ }
+ template <class _K2,
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ return __table_.__equal_range_multi(__k);
+ }
#endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
- _LIBCPP_HIDE_FROM_ABI
- size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
-
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
- _LIBCPP_HIDE_FROM_ABI
- size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
-
- _LIBCPP_HIDE_FROM_ABI
- local_iterator begin(size_type __n) {return __table_.begin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- local_iterator end(size_type __n) {return __table_.end(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
- _LIBCPP_HIDE_FROM_ABI
- const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
-
- _LIBCPP_HIDE_FROM_ABI
- float load_factor() const _NOEXCEPT {return __table_.load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
- _LIBCPP_HIDE_FROM_ABI
- void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
- _LIBCPP_HIDE_FROM_ABI
- void rehash(size_type __n) {__table_.__rehash_multi(__n);}
- _LIBCPP_HIDE_FROM_ABI
- void reserve(size_type __n) {__table_.__reserve_multi(__n);}
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
+ _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+
+ _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+ _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
+
+ _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
+ _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+ _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
+
+ _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
+ _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
+ _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_multi(__n); }
+ _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_multi(__n); }
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Hash = hash<__iter_value_type<_InputIterator>>,
- class _Pred = equal_to<__iter_value_type<_InputIterator>>,
- class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
-
-#if _LIBCPP_STD_VER >= 23
+template <class _InputIterator,
+ class _Hash = hash<__iter_value_type<_InputIterator>>,
+ class _Pred = equal_to<__iter_value_type<_InputIterator>>,
+ class _Allocator = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(
+ _InputIterator,
+ _InputIterator,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
+
+# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
- class _Hash = hash<ranges::range_value_t<_Range>>,
- class _Pred = equal_to<ranges::range_value_t<_Range>>,
+ class _Hash = hash<ranges::range_value_t<_Range>>,
+ class _Pred = equal_to<ranges::range_value_t<_Range>>,
class _Allocator = allocator<ranges::range_value_t<_Range>>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(
+ from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
+# endif
+
+template <class _Tp,
+ class _Hash = hash<_Tp>,
+ class _Pred = equal_to<_Tp>,
+ class _Allocator = allocator<_Tp>,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(initializer_list<_Tp>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
+
+template <class _InputIterator,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
+unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
+ -> unordered_multiset<__iter_value_type<_InputIterator>,
+ hash<__iter_value_type<_InputIterator>>,
+ equal_to<__iter_value_type<_InputIterator>>,
+ _Allocator>;
+
+template <class _InputIterator,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
-#endif
+unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
+ -> unordered_multiset<__iter_value_type<_InputIterator>,
+ _Hash,
+ equal_to<__iter_value_type<_InputIterator>>,
+ _Allocator>;
-template<class _Tp, class _Hash = hash<_Tp>,
- class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<!__is_allocator<_Pred>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
- -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
-
-template<class _InputIterator, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<__iter_value_type<_InputIterator>,
- hash<__iter_value_type<_InputIterator>>,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
-
-template<class _InputIterator, class _Hash, class _Allocator,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type,
- _Hash, _Allocator)
- -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash,
- equal_to<__iter_value_type<_InputIterator>>,
- _Allocator>;
+# if _LIBCPP_STD_VER >= 23
-#if _LIBCPP_STD_VER >= 23
-
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_multiset<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(from_range_t, _Range&&, _Allocator)
- -> unordered_multiset<ranges::range_value_t<_Range>, hash<ranges::range_value_t<_Range>>,
- equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_multiset<ranges::range_value_t<_Range>,
+ hash<ranges::range_value_t<_Range>>,
+ equal_to<ranges::range_value_t<_Range>>,
+ _Allocator>;
-template <ranges::input_range _Range, class _Hash, class _Allocator,
+template <ranges::input_range _Range,
+ class _Hash,
+ class _Allocator,
class = enable_if_t<!__is_allocator<_Hash>::value>,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(from_range_t, _Range&&, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
+ -> unordered_multiset<ranges::range_value_t<_Range>, _Hash, equal_to<ranges::range_value_t<_Range>>, _Allocator>;
-#endif
+# endif
-template<class _Tp, class _Allocator,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
- -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+ -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
-template<class _Tp, class _Hash, class _Allocator,
- class = enable_if_t<!__is_allocator<_Hash>::value>,
- class = enable_if_t<!is_integral<_Hash>::value>,
- class = enable_if_t<__is_allocator<_Allocator>::value>>
+template <class _Tp,
+ class _Hash,
+ class _Allocator,
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
- -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+ -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
+ size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last)
-{
- insert(__first, __last);
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(_InputIterator __first, _InputIterator __last) {
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- _InputIterator __first, _InputIterator __last, size_type __n,
- const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__first, __last);
+ _InputIterator __first,
+ _InputIterator __last,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__first, __last);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const allocator_type& __a)
- : __table_(__a)
-{
-}
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const allocator_type& __a)
+ : __table_(__a) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const unordered_multiset& __u)
- : __table_(__u.__table_)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const unordered_multiset& __u)
+ : __table_(__u.__table_) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- const unordered_multiset& __u, const allocator_type& __a)
- : __table_(__u.__table_, __a)
-{
- __table_.__rehash_multi(__u.bucket_count());
- insert(__u.begin(), __u.end());
+ const unordered_multiset& __u, const allocator_type& __a)
+ : __table_(__u.__table_, __a) {
+ __table_.__rehash_multi(__u.bucket_count());
+ insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- unordered_multiset&& __u)
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(unordered_multiset&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
- : __table_(std::move(__u.__table_))
-{
-}
+ : __table_(std::move(__u.__table_)) {}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- unordered_multiset&& __u, const allocator_type& __a)
- : __table_(std::move(__u.__table_), __a)
-{
- if (__a != __u.get_allocator())
- {
- iterator __i = __u.begin();
- while (__u.size() != 0)
- __table_.__insert_multi(std::move(__u.__table_.remove(__i++)->__get_value()));
- }
+ unordered_multiset&& __u, const allocator_type& __a)
+ : __table_(std::move(__u.__table_), __a) {
+ if (__a != __u.get_allocator()) {
+ iterator __i = __u.begin();
+ while (__u.size() != 0)
+ __table_.__insert_multi(std::move(__u.__table_.remove(__i++)->__get_value()));
+ }
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il)
-{
- insert(__il.begin(), __il.end());
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql)
- : __table_(__hf, __eql)
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql)
+ : __table_(__hf, __eql) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
- initializer_list<value_type> __il, size_type __n, const hasher& __hf,
- const key_equal& __eql, const allocator_type& __a)
- : __table_(__hf, __eql, __a)
-{
- __table_.__rehash_multi(__n);
- insert(__il.begin(), __il.end());
+ initializer_list<value_type> __il,
+ size_type __n,
+ const hasher& __hf,
+ const key_equal& __eql,
+ const allocator_type& __a)
+ : __table_(__hf, __eql, __a) {
+ __table_.__rehash_multi(__n);
+ insert(__il.begin(), __il.end());
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
- unordered_multiset&& __u)
- _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
-{
- __table_ = std::move(__u.__table_);
- return *this;
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_multiset&& __u)
+ _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) {
+ __table_ = std::move(__u.__table_);
+ return *this;
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
- initializer_list<value_type> __il)
-{
- __table_.__assign_multi(__il.begin(), __il.end());
- return *this;
+inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
+unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(initializer_list<value_type> __il) {
+ __table_.__assign_multi(__il.begin(), __il.end());
+ return *this;
}
#endif // _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
-inline
-void
-unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
- _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- __table_.__insert_multi(*__first);
+inline void unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
+ for (; __first != __last; ++__first)
+ __table_.__insert_multi(*__first);
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+inline _LIBCPP_HIDE_FROM_ABI void
+swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
-template <class _Value, class _Hash, class _Pred, class _Alloc,
- class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI
- typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type
- erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c,
- _Predicate __pred) {
+template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type
+erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- if (__x.size() != __y.size())
- return false;
- typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
- const_iterator;
- typedef pair<const_iterator, const_iterator> _EqRng;
- for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
- {
- _EqRng __xeq = __x.equal_range(*__i);
- _EqRng __yeq = __y.equal_range(*__i);
- if (std::distance(__xeq.first, __xeq.second) !=
- std::distance(__yeq.first, __yeq.second) ||
- !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
- return false;
- __i = __xeq.second;
- }
- return true;
+_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ if (__x.size() != __y.size())
+ return false;
+ typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
+ typedef pair<const_iterator, const_iterator> _EqRng;
+ for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
+ _EqRng __xeq = __x.equal_range(*__i);
+ _EqRng __yeq = __y.equal_range(*__i);
+ if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
+ !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
+ return false;
+ __i = __xeq.second;
+ }
+ return true;
}
#if _LIBCPP_STD_VER <= 17
template <class _Value, class _Hash, class _Pred, class _Alloc>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
- const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
+ return !(__x == __y);
}
#endif
@@ -1970,7 +1804,8 @@ template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equa
using unordered_set _LIBCPP_AVAILABILITY_PMR = std::unordered_set<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;
template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>>
-using unordered_multiset _LIBCPP_AVAILABILITY_PMR = std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;
+using unordered_multiset _LIBCPP_AVAILABILITY_PMR =
+ std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD
#endif
diff --git a/contrib/llvm-project/libcxx/include/valarray b/contrib/llvm-project/libcxx/include/valarray
index 19f26d0940a0..fb6186849521 100644
--- a/contrib/llvm-project/libcxx/include/valarray
+++ b/contrib/llvm-project/libcxx/include/valarray
@@ -379,355 +379,264 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp> class _LIBCPP_TEMPLATE_VIS valarray;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS valarray;
+
+class _LIBCPP_TEMPLATE_VIS slice {
+ size_t __start_;
+ size_t __size_;
+ size_t __stride_;
-class _LIBCPP_TEMPLATE_VIS slice
-{
- size_t __start_;
- size_t __size_;
- size_t __stride_;
public:
- _LIBCPP_HIDE_FROM_ABI
- slice()
- : __start_(0),
- __size_(0),
- __stride_(0)
- {}
-
- _LIBCPP_HIDE_FROM_ABI
- slice(size_t __start, size_t __size, size_t __stride)
- : __start_(__start),
- __size_(__size),
- __stride_(__stride)
- {}
-
- _LIBCPP_HIDE_FROM_ABI size_t start() const {return __start_;}
- _LIBCPP_HIDE_FROM_ABI size_t size() const {return __size_;}
- _LIBCPP_HIDE_FROM_ABI size_t stride() const {return __stride_;}
+ _LIBCPP_HIDE_FROM_ABI slice() : __start_(0), __size_(0), __stride_(0) {}
+
+ _LIBCPP_HIDE_FROM_ABI slice(size_t __start, size_t __size, size_t __stride)
+ : __start_(__start), __size_(__size), __stride_(__stride) {}
+
+ _LIBCPP_HIDE_FROM_ABI size_t start() const { return __start_; }
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
+ _LIBCPP_HIDE_FROM_ABI size_t stride() const { return __stride_; }
#if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(const slice& __x, const slice& __y) {
- return __x.start() == __y.start() && __x.size() == __y.size() && __x.stride() == __y.stride();
- }
+ _LIBCPP_HIDE_FROM_ABI friend bool operator==(const slice& __x, const slice& __y) {
+ return __x.start() == __y.start() && __x.size() == __y.size() && __x.stride() == __y.stride();
+ }
#endif
};
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS slice_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS slice_array;
class _LIBCPP_EXPORTED_FROM_ABI gslice;
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS gslice_array;
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS mask_array;
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS indirect_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS gslice_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS mask_array;
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS indirect_array;
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp*
-begin(valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI _Tp* begin(valarray<_Tp>& __v);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-const _Tp*
-begin(const valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI const _Tp* begin(const valarray<_Tp>& __v);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-_Tp*
-end(valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI _Tp* end(valarray<_Tp>& __v);
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI
-const _Tp*
-end(const valarray<_Tp>& __v);
+_LIBCPP_HIDE_FROM_ABI const _Tp* end(const valarray<_Tp>& __v);
template <class _Op, class _A0>
-struct _UnaryOp
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _UnaryOp {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- _A0 __a0_;
+ _Op __op_;
+ _A0 __a0_;
- _LIBCPP_HIDE_FROM_ABI
- _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
+ _LIBCPP_HIDE_FROM_ABI _UnaryOp(const _Op& __op, const _A0& __a0) : __op_(__op), __a0_(__a0) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _A0, class _A1>
-struct _BinaryOp
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- _A0 __a0_;
- _A1 __a1_;
+ _Op __op_;
+ _A0 __a0_;
+ _A1 __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const _A0& __a0, const _A1& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Tp>
-class __scalar_expr
-{
+class __scalar_expr {
public:
- typedef _Tp value_type;
- typedef const _Tp& __result_type;
+ typedef _Tp value_type;
+ typedef const _Tp& __result_type;
+
private:
- const value_type& __t_;
- size_t __s_;
+ const value_type& __t_;
+ size_t __s_;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __scalar_expr(const value_type& __t, size_t __s) : __t_(__t), __s_(__s) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t) const {return __t_;}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t) const { return __t_; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __s_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __s_; }
};
template <class _Tp>
-struct __unary_plus
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return +__x;}
+struct __unary_plus {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return +__x; }
};
template <class _Tp>
-struct __bit_not
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return ~__x;}
+struct __bit_not {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; }
};
template <class _Tp>
-struct __bit_shift_left
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x << __y;}
+struct __bit_shift_left {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x << __y; }
};
template <class _Tp>
-struct __bit_shift_right
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return __x >> __y;}
+struct __bit_shift_right {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x >> __y; }
};
template <class _Tp, class _Fp>
-struct __apply_expr
-{
+struct __apply_expr {
private:
- _Fp __f_;
+ _Fp __f_;
+
public:
- typedef _Tp __result_type;
+ typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit __apply_expr(_Fp __f) : __f_(__f) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __apply_expr(_Fp __f) : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return __f_(__x);}
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return __f_(__x); }
};
template <class _Tp>
-struct __abs_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::abs(__x);}
+struct __abs_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::abs(__x); }
};
template <class _Tp>
-struct __acos_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::acos(__x);}
+struct __acos_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::acos(__x); }
};
template <class _Tp>
-struct __asin_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::asin(__x);}
+struct __asin_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::asin(__x); }
};
template <class _Tp>
-struct __atan_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::atan(__x);}
+struct __atan_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::atan(__x); }
};
template <class _Tp>
-struct __atan2_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return std::atan2(__x, __y);}
+struct __atan2_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return std::atan2(__x, __y); }
};
template <class _Tp>
-struct __cos_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::cos(__x);}
+struct __cos_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::cos(__x); }
};
template <class _Tp>
-struct __cosh_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::cosh(__x);}
+struct __cosh_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::cosh(__x); }
};
template <class _Tp>
-struct __exp_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::exp(__x);}
+struct __exp_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::exp(__x); }
};
template <class _Tp>
-struct __log_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::log(__x);}
+struct __log_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::log(__x); }
};
template <class _Tp>
-struct __log10_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::log10(__x);}
+struct __log10_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::log10(__x); }
};
template <class _Tp>
-struct __pow_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return std::pow(__x, __y);}
+struct __pow_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { return std::pow(__x, __y); }
};
template <class _Tp>
-struct __sin_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::sin(__x);}
+struct __sin_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::sin(__x); }
};
template <class _Tp>
-struct __sinh_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::sinh(__x);}
+struct __sinh_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::sinh(__x); }
};
template <class _Tp>
-struct __sqrt_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::sqrt(__x);}
+struct __sqrt_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::sqrt(__x); }
};
template <class _Tp>
-struct __tan_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::tan(__x);}
+struct __tan_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::tan(__x); }
};
template <class _Tp>
-struct __tanh_expr
-{
- typedef _Tp __result_type;
- _LIBCPP_HIDE_FROM_ABI
- _Tp operator()(const _Tp& __x) const
- {return std::tanh(__x);}
+struct __tanh_expr {
+ typedef _Tp __result_type;
+ _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return std::tanh(__x); }
};
template <class _ValExpr>
-class __slice_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __slice_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- size_t __start_;
- size_t __size_;
- size_t __stride_;
-
- _LIBCPP_HIDE_FROM_ABI
- __slice_expr(const slice& __sl, const _RmExpr& __e)
- : __expr_(__e),
- __start_(__sl.start()),
- __size_(__sl.size()),
- __stride_(__sl.stride())
- {}
-public:
+ _ValExpr __expr_;
+ size_t __start_;
+ size_t __size_;
+ size_t __stride_;
+
+ _LIBCPP_HIDE_FROM_ABI __slice_expr(const slice& __sl, const _RmExpr& __e)
+ : __expr_(__e), __start_(__sl.start()), __size_(__sl.size()), __stride_(__sl.stride()) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__start_ + __i * __stride_];}
+public:
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__start_ + __i * __stride_]; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
- template <class> friend class __val_expr;
- template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
+ template <class>
+ friend class __val_expr;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS valarray;
};
template <class _ValExpr>
@@ -737,2576 +646,1904 @@ template <class _ValExpr>
class __indirect_expr;
template <class _ValExpr>
-class __shift_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __shift_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- size_t __size_;
- ptrdiff_t __ul_;
- ptrdiff_t __sn_;
- ptrdiff_t __n_;
- static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
- sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
-
- _LIBCPP_HIDE_FROM_ABI
- __shift_expr(int __n, const _RmExpr& __e)
- : __expr_(__e),
- __size_(__e.size()),
- __n_(__n)
- {
- ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
- __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
- __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
- }
-public:
+ _ValExpr __expr_;
+ size_t __size_;
+ ptrdiff_t __ul_;
+ ptrdiff_t __sn_;
+ ptrdiff_t __n_;
+ static const ptrdiff_t _Np = static_cast<ptrdiff_t>(sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
+
+ _LIBCPP_HIDE_FROM_ABI __shift_expr(int __n, const _RmExpr& __e) : __expr_(__e), __size_(__e.size()), __n_(__n) {
+ ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
+ __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
+ __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __j) const
- {
- ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
- ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
- return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __j) const {
+ ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
+ ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
+ return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
- template <class> friend class __val_expr;
+ template <class>
+ friend class __val_expr;
};
template <class _ValExpr>
-class __cshift_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __cshift_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- size_t __size_;
- size_t __m_;
- size_t __o1_;
- size_t __o2_;
-
- _LIBCPP_HIDE_FROM_ABI
- __cshift_expr(int __n, const _RmExpr& __e)
- : __expr_(__e),
- __size_(__e.size())
- {
- __n %= static_cast<int>(__size_);
- if (__n >= 0)
- {
- __m_ = __size_ - __n;
- __o1_ = __n;
- __o2_ = __n - __size_;
- }
- else
- {
- __m_ = -__n;
- __o1_ = __n + __size_;
- __o2_ = __n;
- }
- }
-public:
+ _ValExpr __expr_;
+ size_t __size_;
+ size_t __m_;
+ size_t __o1_;
+ size_t __o2_;
+
+ _LIBCPP_HIDE_FROM_ABI __cshift_expr(int __n, const _RmExpr& __e) : __expr_(__e), __size_(__e.size()) {
+ __n %= static_cast<int>(__size_);
+ if (__n >= 0) {
+ __m_ = __size_ - __n;
+ __o1_ = __n;
+ __o2_ = __n - __size_;
+ } else {
+ __m_ = -__n;
+ __o1_ = __n + __size_;
+ __o2_ = __n;
+ }
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {
- if (__i < __m_)
- return __expr_[__i + __o1_];
- return __expr_[__i + __o2_];
- }
+public:
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const {
+ if (__i < __m_)
+ return __expr_[__i + __o1_];
+ return __expr_[__i + __o2_];
+ }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __size_; }
- template <class> friend class __val_expr;
+ template <class>
+ friend class __val_expr;
};
-template<class _ValExpr>
+template <class _ValExpr>
class __val_expr;
-template<class _ValExpr>
+template <class _ValExpr>
struct __is_val_expr : false_type {};
-template<class _ValExpr>
+template <class _ValExpr>
struct __is_val_expr<__val_expr<_ValExpr> > : true_type {};
-template<class _Tp>
+template <class _Tp>
struct __is_val_expr<valarray<_Tp> > : true_type {};
-template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS valarray
-{
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS valarray {
public:
- typedef _Tp value_type;
- typedef _Tp __result_type;
+ typedef _Tp value_type;
+ typedef _Tp __result_type;
private:
- value_type* __begin_;
- value_type* __end_;
+ value_type* __begin_;
+ value_type* __end_;
public:
- // construct/destroy:
- _LIBCPP_HIDE_FROM_ABI
- valarray() : __begin_(nullptr), __end_(nullptr) {}
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- explicit valarray(size_t __n);
- _LIBCPP_HIDE_FROM_ABI
- valarray(const value_type& __x, size_t __n);
- valarray(const value_type* __p, size_t __n);
- valarray(const valarray& __v);
+ // construct/destroy:
+ _LIBCPP_HIDE_FROM_ABI valarray() : __begin_(nullptr), __end_(nullptr) {}
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit valarray(size_t __n);
+ _LIBCPP_HIDE_FROM_ABI valarray(const value_type& __x, size_t __n);
+ valarray(const value_type* __p, size_t __n);
+ valarray(const valarray& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- valarray(valarray&& __v) _NOEXCEPT;
- valarray(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI valarray(valarray&& __v) _NOEXCEPT;
+ valarray(initializer_list<value_type> __il);
#endif // _LIBCPP_CXX03_LANG
- valarray(const slice_array<value_type>& __sa);
- valarray(const gslice_array<value_type>& __ga);
- valarray(const mask_array<value_type>& __ma);
- valarray(const indirect_array<value_type>& __ia);
- inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
- ~valarray();
-
- // assignment:
- valarray& operator=(const valarray& __v);
+ valarray(const slice_array<value_type>& __sa);
+ valarray(const gslice_array<value_type>& __ga);
+ valarray(const mask_array<value_type>& __ma);
+ valarray(const indirect_array<value_type>& __ia);
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 ~valarray();
+
+ // assignment:
+ valarray& operator=(const valarray& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(valarray&& __v) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(initializer_list<value_type>);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(valarray&& __v) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(initializer_list<value_type>);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const slice_array<value_type>& __sa);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const gslice_array<value_type>& __ga);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const mask_array<value_type>& __ma);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const indirect_array<value_type>& __ia);
- template <class _ValExpr>
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator=(const __val_expr<_ValExpr>& __v);
-
- // element access:
- _LIBCPP_HIDE_FROM_ABI
- const value_type& operator[](size_t __i) const {return __begin_[__i];}
-
- _LIBCPP_HIDE_FROM_ABI
- value_type& operator[](size_t __i) {return __begin_[__i];}
-
- // subset operations:
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
- _LIBCPP_HIDE_FROM_ABI
- slice_array<value_type> operator[](slice __s);
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
- _LIBCPP_HIDE_FROM_ABI
- gslice_array<value_type> operator[](const gslice& __gs);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const slice_array<value_type>& __sa);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const gslice_array<value_type>& __ga);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const mask_array<value_type>& __ma);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const indirect_array<value_type>& __ia);
+ template <class _ValExpr>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator=(const __val_expr<_ValExpr>& __v);
+
+ // element access:
+ _LIBCPP_HIDE_FROM_ABI const value_type& operator[](size_t __i) const { return __begin_[__i]; }
+
+ _LIBCPP_HIDE_FROM_ABI value_type& operator[](size_t __i) { return __begin_[__i]; }
+
+ // subset operations:
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
+ _LIBCPP_HIDE_FROM_ABI slice_array<value_type> operator[](slice __s);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
+ _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](const gslice& __gs);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
- _LIBCPP_HIDE_FROM_ABI
- gslice_array<value_type> operator[](gslice&& __gs);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
+ _LIBCPP_HIDE_FROM_ABI gslice_array<value_type> operator[](gslice&& __gs);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
- _LIBCPP_HIDE_FROM_ABI
- mask_array<value_type> operator[](const valarray<bool>& __vb);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
+ _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](const valarray<bool>& __vb);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
- _LIBCPP_HIDE_FROM_ABI
- mask_array<value_type> operator[](valarray<bool>&& __vb);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
+ _LIBCPP_HIDE_FROM_ABI mask_array<value_type> operator[](valarray<bool>&& __vb);
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
- _LIBCPP_HIDE_FROM_ABI
- indirect_array<value_type> operator[](const valarray<size_t>& __vs);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
+ _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](const valarray<size_t>& __vs);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
- _LIBCPP_HIDE_FROM_ABI
- indirect_array<value_type> operator[](valarray<size_t>&& __vs);
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
+ _LIBCPP_HIDE_FROM_ABI indirect_array<value_type> operator[](valarray<size_t>&& __vs);
#endif // _LIBCPP_CXX03_LANG
- // unary operators:
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray&> > operator+() const;
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<negate<_Tp>, const valarray&> > operator-() const;
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__bit_not<_Tp>, const valarray&> > operator~() const;
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<logical_not<_Tp>, const valarray&> > operator!() const;
+ // unary operators:
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray&> > operator+() const;
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<negate<_Tp>, const valarray&> > operator-() const;
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__bit_not<_Tp>, const valarray&> > operator~() const;
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<logical_not<_Tp>, const valarray&> > operator!() const;
- // computed assignment:
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator*= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator/= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator%= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator+= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator-= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator^= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator&= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator|= (const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator<<=(const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI
- valarray& operator>>=(const value_type& __x);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator*= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator/= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator%= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator+= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator-= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator^= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator|= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator&= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator<<= (const _Expr& __v);
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI valarray&
- operator>>= (const _Expr& __v);
+ // computed assignment:
+ _LIBCPP_HIDE_FROM_ABI valarray& operator*=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator/=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator%=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator+=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator-=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator^=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator&=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator|=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator<<=(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI valarray& operator>>=(const value_type& __x);
- // member functions:
- _LIBCPP_HIDE_FROM_ABI
- void swap(valarray& __v) _NOEXCEPT;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator*=(const _Expr& __v);
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator/=(const _Expr& __v);
- _LIBCPP_HIDE_FROM_ABI
- value_type sum() const;
- _LIBCPP_HIDE_FROM_ABI
- value_type min() const;
- _LIBCPP_HIDE_FROM_ABI
- value_type max() const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator%=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator+=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator-=(const _Expr& __v);
- valarray shift (int __i) const;
- valarray cshift(int __i) const;
- valarray apply(value_type __f(value_type)) const;
- valarray apply(value_type __f(const value_type&)) const;
- void resize(size_t __n, value_type __x = value_type());
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator^=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator|=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator&=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator<<=(const _Expr& __v);
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI valarray& operator>>=(const _Expr& __v);
+
+ // member functions:
+ _LIBCPP_HIDE_FROM_ABI void swap(valarray& __v) _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return static_cast<size_t>(__end_ - __begin_); }
+
+ _LIBCPP_HIDE_FROM_ABI value_type sum() const;
+ _LIBCPP_HIDE_FROM_ABI value_type min() const;
+ _LIBCPP_HIDE_FROM_ABI value_type max() const;
+
+ valarray shift(int __i) const;
+ valarray cshift(int __i) const;
+ valarray apply(value_type __f(value_type)) const;
+ valarray apply(value_type __f(const value_type&)) const;
+ void resize(size_t __n, value_type __x = value_type());
private:
- template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
- template <class> friend class _LIBCPP_TEMPLATE_VIS slice_array;
- template <class> friend class _LIBCPP_TEMPLATE_VIS gslice_array;
- template <class> friend class _LIBCPP_TEMPLATE_VIS mask_array;
- template <class> friend class __mask_expr;
- template <class> friend class _LIBCPP_TEMPLATE_VIS indirect_array;
- template <class> friend class __indirect_expr;
- template <class> friend class __val_expr;
-
- template <class _Up>
- friend
- _Up*
- begin(valarray<_Up>& __v);
-
- template <class _Up>
- friend
- const _Up*
- begin(const valarray<_Up>& __v);
-
- template <class _Up>
- friend
- _Up*
- end(valarray<_Up>& __v);
-
- template <class _Up>
- friend
- const _Up*
- end(const valarray<_Up>& __v);
-
- _LIBCPP_HIDE_FROM_ABI
- void __clear(size_t __capacity);
- valarray& __assign_range(const value_type* __f, const value_type* __l);
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS valarray;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS slice_array;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS gslice_array;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS mask_array;
+ template <class>
+ friend class __mask_expr;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS indirect_array;
+ template <class>
+ friend class __indirect_expr;
+ template <class>
+ friend class __val_expr;
+
+ template <class _Up>
+ friend _Up* begin(valarray<_Up>& __v);
+
+ template <class _Up>
+ friend const _Up* begin(const valarray<_Up>& __v);
+
+ template <class _Up>
+ friend _Up* end(valarray<_Up>& __v);
+
+ template <class _Up>
+ friend const _Up* end(const valarray<_Up>& __v);
+
+ _LIBCPP_HIDE_FROM_ABI void __clear(size_t __capacity);
+ valarray& __assign_range(const value_type* __f, const value_type* __l);
};
#if _LIBCPP_STD_VER >= 17
-template<class _Tp, size_t _Size>
-valarray(const _Tp(&)[_Size], size_t) -> valarray<_Tp>;
+template <class _Tp, size_t _Size>
+valarray(const _Tp (&)[_Size], size_t) -> valarray<_Tp>;
#endif
extern template _LIBCPP_EXPORTED_FROM_ABI void valarray<size_t>::resize(size_t, size_t);
template <class _Op, class _Tp>
-struct _UnaryOp<_Op, valarray<_Tp> >
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _UnaryOp<_Op, valarray<_Tp> > {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- const valarray<_Tp>& __a0_;
+ _Op __op_;
+ const valarray<_Tp>& __a0_;
- _LIBCPP_HIDE_FROM_ABI
- _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
+ _LIBCPP_HIDE_FROM_ABI _UnaryOp(const _Op& __op, const valarray<_Tp>& __a0) : __op_(__op), __a0_(__a0) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _Tp, class _A1>
-struct _BinaryOp<_Op, valarray<_Tp>, _A1>
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp<_Op, valarray<_Tp>, _A1> {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- const valarray<_Tp>& __a0_;
- _A1 __a1_;
+ _Op __op_;
+ const valarray<_Tp>& __a0_;
+ _A1 __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const _A1& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _A0, class _Tp>
-struct _BinaryOp<_Op, _A0, valarray<_Tp> >
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp<_Op, _A0, valarray<_Tp> > {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- _A0 __a0_;
- const valarray<_Tp>& __a1_;
+ _Op __op_;
+ _A0 __a0_;
+ const valarray<_Tp>& __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const _A0& __a0, const valarray<_Tp>& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
template <class _Op, class _Tp>
-struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
-{
- typedef typename _Op::__result_type __result_type;
- using value_type = __decay_t<__result_type>;
+struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> > {
+ typedef typename _Op::__result_type __result_type;
+ using value_type = __decay_t<__result_type>;
- _Op __op_;
- const valarray<_Tp>& __a0_;
- const valarray<_Tp>& __a1_;
+ _Op __op_;
+ const valarray<_Tp>& __a0_;
+ const valarray<_Tp>& __a1_;
- _LIBCPP_HIDE_FROM_ABI
- _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
- : __op_(__op), __a0_(__a0), __a1_(__a1) {}
+ _LIBCPP_HIDE_FROM_ABI _BinaryOp(const _Op& __op, const valarray<_Tp>& __a0, const valarray<_Tp>& __a1)
+ : __op_(__op), __a0_(__a0), __a1_(__a1) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const {return __op_(__a0_[__i], __a1_[__i]);}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __op_(__a0_[__i], __a1_[__i]); }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __a0_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __a0_.size(); }
};
// slice_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS slice_array
-{
+class _LIBCPP_TEMPLATE_VIS slice_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- size_t __size_;
- size_t __stride_;
+ value_type* __vp_;
+ size_t __size_;
+ size_t __stride_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- slice_array(slice_array const&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- const slice_array& operator=(const slice_array& __sa) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const valarray<value_type>& __va) const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ slice_array(slice_array const&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI const slice_array& operator=(const slice_array& __sa) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const valarray<value_type>& __va) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- slice_array(const slice& __sl, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())),
- __size_(__sl.size()),
- __stride_(__sl.stride())
- {}
-
- template <class> friend class valarray;
+ _LIBCPP_HIDE_FROM_ABI slice_array(const slice& __sl, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_ + __sl.start())), __size_(__sl.size()), __stride_(__sl.stride()) {}
+
+ template <class>
+ friend class valarray;
};
template <class _Tp>
-inline
-const slice_array<_Tp>&
-slice_array<_Tp>::operator=(const slice_array& __sa) const
-{
- value_type* __t = __vp_;
- const value_type* __s = __sa.__vp_;
- for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
- *__t = *__s;
- return *this;
+inline const slice_array<_Tp>& slice_array<_Tp>::operator=(const slice_array& __sa) const {
+ value_type* __t = __vp_;
+ const value_type* __s = __sa.__vp_;
+ for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
+ *__t = *__s;
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t = __v[__i];
+inline void slice_array<_Tp>::operator=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t = __v[__i];
}
template <class _Tp>
-inline void
-slice_array<_Tp>::operator=(const valarray<value_type>& __va) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __va.size(); ++__i, __t += __stride_)
- *__t = __va[__i];
+inline void slice_array<_Tp>::operator=(const valarray<value_type>& __va) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __va.size(); ++__i, __t += __stride_)
+ *__t = __va[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator*=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t *= __v[__i];
+inline void slice_array<_Tp>::operator*=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t *= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator/=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t /= __v[__i];
+inline void slice_array<_Tp>::operator/=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t /= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator%=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t %= __v[__i];
+inline void slice_array<_Tp>::operator%=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t %= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator+=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t += __v[__i];
+inline void slice_array<_Tp>::operator+=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t += __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator-=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t -= __v[__i];
+inline void slice_array<_Tp>::operator-=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t -= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator^=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t ^= __v[__i];
+inline void slice_array<_Tp>::operator^=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t ^= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator&=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t &= __v[__i];
+inline void slice_array<_Tp>::operator&=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t &= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator|=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t |= __v[__i];
+inline void slice_array<_Tp>::operator|=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t |= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t <<= __v[__i];
+inline void slice_array<_Tp>::operator<<=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t <<= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-slice_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- value_type* __t = __vp_;
- for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
- *__t >>= __v[__i];
+inline void slice_array<_Tp>::operator>>=(const _Expr& __v) const {
+ value_type* __t = __vp_;
+ for (size_t __i = 0; __i < __size_; ++__i, __t += __stride_)
+ *__t >>= __v[__i];
}
template <class _Tp>
-inline
-void
-slice_array<_Tp>::operator=(const value_type& __x) const
-{
- value_type* __t = __vp_;
- for (size_t __n = __size_; __n; --__n, __t += __stride_)
- *__t = __x;
+inline void slice_array<_Tp>::operator=(const value_type& __x) const {
+ value_type* __t = __vp_;
+ for (size_t __n = __size_; __n; --__n, __t += __stride_)
+ *__t = __x;
}
// gslice
-class _LIBCPP_EXPORTED_FROM_ABI gslice
-{
- valarray<size_t> __size_;
- valarray<size_t> __stride_;
- valarray<size_t> __1d_;
+class _LIBCPP_EXPORTED_FROM_ABI gslice {
+ valarray<size_t> __size_;
+ valarray<size_t> __stride_;
+ valarray<size_t> __1d_;
public:
- _LIBCPP_HIDE_FROM_ABI
- gslice() {}
+ _LIBCPP_HIDE_FROM_ABI gslice() {}
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, const valarray<size_t>& __size,
- const valarray<size_t>& __stride)
- : __size_(__size),
- __stride_(__stride)
- {__init(__start);}
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, const valarray<size_t>& __size, const valarray<size_t>& __stride)
+ : __size_(__size), __stride_(__stride) {
+ __init(__start);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, const valarray<size_t>& __size,
- valarray<size_t>&& __stride)
- : __size_(__size),
- __stride_(std::move(__stride))
- {__init(__start);}
-
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, valarray<size_t>&& __size,
- const valarray<size_t>& __stride)
- : __size_(std::move(__size)),
- __stride_(__stride)
- {__init(__start);}
-
- _LIBCPP_HIDE_FROM_ABI
- gslice(size_t __start, valarray<size_t>&& __size,
- valarray<size_t>&& __stride)
- : __size_(std::move(__size)),
- __stride_(std::move(__stride))
- {__init(__start);}
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, const valarray<size_t>& __size, valarray<size_t>&& __stride)
+ : __size_(__size), __stride_(std::move(__stride)) {
+ __init(__start);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, valarray<size_t>&& __size, const valarray<size_t>& __stride)
+ : __size_(std::move(__size)), __stride_(__stride) {
+ __init(__start);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI gslice(size_t __start, valarray<size_t>&& __size, valarray<size_t>&& __stride)
+ : __size_(std::move(__size)), __stride_(std::move(__stride)) {
+ __init(__start);
+ }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
+ _LIBCPP_HIDE_FROM_ABI size_t start() const { return __1d_.size() ? __1d_[0] : 0; }
- _LIBCPP_HIDE_FROM_ABI
- valarray<size_t> size() const {return __size_;}
+ _LIBCPP_HIDE_FROM_ABI valarray<size_t> size() const { return __size_; }
- _LIBCPP_HIDE_FROM_ABI
- valarray<size_t> stride() const {return __stride_;}
+ _LIBCPP_HIDE_FROM_ABI valarray<size_t> stride() const { return __stride_; }
private:
- void __init(size_t __start);
-
- template <class> friend class gslice_array;
- template <class> friend class valarray;
- template <class> friend class __val_expr;
+ void __init(size_t __start);
+
+ template <class>
+ friend class gslice_array;
+ template <class>
+ friend class valarray;
+ template <class>
+ friend class __val_expr;
};
// gslice_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS gslice_array
-{
+class _LIBCPP_TEMPLATE_VIS gslice_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- valarray<size_t> __1d_;
+ value_type* __vp_;
+ valarray<size_t> __1d_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- _LIBCPP_HIDE_FROM_ABI
- const gslice_array& operator=(const gslice_array& __ga) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
-
- gslice_array(const gslice_array&) = default;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ _LIBCPP_HIDE_FROM_ABI const gslice_array& operator=(const gslice_array& __ga) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
+
+ gslice_array(const gslice_array&) = default;
private:
- gslice_array(const gslice& __gs, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(__gs.__1d_)
- {}
+ gslice_array(const gslice& __gs, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(__gs.__1d_) {}
#ifndef _LIBCPP_CXX03_LANG
- gslice_array(gslice&& __gs, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(std::move(__gs.__1d_))
- {}
+ gslice_array(gslice&& __gs, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(std::move(__gs.__1d_)) {}
#endif // _LIBCPP_CXX03_LANG
- template <class> friend class valarray;
+ template <class>
+ friend class valarray;
};
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] = __v[__j];
+inline void gslice_array<_Tp>::operator=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] = __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator*=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] *= __v[__j];
+inline void gslice_array<_Tp>::operator*=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] *= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator/=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] /= __v[__j];
+inline void gslice_array<_Tp>::operator/=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] /= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator%=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] %= __v[__j];
+inline void gslice_array<_Tp>::operator%=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] %= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator+=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] += __v[__j];
+inline void gslice_array<_Tp>::operator+=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] += __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator-=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] -= __v[__j];
+inline void gslice_array<_Tp>::operator-=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] -= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator^=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] ^= __v[__j];
+inline void gslice_array<_Tp>::operator^=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] ^= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator&=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] &= __v[__j];
+inline void gslice_array<_Tp>::operator&=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] &= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator|=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] |= __v[__j];
+inline void gslice_array<_Tp>::operator|=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] |= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] <<= __v[__j];
+inline void gslice_array<_Tp>::operator<<=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] <<= __v[__j];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-gslice_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- typedef const size_t* _Ip;
- size_t __j = 0;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
- __vp_[*__i] >>= __v[__j];
+inline void gslice_array<_Tp>::operator>>=(const _Expr& __v) const {
+ typedef const size_t* _Ip;
+ size_t __j = 0;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] >>= __v[__j];
}
template <class _Tp>
-inline
-const gslice_array<_Tp>&
-gslice_array<_Tp>::operator=(const gslice_array& __ga) const
-{
- typedef const size_t* _Ip;
- const value_type* __s = __ga.__vp_;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_;
- __i != __e; ++__i, ++__j)
- __vp_[*__i] = __s[*__j];
- return *this;
+inline const gslice_array<_Tp>& gslice_array<_Tp>::operator=(const gslice_array& __ga) const {
+ typedef const size_t* _Ip;
+ const value_type* __s = __ga.__vp_;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ga.__1d_.__begin_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] = __s[*__j];
+ return *this;
}
template <class _Tp>
-inline
-void
-gslice_array<_Tp>::operator=(const value_type& __x) const
-{
- typedef const size_t* _Ip;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
- __vp_[*__i] = __x;
+inline void gslice_array<_Tp>::operator=(const value_type& __x) const {
+ typedef const size_t* _Ip;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
+ __vp_[*__i] = __x;
}
// mask_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS mask_array
-{
+class _LIBCPP_TEMPLATE_VIS mask_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- valarray<size_t> __1d_;
+ value_type* __vp_;
+ valarray<size_t> __1d_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- mask_array(const mask_array&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- const mask_array& operator=(const mask_array& __ma) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ mask_array(const mask_array&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI const mask_array& operator=(const mask_array& __ma) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
- {
- size_t __j = 0;
- for (size_t __i = 0; __i < __vb.size(); ++__i)
- if (__vb[__i])
- __1d_[__j++] = __i;
- }
-
- template <class> friend class valarray;
+ _LIBCPP_HIDE_FROM_ABI mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)),
+ __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true))) {
+ size_t __j = 0;
+ for (size_t __i = 0; __i < __vb.size(); ++__i)
+ if (__vb[__i])
+ __1d_[__j++] = __i;
+ }
+
+ template <class>
+ friend class valarray;
};
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __v[__i];
+inline void mask_array<_Tp>::operator=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator*=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] *= __v[__i];
+inline void mask_array<_Tp>::operator*=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] *= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator/=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] /= __v[__i];
+inline void mask_array<_Tp>::operator/=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] /= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator%=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] %= __v[__i];
+inline void mask_array<_Tp>::operator%=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] %= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator+=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] += __v[__i];
+inline void mask_array<_Tp>::operator+=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] += __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator-=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] -= __v[__i];
+inline void mask_array<_Tp>::operator-=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] -= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator^=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] ^= __v[__i];
+inline void mask_array<_Tp>::operator^=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] ^= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator&=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] &= __v[__i];
+inline void mask_array<_Tp>::operator&=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] &= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator|=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] |= __v[__i];
+inline void mask_array<_Tp>::operator|=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] |= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] <<= __v[__i];
+inline void mask_array<_Tp>::operator<<=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] <<= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- void
-mask_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] >>= __v[__i];
+inline void mask_array<_Tp>::operator>>=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] >>= __v[__i];
}
template <class _Tp>
-inline
-const mask_array<_Tp>&
-mask_array<_Tp>::operator=(const mask_array& __ma) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
- return *this;
+inline const mask_array<_Tp>& mask_array<_Tp>::operator=(const mask_array& __ma) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
+ return *this;
}
template <class _Tp>
-inline
-void
-mask_array<_Tp>::operator=(const value_type& __x) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __x;
+inline void mask_array<_Tp>::operator=(const value_type& __x) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __x;
}
template <class _ValExpr>
-class __mask_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __mask_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- valarray<size_t> __1d_;
-
- _LIBCPP_HIDE_FROM_ABI
- __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
- : __expr_(__e),
- __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
- {
- size_t __j = 0;
- for (size_t __i = 0; __i < __vb.size(); ++__i)
- if (__vb[__i])
- __1d_[__j++] = __i;
- }
+ _ValExpr __expr_;
+ valarray<size_t> __1d_;
+
+ _LIBCPP_HIDE_FROM_ABI __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
+ : __expr_(__e), __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true))) {
+ size_t __j = 0;
+ for (size_t __i = 0; __i < __vb.size(); ++__i)
+ if (__vb[__i])
+ __1d_[__j++] = __i;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__1d_[__i]];}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__1d_[__i]]; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __1d_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __1d_.size(); }
- template <class> friend class __val_expr;
- template <class> friend class valarray;
+ template <class>
+ friend class __val_expr;
+ template <class>
+ friend class valarray;
};
// indirect_array
template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS indirect_array
-{
+class _LIBCPP_TEMPLATE_VIS indirect_array {
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
private:
- value_type* __vp_;
- valarray<size_t> __1d_;
+ value_type* __vp_;
+ valarray<size_t> __1d_;
public:
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator*=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator/=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator%=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator+=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator-=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator^=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator&=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator|=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator<<=(const _Expr& __v) const;
-
- template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI
- operator>>=(const _Expr& __v) const;
-
- indirect_array(const indirect_array&) = default;
-
- _LIBCPP_HIDE_FROM_ABI
- const indirect_array& operator=(const indirect_array& __ia) const;
-
- _LIBCPP_HIDE_FROM_ABI
- void operator=(const value_type& __x) const;
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator*=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator/=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator%=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator+=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator-=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator^=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator&=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator|=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator<<=(const _Expr& __v) const;
+
+ template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI operator>>=(const _Expr& __v) const;
+
+ indirect_array(const indirect_array&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI const indirect_array& operator=(const indirect_array& __ia) const;
+
+ _LIBCPP_HIDE_FROM_ABI void operator=(const value_type& __x) const;
private:
- _LIBCPP_HIDE_FROM_ABI
- indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(__ia)
- {}
+ _LIBCPP_HIDE_FROM_ABI indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(__ia) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
- : __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(std::move(__ia))
- {}
+ _LIBCPP_HIDE_FROM_ABI indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
+ : __vp_(const_cast<value_type*>(__v.__begin_)), __1d_(std::move(__ia)) {}
#endif // _LIBCPP_CXX03_LANG
- template <class> friend class valarray;
+ template <class>
+ friend class valarray;
};
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] = __v[__i];
+inline void indirect_array<_Tp>::operator=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] = __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator*=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] *= __v[__i];
+inline void indirect_array<_Tp>::operator*=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] *= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator/=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] /= __v[__i];
+inline void indirect_array<_Tp>::operator/=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] /= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator%=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] %= __v[__i];
+inline void indirect_array<_Tp>::operator%=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] %= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator+=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] += __v[__i];
+inline void indirect_array<_Tp>::operator+=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] += __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator-=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] -= __v[__i];
+inline void indirect_array<_Tp>::operator-=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] -= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator^=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] ^= __v[__i];
+inline void indirect_array<_Tp>::operator^=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] ^= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator&=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] &= __v[__i];
+inline void indirect_array<_Tp>::operator&=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] &= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator|=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] |= __v[__i];
+inline void indirect_array<_Tp>::operator|=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] |= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator<<=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] <<= __v[__i];
+inline void indirect_array<_Tp>::operator<<=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] <<= __v[__i];
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
-void
-indirect_array<_Tp>::operator>>=(const _Expr& __v) const
-{
- size_t __n = __1d_.size();
- for (size_t __i = 0; __i < __n; ++__i)
- __vp_[__1d_[__i]] >>= __v[__i];
+inline void indirect_array<_Tp>::operator>>=(const _Expr& __v) const {
+ size_t __n = __1d_.size();
+ for (size_t __i = 0; __i < __n; ++__i)
+ __vp_[__1d_[__i]] >>= __v[__i];
}
template <class _Tp>
-inline
-const indirect_array<_Tp>&
-indirect_array<_Tp>::operator=(const indirect_array& __ia) const
-{
- typedef const size_t* _Ip;
- const value_type* __s = __ia.__vp_;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_;
- __i != __e; ++__i, ++__j)
- __vp_[*__i] = __s[*__j];
- return *this;
+inline const indirect_array<_Tp>& indirect_array<_Tp>::operator=(const indirect_array& __ia) const {
+ typedef const size_t* _Ip;
+ const value_type* __s = __ia.__vp_;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_, __j = __ia.__1d_.__begin_; __i != __e; ++__i, ++__j)
+ __vp_[*__i] = __s[*__j];
+ return *this;
}
template <class _Tp>
-inline
-void
-indirect_array<_Tp>::operator=(const value_type& __x) const
-{
- typedef const size_t* _Ip;
- for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
- __vp_[*__i] = __x;
+inline void indirect_array<_Tp>::operator=(const value_type& __x) const {
+ typedef const size_t* _Ip;
+ for (_Ip __i = __1d_.__begin_, __e = __1d_.__end_; __i != __e; ++__i)
+ __vp_[*__i] = __x;
}
template <class _ValExpr>
-class __indirect_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+class __indirect_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
public:
- typedef typename _RmExpr::value_type value_type;
- typedef value_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef value_type __result_type;
private:
- _ValExpr __expr_;
- valarray<size_t> __1d_;
+ _ValExpr __expr_;
+ valarray<size_t> __1d_;
- _LIBCPP_HIDE_FROM_ABI
- __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e)
- : __expr_(__e),
- __1d_(__ia)
- {}
+ _LIBCPP_HIDE_FROM_ABI __indirect_expr(const valarray<size_t>& __ia, const _RmExpr& __e) : __expr_(__e), __1d_(__ia) {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI
- __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
- : __expr_(__e),
- __1d_(std::move(__ia))
- {}
+ _LIBCPP_HIDE_FROM_ABI __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
+ : __expr_(__e), __1d_(std::move(__ia)) {}
#endif // _LIBCPP_CXX03_LANG
public:
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__1d_[__i]];}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__1d_[__i]]; }
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __1d_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __1d_.size(); }
- template <class> friend class __val_expr;
- template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
+ template <class>
+ friend class __val_expr;
+ template <class>
+ friend class _LIBCPP_TEMPLATE_VIS valarray;
};
-template<class _ValExpr>
-class __val_expr
-{
- typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+template <class _ValExpr>
+class __val_expr {
+ typedef __libcpp_remove_reference_t<_ValExpr> _RmExpr;
+
+ _ValExpr __expr_;
- _ValExpr __expr_;
public:
- typedef typename _RmExpr::value_type value_type;
- typedef typename _RmExpr::__result_type __result_type;
+ typedef typename _RmExpr::value_type value_type;
+ typedef typename _RmExpr::__result_type __result_type;
- _LIBCPP_HIDE_FROM_ABI
- explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
+ _LIBCPP_HIDE_FROM_ABI explicit __val_expr(const _RmExpr& __e) : __expr_(__e) {}
- _LIBCPP_HIDE_FROM_ABI
- __result_type operator[](size_t __i) const
- {return __expr_[__i];}
+ _LIBCPP_HIDE_FROM_ABI __result_type operator[](size_t __i) const { return __expr_[__i]; }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
- {
- typedef __slice_expr<_ValExpr> _NewExpr;
- return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const {
+ typedef __slice_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
- {
- typedef __indirect_expr<_ValExpr> _NewExpr;
- return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const {
+ typedef __indirect_expr<_ValExpr> _NewExpr;
+ return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
- {
- typedef __mask_expr<_ValExpr> _NewExpr;
- return __val_expr< _NewExpr >( _NewExpr(__vb, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const {
+ typedef __mask_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__vb, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
- {
- typedef __indirect_expr<_ValExpr> _NewExpr;
- return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const {
+ typedef __indirect_expr<_ValExpr> _NewExpr;
+ return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
- operator+() const
- {
- typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> > operator+() const {
+ typedef _UnaryOp<__unary_plus<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(__unary_plus<value_type>(), __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<negate<value_type>, _ValExpr> >
- operator-() const
- {
- typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<negate<value_type>, _ValExpr> > operator-() const {
+ typedef _UnaryOp<negate<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(negate<value_type>(), __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> >
- operator~() const
- {
- typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__bit_not<value_type>, _ValExpr> > operator~() const {
+ typedef _UnaryOp<__bit_not<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(__bit_not<value_type>(), __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> >
- operator!() const
- {
- typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<logical_not<value_type>, _ValExpr> > operator!() const {
+ typedef _UnaryOp<logical_not<value_type>, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(logical_not<value_type>(), __expr_));
+ }
- operator valarray<__result_type>() const;
+ operator valarray<__result_type>() const;
- _LIBCPP_HIDE_FROM_ABI
- size_t size() const {return __expr_.size();}
+ _LIBCPP_HIDE_FROM_ABI size_t size() const { return __expr_.size(); }
- _LIBCPP_HIDE_FROM_ABI
- __result_type sum() const
- {
- size_t __n = __expr_.size();
- __result_type __r = __n ? __expr_[0] : __result_type();
- for (size_t __i = 1; __i < __n; ++__i)
- __r += __expr_[__i];
- return __r;
- }
+ _LIBCPP_HIDE_FROM_ABI __result_type sum() const {
+ size_t __n = __expr_.size();
+ __result_type __r = __n ? __expr_[0] : __result_type();
+ for (size_t __i = 1; __i < __n; ++__i)
+ __r += __expr_[__i];
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type min() const
- {
- size_t __n = size();
- __result_type __r = __n ? (*this)[0] : __result_type();
- for (size_t __i = 1; __i < __n; ++__i)
- {
- __result_type __x = __expr_[__i];
- if (__x < __r)
- __r = __x;
- }
- return __r;
+ _LIBCPP_HIDE_FROM_ABI __result_type min() const {
+ size_t __n = size();
+ __result_type __r = __n ? (*this)[0] : __result_type();
+ for (size_t __i = 1; __i < __n; ++__i) {
+ __result_type __x = __expr_[__i];
+ if (__x < __r)
+ __r = __x;
}
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __result_type max() const
- {
- size_t __n = size();
- __result_type __r = __n ? (*this)[0] : __result_type();
- for (size_t __i = 1; __i < __n; ++__i)
- {
- __result_type __x = __expr_[__i];
- if (__r < __x)
- __r = __x;
- }
- return __r;
+ _LIBCPP_HIDE_FROM_ABI __result_type max() const {
+ size_t __n = size();
+ __result_type __r = __n ? (*this)[0] : __result_type();
+ for (size_t __i = 1; __i < __n; ++__i) {
+ __result_type __x = __expr_[__i];
+ if (__r < __x)
+ __r = __x;
}
+ return __r;
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__shift_expr<_ValExpr> > shift (int __i) const
- {return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));}
-
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const
- {return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));}
-
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(value_type)>, _ValExpr> >
- apply(value_type __f(value_type)) const
- {
- typedef __apply_expr<value_type, value_type(*)(value_type)> _Op;
- typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__shift_expr<_ValExpr> > shift(int __i) const {
+ return __val_expr<__shift_expr<_ValExpr> >(__shift_expr<_ValExpr>(__i, __expr_));
+ }
- _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__apply_expr<value_type, value_type(*)(const value_type&)>, _ValExpr> >
- apply(value_type __f(const value_type&)) const
- {
- typedef __apply_expr<value_type, value_type(*)(const value_type&)> _Op;
- typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
- return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
- }
+ _LIBCPP_HIDE_FROM_ABI __val_expr<__cshift_expr<_ValExpr> > cshift(int __i) const {
+ return __val_expr<__cshift_expr<_ValExpr> >(__cshift_expr<_ValExpr>(__i, __expr_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__apply_expr<value_type, value_type (*)(value_type)>, _ValExpr> >
+ apply(value_type __f(value_type)) const {
+ typedef __apply_expr<value_type, value_type (*)(value_type)> _Op;
+ typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__apply_expr<value_type, value_type (*)(const value_type&)>, _ValExpr> >
+ apply(value_type __f(const value_type&)) const {
+ typedef __apply_expr<value_type, value_type (*)(const value_type&)> _Op;
+ typedef _UnaryOp<_Op, _ValExpr> _NewExpr;
+ return __val_expr<_NewExpr>(_NewExpr(_Op(__f), __expr_));
+ }
};
-template<class _ValExpr>
-__val_expr<_ValExpr>::operator valarray<__val_expr::__result_type>() const
-{
- valarray<__result_type> __r;
- size_t __n = __expr_.size();
- if (__n)
- {
- __r.__begin_ =
- __r.__end_ = allocator<__result_type>().allocate(__n);
- for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
- ::new ((void*)__r.__end_) __result_type(__expr_[__i]);
- }
- return __r;
+template <class _ValExpr>
+__val_expr<_ValExpr>::operator valarray<__val_expr::__result_type>() const {
+ valarray<__result_type> __r;
+ size_t __n = __expr_.size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<__result_type>().allocate(__n);
+ for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
+ ::new ((void*)__r.__end_) __result_type(__expr_[__i]);
+ }
+ return __r;
}
// valarray
template <class _Tp>
-inline
-valarray<_Tp>::valarray(size_t __n)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+inline valarray<_Tp>::valarray(size_t __n) : __begin_(nullptr), __end_(nullptr) {
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
- ::new ((void*)__end_) value_type();
+ for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
+ ::new ((void*)__end_) value_type();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-inline
-valarray<_Tp>::valarray(const value_type& __x, size_t __n)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- resize(__n, __x);
+inline valarray<_Tp>::valarray(const value_type& __x, size_t __n) : __begin_(nullptr), __end_(nullptr) {
+ resize(__n, __x);
}
template <class _Tp>
-valarray<_Tp>::valarray(const value_type* __p, size_t __n)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const value_type* __p, size_t __n) : __begin_(nullptr), __end_(nullptr) {
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
- ::new ((void*)__end_) value_type(*__p);
+ for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
+ ::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const valarray& __v)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- if (__v.size())
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__v.size());
+valarray<_Tp>::valarray(const valarray& __v) : __begin_(nullptr), __end_(nullptr) {
+ if (__v.size()) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__v.size());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
- ::new ((void*)__end_) value_type(*__p);
+ for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
+ ::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__v.size());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__v.size());
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
- : __begin_(__v.__begin_),
- __end_(__v.__end_)
-{
- __v.__begin_ = __v.__end_ = nullptr;
+inline valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT : __begin_(__v.__begin_), __end_(__v.__end_) {
+ __v.__begin_ = __v.__end_ = nullptr;
}
template <class _Tp>
-valarray<_Tp>::valarray(initializer_list<value_type> __il)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __il.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- size_t __n_left = __n;
- for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
- ::new ((void*)__end_) value_type(*__p);
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+valarray<_Tp>::valarray(initializer_list<value_type> __il) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __il.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ size_t __n_left = __n;
+ for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
+ ::new ((void*)__end_) value_type(*__p);
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __sa.__size_;
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const slice_array<value_type>& __sa) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __sa.__size_;
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- size_t __n_left = __n;
- for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
- ::new ((void*)__end_) value_type(*__p);
+ size_t __n_left = __n;
+ for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
+ ::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __ga.__1d_.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const gslice_array<value_type>& __ga) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __ga.__1d_.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef const size_t* _Ip;
- const value_type* __s = __ga.__vp_;
- for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
- __i != __e; ++__i, ++__end_)
- ::new ((void*)__end_) value_type(__s[*__i]);
+ typedef const size_t* _Ip;
+ const value_type* __s = __ga.__vp_;
+ for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__end_)
+ ::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __ma.__1d_.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const mask_array<value_type>& __ma) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __ma.__1d_.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef const size_t* _Ip;
- const value_type* __s = __ma.__vp_;
- for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
- __i != __e; ++__i, ++__end_)
- ::new ((void*)__end_) value_type(__s[*__i]);
+ typedef const size_t* _Ip;
+ const value_type* __s = __ma.__vp_;
+ for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__end_)
+ ::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
- : __begin_(nullptr),
- __end_(nullptr)
-{
- const size_t __n = __ia.__1d_.size();
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+valarray<_Tp>::valarray(const indirect_array<value_type>& __ia) : __begin_(nullptr), __end_(nullptr) {
+ const size_t __n = __ia.__1d_.size();
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef const size_t* _Ip;
- const value_type* __s = __ia.__vp_;
- for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
- __i != __e; ++__i, ++__end_)
- ::new ((void*)__end_) value_type(__s[*__i]);
+ typedef const size_t* _Ip;
+ const value_type* __s = __ia.__vp_;
+ for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__end_)
+ ::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp>
-inline
-valarray<_Tp>::~valarray()
-{
- __clear(size());
+inline valarray<_Tp>::~valarray() {
+ __clear(size());
}
template <class _Tp>
-valarray<_Tp>&
-valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l)
-{
- size_t __n = __l - __f;
- if (size() != __n)
- {
- __clear(size());
- __begin_ = allocator<value_type>().allocate(__n);
- __end_ = __begin_ + __n;
- std::uninitialized_copy(__f, __l, __begin_);
- } else {
- std::copy(__f, __l, __begin_);
- }
- return *this;
+valarray<_Tp>& valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l) {
+ size_t __n = __l - __f;
+ if (size() != __n) {
+ __clear(size());
+ __begin_ = allocator<value_type>().allocate(__n);
+ __end_ = __begin_ + __n;
+ std::uninitialized_copy(__f, __l, __begin_);
+ } else {
+ std::copy(__f, __l, __begin_);
+ }
+ return *this;
}
template <class _Tp>
-valarray<_Tp>&
-valarray<_Tp>::operator=(const valarray& __v)
-{
- if (this != std::addressof(__v))
- return __assign_range(__v.__begin_, __v.__end_);
- return *this;
+valarray<_Tp>& valarray<_Tp>::operator=(const valarray& __v) {
+ if (this != std::addressof(__v))
+ return __assign_range(__v.__begin_, __v.__end_);
+ return *this;
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
-{
- __clear(size());
- __begin_ = __v.__begin_;
- __end_ = __v.__end_;
- __v.__begin_ = nullptr;
- __v.__end_ = nullptr;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT {
+ __clear(size());
+ __begin_ = __v.__begin_;
+ __end_ = __v.__end_;
+ __v.__begin_ = nullptr;
+ __v.__end_ = nullptr;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(initializer_list<value_type> __il)
-{
- return __assign_range(__il.begin(), __il.end());
+inline valarray<_Tp>& valarray<_Tp>::operator=(initializer_list<value_type> __il) {
+ return __assign_range(__il.begin(), __il.end());
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const value_type& __x)
-{
- std::fill(__begin_, __end_, __x);
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const value_type& __x) {
+ std::fill(__begin_, __end_, __x);
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
-{
- value_type* __t = __begin_;
- const value_type* __s = __sa.__vp_;
- for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
- *__t = *__s;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<value_type>& __sa) {
+ value_type* __t = __begin_;
+ const value_type* __s = __sa.__vp_;
+ for (size_t __n = __sa.__size_; __n; --__n, __s += __sa.__stride_, ++__t)
+ *__t = *__s;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
-{
- typedef const size_t* _Ip;
- value_type* __t = __begin_;
- const value_type* __s = __ga.__vp_;
- for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
- __i != __e; ++__i, ++__t)
- *__t = __s[*__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<value_type>& __ga) {
+ typedef const size_t* _Ip;
+ value_type* __t = __begin_;
+ const value_type* __s = __ga.__vp_;
+ for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__t)
+ *__t = __s[*__i];
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
-{
- typedef const size_t* _Ip;
- value_type* __t = __begin_;
- const value_type* __s = __ma.__vp_;
- for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
- __i != __e; ++__i, ++__t)
- *__t = __s[*__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<value_type>& __ma) {
+ typedef const size_t* _Ip;
+ value_type* __t = __begin_;
+ const value_type* __s = __ma.__vp_;
+ for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__t)
+ *__t = __s[*__i];
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
-{
- typedef const size_t* _Ip;
- value_type* __t = __begin_;
- const value_type* __s = __ia.__vp_;
- for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
- __i != __e; ++__i, ++__t)
- *__t = __s[*__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<value_type>& __ia) {
+ typedef const size_t* _Ip;
+ value_type* __t = __begin_;
+ const value_type* __s = __ia.__vp_;
+ for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__t)
+ *__t = __s[*__i];
+ return *this;
}
template <class _Tp>
template <class _ValExpr>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
-{
- size_t __n = __v.size();
- if (size() != __n)
- resize(__n);
- value_type* __t = __begin_;
- for (size_t __i = 0; __i != __n; ++__t, ++__i)
- *__t = __result_type(__v[__i]);
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v) {
+ size_t __n = __v.size();
+ if (size() != __n)
+ resize(__n);
+ value_type* __t = __begin_;
+ for (size_t __i = 0; __i != __n; ++__t, ++__i)
+ *__t = __result_type(__v[__i]);
+ return *this;
}
template <class _Tp>
-inline
-__val_expr<__slice_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](slice __s) const
-{
- return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
+inline __val_expr<__slice_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](slice __s) const {
+ return __val_expr<__slice_expr<const valarray&> >(__slice_expr<const valarray&>(__s, *this));
}
template <class _Tp>
-inline
-slice_array<_Tp>
-valarray<_Tp>::operator[](slice __s)
-{
- return slice_array<value_type>(__s, *this);
+inline slice_array<_Tp> valarray<_Tp>::operator[](slice __s) {
+ return slice_array<value_type>(__s, *this);
}
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](const gslice& __gs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](const gslice& __gs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__gs.__1d_, *this));
}
template <class _Tp>
-inline
-gslice_array<_Tp>
-valarray<_Tp>::operator[](const gslice& __gs)
-{
- return gslice_array<value_type>(__gs, *this);
+inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __gs) {
+ return gslice_array<value_type>(__gs, *this);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](gslice&& __gs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__gs.__1d_), *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](gslice&& __gs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__gs.__1d_), *this));
}
template <class _Tp>
-inline
-gslice_array<_Tp>
-valarray<_Tp>::operator[](gslice&& __gs)
-{
- return gslice_array<value_type>(std::move(__gs), *this);
+inline gslice_array<_Tp> valarray<_Tp>::operator[](gslice&& __gs) {
+ return gslice_array<value_type>(std::move(__gs), *this);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__mask_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](const valarray<bool>& __vb) const
-{
- return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
+inline __val_expr<__mask_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](const valarray<bool>& __vb) const {
+ return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(__vb, *this));
}
template <class _Tp>
-inline
-mask_array<_Tp>
-valarray<_Tp>::operator[](const valarray<bool>& __vb)
-{
- return mask_array<value_type>(__vb, *this);
+inline mask_array<_Tp> valarray<_Tp>::operator[](const valarray<bool>& __vb) {
+ return mask_array<value_type>(__vb, *this);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__mask_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](valarray<bool>&& __vb) const
-{
- return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(std::move(__vb), *this));
+inline __val_expr<__mask_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](valarray<bool>&& __vb) const {
+ return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(std::move(__vb), *this));
}
template <class _Tp>
-inline
-mask_array<_Tp>
-valarray<_Tp>::operator[](valarray<bool>&& __vb)
-{
- return mask_array<value_type>(std::move(__vb), *this);
+inline mask_array<_Tp> valarray<_Tp>::operator[](valarray<bool>&& __vb) {
+ return mask_array<value_type>(std::move(__vb), *this);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> >
+valarray<_Tp>::operator[](const valarray<size_t>& __vs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(__vs, *this));
}
template <class _Tp>
-inline
-indirect_array<_Tp>
-valarray<_Tp>::operator[](const valarray<size_t>& __vs)
-{
- return indirect_array<value_type>(__vs, *this);
+inline indirect_array<_Tp> valarray<_Tp>::operator[](const valarray<size_t>& __vs) {
+ return indirect_array<value_type>(__vs, *this);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<__indirect_expr<const valarray<_Tp>&> >
-valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
-{
- return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__vs), *this));
+inline __val_expr<__indirect_expr<const valarray<_Tp>&> > valarray<_Tp>::operator[](valarray<size_t>&& __vs) const {
+ return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__vs), *this));
}
template <class _Tp>
-inline
-indirect_array<_Tp>
-valarray<_Tp>::operator[](valarray<size_t>&& __vs)
-{
- return indirect_array<value_type>(std::move(__vs), *this);
+inline indirect_array<_Tp> valarray<_Tp>::operator[](valarray<size_t>&& __vs) {
+ return indirect_array<value_type>(std::move(__vs), *this);
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
-inline
-__val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator+() const
-{
- using _Op = _UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(__unary_plus<_Tp>(), *this));
+inline __val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator+() const {
+ using _Op = _UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(__unary_plus<_Tp>(), *this));
}
template <class _Tp>
-inline
-__val_expr<_UnaryOp<negate<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator-() const
-{
- using _Op = _UnaryOp<negate<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(negate<_Tp>(), *this));
+inline __val_expr<_UnaryOp<negate<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator-() const {
+ using _Op = _UnaryOp<negate<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(negate<_Tp>(), *this));
}
template <class _Tp>
-inline
-__val_expr<_UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator~() const
-{
- using _Op = _UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(__bit_not<_Tp>(), *this));
+inline __val_expr<_UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator~() const {
+ using _Op = _UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(__bit_not<_Tp>(), *this));
}
template <class _Tp>
-inline
-__val_expr<_UnaryOp<logical_not<_Tp>, const valarray<_Tp>&> >
-valarray<_Tp>::operator!() const
-{
- using _Op = _UnaryOp<logical_not<_Tp>, const valarray<_Tp>&>;
- return __val_expr<_Op>(_Op(logical_not<_Tp>(), *this));
+inline __val_expr<_UnaryOp<logical_not<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator!() const {
+ using _Op = _UnaryOp<logical_not<_Tp>, const valarray<_Tp>&>;
+ return __val_expr<_Op>(_Op(logical_not<_Tp>(), *this));
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator*=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p *= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator*=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p *= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator/=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p /= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator/=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p /= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator%=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p %= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator%=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p %= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator+=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p += __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator+=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p += __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator-=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p -= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator-=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p -= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator^=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p ^= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator^=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p ^= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator&=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p &= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator&=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p &= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator|=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p |= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator|=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p |= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator<<=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p <<= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator<<=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p <<= __x;
+ return *this;
}
template <class _Tp>
-inline
-valarray<_Tp>&
-valarray<_Tp>::operator>>=(const value_type& __x)
-{
- for (value_type* __p = __begin_; __p != __end_; ++__p)
- *__p >>= __x;
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator>>=(const value_type& __x) {
+ for (value_type* __p = __begin_; __p != __end_; ++__p)
+ *__p >>= __x;
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator*=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t *= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator*=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t *= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator/=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t /= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator/=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t /= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator%=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t %= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator%=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t %= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator+=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t += __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator+=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t += __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator-=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t -= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator-=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t -= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator^=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t ^= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator^=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t ^= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator|=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t |= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator|=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t |= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator&=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t &= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator&=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t &= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator<<=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t <<= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator<<=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t <<= __v[__i];
+ return *this;
}
template <class _Tp>
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> >
-inline
- valarray<_Tp>&
-valarray<_Tp>::operator>>=(const _Expr& __v)
-{
- size_t __i = 0;
- for (value_type* __t = __begin_; __t != __end_ ; ++__t, ++__i)
- *__t >>= __v[__i];
- return *this;
+inline valarray<_Tp>& valarray<_Tp>::operator>>=(const _Expr& __v) {
+ size_t __i = 0;
+ for (value_type* __t = __begin_; __t != __end_; ++__t, ++__i)
+ *__t >>= __v[__i];
+ return *this;
}
template <class _Tp>
-inline
-void
-valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
-{
- std::swap(__begin_, __v.__begin_);
- std::swap(__end_, __v.__end_);
+inline void valarray<_Tp>::swap(valarray& __v) _NOEXCEPT {
+ std::swap(__begin_, __v.__begin_);
+ std::swap(__end_, __v.__end_);
}
template <class _Tp>
-inline
-_Tp
-valarray<_Tp>::sum() const
-{
- if (__begin_ == __end_)
- return value_type();
- const value_type* __p = __begin_;
- _Tp __r = *__p;
- for (++__p; __p != __end_; ++__p)
- __r += *__p;
- return __r;
+inline _Tp valarray<_Tp>::sum() const {
+ if (__begin_ == __end_)
+ return value_type();
+ const value_type* __p = __begin_;
+ _Tp __r = *__p;
+ for (++__p; __p != __end_; ++__p)
+ __r += *__p;
+ return __r;
}
template <class _Tp>
-inline
-_Tp
-valarray<_Tp>::min() const
-{
- if (__begin_ == __end_)
- return value_type();
- return *std::min_element(__begin_, __end_);
+inline _Tp valarray<_Tp>::min() const {
+ if (__begin_ == __end_)
+ return value_type();
+ return *std::min_element(__begin_, __end_);
}
template <class _Tp>
-inline
-_Tp
-valarray<_Tp>::max() const
-{
- if (__begin_ == __end_)
- return value_type();
- return *std::max_element(__begin_, __end_);
+inline _Tp valarray<_Tp>::max() const {
+ if (__begin_ == __end_)
+ return value_type();
+ return *std::max_element(__begin_, __end_);
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::shift(int __i) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- const value_type* __sb;
- value_type* __tb;
- value_type* __te;
- if (__i >= 0)
- {
- __i = std::min(__i, static_cast<int>(__n));
- __sb = __begin_ + __i;
- __tb = __r.__begin_;
- __te = __r.__begin_ + (__n - __i);
- }
- else
- {
- __i = std::min(-__i, static_cast<int>(__n));
- __sb = __begin_;
- __tb = __r.__begin_ + __i;
- __te = __r.__begin_ + __n;
- }
- for (; __r.__end_ != __tb; ++__r.__end_)
- ::new ((void*)__r.__end_) value_type();
- for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
- ::new ((void*)__r.__end_) value_type(*__sb);
- for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
- ::new ((void*)__r.__end_) value_type();
+valarray<_Tp> valarray<_Tp>::shift(int __i) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ const value_type* __sb;
+ value_type* __tb;
+ value_type* __te;
+ if (__i >= 0) {
+ __i = std::min(__i, static_cast<int>(__n));
+ __sb = __begin_ + __i;
+ __tb = __r.__begin_;
+ __te = __r.__begin_ + (__n - __i);
+ } else {
+ __i = std::min(-__i, static_cast<int>(__n));
+ __sb = __begin_;
+ __tb = __r.__begin_ + __i;
+ __te = __r.__begin_ + __n;
}
- return __r;
+ for (; __r.__end_ != __tb; ++__r.__end_)
+ ::new ((void*)__r.__end_) value_type();
+ for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
+ ::new ((void*)__r.__end_) value_type(*__sb);
+ for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
+ ::new ((void*)__r.__end_) value_type();
+ }
+ return __r;
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::cshift(int __i) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- __i %= static_cast<int>(__n);
- const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
- for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
- ::new ((void*)__r.__end_) value_type(*__s);
- for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
- ::new ((void*)__r.__end_) value_type(*__s);
- }
- return __r;
+valarray<_Tp> valarray<_Tp>::cshift(int __i) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ __i %= static_cast<int>(__n);
+ const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
+ for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
+ ::new ((void*)__r.__end_) value_type(*__s);
+ for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
+ ::new ((void*)__r.__end_) value_type(*__s);
+ }
+ return __r;
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::apply(value_type __f(value_type)) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
- ::new ((void*)__r.__end_) value_type(__f(*__p));
- }
- return __r;
+valarray<_Tp> valarray<_Tp>::apply(value_type __f(value_type)) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+ ::new ((void*)__r.__end_) value_type(__f(*__p));
+ }
+ return __r;
}
template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::apply(value_type __f(const value_type&)) const
-{
- valarray<value_type> __r;
- size_t __n = size();
- if (__n)
- {
- __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
- for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
- ::new ((void*)__r.__end_) value_type(__f(*__p));
- }
- return __r;
+valarray<_Tp> valarray<_Tp>::apply(value_type __f(const value_type&)) const {
+ valarray<value_type> __r;
+ size_t __n = size();
+ if (__n) {
+ __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
+ for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
+ ::new ((void*)__r.__end_) value_type(__f(*__p));
+ }
+ return __r;
}
template <class _Tp>
-inline
-void valarray<_Tp>::__clear(size_t __capacity)
-{
- if (__begin_ != nullptr)
- {
+inline void valarray<_Tp>::__clear(size_t __capacity) {
+ if (__begin_ != nullptr) {
while (__end_ != __begin_)
(--__end_)->~value_type();
allocator<value_type>().deallocate(__begin_, __capacity);
@@ -3315,888 +2552,719 @@ void valarray<_Tp>::__clear(size_t __capacity)
}
template <class _Tp>
-void
-valarray<_Tp>::resize(size_t __n, value_type __x)
-{
- __clear(size());
- if (__n)
- {
- __begin_ = __end_ = allocator<value_type>().allocate(__n);
+void valarray<_Tp>::resize(size_t __n, value_type __x) {
+ __clear(size());
+ if (__n) {
+ __begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
- ::new ((void*)__end_) value_type(__x);
+ for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
+ ::new ((void*)__end_) value_type(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- __clear(__n);
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __clear(__n);
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
-template<class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
-{
- __x.swap(__y);
+template <class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI void swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT {
+ __x.swap(__y);
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator*(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<multiplies<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator*(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<multiplies<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator*(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(multiplies<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator*(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator*(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(multiplies<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator*(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(multiplies<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator/(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<divides<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator/(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<divides<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(divides<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<divides<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator/(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(divides<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<divides<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator/(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(divides<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<divides<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator/(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(divides<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<divides<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator/(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(divides<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator%(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<modulus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator%(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<modulus<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator%(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(modulus<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator%(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<modulus<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator%(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(modulus<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator%(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(modulus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator+(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<plus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator+(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<plus<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(plus<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<plus<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator+(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(plus<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<plus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator+(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(plus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<plus<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator+(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(plus<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<plus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator+(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(plus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator-(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<minus<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator-(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<minus<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(minus<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<minus<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator-(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(minus<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<minus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator-(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(minus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<minus<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator-(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(minus<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<minus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator-(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(minus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator^(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<bit_xor<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator^(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<bit_xor<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator^(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(bit_xor<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator^(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator^(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(bit_xor<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator^(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(bit_xor<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator&(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<bit_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator&(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<bit_and<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator&(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(bit_and<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator&(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator&(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(bit_and<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator&(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(bit_and<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator|(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<bit_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator|(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<bit_or<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator|(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(bit_or<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator|(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator|(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(bit_or<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator|(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(bit_or<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator<<(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__bit_shift_left<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator<<(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__bit_shift_left<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator<<(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_left<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator<<(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator<<(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_left<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator<<(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_left<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator>>(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__bit_shift_right<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator>>(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__bit_shift_right<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator>>(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_right<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator>>(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_right<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__bit_shift_right<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator>>(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<
+ _BinaryOp<__bit_shift_right<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator>>(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__bit_shift_right<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator&&(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<logical_and<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator&&(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<logical_and<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator&&(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(logical_and<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator&&(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator&&(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(logical_and<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator&&(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(logical_and<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator||(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<logical_or<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator||(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<logical_or<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator||(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(logical_or<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator||(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator||(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(logical_or<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator||(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(logical_or<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator==(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator==(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<equal_to<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator==(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(equal_to<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator==(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator==(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(equal_to<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator==(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(equal_to<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator!=(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<not_equal_to<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator!=(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<not_equal_to<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator!=(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator!=(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator!=(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(not_equal_to<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator!=(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator<(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<less<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator<(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<less<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(less<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator<(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(less<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<less<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator<(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(less<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator<(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(less<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<less<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator<(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(less<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator>(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<greater<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator>(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<greater<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(greater<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator>(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(greater<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<greater<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator>(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(greater<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator>(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(greater<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<greater<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator>(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(greater<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator<=(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<less_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator<=(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<less_equal<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator<=(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(less_equal<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator<=(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator<=(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(less_equal<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator<=(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(less_equal<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
-operator>=(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<greater_equal<typename _Expr1::value_type>, _Expr1, _Expr2> >
+operator>=(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<greater_equal<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-operator>=(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(greater_equal<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ operator>=(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-operator>=(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(greater_equal<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ operator>=(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(greater_equal<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
-abs(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__abs_expr<typename _Expr::value_type>, _Expr> >
+abs(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__abs_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__abs_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
-acos(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__acos_expr<typename _Expr::value_type>, _Expr> >
+acos(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__acos_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__acos_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
-asin(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__asin_expr<typename _Expr::value_type>, _Expr> >
+asin(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__asin_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__asin_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
-atan(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__atan_expr<typename _Expr::value_type>, _Expr> >
+atan(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__atan_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__atan_expr<value_type>(), __x));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
-atan2(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__atan2_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
+atan2(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__atan2_expr<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-atan2(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ atan2(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-atan2(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__atan2_expr<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ atan2(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
-cos(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cos_expr<typename _Expr::value_type>, _Expr> >
+cos(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__cos_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__cos_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
-cosh(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__cosh_expr<typename _Expr::value_type>, _Expr> >
+cosh(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__cosh_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__cosh_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
-exp(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__exp_expr<typename _Expr::value_type>, _Expr> >
+exp(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__exp_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__exp_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
-log(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log_expr<typename _Expr::value_type>, _Expr> >
+log(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__log_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__log_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
-log10(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__log10_expr<typename _Expr::value_type>, _Expr> >
+log10(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__log10_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__log10_expr<value_type>(), __x));
}
-template<class _Expr1, class _Expr2, __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
-pow(const _Expr1& __x, const _Expr2& __y)
-{
- typedef typename _Expr1::value_type value_type;
- typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
- return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
+template <class _Expr1,
+ class _Expr2,
+ __enable_if_t<__is_val_expr<_Expr1>::value && __is_val_expr<_Expr2>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_BinaryOp<__pow_expr<typename _Expr1::value_type>, _Expr1, _Expr2> >
+pow(const _Expr1& __x, const _Expr2& __y) {
+ typedef typename _Expr1::value_type value_type;
+ typedef _BinaryOp<__pow_expr<value_type>, _Expr1, _Expr2> _Op;
+ return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
- _Expr, __scalar_expr<typename _Expr::value_type> > >
-pow(const _Expr& __x, const typename _Expr::value_type& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
- return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
- __x, __scalar_expr<value_type>(__y, __x.size())));
+ __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+ pow(const _Expr& __x, const typename _Expr::value_type& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
+ return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
-__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>,
- __scalar_expr<typename _Expr::value_type>, _Expr> >
-pow(const typename _Expr::value_type& __x, const _Expr& __y)
-{
- typedef typename _Expr::value_type value_type;
- typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__pow_expr<value_type>(),
- __scalar_expr<value_type>(__x, __y.size()), __y));
+ __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+ pow(const typename _Expr::value_type& __x, const _Expr& __y) {
+ typedef typename _Expr::value_type value_type;
+ typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
-sin(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sin_expr<typename _Expr::value_type>, _Expr> >
+sin(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__sin_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__sin_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
-sinh(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sinh_expr<typename _Expr::value_type>, _Expr> >
+sinh(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__sinh_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__sinh_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
-sqrt(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__sqrt_expr<typename _Expr::value_type>, _Expr> >
+sqrt(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__sqrt_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__sqrt_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
-tan(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tan_expr<typename _Expr::value_type>, _Expr> >
+tan(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__tan_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__tan_expr<value_type>(), __x));
}
-template<class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
-tanh(const _Expr& __x)
-{
- typedef typename _Expr::value_type value_type;
- typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
- return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
+template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI __val_expr<_UnaryOp<__tanh_expr<typename _Expr::value_type>, _Expr> >
+tanh(const _Expr& __x) {
+ typedef typename _Expr::value_type value_type;
+ typedef _UnaryOp<__tanh_expr<value_type>, _Expr> _Op;
+ return __val_expr<_Op>(_Op(__tanh_expr<value_type>(), __x));
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp*
-begin(valarray<_Tp>& __v)
-{
- return __v.__begin_;
+inline _LIBCPP_HIDE_FROM_ABI _Tp* begin(valarray<_Tp>& __v) {
+ return __v.__begin_;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-const _Tp*
-begin(const valarray<_Tp>& __v)
-{
- return __v.__begin_;
+inline _LIBCPP_HIDE_FROM_ABI const _Tp* begin(const valarray<_Tp>& __v) {
+ return __v.__begin_;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_Tp*
-end(valarray<_Tp>& __v)
-{
- return __v.__end_;
+inline _LIBCPP_HIDE_FROM_ABI _Tp* end(valarray<_Tp>& __v) {
+ return __v.__end_;
}
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-const _Tp*
-end(const valarray<_Tp>& __v)
-{
- return __v.__end_;
+inline _LIBCPP_HIDE_FROM_ABI const _Tp* end(const valarray<_Tp>& __v) {
+ return __v.__end_;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/variant b/contrib/llvm-project/libcxx/include/variant
index 3b01e5e126d9..6179b2a1a0ab 100644
--- a/contrib/llvm-project/libcxx/include/variant
+++ b/contrib/llvm-project/libcxx/include/variant
@@ -262,7 +262,7 @@ namespace std { // explicitly not using versioning namespace
class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS bad_variant_access : public exception {
public:
- const char* what() const _NOEXCEPT override;
+ const char* what() const _NOEXCEPT override;
};
} // namespace std
@@ -273,26 +273,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Light N-dimensional array of function pointers. Used in place of std::array to avoid
// adding a dependency.
-template<class _Tp, size_t _Size>
+template <class _Tp, size_t _Size>
struct __farray {
static_assert(_Size > 0, "N-dimensional array should never be empty in std::visit");
_Tp __buf_[_Size] = {};
- _LIBCPP_HIDE_FROM_ABI constexpr
- const _Tp &operator[](size_t __n) const noexcept {
- return __buf_[__n];
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; }
};
-_LIBCPP_NORETURN
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-void __throw_bad_variant_access() {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_variant_access();
-#else
- _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode");
-#endif
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
+__throw_bad_variant_access() {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw bad_variant_access();
+# else
+ _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode");
+# endif
}
template <class... _Types>
@@ -311,12 +306,10 @@ template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS variant_size<volatile _Tp> : variant_size<_Tp> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_size<const volatile _Tp>
- : variant_size<_Tp> {};
+struct _LIBCPP_TEMPLATE_VIS variant_size<const volatile _Tp> : variant_size<_Tp> {};
template <class... _Types>
-struct _LIBCPP_TEMPLATE_VIS variant_size<variant<_Types...>>
- : integral_constant<size_t, sizeof...(_Types)> {};
+struct _LIBCPP_TEMPLATE_VIS variant_size<variant<_Types...>> : integral_constant<size_t, sizeof...(_Types)> {};
template <size_t _Ip, class _Tp>
struct _LIBCPP_TEMPLATE_VIS variant_alternative;
@@ -325,16 +318,13 @@ template <size_t _Ip, class _Tp>
using variant_alternative_t = typename variant_alternative<_Ip, _Tp>::type;
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const _Tp>
- : add_const<variant_alternative_t<_Ip, _Tp>> {};
+struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const _Tp> : add_const<variant_alternative_t<_Ip, _Tp>> {};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, volatile _Tp>
- : add_volatile<variant_alternative_t<_Ip, _Tp>> {};
+struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, volatile _Tp> : add_volatile<variant_alternative_t<_Ip, _Tp>> {};
template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp>
- : add_cv<variant_alternative_t<_Ip, _Tp>> {};
+struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp> : add_cv<variant_alternative_t<_Ip, _Tp>> {};
template <size_t _Ip, class... _Types>
struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
@@ -354,14 +344,11 @@ _LIBCPP_HIDE_FROM_ABI constexpr int __choose_index_type(unsigned int __num_elem)
template <size_t _NumAlts>
using __variant_index_t =
-#ifndef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
- unsigned int;
-#else
- std::tuple_element_t<
- __choose_index_type(_NumAlts),
- std::tuple<unsigned char, unsigned short, unsigned int>
- >;
-#endif
+# ifndef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
+ unsigned int;
+# else
+ std::tuple_element_t< __choose_index_type(_NumAlts), std::tuple<unsigned char, unsigned short, unsigned int> >;
+# endif
template <class _IndexType>
constexpr _IndexType __variant_npos = static_cast<_IndexType>(-1);
@@ -370,36 +357,31 @@ template <class... _Types>
class _LIBCPP_TEMPLATE_VIS variant;
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&
-__as_variant(variant<_Types...>& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>& __as_variant(variant<_Types...>& __vs) noexcept {
return __vs;
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&
-__as_variant(const variant<_Types...>& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>& __as_variant(const variant<_Types...>& __vs) noexcept {
return __vs;
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&&
-__as_variant(variant<_Types...>&& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&& __as_variant(variant<_Types...>&& __vs) noexcept {
return std::move(__vs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&&
-__as_variant(const variant<_Types...>&& __vs) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&& __as_variant(const variant<_Types...>&& __vs) noexcept {
return std::move(__vs);
}
namespace __find_detail {
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr size_t __find_index() {
+_LIBCPP_HIDE_FROM_ABI constexpr size_t __find_index() {
constexpr bool __matches[] = {is_same_v<_Tp, _Types>...};
- size_t __result = __not_found;
+ size_t __result = __not_found;
for (size_t __i = 0; __i < sizeof...(_Types); ++__i) {
if (__matches[__i]) {
if (__result != __not_found) {
@@ -412,8 +394,7 @@ constexpr size_t __find_index() {
}
template <size_t _Index>
-struct __find_unambiguous_index_sfinae_impl
- : integral_constant<size_t, _Index> {};
+struct __find_unambiguous_index_sfinae_impl : integral_constant<size_t, _Index> {};
template <>
struct __find_unambiguous_index_sfinae_impl<__not_found> {};
@@ -422,8 +403,7 @@ template <>
struct __find_unambiguous_index_sfinae_impl<__ambiguous> {};
template <class _Tp, class... _Types>
-struct __find_unambiguous_index_sfinae
- : __find_unambiguous_index_sfinae_impl<__find_index<_Tp, _Types...>()> {};
+struct __find_unambiguous_index_sfinae : __find_unambiguous_index_sfinae_impl<__find_index<_Tp, _Types...>()> {};
} // namespace __find_detail
@@ -433,16 +413,14 @@ struct __valueless_t {};
enum class _Trait { _TriviallyAvailable, _Available, _Unavailable };
-template <typename _Tp,
- template <typename> class _IsTriviallyAvailable,
- template <typename> class _IsAvailable>
+template <typename _Tp, template <typename> class _IsTriviallyAvailable, template <typename> class _IsAvailable>
constexpr _Trait __trait =
- _IsTriviallyAvailable<_Tp>::value
- ? _Trait::_TriviallyAvailable
- : _IsAvailable<_Tp>::value ? _Trait::_Available : _Trait::_Unavailable;
+ _IsTriviallyAvailable<_Tp>::value ? _Trait::_TriviallyAvailable
+ : _IsAvailable<_Tp>::value
+ ? _Trait::_Available
+ : _Trait::_Unavailable;
-_LIBCPP_HIDE_FROM_ABI
-constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
_Trait __result = _Trait::_TriviallyAvailable;
for (_Trait __t : __traits) {
if (static_cast<int>(__t) > static_cast<int>(__result)) {
@@ -455,56 +433,45 @@ constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
template <typename... _Types>
struct __traits {
static constexpr _Trait __copy_constructible_trait =
- __variant_detail::__common_trait({__trait<_Types,
- is_trivially_copy_constructible,
- is_copy_constructible>...});
+ __variant_detail::__common_trait({__trait<_Types, is_trivially_copy_constructible, is_copy_constructible>...});
static constexpr _Trait __move_constructible_trait =
- __variant_detail::__common_trait({__trait<_Types,
- is_trivially_move_constructible,
- is_move_constructible>...});
+ __variant_detail::__common_trait({__trait<_Types, is_trivially_move_constructible, is_move_constructible>...});
static constexpr _Trait __copy_assignable_trait = __variant_detail::__common_trait(
- {__copy_constructible_trait,
- __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...});
+ {__copy_constructible_trait, __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...});
static constexpr _Trait __move_assignable_trait = __variant_detail::__common_trait(
- {__move_constructible_trait,
- __trait<_Types, is_trivially_move_assignable, is_move_assignable>...});
+ {__move_constructible_trait, __trait<_Types, is_trivially_move_assignable, is_move_assignable>...});
- static constexpr _Trait __destructible_trait = __variant_detail::__common_trait(
- {__trait<_Types, is_trivially_destructible, is_destructible>...});
+ static constexpr _Trait __destructible_trait =
+ __variant_detail::__common_trait({__trait<_Types, is_trivially_destructible, is_destructible>...});
};
namespace __access {
struct __union {
template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) {
return std::forward<_Vp>(__v).__head;
}
template <class _Vp, size_t _Ip>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) {
return __get_alt(std::forward<_Vp>(__v).__tail, in_place_index<_Ip - 1>);
}
};
struct __base {
template <size_t _Ip, class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v) {
- return __union::__get_alt(std::forward<_Vp>(__v).__data,
- in_place_index<_Ip>);
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) {
+ return __union::__get_alt(std::forward<_Vp>(__v).__data, in_place_index<_Ip>);
}
};
struct __variant {
template <size_t _Ip, class _Vp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __get_alt(_Vp&& __v) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) {
return __base::__get_alt<_Ip>(std::forward<_Vp>(__v).__impl_);
}
};
@@ -515,50 +482,38 @@ namespace __visitation {
struct __base {
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto)
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
__visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- constexpr auto __fdiagonal =
- __make_fdiagonal<_Visitor&&,
- decltype(std::forward<_Vs>(__vs).__as_base())...>();
- return __fdiagonal[__index](std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs).__as_base()...);
+ constexpr auto __fdiagonal = __make_fdiagonal<_Visitor&&, decltype(std::forward<_Vs>(__vs).__as_base())...>();
+ return __fdiagonal[__index](std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__as_base()...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor,
- _Vs&&... __vs) {
- constexpr auto __fmatrix =
- __make_fmatrix<_Visitor&&,
- decltype(std::forward<_Vs>(__vs).__as_base())...>();
- return __at(__fmatrix, __vs.index()...)(
- std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs).__as_base()...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) {
+ constexpr auto __fmatrix = __make_fmatrix<_Visitor&&, decltype(std::forward<_Vs>(__vs).__as_base())...>();
+ return __at(__fmatrix, __vs.index()...)(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__as_base()...);
}
private:
template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; }
+ _LIBCPP_HIDE_FROM_ABI static constexpr const _Tp& __at(const _Tp& __elem) {
+ return __elem;
+ }
template <class _Tp, size_t _Np, typename... _Indices>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto&& __at(const __farray<_Tp, _Np>& __elems,
- size_t __index, _Indices... __indices) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto&&
+ __at(const __farray<_Tp, _Np>& __elems, size_t __index, _Indices... __indices) {
return __at(__elems[__index], __indices...);
}
template <class _Fp, class... _Fs>
static _LIBCPP_HIDE_FROM_ABI constexpr void __std_visit_visitor_return_type_check() {
static_assert(
- __all<is_same_v<_Fp, _Fs>...>::value,
- "`std::visit` requires the visitor to have a single return type.");
+ __all<is_same_v<_Fp, _Fs>...>::value, "`std::visit` requires the visitor to have a single return type.");
}
template <class... _Fs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_farray(_Fs&&... __fs) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_farray(_Fs&&... __fs) {
__std_visit_visitor_return_type_check<__remove_cvref_t<_Fs>...>();
using __result = __farray<common_type_t<__remove_cvref_t<_Fs>...>, sizeof...(_Fs)>;
return __result{{std::forward<_Fs>(__fs)...}};
@@ -567,59 +522,46 @@ private:
template <size_t... _Is>
struct __dispatcher {
template <class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
- return std::__invoke(
- static_cast<_Fp>(__f),
- __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
+ return std::__invoke(static_cast<_Fp>(__f), __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
}
};
template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_dispatch(index_sequence<_Is...>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_dispatch(index_sequence<_Is...>) {
return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
}
template <size_t _Ip, class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fdiagonal_impl() {
- return __make_dispatch<_Fp, _Vs...>(
- index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{});
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl() {
+ return __make_dispatch<_Fp, _Vs...>(index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{});
}
template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fdiagonal_impl(index_sequence<_Is...>) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl(index_sequence<_Is...>) {
return __base::__make_farray(__make_fdiagonal_impl<_Is, _Fp, _Vs...>()...);
}
template <class _Fp, class _Vp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fdiagonal() {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal() {
constexpr size_t __np = __remove_cvref_t<_Vp>::__size();
static_assert(__all<(__np == __remove_cvref_t<_Vs>::__size())...>::value);
return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<__np>{});
}
template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fmatrix_impl(index_sequence<_Is...> __is) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fmatrix_impl(index_sequence<_Is...> __is) {
return __make_dispatch<_Fp, _Vs...>(__is);
}
template <class _Fp, class... _Vs, size_t... _Is, size_t... _Js, class... _Ls>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fmatrix_impl(index_sequence<_Is...>,
- index_sequence<_Js...>,
- _Ls... __ls) {
- return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(
- index_sequence<_Is..., _Js>{}, __ls...)...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __make_fmatrix_impl(index_sequence<_Is...>, index_sequence<_Js...>, _Ls... __ls) {
+ return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(index_sequence<_Is..., _Js>{}, __ls...)...);
}
template <class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_fmatrix() {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fmatrix() {
return __make_fmatrix_impl<_Fp, _Vs...>(
index_sequence<>{}, make_index_sequence<__remove_cvref_t<_Vs>::__size()>{}...);
}
@@ -627,110 +569,79 @@ private:
struct __variant {
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto)
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
__visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- return __base::__visit_alt_at(__index,
- std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs).__impl_...);
+ return __base::__visit_alt_at(__index, std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__impl_...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor,
- _Vs&&... __vs) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) {
return __base::__visit_alt(
- std::forward<_Visitor>(__visitor),
- std::__as_variant(std::forward<_Vs>(__vs)).__impl_...);
+ std::forward<_Visitor>(__visitor), std::__as_variant(std::forward<_Vs>(__vs)).__impl_...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto)
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
__visit_value_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- return __visit_alt_at(
- __index,
- __make_value_visitor(std::forward<_Visitor>(__visitor)),
- std::forward<_Vs>(__vs)...);
+ return __visit_alt_at(__index, __make_value_visitor(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
}
template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr decltype(auto) __visit_value(_Visitor&& __visitor,
- _Vs&&... __vs) {
- return __visit_alt(
- __make_value_visitor(std::forward<_Visitor>(__visitor)),
- std::forward<_Vs>(__vs)...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_value(_Visitor&& __visitor, _Vs&&... __vs) {
+ return __visit_alt(__make_value_visitor(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Rp, class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr _Rp __visit_value(_Visitor&& __visitor,
- _Vs&&... __vs) {
- return __visit_alt(
- __make_value_visitor<_Rp>(std::forward<_Visitor>(__visitor)),
- std::forward<_Vs>(__vs)...);
+ _LIBCPP_HIDE_FROM_ABI static constexpr _Rp __visit_value(_Visitor&& __visitor, _Vs&&... __vs) {
+ return __visit_alt(__make_value_visitor<_Rp>(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
}
-#endif
+# endif
private:
template <class _Visitor, class... _Values>
static _LIBCPP_HIDE_FROM_ABI constexpr void __std_visit_exhaustive_visitor_check() {
- static_assert(is_invocable_v<_Visitor, _Values...>,
- "`std::visit` requires the visitor to be exhaustive.");
+ static_assert(is_invocable_v<_Visitor, _Values...>, "`std::visit` requires the visitor to be exhaustive.");
}
template <class _Visitor>
struct __value_visitor {
template <class... _Alts>
- _LIBCPP_HIDE_FROM_ABI
- constexpr decltype(auto) operator()(_Alts&&... __alts) const {
- __std_visit_exhaustive_visitor_check<
- _Visitor,
- decltype((std::forward<_Alts>(__alts).__value))...>();
- return std::__invoke(std::forward<_Visitor>(__visitor),
- std::forward<_Alts>(__alts).__value...);
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Alts&&... __alts) const {
+ __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>();
+ return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
}
_Visitor&& __visitor;
};
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Rp, class _Visitor>
struct __value_visitor_return_type {
template <class... _Alts>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Rp operator()(_Alts&&... __alts) const {
- __std_visit_exhaustive_visitor_check<
- _Visitor,
- decltype((std::forward<_Alts>(__alts).__value))...>();
+ _LIBCPP_HIDE_FROM_ABI constexpr _Rp operator()(_Alts&&... __alts) const {
+ __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>();
if constexpr (is_void_v<_Rp>) {
- std::__invoke(std::forward<_Visitor>(__visitor),
- std::forward<_Alts>(__alts).__value...);
- }
- else {
- return std::__invoke(std::forward<_Visitor>(__visitor),
- std::forward<_Alts>(__alts).__value...);
+ std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
+ } else {
+ return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
}
}
_Visitor&& __visitor;
};
-#endif
+# endif
template <class _Visitor>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
return __value_visitor<_Visitor>{std::forward<_Visitor>(__visitor)};
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _Rp, class _Visitor>
- _LIBCPP_HIDE_FROM_ABI
- static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
return __value_visitor_return_type<_Rp, _Visitor>{std::forward<_Visitor>(__visitor)};
}
-#endif
+# endif
};
} // namespace __visitation
@@ -740,8 +651,7 @@ struct _LIBCPP_TEMPLATE_VIS __alt {
using __value_type = _Tp;
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr __alt(in_place_t, _Args&&... __args)
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __alt(in_place_t, _Args&&... __args)
: __value(std::forward<_Args>(__args)...) {}
__value_type __value;
@@ -753,89 +663,71 @@ union _LIBCPP_TEMPLATE_VIS __union;
template <_Trait _DestructibleTrait, size_t _Index>
union _LIBCPP_TEMPLATE_VIS __union<_DestructibleTrait, _Index> {};
-#define _LIBCPP_VARIANT_UNION(destructible_trait, destructor) \
- template <size_t _Index, class _Tp, class... _Types> \
- union _LIBCPP_TEMPLATE_VIS __union<destructible_trait, \
- _Index, \
- _Tp, \
- _Types...> { \
- public: \
- _LIBCPP_HIDE_FROM_ABI \
- explicit constexpr __union(__valueless_t) noexcept : __dummy{} {} \
- \
- template <class... _Args> \
- _LIBCPP_HIDE_FROM_ABI \
- explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \
- : __head(in_place, std::forward<_Args>(__args)...) {} \
- \
- template <size_t _Ip, class... _Args> \
- _LIBCPP_HIDE_FROM_ABI \
- explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \
- : __tail(in_place_index<_Ip - 1>, std::forward<_Args>(__args)...) {} \
- \
- __union(const __union&) = default; \
- __union(__union&&) = default; \
- \
- destructor \
- \
- __union& operator=(const __union&) = default; \
- __union& operator=(__union&&) = default; \
- \
- private: \
- char __dummy; \
- __alt<_Index, _Tp> __head; \
- __union<destructible_trait, _Index + 1, _Types...> __tail; \
- \
- friend struct __access::__union; \
- }
+# define _LIBCPP_VARIANT_UNION(destructible_trait, destructor) \
+ template <size_t _Index, class _Tp, class... _Types> \
+ union _LIBCPP_TEMPLATE_VIS __union<destructible_trait, _Index, _Tp, _Types...> { \
+ public: \
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(__valueless_t) noexcept : __dummy{} {} \
+ \
+ template <class... _Args> \
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \
+ : __head(in_place, std::forward<_Args>(__args)...) {} \
+ \
+ template <size_t _Ip, class... _Args> \
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \
+ : __tail(in_place_index<_Ip - 1>, std::forward<_Args>(__args)...) {} \
+ \
+ __union(const __union&) = default; \
+ __union(__union&&) = default; \
+ \
+ destructor \
+ \
+ __union& \
+ operator=(const __union&) = default; \
+ __union& operator=(__union&&) = default; \
+ \
+ private: \
+ char __dummy; \
+ __alt<_Index, _Tp> __head; \
+ __union<destructible_trait, _Index + 1, _Types...> __tail; \
+ \
+ friend struct __access::__union; \
+ }
_LIBCPP_VARIANT_UNION(_Trait::_TriviallyAvailable, ~__union() = default;);
-_LIBCPP_VARIANT_UNION(_Trait::_Available, ~__union() {});
+_LIBCPP_VARIANT_UNION(_Trait::_Available, ~__union(){});
_LIBCPP_VARIANT_UNION(_Trait::_Unavailable, ~__union() = delete;);
-#undef _LIBCPP_VARIANT_UNION
+# undef _LIBCPP_VARIANT_UNION
template <_Trait _DestructibleTrait, class... _Types>
class _LIBCPP_TEMPLATE_VIS __base {
public:
using __index_t = __variant_index_t<sizeof...(_Types)>;
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr __base(__valueless_t __tag) noexcept
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __base(__valueless_t __tag) noexcept
: __data(__tag), __index(__variant_npos<__index_t>) {}
template <size_t _Ip, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args)
- :
- __data(in_place_index<_Ip>, std::forward<_Args>(__args)...),
- __index(_Ip) {}
-
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool valueless_by_exception() const noexcept {
- return index() == variant_npos;
- }
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args)
+ : __data(in_place_index<_Ip>, std::forward<_Args>(__args)...), __index(_Ip) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept { return index() == variant_npos; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr size_t index() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept {
return __index == __variant_npos<__index_t> ? variant_npos : __index;
}
protected:
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() & { return *this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() & { return *this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() && { return std::move(*this); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() && { return std::move(*this); }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() const & { return *this; }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() const& { return *this; }
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto&& __as_base() const && { return std::move(*this); }
+ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() const&& { return std::move(*this); }
- _LIBCPP_HIDE_FROM_ABI
- static constexpr size_t __size() { return sizeof...(_Types); }
+ _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return sizeof...(_Types); }
__union<_DestructibleTrait, 0, _Types...> __data;
__index_t __index;
@@ -847,33 +739,29 @@ protected:
template <class _Traits, _Trait = _Traits::__destructible_trait>
class _LIBCPP_TEMPLATE_VIS __dtor;
-#define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, \
- destructible_trait> \
- : public __base<destructible_trait, _Types...> { \
- using __base_type = __base<destructible_trait, _Types...>; \
- using __index_t = typename __base_type::__index_t; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __dtor(const __dtor&) = default; \
- __dtor(__dtor&&) = default; \
- destructor \
- __dtor& operator=(const __dtor&) = default; \
- __dtor& operator=(__dtor&&) = default; \
- \
- protected: \
- inline _LIBCPP_HIDE_FROM_ABI \
- destroy \
- }
+# define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, destructible_trait> \
+ : public __base<destructible_trait, _Types...> { \
+ using __base_type = __base<destructible_trait, _Types...>; \
+ using __index_t = typename __base_type::__index_t; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __dtor(const __dtor&) = default; \
+ __dtor(__dtor&&) = default; \
+ destructor __dtor& operator=(const __dtor&) = default; \
+ __dtor& operator=(__dtor&&) = default; \
+ \
+ protected: \
+ inline _LIBCPP_HIDE_FROM_ABI destroy \
+ }
_LIBCPP_VARIANT_DESTRUCTOR(
- _Trait::_TriviallyAvailable,
- ~__dtor() = default;,
- void __destroy() noexcept { this->__index = __variant_npos<__index_t>; });
+ _Trait::_TriviallyAvailable, ~__dtor() = default;
+ , void __destroy() noexcept { this->__index = __variant_npos<__index_t>; });
_LIBCPP_VARIANT_DESTRUCTOR(
_Trait::_Available,
@@ -890,12 +778,9 @@ _LIBCPP_VARIANT_DESTRUCTOR(
this->__index = __variant_npos<__index_t>;
});
-_LIBCPP_VARIANT_DESTRUCTOR(
- _Trait::_Unavailable,
- ~__dtor() = delete;,
- void __destroy() noexcept = delete;);
+_LIBCPP_VARIANT_DESTRUCTOR(_Trait::_Unavailable, ~__dtor() = delete;, void __destroy() noexcept = delete;);
-#undef _LIBCPP_VARIANT_DESTRUCTOR
+# undef _LIBCPP_VARIANT_DESTRUCTOR
template <class _Traits>
class _LIBCPP_TEMPLATE_VIS __ctor : public __dtor<_Traits> {
@@ -907,26 +792,22 @@ public:
protected:
template <size_t _Ip, class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
- ::new ((void*)std::addressof(__a))
- __alt<_Ip, _Tp>(in_place, std::forward<_Args>(__args)...);
+ _LIBCPP_HIDE_FROM_ABI static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
+ ::new ((void*)std::addressof(__a)) __alt<_Ip, _Tp>(in_place, std::forward<_Args>(__args)...);
return __a.__value;
}
template <class _Rhs>
- _LIBCPP_HIDE_FROM_ABI
- static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
+ _LIBCPP_HIDE_FROM_ABI static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
__lhs.__destroy();
if (!__rhs.valueless_by_exception()) {
__visitation::__base::__visit_alt_at(
__rhs.index(),
[](auto& __lhs_alt, auto&& __rhs_alt) {
- __construct_alt(
- __lhs_alt,
- std::forward<decltype(__rhs_alt)>(__rhs_alt).__value);
+ __construct_alt(__lhs_alt, std::forward<decltype(__rhs_alt)>(__rhs_alt).__value);
},
- __lhs, std::forward<_Rhs>(__rhs));
+ __lhs,
+ std::forward<_Rhs>(__rhs));
__lhs.__index = __rhs.index();
}
}
@@ -935,81 +816,63 @@ protected:
template <class _Traits, _Trait = _Traits::__move_constructible_trait>
class _LIBCPP_TEMPLATE_VIS __move_constructor;
-#define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, \
- move_constructor) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, \
- move_constructible_trait> \
- : public __ctor<__traits<_Types...>> { \
- using __base_type = __ctor<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __move_constructor(const __move_constructor&) = default; \
- move_constructor \
- ~__move_constructor() = default; \
- __move_constructor& operator=(const __move_constructor&) = default; \
- __move_constructor& operator=(__move_constructor&&) = default; \
- }
+# define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, move_constructor) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, move_constructible_trait> \
+ : public __ctor<__traits<_Types...>> { \
+ using __base_type = __ctor<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __move_constructor(const __move_constructor&) = default; \
+ move_constructor ~__move_constructor() = default; \
+ __move_constructor& operator=(const __move_constructor&) = default; \
+ __move_constructor& operator=(__move_constructor&&) = default; \
+ }
-_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
- _Trait::_TriviallyAvailable,
- __move_constructor(__move_constructor&& __that) = default;);
+_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(_Trait::_TriviallyAvailable,
+ __move_constructor(__move_constructor&& __that) = default;);
_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
_Trait::_Available,
- __move_constructor(__move_constructor&& __that) noexcept(
- __all<is_nothrow_move_constructible_v<_Types>...>::value)
- : __move_constructor(__valueless_t{}) {
- this->__generic_construct(*this, std::move(__that));
- });
+ __move_constructor(__move_constructor&& __that) noexcept(__all<is_nothrow_move_constructible_v<_Types>...>::value)
+ : __move_constructor(__valueless_t{}) { this->__generic_construct(*this, std::move(__that)); });
-_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
- _Trait::_Unavailable,
- __move_constructor(__move_constructor&&) = delete;);
+_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(_Trait::_Unavailable, __move_constructor(__move_constructor&&) = delete;);
-#undef _LIBCPP_VARIANT_MOVE_CONSTRUCTOR
+# undef _LIBCPP_VARIANT_MOVE_CONSTRUCTOR
template <class _Traits, _Trait = _Traits::__copy_constructible_trait>
class _LIBCPP_TEMPLATE_VIS __copy_constructor;
-#define _LIBCPP_VARIANT_COPY_CONSTRUCTOR(copy_constructible_trait, \
- copy_constructor) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, \
- copy_constructible_trait> \
- : public __move_constructor<__traits<_Types...>> { \
- using __base_type = __move_constructor<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- copy_constructor \
- __copy_constructor(__copy_constructor&&) = default; \
- ~__copy_constructor() = default; \
- __copy_constructor& operator=(const __copy_constructor&) = default; \
- __copy_constructor& operator=(__copy_constructor&&) = default; \
- }
+# define _LIBCPP_VARIANT_COPY_CONSTRUCTOR(copy_constructible_trait, copy_constructor) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, copy_constructible_trait> \
+ : public __move_constructor<__traits<_Types...>> { \
+ using __base_type = __move_constructor<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ copy_constructor __copy_constructor(__copy_constructor&&) = default; \
+ ~__copy_constructor() = default; \
+ __copy_constructor& operator=(const __copy_constructor&) = default; \
+ __copy_constructor& operator=(__copy_constructor&&) = default; \
+ }
-_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_TriviallyAvailable,
- __copy_constructor(const __copy_constructor& __that) = default;);
+_LIBCPP_VARIANT_COPY_CONSTRUCTOR(_Trait::_TriviallyAvailable,
+ __copy_constructor(const __copy_constructor& __that) = default;);
_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_Available,
- __copy_constructor(const __copy_constructor& __that)
- : __copy_constructor(__valueless_t{}) {
- this->__generic_construct(*this, __that);
- });
+ _Trait::_Available, __copy_constructor(const __copy_constructor& __that)
+ : __copy_constructor(__valueless_t{}) { this->__generic_construct(*this, __that); });
-_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_Unavailable,
- __copy_constructor(const __copy_constructor&) = delete;);
+_LIBCPP_VARIANT_COPY_CONSTRUCTOR(_Trait::_Unavailable, __copy_constructor(const __copy_constructor&) = delete;);
-#undef _LIBCPP_VARIANT_COPY_CONSTRUCTOR
+# undef _LIBCPP_VARIANT_COPY_CONSTRUCTOR
template <class _Traits>
class _LIBCPP_TEMPLATE_VIS __assignment : public __copy_constructor<_Traits> {
@@ -1020,40 +883,33 @@ public:
using __base_type::operator=;
template <size_t _Ip, class... _Args>
- _LIBCPP_HIDE_FROM_ABI
- auto& __emplace(_Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI auto& __emplace(_Args&&... __args) {
this->__destroy();
- auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
- std::forward<_Args>(__args)...);
+ auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), std::forward<_Args>(__args)...);
this->__index = _Ip;
return __res;
}
protected:
template <size_t _Ip, class _Tp, class _Arg>
- _LIBCPP_HIDE_FROM_ABI
- void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
+ _LIBCPP_HIDE_FROM_ABI void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
if (this->index() == _Ip) {
__a.__value = std::forward<_Arg>(__arg);
} else {
struct {
- _LIBCPP_HIDE_FROM_ABI void operator()(true_type) const {
- __this->__emplace<_Ip>(std::forward<_Arg>(__arg));
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()(true_type) const { __this->__emplace<_Ip>(std::forward<_Arg>(__arg)); }
_LIBCPP_HIDE_FROM_ABI void operator()(false_type) const {
__this->__emplace<_Ip>(_Tp(std::forward<_Arg>(__arg)));
}
__assignment* __this;
_Arg&& __arg;
} __impl{this, std::forward<_Arg>(__arg)};
- __impl(bool_constant<is_nothrow_constructible_v<_Tp, _Arg> ||
- !is_nothrow_move_constructible_v<_Tp>>{});
+ __impl(bool_constant < is_nothrow_constructible_v<_Tp, _Arg> || !is_nothrow_move_constructible_v < _Tp >> {});
}
}
template <class _That>
- _LIBCPP_HIDE_FROM_ABI
- void __generic_assign(_That&& __that) {
+ _LIBCPP_HIDE_FROM_ABI void __generic_assign(_That&& __that) {
if (this->valueless_by_exception() && __that.valueless_by_exception()) {
// do nothing.
} else if (__that.valueless_by_exception()) {
@@ -1062,11 +918,10 @@ protected:
__visitation::__base::__visit_alt_at(
__that.index(),
[this](auto& __this_alt, auto&& __that_alt) {
- this->__assign_alt(
- __this_alt,
- std::forward<decltype(__that_alt)>(__that_alt).__value);
+ this->__assign_alt(__this_alt, std::forward<decltype(__that_alt)>(__that_alt).__value);
},
- *this, std::forward<_That>(__that));
+ *this,
+ std::forward<_That>(__that));
}
}
};
@@ -1074,104 +929,88 @@ protected:
template <class _Traits, _Trait = _Traits::__move_assignable_trait>
class _LIBCPP_TEMPLATE_VIS __move_assignment;
-#define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, \
- move_assignment) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, \
- move_assignable_trait> \
- : public __assignment<__traits<_Types...>> { \
- using __base_type = __assignment<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __move_assignment(const __move_assignment&) = default; \
- __move_assignment(__move_assignment&&) = default; \
- ~__move_assignment() = default; \
- __move_assignment& operator=(const __move_assignment&) = default; \
- move_assignment \
- }
+# define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, move_assignment) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, move_assignable_trait> \
+ : public __assignment<__traits<_Types...>> { \
+ using __base_type = __assignment<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __move_assignment(const __move_assignment&) = default; \
+ __move_assignment(__move_assignment&&) = default; \
+ ~__move_assignment() = default; \
+ __move_assignment& operator=(const __move_assignment&) = default; \
+ move_assignment \
+ }
-_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
- _Trait::_TriviallyAvailable,
- __move_assignment& operator=(__move_assignment&& __that) = default;);
+_LIBCPP_VARIANT_MOVE_ASSIGNMENT(_Trait::_TriviallyAvailable,
+ __move_assignment& operator=(__move_assignment&& __that) = default;);
_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
_Trait::_Available,
- __move_assignment& operator=(__move_assignment&& __that) noexcept(
- __all<(is_nothrow_move_constructible_v<_Types> &&
- is_nothrow_move_assignable_v<_Types>)...>::value) {
+ __move_assignment&
+ operator=(__move_assignment&& __that) noexcept(
+ __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_move_assignable_v<_Types>)...>::value) {
this->__generic_assign(std::move(__that));
return *this;
});
-_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
- _Trait::_Unavailable,
- __move_assignment& operator=(__move_assignment&&) = delete;);
+_LIBCPP_VARIANT_MOVE_ASSIGNMENT(_Trait::_Unavailable, __move_assignment& operator=(__move_assignment&&) = delete;);
-#undef _LIBCPP_VARIANT_MOVE_ASSIGNMENT
+# undef _LIBCPP_VARIANT_MOVE_ASSIGNMENT
template <class _Traits, _Trait = _Traits::__copy_assignable_trait>
class _LIBCPP_TEMPLATE_VIS __copy_assignment;
-#define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, \
- copy_assignment) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, \
- copy_assignable_trait> \
- : public __move_assignment<__traits<_Types...>> { \
- using __base_type = __move_assignment<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- __copy_assignment(const __copy_assignment&) = default; \
- __copy_assignment(__copy_assignment&&) = default; \
- ~__copy_assignment() = default; \
- copy_assignment \
- __copy_assignment& operator=(__copy_assignment&&) = default; \
- }
+# define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, copy_assignment) \
+ template <class... _Types> \
+ class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, copy_assignable_trait> \
+ : public __move_assignment<__traits<_Types...>> { \
+ using __base_type = __move_assignment<__traits<_Types...>>; \
+ \
+ public: \
+ using __base_type::__base_type; \
+ using __base_type::operator=; \
+ \
+ __copy_assignment(const __copy_assignment&) = default; \
+ __copy_assignment(__copy_assignment&&) = default; \
+ ~__copy_assignment() = default; \
+ copy_assignment __copy_assignment& operator=(__copy_assignment&&) = default; \
+ }
-_LIBCPP_VARIANT_COPY_ASSIGNMENT(
- _Trait::_TriviallyAvailable,
- __copy_assignment& operator=(const __copy_assignment& __that) = default;);
+_LIBCPP_VARIANT_COPY_ASSIGNMENT(_Trait::_TriviallyAvailable,
+ __copy_assignment& operator=(const __copy_assignment& __that) = default;);
_LIBCPP_VARIANT_COPY_ASSIGNMENT(
- _Trait::_Available,
- __copy_assignment& operator=(const __copy_assignment& __that) {
+ _Trait::_Available, __copy_assignment& operator=(const __copy_assignment& __that) {
this->__generic_assign(__that);
return *this;
});
-_LIBCPP_VARIANT_COPY_ASSIGNMENT(
- _Trait::_Unavailable,
- __copy_assignment& operator=(const __copy_assignment&) = delete;);
+_LIBCPP_VARIANT_COPY_ASSIGNMENT(_Trait::_Unavailable, __copy_assignment& operator=(const __copy_assignment&) = delete;);
-#undef _LIBCPP_VARIANT_COPY_ASSIGNMENT
+# undef _LIBCPP_VARIANT_COPY_ASSIGNMENT
template <class... _Types>
-class _LIBCPP_TEMPLATE_VIS __impl
- : public __copy_assignment<__traits<_Types...>> {
+class _LIBCPP_TEMPLATE_VIS __impl : public __copy_assignment<__traits<_Types...>> {
using __base_type = __copy_assignment<__traits<_Types...>>;
public:
using __base_type::__base_type; // get in_place_index_t constructor & friends
- _LIBCPP_HIDE_FROM_ABI __impl(__impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __impl(__impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __impl(__impl const&) = default;
+ _LIBCPP_HIDE_FROM_ABI __impl(__impl&&) = default;
_LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl&&) = default;
+ _LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl&&) = default;
template <size_t _Ip, class _Arg>
- _LIBCPP_HIDE_FROM_ABI
- void __assign(_Arg&& __arg) {
- this->__assign_alt(__access::__base::__get_alt<_Ip>(*this),
- std::forward<_Arg>(__arg));
+ _LIBCPP_HIDE_FROM_ABI void __assign(_Arg&& __arg) {
+ this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), std::forward<_Arg>(__arg));
}
- inline _LIBCPP_HIDE_FROM_ABI
- void __swap(__impl& __that) {
+ inline _LIBCPP_HIDE_FROM_ABI void __swap(__impl& __that) {
if (this->valueless_by_exception() && __that.valueless_by_exception()) {
// do nothing.
} else if (this->index() == __that.index()) {
@@ -1190,7 +1029,7 @@ public:
std::swap(__lhs, __rhs);
}
__impl __tmp(std::move(*__rhs));
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
if constexpr (__all<is_nothrow_move_constructible_v<_Types>...>::value) {
this->__generic_construct(*__rhs, std::move(*__lhs));
} else {
@@ -1206,18 +1045,17 @@ public:
throw;
}
}
-#else
+# else
// this isn't consolidated with the `if constexpr` branch above due to
// `throw` being ill-formed with exceptions disabled even when discarded.
this->__generic_construct(*__rhs, std::move(*__lhs));
-#endif
+# endif
this->__generic_construct(*__lhs, std::move(__tmp));
}
}
private:
- inline _LIBCPP_HIDE_FROM_ABI
- bool __move_nothrow() const {
+ inline _LIBCPP_HIDE_FROM_ABI bool __move_nothrow() const {
constexpr bool __results[] = {is_nothrow_move_constructible_v<_Types>...};
return this->valueless_by_exception() || __results[this->index()];
}
@@ -1236,15 +1074,13 @@ struct __narrowing_check {
};
template <class _Dest, class _Source>
-using __check_for_narrowing _LIBCPP_NODEBUG =
- typename _If<
-#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
+using __check_for_narrowing _LIBCPP_NODEBUG = typename _If<
+# ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
false &&
-#endif
- is_arithmetic<_Dest>::value,
+# endif
+ is_arithmetic<_Dest>::value,
__narrowing_check,
- __no_narrowing_check
- >::template _Apply<_Dest, _Source>;
+ __no_narrowing_check >::template _Apply<_Dest, _Source>;
template <class _Tp, size_t _Idx>
struct __overload {
@@ -1253,12 +1089,11 @@ struct __overload {
};
// TODO(LLVM-19): Remove all occurrences of this macro.
-#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
+# ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
template <class _Tp, size_t>
-struct __overload_bool {
+struct __overload_bool {
template <class _Up, class _Ap = __remove_cvref_t<_Up>>
- auto operator()(bool, _Up&&) const
- -> enable_if_t<is_same_v<_Ap, bool>, __type_identity<_Tp>>;
+ auto operator()(bool, _Up&&) const -> enable_if_t<is_same_v<_Ap, bool>, __type_identity<_Tp>>;
};
template <size_t _Idx>
@@ -1269,9 +1104,9 @@ template <size_t _Idx>
struct __overload<bool volatile, _Idx> : __overload_bool<bool volatile, _Idx> {};
template <size_t _Idx>
struct __overload<bool const volatile, _Idx> : __overload_bool<bool const volatile, _Idx> {};
-#endif
+# endif
-template <class ..._Bases>
+template <class... _Bases>
struct __all_overloads : _Bases... {
void operator()() const;
using _Bases::operator()...;
@@ -1280,213 +1115,161 @@ struct __all_overloads : _Bases... {
template <class _IdxSeq>
struct __make_overloads_imp;
-template <size_t ..._Idx>
+template <size_t... _Idx>
struct __make_overloads_imp<__tuple_indices<_Idx...> > {
- template <class ..._Types>
+ template <class... _Types>
using _Apply _LIBCPP_NODEBUG = __all_overloads<__overload<_Types, _Idx>...>;
};
-template <class ..._Types>
-using _MakeOverloads _LIBCPP_NODEBUG = typename __make_overloads_imp<
- __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
+template <class... _Types>
+using _MakeOverloads _LIBCPP_NODEBUG =
+ typename __make_overloads_imp< __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
template <class _Tp, class... _Types>
-using __best_match_t =
- typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
+using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
} // namespace __variant_detail
template <class... _Types>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES variant
- : private __sfinae_ctor_base<
- __all<is_copy_constructible_v<_Types>...>::value,
- __all<is_move_constructible_v<_Types>...>::value>,
+ : private __sfinae_ctor_base< __all<is_copy_constructible_v<_Types>...>::value,
+ __all<is_move_constructible_v<_Types>...>::value>,
private __sfinae_assign_base<
- __all<(is_copy_constructible_v<_Types> &&
- is_copy_assignable_v<_Types>)...>::value,
- __all<(is_move_constructible_v<_Types> &&
- is_move_assignable_v<_Types>)...>::value> {
- static_assert(0 < sizeof...(_Types),
- "variant must consist of at least one alternative.");
+ __all<(is_copy_constructible_v<_Types> && is_copy_assignable_v<_Types>)...>::value,
+ __all<(is_move_constructible_v<_Types> && is_move_assignable_v<_Types>)...>::value> {
+ static_assert(0 < sizeof...(_Types), "variant must consist of at least one alternative.");
- static_assert(__all<!is_array_v<_Types>...>::value,
- "variant can not have an array type as an alternative.");
+ static_assert(__all<!is_array_v<_Types>...>::value, "variant can not have an array type as an alternative.");
- static_assert(__all<!is_reference_v<_Types>...>::value,
- "variant can not have a reference type as an alternative.");
+ static_assert(__all<!is_reference_v<_Types>...>::value, "variant can not have a reference type as an alternative.");
- static_assert(__all<!is_void_v<_Types>...>::value,
- "variant can not have a void type as an alternative.");
+ static_assert(__all<!is_void_v<_Types>...>::value, "variant can not have a void type as an alternative.");
using __first_type = variant_alternative_t<0, variant>;
public:
- template <bool _Dummy = true,
- enable_if_t<__dependent_type<is_default_constructible<__first_type>,
- _Dummy>::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
+ template <bool _Dummy = true,
+ enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
: __impl_(in_place_index<0>) {}
_LIBCPP_HIDE_FROM_ABI constexpr variant(const variant&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr variant(variant&&) = default;
-
- template <
- class _Arg,
- enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
- enable_if_t<!__is_inplace_type<__remove_cvref_t<_Arg>>::value, int> = 0,
- enable_if_t<!__is_inplace_index<__remove_cvref_t<_Arg>>::value, int> = 0,
- class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Arg>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- constexpr variant(_Arg&& __arg) noexcept(
- is_nothrow_constructible_v<_Tp, _Arg>)
+ _LIBCPP_HIDE_FROM_ABI constexpr variant(variant&&) = default;
+
+ template < class _Arg,
+ enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
+ enable_if_t<!__is_inplace_type<__remove_cvref_t<_Arg>>::value, int> = 0,
+ enable_if_t<!__is_inplace_index<__remove_cvref_t<_Arg>>::value, int> = 0,
+ class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, _Arg>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI constexpr variant(_Arg&& __arg) noexcept(is_nothrow_constructible_v<_Tp, _Arg>)
: __impl_(in_place_index<_Ip>, std::forward<_Arg>(__arg)) {}
- template <size_t _Ip, class... _Args,
- class = enable_if_t<(_Ip < sizeof...(_Types)), int>,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ template <size_t _Ip,
+ class... _Args,
+ class = enable_if_t<(_Ip < sizeof...(_Types)), int>,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(
- in_place_index_t<_Ip>,
- _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>)
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(in_place_index_t<_Ip>, _Args&&... __args) noexcept(
+ is_nothrow_constructible_v<_Tp, _Args...>)
: __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {}
- template <
- size_t _Ip,
- class _Up,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(
+ template < size_t _Ip,
+ class _Up,
+ class... _Args,
+ enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(
in_place_index_t<_Ip>,
initializer_list<_Up> __il,
- _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>)
+ _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>)
: __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {}
- template <
- class _Tp,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept(
+ template < class _Tp,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Tp, _Args...>)
: __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {}
- template <
- class _Tp,
- class _Up,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- explicit constexpr variant(
+ template < class _Tp,
+ class _Up,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(
in_place_type_t<_Tp>,
initializer_list<_Up> __il,
- _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>)
+ _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>)
: __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {}
_LIBCPP_HIDE_FROM_ABI ~variant() = default;
_LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(const variant&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(variant&&) = default;
-
- template <
- class _Arg,
- enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
- class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_assignable_v<_Tp&, _Arg> && is_constructible_v<_Tp, _Arg>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- variant& operator=(_Arg&& __arg) noexcept(
- is_nothrow_assignable_v<_Tp&, _Arg> &&
- is_nothrow_constructible_v<_Tp, _Arg>) {
+ _LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(variant&&) = default;
+
+ template < class _Arg,
+ enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
+ class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_assignable_v<_Tp&, _Arg> && is_constructible_v<_Tp, _Arg>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI variant&
+ operator=(_Arg&& __arg) noexcept(is_nothrow_assignable_v<_Tp&, _Arg> && is_nothrow_constructible_v<_Tp, _Arg>) {
__impl_.template __assign<_Ip>(std::forward<_Arg>(__arg));
return *this;
}
- template <
- size_t _Ip,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(_Args&&... __args) {
+ template < size_t _Ip,
+ class... _Args,
+ enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&... __args) {
return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...);
}
- template <
- size_t _Ip,
- class _Up,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ template < size_t _Ip,
+ class _Up,
+ class... _Args,
+ enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
+ class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...);
}
- template <
- class _Tp,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(_Args&&... __args) {
+ template < class _Tp,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&... __args) {
return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...);
}
- template <
- class _Tp,
- class _Up,
- class... _Args,
- size_t _Ip =
- __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ template < class _Tp,
+ class _Up,
+ class... _Args,
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
+ enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...);
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool valueless_by_exception() const noexcept {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept {
return __impl_.valueless_by_exception();
}
- _LIBCPP_HIDE_FROM_ABI
- constexpr size_t index() const noexcept { return __impl_.index(); }
-
- template <
- bool _Dummy = true,
- enable_if_t<
- __all<(
- __dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
- __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- void swap(variant& __that) noexcept(
- __all<(is_nothrow_move_constructible_v<_Types> &&
- is_nothrow_swappable_v<_Types>)...>::value) {
+ _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); }
+
+ template < bool _Dummy = true,
+ enable_if_t< __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
+ __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void swap(variant& __that) noexcept(
+ __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) {
__impl_.__swap(__that.__impl_);
}
@@ -1498,21 +1281,17 @@ private:
};
template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept {
return __v.index() == _Ip;
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
return std::__holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr auto&& __generic_get(_Vp&& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr auto&& __generic_get(_Vp&& __v) {
using __variant_detail::__access::__variant;
if (!std::__holds_alternative<_Ip>(__v)) {
__throw_bad_variant_access();
@@ -1522,9 +1301,8 @@ constexpr auto&& __generic_get(_Vp&& __v) {
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(
- variant<_Types...>& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&
+ get(variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(__v);
@@ -1532,9 +1310,8 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(
- variant<_Types...>&& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&&
+ get(variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(std::move(__v));
@@ -1542,9 +1319,8 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get(
- const variant<_Types...>& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&
+ get(const variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(__v);
@@ -1552,60 +1328,47 @@ constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get(
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get(
- const variant<_Types...>&& __v) {
+ _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&&
+ get(const variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(std::move(__v));
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr _Tp& get(variant<_Types...>& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp& get(variant<_Types...>& __v) {
static_assert(!is_void_v<_Tp>);
return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr _Tp&& get(variant<_Types...>&& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp&& get(variant<_Types...>&& __v) {
static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(
- std::move(__v));
+ return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const _Tp& get(const variant<_Types...>& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&
+get(const variant<_Types...>& __v) {
static_assert(!is_void_v<_Tp>);
return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr const _Tp&& get(const variant<_Types...>&& __v) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&&
+get(const variant<_Types...>&& __v) {
static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(
- std::move(__v));
+ return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
}
template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto* __generic_get_if(_Vp* __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto* __generic_get_if(_Vp* __v) noexcept {
using __variant_detail::__access::__variant;
- return __v && std::__holds_alternative<_Ip>(*__v)
- ? std::addressof(__variant::__get_alt<_Ip>(*__v).__value)
- : nullptr;
+ return __v && std::__holds_alternative<_Ip>(*__v) ? std::addressof(__variant::__get_alt<_Ip>(*__v).__value) : nullptr;
}
template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
get_if(variant<_Types...>* __v) noexcept {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
@@ -1613,8 +1376,7 @@ get_if(variant<_Types...>* __v) noexcept {
}
template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
get_if(const variant<_Types...>* __v) noexcept {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
@@ -1622,17 +1384,13 @@ get_if(const variant<_Types...>* __v) noexcept {
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<_Tp>
-get_if(variant<_Types...>* __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __v) noexcept {
static_assert(!is_void_v<_Tp>);
return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr add_pointer_t<const _Tp>
-get_if(const variant<_Types...>* __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const _Tp> get_if(const variant<_Types...>* __v) noexcept {
static_assert(!is_void_v<_Tp>);
return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
@@ -1640,27 +1398,27 @@ get_if(const variant<_Types...>* __v) noexcept {
template <class _Operator>
struct __convert_to_bool {
template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI
- constexpr bool operator()(_T1 && __t1, _T2&& __t2) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_T1&& __t1, _T2&& __t2) const {
static_assert(is_convertible<decltype(_Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2))), bool>::value,
- "the relational operator does not return a type which is implicitly convertible to bool");
+ "the relational operator does not return a type which is implicitly convertible to bool");
return _Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2));
}
};
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator==(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.index() != __rhs.index()) return false;
- if (__lhs.valueless_by_exception()) return true;
+ if (__lhs.index() != __rhs.index())
+ return false;
+ if (__lhs.valueless_by_exception())
+ return true;
return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<equal_to<>>{}, __lhs, __rhs);
}
# if _LIBCPP_STD_VER >= 20
-template <class... _Types> requires (three_way_comparable<_Types> && ...)
+template <class... _Types>
+ requires(three_way_comparable<_Types> && ...)
_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<compare_three_way_result_t<_Types>...>
operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
@@ -1680,130 +1438,124 @@ operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
# endif // _LIBCPP_STD_VER >= 20
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator!=(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.index() != __rhs.index()) return true;
- if (__lhs.valueless_by_exception()) return false;
- return __variant::__visit_value_at(
- __lhs.index(), __convert_to_bool<not_equal_to<>>{}, __lhs, __rhs);
+ if (__lhs.index() != __rhs.index())
+ return true;
+ if (__lhs.valueless_by_exception())
+ return false;
+ return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<not_equal_to<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator<(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__rhs.valueless_by_exception()) return false;
- if (__lhs.valueless_by_exception()) return true;
- if (__lhs.index() < __rhs.index()) return true;
- if (__lhs.index() > __rhs.index()) return false;
+ if (__rhs.valueless_by_exception())
+ return false;
+ if (__lhs.valueless_by_exception())
+ return true;
+ if (__lhs.index() < __rhs.index())
+ return true;
+ if (__lhs.index() > __rhs.index())
+ return false;
return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<less<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator>(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.valueless_by_exception()) return false;
- if (__rhs.valueless_by_exception()) return true;
- if (__lhs.index() > __rhs.index()) return true;
- if (__lhs.index() < __rhs.index()) return false;
+ if (__lhs.valueless_by_exception())
+ return false;
+ if (__rhs.valueless_by_exception())
+ return true;
+ if (__lhs.index() > __rhs.index())
+ return true;
+ if (__lhs.index() < __rhs.index())
+ return false;
return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<greater<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator<=(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__lhs.valueless_by_exception()) return true;
- if (__rhs.valueless_by_exception()) return false;
- if (__lhs.index() < __rhs.index()) return true;
- if (__lhs.index() > __rhs.index()) return false;
- return __variant::__visit_value_at(
- __lhs.index(), __convert_to_bool<less_equal<>>{}, __lhs, __rhs);
+ if (__lhs.valueless_by_exception())
+ return true;
+ if (__rhs.valueless_by_exception())
+ return false;
+ if (__lhs.index() < __rhs.index())
+ return true;
+ if (__lhs.index() > __rhs.index())
+ return false;
+ return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<less_equal<>>{}, __lhs, __rhs);
}
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr bool operator>=(const variant<_Types...>& __lhs,
- const variant<_Types...>& __rhs) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
using __variant_detail::__visitation::__variant;
- if (__rhs.valueless_by_exception()) return true;
- if (__lhs.valueless_by_exception()) return false;
- if (__lhs.index() > __rhs.index()) return true;
- if (__lhs.index() < __rhs.index()) return false;
- return __variant::__visit_value_at(
- __lhs.index(), __convert_to_bool<greater_equal<>>{}, __lhs, __rhs);
+ if (__rhs.valueless_by_exception())
+ return true;
+ if (__lhs.valueless_by_exception())
+ return false;
+ if (__lhs.index() > __rhs.index())
+ return true;
+ if (__lhs.index() < __rhs.index())
+ return false;
+ return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<greater_equal<>>{}, __lhs, __rhs);
}
template <class... _Vs>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr void __throw_if_valueless(_Vs&&... __vs) {
- const bool __valueless =
- (... || std::__as_variant(__vs).valueless_by_exception());
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr void __throw_if_valueless(_Vs&&... __vs) {
+ const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception());
if (__valueless) {
__throw_bad_variant_access();
}
}
-template <
- class _Visitor, class... _Vs,
- typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
+template < class _Visitor, class... _Vs, typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto)
+visit(_Visitor&& __visitor, _Vs&&... __vs) {
using __variant_detail::__visitation::__variant;
std::__throw_if_valueless(std::forward<_Vs>(__vs)...);
- return __variant::__visit_value(std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs)...);
+ return __variant::__visit_value(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
}
-#if _LIBCPP_STD_VER >= 20
-template <
- class _Rp, class _Visitor, class... _Vs,
- typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
-constexpr _Rp visit(_Visitor&& __visitor, _Vs&&... __vs) {
+# if _LIBCPP_STD_VER >= 20
+template < class _Rp,
+ class _Visitor,
+ class... _Vs,
+ typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp
+visit(_Visitor&& __visitor, _Vs&&... __vs) {
using __variant_detail::__visitation::__variant;
std::__throw_if_valueless(std::forward<_Vs>(__vs)...);
- return __variant::__visit_value<_Rp>(std::forward<_Visitor>(__visitor),
- std::forward<_Vs>(__vs)...);
+ return __variant::__visit_value<_Rp>(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
}
-#endif
+# endif
template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-auto swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs)
- noexcept(noexcept(__lhs.swap(__rhs)))
- -> decltype( __lhs.swap(__rhs))
- { return __lhs.swap(__rhs); }
+_LIBCPP_HIDE_FROM_ABI auto
+swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs)))
+ -> decltype(__lhs.swap(__rhs)) {
+ return __lhs.swap(__rhs);
+}
template <class... _Types>
-struct _LIBCPP_TEMPLATE_VIS hash<
- __enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>> {
+struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>> {
using argument_type = variant<_Types...>;
- using result_type = size_t;
+ using result_type = size_t;
- _LIBCPP_HIDE_FROM_ABI
- result_type operator()(const argument_type& __v) const {
+ _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type& __v) const {
using __variant_detail::__visitation::__variant;
size_t __res =
__v.valueless_by_exception()
- ? 299792458 // Random value chosen by the universe upon creation
- : __variant::__visit_alt(
- [](const auto& __alt) {
- using __alt_type = __remove_cvref_t<decltype(__alt)>;
- using __value_type = remove_const_t<
- typename __alt_type::__value_type>;
- return hash<__value_type>{}(__alt.__value);
- },
- __v);
+ ? 299792458 // Random value chosen by the universe upon creation
+ : __variant::__visit_alt(
+ [](const auto& __alt) {
+ using __alt_type = __remove_cvref_t<decltype(__alt)>;
+ using __value_type = remove_const_t< typename __alt_type::__value_type>;
+ return hash<__value_type>{}(__alt.__value);
+ },
+ __v);
return std::__hash_combine(__res, hash<size_t>{}(__v.index()));
}
};
@@ -1812,21 +1564,18 @@ struct _LIBCPP_TEMPLATE_VIS hash<
// type whereas std::get will throw or returning nullptr. This makes it faster than
// std::get.
template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto&& __unchecked_get(_Vp&& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(_Vp&& __v) noexcept {
using __variant_detail::__access::__variant;
return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value;
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto&& __unchecked_get(const variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(const variant<_Types...>& __v) noexcept {
return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-constexpr auto&& __unchecked_get(variant<_Types...>& __v) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(variant<_Types...>& __v) noexcept {
return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
diff --git a/contrib/llvm-project/libcxx/include/vector b/contrib/llvm-project/libcxx/include/vector
index d010a1f6ec9f..0098273a195f 100644
--- a/contrib/llvm-project/libcxx/include/vector
+++ b/contrib/llvm-project/libcxx/include/vector
@@ -384,64 +384,59 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator /* = allocator<_Tp> */>
-class _LIBCPP_TEMPLATE_VIS vector
-{
+class _LIBCPP_TEMPLATE_VIS vector {
private:
- typedef allocator<_Tp> __default_allocator_type;
+ typedef allocator<_Tp> __default_allocator_type;
+
public:
- typedef vector __self;
- typedef _Tp value_type;
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef typename __alloc_traits::pointer pointer;
- typedef typename __alloc_traits::const_pointer const_pointer;
- // TODO: Implement iterator bounds checking without requiring the global database.
- typedef __wrap_iter<pointer> iterator;
- typedef __wrap_iter<const_pointer> const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- {
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(const allocator_type& __a)
+ typedef vector __self;
+ typedef _Tp value_type;
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef typename __alloc_traits::pointer pointer;
+ typedef typename __alloc_traits::const_pointer const_pointer;
+ // TODO: Implement iterator bounds checking without requiring the global database.
+ typedef __wrap_iter<pointer> iterator;
+ typedef __wrap_iter<const_pointer> const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
+ static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
#else
- _NOEXCEPT
+ _NOEXCEPT
#endif
- : __end_cap_(nullptr, __a)
- {
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n);
+ : __end_cap_(nullptr, __a) {
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x);
- template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(size_type __n, const value_type& __x, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
- {
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
+ template <class = __enable_if_t<__is_allocator<_Allocator>::value> >
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(size_type __n, const value_type& __x, const allocator_type& __a)
+ : __end_cap_(nullptr, __a) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
}
+ }
template <class _InputIterator,
__enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
@@ -462,7 +457,8 @@ public:
int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator,
+ template <
+ class _ForwardIterator,
__enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
is_constructible<value_type, typename iterator_traits<_ForwardIterator>::reference>::value,
int> = 0>
@@ -471,8 +467,9 @@ public:
#if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr vector(from_range_t, _Range&& __range,
- const allocator_type& __alloc = allocator_type()) : __end_cap_(nullptr, __alloc) {
+ _LIBCPP_HIDE_FROM_ABI constexpr vector(
+ from_range_t, _Range&& __range, const allocator_type& __alloc = allocator_type())
+ : __end_cap_(nullptr, __alloc) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
auto __n = static_cast<size_type>(ranges::distance(__range));
__init_with_size(ranges::begin(__range), ranges::end(__range), __n);
@@ -485,54 +482,52 @@ public:
private:
class __destroy_vector {
- public:
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
- if (__vec_.__begin_ != nullptr) {
- __vec_.__clear();
- __vec_.__annotate_delete();
- __alloc_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.capacity());
- }
+ public:
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
+ if (__vec_.__begin_ != nullptr) {
+ __vec_.__clear();
+ __vec_.__annotate_delete();
+ __alloc_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.capacity());
}
+ }
- private:
- vector& __vec_;
+ private:
+ vector& __vec_;
};
public:
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector(*this)(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector (*this)(); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector& operator=(const vector& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(const vector& __x, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(const vector& __x);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(initializer_list<value_type> __il);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(initializer_list<value_type> __il);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(initializer_list<value_type> __il, const allocator_type& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(initializer_list<value_type> __il, const allocator_type& __a);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector& operator=(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end()); return *this;}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
+ }
#endif // !_LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(vector&& __x)
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(vector&& __x)
#if _LIBCPP_STD_VER >= 17
- noexcept;
+ noexcept;
#else
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector(vector&& __x, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- vector& operator=(vector&& __x)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ vector(vector&& __x, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(vector&& __x)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
template <class _InputIterator,
__enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
@@ -547,140 +542,129 @@ public:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(_ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void assign_range(_Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void assign_range(_Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const_reference __u);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const_reference __u);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- allocator_type get_allocator() const _NOEXCEPT
- {return this->__alloc();}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_iterator cbegin() const _NOEXCEPT
- {return begin();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_iterator cend() const _NOEXCEPT
- {return end();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return rbegin();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_reverse_iterator crend() const _NOEXCEPT
- {return rend();}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- size_type size() const _NOEXCEPT
- {return static_cast<size_type>(this->__end_ - this->__begin_);}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- size_type capacity() const _NOEXCEPT
- {return static_cast<size_type>(__end_cap() - this->__begin_);}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- bool empty() const _NOEXCEPT
- {return this->__begin_ == this->__end_;}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
- return *this->__begin_;
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
- return *this->__begin_;
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
- return *(this->__end_ - 1);
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
- return *(this->__end_ - 1);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ return this->__alloc();
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
+ return static_cast<size_type>(this->__end_ - this->__begin_);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT {
+ return static_cast<size_type>(__end_cap() - this->__begin_);
+ }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
+ return this->__begin_ == this->__end_;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __n) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
+ return *this->__begin_;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
+ return *this->__begin_;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
+ return *(this->__end_ - 1);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
+ return *(this->__end_ - 1);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- value_type* data() _NOEXCEPT
- {return std::__to_address(this->__begin_);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data() _NOEXCEPT {
+ return std::__to_address(this->__begin_);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const value_type* data() const _NOEXCEPT
- {return std::__to_address(this->__begin_);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data() const _NOEXCEPT {
+ return std::__to_address(this->__begin_);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x);
- template <class... _Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
#if _LIBCPP_STD_VER >= 17
- reference emplace_back(_Args&&... __args);
+ reference
+ emplace_back(_Args&&... __args);
#else
- void emplace_back(_Args&&... __args);
+ void
+ emplace_back(_Args&&... __args);
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void pop_back();
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back();
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, value_type&& __x);
- template <class... _Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __position, _Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, value_type&& __x);
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __position, _Args&&... __args);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __position, size_type __n, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __position, size_type __n, const_reference __x);
template <class _InputIterator,
__enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
@@ -690,17 +674,16 @@ public:
insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
template <
@@ -712,191 +695,185 @@ public:
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator insert(const_iterator __position, initializer_list<value_type> __il)
- {return insert(__position, __il.begin(), __il.end());}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __position, initializer_list<value_type> __il) {
+ return insert(__position, __il.begin(), __il.end());
+ }
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __position);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __position);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void clear() _NOEXCEPT
- {
- size_type __old_size = size();
- __clear();
- __annotate_shrink(__old_size);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT {
+ size_type __old_size = size();
+ __clear();
+ __annotate_shrink(__old_size);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz, const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(vector&)
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(vector&)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
private:
- pointer __begin_ = nullptr;
- pointer __end_ = nullptr;
- __compressed_pair<pointer, allocator_type> __end_cap_ =
- __compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag());
-
- // Allocate space for __n objects
- // throws length_error if __n > max_size()
- // throws (probably bad_alloc) if memory run out
- // Precondition: __begin_ == __end_ == __end_cap() == 0
- // Precondition: __n > 0
- // Postcondition: capacity() >= __n
- // Postcondition: size() == 0
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
- if (__n > max_size())
- __throw_length_error();
- auto __allocation = std::__allocate_at_least(__alloc(), __n);
- __begin_ = __allocation.ptr;
- __end_ = __allocation.ptr;
- __end_cap() = __begin_ + __allocation.count;
- __annotate_new(0);
+ pointer __begin_ = nullptr;
+ pointer __end_ = nullptr;
+ __compressed_pair<pointer, allocator_type> __end_cap_ =
+ __compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag());
+
+ // Allocate space for __n objects
+ // throws length_error if __n > max_size()
+ // throws (probably bad_alloc) if memory run out
+ // Precondition: __begin_ == __end_ == __end_cap() == 0
+ // Precondition: __n > 0
+ // Postcondition: capacity() >= __n
+ // Postcondition: size() == 0
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
+ if (__n > max_size())
+ __throw_length_error();
+ auto __allocation = std::__allocate_at_least(__alloc(), __n);
+ __begin_ = __allocation.ptr;
+ __end_ = __allocation.ptr;
+ __end_cap() = __begin_ + __allocation.count;
+ __annotate_new(0);
+ }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vdeallocate() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __recommend(size_type __new_size) const;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x);
+
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__first, __last, __n);
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vdeallocate() _NOEXCEPT;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __recommend(size_type __new_size) const;
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(size_type __n, const_reference __x);
+ __guard.__complete();
+ }
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0) {
- __vallocate(__n);
- __construct_at_end(__first, __last, __n);
- }
+ for (; __first != __last; ++__first)
+ emplace_back(*__first);
- __guard.__complete();
- }
+ __guard.__complete();
+ }
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
- for (; __first != __last; ++__first)
- emplace_back(*__first);
+ template <class _ForwardIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n);
- __guard.__complete();
- }
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
-
- template <class _ForwardIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n);
-
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
-
- template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
-
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __make_iter(pointer __p) _NOEXCEPT { return iterator(__p); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { return const_iterator(__p); }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_range(pointer __from_s, pointer __from_e, pointer __to);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value);
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __destruct_at_end(pointer __new_last) _NOEXCEPT
- {
- size_type __old_size = size();
- __base_destruct_at_end(__new_last);
- __annotate_shrink(__old_size);
- }
+ template <class _Iterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
- template <class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- inline pointer __push_back_slow_path(_Up&& __x);
-
- template <class... _Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- inline pointer __emplace_back_slow_path(_Args&&... __args);
-
- // The following functions are no-ops outside of AddressSanitizer mode.
- // We call annotations for every allocator, unless explicitly disabled.
- //
- // To disable annotations for a particular allocator, change value of
- // __asan_annotate_container_with_allocator to false.
- // For more details, see the "Using libc++" documentation page or
- // the documentation for __sanitizer_annotate_contiguous_container.
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_contiguous_container(const void *__beg,
- const void *__end,
- const void *__old_mid,
- const void *__new_mid) const
- {
- (void)__beg;
- (void)__end;
- (void)__old_mid;
- (void)__new_mid;
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT {
+ return iterator(__p);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT {
+ return const_iterator(__p);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
+ __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __move_range(pointer __from_s, pointer __from_e, pointer __to);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_end(pointer __new_last) _NOEXCEPT {
+ size_type __old_size = size();
+ __base_destruct_at_end(__new_last);
+ __annotate_shrink(__old_size);
+ }
+
+ template <class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer __push_back_slow_path(_Up&& __x);
+
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer __emplace_back_slow_path(_Args&&... __args);
+
+ // The following functions are no-ops outside of AddressSanitizer mode.
+ // We call annotations for every allocator, unless explicitly disabled.
+ //
+ // To disable annotations for a particular allocator, change value of
+ // __asan_annotate_container_with_allocator to false.
+ // For more details, see the "Using libc++" documentation page or
+ // the documentation for __sanitizer_annotate_contiguous_container.
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_contiguous_container(
+ const void* __beg, const void* __end, const void* __old_mid, const void* __new_mid) const {
+ (void)__beg;
+ (void)__end;
+ (void)__old_mid;
+ (void)__new_mid;
#ifndef _LIBCPP_HAS_NO_ASAN
- if (!__libcpp_is_constant_evaluated() && __beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
- __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
+ if (!__libcpp_is_constant_evaluated() && __beg != nullptr &&
+ __asan_annotate_container_with_allocator<_Allocator>::value)
+ __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
#endif
- }
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_new(size_type __current_size) const _NOEXCEPT {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + capacity(), data() + __current_size);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
+ (void)__current_size;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + capacity(), data() + __current_size);
+#endif
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_delete() const _NOEXCEPT {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + size(), data() + capacity());
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + capacity());
+#endif
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_increase(size_type __n) const _NOEXCEPT
- {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + size(), data() + size() + __n);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_increase(size_type __n) const _NOEXCEPT {
+ (void)__n;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + size() + __n);
+#endif
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __annotate_shrink(size_type __old_size) const _NOEXCEPT
- {
- __annotate_contiguous_container(data(), data() + capacity(),
- data() + __old_size, data() + size());
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
+ (void)__old_size;
+#ifndef _LIBCPP_HAS_NO_ASAN
+ __annotate_contiguous_container(data(), data() + capacity(), data() + __old_size, data() + size());
+#endif
+ }
struct _ConstructTransaction {
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- explicit _ConstructTransaction(vector &__v, size_type __n)
- : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(vector& __v, size_type __n)
+ : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
#ifndef _LIBCPP_HAS_NO_ASAN
__v_.__annotate_increase(__n);
#endif
@@ -910,76 +887,62 @@ private:
#endif
}
- vector &__v_;
+ vector& __v_;
pointer __pos_;
const_pointer const __new_end_;
private:
- _ConstructTransaction(_ConstructTransaction const&) = delete;
+ _ConstructTransaction(_ConstructTransaction const&) = delete;
_ConstructTransaction& operator=(_ConstructTransaction const&) = delete;
};
- template <class ..._Args>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __construct_one_at_end(_Args&& ...__args) {
+ template <class... _Args>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_one_at_end(_Args&&... __args) {
_ConstructTransaction __tx(*this, 1);
- __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_),
- std::forward<_Args>(__args)...);
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__tx.__pos_), std::forward<_Args>(__args)...);
++__tx.__pos_;
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- allocator_type& __alloc() _NOEXCEPT
- {return this->__end_cap_.second();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const allocator_type& __alloc() const _NOEXCEPT
- {return this->__end_cap_.second();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- pointer& __end_cap() _NOEXCEPT
- {return this->__end_cap_.first();}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- const pointer& __end_cap() const _NOEXCEPT
- {return this->__end_cap_.first();}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT {
+ return this->__end_cap_.second();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT {
+ return this->__end_cap_.second();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT {
+ return this->__end_cap_.first();
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT {
+ return this->__end_cap_.first();
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __clear() _NOEXCEPT {__base_destruct_at_end(this->__begin_);}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __clear() _NOEXCEPT {
+ __base_destruct_at_end(this->__begin_);
+ }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __base_destruct_at_end(pointer __new_last) _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __base_destruct_at_end(pointer __new_last) _NOEXCEPT {
pointer __soon_to_be_end = this->__end_;
while (__new_last != __soon_to_be_end)
- __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
+ __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
this->__end_ = __new_last;
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const vector& __c)
- {__copy_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_copy_assignment::value>());}
-
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(vector& __c)
- _NOEXCEPT_(
- !__alloc_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());}
-
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_length_error() const {
- std::__throw_length_error("vector");
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c) {
+ __copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());
}
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_out_of_range() const {
- std::__throw_out_of_range("vector");
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector& __c)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const vector& __c, true_type)
- {
- if (__alloc() != __c.__alloc())
- {
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
+
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) {
+ if (__alloc() != __c.__alloc()) {
__clear();
__annotate_delete();
__alloc_traits::deallocate(__alloc(), this->__begin_, capacity());
@@ -988,124 +951,97 @@ private:
__alloc() = __c.__alloc();
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __copy_assign_alloc(const vector&, false_type)
- {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector&, false_type) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
__alloc() = std::move(__c.__alloc());
}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __move_assign_alloc(vector&, false_type)
- _NOEXCEPT
- {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector&, false_type) _NOEXCEPT {}
};
#if _LIBCPP_STD_VER >= 17
-template<class _InputIterator,
- class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-vector(_InputIterator, _InputIterator)
- -> vector<__iter_value_type<_InputIterator>, _Alloc>;
-
-template<class _InputIterator,
- class _Alloc,
- class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-vector(_InputIterator, _InputIterator, _Alloc)
- -> vector<__iter_value_type<_InputIterator>, _Alloc>;
+template <class _InputIterator,
+ class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+vector(_InputIterator, _InputIterator) -> vector<__iter_value_type<_InputIterator>, _Alloc>;
+
+template <class _InputIterator,
+ class _Alloc,
+ class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+vector(_InputIterator, _InputIterator, _Alloc) -> vector<__iter_value_type<_InputIterator>, _Alloc>;
#endif
#if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range,
class _Alloc = allocator<ranges::range_value_t<_Range>>,
- class = enable_if_t<__is_allocator<_Alloc>::value>
- >
-vector(from_range_t, _Range&&, _Alloc = _Alloc())
- -> vector<ranges::range_value_t<_Range>, _Alloc>;
+ class = enable_if_t<__is_allocator<_Alloc>::value> >
+vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_t<_Range>, _Alloc>;
#endif
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
-{
- __annotate_delete();
- using _RevIter = std::reverse_iterator<pointer>;
- __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
- __alloc(), _RevIter(__end_), _RevIter(__begin_), _RevIter(__v.__begin_))
- .base();
- std::swap(this->__begin_, __v.__begin_);
- std::swap(this->__end_, __v.__end_);
- std::swap(this->__end_cap(), __v.__end_cap());
- __v.__first_ = __v.__begin_;
- __annotate_new(size());
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::pointer
-vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) {
+ __annotate_delete();
+ using _RevIter = std::reverse_iterator<pointer>;
+ __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
+ __alloc(), _RevIter(__end_), _RevIter(__begin_), _RevIter(__v.__begin_))
+ .base();
+ std::swap(this->__begin_, __v.__begin_);
+ std::swap(this->__end_, __v.__end_);
+ std::swap(this->__end_cap(), __v.__end_cap());
+ __v.__first_ = __v.__begin_;
+ __annotate_new(size());
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
+vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) {
+ __annotate_delete();
+ pointer __r = __v.__begin_;
+ using _RevIter = std::reverse_iterator<pointer>;
+ __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
+ __alloc(), _RevIter(__p), _RevIter(__begin_), _RevIter(__v.__begin_))
+ .base();
+ __v.__end_ = std::__uninitialized_allocator_move_if_noexcept(__alloc(), __p, __end_, __v.__end_);
+ std::swap(this->__begin_, __v.__begin_);
+ std::swap(this->__end_, __v.__end_);
+ std::swap(this->__end_cap(), __v.__end_cap());
+ __v.__first_ = __v.__begin_;
+ __annotate_new(size());
+ return __r;
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT {
+ if (this->__begin_ != nullptr) {
+ clear();
__annotate_delete();
- pointer __r = __v.__begin_;
- using _RevIter = std::reverse_iterator<pointer>;
- __v.__begin_ = std::__uninitialized_allocator_move_if_noexcept(
- __alloc(), _RevIter(__p), _RevIter(__begin_), _RevIter(__v.__begin_))
- .base();
- __v.__end_ = std::__uninitialized_allocator_move_if_noexcept(__alloc(), __p, __end_, __v.__end_);
- std::swap(this->__begin_, __v.__begin_);
- std::swap(this->__end_, __v.__end_);
- std::swap(this->__end_cap(), __v.__end_cap());
- __v.__first_ = __v.__begin_;
- __annotate_new(size());
- return __r;
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT
-{
- if (this->__begin_ != nullptr)
- {
- clear();
- __annotate_delete();
- __alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity());
- this->__begin_ = this->__end_ = this->__end_cap() = nullptr;
- }
+ __alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity());
+ this->__begin_ = this->__end_ = this->__end_cap() = nullptr;
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::size_type
-vector<_Tp, _Allocator>::max_size() const _NOEXCEPT
-{
- return std::min<size_type>(__alloc_traits::max_size(this->__alloc()),
- numeric_limits<difference_type>::max());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::size_type
+vector<_Tp, _Allocator>::max_size() const _NOEXCEPT {
+ return std::min<size_type>(__alloc_traits::max_size(this->__alloc()), numeric_limits<difference_type>::max());
}
// Precondition: __new_size > capacity()
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::size_type
-vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
-{
- const size_type __ms = max_size();
- if (__new_size > __ms)
- this->__throw_length_error();
- const size_type __cap = capacity();
- if (__cap >= __ms / 2)
- return __ms;
- return std::max<size_type>(2 * __cap, __new_size);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
+vector<_Tp, _Allocator>::__recommend(size_type __new_size) const {
+ const size_type __ms = max_size();
+ if (__new_size > __ms)
+ this->__throw_length_error();
+ const size_type __cap = capacity();
+ if (__cap >= __ms / 2)
+ return __ms;
+ return std::max<size_type>(2 * __cap, __new_size);
}
// Default constructs __n objects starting at __end_
@@ -1114,15 +1050,12 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
-{
- _ConstructTransaction __tx(*this, __n);
- const_pointer __new_end = __tx.__new_end_;
- for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
- __alloc_traits::construct(this->__alloc(), std::__to_address(__pos));
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__construct_at_end(size_type __n) {
+ _ConstructTransaction __tx(*this, __n);
+ const_pointer __new_end = __tx.__new_end_;
+ for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__pos));
+ }
}
// Copy constructs __n objects starting at __end_ from __x
@@ -1132,16 +1065,13 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
-{
- _ConstructTransaction __tx(*this, __n);
- const_pointer __new_end = __tx.__new_end_;
- for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
- __alloc_traits::construct(this->__alloc(), std::__to_address(__pos), __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
+vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) {
+ _ConstructTransaction __tx(*this, __n);
+ const_pointer __new_end = __tx.__new_end_;
+ for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__pos), __x);
+ }
}
template <class _Tp, class _Allocator>
@@ -1157,19 +1087,15 @@ vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __
// Postcondition: size() == size() + __n
// Exception safety: strong.
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__append(size_type __n)
-{
- if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
- this->__construct_at_end(__n);
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
- __v.__construct_at_end(__n);
- __swap_out_circular_buffer(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type __n) {
+ if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
+ this->__construct_at_end(__n);
+ else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
+ __v.__construct_at_end(__n);
+ __swap_out_circular_buffer(__v);
+ }
}
// Default constructs __n objects starting at __end_
@@ -1177,1403 +1103,1186 @@ vector<_Tp, _Allocator>::__append(size_type __n)
// Postcondition: size() == size() + __n
// Exception safety: strong.
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x)
-{
- if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
- this->__construct_at_end(__n, __x);
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
- __v.__construct_at_end(__n, __x);
- __swap_out_circular_buffer(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) {
+ if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n)
+ this->__construct_at_end(__n, __x);
+ else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a);
+ __v.__construct_at_end(__n, __x);
+ __swap_out_circular_buffer(__v);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(size_type __n)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n);
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n);
+ }
+ __guard.__complete();
}
#if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n);
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
+ : __end_cap_(nullptr, __a) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n);
+ }
+ __guard.__complete();
}
#endif
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
+ }
+ __guard.__complete();
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last)
-{
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last) {
__init_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
+ : __end_cap_(nullptr, __a) {
__init_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last)
-{
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last) {
size_type __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
+ : __end_cap_(nullptr, __a) {
size_type __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<_Tp, _Allocator>::vector(const vector& __x)
- : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc()))
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(const vector& __x)
+ : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc())) {
__init_with_size(__x.__begin_, __x.__end_, __x.size());
}
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
- : __end_cap_(nullptr, __a)
-{
+ : __end_cap_(nullptr, __a) {
__init_with_size(__x.__begin_, __x.__end_, __x.size());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>::vector(vector&& __x)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>::vector(vector&& __x)
#if _LIBCPP_STD_VER >= 17
- noexcept
+ noexcept
#else
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
#endif
- : __end_cap_(nullptr, std::move(__x.__alloc()))
-{
- this->__begin_ = __x.__begin_;
- this->__end_ = __x.__end_;
- this->__end_cap() = __x.__end_cap();
- __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
+ : __end_cap_(nullptr, std::move(__x.__alloc())) {
+ this->__begin_ = __x.__begin_;
+ this->__end_ = __x.__end_;
+ this->__end_cap() = __x.__end_cap();
+ __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
- : __end_cap_(nullptr, __a)
-{
- if (__a == __x.__alloc())
- {
- this->__begin_ = __x.__begin_;
- this->__end_ = __x.__end_;
- this->__end_cap() = __x.__end_cap();
- __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
- }
- else
- {
- typedef move_iterator<iterator> _Ip;
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- assign(_Ip(__x.begin()), _Ip(__x.end()));
- __guard.__complete();
- }
+ : __end_cap_(nullptr, __a) {
+ if (__a == __x.__alloc()) {
+ this->__begin_ = __x.__begin_;
+ this->__end_ = __x.__end_;
+ this->__end_cap() = __x.__end_cap();
+ __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
+ } else {
+ typedef move_iterator<iterator> _Ip;
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ assign(_Ip(__x.begin()), _Ip(__x.end()));
+ __guard.__complete();
+ }
}
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__il.size() > 0)
- {
- __vallocate(__il.size());
- __construct_at_end(__il.begin(), __il.end(), __il.size());
- }
- __guard.__complete();
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
+vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__il.size() > 0) {
+ __vallocate(__il.size());
+ __construct_at_end(__il.begin(), __il.end(), __il.size());
+ }
+ __guard.__complete();
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
- : __end_cap_(nullptr, __a)
-{
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- if (__il.size() > 0)
- {
- __vallocate(__il.size());
- __construct_at_end(__il.begin(), __il.end(), __il.size());
- }
- __guard.__complete();
+ : __end_cap_(nullptr, __a) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+ if (__il.size() > 0) {
+ __vallocate(__il.size());
+ __construct_at_end(__il.begin(), __il.end(), __il.size());
+ }
+ __guard.__complete();
}
#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>&
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(vector&& __x)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
-{
- __move_assign(__x, integral_constant<bool,
- __alloc_traits::propagate_on_container_move_assignment::value>());
- return *this;
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value)
-{
- if (__alloc() != __c.__alloc())
- {
- typedef move_iterator<iterator> _Ip;
- assign(_Ip(__c.begin()), _Ip(__c.end()));
- }
- else
- __move_assign(__c, true_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value) {
+ if (__alloc() != __c.__alloc()) {
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
+ } else
+ __move_assign(__c, true_type());
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- __vdeallocate();
- __move_assign_alloc(__c); // this can throw
- this->__begin_ = __c.__begin_;
- this->__end_ = __c.__end_;
- this->__end_cap() = __c.__end_cap();
- __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __vdeallocate();
+ __move_assign_alloc(__c); // this can throw
+ this->__begin_ = __c.__begin_;
+ this->__end_ = __c.__end_;
+ this->__end_cap() = __c.__end_cap();
+ __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-vector<_Tp, _Allocator>&
-vector<_Tp, _Allocator>::operator=(const vector& __x)
-{
- if (this != std::addressof(__x))
- {
- __copy_assign_alloc(__x);
- assign(__x.__begin_, __x.__end_);
- }
- return *this;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>&
+vector<_Tp, _Allocator>::operator=(const vector& __x) {
+ if (this != std::addressof(__x)) {
+ __copy_assign_alloc(__x);
+ assign(__x.__begin_, __x.__end_);
+ }
+ return *this;
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last) {
__assign_with_sentinel(__first, __last);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
- clear();
- for (; __first != __last; ++__first)
- emplace_back(*__first);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
+ clear();
+ for (; __first != __last; ++__first)
+ emplace_back(*__first);
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
-{
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) {
__assign_with_size(__first, __last, std::distance(__first, __last));
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n) {
- size_type __new_size = static_cast<size_type>(__n);
- if (__new_size <= capacity())
- {
- if (__new_size > size())
- {
- _ForwardIterator __mid = std::next(__first, size());
- std::copy(__first, __mid, this->__begin_);
- __construct_at_end(__mid, __last, __new_size - size());
- }
- else
- {
- pointer __m = std::__copy<_ClassicAlgPolicy>(__first, __last, this->__begin_).second;
- this->__destruct_at_end(__m);
- }
- }
- else
- {
- __vdeallocate();
- __vallocate(__recommend(__new_size));
- __construct_at_end(__first, __last, __new_size);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n) {
+ size_type __new_size = static_cast<size_type>(__n);
+ if (__new_size <= capacity()) {
+ if (__new_size > size()) {
+ _ForwardIterator __mid = std::next(__first, size());
+ std::copy(__first, __mid, this->__begin_);
+ __construct_at_end(__mid, __last, __new_size - size());
+ } else {
+ pointer __m = std::__copy<_ClassicAlgPolicy>(__first, __last, this->__begin_).second;
+ this->__destruct_at_end(__m);
}
+ } else {
+ __vdeallocate();
+ __vallocate(__recommend(__new_size));
+ __construct_at_end(__first, __last, __new_size);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
-{
- if (__n <= capacity())
- {
- size_type __s = size();
- std::fill_n(this->__begin_, std::min(__n, __s), __u);
- if (__n > __s)
- __construct_at_end(__n - __s, __u);
- else
- this->__destruct_at_end(this->__begin_ + __n);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) {
+ if (__n <= capacity()) {
+ size_type __s = size();
+ std::fill_n(this->__begin_, std::min(__n, __s), __u);
+ if (__n > __s)
+ __construct_at_end(__n - __s, __u);
else
- {
- __vdeallocate();
- __vallocate(__recommend(static_cast<size_type>(__n)));
- __construct_at_end(__n, __u);
- }
+ this->__destruct_at_end(this->__begin_ + __n);
+ } else {
+ __vdeallocate();
+ __vallocate(__recommend(static_cast<size_type>(__n)));
+ __construct_at_end(__n, __u);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::begin() _NOEXCEPT
-{
- return __make_iter(this->__begin_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::begin() _NOEXCEPT {
+ return __make_iter(this->__begin_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::const_iterator
-vector<_Tp, _Allocator>::begin() const _NOEXCEPT
-{
- return __make_iter(this->__begin_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::begin() const _NOEXCEPT {
+ return __make_iter(this->__begin_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::end() _NOEXCEPT
-{
- return __make_iter(this->__end_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::end() _NOEXCEPT {
+ return __make_iter(this->__end_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::const_iterator
-vector<_Tp, _Allocator>::end() const _NOEXCEPT
-{
- return __make_iter(this->__end_);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::end() const _NOEXCEPT {
+ return __make_iter(this->__end_);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::reference
-vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::reference
+vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::const_reference
-vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_reference
+vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::reference
-vector<_Tp, _Allocator>::at(size_type __n)
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::at(size_type __n) {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::const_reference
-vector<_Tp, _Allocator>::at(size_type __n) const
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return this->__begin_[__n];
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::const_reference
+vector<_Tp, _Allocator>::at(size_type __n) const {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return this->__begin_[__n];
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::reserve(size_type __n)
-{
- if (__n > capacity())
- {
- if (__n > max_size())
- this->__throw_length_error();
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__n, size(), __a);
- __swap_out_circular_buffer(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::reserve(size_type __n) {
+ if (__n > capacity()) {
+ if (__n > max_size())
+ this->__throw_length_error();
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__n, size(), __a);
+ __swap_out_circular_buffer(__v);
+ }
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- if (capacity() > size())
- {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ if (capacity() > size()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(size(), size(), __a);
- __swap_out_circular_buffer(__v);
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(size(), size(), __a);
+ __swap_out_circular_buffer(__v);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Tp, class _Allocator>
template <class _Up>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::pointer
-vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x)
-{
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
- // __v.push_back(std::forward<_Up>(__x));
- __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Up>(__x));
- __v.__end_++;
- __swap_out_circular_buffer(__v);
- return this->__end_;
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-vector<_Tp, _Allocator>::push_back(const_reference __x)
-{
- pointer __end = this->__end_;
- if (__end < this->__end_cap()) {
- __construct_one_at_end(__x);
- ++__end;
- } else {
- __end = __push_back_slow_path(__x);
- }
- this->__end_ = __end;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
+vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+ // __v.push_back(std::forward<_Up>(__x));
+ __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Up>(__x));
+ __v.__end_++;
+ __swap_out_circular_buffer(__v);
+ return this->__end_;
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+vector<_Tp, _Allocator>::push_back(const_reference __x) {
+ pointer __end = this->__end_;
+ if (__end < this->__end_cap()) {
+ __construct_one_at_end(__x);
+ ++__end;
+ } else {
+ __end = __push_back_slow_path(__x);
+ }
+ this->__end_ = __end;
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-vector<_Tp, _Allocator>::push_back(value_type&& __x)
-{
- pointer __end = this->__end_;
- if (__end < this->__end_cap()) {
- __construct_one_at_end(std::move(__x));
- ++__end;
- } else {
- __end = __push_back_slow_path(std::move(__x));
- }
- this->__end_ = __end;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void vector<_Tp, _Allocator>::push_back(value_type&& __x) {
+ pointer __end = this->__end_;
+ if (__end < this->__end_cap()) {
+ __construct_one_at_end(std::move(__x));
+ ++__end;
+ } else {
+ __end = __push_back_slow_path(std::move(__x));
+ }
+ this->__end_ = __end;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::pointer
-vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
-{
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
-// __v.emplace_back(std::forward<_Args>(__args)...);
- __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Args>(__args)...);
- __v.__end_++;
- __swap_out_circular_buffer(__v);
- return this->__end_;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
+vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+ // __v.emplace_back(std::forward<_Args>(__args)...);
+ __alloc_traits::construct(__a, std::__to_address(__v.__end_), std::forward<_Args>(__args)...);
+ __v.__end_++;
+ __swap_out_circular_buffer(__v);
+ return this->__end_;
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline
#if _LIBCPP_STD_VER >= 17
-typename vector<_Tp, _Allocator>::reference
+ typename vector<_Tp, _Allocator>::reference
#else
-void
+ void
#endif
-vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
-{
- pointer __end = this->__end_;
- if (__end < this->__end_cap()) {
- __construct_one_at_end(std::forward<_Args>(__args)...);
- ++__end;
- } else {
- __end = __emplace_back_slow_path(std::forward<_Args>(__args)...);
- }
- this->__end_ = __end;
+ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
+ pointer __end = this->__end_;
+ if (__end < this->__end_cap()) {
+ __construct_one_at_end(std::forward<_Args>(__args)...);
+ ++__end;
+ } else {
+ __end = __emplace_back_slow_path(std::forward<_Args>(__args)...);
+ }
+ this->__end_ = __end;
#if _LIBCPP_STD_VER >= 17
- return *(__end - 1);
+ return *(__end - 1);
#endif
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline
-void
-vector<_Tp, _Allocator>::pop_back()
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector::pop_back called on an empty vector");
- this->__destruct_at_end(this->__end_ - 1);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void vector<_Tp, _Allocator>::pop_back() {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector::pop_back called on an empty vector");
+ this->__destruct_at_end(this->__end_ - 1);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::erase(const_iterator __position)
-{
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__position != end(),
- "vector::erase(iterator) called with a non-dereferenceable iterator");
- difference_type __ps = __position - cbegin();
- pointer __p = this->__begin_ + __ps;
- this->__destruct_at_end(std::move(__p + 1, this->__end_, __p));
- return __make_iter(__p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::erase(const_iterator __position) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ __position != end(), "vector::erase(iterator) called with a non-dereferenceable iterator");
+ difference_type __ps = __position - cbegin();
+ pointer __p = this->__begin_ + __ps;
+ this->__destruct_at_end(std::move(__p + 1, this->__end_, __p));
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
-{
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "vector::erase(first, last) called with invalid range");
- pointer __p = this->__begin_ + (__first - begin());
- if (__first != __last) {
- this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p));
- }
- return __make_iter(__p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "vector::erase(first, last) called with invalid range");
+ pointer __p = this->__begin_ + (__first - begin());
+ if (__first != __last) {
+ this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p));
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to)
-{
- pointer __old_last = this->__end_;
- difference_type __n = __old_last - __to;
- {
- pointer __i = __from_s + __n;
- _ConstructTransaction __tx(*this, __from_e - __i);
- for (pointer __pos = __tx.__pos_; __i < __from_e;
- ++__i, (void) ++__pos, __tx.__pos_ = __pos) {
- __alloc_traits::construct(this->__alloc(),
- std::__to_address(__pos),
- std::move(*__i));
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) {
+ pointer __old_last = this->__end_;
+ difference_type __n = __old_last - __to;
+ {
+ pointer __i = __from_s + __n;
+ _ConstructTransaction __tx(*this, __from_e - __i);
+ for (pointer __pos = __tx.__pos_; __i < __from_e; ++__i, (void)++__pos, __tx.__pos_ = __pos) {
+ __alloc_traits::construct(this->__alloc(), std::__to_address(__pos), std::move(*__i));
}
- std::move_backward(__from_s, __from_s + __n, __old_last);
+ }
+ std::move_backward(__from_s, __from_s + __n, __old_last);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
-{
- pointer __p = this->__begin_ + (__position - begin());
- // We can't compare unrelated pointers inside constant expressions
- if (!__libcpp_is_constant_evaluated() && this->__end_ < this->__end_cap())
- {
- if (__p == this->__end_)
- {
- __construct_one_at_end(__x);
- }
- else
- {
- __move_range(__p, this->__end_, __p + 1);
- const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
- if (__p <= __xr && __xr < this->__end_)
- ++__xr;
- *__p = *__xr;
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
- __v.push_back(__x);
- __p = __swap_out_circular_buffer(__v, __p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) {
+ pointer __p = this->__begin_ + (__position - begin());
+ // We can't compare unrelated pointers inside constant expressions
+ if (!__libcpp_is_constant_evaluated() && this->__end_ < this->__end_cap()) {
+ if (__p == this->__end_) {
+ __construct_one_at_end(__x);
+ } else {
+ __move_range(__p, this->__end_, __p + 1);
+ const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
+ if (__p <= __xr && __xr < this->__end_)
+ ++__xr;
+ *__p = *__xr;
}
- return __make_iter(__p);
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+ __v.push_back(__x);
+ __p = __swap_out_circular_buffer(__v, __p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
-{
- pointer __p = this->__begin_ + (__position - begin());
- if (this->__end_ < this->__end_cap())
- {
- if (__p == this->__end_)
- {
- __construct_one_at_end(std::move(__x));
- }
- else
- {
- __move_range(__p, this->__end_, __p + 1);
- *__p = std::move(__x);
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
- __v.push_back(std::move(__x));
- __p = __swap_out_circular_buffer(__v, __p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) {
+ pointer __p = this->__begin_ + (__position - begin());
+ if (this->__end_ < this->__end_cap()) {
+ if (__p == this->__end_) {
+ __construct_one_at_end(std::move(__x));
+ } else {
+ __move_range(__p, this->__end_, __p + 1);
+ *__p = std::move(__x);
}
- return __make_iter(__p);
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+ __v.push_back(std::move(__x));
+ __p = __swap_out_circular_buffer(__v, __p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
template <class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
-{
- pointer __p = this->__begin_ + (__position - begin());
- if (this->__end_ < this->__end_cap())
- {
- if (__p == this->__end_)
- {
- __construct_one_at_end(std::forward<_Args>(__args)...);
- }
- else
- {
- __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::forward<_Args>(__args)...);
- __move_range(__p, this->__end_, __p + 1);
- *__p = std::move(__tmp.get());
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
- __v.emplace_back(std::forward<_Args>(__args)...);
- __p = __swap_out_circular_buffer(__v, __p);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) {
+ pointer __p = this->__begin_ + (__position - begin());
+ if (this->__end_ < this->__end_cap()) {
+ if (__p == this->__end_) {
+ __construct_one_at_end(std::forward<_Args>(__args)...);
+ } else {
+ __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::forward<_Args>(__args)...);
+ __move_range(__p, this->__end_, __p + 1);
+ *__p = std::move(__tmp.get());
}
- return __make_iter(__p);
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a);
+ __v.emplace_back(std::forward<_Args>(__args)...);
+ __p = __swap_out_circular_buffer(__v, __p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)
-{
- pointer __p = this->__begin_ + (__position - begin());
- if (__n > 0)
- {
- // We can't compare unrelated pointers inside constant expressions
- if (!__libcpp_is_constant_evaluated() && __n <= static_cast<size_type>(this->__end_cap() - this->__end_))
- {
- size_type __old_n = __n;
- pointer __old_last = this->__end_;
- if (__n > static_cast<size_type>(this->__end_ - __p))
- {
- size_type __cx = __n - (this->__end_ - __p);
- __construct_at_end(__cx, __x);
- __n -= __cx;
- }
- if (__n > 0)
- {
- __move_range(__p, __old_last, __p + __old_n);
- const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
- if (__p <= __xr && __xr < this->__end_)
- __xr += __old_n;
- std::fill_n(__p, __n, *__xr);
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
- __v.__construct_at_end(__n, __x);
- __p = __swap_out_circular_buffer(__v, __p);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) {
+ pointer __p = this->__begin_ + (__position - begin());
+ if (__n > 0) {
+ // We can't compare unrelated pointers inside constant expressions
+ if (!__libcpp_is_constant_evaluated() && __n <= static_cast<size_type>(this->__end_cap() - this->__end_)) {
+ size_type __old_n = __n;
+ pointer __old_last = this->__end_;
+ if (__n > static_cast<size_type>(this->__end_ - __p)) {
+ size_type __cx = __n - (this->__end_ - __p);
+ __construct_at_end(__cx, __x);
+ __n -= __cx;
+ }
+ if (__n > 0) {
+ __move_range(__p, __old_last, __p + __old_n);
+ const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
+ if (__p <= __xr && __xr < this->__end_)
+ __xr += __old_n;
+ std::fill_n(__p, __n, *__xr);
+ }
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
+ __v.__construct_at_end(__n, __x);
+ __p = __swap_out_circular_buffer(__v, __p);
}
- return __make_iter(__p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
- int> >
+template <class _InputIterator,
+ __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_InputIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
-{
+vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) {
return __insert_with_sentinel(__position, __first, __last);
}
template <class _Tp, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) {
- difference_type __off = __position - begin();
- pointer __p = this->__begin_ + __off;
- allocator_type& __a = this->__alloc();
- pointer __old_last = this->__end_;
- for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
- {
- __construct_one_at_end(*__first);
- }
- __split_buffer<value_type, allocator_type&> __v(__a);
- if (__first != __last)
- {
+ difference_type __off = __position - begin();
+ pointer __p = this->__begin_ + __off;
+ allocator_type& __a = this->__alloc();
+ pointer __old_last = this->__end_;
+ for (; this->__end_ != this->__end_cap() && __first != __last; ++__first) {
+ __construct_one_at_end(*__first);
+ }
+ __split_buffer<value_type, allocator_type&> __v(__a);
+ if (__first != __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last));
- difference_type __old_size = __old_last - this->__begin_;
- difference_type __old_p = __p - this->__begin_;
- reserve(__recommend(size() + __v.size()));
- __p = this->__begin_ + __old_p;
- __old_last = this->__begin_ + __old_size;
+ __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last));
+ difference_type __old_size = __old_last - this->__begin_;
+ difference_type __old_p = __p - this->__begin_;
+ reserve(__recommend(size() + __v.size()));
+ __p = this->__begin_ + __old_p;
+ __old_last = this->__begin_ + __old_size;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- erase(__make_iter(__old_last), end());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ erase(__make_iter(__old_last), end());
+ throw;
}
- __p = std::rotate(__p, __old_last, this->__end_);
- insert(__make_iter(__p), std::make_move_iterator(__v.begin()),
- std::make_move_iterator(__v.end()));
- return begin() + __off;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+ __p = std::rotate(__p, __old_last, this->__end_);
+ insert(__make_iter(__p), std::make_move_iterator(__v.begin()), std::make_move_iterator(__v.end()));
+ return begin() + __off;
}
template <class _Tp, class _Allocator>
-template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
- is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
- int> >
+template <class _ForwardIterator,
+ __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value &&
+ is_constructible<_Tp, typename iterator_traits<_ForwardIterator>::reference>::value,
+ int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
-{
+vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) {
return __insert_with_size(__position, __first, __last, std::distance(__first, __last));
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<_Tp, _Allocator>::iterator
-vector<_Tp, _Allocator>::__insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last,
- difference_type __n) {
- auto __insertion_size = __n;
- pointer __p = this->__begin_ + (__position - begin());
- if (__n > 0)
- {
- if (__n <= this->__end_cap() - this->__end_)
- {
- size_type __old_n = __n;
- pointer __old_last = this->__end_;
- _Iterator __m = std::next(__first, __n);
- difference_type __dx = this->__end_ - __p;
- if (__n > __dx)
- {
- __m = __first;
- difference_type __diff = this->__end_ - __p;
- std::advance(__m, __diff);
- __construct_at_end(__m, __last, __n - __diff);
- __n = __dx;
- }
- if (__n > 0)
- {
- __move_range(__p, __old_last, __p + __old_n);
- std::copy(__first, __m, __p);
- }
- }
- else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
- __v.__construct_at_end_with_size(__first, __insertion_size);
- __p = __swap_out_circular_buffer(__v, __p);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::__insert_with_size(
+ const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n) {
+ auto __insertion_size = __n;
+ pointer __p = this->__begin_ + (__position - begin());
+ if (__n > 0) {
+ if (__n <= this->__end_cap() - this->__end_) {
+ size_type __old_n = __n;
+ pointer __old_last = this->__end_;
+ _Iterator __m = std::next(__first, __n);
+ difference_type __dx = this->__end_ - __p;
+ if (__n > __dx) {
+ __m = __first;
+ difference_type __diff = this->__end_ - __p;
+ std::advance(__m, __diff);
+ __construct_at_end(__m, __last, __n - __diff);
+ __n = __dx;
+ }
+ if (__n > 0) {
+ __move_range(__p, __old_last, __p + __old_n);
+ std::copy(__first, __m, __p);
+ }
+ } else {
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a);
+ __v.__construct_at_end_with_size(__first, __insertion_size);
+ __p = __swap_out_circular_buffer(__v, __p);
}
- return __make_iter(__p);
+ }
+ return __make_iter(__p);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::resize(size_type __sz)
-{
- size_type __cs = size();
- if (__cs < __sz)
- this->__append(__sz - __cs);
- else if (__cs > __sz)
- this->__destruct_at_end(this->__begin_ + __sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __sz) {
+ size_type __cs = size();
+ if (__cs < __sz)
+ this->__append(__sz - __cs);
+ else if (__cs > __sz)
+ this->__destruct_at_end(this->__begin_ + __sz);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x)
-{
- size_type __cs = size();
- if (__cs < __sz)
- this->__append(__sz - __cs, __x);
- else if (__cs > __sz)
- this->__destruct_at_end(this->__begin_ + __sz);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) {
+ size_type __cs = size();
+ if (__cs < __sz)
+ this->__append(__sz - __cs, __x);
+ else if (__cs > __sz)
+ this->__destruct_at_end(this->__begin_ + __sz);
}
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<_Tp, _Allocator>::swap(vector& __x)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__alloc_traits::propagate_on_container_swap::value ||
- this->__alloc() == __x.__alloc(),
- "vector::swap: Either propagate_on_container_swap must be true"
- " or the allocators must compare equal");
- std::swap(this->__begin_, __x.__begin_);
- std::swap(this->__end_, __x.__end_);
- std::swap(this->__end_cap(), __x.__end_cap());
- std::__swap_allocator(this->__alloc(), __x.__alloc(),
- integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-vector<_Tp, _Allocator>::__invariants() const
-{
- if (this->__begin_ == nullptr)
- {
- if (this->__end_ != nullptr || this->__end_cap() != nullptr)
- return false;
- }
- else
- {
- if (this->__begin_ > this->__end_)
- return false;
- if (this->__begin_ == this->__end_cap())
- return false;
- if (this->__end_ > this->__end_cap())
- return false;
- }
- return true;
+ _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
+ __alloc_traits::propagate_on_container_swap::value || this->__alloc() == __x.__alloc(),
+ "vector::swap: Either propagate_on_container_swap must be true"
+ " or the allocators must compare equal");
+ std::swap(this->__begin_, __x.__begin_);
+ std::swap(this->__end_, __x.__end_);
+ std::swap(this->__end_cap(), __x.__end_cap());
+ std::__swap_allocator(
+ this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const {
+ if (this->__begin_ == nullptr) {
+ if (this->__end_ != nullptr || this->__end_cap() != nullptr)
+ return false;
+ } else {
+ if (this->__begin_ > this->__end_)
+ return false;
+ if (this->__begin_ == this->__end_cap())
+ return false;
+ if (this->__end_ > this->__end_cap())
+ return false;
+ }
+ return true;
}
// vector<bool>
-template <class _Allocator> class vector<bool, _Allocator>;
+template <class _Allocator>
+class vector<bool, _Allocator>;
-template <class _Allocator> struct hash<vector<bool, _Allocator> >;
+template <class _Allocator>
+struct hash<vector<bool, _Allocator> >;
template <class _Allocator>
-struct __has_storage_type<vector<bool, _Allocator> >
-{
- static const bool value = true;
+struct __has_storage_type<vector<bool, _Allocator> > {
+ static const bool value = true;
};
template <class _Allocator>
-class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator>
-{
+class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator> {
public:
- typedef vector __self;
- typedef bool value_type;
- typedef _Allocator allocator_type;
- typedef allocator_traits<allocator_type> __alloc_traits;
- typedef typename __alloc_traits::size_type size_type;
- typedef typename __alloc_traits::difference_type difference_type;
- typedef size_type __storage_type;
- typedef __bit_iterator<vector, false> pointer;
- typedef __bit_iterator<vector, true> const_pointer;
- typedef pointer iterator;
- typedef const_pointer const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef vector __self;
+ typedef bool value_type;
+ typedef _Allocator allocator_type;
+ typedef allocator_traits<allocator_type> __alloc_traits;
+ typedef typename __alloc_traits::size_type size_type;
+ typedef typename __alloc_traits::difference_type difference_type;
+ typedef size_type __storage_type;
+ typedef __bit_iterator<vector, false> pointer;
+ typedef __bit_iterator<vector, true> const_pointer;
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
- typedef __rebind_alloc<__alloc_traits, __storage_type> __storage_allocator;
- typedef allocator_traits<__storage_allocator> __storage_traits;
- typedef typename __storage_traits::pointer __storage_pointer;
- typedef typename __storage_traits::const_pointer __const_storage_pointer;
-
- __storage_pointer __begin_;
- size_type __size_;
- __compressed_pair<size_type, __storage_allocator> __cap_alloc_;
+ typedef __rebind_alloc<__alloc_traits, __storage_type> __storage_allocator;
+ typedef allocator_traits<__storage_allocator> __storage_traits;
+ typedef typename __storage_traits::pointer __storage_pointer;
+ typedef typename __storage_traits::const_pointer __const_storage_pointer;
+
+ __storage_pointer __begin_;
+ size_type __size_;
+ __compressed_pair<size_type, __storage_allocator> __cap_alloc_;
+
public:
- typedef __bit_reference<vector> reference;
+ typedef __bit_reference<vector> reference;
#ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
- using const_reference = bool;
+ using const_reference = bool;
#else
- typedef __bit_const_reference<vector> const_reference;
+ typedef __bit_const_reference<vector> const_reference;
#endif
+
private:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type& __cap() _NOEXCEPT
- {return __cap_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const size_type& __cap() const _NOEXCEPT
- {return __cap_alloc_.first();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __storage_allocator& __alloc() _NOEXCEPT
- {return __cap_alloc_.second();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const __storage_allocator& __alloc() const _NOEXCEPT
- {return __cap_alloc_.second();}
-
- static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type __internal_cap_to_external(size_type __n) _NOEXCEPT
- {return __n * __bits_per_word;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type __external_cap_to_internal(size_type __n) _NOEXCEPT
- {return (__n - 1) / __bits_per_word + 1;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type& __cap() _NOEXCEPT { return __cap_alloc_.first(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const size_type& __cap() const _NOEXCEPT {
+ return __cap_alloc_.first();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __storage_allocator& __alloc() _NOEXCEPT {
+ return __cap_alloc_.second();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const __storage_allocator& __alloc() const _NOEXCEPT {
+ return __cap_alloc_.second();
+ }
+
+ static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type
+ __internal_cap_to_external(size_type __n) _NOEXCEPT {
+ return __n * __bits_per_word;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type
+ __external_cap_to_internal(size_type __n) _NOEXCEPT {
+ return (__n - 1) / __bits_per_word + 1;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
#else
- _NOEXCEPT;
+ _NOEXCEPT;
#endif
private:
class __destroy_vector {
- public:
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
+ public:
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
- if (__vec_.__begin_ != nullptr)
- __storage_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.__cap());
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
+ if (__vec_.__begin_ != nullptr)
+ __storage_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.__cap());
+ }
- private:
- vector& __vec_;
+ private:
+ vector& __vec_;
};
public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector(*this)(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector (*this)(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n);
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v, const allocator_type& __a);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(size_type __n, const value_type& __v, const allocator_type& __a);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_InputIterator __first, _InputIterator __last);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr
- vector(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __init_with_size(ranges::begin(__range), ranges::end(__range), __n);
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr vector(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __init_with_size(ranges::begin(__range), ranges::end(__range), __n);
- } else {
- __init_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ } else {
+ __init_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(const vector& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(const vector& __v, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(const vector& __v);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(initializer_list<value_type> __il);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(initializer_list<value_type> __il, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector& operator=(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end()); return *this;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ return *this;
+ }
#endif // !_LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector(vector&& __v)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(vector&& __v)
#if _LIBCPP_STD_VER >= 17
- noexcept;
+ noexcept;
#else
- _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(vector&& __v, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- vector& operator=(vector&& __v)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ vector(vector&& __v, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector& operator=(vector&& __v)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_InputIterator __first, _InputIterator __last);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- void
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_ForwardIterator __first, _ForwardIterator __last);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_InputIterator __first, _InputIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ void _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 assign(_ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void assign_range(_Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void assign_range(_Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ __assign_with_size(ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ __assign_with_sentinel(ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void assign(size_type __n, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void assign(size_type __n, const value_type& __x);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void assign(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT
- {return allocator_type(this->__alloc());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type capacity() const _NOEXCEPT
- {return __internal_cap_to_external(__cap());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_type size() const _NOEXCEPT
- {return __size_;}
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- bool empty() const _NOEXCEPT
- {return __size_ == 0;}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator begin() _NOEXCEPT
- {return __make_iter(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator begin() const _NOEXCEPT
- {return __make_iter(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator end() _NOEXCEPT
- {return __make_iter(__size_);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator end() const _NOEXCEPT
- {return __make_iter(__size_);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rbegin() _NOEXCEPT
- {return reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rbegin() const _NOEXCEPT
- {return const_reverse_iterator(end());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reverse_iterator rend() _NOEXCEPT
- {return reverse_iterator(begin());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator rend() const _NOEXCEPT
- {return const_reverse_iterator(begin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cbegin() const _NOEXCEPT
- {return __make_iter(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator cend() const _NOEXCEPT
- {return __make_iter(__size_);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crbegin() const _NOEXCEPT
- {return rbegin();}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reverse_iterator crend() const _NOEXCEPT
- {return rend();}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __n) {return __make_ref(__n);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __n) const {return __make_ref(__n);}
- _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
- _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() {return __make_ref(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const {return __make_ref(0);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() {return __make_ref(__size_ - 1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const {return __make_ref(__size_ - 1);}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(this->__alloc());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
+ return __internal_cap_to_external(__cap());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT { return __size_; }
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT {
+ return __size_ == 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT { return __make_iter(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT { return __make_iter(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT { return __make_iter(__size_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
+ return __make_iter(__size_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT { return __make_iter(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT {
+ return __make_iter(__size_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __n) { return __make_ref(__n); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __n) const {
+ return __make_ref(__n);
+ }
+ _LIBCPP_HIDE_FROM_ABI reference at(size_type __n);
+ _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() { return __make_ref(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const { return __make_ref(0); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() { return __make_ref(__size_ - 1); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const { return __make_ref(__size_ - 1); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(const value_type& __x);
#if _LIBCPP_STD_VER >= 14
- template <class... _Args>
-#if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference emplace_back(_Args&&... __args)
-#else
- _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args)
-#endif
- {
- push_back ( value_type ( std::forward<_Args>(__args)... ));
-#if _LIBCPP_STD_VER >= 17
- return this->back();
-#endif
- }
+ template <class... _Args>
+# if _LIBCPP_STD_VER >= 17
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference emplace_back(_Args&&... __args)
+# else
+ _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args)
+# endif
+ {
+ push_back(value_type(std::forward<_Args>(__args)...));
+# if _LIBCPP_STD_VER >= 17
+ return this->back();
+# endif
+ }
#endif
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void append_range(_Range&& __range) {
- insert_range(end(), std::forward<_Range>(__range));
- }
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) {
+ insert_range(end(), std::forward<_Range>(__range));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back() {--__size_;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back() { --__size_; }
#if _LIBCPP_STD_VER >= 14
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator emplace(const_iterator __position, _Args&&... __args)
- { return insert ( __position, value_type ( std::forward<_Args>(__args)... )); }
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator emplace(const_iterator __position, _Args&&... __args) {
+ return insert(__position, value_type(std::forward<_Args>(__args)...));
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, const value_type& __x);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, size_type __n, const value_type& __x);
- template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
- iterator
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
- template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- iterator
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __position, const value_type& __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ insert(const_iterator __position, size_type __n, const value_type& __x);
+ template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
+ iterator _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
+ template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
+ iterator _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
+ insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
#if _LIBCPP_STD_VER >= 23
- template <_ContainerCompatibleRange<bool> _Range>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
- if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
- auto __n = static_cast<size_type>(ranges::distance(__range));
- return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
-
- } else {
- return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
- }
+ template <_ContainerCompatibleRange<bool> _Range>
+ _LIBCPP_HIDE_FROM_ABI constexpr iterator insert_range(const_iterator __position, _Range&& __range) {
+ if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
+ auto __n = static_cast<size_type>(ranges::distance(__range));
+ return __insert_with_size(__position, ranges::begin(__range), ranges::end(__range), __n);
+
+ } else {
+ return __insert_with_sentinel(__position, ranges::begin(__range), ranges::end(__range));
}
+ }
#endif
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator insert(const_iterator __position, initializer_list<value_type> __il)
- {return insert(__position, __il.begin(), __il.end());}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
+ insert(const_iterator __position, initializer_list<value_type> __il) {
+ return insert(__position, __il.begin(), __il.end());
+ }
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __position);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __position);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator erase(const_iterator __first, const_iterator __last);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void clear() _NOEXCEPT {__size_ = 0;}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT { __size_ = 0; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(vector&)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(vector&)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void swap(reference __x, reference __y) _NOEXCEPT { std::swap(__x, __y); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void swap(reference __x, reference __y) _NOEXCEPT {
+ std::swap(__x, __y);
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __sz, value_type __x = false);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void resize(size_type __sz, value_type __x = false);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
private:
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_length_error() const {
- std::__throw_length_error("vector");
- }
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); }
- _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
- void __throw_out_of_range() const {
- std::__throw_out_of_range("vector");
- }
+ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); }
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-
- if (__n > 0) {
- __vallocate(__n);
- __construct_at_end(std::move(__first), std::move(__last), __n);
- }
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
+ auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- __guard.__complete();
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(std::move(__first), std::move(__last), __n);
}
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
+ __guard.__complete();
+ }
+
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- for (; __first != __last; ++__first)
- push_back(*__first);
+ for (; __first != __last; ++__first)
+ push_back(*__first);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- if (__begin_ != nullptr)
- __storage_traits::deallocate(__alloc(), __begin_, __cap());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ if (__begin_ != nullptr)
+ __storage_traits::deallocate(__alloc(), __begin_, __cap());
+ throw;
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __first, _Sentinel __last);
template <class _ForwardIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- void __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns);
template <class _InputIterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last);
template <class _Iterator, class _Sentinel>
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
- iterator __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
-
- // Allocate space for __n objects
- // throws length_error if __n > max_size()
- // throws (probably bad_alloc) if memory run out
- // Precondition: __begin_ == __end_ == __cap() == 0
- // Precondition: __n > 0
- // Postcondition: capacity() >= __n
- // Postcondition: size() == 0
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) {
- if (__n > max_size())
- __throw_length_error();
- auto __allocation = std::__allocate_at_least(__alloc(), __external_cap_to_internal(__n));
- __begin_ = __allocation.ptr;
- __size_ = 0;
- __cap() = __allocation.count;
- if (__libcpp_is_constant_evaluated()) {
- for (size_type __i = 0; __i != __cap(); ++__i)
- std::__construct_at(std::__to_address(__begin_) + __i);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n);
+
+ // Allocate space for __n objects
+ // throws length_error if __n > max_size()
+ // throws (probably bad_alloc) if memory run out
+ // Precondition: __begin_ == __end_ == __cap() == 0
+ // Precondition: __n > 0
+ // Postcondition: capacity() >= __n
+ // Postcondition: size() == 0
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) {
+ if (__n > max_size())
+ __throw_length_error();
+ auto __allocation = std::__allocate_at_least(__alloc(), __external_cap_to_internal(__n));
+ __begin_ = __allocation.ptr;
+ __size_ = 0;
+ __cap() = __allocation.count;
+ if (__libcpp_is_constant_evaluated()) {
+ for (size_type __i = 0; __i != __cap(); ++__i)
+ std::__construct_at(std::__to_address(__begin_) + __i);
}
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vdeallocate() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- static size_type __align_it(size_type __new_size) _NOEXCEPT
- {return (__new_size + (__bits_per_word-1)) & ~((size_type)__bits_per_word-1);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __new_size) const;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_at_end(size_type __n, bool __x);
- template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append(size_type __n, const_reference __x);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- reference __make_ref(size_type __pos) _NOEXCEPT
- {return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_reference __make_ref(size_type __pos) const _NOEXCEPT {
- return __bit_const_reference<vector>(__begin_ + __pos / __bits_per_word,
- __storage_type(1) << __pos % __bits_per_word);
- }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator __make_iter(size_type __pos) _NOEXCEPT
- {return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_iterator __make_iter(size_type __pos) const _NOEXCEPT
- {return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT
- {return begin() + (__p - cbegin());}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const vector& __v)
- {__copy_assign_alloc(__v, integral_constant<bool,
- __storage_traits::propagate_on_container_copy_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const vector& __c, true_type)
- {
- if (__alloc() != __c.__alloc())
- __vdeallocate();
- __alloc() = __c.__alloc();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __copy_assign_alloc(const vector&, false_type)
- {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, false_type);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(vector& __c)
- _NOEXCEPT_(
- !__storage_traits::propagate_on_container_move_assignment::value ||
- is_nothrow_move_assignable<allocator_type>::value)
- {__move_assign_alloc(__c, integral_constant<bool,
- __storage_traits::propagate_on_container_move_assignment::value>());}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
- {
- __alloc() = std::move(__c.__alloc());
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- void __move_assign_alloc(vector&, false_type)
- _NOEXCEPT
- {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vdeallocate() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type __align_it(size_type __new_size) _NOEXCEPT {
+ return (__new_size + (__bits_per_word - 1)) & ~((size_type)__bits_per_word - 1);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __new_size) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_at_end(size_type __n, bool __x);
+ template <class _InputIterator, class _Sentinel>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append(size_type __n, const_reference __x);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference __make_ref(size_type __pos) _NOEXCEPT {
+ return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference __make_ref(size_type __pos) const _NOEXCEPT {
+ return __bit_const_reference<vector>(
+ __begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iter(size_type __pos) _NOEXCEPT {
+ return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_iter(size_type __pos) const _NOEXCEPT {
+ return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT {
+ return begin() + (__p - cbegin());
+ }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t __hash_code() const _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const vector& __v) {
+ __copy_assign_alloc(
+ __v, integral_constant<bool, __storage_traits::propagate_on_container_copy_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const vector& __c, true_type) {
+ if (__alloc() != __c.__alloc())
+ __vdeallocate();
+ __alloc() = __c.__alloc();
+ }
- friend class __bit_reference<vector>;
- friend class __bit_const_reference<vector>;
- friend class __bit_iterator<vector, false>;
- friend class __bit_iterator<vector, true>;
- friend struct __bit_array<vector>;
- friend struct _LIBCPP_TEMPLATE_VIS hash<vector>;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const vector&, false_type) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, false_type);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(vector& __c)
+ _NOEXCEPT_(!__storage_traits::propagate_on_container_move_assignment::value ||
+ is_nothrow_move_assignable<allocator_type>::value) {
+ __move_assign_alloc(
+ __c, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __alloc() = std::move(__c.__alloc());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc(vector&, false_type) _NOEXCEPT {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t __hash_code() const _NOEXCEPT;
+
+ friend class __bit_reference<vector>;
+ friend class __bit_const_reference<vector>;
+ friend class __bit_iterator<vector, false>;
+ friend class __bit_iterator<vector, true>;
+ friend struct __bit_array<vector>;
+ friend struct _LIBCPP_TEMPLATE_VIS hash<vector>;
};
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT
-{
- if (this->__begin_ != nullptr)
- {
- __storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
- this->__begin_ = nullptr;
- this->__size_ = this->__cap() = 0;
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT {
+ if (this->__begin_ != nullptr) {
+ __storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
+ this->__begin_ = nullptr;
+ this->__size_ = this->__cap() = 0;
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::size_type
-vector<bool, _Allocator>::max_size() const _NOEXCEPT
-{
- size_type __amax = __storage_traits::max_size(__alloc());
- size_type __nmax = numeric_limits<size_type>::max() / 2; // end() >= begin(), always
- if (__nmax / __bits_per_word <= __amax)
- return __nmax;
- return __internal_cap_to_external(__amax);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::size_type
+vector<bool, _Allocator>::max_size() const _NOEXCEPT {
+ size_type __amax = __storage_traits::max_size(__alloc());
+ size_type __nmax = numeric_limits<size_type>::max() / 2; // end() >= begin(), always
+ if (__nmax / __bits_per_word <= __amax)
+ return __nmax;
+ return __internal_cap_to_external(__amax);
}
// Precondition: __new_size > capacity()
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::size_type
-vector<bool, _Allocator>::__recommend(size_type __new_size) const
-{
- const size_type __ms = max_size();
- if (__new_size > __ms)
- this->__throw_length_error();
- const size_type __cap = capacity();
- if (__cap >= __ms / 2)
- return __ms;
- return std::max(2 * __cap, __align_it(__new_size));
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::size_type
+vector<bool, _Allocator>::__recommend(size_type __new_size) const {
+ const size_type __ms = max_size();
+ if (__new_size > __ms)
+ this->__throw_length_error();
+ const size_type __cap = capacity();
+ if (__cap >= __ms / 2)
+ return __ms;
+ return std::max(2 * __cap, __align_it(__new_size));
}
// Default constructs __n objects starting at __end_
@@ -2581,128 +2290,92 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x)
-{
- size_type __old_size = this->__size_;
- this->__size_ += __n;
- if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word))
- {
- if (this->__size_ <= __bits_per_word)
- this->__begin_[0] = __storage_type(0);
- else
- this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
- }
- std::fill_n(__make_iter(__old_size), __n, __x);
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x) {
+ size_type __old_size = this->__size_;
+ this->__size_ += __n;
+ if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word)) {
+ if (this->__size_ <= __bits_per_word)
+ this->__begin_[0] = __storage_type(0);
+ else
+ this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
+ }
+ std::fill_n(__make_iter(__old_size), __n, __x);
}
template <class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void vector<bool, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) {
- size_type __old_size = this->__size_;
- this->__size_ += __n;
- if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word))
- {
- if (this->__size_ <= __bits_per_word)
- this->__begin_[0] = __storage_type(0);
- else
- this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
- }
- std::__copy<_ClassicAlgPolicy>(__first, __last, __make_iter(__old_size));
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void
+vector<bool, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) {
+ size_type __old_size = this->__size_;
+ this->__size_ += __n;
+ if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word)) {
+ if (this->__size_ <= __bits_per_word)
+ this->__begin_[0] = __storage_type(0);
+ else
+ this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0);
+ }
+ std::__copy<_ClassicAlgPolicy>(__first, __last, __make_iter(__old_size));
}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector()
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
-}
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(const allocator_type& __a)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
- _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
#else
_NOEXCEPT
#endif
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(size_type __n)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, false);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, false);
+ }
}
#if _LIBCPP_STD_VER >= 14
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, false);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, false);
+ }
}
#endif
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
+ }
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__n, __x);
- }
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__n, __x);
+ }
}
template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
__init_with_sentinel(__first, __last);
}
@@ -2710,21 +2383,14 @@ template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
__init_with_sentinel(__first, __last);
}
template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
auto __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
@@ -2733,10 +2399,7 @@ template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
auto __n = static_cast<size_type>(std::distance(__first, __last));
__init_with_size(__first, __last, __n);
}
@@ -2744,85 +2407,62 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
#ifndef _LIBCPP_CXX03_LANG
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __default_init_tag())
-{
- size_type __n = static_cast<size_type>(__il.size());
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__il.begin(), __il.end(), __n);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {
+ size_type __n = static_cast<size_type>(__il.size());
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__il.begin(), __il.end(), __n);
+ }
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
- size_type __n = static_cast<size_type>(__il.size());
- if (__n > 0)
- {
- __vallocate(__n);
- __construct_at_end(__il.begin(), __il.end(), __n);
- }
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) {
+ size_type __n = static_cast<size_type>(__il.size());
+ if (__n > 0) {
+ __vallocate(__n);
+ __construct_at_end(__il.begin(), __il.end(), __n);
+ }
}
#endif // _LIBCPP_CXX03_LANG
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(const vector& __v)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v)
: __begin_(nullptr),
__size_(0),
- __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc()))
-{
- if (__v.size() > 0)
- {
- __vallocate(__v.size());
- __construct_at_end(__v.begin(), __v.end(), __v.size());
- }
+ __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc())) {
+ if (__v.size() > 0) {
+ __vallocate(__v.size());
+ __construct_at_end(__v.begin(), __v.end(), __v.size());
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __a)
-{
- if (__v.size() > 0)
- {
- __vallocate(__v.size());
- __construct_at_end(__v.begin(), __v.end(), __v.size());
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a)
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) {
+ if (__v.size() > 0) {
+ __vallocate(__v.size());
+ __construct_at_end(__v.begin(), __v.end(), __v.size());
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>&
-vector<bool, _Allocator>::operator=(const vector& __v)
-{
- if (this != std::addressof(__v))
- {
- __copy_assign_alloc(__v);
- if (__v.__size_)
- {
- if (__v.__size_ > capacity())
- {
- __vdeallocate();
- __vallocate(__v.__size_);
- }
- std::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_);
- }
- __size_ = __v.__size_;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>& vector<bool, _Allocator>::operator=(const vector& __v) {
+ if (this != std::addressof(__v)) {
+ __copy_assign_alloc(__v);
+ if (__v.__size_) {
+ if (__v.__size_ > capacity()) {
+ __vdeallocate();
+ __vallocate(__v.__size_);
+ }
+ std::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_);
}
- return *this;
+ __size_ = __v.__size_;
+ }
+ return *this;
}
template <class _Allocator>
@@ -2835,523 +2475,419 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat
: __begin_(__v.__begin_),
__size_(__v.__size_),
__cap_alloc_(std::move(__v.__cap_alloc_)) {
- __v.__begin_ = nullptr;
- __v.__size_ = 0;
- __v.__cap() = 0;
+ __v.__begin_ = nullptr;
+ __v.__size_ = 0;
+ __v.__cap() = 0;
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20
vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a)
- : __begin_(nullptr),
- __size_(0),
- __cap_alloc_(0, __a)
-{
- if (__a == allocator_type(__v.__alloc()))
- {
- this->__begin_ = __v.__begin_;
- this->__size_ = __v.__size_;
- this->__cap() = __v.__cap();
- __v.__begin_ = nullptr;
- __v.__cap() = __v.__size_ = 0;
- }
- else if (__v.size() > 0)
- {
- __vallocate(__v.size());
- __construct_at_end(__v.begin(), __v.end(), __v.size());
- }
+ : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) {
+ if (__a == allocator_type(__v.__alloc())) {
+ this->__begin_ = __v.__begin_;
+ this->__size_ = __v.__size_;
+ this->__cap() = __v.__cap();
+ __v.__begin_ = nullptr;
+ __v.__cap() = __v.__size_ = 0;
+ } else if (__v.size() > 0) {
+ __vallocate(__v.size());
+ __construct_at_end(__v.begin(), __v.end(), __v.size());
+ }
}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-vector<bool, _Allocator>&
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>&
vector<bool, _Allocator>::operator=(vector&& __v)
- _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
-{
- __move_assign(__v, integral_constant<bool,
- __storage_traits::propagate_on_container_move_assignment::value>());
- return *this;
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {
+ __move_assign(__v, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::__move_assign(vector& __c, false_type)
-{
- if (__alloc() != __c.__alloc())
- assign(__c.begin(), __c.end());
- else
- __move_assign(__c, true_type());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__move_assign(vector& __c, false_type) {
+ if (__alloc() != __c.__alloc())
+ assign(__c.begin(), __c.end());
+ else
+ __move_assign(__c, true_type());
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::__move_assign(vector& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
-{
- __vdeallocate();
- __move_assign_alloc(__c);
- this->__begin_ = __c.__begin_;
- this->__size_ = __c.__size_;
- this->__cap() = __c.__cap();
- __c.__begin_ = nullptr;
- __c.__cap() = __c.__size_ = 0;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__move_assign(vector& __c, true_type)
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+ __vdeallocate();
+ __move_assign_alloc(__c);
+ this->__begin_ = __c.__begin_;
+ this->__size_ = __c.__size_;
+ this->__cap() = __c.__cap();
+ __c.__begin_ = nullptr;
+ __c.__cap() = __c.__size_ = 0;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::assign(size_type __n, const value_type& __x)
-{
- __size_ = 0;
- if (__n > 0)
- {
- size_type __c = capacity();
- if (__n <= __c)
- __size_ = __n;
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__n));
- __v.__size_ = __n;
- swap(__v);
- }
- std::fill_n(begin(), __n, __x);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::assign(size_type __n, const value_type& __x) {
+ __size_ = 0;
+ if (__n > 0) {
+ size_type __c = capacity();
+ if (__n <= __c)
+ __size_ = __n;
+ else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__n));
+ __v.__size_ = __n;
+ swap(__v);
+ }
+ std::fill_n(begin(), __n, __x);
+ }
}
template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last) {
__assign_with_sentinel(__first, __last);
}
template <class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<bool, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
- clear();
- for (; __first != __last; ++__first)
- push_back(*__first);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<bool, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
+ clear();
+ for (; __first != __last; ++__first)
+ push_back(*__first);
}
template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-void
-vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) {
__assign_with_size(__first, __last, std::distance(__first, __last));
}
template <class _Allocator>
template <class _ForwardIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-void vector<bool, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__ns >= 0, "invalid range specified");
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+vector<bool, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__ns >= 0, "invalid range specified");
- clear();
+ clear();
- const size_t __n = static_cast<size_type>(__ns);
- if (__n)
- {
- if (__n > capacity())
- {
- __vdeallocate();
- __vallocate(__n);
- }
- __construct_at_end(__first, __last, __n);
+ const size_t __n = static_cast<size_type>(__ns);
+ if (__n) {
+ if (__n > capacity()) {
+ __vdeallocate();
+ __vallocate(__n);
}
+ __construct_at_end(__first, __last, __n);
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::reserve(size_type __n)
-{
- if (__n > capacity())
- {
- if (__n > max_size())
- this->__throw_length_error();
- vector __v(this->get_allocator());
- __v.__vallocate(__n);
- __v.__construct_at_end(this->begin(), this->end(), this->size());
- swap(__v);
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::reserve(size_type __n) {
+ if (__n > capacity()) {
+ if (__n > max_size())
+ this->__throw_length_error();
+ vector __v(this->get_allocator());
+ __v.__vallocate(__n);
+ __v.__construct_at_end(this->begin(), this->end(), this->size());
+ swap(__v);
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT
-{
- if (__external_cap_to_internal(size()) > __cap())
- {
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT {
+ if (__external_cap_to_internal(size()) > __cap()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- vector(*this, allocator_type(__alloc())).swap(*this);
+ vector(*this, allocator_type(__alloc())).swap(*this);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
}
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
}
template <class _Allocator>
-typename vector<bool, _Allocator>::reference
-vector<bool, _Allocator>::at(size_type __n)
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return (*this)[__n];
+typename vector<bool, _Allocator>::reference vector<bool, _Allocator>::at(size_type __n) {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return (*this)[__n];
}
template <class _Allocator>
-typename vector<bool, _Allocator>::const_reference
-vector<bool, _Allocator>::at(size_type __n) const
-{
- if (__n >= size())
- this->__throw_out_of_range();
- return (*this)[__n];
+typename vector<bool, _Allocator>::const_reference vector<bool, _Allocator>::at(size_type __n) const {
+ if (__n >= size())
+ this->__throw_out_of_range();
+ return (*this)[__n];
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::push_back(const value_type& __x)
-{
- if (this->__size_ == this->capacity())
- reserve(__recommend(this->__size_ + 1));
- ++this->__size_;
- back() = __x;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::push_back(const value_type& __x) {
+ if (this->__size_ == this->capacity())
+ reserve(__recommend(this->__size_ + 1));
+ ++this->__size_;
+ back() = __x;
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x)
-{
- iterator __r;
- if (size() < capacity())
- {
- const_iterator __old_end = end();
- ++__size_;
- std::copy_backward(__position, __old_end, end());
- __r = __const_iterator_cast(__position);
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + 1));
- __v.__size_ = __size_ + 1;
- __r = std::copy(cbegin(), __position, __v.begin());
- std::copy_backward(__position, cend(), __v.end());
- swap(__v);
- }
- *__r = __x;
- return __r;
+vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x) {
+ iterator __r;
+ if (size() < capacity()) {
+ const_iterator __old_end = end();
+ ++__size_;
+ std::copy_backward(__position, __old_end, end());
+ __r = __const_iterator_cast(__position);
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + 1));
+ __v.__size_ = __size_ + 1;
+ __r = std::copy(cbegin(), __position, __v.begin());
+ std::copy_backward(__position, cend(), __v.end());
+ swap(__v);
+ }
+ *__r = __x;
+ return __r;
}
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x)
-{
- iterator __r;
- size_type __c = capacity();
- if (__n <= __c && size() <= __c - __n)
- {
- const_iterator __old_end = end();
- __size_ += __n;
- std::copy_backward(__position, __old_end, end());
- __r = __const_iterator_cast(__position);
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + __n));
- __v.__size_ = __size_ + __n;
- __r = std::copy(cbegin(), __position, __v.begin());
- std::copy_backward(__position, cend(), __v.end());
- swap(__v);
- }
- std::fill_n(__r, __n, __x);
- return __r;
+vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x) {
+ iterator __r;
+ size_type __c = capacity();
+ if (__n <= __c && size() <= __c - __n) {
+ const_iterator __old_end = end();
+ __size_ += __n;
+ std::copy_backward(__position, __old_end, end());
+ __r = __const_iterator_cast(__position);
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + __n));
+ __v.__size_ = __size_ + __n;
+ __r = std::copy(cbegin(), __position, __v.begin());
+ std::copy_backward(__position, cend(), __v.end());
+ swap(__v);
+ }
+ std::fill_n(__r, __n, __x);
+ return __r;
}
template <class _Allocator>
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) {
return __insert_with_sentinel(__position, __first, __last);
}
template <class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<bool, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<bool, _Allocator>::iterator
vector<bool, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) {
- difference_type __off = __position - begin();
- iterator __p = __const_iterator_cast(__position);
- iterator __old_end = end();
- for (; size() != capacity() && __first != __last; ++__first)
- {
- ++this->__size_;
- back() = *__first;
- }
- vector __v(get_allocator());
- if (__first != __last)
- {
+ difference_type __off = __position - begin();
+ iterator __p = __const_iterator_cast(__position);
+ iterator __old_end = end();
+ for (; size() != capacity() && __first != __last; ++__first) {
+ ++this->__size_;
+ back() = *__first;
+ }
+ vector __v(get_allocator());
+ if (__first != __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __v.__assign_with_sentinel(std::move(__first), std::move(__last));
- difference_type __old_size = static_cast<difference_type>(__old_end - begin());
- difference_type __old_p = __p - begin();
- reserve(__recommend(size() + __v.size()));
- __p = begin() + __old_p;
- __old_end = begin() + __old_size;
+ __v.__assign_with_sentinel(std::move(__first), std::move(__last));
+ difference_type __old_size = static_cast<difference_type>(__old_end - begin());
+ difference_type __old_p = __p - begin();
+ reserve(__recommend(size() + __v.size()));
+ __p = begin() + __old_p;
+ __old_end = begin() + __old_size;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- erase(__old_end, end());
- throw;
- }
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ erase(__old_end, end());
+ throw;
}
- __p = std::rotate(__p, __old_end, end());
- insert(__p, __v.begin(), __v.end());
- return begin() + __off;
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+ __p = std::rotate(__p, __old_end, end());
+ insert(__p, __v.begin(), __v.end());
+ return begin() + __off;
}
template <class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> >
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
-{
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) {
return __insert_with_size(__position, __first, __last, std::distance(__first, __last));
}
template <class _Allocator>
template <class _ForwardIterator, class _Sentinel>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::__insert_with_size(const_iterator __position, _ForwardIterator __first, _Sentinel __last,
- difference_type __n_signed) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__n_signed >= 0, "invalid range specified");
- const size_type __n = static_cast<size_type>(__n_signed);
- iterator __r;
- size_type __c = capacity();
- if (__n <= __c && size() <= __c - __n)
- {
- const_iterator __old_end = end();
- __size_ += __n;
- std::copy_backward(__position, __old_end, end());
- __r = __const_iterator_cast(__position);
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + __n));
- __v.__size_ = __size_ + __n;
- __r = std::copy(cbegin(), __position, __v.begin());
- std::copy_backward(__position, cend(), __v.end());
- swap(__v);
- }
- std::__copy<_ClassicAlgPolicy>(__first, __last, __r);
- return __r;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::__insert_with_size(
+ const_iterator __position, _ForwardIterator __first, _Sentinel __last, difference_type __n_signed) {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(__n_signed >= 0, "invalid range specified");
+ const size_type __n = static_cast<size_type>(__n_signed);
+ iterator __r;
+ size_type __c = capacity();
+ if (__n <= __c && size() <= __c - __n) {
+ const_iterator __old_end = end();
+ __size_ += __n;
+ std::copy_backward(__position, __old_end, end());
+ __r = __const_iterator_cast(__position);
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + __n));
+ __v.__size_ = __size_ + __n;
+ __r = std::copy(cbegin(), __position, __v.begin());
+ std::copy_backward(__position, cend(), __v.end());
+ swap(__v);
+ }
+ std::__copy<_ClassicAlgPolicy>(__first, __last, __r);
+ return __r;
}
template <class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::erase(const_iterator __position)
-{
- iterator __r = __const_iterator_cast(__position);
- std::copy(__position + 1, this->cend(), __r);
- --__size_;
- return __r;
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::erase(const_iterator __position) {
+ iterator __r = __const_iterator_cast(__position);
+ std::copy(__position + 1, this->cend(), __r);
+ --__size_;
+ return __r;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-typename vector<bool, _Allocator>::iterator
-vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last)
-{
- iterator __r = __const_iterator_cast(__first);
- difference_type __d = __last - __first;
- std::copy(__last, this->cend(), __r);
- __size_ -= __d;
- return __r;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<bool, _Allocator>::iterator
+vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last) {
+ iterator __r = __const_iterator_cast(__first);
+ difference_type __d = __last - __first;
+ std::copy(__last, this->cend(), __r);
+ __size_ -= __d;
+ return __r;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::swap(vector& __x)
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::swap(vector& __x)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
#endif
{
- std::swap(this->__begin_, __x.__begin_);
- std::swap(this->__size_, __x.__size_);
- std::swap(this->__cap(), __x.__cap());
- std::__swap_allocator(this->__alloc(), __x.__alloc(),
- integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
+ std::swap(this->__begin_, __x.__begin_);
+ std::swap(this->__size_, __x.__size_);
+ std::swap(this->__cap(), __x.__cap());
+ std::__swap_allocator(
+ this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::resize(size_type __sz, value_type __x)
-{
- size_type __cs = size();
- if (__cs < __sz)
- {
- iterator __r;
- size_type __c = capacity();
- size_type __n = __sz - __cs;
- if (__n <= __c && __cs <= __c - __n)
- {
- __r = end();
- __size_ += __n;
- }
- else
- {
- vector __v(get_allocator());
- __v.reserve(__recommend(__size_ + __n));
- __v.__size_ = __size_ + __n;
- __r = std::copy(cbegin(), cend(), __v.begin());
- swap(__v);
- }
- std::fill_n(__r, __n, __x);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::resize(size_type __sz, value_type __x) {
+ size_type __cs = size();
+ if (__cs < __sz) {
+ iterator __r;
+ size_type __c = capacity();
+ size_type __n = __sz - __cs;
+ if (__n <= __c && __cs <= __c - __n) {
+ __r = end();
+ __size_ += __n;
+ } else {
+ vector __v(get_allocator());
+ __v.reserve(__recommend(__size_ + __n));
+ __v.__size_ = __size_ + __n;
+ __r = std::copy(cbegin(), cend(), __v.begin());
+ swap(__v);
}
- else
- __size_ = __sz;
+ std::fill_n(__r, __n, __x);
+ } else
+ __size_ = __sz;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void
-vector<bool, _Allocator>::flip() _NOEXCEPT
-{
- // do middle whole words
- size_type __n = __size_;
- __storage_pointer __p = __begin_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- *__p = ~*__p;
- // do last partial word
- if (__n > 0)
- {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __storage_type __b = *__p & __m;
- *__p &= ~__m;
- *__p |= ~__b & __m;
- }
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::flip() _NOEXCEPT {
+ // do middle whole words
+ size_type __n = __size_;
+ __storage_pointer __p = __begin_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ *__p = ~*__p;
+ // do last partial word
+ if (__n > 0) {
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ __storage_type __b = *__p & __m;
+ *__p &= ~__m;
+ *__p |= ~__b & __m;
+ }
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-vector<bool, _Allocator>::__invariants() const
-{
- if (this->__begin_ == nullptr)
- {
- if (this->__size_ != 0 || this->__cap() != 0)
- return false;
- }
- else
- {
- if (this->__cap() == 0)
- return false;
- if (this->__size_ > this->capacity())
- return false;
- }
- return true;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<bool, _Allocator>::__invariants() const {
+ if (this->__begin_ == nullptr) {
+ if (this->__size_ != 0 || this->__cap() != 0)
+ return false;
+ } else {
+ if (this->__cap() == 0)
+ return false;
+ if (this->__size_ > this->capacity())
+ return false;
+ }
+ return true;
}
template <class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 size_t
-vector<bool, _Allocator>::__hash_code() const _NOEXCEPT
-{
- size_t __h = 0;
- // do middle whole words
- size_type __n = __size_;
- __storage_pointer __p = __begin_;
- for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
- __h ^= *__p;
- // do last partial word
- if (__n > 0)
- {
- const __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __h ^= *__p & __m;
- }
- return __h;
+_LIBCPP_CONSTEXPR_SINCE_CXX20 size_t vector<bool, _Allocator>::__hash_code() const _NOEXCEPT {
+ size_t __h = 0;
+ // do middle whole words
+ size_type __n = __size_;
+ __storage_pointer __p = __begin_;
+ for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
+ __h ^= *__p;
+ // do last partial word
+ if (__n > 0) {
+ const __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
+ __h ^= *__p & __m;
+ }
+ return __h;
}
template <class _Allocator>
struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> >
- : public __unary_function<vector<bool, _Allocator>, size_t>
-{
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT
- {return __vec.__hash_code();}
+ : public __unary_function<vector<bool, _Allocator>, size_t> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_t
+ operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT {
+ return __vec.__hash_code();
+ }
};
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- const typename vector<_Tp, _Allocator>::size_type __sz = __x.size();
- return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ const typename vector<_Tp, _Allocator>::size_type __sz = __x.size();
+ return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
#if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return !(__x == __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return !(__x == __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
+inline _LIBCPP_HIDE_FROM_ABI bool operator<(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return __y < __x;
+inline _LIBCPP_HIDE_FROM_ABI bool operator>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return __y < __x;
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return !(__x < __y);
+inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return !(__x < __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI
-bool
-operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
-{
- return !(__y < __x);
+inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
+ return !(__y < __x);
}
#else // _LIBCPP_STD_VER <= 17
@@ -3359,26 +2895,21 @@ operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
operator<=>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
- return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
+ return std::lexicographical_compare_three_way(
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI
-void
-swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
-{
- __x.swap(__y);
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
+swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+ __x.swap(__y);
}
#if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Allocator, class _Up>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
erase(vector<_Tp, _Allocator>& __c, const _Up& __v) {
auto __old_size = __c.size();
__c.erase(std::remove(__c.begin(), __c.end(), __v), __c.end());
@@ -3386,8 +2917,7 @@ erase(vector<_Tp, _Allocator>& __c, const _Up& __v) {
}
template <class _Tp, class _Allocator, class _Predicate>
-_LIBCPP_CONSTEXPR_SINCE_CXX20
-inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type
erase_if(vector<_Tp, _Allocator>& __c, _Predicate __pred) {
auto __old_size = __c.size();
__c.erase(std::remove_if(__c.begin(), __c.end(), __pred), __c.end());
@@ -3396,10 +2926,10 @@ erase_if(vector<_Tp, _Allocator>& __c, _Predicate __pred) {
template <>
inline constexpr bool __format::__enable_insertable<vector<char>> = true;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
inline constexpr bool __format::__enable_insertable<vector<wchar_t>> = true;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 20
@@ -3414,12 +2944,12 @@ private:
public:
template <class _ParseContext>
_LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __underlying_.parse(__ctx);
+ return __underlying_.parse(__ctx);
}
template <class _FormatContext>
_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _Tp& __ref, _FormatContext& __ctx) const {
- return __underlying_.format(__ref, __ctx);
+ return __underlying_.format(__ref, __ctx);
}
};
#endif // _LIBCPP_STD_VER >= 23
diff --git a/contrib/llvm-project/libcxx/include/version b/contrib/llvm-project/libcxx/include/version
index a91c344c4360..768710ef5c84 100644
--- a/contrib/llvm-project/libcxx/include/version
+++ b/contrib/llvm-project/libcxx/include/version
@@ -93,7 +93,7 @@ __cpp_lib_expected 202211L <expected>
__cpp_lib_filesystem 201703L <filesystem>
__cpp_lib_format 202106L <format>
__cpp_lib_format_ranges 202207L <format>
-__cpp_lib_format_uchar 202311L <>
+__cpp_lib_format_uchar 202311L <format>
__cpp_lib_formatters 202302L <stacktrace> <thread>
__cpp_lib_forward_like 202207L <utility>
__cpp_lib_freestanding_algorithm 202311L <algorithm>
@@ -188,7 +188,7 @@ __cpp_lib_remove_cvref 201711L <type_traits>
__cpp_lib_result_of_sfinae 201210L <functional> <type_traits>
__cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm>
__cpp_lib_sample 201603L <algorithm>
-__cpp_lib_saturation_arithmetic 202311L <>
+__cpp_lib_saturation_arithmetic 202311L <numeric>
__cpp_lib_scoped_lock 201703L <mutex>
__cpp_lib_semaphore 201907L <semaphore>
__cpp_lib_shared_mutex 201505L <shared_mutex>
@@ -454,7 +454,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
# undef __cpp_lib_optional
# define __cpp_lib_optional 202110L
// # define __cpp_lib_out_ptr 202106L
-// # define __cpp_lib_print 202207L
+# define __cpp_lib_print 202207L
// # define __cpp_lib_ranges_as_const 202207L
# define __cpp_lib_ranges_as_rvalue 202207L
// # define __cpp_lib_ranges_chunk 202202L
diff --git a/contrib/llvm-project/libcxx/include/wchar.h b/contrib/llvm-project/libcxx/include/wchar.h
index 41fe40db06f9..d4268c6d2c24 100644
--- a/contrib/llvm-project/libcxx/include/wchar.h
+++ b/contrib/llvm-project/libcxx/include/wchar.h
@@ -9,14 +9,14 @@
#if defined(__need_wint_t) || defined(__need_mbstate_t)
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-#include_next <wchar.h>
+# include_next <wchar.h>
#elif !defined(_LIBCPP_WCHAR_H)
-#define _LIBCPP_WCHAR_H
+# define _LIBCPP_WCHAR_H
/*
wchar.h synopsis
@@ -105,22 +105,23 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
*/
-#include <__config>
-#include <stddef.h>
+# include <__config>
+# include <stddef.h>
-#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
-# error "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
-#endif
+# if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+# error \
+ "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
+# endif
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
// We define this here to support older versions of glibc <wchar.h> that do
// not define this for clang.
-#ifdef __cplusplus
-#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
-#endif
+# ifdef __cplusplus
+# define __CORRECT_ISO_CPP_WCHAR_H_PROTO
+# endif
# if __has_include_next(<wchar.h>)
# include_next <wchar.h>
@@ -129,64 +130,82 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
# endif
// Determine whether we have const-correct overloads for wcschr and friends.
-#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
-# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
-#elif defined(__GLIBC_PREREQ)
-# if __GLIBC_PREREQ(2, 10)
+# if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# elif defined(__GLIBC_PREREQ)
+# if __GLIBC_PREREQ(2, 10)
+# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# endif
+# elif defined(_LIBCPP_MSVCRT)
+# if defined(_CRT_CONST_CORRECT_OVERLOADS)
+# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# endif
# endif
-#elif defined(_LIBCPP_MSVCRT)
-# if defined(_CRT_CONST_CORRECT_OVERLOADS)
-# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
-# endif
-#endif
-#if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
+# if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
extern "C++" {
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
-
-inline _LIBCPP_HIDE_FROM_ABI
-wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
-const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
- wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
-}
-#endif
-
-#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {
+ return (wchar_t*)wcschr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcschr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcschr(wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcschr(__s, __c);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
+ return (wchar_t*)wcspbrk(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
+wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcspbrk(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcspbrk(wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcspbrk(__s1, __s2);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {
+ return (wchar_t*)wcsrchr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcsrchr(__s, __c);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcsrchr(wchar_t* __s, wchar_t __c) {
+ return __libcpp_wcsrchr(__s, __c);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {
+ return (wchar_t*)wcsstr(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
+wcsstr(const wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcsstr(__s1, __s2);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wcsstr(wchar_t* __s1, const wchar_t* __s2) {
+ return __libcpp_wcsstr(__s1, __s2);
+}
+
+inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
+ return (wchar_t*)wmemchr(__s, __c, __n);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
+wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
+ return __libcpp_wmemchr(__s, __c, __n);
+}
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wmemchr(wchar_t* __s, wchar_t __c, size_t __n) {
+ return __libcpp_wmemchr(__s, __c, __n);
+}
+}
+# endif
+
+# if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))
extern "C" {
-size_t mbsnrtowcs(wchar_t *__restrict __dst, const char **__restrict __src,
- size_t __nmc, size_t __len, mbstate_t *__restrict __ps);
-size_t wcsnrtombs(char *__restrict __dst, const wchar_t **__restrict __src,
- size_t __nwc, size_t __len, mbstate_t *__restrict __ps);
+size_t mbsnrtowcs(
+ wchar_t* __restrict __dst, const char** __restrict __src, size_t __nmc, size_t __len, mbstate_t* __restrict __ps);
+size_t wcsnrtombs(
+ char* __restrict __dst, const wchar_t** __restrict __src, size_t __nwc, size_t __len, mbstate_t* __restrict __ps);
} // extern "C"
-#endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)
+# endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)
#endif // _LIBCPP_WCHAR_H
diff --git a/contrib/llvm-project/libcxx/include/wctype.h b/contrib/llvm-project/libcxx/include/wctype.h
index e4dc61ad5cf4..c76ec5a3f060 100644
--- a/contrib/llvm-project/libcxx/include/wctype.h
+++ b/contrib/llvm-project/libcxx/include/wctype.h
@@ -47,7 +47,8 @@ wctrans_t wctrans(const char* property);
#include <__config>
#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
-# error "The <wctype.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
+# error \
+ "The <wctype.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -64,30 +65,30 @@ wctrans_t wctrans(const char* property);
// of these declarations (e.g. <wchar.h>), the second `using ::wint_t` with using_if_exists
// will fail because it does not refer to the same declaration.
#if __has_include_next(<wctype.h>)
-# include_next <wctype.h>
-# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
+# include_next <wctype.h>
+# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
#endif
#ifdef __cplusplus
-#undef iswalnum
-#undef iswalpha
-#undef iswblank
-#undef iswcntrl
-#undef iswdigit
-#undef iswgraph
-#undef iswlower
-#undef iswprint
-#undef iswpunct
-#undef iswspace
-#undef iswupper
-#undef iswxdigit
-#undef iswctype
-#undef wctype
-#undef towlower
-#undef towupper
-#undef towctrans
-#undef wctrans
+# undef iswalnum
+# undef iswalpha
+# undef iswblank
+# undef iswcntrl
+# undef iswdigit
+# undef iswgraph
+# undef iswlower
+# undef iswprint
+# undef iswpunct
+# undef iswspace
+# undef iswupper
+# undef iswxdigit
+# undef iswctype
+# undef wctype
+# undef towlower
+# undef towupper
+# undef towctrans
+# undef wctrans
#endif // __cplusplus
diff --git a/contrib/llvm-project/libcxx/modules/std/algorithm.inc b/contrib/llvm-project/libcxx/modules/std/algorithm.inc
index b7900d15c10c..75e8a3af78de 100644
--- a/contrib/llvm-project/libcxx/modules/std/algorithm.inc
+++ b/contrib/llvm-project/libcxx/modules/std/algorithm.inc
@@ -16,7 +16,9 @@ export namespace std {
using std::ranges::in_in_result;
using std::ranges::in_out_out_result;
using std::ranges::in_out_result;
- // using std::ranges::in_value_result;
+#if _LIBCPP_STD_VER >= 23
+ using std::ranges::in_value_result;
+#endif
using std::ranges::min_max_result;
// using std::ranges::out_value_result;
} // namespace ranges
@@ -40,13 +42,15 @@ export namespace std {
using std::ranges::none_of;
}
+#if _LIBCPP_STD_VER >= 23
// [alg.contains], contains
-#if 0
namespace ranges {
using std::ranges::contains;
+#if 0
using std::ranges::contains_subrange;
- } // namespace ranges
#endif
+ } // namespace ranges
+#endif // _LIBCPP_STD_VER >= 23
// [alg.foreach], for each
using std::for_each;
@@ -157,15 +161,15 @@ export namespace std {
// [alg.ends.with], ends with
using std::ranges::ends_with;
-# if 0
// [alg.fold], fold
using std::ranges::fold_left;
+ using std::ranges::fold_left_with_iter;
+ using std::ranges::fold_left_with_iter_result;
+# if 0
using std::ranges::fold_left_first;
using std::ranges::fold_right;
using std::ranges::fold_right_last;
using std::ranges::fold_left_with_iter;
- using std::ranges::fold_left_with_iter_result;
- using std::ranges::fold_left_with_iter;
using std::ranges::fold_left_first_with_iter;
using std::ranges::fold_left_first_with_iter;
# endif
diff --git a/contrib/llvm-project/libcxx/modules/std/ostream.inc b/contrib/llvm-project/libcxx/modules/std/ostream.inc
index e8989788b7a5..8fcbfb4bdc18 100644
--- a/contrib/llvm-project/libcxx/modules/std/ostream.inc
+++ b/contrib/llvm-project/libcxx/modules/std/ostream.inc
@@ -27,13 +27,14 @@ export namespace std {
# endif
using std::operator<<;
-# if 0
+# if _LIBCPP_STD_VER >= 23
// [ostream.formatted.print], print functions
using std::print;
using std::println;
using std::vprint_nonunicode;
using std::vprint_unicode;
-# endif
+# endif // _LIBCPP_STD_VER >= 23
+
#endif // _LIBCPP_HAS_NO_LOCALIZATION
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/any.cpp b/contrib/llvm-project/libcxx/src/any.cpp
index 36f95c0ec4fc..b0ad695669de 100644
--- a/contrib/llvm-project/libcxx/src/any.cpp
+++ b/contrib/llvm-project/libcxx/src/any.cpp
@@ -9,11 +9,8 @@
#include <any>
namespace std {
-const char* bad_any_cast::what() const noexcept {
- return "bad any cast";
-}
-}
-
+const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
+} // namespace std
#include <experimental/__config>
@@ -21,14 +18,11 @@ const char* bad_any_cast::what() const noexcept {
// Even though it no longer exists in a header file
_LIBCPP_BEGIN_NAMESPACE_LFTS
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast
-{
+class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast {
public:
- virtual const char* what() const noexcept;
+ virtual const char* what() const noexcept;
};
-const char* bad_any_cast::what() const noexcept {
- return "bad any cast";
-}
+const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/contrib/llvm-project/libcxx/src/atomic.cpp b/contrib/llvm-project/libcxx/src/atomic.cpp
index 133774bf13c4..2f0389ae6974 100644
--- a/contrib/llvm-project/libcxx/src/atomic.cpp
+++ b/contrib/llvm-project/libcxx/src/atomic.cpp
@@ -16,20 +16,20 @@
#ifdef __linux__
-#include <unistd.h>
-#include <linux/futex.h>
-#include <sys/syscall.h>
+# include <linux/futex.h>
+# include <sys/syscall.h>
+# include <unistd.h>
// libc++ uses SYS_futex as a universal syscall name. However, on 32 bit architectures
// with a 64 bit time_t, we need to specify SYS_futex_time64.
-#if !defined(SYS_futex) && defined(SYS_futex_time64)
-# define SYS_futex SYS_futex_time64
-#endif
+# if !defined(SYS_futex) && defined(SYS_futex_time64)
+# define SYS_futex SYS_futex_time64
+# endif
#elif defined(__FreeBSD__)
-#include <sys/types.h>
-#include <sys/umtx.h>
+# include <sys/types.h>
+# include <sys/umtx.h>
#else // <- Add other operating systems here
@@ -41,40 +41,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifdef __linux__
-static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr,
- __cxx_contention_t __val)
-{
- static constexpr timespec __timeout = { 2, 0 };
- syscall(SYS_futex, __ptr, FUTEX_WAIT_PRIVATE, __val, &__timeout, 0, 0);
+static void
+__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
+ static constexpr timespec __timeout = {2, 0};
+ syscall(SYS_futex, __ptr, FUTEX_WAIT_PRIVATE, __val, &__timeout, 0, 0);
}
-static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr,
- bool __notify_one)
-{
- syscall(SYS_futex, __ptr, FUTEX_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, 0, 0, 0);
+static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, bool __notify_one) {
+ syscall(SYS_futex, __ptr, FUTEX_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, 0, 0, 0);
}
#elif defined(__APPLE__) && defined(_LIBCPP_USE_ULOCK)
-extern "C" int __ulock_wait(uint32_t operation, void *addr, uint64_t value,
- uint32_t timeout); /* timeout is specified in microseconds */
-extern "C" int __ulock_wake(uint32_t operation, void *addr, uint64_t wake_value);
+extern "C" int __ulock_wait(
+ uint32_t operation, void* addr, uint64_t value, uint32_t timeout); /* timeout is specified in microseconds */
+extern "C" int __ulock_wake(uint32_t operation, void* addr, uint64_t wake_value);
-#define UL_COMPARE_AND_WAIT 1
-#define ULF_WAKE_ALL 0x00000100
+# define UL_COMPARE_AND_WAIT 1
+# define ULF_WAKE_ALL 0x00000100
-static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr,
- __cxx_contention_t __val)
-{
- __ulock_wait(UL_COMPARE_AND_WAIT,
- const_cast<__cxx_atomic_contention_t*>(__ptr), __val, 0);
+static void
+__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
+ __ulock_wait(UL_COMPARE_AND_WAIT, const_cast<__cxx_atomic_contention_t*>(__ptr), __val, 0);
}
-static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr,
- bool __notify_one)
-{
- __ulock_wake(UL_COMPARE_AND_WAIT | (__notify_one ? 0 : ULF_WAKE_ALL),
- const_cast<__cxx_atomic_contention_t*>(__ptr), 0);
+static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, bool __notify_one) {
+ __ulock_wake(
+ UL_COMPARE_AND_WAIT | (__notify_one ? 0 : ULF_WAKE_ALL), const_cast<__cxx_atomic_contention_t*>(__ptr), 0);
}
#elif defined(__FreeBSD__) && __SIZEOF_LONG__ == 8
@@ -84,53 +77,44 @@ static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const vo
* limit its use to architectures where long and int64_t are synonyms.
*/
-static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr,
- __cxx_contention_t __val)
-{
- _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr),
- UMTX_OP_WAIT, __val, NULL, NULL);
+static void
+__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
+ _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), UMTX_OP_WAIT, __val, NULL, NULL);
}
-static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr,
- bool __notify_one)
-{
- _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr),
- UMTX_OP_WAKE, __notify_one ? 1 : INT_MAX, NULL, NULL);
+static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, bool __notify_one) {
+ _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), UMTX_OP_WAKE, __notify_one ? 1 : INT_MAX, NULL, NULL);
}
#else // <- Add other operating systems here
// Baseline is just a timed backoff
-static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr,
- __cxx_contention_t __val)
-{
- __libcpp_thread_poll_with_backoff([=]() -> bool {
- return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__ptr, memory_order_relaxed), __val);
- }, __libcpp_timed_backoff_policy());
+static void
+__libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, __cxx_contention_t __val) {
+ __libcpp_thread_poll_with_backoff(
+ [=]() -> bool { return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__ptr, memory_order_relaxed), __val); },
+ __libcpp_timed_backoff_policy());
}
-static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile*, bool) { }
+static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile*, bool) {}
#endif // __linux__
-static constexpr size_t __libcpp_contention_table_size = (1 << 8); /* < there's no magic in this number */
+static constexpr size_t __libcpp_contention_table_size = (1 << 8); /* < there's no magic in this number */
-struct alignas(64) /* aim to avoid false sharing */ __libcpp_contention_table_entry
-{
- __cxx_atomic_contention_t __contention_state;
- __cxx_atomic_contention_t __platform_state;
- inline constexpr __libcpp_contention_table_entry() :
- __contention_state(0), __platform_state(0) { }
+struct alignas(64) /* aim to avoid false sharing */ __libcpp_contention_table_entry {
+ __cxx_atomic_contention_t __contention_state;
+ __cxx_atomic_contention_t __platform_state;
+ inline constexpr __libcpp_contention_table_entry() : __contention_state(0), __platform_state(0) {}
};
-static __libcpp_contention_table_entry __libcpp_contention_table[ __libcpp_contention_table_size ];
+static __libcpp_contention_table_entry __libcpp_contention_table[__libcpp_contention_table_size];
static hash<void const volatile*> __libcpp_contention_hasher;
-static __libcpp_contention_table_entry* __libcpp_contention_state(void const volatile * p)
-{
- return &__libcpp_contention_table[__libcpp_contention_hasher(p) & (__libcpp_contention_table_size - 1)];
+static __libcpp_contention_table_entry* __libcpp_contention_state(void const volatile* p) {
+ return &__libcpp_contention_table[__libcpp_contention_hasher(p) & (__libcpp_contention_table_size - 1)];
}
/* Given an atomic to track contention and an atomic to actually wait on, which may be
@@ -138,81 +122,69 @@ static __libcpp_contention_table_entry* __libcpp_contention_state(void const vol
static void __libcpp_contention_notify(__cxx_atomic_contention_t volatile* __contention_state,
__cxx_atomic_contention_t const volatile* __platform_state,
- bool __notify_one)
-{
- if(0 != __cxx_atomic_load(__contention_state, memory_order_seq_cst))
- // We only call 'wake' if we consumed a contention bit here.
- __libcpp_platform_wake_by_address(__platform_state, __notify_one);
-}
-static __cxx_contention_t __libcpp_contention_monitor_for_wait(__cxx_atomic_contention_t volatile* /*__contention_state*/,
- __cxx_atomic_contention_t const volatile* __platform_state)
-{
- // We will monitor this value.
- return __cxx_atomic_load(__platform_state, memory_order_acquire);
+ bool __notify_one) {
+ if (0 != __cxx_atomic_load(__contention_state, memory_order_seq_cst))
+ // We only call 'wake' if we consumed a contention bit here.
+ __libcpp_platform_wake_by_address(__platform_state, __notify_one);
+}
+static __cxx_contention_t
+__libcpp_contention_monitor_for_wait(__cxx_atomic_contention_t volatile* /*__contention_state*/,
+ __cxx_atomic_contention_t const volatile* __platform_state) {
+ // We will monitor this value.
+ return __cxx_atomic_load(__platform_state, memory_order_acquire);
}
static void __libcpp_contention_wait(__cxx_atomic_contention_t volatile* __contention_state,
__cxx_atomic_contention_t const volatile* __platform_state,
- __cxx_contention_t __old_value)
-{
- __cxx_atomic_fetch_add(__contention_state, __cxx_contention_t(1), memory_order_seq_cst);
- // We sleep as long as the monitored value hasn't changed.
- __libcpp_platform_wait_on_address(__platform_state, __old_value);
- __cxx_atomic_fetch_sub(__contention_state, __cxx_contention_t(1), memory_order_release);
+ __cxx_contention_t __old_value) {
+ __cxx_atomic_fetch_add(__contention_state, __cxx_contention_t(1), memory_order_seq_cst);
+ // We sleep as long as the monitored value hasn't changed.
+ __libcpp_platform_wait_on_address(__platform_state, __old_value);
+ __cxx_atomic_fetch_sub(__contention_state, __cxx_contention_t(1), memory_order_release);
}
/* When the incoming atomic is the wrong size for the platform wait size, need to
launder the value sequence through an atomic from our table. */
-static void __libcpp_atomic_notify(void const volatile* __location)
-{
- auto const __entry = __libcpp_contention_state(__location);
- // The value sequence laundering happens on the next line below.
- __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_release);
- __libcpp_contention_notify(&__entry->__contention_state,
- &__entry->__platform_state,
- false /* when laundering, we can't handle notify_one */);
-}
-_LIBCPP_EXPORTED_FROM_ABI
-void __cxx_atomic_notify_one(void const volatile* __location)
- { __libcpp_atomic_notify(__location); }
-_LIBCPP_EXPORTED_FROM_ABI
-void __cxx_atomic_notify_all(void const volatile* __location)
- { __libcpp_atomic_notify(__location); }
-_LIBCPP_EXPORTED_FROM_ABI
-__cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location)
-{
- auto const __entry = __libcpp_contention_state(__location);
- return __libcpp_contention_monitor_for_wait(&__entry->__contention_state, &__entry->__platform_state);
-}
-_LIBCPP_EXPORTED_FROM_ABI
-void __libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value)
-{
- auto const __entry = __libcpp_contention_state(__location);
- __libcpp_contention_wait(&__entry->__contention_state, &__entry->__platform_state, __old_value);
+static void __libcpp_atomic_notify(void const volatile* __location) {
+ auto const __entry = __libcpp_contention_state(__location);
+ // The value sequence laundering happens on the next line below.
+ __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_release);
+ __libcpp_contention_notify(
+ &__entry->__contention_state,
+ &__entry->__platform_state,
+ false /* when laundering, we can't handle notify_one */);
+}
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile* __location) {
+ __libcpp_atomic_notify(__location);
+}
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __location) {
+ __libcpp_atomic_notify(__location);
+}
+_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) {
+ auto const __entry = __libcpp_contention_state(__location);
+ return __libcpp_contention_monitor_for_wait(&__entry->__contention_state, &__entry->__platform_state);
+}
+_LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) {
+ auto const __entry = __libcpp_contention_state(__location);
+ __libcpp_contention_wait(&__entry->__contention_state, &__entry->__platform_state, __old_value);
}
/* When the incoming atomic happens to be the platform wait size, we still need to use the
table for the contention detection, but we can use the atomic directly for the wait. */
-_LIBCPP_EXPORTED_FROM_ABI
-void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location)
-{
- __libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, true);
-}
-_LIBCPP_EXPORTED_FROM_ABI
-void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location)
-{
- __libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, false);
-}
-_LIBCPP_EXPORTED_FROM_ABI
-__cxx_contention_t __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location)
-{
- return __libcpp_contention_monitor_for_wait(&__libcpp_contention_state(__location)->__contention_state, __location);
-}
-_LIBCPP_EXPORTED_FROM_ABI
-void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value)
-{
- __libcpp_contention_wait(&__libcpp_contention_state(__location)->__contention_state, __location, __old_value);
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) {
+ __libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, true);
+}
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) {
+ __libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, false);
+}
+_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
+__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) {
+ return __libcpp_contention_monitor_for_wait(&__libcpp_contention_state(__location)->__contention_state, __location);
+}
+_LIBCPP_EXPORTED_FROM_ABI void
+__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) {
+ __libcpp_contention_wait(&__libcpp_contention_state(__location)->__contention_state, __location, __old_value);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/barrier.cpp b/contrib/llvm-project/libcxx/src/barrier.cpp
index 3242e0865bff..baa26101cd57 100644
--- a/contrib/llvm-project/libcxx/src/barrier.cpp
+++ b/contrib/llvm-project/libcxx/src/barrier.cpp
@@ -15,75 +15,59 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class __barrier_algorithm_base {
public:
- struct alignas(64) /* naturally-align the heap state */ __state_t
- {
- struct {
- __atomic_base<__barrier_phase_t> __phase{0};
- } __tickets[64];
- };
+ struct alignas(64) /* naturally-align the heap state */ __state_t {
+ struct {
+ __atomic_base<__barrier_phase_t> __phase{0};
+ } __tickets[64];
+ };
- ptrdiff_t& __expected;
- unique_ptr<__state_t[]> __state;
+ ptrdiff_t& __expected;
+ unique_ptr<__state_t[]> __state;
- _LIBCPP_HIDDEN
- __barrier_algorithm_base(ptrdiff_t& __expected)
- : __expected(__expected)
- {
- size_t const __count = (__expected + 1) >> 1;
- __state = unique_ptr<__state_t[]>(new __state_t[__count]);
- }
- _LIBCPP_HIDDEN
- bool __arrive(__barrier_phase_t __old_phase)
- {
- __barrier_phase_t const __half_step = __old_phase + 1,
- __full_step = __old_phase + 2;
- size_t __current_expected = __expected,
- __current = hash<thread::id>()(this_thread::get_id()) % ((__expected + 1) >> 1);
- for(int __round = 0;; ++__round) {
- if(__current_expected <= 1)
- return true;
- size_t const __end_node = ((__current_expected + 1) >> 1),
- __last_node = __end_node - 1;
- for(;;++__current) {
- if(__current == __end_node)
- __current = 0;
- __barrier_phase_t expect = __old_phase;
- if(__current == __last_node && (__current_expected & 1))
- {
- if(__state[__current].__tickets[__round].__phase.compare_exchange_strong(expect, __full_step, memory_order_acq_rel))
- break; // I'm 1 in 1, go to next __round
- }
- else if(__state[__current].__tickets[__round].__phase.compare_exchange_strong(expect, __half_step, memory_order_acq_rel))
- {
- return false; // I'm 1 in 2, done with arrival
- }
- else if(expect == __half_step)
- {
- if(__state[__current].__tickets[__round].__phase.compare_exchange_strong(expect, __full_step, memory_order_acq_rel))
- break; // I'm 2 in 2, go to next __round
- }
- }
- __current_expected = __last_node + 1;
- __current >>= 1;
+ _LIBCPP_HIDDEN __barrier_algorithm_base(ptrdiff_t& __expected) : __expected(__expected) {
+ size_t const __count = (__expected + 1) >> 1;
+ __state = unique_ptr<__state_t[]>(new __state_t[__count]);
+ }
+ _LIBCPP_HIDDEN bool __arrive(__barrier_phase_t __old_phase) {
+ __barrier_phase_t const __half_step = __old_phase + 1, __full_step = __old_phase + 2;
+ size_t __current_expected = __expected,
+ __current = hash<thread::id>()(this_thread::get_id()) % ((__expected + 1) >> 1);
+ for (int __round = 0;; ++__round) {
+ if (__current_expected <= 1)
+ return true;
+ size_t const __end_node = ((__current_expected + 1) >> 1), __last_node = __end_node - 1;
+ for (;; ++__current) {
+ if (__current == __end_node)
+ __current = 0;
+ __barrier_phase_t expect = __old_phase;
+ if (__current == __last_node && (__current_expected & 1)) {
+ if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ expect, __full_step, memory_order_acq_rel))
+ break; // I'm 1 in 1, go to next __round
+ } else if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ expect, __half_step, memory_order_acq_rel)) {
+ return false; // I'm 1 in 2, done with arrival
+ } else if (expect == __half_step) {
+ if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ expect, __full_step, memory_order_acq_rel))
+ break; // I'm 2 in 2, go to next __round
}
+ }
+ __current_expected = __last_node + 1;
+ __current >>= 1;
}
+ }
};
-_LIBCPP_EXPORTED_FROM_ABI
-__barrier_algorithm_base * __construct_barrier_algorithm_base(ptrdiff_t& __expected)
-{
- return new __barrier_algorithm_base(__expected);
+_LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected) {
+ return new __barrier_algorithm_base(__expected);
}
-_LIBCPP_EXPORTED_FROM_ABI
-bool __arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier,
- __barrier_phase_t __old_phase)
-{
- return __barrier->__arrive(__old_phase);
+_LIBCPP_EXPORTED_FROM_ABI bool
+__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) {
+ return __barrier->__arrive(__old_phase);
}
-_LIBCPP_EXPORTED_FROM_ABI
-void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier)
-{
- delete __barrier;
+_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) {
+ delete __barrier;
}
#endif // !defined(_LIBCPP_HAS_NO_TREE_BARRIER)
diff --git a/contrib/llvm-project/libcxx/src/bind.cpp b/contrib/llvm-project/libcxx/src/bind.cpp
index 0e217e5fc5d6..e057395842ec 100644
--- a/contrib/llvm-project/libcxx/src/bind.cpp
+++ b/contrib/llvm-project/libcxx/src/bind.cpp
@@ -10,20 +10,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace placeholders
-{
+namespace placeholders {
-const __ph<1> _1{};
-const __ph<2> _2{};
-const __ph<3> _3{};
-const __ph<4> _4{};
-const __ph<5> _5{};
-const __ph<6> _6{};
-const __ph<7> _7{};
-const __ph<8> _8{};
-const __ph<9> _9{};
+const __ph<1> _1{};
+const __ph<2> _2{};
+const __ph<3> _3{};
+const __ph<4> _4{};
+const __ph<5> _5{};
+const __ph<6> _6{};
+const __ph<7> _7{};
+const __ph<8> _8{};
+const __ph<9> _9{};
const __ph<10> _10{};
-} // placeholders
+} // namespace placeholders
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/call_once.cpp b/contrib/llvm-project/libcxx/src/call_once.cpp
index 352cdcccdee0..b596518a6540 100644
--- a/contrib/llvm-project/libcxx/src/call_once.cpp
+++ b/contrib/llvm-project/libcxx/src/call_once.cpp
@@ -24,47 +24,45 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// keep in sync with: 7741191.
#ifndef _LIBCPP_HAS_NO_THREADS
-static constinit __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER;
+static constinit __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER;
static constinit __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER;
#endif
-void __call_once(volatile once_flag::_State_type& flag, void* arg,
- void (*func)(void*))
-{
+void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(void*)) {
#if defined(_LIBCPP_HAS_NO_THREADS)
- if (flag == once_flag::_Unset) {
- auto guard = std::__make_exception_guard([&flag] { flag = once_flag::_Unset; });
- flag = once_flag::_Pending;
- func(arg);
- flag = once_flag::_Complete;
- guard.__complete();
- }
+ if (flag == once_flag::_Unset) {
+ auto guard = std::__make_exception_guard([&flag] { flag = once_flag::_Unset; });
+ flag = once_flag::_Pending;
+ func(arg);
+ flag = once_flag::_Complete;
+ guard.__complete();
+ }
#else // !_LIBCPP_HAS_NO_THREADS
- __libcpp_mutex_lock(&mut);
- while (flag == once_flag::_Pending)
- __libcpp_condvar_wait(&cv, &mut);
- if (flag == once_flag::_Unset) {
- auto guard = std::__make_exception_guard([&flag] {
- __libcpp_mutex_lock(&mut);
- __libcpp_relaxed_store(&flag, once_flag::_Unset);
- __libcpp_mutex_unlock(&mut);
- __libcpp_condvar_broadcast(&cv);
- });
+ __libcpp_mutex_lock(&mut);
+ while (flag == once_flag::_Pending)
+ __libcpp_condvar_wait(&cv, &mut);
+ if (flag == once_flag::_Unset) {
+ auto guard = std::__make_exception_guard([&flag] {
+ __libcpp_mutex_lock(&mut);
+ __libcpp_relaxed_store(&flag, once_flag::_Unset);
+ __libcpp_mutex_unlock(&mut);
+ __libcpp_condvar_broadcast(&cv);
+ });
- __libcpp_relaxed_store(&flag, once_flag::_Pending);
- __libcpp_mutex_unlock(&mut);
- func(arg);
- __libcpp_mutex_lock(&mut);
- __libcpp_atomic_store(&flag, once_flag::_Complete, _AO_Release);
- __libcpp_mutex_unlock(&mut);
- __libcpp_condvar_broadcast(&cv);
- guard.__complete();
- } else {
- __libcpp_mutex_unlock(&mut);
- }
+ __libcpp_relaxed_store(&flag, once_flag::_Pending);
+ __libcpp_mutex_unlock(&mut);
+ func(arg);
+ __libcpp_mutex_lock(&mut);
+ __libcpp_atomic_store(&flag, once_flag::_Complete, _AO_Release);
+ __libcpp_mutex_unlock(&mut);
+ __libcpp_condvar_broadcast(&cv);
+ guard.__complete();
+ } else {
+ __libcpp_mutex_unlock(&mut);
+ }
#endif // !_LIBCPP_HAS_NO_THREADS
}
diff --git a/contrib/llvm-project/libcxx/src/charconv.cpp b/contrib/llvm-project/libcxx/src/charconv.cpp
index aa52220413aa..4fd7a2c2c0f0 100644
--- a/contrib/llvm-project/libcxx/src/charconv.cpp
+++ b/contrib/llvm-project/libcxx/src/charconv.cpp
@@ -15,22 +15,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
-namespace __itoa
-{
+namespace __itoa {
-_LIBCPP_EXPORTED_FROM_ABI char*
-__u32toa(uint32_t value, char* buffer) noexcept
-{
- return __base_10_u32(buffer, value);
-}
+_LIBCPP_EXPORTED_FROM_ABI char* __u32toa(uint32_t value, char* buffer) noexcept { return __base_10_u32(buffer, value); }
-_LIBCPP_EXPORTED_FROM_ABI char*
-__u64toa(uint64_t value, char* buffer) noexcept
-{
- return __base_10_u64(buffer, value);
-}
+_LIBCPP_EXPORTED_FROM_ABI char* __u64toa(uint64_t value, char* buffer) noexcept { return __base_10_u64(buffer, value); }
-} // namespace __itoa
+} // namespace __itoa
#endif // _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
@@ -51,8 +42,8 @@ to_chars_result to_chars(char* __first, char* __last, double __value) {
}
to_chars_result to_chars(char* __first, char* __last, long double __value) {
- return _Floating_to_chars<_Floating_to_chars_overload::_Plain>(__first, __last, static_cast<double>(__value),
- chars_format{}, 0);
+ return _Floating_to_chars<_Floating_to_chars_overload::_Plain>(
+ __first, __last, static_cast<double>(__value), chars_format{}, 0);
}
to_chars_result to_chars(char* __first, char* __last, float __value, chars_format __fmt) {
@@ -64,18 +55,18 @@ to_chars_result to_chars(char* __first, char* __last, double __value, chars_form
}
to_chars_result to_chars(char* __first, char* __last, long double __value, chars_format __fmt) {
- return _Floating_to_chars<_Floating_to_chars_overload::_Format_only>(__first, __last, static_cast<double>(__value),
- __fmt, 0);
+ return _Floating_to_chars<_Floating_to_chars_overload::_Format_only>(
+ __first, __last, static_cast<double>(__value), __fmt, 0);
}
to_chars_result to_chars(char* __first, char* __last, float __value, chars_format __fmt, int __precision) {
- return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(__first, __last, __value, __fmt,
- __precision);
+ return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(
+ __first, __last, __value, __fmt, __precision);
}
to_chars_result to_chars(char* __first, char* __last, double __value, chars_format __fmt, int __precision) {
- return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(__first, __last, __value, __fmt,
- __precision);
+ return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(
+ __first, __last, __value, __fmt, __precision);
}
to_chars_result to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision) {
diff --git a/contrib/llvm-project/libcxx/src/chrono.cpp b/contrib/llvm-project/libcxx/src/chrono.cpp
index c4446070d0a4..c5e827c0cb59 100644
--- a/contrib/llvm-project/libcxx/src/chrono.cpp
+++ b/contrib/llvm-project/libcxx/src/chrono.cpp
@@ -9,7 +9,7 @@
#if defined(__MVS__)
// As part of monotonic clock support on z/OS we need macro _LARGE_TIME_API
// to be defined before any system header to include definition of struct timespec64.
-#define _LARGE_TIME_API
+# define _LARGE_TIME_API
#endif
#include <__system_error/system_error.h>
@@ -17,22 +17,22 @@
#include <chrono>
#if defined(__MVS__)
-#include <__support/ibm/gettod_zos.h> // gettimeofdayMonotonic
+# include <__support/ibm/gettod_zos.h> // gettimeofdayMonotonic
#endif
-#include <time.h> // clock_gettime and CLOCK_{MONOTONIC,REALTIME,MONOTONIC_RAW}
#include "include/apple_availability.h"
+#include <time.h> // clock_gettime and CLOCK_{MONOTONIC,REALTIME,MONOTONIC_RAW}
#if __has_include(<unistd.h>)
-# include <unistd.h> // _POSIX_TIMERS
+# include <unistd.h> // _POSIX_TIMERS
#endif
#if __has_include(<sys/time.h>)
-# include <sys/time.h> // for gettimeofday and timeval
+# include <sys/time.h> // for gettimeofday and timeval
#endif
-#if defined(__APPLE__) || defined (__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
-# define _LIBCPP_HAS_CLOCK_GETTIME
+#if defined(__APPLE__) || defined(__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
+# define _LIBCPP_HAS_CLOCK_GETTIME
#endif
#if defined(_LIBCPP_WIN32API)
@@ -49,7 +49,7 @@
#endif
#if __has_include(<mach/mach_time.h>)
-# include <mach/mach_time.h>
+# include <mach/mach_time.h>
#endif
#if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB)
@@ -58,8 +58,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace chrono
-{
+namespace chrono {
//
// system_clock
@@ -67,17 +66,17 @@ namespace chrono
#if defined(_LIBCPP_WIN32API)
-#if _WIN32_WINNT < _WIN32_WINNT_WIN8
+# if _WIN32_WINNT < _WIN32_WINNT_WIN8
namespace {
-typedef void(WINAPI *GetSystemTimeAsFileTimePtr)(LPFILETIME);
+typedef void(WINAPI* GetSystemTimeAsFileTimePtr)(LPFILETIME);
class GetSystemTimeInit {
public:
GetSystemTimeInit() {
- fp = (GetSystemTimeAsFileTimePtr)GetProcAddress(
- GetModuleHandleW(L"kernel32.dll"), "GetSystemTimePreciseAsFileTime");
+ fp =
+ (GetSystemTimeAsFileTimePtr)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "GetSystemTimePreciseAsFileTime");
if (fp == nullptr)
fp = GetSystemTimeAsFileTime;
}
@@ -86,33 +85,30 @@ public:
// Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority
// attribute with a value that's reserved for the implementation (we're the implementation).
-#include "chrono_system_time_init.h"
+# include "chrono_system_time_init.h"
} // namespace
-#endif
+# endif
static system_clock::time_point __libcpp_system_clock_now() {
// FILETIME is in 100ns units
using filetime_duration =
- std::chrono::duration<__int64,
- std::ratio_multiply<std::ratio<100, 1>,
- nanoseconds::period>>;
+ std::chrono::duration<__int64, std::ratio_multiply<std::ratio<100, 1>, nanoseconds::period>>;
// The Windows epoch is Jan 1 1601, the Unix epoch Jan 1 1970.
static constexpr const seconds nt_to_unix_epoch{11644473600};
FILETIME ft;
-#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) || \
- (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
+# if (_WIN32_WINNT >= _WIN32_WINNT_WIN8 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) || \
+ (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
GetSystemTimePreciseAsFileTime(&ft);
-#elif !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+# elif !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
GetSystemTimeAsFileTime(&ft);
-#else
+# else
GetSystemTimeAsFileTimeFunc.fp(&ft);
-#endif
+# endif
- filetime_duration d{(static_cast<__int64>(ft.dwHighDateTime) << 32) |
- static_cast<__int64>(ft.dwLowDateTime)};
+ filetime_duration d{(static_cast<__int64>(ft.dwHighDateTime) << 32) | static_cast<__int64>(ft.dwLowDateTime)};
return system_clock::time_point(duration_cast<system_clock::duration>(d - nt_to_unix_epoch));
}
@@ -128,32 +124,22 @@ static system_clock::time_point __libcpp_system_clock_now() {
#else
static system_clock::time_point __libcpp_system_clock_now() {
- timeval tv;
- gettimeofday(&tv, 0);
- return system_clock::time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
+ timeval tv;
+ gettimeofday(&tv, 0);
+ return system_clock::time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
}
#endif
const bool system_clock::is_steady;
-system_clock::time_point
-system_clock::now() noexcept
-{
- return __libcpp_system_clock_now();
-}
+system_clock::time_point system_clock::now() noexcept { return __libcpp_system_clock_now(); }
-time_t
-system_clock::to_time_t(const time_point& t) noexcept
-{
- return time_t(duration_cast<seconds>(t.time_since_epoch()).count());
+time_t system_clock::to_time_t(const time_point& t) noexcept {
+ return time_t(duration_cast<seconds>(t.time_since_epoch()).count());
}
-system_clock::time_point
-system_clock::from_time_t(time_t t) noexcept
-{
- return system_clock::time_point(seconds(t));
-}
+system_clock::time_point system_clock::from_time_t(time_t t) noexcept { return system_clock::time_point(seconds(t)); }
//
// steady_clock
@@ -165,7 +151,7 @@ system_clock::from_time_t(time_t t) noexcept
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
-#if defined(__APPLE__)
+# if defined(__APPLE__)
// On Apple platforms, only CLOCK_UPTIME_RAW, CLOCK_MONOTONIC_RAW or
// mach_absolute_time are able to time functions in the nanosecond range.
@@ -173,39 +159,37 @@ system_clock::from_time_t(time_t t) noexcept
// also counts cycles when the system is asleep. Thus, it is the only
// acceptable implementation of steady_clock.
static steady_clock::time_point __libcpp_steady_clock_now() {
- struct timespec tp;
- if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &tp))
- __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed");
- return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
+ struct timespec tp;
+ if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &tp))
+ __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed");
+ return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
}
-#elif defined(_LIBCPP_WIN32API)
+# elif defined(_LIBCPP_WIN32API)
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx says:
// If the function fails, the return value is zero. <snip>
// On systems that run Windows XP or later, the function will always succeed
// and will thus never return zero.
-static LARGE_INTEGER
-__QueryPerformanceFrequency()
-{
- LARGE_INTEGER val;
- (void) QueryPerformanceFrequency(&val);
- return val;
+static LARGE_INTEGER __QueryPerformanceFrequency() {
+ LARGE_INTEGER val;
+ (void)QueryPerformanceFrequency(&val);
+ return val;
}
static steady_clock::time_point __libcpp_steady_clock_now() {
static const LARGE_INTEGER freq = __QueryPerformanceFrequency();
LARGE_INTEGER counter;
- (void) QueryPerformanceCounter(&counter);
- auto seconds = counter.QuadPart / freq.QuadPart;
+ (void)QueryPerformanceCounter(&counter);
+ auto seconds = counter.QuadPart / freq.QuadPart;
auto fractions = counter.QuadPart % freq.QuadPart;
- auto dur = seconds * nano::den + fractions * nano::den / freq.QuadPart;
+ auto dur = seconds * nano::den + fractions * nano::den / freq.QuadPart;
return steady_clock::time_point(steady_clock::duration(dur));
}
-#elif defined(__MVS__)
+# elif defined(__MVS__)
static steady_clock::time_point __libcpp_steady_clock_now() {
struct timespec64 ts;
@@ -229,10 +213,10 @@ static steady_clock::time_point __libcpp_steady_clock_now() noexcept {
# elif defined(_LIBCPP_HAS_CLOCK_GETTIME)
static steady_clock::time_point __libcpp_steady_clock_now() {
- struct timespec tp;
- if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
- __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
- return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
+ struct timespec tp;
+ if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
+ __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
+ return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
}
# else
@@ -241,14 +225,10 @@ static steady_clock::time_point __libcpp_steady_clock_now() {
const bool steady_clock::is_steady;
-steady_clock::time_point
-steady_clock::now() noexcept
-{
- return __libcpp_steady_clock_now();
-}
+steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_clock_now(); }
#endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK
-}
+} // namespace chrono
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/condition_variable.cpp b/contrib/llvm-project/libcxx/src/condition_variable.cpp
index 33e19568b474..db60571cf5f5 100644
--- a/contrib/llvm-project/libcxx/src/condition_variable.cpp
+++ b/contrib/llvm-project/libcxx/src/condition_variable.cpp
@@ -20,69 +20,50 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// ~condition_variable is defined elsewhere.
-void
-condition_variable::notify_one() noexcept
-{
- __libcpp_condvar_signal(&__cv_);
-}
+void condition_variable::notify_one() noexcept { __libcpp_condvar_signal(&__cv_); }
-void
-condition_variable::notify_all() noexcept
-{
- __libcpp_condvar_broadcast(&__cv_);
-}
+void condition_variable::notify_all() noexcept { __libcpp_condvar_broadcast(&__cv_); }
-void
-condition_variable::wait(unique_lock<mutex>& lk) noexcept
-{
- if (!lk.owns_lock())
- __throw_system_error(EPERM,
- "condition_variable::wait: mutex not locked");
- int ec = __libcpp_condvar_wait(&__cv_, lk.mutex()->native_handle());
- if (ec)
- __throw_system_error(ec, "condition_variable wait failed");
+void condition_variable::wait(unique_lock<mutex>& lk) noexcept {
+ if (!lk.owns_lock())
+ __throw_system_error(EPERM, "condition_variable::wait: mutex not locked");
+ int ec = __libcpp_condvar_wait(&__cv_, lk.mutex()->native_handle());
+ if (ec)
+ __throw_system_error(ec, "condition_variable wait failed");
}
-void
-condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
- chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp) noexcept
-{
- using namespace chrono;
- if (!lk.owns_lock())
- __throw_system_error(EPERM,
- "condition_variable::timed wait: mutex not locked");
- nanoseconds d = tp.time_since_epoch();
- if (d > nanoseconds(0x59682F000000E941))
- d = nanoseconds(0x59682F000000E941);
- __libcpp_timespec_t ts;
- seconds s = duration_cast<seconds>(d);
- typedef decltype(ts.tv_sec) ts_sec;
- constexpr ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
- if (s.count() < ts_sec_max)
- {
- ts.tv_sec = static_cast<ts_sec>(s.count());
- ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((d - s).count());
- }
- else
- {
- ts.tv_sec = ts_sec_max;
- ts.tv_nsec = giga::num - 1;
- }
- int ec = __libcpp_condvar_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
- if (ec != 0 && ec != ETIMEDOUT)
- __throw_system_error(ec, "condition_variable timed_wait failed");
+void condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
+ chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp) noexcept {
+ using namespace chrono;
+ if (!lk.owns_lock())
+ __throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked");
+ nanoseconds d = tp.time_since_epoch();
+ if (d > nanoseconds(0x59682F000000E941))
+ d = nanoseconds(0x59682F000000E941);
+ __libcpp_timespec_t ts;
+ seconds s = duration_cast<seconds>(d);
+ typedef decltype(ts.tv_sec) ts_sec;
+ constexpr ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
+ if (s.count() < ts_sec_max) {
+ ts.tv_sec = static_cast<ts_sec>(s.count());
+ ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((d - s).count());
+ } else {
+ ts.tv_sec = ts_sec_max;
+ ts.tv_nsec = giga::num - 1;
+ }
+ int ec = __libcpp_condvar_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
+ if (ec != 0 && ec != ETIMEDOUT)
+ __throw_system_error(ec, "condition_variable timed_wait failed");
}
-void
-notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
-{
- auto& tl_ptr = __thread_local_data();
- // If this thread was not created using std::thread then it will not have
- // previously allocated.
- if (tl_ptr.get() == nullptr) {
- tl_ptr.set_pointer(new __thread_struct);
- }
- __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release());
+void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk) {
+ auto& tl_ptr = __thread_local_data();
+ // If this thread was not created using std::thread then it will not have
+ // previously allocated.
+ if (tl_ptr.get() == nullptr) {
+ tl_ptr.set_pointer(new __thread_struct);
+ }
+ __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/condition_variable_destructor.cpp b/contrib/llvm-project/libcxx/src/condition_variable_destructor.cpp
index d39c8f811d27..8b62d4184018 100644
--- a/contrib/llvm-project/libcxx/src/condition_variable_destructor.cpp
+++ b/contrib/llvm-project/libcxx/src/condition_variable_destructor.cpp
@@ -22,23 +22,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifdef NEEDS_CONDVAR_DESTRUCTOR
-class _LIBCPP_EXPORTED_FROM_ABI condition_variable
-{
- __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
+class _LIBCPP_EXPORTED_FROM_ABI condition_variable {
+ __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
+
public:
- _LIBCPP_HIDE_FROM_ABI
- constexpr condition_variable() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr condition_variable() noexcept = default;
- ~condition_variable();
+ ~condition_variable();
- condition_variable(const condition_variable&) = delete;
- condition_variable& operator=(const condition_variable&) = delete;
+ condition_variable(const condition_variable&) = delete;
+ condition_variable& operator=(const condition_variable&) = delete;
};
-condition_variable::~condition_variable()
-{
- __libcpp_condvar_destroy(&__cv_);
-}
+condition_variable::~condition_variable() { __libcpp_condvar_destroy(&__cv_); }
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/exception.cpp b/contrib/llvm-project/libcxx/src/exception.cpp
index e5d6b9e73a26..ddb186bf8048 100644
--- a/contrib/llvm-project/libcxx/src/exception.cpp
+++ b/contrib/llvm-project/libcxx/src/exception.cpp
@@ -11,25 +11,25 @@
#include <typeinfo>
#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
- #include <cxxabi.h>
- using namespace __cxxabiv1;
- #define HAVE_DEPENDENT_EH_ABI 1
+# include <cxxabi.h>
+using namespace __cxxabiv1;
+# define HAVE_DEPENDENT_EH_ABI 1
#endif
#if defined(_LIBCPP_ABI_MICROSOFT)
-#include "support/runtime/exception_msvc.ipp"
-#include "support/runtime/exception_pointer_msvc.ipp"
+# include "support/runtime/exception_msvc.ipp"
+# include "support/runtime/exception_pointer_msvc.ipp"
#elif defined(_LIBCPPABI_VERSION)
-#include "support/runtime/exception_libcxxabi.ipp"
-#include "support/runtime/exception_pointer_cxxabi.ipp"
+# include "support/runtime/exception_libcxxabi.ipp"
+# include "support/runtime/exception_pointer_cxxabi.ipp"
#elif defined(LIBCXXRT)
-#include "support/runtime/exception_libcxxrt.ipp"
-#include "support/runtime/exception_pointer_cxxabi.ipp"
+# include "support/runtime/exception_libcxxrt.ipp"
+# include "support/runtime/exception_pointer_cxxabi.ipp"
#elif defined(__GLIBCXX__)
-#include "support/runtime/exception_glibcxx.ipp"
-#include "support/runtime/exception_pointer_glibcxx.ipp"
+# include "support/runtime/exception_glibcxx.ipp"
+# include "support/runtime/exception_pointer_glibcxx.ipp"
#else
-#include "include/atomic_support.h"
-#include "support/runtime/exception_fallback.ipp"
-#include "support/runtime/exception_pointer_unimplemented.ipp"
+# include "include/atomic_support.h"
+# include "support/runtime/exception_fallback.ipp"
+# include "support/runtime/exception_pointer_unimplemented.ipp"
#endif
diff --git a/contrib/llvm-project/libcxx/src/filesystem/directory_entry.cpp b/contrib/llvm-project/libcxx/src/filesystem/directory_entry.cpp
index a71c2f9d2456..152715243906 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/directory_entry.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/directory_entry.cpp
@@ -29,8 +29,8 @@ error_code directory_entry::__do_refresh() noexcept {
}
if (!filesystem::exists(st) || !filesystem::is_symlink(st)) {
- __data_.__cache_type_ = directory_entry::_RefreshNonSymlink;
- __data_.__type_ = st.type();
+ __data_.__cache_type_ = directory_entry::_RefreshNonSymlink;
+ __data_.__type_ = st.type();
__data_.__non_sym_perms_ = st.permissions();
} else { // we have a symlink
__data_.__sym_perms_ = st.permissions();
@@ -40,7 +40,7 @@ error_code directory_entry::__do_refresh() noexcept {
error_code ignored_ec;
st = detail::posix_stat(__p_, full_st, &ignored_ec);
- __data_.__type_ = st.type();
+ __data_.__type_ = st.type();
__data_.__non_sym_perms_ = st.permissions();
// If we failed to resolve the link, then only partially populate the
@@ -64,8 +64,7 @@ error_code directory_entry::__do_refresh() noexcept {
// file_time_type. For now we ignore the error, as we'll report it when
// the value is actually used.
error_code ignored_ec;
- __data_.__write_time_ =
- detail::__extract_last_write_time(__p_, full_st, &ignored_ec);
+ __data_.__write_time_ = detail::__extract_last_write_time(__p_, full_st, &ignored_ec);
}
return failure_ec;
diff --git a/contrib/llvm-project/libcxx/src/filesystem/directory_iterator.cpp b/contrib/llvm-project/libcxx/src/filesystem/directory_iterator.cpp
index 0fd6265c99c7..dceb3486279f 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/directory_iterator.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/directory_iterator.cpp
@@ -17,11 +17,11 @@
#include "file_descriptor.h"
#if defined(_LIBCPP_WIN32API)
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <windows.h>
#else
-# include <dirent.h> // for DIR & friends
+# include <dirent.h> // for DIR & friends
#endif
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
@@ -31,12 +31,11 @@ using detail::ErrorHandler;
#if defined(_LIBCPP_WIN32API)
class __dir_stream {
public:
- __dir_stream() = delete;
+ __dir_stream() = delete;
__dir_stream& operator=(const __dir_stream&) = delete;
- __dir_stream(__dir_stream&& __ds) noexcept : __stream_(__ds.__stream_),
- __root_(std::move(__ds.__root_)),
- __entry_(std::move(__ds.__entry_)) {
+ __dir_stream(__dir_stream&& __ds) noexcept
+ : __stream_(__ds.__stream_), __root_(std::move(__ds.__root_)), __entry_(std::move(__ds.__entry_)) {
__ds.__stream_ = INVALID_HANDLE_VALUE;
}
@@ -48,11 +47,9 @@ public:
}
__stream_ = ::FindFirstFileW((root / "*").c_str(), &__data_);
if (__stream_ == INVALID_HANDLE_VALUE) {
- ec = detail::make_windows_error(GetLastError());
- const bool ignore_permission_denied =
- bool(opts & directory_options::skip_permission_denied);
- if (ignore_permission_denied &&
- ec.value() == static_cast<int>(errc::permission_denied))
+ ec = detail::make_windows_error(GetLastError());
+ const bool ignore_permission_denied = bool(opts & directory_options::skip_permission_denied);
+ if (ignore_permission_denied && ec.value() == static_cast<int>(errc::permission_denied))
ec.clear();
return;
}
@@ -81,13 +78,12 @@ public:
if (!wcscmp(__data_.cFileName, L".") || !wcscmp(__data_.cFileName, L".."))
return false;
// FIXME: Cache more of this
- //directory_entry::__cached_data cdata;
- //cdata.__type_ = get_file_type(__data_);
- //cdata.__size_ = get_file_size(__data_);
- //cdata.__write_time_ = get_write_time(__data_);
+ // directory_entry::__cached_data cdata;
+ // cdata.__type_ = get_file_type(__data_);
+ // cdata.__size_ = get_file_size(__data_);
+ // cdata.__write_time_ = get_write_time(__data_);
__entry_.__assign_iter_entry(
- __root_ / __data_.cFileName,
- directory_entry::__create_iter_result(detail::get_file_type(__data_)));
+ __root_ / __data_.cFileName, directory_entry::__create_iter_result(detail::get_file_type(__data_)));
return true;
}
@@ -110,21 +106,18 @@ public:
#else
class __dir_stream {
public:
- __dir_stream() = delete;
+ __dir_stream() = delete;
__dir_stream& operator=(const __dir_stream&) = delete;
- __dir_stream(__dir_stream&& other) noexcept : __stream_(other.__stream_),
- __root_(std::move(other.__root_)),
- __entry_(std::move(other.__entry_)) {
+ __dir_stream(__dir_stream&& other) noexcept
+ : __stream_(other.__stream_), __root_(std::move(other.__root_)), __entry_(std::move(other.__entry_)) {
other.__stream_ = nullptr;
}
- __dir_stream(const path& root, directory_options opts, error_code& ec)
- : __stream_(nullptr), __root_(root) {
+ __dir_stream(const path& root, directory_options opts, error_code& ec) : __stream_(nullptr), __root_(root) {
if ((__stream_ = ::opendir(root.c_str())) == nullptr) {
- ec = detail::capture_errno();
- const bool allow_eacces =
- bool(opts & directory_options::skip_permission_denied);
+ ec = detail::capture_errno();
+ const bool allow_eacces = bool(opts & directory_options::skip_permission_denied);
if (allow_eacces && ec.value() == EACCES)
ec.clear();
return;
@@ -142,16 +135,14 @@ public:
bool advance(error_code& ec) {
while (true) {
auto str_type_pair = detail::posix_readdir(__stream_, ec);
- auto& str = str_type_pair.first;
+ auto& str = str_type_pair.first;
if (str == "." || str == "..") {
continue;
} else if (ec || str.empty()) {
close();
return false;
} else {
- __entry_.__assign_iter_entry(
- __root_ / str,
- directory_entry::__create_iter_result(str_type_pair.second));
+ __entry_.__assign_iter_entry(__root_ / str, directory_entry::__create_iter_result(str_type_pair.second));
return true;
}
}
@@ -176,8 +167,7 @@ public:
// directory_iterator
-directory_iterator::directory_iterator(const path& p, error_code* ec,
- directory_options opts) {
+directory_iterator::directory_iterator(const path& p, error_code* ec, directory_options opts) {
ErrorHandler<void> err("directory_iterator::directory_iterator(...)", ec, &p);
error_code m_ec;
@@ -217,8 +207,7 @@ struct recursive_directory_iterator::__shared_imp {
directory_options __options_;
};
-recursive_directory_iterator::recursive_directory_iterator(
- const path& p, directory_options opt, error_code* ec)
+recursive_directory_iterator::recursive_directory_iterator(const path& p, directory_options opt, error_code* ec)
: __imp_(nullptr), __rec_(true) {
ErrorHandler<void> err("recursive_directory_iterator", ec, &p);
@@ -229,7 +218,7 @@ recursive_directory_iterator::recursive_directory_iterator(
if (m_ec || !new_s.good())
return;
- __imp_ = make_shared<__shared_imp>();
+ __imp_ = make_shared<__shared_imp>();
__imp_->__options_ = opt;
__imp_->__stack_.push(std::move(new_s));
}
@@ -245,20 +234,13 @@ void recursive_directory_iterator::__pop(error_code* ec) {
__advance(ec);
}
-directory_options recursive_directory_iterator::options() const {
- return __imp_->__options_;
-}
+directory_options recursive_directory_iterator::options() const { return __imp_->__options_; }
-int recursive_directory_iterator::depth() const {
- return __imp_->__stack_.size() - 1;
-}
+int recursive_directory_iterator::depth() const { return __imp_->__stack_.size() - 1; }
-const directory_entry& recursive_directory_iterator::__dereference() const {
- return __imp_->__stack_.top().__entry_;
-}
+const directory_entry& recursive_directory_iterator::__dereference() const { return __imp_->__stack_.top().__entry_; }
-recursive_directory_iterator&
-recursive_directory_iterator::__increment(error_code* ec) {
+recursive_directory_iterator& recursive_directory_iterator::__increment(error_code* ec) {
if (ec)
ec->clear();
if (recursion_pending()) {
@@ -324,16 +306,14 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) {
}
}
if (m_ec) {
- const bool allow_eacess =
- bool(__imp_->__options_ & directory_options::skip_permission_denied);
+ const bool allow_eacess = bool(__imp_->__options_ & directory_options::skip_permission_denied);
if (m_ec.value() == EACCES && allow_eacess) {
if (ec)
ec->clear();
} else {
path at_ent = std::move(curr_it.__entry_.__p_);
__imp_.reset();
- err.report(m_ec, "attempting recursion into " PATH_CSTR_FMT,
- at_ent.c_str());
+ err.report(m_ec, "attempting recursion into " PATH_CSTR_FMT, at_ent.c_str());
}
}
return false;
diff --git a/contrib/llvm-project/libcxx/src/filesystem/error.h b/contrib/llvm-project/libcxx/src/filesystem/error.h
index 93da75876151..b86f4ed41071 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/error.h
+++ b/contrib/llvm-project/libcxx/src/filesystem/error.h
@@ -23,9 +23,9 @@
#include "format_string.h"
#if defined(_LIBCPP_WIN32API)
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <windows.h> // ERROR_* macros
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <windows.h> // ERROR_* macros
#endif
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
@@ -90,7 +90,7 @@ inline errc __win_err_to_errc(int err) {
{ERROR_WRITE_PROTECT, errc::permission_denied},
};
- for (const auto &pair : win_error_mapping)
+ for (const auto& pair : win_error_mapping)
if (pair.win == static_cast<DWORD>(err))
return pair.errc;
return errc::invalid_argument;
@@ -104,9 +104,7 @@ inline error_code capture_errno() {
}
#if defined(_LIBCPP_WIN32API)
-inline error_code make_windows_error(int err) {
- return make_error_code(__win_err_to_errc(err));
-}
+inline error_code make_windows_error(int err) { return make_error_code(__win_err_to_errc(err)); }
#endif
template <class T>
@@ -143,8 +141,7 @@ struct ErrorHandler {
const path* p1_ = nullptr;
const path* p2_ = nullptr;
- ErrorHandler(const char* fname, error_code* ec, const path* p1 = nullptr,
- const path* p2 = nullptr)
+ ErrorHandler(const char* fname, error_code* ec, const path* p1 = nullptr, const path* p2 = nullptr)
: func_name_(fname), ec_(ec), p1_(p1), p2_(p2) {
if (ec_)
ec_->clear();
@@ -173,8 +170,7 @@ struct ErrorHandler {
*ec_ = ec;
return;
}
- string what =
- string("in ") + func_name_ + ": " + detail::vformat_string(msg, ap);
+ string what = string("in ") + func_name_ + ": " + detail::vformat_string(msg, ap);
switch (bool(p1_) + bool(p2_)) {
case 0:
__throw_filesystem_error(what, ec);
@@ -204,9 +200,7 @@ struct ErrorHandler {
return error_value<T>();
}
- T report(errc const& err) const {
- return report(make_error_code(err));
- }
+ T report(errc const& err) const { return report(make_error_code(err)); }
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4)
T report(errc const& err, const char* msg, ...) const {
@@ -227,7 +221,7 @@ struct ErrorHandler {
}
private:
- ErrorHandler(ErrorHandler const&) = delete;
+ ErrorHandler(ErrorHandler const&) = delete;
ErrorHandler& operator=(ErrorHandler const&) = delete;
};
diff --git a/contrib/llvm-project/libcxx/src/filesystem/file_descriptor.h b/contrib/llvm-project/libcxx/src/filesystem/file_descriptor.h
index 67f670893c31..50178ff84e03 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/file_descriptor.h
+++ b/contrib/llvm-project/libcxx/src/filesystem/file_descriptor.h
@@ -21,15 +21,15 @@
#include "time_utils.h"
#if defined(_LIBCPP_WIN32API)
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <windows.h>
#else
-# include <dirent.h> // for DIR & friends
-# include <fcntl.h> // values for fchmodat
-# include <sys/stat.h>
-# include <sys/statvfs.h>
-# include <unistd.h>
+# include <dirent.h> // for DIR & friends
+# include <fcntl.h> // values for fchmodat
+# include <sys/stat.h>
+# include <sys/statvfs.h>
+# include <unistd.h>
#endif // defined(_LIBCPP_WIN32API)
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
@@ -38,7 +38,7 @@ namespace detail {
#if !defined(_LIBCPP_WIN32API)
-#if defined(DT_BLK)
+# if defined(DT_BLK)
template <class DirEntT, class = decltype(DirEntT::d_type)>
file_type get_file_type(DirEntT* ent, int) {
switch (ent->d_type) {
@@ -64,17 +64,16 @@ file_type get_file_type(DirEntT* ent, int) {
}
return file_type::none;
}
-#endif // defined(DT_BLK)
+# endif // defined(DT_BLK)
template <class DirEntT>
file_type get_file_type(DirEntT*, long) {
return file_type::none;
}
-inline pair<string_view, file_type> posix_readdir(DIR* dir_stream,
- error_code& ec) {
+inline pair<string_view, file_type> posix_readdir(DIR* dir_stream, error_code& ec) {
struct dirent* dir_entry_ptr = nullptr;
- errno = 0; // zero errno in order to detect errors
+ errno = 0; // zero errno in order to detect errors
ec.clear();
if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) {
if (errno)
@@ -88,8 +87,7 @@ inline pair<string_view, file_type> posix_readdir(DIR* dir_stream,
#else // _LIBCPP_WIN32API
inline file_type get_file_type(const WIN32_FIND_DATAW& data) {
- if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
- data.dwReserved0 == IO_REPARSE_TAG_SYMLINK)
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && data.dwReserved0 == IO_REPARSE_TAG_SYMLINK)
return file_type::symlink;
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
return file_type::directory;
@@ -101,8 +99,8 @@ inline uintmax_t get_file_size(const WIN32_FIND_DATAW& data) {
inline file_time_type get_write_time(const WIN32_FIND_DATAW& data) {
ULARGE_INTEGER tmp;
const FILETIME& time = data.ftLastWriteTime;
- tmp.u.LowPart = time.dwLowDateTime;
- tmp.u.HighPart = time.dwHighDateTime;
+ tmp.u.LowPart = time.dwLowDateTime;
+ tmp.u.HighPart = time.dwHighDateTime;
return file_time_type(file_time_type::duration(tmp.QuadPart));
}
@@ -110,7 +108,7 @@ inline file_time_type get_write_time(const WIN32_FIND_DATAW& data) {
// POSIX HELPERS
-using value_type = path::value_type;
+using value_type = path::value_type;
using string_type = path::string_type;
struct FileDescriptor {
@@ -149,8 +147,7 @@ struct FileDescriptor {
}
template <class... Args>
- static FileDescriptor create_with_status(const path* p, error_code& ec,
- Args... args) {
+ static FileDescriptor create_with_status(const path* p, error_code& ec, Args... args) {
FileDescriptor fd = create(p, ec, args...);
if (!ec)
fd.refresh_status(ec);
@@ -178,27 +175,23 @@ struct FileDescriptor {
}
FileDescriptor(FileDescriptor&& other)
- : name(other.name), fd(other.fd), m_stat(other.m_stat),
- m_status(other.m_status) {
- other.fd = -1;
+ : name(other.name), fd(other.fd), m_stat(other.m_stat), m_status(other.m_status) {
+ other.fd = -1;
other.m_status = file_status{};
}
~FileDescriptor() { close(); }
- FileDescriptor(FileDescriptor const&) = delete;
+ FileDescriptor(FileDescriptor const&) = delete;
FileDescriptor& operator=(FileDescriptor const&) = delete;
private:
explicit FileDescriptor(const path* p, int descriptor = -1) : name(*p), fd(descriptor) {}
};
-inline perms posix_get_perms(const StatT& st) noexcept {
- return static_cast<perms>(st.st_mode) & perms::mask;
-}
+inline perms posix_get_perms(const StatT& st) noexcept { return static_cast<perms>(st.st_mode) & perms::mask; }
-inline file_status create_file_status(error_code& m_ec, path const& p,
- const StatT& path_stat, error_code* ec) {
+inline file_status create_file_status(error_code& m_ec, path const& p, const StatT& path_stat, error_code* ec) {
if (ec)
*ec = m_ec;
if (m_ec && (m_ec.value() == ENOENT || m_ec.value() == ENOTDIR)) {
@@ -283,7 +276,7 @@ inline bool stat_equivalent(const StatT& st1, const StatT& st2) {
inline file_status FileDescriptor::refresh_status(error_code& ec) {
// FD must be open and good.
m_status = file_status{};
- m_stat = {};
+ m_stat = {};
error_code m_ec;
if (detail::fstat(fd, &m_stat) == -1)
m_ec = capture_errno();
diff --git a/contrib/llvm-project/libcxx/src/filesystem/filesystem_clock.cpp b/contrib/llvm-project/libcxx/src/filesystem/filesystem_clock.cpp
index fbb19ac68df5..e13b2853e367 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/filesystem_clock.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/filesystem_clock.cpp
@@ -16,21 +16,21 @@
#endif
#if defined(_LIBCPP_WIN32API)
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <windows.h>
#endif
#if __has_include(<unistd.h>)
-# include <unistd.h> // _POSIX_TIMERS
+# include <unistd.h> // _POSIX_TIMERS
#endif
#if __has_include(<sys/time.h>)
-# include <sys/time.h> // for gettimeofday and timeval
+# include <sys/time.h> // for gettimeofday and timeval
#endif
-#if defined(__APPLE__) || defined (__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
-# define _LIBCPP_HAS_CLOCK_GETTIME
+#if defined(__APPLE__) || defined(__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
+# define _LIBCPP_HAS_CLOCK_GETTIME
#endif
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
@@ -44,15 +44,13 @@ _FilesystemClock::time_point _FilesystemClock::now() noexcept {
FILETIME time;
GetSystemTimeAsFileTime(&time);
detail::TimeSpec tp = detail::filetime_to_timespec(time);
- return time_point(__secs(tp.tv_sec) +
- chrono::duration_cast<duration>(__nsecs(tp.tv_nsec)));
+ return time_point(__secs(tp.tv_sec) + chrono::duration_cast<duration>(__nsecs(tp.tv_nsec)));
#elif defined(_LIBCPP_HAS_CLOCK_GETTIME)
typedef chrono::duration<rep, nano> __nsecs;
struct timespec tp;
if (0 != clock_gettime(CLOCK_REALTIME, &tp))
__throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
- return time_point(__secs(tp.tv_sec) +
- chrono::duration_cast<duration>(__nsecs(tp.tv_nsec)));
+ return time_point(__secs(tp.tv_sec) + chrono::duration_cast<duration>(__nsecs(tp.tv_nsec)));
#else
typedef chrono::duration<rep, micro> __microsecs;
timeval tv;
diff --git a/contrib/llvm-project/libcxx/src/filesystem/filesystem_error.cpp b/contrib/llvm-project/libcxx/src/filesystem/filesystem_error.cpp
index 5faed3b89efa..456b902c3315 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/filesystem_error.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/filesystem_error.cpp
@@ -19,16 +19,18 @@ filesystem_error::~filesystem_error() {}
void filesystem_error::__create_what(int __num_paths) {
const char* derived_what = system_error::what();
- __storage_->__what_ = [&]() -> string {
+ __storage_->__what_ = [&]() -> string {
switch (__num_paths) {
case 0:
return detail::format_string("filesystem error: %s", derived_what);
case 1:
- return detail::format_string("filesystem error: %s [" PATH_CSTR_FMT "]",
- derived_what, path1().c_str());
+ return detail::format_string("filesystem error: %s [" PATH_CSTR_FMT "]", derived_what, path1().c_str());
case 2:
- return detail::format_string("filesystem error: %s [" PATH_CSTR_FMT "] [" PATH_CSTR_FMT "]",
- derived_what, path1().c_str(), path2().c_str());
+ return detail::format_string(
+ "filesystem error: %s [" PATH_CSTR_FMT "] [" PATH_CSTR_FMT "]",
+ derived_what,
+ path1().c_str(),
+ path2().c_str());
}
__libcpp_unreachable();
}();
diff --git a/contrib/llvm-project/libcxx/src/filesystem/int128_builtins.cpp b/contrib/llvm-project/libcxx/src/filesystem/int128_builtins.cpp
index 96bcc5fa67e8..72b7cb4a8d1c 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/int128_builtins.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/int128_builtins.cpp
@@ -18,13 +18,13 @@
#if !defined(_LIBCPP_HAS_NO_INT128)
-extern "C" __attribute__((no_sanitize("undefined"))) _LIBCPP_EXPORTED_FROM_ABI
-__int128_t __muloti4(__int128_t a, __int128_t b, int* overflow) {
- const int N = (int)(sizeof(__int128_t) * CHAR_BIT);
+extern "C" __attribute__((no_sanitize("undefined"))) _LIBCPP_EXPORTED_FROM_ABI __int128_t
+__muloti4(__int128_t a, __int128_t b, int* overflow) {
+ const int N = (int)(sizeof(__int128_t) * CHAR_BIT);
const __int128_t MIN = (__int128_t)1 << (N - 1);
const __int128_t MAX = ~MIN;
- *overflow = 0;
- __int128_t result = a * b;
+ *overflow = 0;
+ __int128_t result = a * b;
if (a == MIN) {
if (b != 0 && b != 1)
*overflow = 1;
@@ -35,9 +35,9 @@ __int128_t __muloti4(__int128_t a, __int128_t b, int* overflow) {
*overflow = 1;
return result;
}
- __int128_t sa = a >> (N - 1);
+ __int128_t sa = a >> (N - 1);
__int128_t abs_a = (a ^ sa) - sa;
- __int128_t sb = b >> (N - 1);
+ __int128_t sb = b >> (N - 1);
__int128_t abs_b = (b ^ sb) - sb;
if (abs_a < 2 || abs_b < 2)
return result;
diff --git a/contrib/llvm-project/libcxx/src/filesystem/operations.cpp b/contrib/llvm-project/libcxx/src/filesystem/operations.cpp
index 1877bcd79f4d..a84a54b27d3e 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/operations.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/operations.cpp
@@ -25,31 +25,31 @@
#include "time_utils.h"
#if defined(_LIBCPP_WIN32API)
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <windows.h>
#else
-# include <dirent.h>
-# include <sys/stat.h>
-# include <sys/statvfs.h>
-# include <unistd.h>
+# include <dirent.h>
+# include <sys/stat.h>
+# include <sys/statvfs.h>
+# include <unistd.h>
#endif
-#include <time.h>
#include <fcntl.h> /* values for fchmodat */
+#include <time.h>
#if __has_include(<sys/sendfile.h>)
-# include <sys/sendfile.h>
-# define _LIBCPP_FILESYSTEM_USE_SENDFILE
+# include <sys/sendfile.h>
+# define _LIBCPP_FILESYSTEM_USE_SENDFILE
#elif defined(__APPLE__) || __has_include(<copyfile.h>)
-# include <copyfile.h>
-# define _LIBCPP_FILESYSTEM_USE_COPYFILE
+# include <copyfile.h>
+# define _LIBCPP_FILESYSTEM_USE_COPYFILE
#else
-# include <fstream>
-# define _LIBCPP_FILESYSTEM_USE_FSTREAM
+# include <fstream>
+# define _LIBCPP_FILESYSTEM_USE_FSTREAM
#endif
#if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB)
-# pragma comment(lib, "rt")
+# pragma comment(lib, "rt")
#endif
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
@@ -84,17 +84,16 @@ path __canonical(path const& orig_p, error_code* ec) {
path p = __do_absolute(orig_p, &cwd, ec);
#if (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112) || defined(_LIBCPP_WIN32API)
- std::unique_ptr<path::value_type, decltype(&::free)>
- hold(detail::realpath(p.c_str(), nullptr), &::free);
+ std::unique_ptr<path::value_type, decltype(&::free)> hold(detail::realpath(p.c_str(), nullptr), &::free);
if (hold.get() == nullptr)
return err.report(capture_errno());
return {hold.get()};
#else
- #if defined(__MVS__) && !defined(PATH_MAX)
- path::value_type buff[ _XOPEN_PATH_MAX + 1 ];
- #else
- path::value_type buff[PATH_MAX + 1];
- #endif
+# if defined(__MVS__) && !defined(PATH_MAX)
+ path::value_type buff[_XOPEN_PATH_MAX + 1];
+# else
+ path::value_type buff[PATH_MAX + 1];
+# endif
path::value_type* ret;
if ((ret = detail::realpath(p.c_str(), buff)) == nullptr)
return err.report(capture_errno());
@@ -102,32 +101,27 @@ path __canonical(path const& orig_p, error_code* ec) {
#endif
}
-void __copy(const path& from, const path& to, copy_options options,
- error_code* ec) {
+void __copy(const path& from, const path& to, copy_options options, error_code* ec) {
ErrorHandler<void> err("copy", ec, &from, &to);
- const bool sym_status = bool(
- options & (copy_options::create_symlinks | copy_options::skip_symlinks));
+ const bool sym_status = bool(options & (copy_options::create_symlinks | copy_options::skip_symlinks));
const bool sym_status2 = bool(options & copy_options::copy_symlinks);
error_code m_ec1;
StatT f_st = {};
- const file_status f = sym_status || sym_status2
- ? detail::posix_lstat(from, f_st, &m_ec1)
- : detail::posix_stat(from, f_st, &m_ec1);
+ const file_status f =
+ sym_status || sym_status2 ? detail::posix_lstat(from, f_st, &m_ec1) : detail::posix_stat(from, f_st, &m_ec1);
if (m_ec1)
return err.report(m_ec1);
- StatT t_st = {};
- const file_status t = sym_status ? detail::posix_lstat(to, t_st, &m_ec1)
- : detail::posix_stat(to, t_st, &m_ec1);
+ StatT t_st = {};
+ const file_status t = sym_status ? detail::posix_lstat(to, t_st, &m_ec1) : detail::posix_stat(to, t_st, &m_ec1);
if (not status_known(t))
return err.report(m_ec1);
- if (!exists(f) || is_other(f) || is_other(t) ||
- (is_directory(f) && is_regular_file(t)) ||
+ if (!exists(f) || is_other(f) || is_other(t) || (is_directory(f) && is_regular_file(t)) ||
detail::stat_equivalent(f_st, t_st)) {
return err.report(errc::function_not_supported);
}
@@ -159,9 +153,7 @@ void __copy(const path& from, const path& to, copy_options options,
return;
} else if (is_directory(f) && bool(copy_options::create_symlinks & options)) {
return err.report(errc::is_a_directory);
- } else if (is_directory(f) && (bool(copy_options::recursive & options) ||
- copy_options::none == options)) {
-
+ } else if (is_directory(f) && (bool(copy_options::recursive & options) || copy_options::none == options)) {
if (!exists(t)) {
// create directory to with attributes from 'from'.
__create_directory(to, from, ec);
@@ -169,8 +161,7 @@ void __copy(const path& from, const path& to, copy_options options,
return;
}
}
- directory_iterator it =
- ec ? directory_iterator(from, *ec) : directory_iterator(from);
+ directory_iterator it = ec ? directory_iterator(from, *ec) : directory_iterator(from);
if (ec && *ec) {
return;
}
@@ -179,8 +170,7 @@ void __copy(const path& from, const path& to, copy_options options,
if (m_ec2) {
return err.report(m_ec2);
}
- __copy(it->path(), to / it->path().filename(),
- options | copy_options::__in_recursive_copy, ec);
+ __copy(it->path(), to / it->path().filename(), options | copy_options::__in_recursive_copy, ec);
if (ec && *ec) {
return;
}
@@ -192,95 +182,93 @@ namespace detail {
namespace {
#if defined(_LIBCPP_FILESYSTEM_USE_SENDFILE)
- bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
- size_t count = read_fd.get_stat().st_size;
- do {
- ssize_t res;
- if ((res = ::sendfile(write_fd.fd, read_fd.fd, nullptr, count)) == -1) {
- ec = capture_errno();
- return false;
- }
- count -= res;
- } while (count > 0);
-
- ec.clear();
-
- return true;
- }
-#elif defined(_LIBCPP_FILESYSTEM_USE_COPYFILE)
- bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
- struct CopyFileState {
- copyfile_state_t state;
- CopyFileState() { state = copyfile_state_alloc(); }
- ~CopyFileState() { copyfile_state_free(state); }
-
- private:
- CopyFileState(CopyFileState const&) = delete;
- CopyFileState& operator=(CopyFileState const&) = delete;
- };
-
- CopyFileState cfs;
- if (fcopyfile(read_fd.fd, write_fd.fd, cfs.state, COPYFILE_DATA) < 0) {
+bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
+ size_t count = read_fd.get_stat().st_size;
+ do {
+ ssize_t res;
+ if ((res = ::sendfile(write_fd.fd, read_fd.fd, nullptr, count)) == -1) {
ec = capture_errno();
return false;
}
+ count -= res;
+ } while (count > 0);
- ec.clear();
- return true;
+ ec.clear();
+
+ return true;
+}
+#elif defined(_LIBCPP_FILESYSTEM_USE_COPYFILE)
+bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
+ struct CopyFileState {
+ copyfile_state_t state;
+ CopyFileState() { state = copyfile_state_alloc(); }
+ ~CopyFileState() { copyfile_state_free(state); }
+
+ private:
+ CopyFileState(CopyFileState const&) = delete;
+ CopyFileState& operator=(CopyFileState const&) = delete;
+ };
+
+ CopyFileState cfs;
+ if (fcopyfile(read_fd.fd, write_fd.fd, cfs.state, COPYFILE_DATA) < 0) {
+ ec = capture_errno();
+ return false;
}
-#elif defined(_LIBCPP_FILESYSTEM_USE_FSTREAM)
- bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
- ifstream in;
- in.__open(read_fd.fd, ios::binary);
- if (!in.is_open()) {
- // This assumes that __open didn't reset the error code.
- ec = capture_errno();
- return false;
- }
- read_fd.fd = -1;
- ofstream out;
- out.__open(write_fd.fd, ios::binary);
- if (!out.is_open()) {
- ec = capture_errno();
- return false;
- }
- write_fd.fd = -1;
-
- if (in.good() && out.good()) {
- using InIt = istreambuf_iterator<char>;
- using OutIt = ostreambuf_iterator<char>;
- InIt bin(in);
- InIt ein;
- OutIt bout(out);
- copy(bin, ein, bout);
- }
- if (out.fail() || in.fail()) {
- ec = make_error_code(errc::io_error);
- return false;
- }
- ec.clear();
- return true;
+ ec.clear();
+ return true;
+}
+#elif defined(_LIBCPP_FILESYSTEM_USE_FSTREAM)
+bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
+ ifstream in;
+ in.__open(read_fd.fd, ios::binary);
+ if (!in.is_open()) {
+ // This assumes that __open didn't reset the error code.
+ ec = capture_errno();
+ return false;
+ }
+ read_fd.fd = -1;
+ ofstream out;
+ out.__open(write_fd.fd, ios::binary);
+ if (!out.is_open()) {
+ ec = capture_errno();
+ return false;
+ }
+ write_fd.fd = -1;
+
+ if (in.good() && out.good()) {
+ using InIt = istreambuf_iterator<char>;
+ using OutIt = ostreambuf_iterator<char>;
+ InIt bin(in);
+ InIt ein;
+ OutIt bout(out);
+ copy(bin, ein, bout);
+ }
+ if (out.fail() || in.fail()) {
+ ec = make_error_code(errc::io_error);
+ return false;
}
+
+ ec.clear();
+ return true;
+}
#else
-# error "Unknown implementation for copy_file_impl"
+# error "Unknown implementation for copy_file_impl"
#endif // copy_file_impl implementation
} // end anonymous namespace
} // end namespace detail
-bool __copy_file(const path& from, const path& to, copy_options options,
- error_code* ec) {
+bool __copy_file(const path& from, const path& to, copy_options options, error_code* ec) {
using detail::FileDescriptor;
ErrorHandler<bool> err("copy_file", ec, &to, &from);
error_code m_ec;
- FileDescriptor from_fd = FileDescriptor::create_with_status(
- &from, m_ec, O_RDONLY | O_NONBLOCK | O_BINARY);
+ FileDescriptor from_fd = FileDescriptor::create_with_status(&from, m_ec, O_RDONLY | O_NONBLOCK | O_BINARY);
if (m_ec)
return err.report(m_ec);
- auto from_st = from_fd.get_status();
+ auto from_st = from_fd.get_status();
StatT const& from_stat = from_fd.get_stat();
if (!is_regular_file(from_st)) {
if (not m_ec)
@@ -288,10 +276,9 @@ bool __copy_file(const path& from, const path& to, copy_options options,
return err.report(m_ec);
}
- const bool skip_existing = bool(copy_options::skip_existing & options);
- const bool update_existing = bool(copy_options::update_existing & options);
- const bool overwrite_existing =
- bool(copy_options::overwrite_existing & options);
+ const bool skip_existing = bool(copy_options::skip_existing & options);
+ const bool update_existing = bool(copy_options::update_existing & options);
+ const bool overwrite_existing = bool(copy_options::overwrite_existing & options);
StatT to_stat_path;
file_status to_st = detail::posix_stat(to, to_stat_path, &m_ec);
@@ -311,11 +298,10 @@ bool __copy_file(const path& from, const path& to, copy_options options,
bool ShouldCopy = [&]() {
if (to_exists && update_existing) {
auto from_time = detail::extract_mtime(from_stat);
- auto to_time = detail::extract_mtime(to_stat_path);
+ auto to_time = detail::extract_mtime(to_stat_path);
if (from_time.tv_sec < to_time.tv_sec)
return false;
- if (from_time.tv_sec == to_time.tv_sec &&
- from_time.tv_nsec <= to_time.tv_nsec)
+ if (from_time.tv_sec == to_time.tv_sec && from_time.tv_nsec <= to_time.tv_nsec)
return false;
return true;
}
@@ -331,8 +317,7 @@ bool __copy_file(const path& from, const path& to, copy_options options,
int to_open_flags = O_WRONLY | O_BINARY;
if (!to_exists)
to_open_flags |= O_CREAT;
- FileDescriptor to_fd = FileDescriptor::create_with_status(
- &to, m_ec, to_open_flags, from_stat.st_mode);
+ FileDescriptor to_fd = FileDescriptor::create_with_status(&to, m_ec, to_open_flags, from_stat.st_mode);
if (m_ec)
return err.report(m_ec);
@@ -358,8 +343,7 @@ bool __copy_file(const path& from, const path& to, copy_options options,
return true;
}
-void __copy_symlink(const path& existing_symlink, const path& new_symlink,
- error_code* ec) {
+void __copy_symlink(const path& existing_symlink, const path& new_symlink, error_code* ec) {
const path real_path(__read_symlink(existing_symlink, ec));
if (ec && *ec) {
return;
@@ -431,8 +415,7 @@ bool __create_directory(path const& p, path const& attributes, error_code* ec) {
if (!status_known(st))
return err.report(mec);
if (!is_directory(st))
- return err.report(errc::not_a_directory,
- "the specified attribute path is invalid");
+ return err.report(errc::not_a_directory, "the specified attribute path is invalid");
if (detail::mkdir(p.c_str(), attr_stat.st_mode) == 0)
return true;
@@ -448,8 +431,7 @@ bool __create_directory(path const& p, path const& attributes, error_code* ec) {
return false;
}
-void __create_directory_symlink(path const& from, path const& to,
- error_code* ec) {
+void __create_directory_symlink(path const& from, path const& to, error_code* ec) {
ErrorHandler<void> err("create_directory_symlink", ec, &from, &to);
if (detail::symlink_dir(from.c_str(), to.c_str()) == -1)
return err.report(capture_errno());
@@ -473,7 +455,7 @@ path __current_path(error_code* ec) {
#if defined(_LIBCPP_WIN32API) || defined(__GLIBC__) || defined(__APPLE__)
// Common extension outside of POSIX getcwd() spec, without needing to
// preallocate a buffer. Also supported by a number of other POSIX libcs.
- int size = 0;
+ int size = 0;
path::value_type* ptr = nullptr;
typedef decltype(&::free) Deleter;
Deleter deleter = &::free;
@@ -481,17 +463,18 @@ path __current_path(error_code* ec) {
auto size = ::pathconf(".", _PC_PATH_MAX);
_LIBCPP_ASSERT_UNCATEGORIZED(size >= 0, "pathconf returned a 0 as max size");
- auto buff = unique_ptr<path::value_type[]>(new path::value_type[size + 1]);
+ auto buff = unique_ptr<path::value_type[]>(new path::value_type[size + 1]);
path::value_type* ptr = buff.get();
// Preallocated buffer, don't free the buffer in the second unique_ptr
// below.
- struct Deleter { void operator()(void*) const {} };
+ struct Deleter {
+ void operator()(void*) const {}
+ };
Deleter deleter;
#endif
- unique_ptr<path::value_type, Deleter> hold(detail::getcwd(ptr, size),
- deleter);
+ unique_ptr<path::value_type, Deleter> hold(detail::getcwd(ptr, size), deleter);
if (hold.get() == nullptr)
return err.report(capture_errno(), "call to getcwd failed");
@@ -526,8 +509,7 @@ uintmax_t __file_size(const path& p, error_code* ec) {
StatT st;
file_status fst = detail::posix_stat(p, st, &m_ec);
if (!exists(fst) || !is_regular_file(fst)) {
- errc error_kind =
- is_directory(fst) ? errc::is_a_directory : errc::not_supported;
+ errc error_kind = is_directory(fst) ? errc::is_a_directory : errc::not_supported;
if (!m_ec)
m_ec = make_error_code(error_kind);
return err.report(m_ec);
@@ -597,7 +579,7 @@ void __last_write_time(const path& p, file_time_type new_time, error_code* ec) {
#else
error_code m_ec;
array<TimeSpec, 2> tbuf;
-#if !defined(_LIBCPP_USE_UTIMENSAT)
+# if !defined(_LIBCPP_USE_UTIMENSAT)
// This implementation has a race condition between determining the
// last access time and attempting to set it to the same value using
// ::utimes
@@ -606,10 +588,10 @@ void __last_write_time(const path& p, file_time_type new_time, error_code* ec) {
if (m_ec)
return err.report(m_ec);
tbuf[0] = detail::extract_atime(st);
-#else
- tbuf[0].tv_sec = 0;
+# else
+ tbuf[0].tv_sec = 0;
tbuf[0].tv_nsec = UTIME_OMIT;
-#endif
+# endif
if (!fs_time::convert_to_timespec(tbuf[1], new_time))
return err.report(errc::value_too_large);
@@ -619,14 +601,13 @@ void __last_write_time(const path& p, file_time_type new_time, error_code* ec) {
#endif
}
-void __permissions(const path& p, perms prms, perm_options opts,
- error_code* ec) {
+void __permissions(const path& p, perms prms, perm_options opts, error_code* ec) {
ErrorHandler<void> err("permissions", ec, &p);
- auto has_opt = [&](perm_options o) { return bool(o & opts); };
+ auto has_opt = [&](perm_options o) { return bool(o & opts); };
const bool resolve_symlinks = !has_opt(perm_options::nofollow);
- const bool add_perms = has_opt(perm_options::add);
- const bool remove_perms = has_opt(perm_options::remove);
+ const bool add_perms = has_opt(perm_options::add);
+ const bool remove_perms = has_opt(perm_options::remove);
_LIBCPP_ASSERT_UNCATEGORIZED(
(add_perms + remove_perms + has_opt(perm_options::replace)) == 1,
"One and only one of the perm_options constants replace, add, or remove "
@@ -636,13 +617,11 @@ void __permissions(const path& p, perms prms, perm_options opts,
prms &= perms::mask;
if (!resolve_symlinks || (add_perms || remove_perms)) {
error_code m_ec;
- file_status st = resolve_symlinks ? detail::posix_stat(p, &m_ec)
- : detail::posix_lstat(p, &m_ec);
- set_sym_perms = is_symlink(st);
+ file_status st = resolve_symlinks ? detail::posix_stat(p, &m_ec) : detail::posix_lstat(p, &m_ec);
+ set_sym_perms = is_symlink(st);
if (m_ec)
return err.report(m_ec);
- _LIBCPP_ASSERT_UNCATEGORIZED(st.permissions() != perms::unknown,
- "Permissions unexpectedly unknown");
+ _LIBCPP_ASSERT_UNCATEGORIZED(st.permissions() != perms::unknown, "Permissions unexpectedly unknown");
if (add_perms)
prms |= st.permissions();
else if (remove_perms)
@@ -668,12 +647,14 @@ path __read_symlink(const path& p, error_code* ec) {
ErrorHandler<path> err("read_symlink", ec, &p);
#if defined(PATH_MAX) || defined(MAX_SYMLINK_SIZE)
- struct NullDeleter { void operator()(void*) const {} };
-#ifdef MAX_SYMLINK_SIZE
+ struct NullDeleter {
+ void operator()(void*) const {}
+ };
+# ifdef MAX_SYMLINK_SIZE
const size_t size = MAX_SYMLINK_SIZE + 1;
-#else
+# else
const size_t size = PATH_MAX + 1;
-#endif
+# endif
path::value_type stack_buff[size];
auto buff = std::unique_ptr<path::value_type[], NullDeleter>(stack_buff);
#else
@@ -682,7 +663,7 @@ path __read_symlink(const path& p, error_code* ec) {
return err.report(capture_errno());
}
const size_t size = sb.st_size + 1;
- auto buff = unique_ptr<path::value_type[]>(new path::value_type[size]);
+ auto buff = unique_ptr<path::value_type[]>(new path::value_type[size]);
#endif
detail::SSizeT ret;
if ((ret = detail::readlink(p.c_str(), buff.get(), size)) == -1)
@@ -711,8 +692,8 @@ bool __remove(const path& p, error_code* ec) {
//
// The second implementation is used on platforms where `openat()` & friends are available,
// and it threads file descriptors through recursive calls to avoid such race conditions.
-#if defined(_LIBCPP_WIN32API) || defined (__MVS__)
-# define REMOVE_ALL_USE_DIRECTORY_ITERATOR
+#if defined(_LIBCPP_WIN32API) || defined(__MVS__)
+# define REMOVE_ALL_USE_DIRECTORY_ITERATOR
#endif
#if defined(REMOVE_ALL_USE_DIRECTORY_ITERATOR)
@@ -720,14 +701,13 @@ bool __remove(const path& p, error_code* ec) {
namespace {
uintmax_t remove_all_impl(path const& p, error_code& ec) {
- const auto npos = static_cast<uintmax_t>(-1);
+ const auto npos = static_cast<uintmax_t>(-1);
const file_status st = __symlink_status(p, &ec);
if (ec)
return npos;
uintmax_t count = 1;
if (is_directory(st)) {
- for (directory_iterator it(p, ec); !ec && it != directory_iterator();
- it.increment(ec)) {
+ for (directory_iterator it(p, ec); !ec && it != directory_iterator(); it.increment(ec)) {
auto other_count = remove_all_impl(it->path(), ec);
if (ec)
return npos;
@@ -762,9 +742,7 @@ namespace {
template <class Cleanup>
struct scope_exit {
- explicit scope_exit(Cleanup const& cleanup)
- : cleanup_(cleanup)
- { }
+ explicit scope_exit(Cleanup const& cleanup) : cleanup_(cleanup) {}
~scope_exit() { cleanup_(); }
@@ -776,7 +754,7 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scope_exit);
uintmax_t remove_all_impl(int parent_directory, const path& p, error_code& ec) {
// First, try to open the path as a directory.
const int options = O_CLOEXEC | O_RDONLY | O_DIRECTORY | O_NOFOLLOW;
- int fd = ::openat(parent_directory, p.c_str(), options);
+ int fd = ::openat(parent_directory, p.c_str(), options);
if (fd != -1) {
// If that worked, iterate over the contents of the directory and
// remove everything in it, recursively.
@@ -827,7 +805,7 @@ uintmax_t remove_all_impl(int parent_directory, const path& p, error_code& ec) {
// may return EMLINK instead of ELOOP, contradicting POSIX.
if (ec == errc::not_a_directory || ec == errc::too_many_symbolic_link_levels || ec == errc::too_many_links) {
ec.clear();
- if (::unlinkat(parent_directory, p.c_str(), /* flags = */0) == -1) {
+ if (::unlinkat(parent_directory, p.c_str(), /* flags = */ 0) == -1) {
ec = detail::capture_errno();
return 0;
}
@@ -884,13 +862,9 @@ space_info __space(const path& p, error_code* ec) {
return si;
}
-file_status __status(const path& p, error_code* ec) {
- return detail::posix_stat(p, ec);
-}
+file_status __status(const path& p, error_code* ec) { return detail::posix_stat(p, ec); }
-file_status __symlink_status(const path& p, error_code* ec) {
- return detail::posix_lstat(p, ec);
-}
+file_status __symlink_status(const path& p, error_code* ec) { return detail::posix_lstat(p, ec); }
path __temp_directory_path(error_code* ec) {
ErrorHandler<path> err("temp_directory_path", ec);
@@ -904,22 +878,22 @@ path __temp_directory_path(error_code* ec) {
return err.report(errc::filename_too_long);
// GetTempPathW returns a path with a trailing slash, which we
// shouldn't include for consistency.
- if (buf[retval-1] == L'\\')
- buf[retval-1] = L'\0';
+ if (buf[retval - 1] == L'\\')
+ buf[retval - 1] = L'\0';
path p(buf);
#else
const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
- const char* ret = nullptr;
+ const char* ret = nullptr;
for (auto& ep : env_paths)
if ((ret = getenv(ep)))
break;
if (ret == nullptr) {
-#if defined(__ANDROID__)
+# if defined(__ANDROID__)
ret = "/data/local/tmp";
-#else
+# else
ret = "/tmp";
-#endif
+# endif
}
path p(ret);
@@ -930,8 +904,7 @@ path __temp_directory_path(error_code* ec) {
return err.report(m_ec, "cannot access path " PATH_CSTR_FMT, p.c_str());
if (!exists(st) || !is_directory(st))
- return err.report(errc::not_a_directory,
- "path " PATH_CSTR_FMT " is not a directory", p.c_str());
+ return err.report(errc::not_a_directory, "path " PATH_CSTR_FMT " is not a directory", p.c_str());
return p;
}
diff --git a/contrib/llvm-project/libcxx/src/filesystem/path.cpp b/contrib/llvm-project/libcxx/src/filesystem/path.cpp
index 82f1ba7ba69d..c89346aa510c 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/path.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/path.cpp
@@ -74,19 +74,16 @@ string_view_t path::__root_path_raw() const {
return {};
}
-static bool ConsumeRootName(PathParser *PP) {
- static_assert(PathParser::PS_BeforeBegin == 1 &&
- PathParser::PS_InRootName == 2,
- "Values for enums are incorrect");
+static bool ConsumeRootName(PathParser* PP) {
+ static_assert(PathParser::PS_BeforeBegin == 1 && PathParser::PS_InRootName == 2, "Values for enums are incorrect");
while (PP->State <= PathParser::PS_InRootName)
++(*PP);
return PP->State == PathParser::PS_AtEnd;
}
static bool ConsumeRootDir(PathParser* PP) {
- static_assert(PathParser::PS_BeforeBegin == 1 &&
- PathParser::PS_InRootName == 2 &&
- PathParser::PS_InRootDir == 3, "Values for enums are incorrect");
+ static_assert(PathParser::PS_BeforeBegin == 1 && PathParser::PS_InRootName == 2 && PathParser::PS_InRootDir == 3,
+ "Values for enums are incorrect");
while (PP->State <= PathParser::PS_InRootDir)
++(*PP);
return PP->State == PathParser::PS_AtEnd;
@@ -132,25 +129,14 @@ string_view_t path::__filename() const {
return *(--PathParser::CreateEnd(__pn_));
}
-string_view_t path::__stem() const {
- return parser::separate_filename(__filename()).first;
-}
+string_view_t path::__stem() const { return parser::separate_filename(__filename()).first; }
-string_view_t path::__extension() const {
- return parser::separate_filename(__filename()).second;
-}
+string_view_t path::__extension() const { return parser::separate_filename(__filename()).second; }
////////////////////////////////////////////////////////////////////////////
// path.gen
-enum PathPartKind : unsigned char {
- PK_None,
- PK_RootSep,
- PK_Filename,
- PK_Dot,
- PK_DotDot,
- PK_TrailingSep
-};
+enum PathPartKind : unsigned char { PK_None, PK_RootSep, PK_Filename, PK_Dot, PK_DotDot, PK_TrailingSep };
static PathPartKind ClassifyPathPart(string_view_t Part) {
if (Part.empty())
@@ -180,7 +166,7 @@ path path::lexically_normal() const {
// Track the total size of the parts as we collect them. This allows the
// resulting path to reserve the correct amount of memory.
size_t NewPathSize = 0;
- auto AddPart = [&](PathPartKind K, string_view_t P) {
+ auto AddPart = [&](PathPartKind K, string_view_t P) {
NewPathSize += P.size();
Parts.emplace_back(P, K);
};
@@ -194,7 +180,7 @@ path path::lexically_normal() const {
// Build a stack containing the remaining elements of the path, popping off
// elements which occur before a '..' entry.
for (auto PP = PathParser::CreateBegin(__pn_); PP; ++PP) {
- auto Part = *PP;
+ auto Part = *PP;
PathPartKind Kind = ClassifyPathPart(Part);
switch (Kind) {
case PK_Filename:
@@ -259,11 +245,10 @@ static int DetermineLexicalElementCount(PathParser PP) {
path path::lexically_relative(const path& base) const {
{ // perform root-name/root-directory mismatch checks
- auto PP = PathParser::CreateBegin(__pn_);
- auto PPBase = PathParser::CreateBegin(base.__pn_);
+ auto PP = PathParser::CreateBegin(__pn_);
+ auto PPBase = PathParser::CreateBegin(base.__pn_);
auto CheckIterMismatchAtBase = [&]() {
- return PP.State != PPBase.State &&
- (PP.inRootPath() || PPBase.inRootPath());
+ return PP.State != PPBase.State && (PP.inRootPath() || PPBase.inRootPath());
};
if (PP.inRootName() && PPBase.inRootName()) {
if (*PP != *PPBase)
@@ -280,7 +265,7 @@ path path::lexically_relative(const path& base) const {
}
// Find the first mismatching element
- auto PP = PathParser::CreateBegin(__pn_);
+ auto PP = PathParser::CreateBegin(__pn_);
auto PPBase = PathParser::CreateBegin(base.__pn_);
while (PP && PPBase && PP.State == PPBase.State && *PP == *PPBase) {
++PP;
@@ -314,20 +299,18 @@ path path::lexically_relative(const path& base) const {
////////////////////////////////////////////////////////////////////////////
// path.comparisons
-static int CompareRootName(PathParser *LHS, PathParser *RHS) {
+static int CompareRootName(PathParser* LHS, PathParser* RHS) {
if (!LHS->inRootName() && !RHS->inRootName())
return 0;
- auto GetRootName = [](PathParser *Parser) -> string_view_t {
- return Parser->inRootName() ? **Parser : PATHSTR("");
- };
- int res = GetRootName(LHS).compare(GetRootName(RHS));
+ auto GetRootName = [](PathParser* Parser) -> string_view_t { return Parser->inRootName() ? **Parser : PATHSTR(""); };
+ int res = GetRootName(LHS).compare(GetRootName(RHS));
ConsumeRootName(LHS);
ConsumeRootName(RHS);
return res;
}
-static int CompareRootDir(PathParser *LHS, PathParser *RHS) {
+static int CompareRootDir(PathParser* LHS, PathParser* RHS) {
if (!LHS->inRootDir() && RHS->inRootDir())
return -1;
else if (LHS->inRootDir() && !RHS->inRootDir())
@@ -339,9 +322,9 @@ static int CompareRootDir(PathParser *LHS, PathParser *RHS) {
}
}
-static int CompareRelative(PathParser *LHSPtr, PathParser *RHSPtr) {
- auto &LHS = *LHSPtr;
- auto &RHS = *RHSPtr;
+static int CompareRelative(PathParser* LHSPtr, PathParser* RHSPtr) {
+ auto& LHS = *LHSPtr;
+ auto& RHS = *RHSPtr;
int res;
while (LHS && RHS) {
@@ -353,7 +336,7 @@ static int CompareRelative(PathParser *LHSPtr, PathParser *RHSPtr) {
return 0;
}
-static int CompareEndState(PathParser *LHS, PathParser *RHS) {
+static int CompareEndState(PathParser* LHS, PathParser* RHS) {
if (LHS->atEnd() && !RHS->atEnd())
return -1;
else if (!LHS->atEnd() && RHS->atEnd())
@@ -381,7 +364,7 @@ int path::__compare(string_view_t __s) const {
////////////////////////////////////////////////////////////////////////////
// path.nonmembers
size_t hash_value(const path& __p) noexcept {
- auto PP = PathParser::CreateBegin(__p.native());
+ auto PP = PathParser::CreateBegin(__p.native());
size_t hash_value = 0;
hash<string_view_t> hasher;
while (PP) {
@@ -397,15 +380,15 @@ path::iterator path::begin() const {
auto PP = PathParser::CreateBegin(__pn_);
iterator it;
it.__path_ptr_ = this;
- it.__state_ = static_cast<path::iterator::_ParserState>(PP.State);
- it.__entry_ = PP.RawEntry;
+ it.__state_ = static_cast<path::iterator::_ParserState>(PP.State);
+ it.__entry_ = PP.RawEntry;
it.__stashed_elem_.__assign_view(*PP);
return it;
}
path::iterator path::end() const {
iterator it{};
- it.__state_ = path::iterator::_AtEnd;
+ it.__state_ = path::iterator::_AtEnd;
it.__path_ptr_ = this;
return it;
}
@@ -431,26 +414,24 @@ path::iterator& path::iterator::__decrement() {
#if defined(_LIBCPP_WIN32API)
////////////////////////////////////////////////////////////////////////////
// Windows path conversions
-size_t __wide_to_char(const wstring &str, char *out, size_t outlen) {
+size_t __wide_to_char(const wstring& str, char* out, size_t outlen) {
if (str.empty())
return 0;
ErrorHandler<size_t> err("__wide_to_char", nullptr);
- UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
+ UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
BOOL used_default = FALSE;
- int ret = WideCharToMultiByte(codepage, 0, str.data(), str.size(), out,
- outlen, nullptr, &used_default);
+ int ret = WideCharToMultiByte(codepage, 0, str.data(), str.size(), out, outlen, nullptr, &used_default);
if (ret <= 0 || used_default)
return err.report(errc::illegal_byte_sequence);
return ret;
}
-size_t __char_to_wide(const string &str, wchar_t *out, size_t outlen) {
+size_t __char_to_wide(const string& str, wchar_t* out, size_t outlen) {
if (str.empty())
return 0;
ErrorHandler<size_t> err("__char_to_wide", nullptr);
UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
- int ret = MultiByteToWideChar(codepage, MB_ERR_INVALID_CHARS, str.data(),
- str.size(), out, outlen);
+ int ret = MultiByteToWideChar(codepage, MB_ERR_INVALID_CHARS, str.data(), str.size(), out, outlen);
if (ret <= 0)
return err.report(errc::illegal_byte_sequence);
return ret;
diff --git a/contrib/llvm-project/libcxx/src/filesystem/path_parser.h b/contrib/llvm-project/libcxx/src/filesystem/path_parser.h
index c6e63e8256ad..28a8f240e3bd 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/path_parser.h
+++ b/contrib/llvm-project/libcxx/src/filesystem/path_parser.h
@@ -29,25 +29,23 @@ inline bool isSeparator(path::value_type C) {
return false;
}
-inline bool isDriveLetter(path::value_type C) {
- return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z');
-}
+inline bool isDriveLetter(path::value_type C) { return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z'); }
namespace parser {
-using string_view_t = path::__string_view;
+using string_view_t = path::__string_view;
using string_view_pair = pair<string_view_t, string_view_t>;
-using PosPtr = path::value_type const*;
+using PosPtr = path::value_type const*;
struct PathParser {
enum ParserState : unsigned char {
// Zero is a special sentinel value used by default constructed iterators.
- PS_BeforeBegin = path::iterator::_BeforeBegin,
- PS_InRootName = path::iterator::_InRootName,
- PS_InRootDir = path::iterator::_InRootDir,
- PS_InFilenames = path::iterator::_InFilenames,
+ PS_BeforeBegin = path::iterator::_BeforeBegin,
+ PS_InRootName = path::iterator::_InRootName,
+ PS_InRootDir = path::iterator::_InRootDir,
+ PS_InFilenames = path::iterator::_InFilenames,
PS_InTrailingSep = path::iterator::_InTrailingSep,
- PS_AtEnd = path::iterator::_AtEnd
+ PS_AtEnd = path::iterator::_AtEnd
};
const string_view_t Path;
@@ -55,8 +53,7 @@ struct PathParser {
ParserState State;
private:
- PathParser(string_view_t P, ParserState State) noexcept : Path(P),
- State(State) {}
+ PathParser(string_view_t P, ParserState State) noexcept : Path(P), State(State) {}
public:
PathParser(string_view_t P, string_view_t E, unsigned char S)
@@ -77,12 +74,12 @@ public:
PosPtr peek() const noexcept {
auto TkEnd = getNextTokenStartPos();
- auto End = getAfterBack();
+ auto End = getAfterBack();
return TkEnd == End ? nullptr : TkEnd;
}
void increment() noexcept {
- const PosPtr End = getAfterBack();
+ const PosPtr End = getAfterBack();
const PosPtr Start = getNextTokenStartPos();
if (Start == End)
return makeState(PS_AtEnd);
@@ -123,7 +120,7 @@ public:
}
void decrement() noexcept {
- const PosPtr REnd = getBeforeFront();
+ const PosPtr REnd = getBeforeFront();
const PosPtr RStart = getCurrentTokenStartPos() - 1;
if (RStart == REnd) // we're decrementing the begin
return makeState(PS_BeforeBegin);
@@ -147,8 +144,7 @@ public:
}
}
case PS_InTrailingSep:
- return makeState(PS_InFilenames, consumeName(RStart, REnd) + 1,
- RStart + 1);
+ return makeState(PS_InFilenames, consumeName(RStart, REnd) + 1, RStart + 1);
case PS_InFilenames: {
PosPtr SepEnd = consumeAllSeparators(RStart, REnd);
if (SepEnd == REnd)
@@ -191,9 +187,7 @@ public:
__libcpp_unreachable();
}
- explicit operator bool() const noexcept {
- return State != PS_BeforeBegin && State != PS_AtEnd;
- }
+ explicit operator bool() const noexcept { return State != PS_BeforeBegin && State != PS_AtEnd; }
PathParser& operator++() noexcept {
increment();
@@ -205,29 +199,21 @@ public:
return *this;
}
- bool atEnd() const noexcept {
- return State == PS_AtEnd;
- }
+ bool atEnd() const noexcept { return State == PS_AtEnd; }
- bool inRootDir() const noexcept {
- return State == PS_InRootDir;
- }
+ bool inRootDir() const noexcept { return State == PS_InRootDir; }
- bool inRootName() const noexcept {
- return State == PS_InRootName;
- }
+ bool inRootName() const noexcept { return State == PS_InRootName; }
- bool inRootPath() const noexcept {
- return inRootName() || inRootDir();
- }
+ bool inRootPath() const noexcept { return inRootName() || inRootDir(); }
private:
void makeState(ParserState NewState, PosPtr Start, PosPtr End) noexcept {
- State = NewState;
+ State = NewState;
RawEntry = string_view_t(Start, End - Start);
}
void makeState(ParserState NewState) noexcept {
- State = NewState;
+ State = NewState;
RawEntry = {};
}
@@ -357,9 +343,7 @@ inline string_view_pair separate_filename(string_view_t const& s) {
return string_view_pair{s.substr(0, pos), s.substr(pos)};
}
-inline string_view_t createView(PosPtr S, PosPtr E) noexcept {
- return {S, static_cast<size_t>(E - S) + 1};
-}
+inline string_view_t createView(PosPtr S, PosPtr E) noexcept { return {S, static_cast<size_t>(E - S) + 1}; }
} // namespace parser
diff --git a/contrib/llvm-project/libcxx/src/filesystem/posix_compat.h b/contrib/llvm-project/libcxx/src/filesystem/posix_compat.h
index fb213d9ec185..ec2de49960be 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/posix_compat.h
+++ b/contrib/llvm-project/libcxx/src/filesystem/posix_compat.h
@@ -31,17 +31,17 @@
#include "time_utils.h"
#if defined(_LIBCPP_WIN32API)
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <windows.h>
-# include <io.h>
-# include <winioctl.h>
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <io.h>
+# include <windows.h>
+# include <winioctl.h>
#else
-# include <fcntl.h>
-# include <unistd.h>
-# include <sys/stat.h>
-# include <sys/statvfs.h>
-# include <sys/time.h>
+# include <fcntl.h>
+# include <sys/stat.h>
+# include <sys/statvfs.h>
+# include <sys/time.h>
+# include <unistd.h>
#endif
#include <stdlib.h>
#include <time.h>
@@ -50,7 +50,7 @@
// This struct isn't defined in the normal Windows SDK, but only in the
// Windows Driver Kit.
struct LIBCPP_REPARSE_DATA_BUFFER {
- unsigned long ReparseTag;
+ unsigned long ReparseTag;
unsigned short ReparseDataLength;
unsigned short Reserved;
union {
@@ -59,15 +59,15 @@ struct LIBCPP_REPARSE_DATA_BUFFER {
unsigned short SubstituteNameLength;
unsigned short PrintNameOffset;
unsigned short PrintNameLength;
- unsigned long Flags;
- wchar_t PathBuffer[1];
+ unsigned long Flags;
+ wchar_t PathBuffer[1];
} SymbolicLinkReparseBuffer;
struct {
unsigned short SubstituteNameOffset;
unsigned short SubstituteNameLength;
unsigned short PrintNameOffset;
unsigned short PrintNameLength;
- wchar_t PathBuffer[1];
+ wchar_t PathBuffer[1];
} MountPointReparseBuffer;
struct {
unsigned char DataBuffer[1];
@@ -86,41 +86,41 @@ namespace detail {
// provide our own implementation, undef all potential defines from the
// C runtime headers and provide a complete set of macros of our own.
-#undef _S_IFMT
-#undef _S_IFDIR
-#undef _S_IFCHR
-#undef _S_IFIFO
-#undef _S_IFREG
-#undef _S_IFBLK
-#undef _S_IFLNK
-#undef _S_IFSOCK
-
-#define _S_IFMT 0xF000
-#define _S_IFDIR 0x4000
-#define _S_IFCHR 0x2000
-#define _S_IFIFO 0x1000
-#define _S_IFREG 0x8000
-#define _S_IFBLK 0x6000
-#define _S_IFLNK 0xA000
-#define _S_IFSOCK 0xC000
-
-#undef S_ISDIR
-#undef S_ISFIFO
-#undef S_ISCHR
-#undef S_ISREG
-#undef S_ISLNK
-#undef S_ISBLK
-#undef S_ISSOCK
-
-#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
-#define S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
-#define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
-#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
-#define S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK)
-#define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
-#define S_ISSOCK(m) (((m) & _S_IFMT) == _S_IFSOCK)
-
-#define O_NONBLOCK 0
+# undef _S_IFMT
+# undef _S_IFDIR
+# undef _S_IFCHR
+# undef _S_IFIFO
+# undef _S_IFREG
+# undef _S_IFBLK
+# undef _S_IFLNK
+# undef _S_IFSOCK
+
+# define _S_IFMT 0xF000
+# define _S_IFDIR 0x4000
+# define _S_IFCHR 0x2000
+# define _S_IFIFO 0x1000
+# define _S_IFREG 0x8000
+# define _S_IFBLK 0x6000
+# define _S_IFLNK 0xA000
+# define _S_IFSOCK 0xC000
+
+# undef S_ISDIR
+# undef S_ISFIFO
+# undef S_ISCHR
+# undef S_ISREG
+# undef S_ISLNK
+# undef S_ISBLK
+# undef S_ISSOCK
+
+# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
+# define S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
+# define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
+# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
+# define S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK)
+# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
+# define S_ISSOCK(m) (((m) & _S_IFMT) == _S_IFSOCK)
+
+# define O_NONBLOCK 0
inline int set_errno(int e = GetLastError()) {
errno = static_cast<int>(__win_err_to_errc(e));
@@ -129,10 +129,15 @@ inline int set_errno(int e = GetLastError()) {
class WinHandle {
public:
- WinHandle(const wchar_t *p, DWORD access, DWORD flags) {
+ WinHandle(const wchar_t* p, DWORD access, DWORD flags) {
h = CreateFileW(
- p, access, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | flags, nullptr);
+ p,
+ access,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ nullptr,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | flags,
+ nullptr);
}
~WinHandle() {
if (h != INVALID_HANDLE_VALUE)
@@ -145,7 +150,7 @@ private:
HANDLE h;
};
-inline int stat_handle(HANDLE h, StatT *buf) {
+inline int stat_handle(HANDLE h, StatT* buf) {
FILE_BASIC_INFO basic;
if (!GetFileInformationByHandleEx(h, FileBasicInfo, &basic, sizeof(basic)))
return set_errno();
@@ -162,18 +167,16 @@ inline int stat_handle(HANDLE h, StatT *buf) {
}
if (basic.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
FILE_ATTRIBUTE_TAG_INFO tag;
- if (!GetFileInformationByHandleEx(h, FileAttributeTagInfo, &tag,
- sizeof(tag)))
+ if (!GetFileInformationByHandleEx(h, FileAttributeTagInfo, &tag, sizeof(tag)))
return set_errno();
if (tag.ReparseTag == IO_REPARSE_TAG_SYMLINK)
buf->st_mode = (buf->st_mode & ~_S_IFMT) | _S_IFLNK;
}
FILE_STANDARD_INFO standard;
- if (!GetFileInformationByHandleEx(h, FileStandardInfo, &standard,
- sizeof(standard)))
+ if (!GetFileInformationByHandleEx(h, FileStandardInfo, &standard, sizeof(standard)))
return set_errno();
buf->st_nlink = standard.NumberOfLinks;
- buf->st_size = standard.EndOfFile.QuadPart;
+ buf->st_size = standard.EndOfFile.QuadPart;
BY_HANDLE_FILE_INFORMATION info;
if (!GetFileInformationByHandle(h, &info))
return set_errno();
@@ -183,7 +186,7 @@ inline int stat_handle(HANDLE h, StatT *buf) {
return 0;
}
-inline int stat_file(const wchar_t *path, StatT *buf, DWORD flags) {
+inline int stat_file(const wchar_t* path, StatT* buf, DWORD flags) {
WinHandle h(path, FILE_READ_ATTRIBUTES, flags);
if (!h)
return set_errno();
@@ -191,32 +194,28 @@ inline int stat_file(const wchar_t *path, StatT *buf, DWORD flags) {
return ret;
}
-inline int stat(const wchar_t *path, StatT *buf) { return stat_file(path, buf, 0); }
+inline int stat(const wchar_t* path, StatT* buf) { return stat_file(path, buf, 0); }
-inline int lstat(const wchar_t *path, StatT *buf) {
- return stat_file(path, buf, FILE_FLAG_OPEN_REPARSE_POINT);
-}
+inline int lstat(const wchar_t* path, StatT* buf) { return stat_file(path, buf, FILE_FLAG_OPEN_REPARSE_POINT); }
-inline int fstat(int fd, StatT *buf) {
+inline int fstat(int fd, StatT* buf) {
HANDLE h = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
return stat_handle(h, buf);
}
-inline int mkdir(const wchar_t *path, int permissions) {
+inline int mkdir(const wchar_t* path, int permissions) {
(void)permissions;
if (!CreateDirectoryW(path, nullptr))
return set_errno();
return 0;
}
-inline int symlink_file_dir(const wchar_t *oldname, const wchar_t *newname,
- bool is_dir) {
+inline int symlink_file_dir(const wchar_t* oldname, const wchar_t* newname, bool is_dir) {
path dest(oldname);
dest.make_preferred();
- oldname = dest.c_str();
+ oldname = dest.c_str();
DWORD flags = is_dir ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0;
- if (CreateSymbolicLinkW(newname, oldname,
- flags | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE))
+ if (CreateSymbolicLinkW(newname, oldname, flags | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE))
return 0;
int e = GetLastError();
if (e != ERROR_INVALID_PARAMETER)
@@ -226,21 +225,21 @@ inline int symlink_file_dir(const wchar_t *oldname, const wchar_t *newname,
return set_errno();
}
-inline int symlink_file(const wchar_t *oldname, const wchar_t *newname) {
+inline int symlink_file(const wchar_t* oldname, const wchar_t* newname) {
return symlink_file_dir(oldname, newname, false);
}
-inline int symlink_dir(const wchar_t *oldname, const wchar_t *newname) {
+inline int symlink_dir(const wchar_t* oldname, const wchar_t* newname) {
return symlink_file_dir(oldname, newname, true);
}
-inline int link(const wchar_t *oldname, const wchar_t *newname) {
+inline int link(const wchar_t* oldname, const wchar_t* newname) {
if (CreateHardLinkW(newname, oldname, nullptr))
return 0;
return set_errno();
}
-inline int remove(const wchar_t *path) {
+inline int remove(const wchar_t* path) {
detail::WinHandle h(path, DELETE, FILE_FLAG_OPEN_REPARSE_POINT);
if (!h)
return set_errno();
@@ -266,17 +265,15 @@ inline int ftruncate(int fd, off_t length) {
return truncate_handle(h, length);
}
-inline int truncate(const wchar_t *path, off_t length) {
+inline int truncate(const wchar_t* path, off_t length) {
detail::WinHandle h(path, GENERIC_WRITE, 0);
if (!h)
return set_errno();
return truncate_handle(h, length);
}
-inline int rename(const wchar_t *from, const wchar_t *to) {
- if (!(MoveFileExW(from, to,
- MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING |
- MOVEFILE_WRITE_THROUGH)))
+inline int rename(const wchar_t* from, const wchar_t* to) {
+ if (!(MoveFileExW(from, to, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)))
return set_errno();
return 0;
}
@@ -294,7 +291,7 @@ struct StatVFS {
uint64_t f_bavail;
};
-inline int statvfs(const wchar_t *p, StatVFS *buf) {
+inline int statvfs(const wchar_t* p, StatVFS* buf) {
path dir = p;
while (true) {
error_code local_ec;
@@ -308,14 +305,13 @@ inline int statvfs(const wchar_t *p, StatVFS *buf) {
}
dir = parent;
}
- ULARGE_INTEGER free_bytes_available_to_caller, total_number_of_bytes,
- total_number_of_free_bytes;
- if (!GetDiskFreeSpaceExW(dir.c_str(), &free_bytes_available_to_caller,
- &total_number_of_bytes, &total_number_of_free_bytes))
+ ULARGE_INTEGER free_bytes_available_to_caller, total_number_of_bytes, total_number_of_free_bytes;
+ if (!GetDiskFreeSpaceExW(
+ dir.c_str(), &free_bytes_available_to_caller, &total_number_of_bytes, &total_number_of_free_bytes))
return set_errno();
buf->f_frsize = 1;
buf->f_blocks = total_number_of_bytes.QuadPart;
- buf->f_bfree = total_number_of_free_bytes.QuadPart;
+ buf->f_bfree = total_number_of_free_bytes.QuadPart;
buf->f_bavail = free_bytes_available_to_caller.QuadPart;
return 0;
}
@@ -340,10 +336,9 @@ inline wchar_t* getcwd([[maybe_unused]] wchar_t* in_buf, [[maybe_unused]] size_t
return buff.release();
}
-inline wchar_t *realpath(const wchar_t *path, [[maybe_unused]] wchar_t *resolved_name) {
+inline wchar_t* realpath(const wchar_t* path, [[maybe_unused]] wchar_t* resolved_name) {
// Only expected to be used with us allocating the buffer.
- _LIBCPP_ASSERT_UNCATEGORIZED(resolved_name == nullptr,
- "Windows realpath() assumes a null resolved_name");
+ _LIBCPP_ASSERT_UNCATEGORIZED(resolved_name == nullptr, "Windows realpath() assumes a null resolved_name");
WinHandle h(path, FILE_READ_ATTRIBUTES, 0);
if (!h) {
@@ -351,21 +346,18 @@ inline wchar_t *realpath(const wchar_t *path, [[maybe_unused]] wchar_t *resolved
return nullptr;
}
size_t buff_size = MAX_PATH + 10;
- std::unique_ptr<wchar_t, decltype(&::free)> buff(
- static_cast<wchar_t *>(malloc(buff_size * sizeof(wchar_t))), &::free);
- DWORD retval = GetFinalPathNameByHandleW(
- h, buff.get(), buff_size, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
+ std::unique_ptr<wchar_t, decltype(&::free)> buff(static_cast<wchar_t*>(malloc(buff_size * sizeof(wchar_t))), &::free);
+ DWORD retval = GetFinalPathNameByHandleW(h, buff.get(), buff_size, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
if (retval > buff_size) {
buff_size = retval;
- buff.reset(static_cast<wchar_t *>(malloc(buff_size * sizeof(wchar_t))));
- retval = GetFinalPathNameByHandleW(h, buff.get(), buff_size,
- FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
+ buff.reset(static_cast<wchar_t*>(malloc(buff_size * sizeof(wchar_t))));
+ retval = GetFinalPathNameByHandleW(h, buff.get(), buff_size, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
}
if (!retval) {
set_errno();
return nullptr;
}
- wchar_t *ptr = buff.get();
+ wchar_t* ptr = buff.get();
if (!wcsncmp(ptr, L"\\\\?\\", 4)) {
if (ptr[5] == ':') { // \\?\X: -> X:
memmove(&ptr[0], &ptr[4], (wcslen(&ptr[4]) + 1) * sizeof(wchar_t));
@@ -377,8 +369,8 @@ inline wchar_t *realpath(const wchar_t *path, [[maybe_unused]] wchar_t *resolved
return buff.release();
}
-#define AT_FDCWD -1
-#define AT_SYMLINK_NOFOLLOW 1
+# define AT_FDCWD -1
+# define AT_SYMLINK_NOFOLLOW 1
using ModeT = int;
inline int fchmod_handle(HANDLE h, int perms) {
@@ -389,18 +381,16 @@ inline int fchmod_handle(HANDLE h, int perms) {
basic.FileAttributes &= ~FILE_ATTRIBUTE_READONLY;
if ((perms & 0222) == 0)
basic.FileAttributes |= FILE_ATTRIBUTE_READONLY;
- if (basic.FileAttributes != orig_attributes &&
- !SetFileInformationByHandle(h, FileBasicInfo, &basic, sizeof(basic)))
+ if (basic.FileAttributes != orig_attributes && !SetFileInformationByHandle(h, FileBasicInfo, &basic, sizeof(basic)))
return set_errno();
return 0;
}
-inline int fchmodat(int /*fd*/, const wchar_t *path, int perms, int flag) {
+inline int fchmodat(int /*fd*/, const wchar_t* path, int perms, int flag) {
DWORD attributes = GetFileAttributesW(path);
if (attributes == INVALID_FILE_ATTRIBUTES)
return set_errno();
- if (attributes & FILE_ATTRIBUTE_REPARSE_POINT &&
- !(flag & AT_SYMLINK_NOFOLLOW)) {
+ if (attributes & FILE_ATTRIBUTE_REPARSE_POINT && !(flag & AT_SYMLINK_NOFOLLOW)) {
// If the file is a symlink, and we are supposed to operate on the target
// of the symlink, we need to open a handle to it, without the
// FILE_FLAG_OPEN_REPARSE_POINT flag, to open the destination of the
@@ -427,21 +417,19 @@ inline int fchmod(int fd, int perms) {
return fchmod_handle(h, perms);
}
-#define MAX_SYMLINK_SIZE MAXIMUM_REPARSE_DATA_BUFFER_SIZE
+# define MAX_SYMLINK_SIZE MAXIMUM_REPARSE_DATA_BUFFER_SIZE
using SSizeT = ::int64_t;
-inline SSizeT readlink(const wchar_t *path, wchar_t *ret_buf, size_t bufsize) {
+inline SSizeT readlink(const wchar_t* path, wchar_t* ret_buf, size_t bufsize) {
uint8_t buf[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
detail::WinHandle h(path, FILE_READ_ATTRIBUTES, FILE_FLAG_OPEN_REPARSE_POINT);
if (!h)
return set_errno();
DWORD out;
- if (!DeviceIoControl(h, FSCTL_GET_REPARSE_POINT, nullptr, 0, buf, sizeof(buf),
- &out, 0))
+ if (!DeviceIoControl(h, FSCTL_GET_REPARSE_POINT, nullptr, 0, buf, sizeof(buf), &out, 0))
return set_errno();
- const auto *reparse = reinterpret_cast<LIBCPP_REPARSE_DATA_BUFFER *>(buf);
- size_t path_buf_offset = offsetof(LIBCPP_REPARSE_DATA_BUFFER,
- SymbolicLinkReparseBuffer.PathBuffer[0]);
+ const auto* reparse = reinterpret_cast<LIBCPP_REPARSE_DATA_BUFFER*>(buf);
+ size_t path_buf_offset = offsetof(LIBCPP_REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer.PathBuffer[0]);
if (out < path_buf_offset) {
errno = EINVAL;
return -1;
@@ -450,7 +438,7 @@ inline SSizeT readlink(const wchar_t *path, wchar_t *ret_buf, size_t bufsize) {
errno = EINVAL;
return -1;
}
- const auto &symlink = reparse->SymbolicLinkReparseBuffer;
+ const auto& symlink = reparse->SymbolicLinkReparseBuffer;
unsigned short name_offset, name_length;
if (symlink.PrintNameLength == 0) {
name_offset = symlink.SubstituteNameOffset;
@@ -468,23 +456,18 @@ inline SSizeT readlink(const wchar_t *path, wchar_t *ret_buf, size_t bufsize) {
errno = ENOMEM;
return -1;
}
- memcpy(ret_buf, &symlink.PathBuffer[name_offset / sizeof(wchar_t)],
- name_length);
+ memcpy(ret_buf, &symlink.PathBuffer[name_offset / sizeof(wchar_t)], name_length);
return name_length / sizeof(wchar_t);
}
#else
-inline int symlink_file(const char *oldname, const char *newname) {
- return ::symlink(oldname, newname);
-}
-inline int symlink_dir(const char *oldname, const char *newname) {
- return ::symlink(oldname, newname);
-}
+inline int symlink_file(const char* oldname, const char* newname) { return ::symlink(oldname, newname); }
+inline int symlink_dir(const char* oldname, const char* newname) { return ::symlink(oldname, newname); }
using ::chdir;
using ::fchmod;
-#if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_FDCWD)
+# if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_FDCWD)
using ::fchmodat;
-#endif
+# endif
using ::fstat;
using ::ftruncate;
using ::getcwd;
@@ -499,11 +482,11 @@ using ::stat;
using ::statvfs;
using ::truncate;
-#define O_BINARY 0
+# define O_BINARY 0
using StatVFS = struct statvfs;
-using ModeT = ::mode_t;
-using SSizeT = ::ssize_t;
+using ModeT = ::mode_t;
+using SSizeT = ::ssize_t;
#endif
diff --git a/contrib/llvm-project/libcxx/src/filesystem/time_utils.h b/contrib/llvm-project/libcxx/src/filesystem/time_utils.h
index eb4176936853..e05f252868f0 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/time_utils.h
+++ b/contrib/llvm-project/libcxx/src/filesystem/time_utils.h
@@ -23,18 +23,18 @@
#include "format_string.h"
#if defined(_LIBCPP_WIN32API)
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
+# include <windows.h>
#else
-# include <fcntl.h>
-# include <sys/stat.h>
-# include <sys/time.h> // for ::utimes as used in __last_write_time
+# include <fcntl.h>
+# include <sys/stat.h>
+# include <sys/time.h> // for ::utimes as used in __last_write_time
#endif
// We can use the presence of UTIME_OMIT to detect platforms that provide utimensat.
#if defined(UTIME_OMIT)
-# define _LIBCPP_USE_UTIMENSAT
+# define _LIBCPP_USE_UTIMENSAT
#endif
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
@@ -59,7 +59,7 @@ struct StatT {
uint64_t st_dev; // FILE_ID_INFO::VolumeSerialNumber
struct FileIdStruct {
unsigned char id[16]; // FILE_ID_INFO::FileId
- bool operator==(const FileIdStruct &other) const {
+ bool operator==(const FileIdStruct& other) const {
for (int i = 0; i < 16; i++)
if (id[i] != other.id[i])
return false;
@@ -72,46 +72,45 @@ struct StatT {
// There were 369 years and 89 leap days from the Windows epoch
// (1601) to the Unix epoch (1970).
-#define FILE_TIME_OFFSET_SECS (uint64_t(369 * 365 + 89) * (24 * 60 * 60))
+# define FILE_TIME_OFFSET_SECS (uint64_t(369 * 365 + 89) * (24 * 60 * 60))
inline TimeSpec filetime_to_timespec(LARGE_INTEGER li) {
TimeSpec ret;
- ret.tv_sec = li.QuadPart / 10000000 - FILE_TIME_OFFSET_SECS;
+ ret.tv_sec = li.QuadPart / 10000000 - FILE_TIME_OFFSET_SECS;
ret.tv_nsec = (li.QuadPart % 10000000) * 100;
return ret;
}
inline TimeSpec filetime_to_timespec(FILETIME ft) {
LARGE_INTEGER li;
- li.LowPart = ft.dwLowDateTime;
+ li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
return filetime_to_timespec(li);
}
inline FILETIME timespec_to_filetime(TimeSpec ts) {
LARGE_INTEGER li;
- li.QuadPart =
- ts.tv_nsec / 100 + (ts.tv_sec + FILE_TIME_OFFSET_SECS) * 10000000;
+ li.QuadPart = ts.tv_nsec / 100 + (ts.tv_sec + FILE_TIME_OFFSET_SECS) * 10000000;
FILETIME ft;
- ft.dwLowDateTime = li.LowPart;
+ ft.dwLowDateTime = li.LowPart;
ft.dwHighDateTime = li.HighPart;
return ft;
}
#else
using TimeSpec = struct timespec;
-using TimeVal = struct timeval;
-using StatT = struct stat;
+using TimeVal = struct timeval;
+using StatT = struct stat;
inline TimeVal make_timeval(TimeSpec const& ts) {
using namespace chrono;
auto Convert = [](long nsec) {
using int_type = decltype(std::declval<TimeVal>().tv_usec);
- auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
+ auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
return static_cast<int_type>(dur);
};
TimeVal TV = {};
- TV.tv_sec = ts.tv_sec;
+ TV.tv_sec = ts.tv_sec;
TV.tv_usec = Convert(ts.tv_nsec);
return TV;
}
@@ -120,42 +119,30 @@ inline TimeVal make_timeval(TimeSpec const& ts) {
using chrono::duration;
using chrono::duration_cast;
-template <class FileTimeT, class TimeT,
- bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>
+template <class FileTimeT, class TimeT, bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>
struct time_util_base {
- using rep = typename FileTimeT::rep;
- using fs_duration = typename FileTimeT::duration;
- using fs_seconds = duration<rep>;
- using fs_nanoseconds = duration<rep, nano>;
+ using rep = typename FileTimeT::rep;
+ using fs_duration = typename FileTimeT::duration;
+ using fs_seconds = duration<rep>;
+ using fs_nanoseconds = duration<rep, nano>;
using fs_microseconds = duration<rep, micro>;
- static constexpr rep max_seconds =
- duration_cast<fs_seconds>(FileTimeT::duration::max()).count();
+ static constexpr rep max_seconds = duration_cast<fs_seconds>(FileTimeT::duration::max()).count();
static constexpr rep max_nsec =
- duration_cast<fs_nanoseconds>(FileTimeT::duration::max() -
- fs_seconds(max_seconds))
- .count();
+ duration_cast<fs_nanoseconds>(FileTimeT::duration::max() - fs_seconds(max_seconds)).count();
- static constexpr rep min_seconds =
- duration_cast<fs_seconds>(FileTimeT::duration::min()).count();
+ static constexpr rep min_seconds = duration_cast<fs_seconds>(FileTimeT::duration::min()).count();
static constexpr rep min_nsec_timespec =
- duration_cast<fs_nanoseconds>(
- (FileTimeT::duration::min() - fs_seconds(min_seconds)) +
- fs_seconds(1))
- .count();
+ duration_cast<fs_nanoseconds>((FileTimeT::duration::min() - fs_seconds(min_seconds)) + fs_seconds(1)).count();
private:
static constexpr fs_duration get_min_nsecs() {
- return duration_cast<fs_duration>(
- fs_nanoseconds(min_nsec_timespec) -
- duration_cast<fs_nanoseconds>(fs_seconds(1)));
+ return duration_cast<fs_duration>(fs_nanoseconds(min_nsec_timespec) - duration_cast<fs_nanoseconds>(fs_seconds(1)));
}
// Static assert that these values properly round trip.
- static_assert(fs_seconds(min_seconds) + get_min_nsecs() ==
- FileTimeT::duration::min(),
- "value doesn't roundtrip");
+ static_assert(fs_seconds(min_seconds) + get_min_nsecs() == FileTimeT::duration::min(), "value doesn't roundtrip");
static constexpr bool check_range() {
// This kinda sucks, but it's what happens when we don't have __int128_t.
@@ -164,8 +151,7 @@ private:
return duration_cast<Years>(fs_seconds(max_seconds)) > Years(250) &&
duration_cast<Years>(fs_seconds(min_seconds)) < Years(-250);
}
- return max_seconds >= numeric_limits<TimeT>::max() &&
- min_seconds <= numeric_limits<TimeT>::min();
+ return max_seconds >= numeric_limits<TimeT>::max() && min_seconds <= numeric_limits<TimeT>::min();
}
#if _LIBCPP_STD_VER >= 14
static_assert(check_range(), "the representable range is unacceptable small");
@@ -174,10 +160,10 @@ private:
template <class FileTimeT, class TimeT>
struct time_util_base<FileTimeT, TimeT, true> {
- using rep = typename FileTimeT::rep;
- using fs_duration = typename FileTimeT::duration;
- using fs_seconds = duration<rep>;
- using fs_nanoseconds = duration<rep, nano>;
+ using rep = typename FileTimeT::rep;
+ using fs_duration = typename FileTimeT::duration;
+ using fs_seconds = duration<rep>;
+ using fs_nanoseconds = duration<rep, nano>;
using fs_microseconds = duration<rep, micro>;
static const rep max_seconds;
@@ -187,28 +173,20 @@ struct time_util_base<FileTimeT, TimeT, true> {
};
template <class FileTimeT, class TimeT>
-const typename FileTimeT::rep
- time_util_base<FileTimeT, TimeT, true>::max_seconds =
- duration_cast<fs_seconds>(FileTimeT::duration::max()).count();
+const typename FileTimeT::rep time_util_base<FileTimeT, TimeT, true>::max_seconds =
+ duration_cast<fs_seconds>(FileTimeT::duration::max()).count();
template <class FileTimeT, class TimeT>
const typename FileTimeT::rep time_util_base<FileTimeT, TimeT, true>::max_nsec =
- duration_cast<fs_nanoseconds>(FileTimeT::duration::max() -
- fs_seconds(max_seconds))
- .count();
+ duration_cast<fs_nanoseconds>(FileTimeT::duration::max() - fs_seconds(max_seconds)).count();
template <class FileTimeT, class TimeT>
-const typename FileTimeT::rep
- time_util_base<FileTimeT, TimeT, true>::min_seconds =
- duration_cast<fs_seconds>(FileTimeT::duration::min()).count();
+const typename FileTimeT::rep time_util_base<FileTimeT, TimeT, true>::min_seconds =
+ duration_cast<fs_seconds>(FileTimeT::duration::min()).count();
template <class FileTimeT, class TimeT>
-const typename FileTimeT::rep
- time_util_base<FileTimeT, TimeT, true>::min_nsec_timespec =
- duration_cast<fs_nanoseconds>((FileTimeT::duration::min() -
- fs_seconds(min_seconds)) +
- fs_seconds(1))
- .count();
+const typename FileTimeT::rep time_util_base<FileTimeT, TimeT, true>::min_nsec_timespec =
+ duration_cast<fs_nanoseconds>((FileTimeT::duration::min() - fs_seconds(min_seconds)) + fs_seconds(1)).count();
template <class FileTimeT, class TimeT, class TimeSpecT>
struct time_util : time_util_base<FileTimeT, TimeT> {
@@ -225,8 +203,7 @@ struct time_util : time_util_base<FileTimeT, TimeT> {
public:
template <class CType, class ChronoType>
- static constexpr bool checked_set(CType* out,
- ChronoType time) {
+ static constexpr bool checked_set(CType* out, ChronoType time) {
using Lim = numeric_limits<CType>;
if (time > Lim::max() || time < Lim::min())
return false;
@@ -236,8 +213,7 @@ public:
static constexpr bool is_representable(TimeSpecT tm) {
if (tm.tv_sec >= 0) {
- return tm.tv_sec < max_seconds ||
- (tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
+ return tm.tv_sec < max_seconds || (tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
} else if (tm.tv_sec == (min_seconds - 1)) {
return tm.tv_nsec >= min_nsec_timespec;
} else {
@@ -246,10 +222,10 @@ public:
}
static constexpr bool is_representable(FileTimeT tm) {
- auto secs = duration_cast<fs_seconds>(tm.time_since_epoch());
+ auto secs = duration_cast<fs_seconds>(tm.time_since_epoch());
auto nsecs = duration_cast<fs_nanoseconds>(tm.time_since_epoch() - secs);
if (nsecs.count() < 0) {
- secs = secs + fs_seconds(1);
+ secs = secs + fs_seconds(1);
nsecs = nsecs + fs_seconds(1);
}
using TLim = numeric_limits<TimeT>;
@@ -258,39 +234,33 @@ public:
return secs.count() >= TLim::min();
}
- static constexpr FileTimeT
- convert_from_timespec(TimeSpecT tm) {
+ static constexpr FileTimeT convert_from_timespec(TimeSpecT tm) {
if (tm.tv_sec >= 0 || tm.tv_nsec == 0) {
- return FileTimeT(fs_seconds(tm.tv_sec) +
- duration_cast<fs_duration>(fs_nanoseconds(tm.tv_nsec)));
+ return FileTimeT(fs_seconds(tm.tv_sec) + duration_cast<fs_duration>(fs_nanoseconds(tm.tv_nsec)));
} else { // tm.tv_sec < 0
- auto adj_subsec = duration_cast<fs_duration>(fs_seconds(1) -
- fs_nanoseconds(tm.tv_nsec));
- auto Dur = fs_seconds(tm.tv_sec + 1) - adj_subsec;
+ auto adj_subsec = duration_cast<fs_duration>(fs_seconds(1) - fs_nanoseconds(tm.tv_nsec));
+ auto Dur = fs_seconds(tm.tv_sec + 1) - adj_subsec;
return FileTimeT(Dur);
}
}
template <class SubSecT>
- static constexpr bool
- set_times_checked(TimeT* sec_out, SubSecT* subsec_out, FileTimeT tp) {
- auto dur = tp.time_since_epoch();
- auto sec_dur = duration_cast<fs_seconds>(dur);
+ static constexpr bool set_times_checked(TimeT* sec_out, SubSecT* subsec_out, FileTimeT tp) {
+ auto dur = tp.time_since_epoch();
+ auto sec_dur = duration_cast<fs_seconds>(dur);
auto subsec_dur = duration_cast<fs_nanoseconds>(dur - sec_dur);
// The tv_nsec and tv_usec fields must not be negative so adjust accordingly
if (subsec_dur.count() < 0) {
if (sec_dur.count() > min_seconds) {
- sec_dur = sec_dur - fs_seconds(1);
+ sec_dur = sec_dur - fs_seconds(1);
subsec_dur = subsec_dur + fs_seconds(1);
} else {
subsec_dur = fs_nanoseconds::zero();
}
}
- return checked_set(sec_out, sec_dur.count()) &&
- checked_set(subsec_out, subsec_dur.count());
+ return checked_set(sec_out, sec_dur.count()) && checked_set(subsec_out, subsec_dur.count());
}
- static constexpr bool convert_to_timespec(TimeSpecT& dest,
- FileTimeT tp) {
+ static constexpr bool convert_to_timespec(TimeSpecT& dest, FileTimeT tp) {
if (!is_representable(tp))
return false;
return set_times_checked(&dest.tv_sec, &dest.tv_nsec, tp);
@@ -331,9 +301,8 @@ inline TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
#ifndef _LIBCPP_HAS_NO_FILESYSTEM
-#if !defined(_LIBCPP_WIN32API)
-inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
- error_code& ec) {
+# if !defined(_LIBCPP_WIN32API)
+inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS, error_code& ec) {
TimeVal ConvertedTS[2] = {make_timeval(TS[0]), make_timeval(TS[1])};
if (::utimes(p.c_str(), ConvertedTS) == -1) {
ec = capture_errno();
@@ -342,30 +311,27 @@ inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
return false;
}
-#if defined(_LIBCPP_USE_UTIMENSAT)
-inline bool posix_utimensat(const path& p, std::array<TimeSpec, 2> const& TS,
- error_code& ec) {
+# if defined(_LIBCPP_USE_UTIMENSAT)
+inline bool posix_utimensat(const path& p, std::array<TimeSpec, 2> const& TS, error_code& ec) {
if (::utimensat(AT_FDCWD, p.c_str(), TS.data(), 0) == -1) {
ec = capture_errno();
return true;
}
return false;
}
-#endif
+# endif
-inline bool set_file_times(const path& p, std::array<TimeSpec, 2> const& TS,
- error_code& ec) {
-#if !defined(_LIBCPP_USE_UTIMENSAT)
+inline bool set_file_times(const path& p, std::array<TimeSpec, 2> const& TS, error_code& ec) {
+# if !defined(_LIBCPP_USE_UTIMENSAT)
return posix_utimes(p, TS, ec);
-#else
+# else
return posix_utimensat(p, TS, ec);
-#endif
+# endif
}
-#endif // !_LIBCPP_WIN32API
+# endif // !_LIBCPP_WIN32API
-inline file_time_type __extract_last_write_time(const path& p, const StatT& st,
- error_code* ec) {
+inline file_time_type __extract_last_write_time(const path& p, const StatT& st, error_code* ec) {
using detail::fs_time;
ErrorHandler<file_time_type> err("last_write_time", ec, &p);
diff --git a/contrib/llvm-project/libcxx/src/functional.cpp b/contrib/llvm-project/libcxx/src/functional.cpp
index ca1079cdd88d..570bb78e150b 100644
--- a/contrib/llvm-project/libcxx/src/functional.cpp
+++ b/contrib/llvm-project/libcxx/src/functional.cpp
@@ -11,17 +11,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
-bad_function_call::~bad_function_call() noexcept
-{
-}
+bad_function_call::~bad_function_call() noexcept {}
#endif
#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
-const char*
-bad_function_call::what() const noexcept
-{
- return "std::bad_function_call";
-}
+const char* bad_function_call::what() const noexcept { return "std::bad_function_call"; }
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/future.cpp b/contrib/llvm-project/libcxx/src/future.cpp
index 0e3f7b12b859..e2c14c8321dd 100644
--- a/contrib/llvm-project/libcxx/src/future.cpp
+++ b/contrib/llvm-project/libcxx/src/future.cpp
@@ -11,256 +11,187 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_HIDDEN __future_error_category
- : public __do_message
-{
+class _LIBCPP_HIDDEN __future_error_category : public __do_message {
public:
- virtual const char* name() const noexcept;
- virtual string message(int ev) const;
+ virtual const char* name() const noexcept;
+ virtual string message(int ev) const;
};
-const char*
-__future_error_category::name() const noexcept
-{
- return "future";
-}
+const char* __future_error_category::name() const noexcept { return "future"; }
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wswitch")
_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wswitch")
-string
-__future_error_category::message(int ev) const
-{
- switch (static_cast<future_errc>(ev))
- {
- case future_errc(0): // For backwards compatibility with C++11 (LWG 2056)
- case future_errc::broken_promise:
- return string("The associated promise has been destructed prior "
- "to the associated state becoming ready.");
- case future_errc::future_already_retrieved:
- return string("The future has already been retrieved from "
- "the promise or packaged_task.");
- case future_errc::promise_already_satisfied:
- return string("The state of the promise has already been set.");
- case future_errc::no_state:
- return string("Operation not permitted on an object without "
- "an associated state.");
- }
- return string("unspecified future_errc value\n");
+string __future_error_category::message(int ev) const {
+ switch (static_cast<future_errc>(ev)) {
+ case future_errc(0): // For backwards compatibility with C++11 (LWG 2056)
+ case future_errc::broken_promise:
+ return string("The associated promise has been destructed prior "
+ "to the associated state becoming ready.");
+ case future_errc::future_already_retrieved:
+ return string("The future has already been retrieved from "
+ "the promise or packaged_task.");
+ case future_errc::promise_already_satisfied:
+ return string("The state of the promise has already been set.");
+ case future_errc::no_state:
+ return string("Operation not permitted on an object without "
+ "an associated state.");
+ }
+ return string("unspecified future_errc value\n");
}
_LIBCPP_DIAGNOSTIC_POP
-const error_category&
-future_category() noexcept
-{
- union AvoidDestroyingFutureCategory {
- __future_error_category future_error_category;
- constexpr explicit AvoidDestroyingFutureCategory() : future_error_category() {}
- ~AvoidDestroyingFutureCategory() {}
- };
- constinit static AvoidDestroyingFutureCategory helper;
- return helper.future_error_category;
+const error_category& future_category() noexcept {
+ union AvoidDestroyingFutureCategory {
+ __future_error_category future_error_category;
+ constexpr explicit AvoidDestroyingFutureCategory() : future_error_category() {}
+ ~AvoidDestroyingFutureCategory() {}
+ };
+ constinit static AvoidDestroyingFutureCategory helper;
+ return helper.future_error_category;
}
-future_error::future_error(error_code __ec)
- : logic_error(__ec.message()),
- __ec_(__ec)
-{
-}
+future_error::future_error(error_code __ec) : logic_error(__ec.message()), __ec_(__ec) {}
-future_error::~future_error() noexcept
-{
-}
+future_error::~future_error() noexcept {}
-void
-__assoc_sub_state::__on_zero_shared() noexcept
-{
- delete this;
-}
+void __assoc_sub_state::__on_zero_shared() noexcept { delete this; }
-void
-__assoc_sub_state::set_value()
-{
- unique_lock<mutex> __lk(__mut_);
- if (__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __state_ |= __constructed | ready;
- __cv_.notify_all();
+void __assoc_sub_state::set_value() {
+ unique_lock<mutex> __lk(__mut_);
+ if (__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __state_ |= __constructed | ready;
+ __cv_.notify_all();
}
-void
-__assoc_sub_state::set_value_at_thread_exit()
-{
- unique_lock<mutex> __lk(__mut_);
- if (__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __state_ |= __constructed;
- __thread_local_data()->__make_ready_at_thread_exit(this);
+void __assoc_sub_state::set_value_at_thread_exit() {
+ unique_lock<mutex> __lk(__mut_);
+ if (__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __state_ |= __constructed;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
}
-void
-__assoc_sub_state::set_exception(exception_ptr __p)
-{
- unique_lock<mutex> __lk(__mut_);
- if (__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __exception_ = __p;
- __state_ |= ready;
- __cv_.notify_all();
+void __assoc_sub_state::set_exception(exception_ptr __p) {
+ unique_lock<mutex> __lk(__mut_);
+ if (__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __exception_ = __p;
+ __state_ |= ready;
+ __cv_.notify_all();
}
-void
-__assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p)
-{
- unique_lock<mutex> __lk(__mut_);
- if (__has_value())
- __throw_future_error(future_errc::promise_already_satisfied);
- __exception_ = __p;
- __thread_local_data()->__make_ready_at_thread_exit(this);
+void __assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p) {
+ unique_lock<mutex> __lk(__mut_);
+ if (__has_value())
+ __throw_future_error(future_errc::promise_already_satisfied);
+ __exception_ = __p;
+ __thread_local_data()->__make_ready_at_thread_exit(this);
}
-void
-__assoc_sub_state::__make_ready()
-{
- unique_lock<mutex> __lk(__mut_);
- __state_ |= ready;
- __cv_.notify_all();
+void __assoc_sub_state::__make_ready() {
+ unique_lock<mutex> __lk(__mut_);
+ __state_ |= ready;
+ __cv_.notify_all();
}
-void
-__assoc_sub_state::copy()
-{
- unique_lock<mutex> __lk(__mut_);
- __sub_wait(__lk);
- if (__exception_ != nullptr)
- rethrow_exception(__exception_);
+void __assoc_sub_state::copy() {
+ unique_lock<mutex> __lk(__mut_);
+ __sub_wait(__lk);
+ if (__exception_ != nullptr)
+ rethrow_exception(__exception_);
}
-void
-__assoc_sub_state::wait()
-{
- unique_lock<mutex> __lk(__mut_);
- __sub_wait(__lk);
+void __assoc_sub_state::wait() {
+ unique_lock<mutex> __lk(__mut_);
+ __sub_wait(__lk);
}
-void
-__assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk)
-{
- if (!__is_ready())
- {
- if (__state_ & static_cast<unsigned>(deferred))
- {
- __state_ &= ~static_cast<unsigned>(deferred);
- __lk.unlock();
- __execute();
- }
- else
- while (!__is_ready())
- __cv_.wait(__lk);
- }
+void __assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk) {
+ if (!__is_ready()) {
+ if (__state_ & static_cast<unsigned>(deferred)) {
+ __state_ &= ~static_cast<unsigned>(deferred);
+ __lk.unlock();
+ __execute();
+ } else
+ while (!__is_ready())
+ __cv_.wait(__lk);
+ }
}
-void
-__assoc_sub_state::__execute()
-{
- __throw_future_error(future_errc::no_state);
-}
+void __assoc_sub_state::__execute() { __throw_future_error(future_errc::no_state); }
-future<void>::future(__assoc_sub_state* __state)
- : __state_(__state)
-{
- __state_->__attach_future();
-}
+future<void>::future(__assoc_sub_state* __state) : __state_(__state) { __state_->__attach_future(); }
-future<void>::~future()
-{
- if (__state_)
- __state_->__release_shared();
+future<void>::~future() {
+ if (__state_)
+ __state_->__release_shared();
}
-void
-future<void>::get()
-{
- unique_ptr<__shared_count, __release_shared_count> __(__state_);
- __assoc_sub_state* __s = __state_;
- __state_ = nullptr;
- __s->copy();
+void future<void>::get() {
+ unique_ptr<__shared_count, __release_shared_count> __(__state_);
+ __assoc_sub_state* __s = __state_;
+ __state_ = nullptr;
+ __s->copy();
}
-promise<void>::promise()
- : __state_(new __assoc_sub_state)
-{
-}
+promise<void>::promise() : __state_(new __assoc_sub_state) {}
-promise<void>::~promise()
-{
- if (__state_)
- {
+promise<void>::~promise() {
+ if (__state_) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- if (!__state_->__has_value() && __state_->use_count() > 1)
- __state_->set_exception(make_exception_ptr(future_error(future_errc::broken_promise)));
+ if (!__state_->__has_value() && __state_->use_count() > 1)
+ __state_->set_exception(make_exception_ptr(future_error(future_errc::broken_promise)));
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __state_->__release_shared();
- }
+ __state_->__release_shared();
+ }
}
-future<void>
-promise<void>::get_future()
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- return future<void>(__state_);
+future<void> promise<void>::get_future() {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ return future<void>(__state_);
}
-void
-promise<void>::set_value()
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value();
+void promise<void>::set_value() {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value();
}
-void
-promise<void>::set_exception(exception_ptr __p)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception(__p);
+void promise<void>::set_exception(exception_ptr __p) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception(__p);
}
-void
-promise<void>::set_value_at_thread_exit()
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_value_at_thread_exit();
+void promise<void>::set_value_at_thread_exit() {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_value_at_thread_exit();
}
-void
-promise<void>::set_exception_at_thread_exit(exception_ptr __p)
-{
- if (__state_ == nullptr)
- __throw_future_error(future_errc::no_state);
- __state_->set_exception_at_thread_exit(__p);
+void promise<void>::set_exception_at_thread_exit(exception_ptr __p) {
+ if (__state_ == nullptr)
+ __throw_future_error(future_errc::no_state);
+ __state_->set_exception_at_thread_exit(__p);
}
-shared_future<void>::~shared_future()
-{
- if (__state_)
- __state_->__release_shared();
+shared_future<void>::~shared_future() {
+ if (__state_)
+ __state_->__release_shared();
}
-shared_future<void>&
-shared_future<void>::operator=(const shared_future& __rhs)
-{
- if (__rhs.__state_)
- __rhs.__state_->__add_shared();
- if (__state_)
- __state_->__release_shared();
- __state_ = __rhs.__state_;
- return *this;
+shared_future<void>& shared_future<void>::operator=(const shared_future& __rhs) {
+ if (__rhs.__state_)
+ __rhs.__state_->__add_shared();
+ if (__state_)
+ __state_->__release_shared();
+ __state_ = __rhs.__state_;
+ return *this;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/hash.cpp b/contrib/llvm-project/libcxx/src/hash.cpp
index f5bd3e968441..34b02b8eafc2 100644
--- a/contrib/llvm-project/libcxx/src/hash.cpp
+++ b/contrib/llvm-project/libcxx/src/hash.cpp
@@ -18,114 +18,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace {
// handle all next_prime(i) for i in [1, 210), special case 0
-const unsigned small_primes[] =
-{
- 0,
- 2,
- 3,
- 5,
- 7,
- 11,
- 13,
- 17,
- 19,
- 23,
- 29,
- 31,
- 37,
- 41,
- 43,
- 47,
- 53,
- 59,
- 61,
- 67,
- 71,
- 73,
- 79,
- 83,
- 89,
- 97,
- 101,
- 103,
- 107,
- 109,
- 113,
- 127,
- 131,
- 137,
- 139,
- 149,
- 151,
- 157,
- 163,
- 167,
- 173,
- 179,
- 181,
- 191,
- 193,
- 197,
- 199,
- 211
-};
+const unsigned small_primes[] = {
+ 0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,
+ 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127,
+ 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211};
// potential primes = 210*k + indices[i], k >= 1
// these numbers are not divisible by 2, 3, 5 or 7
// (or any integer 2 <= j <= 10 for that matter).
-const unsigned indices[] =
-{
- 1,
- 11,
- 13,
- 17,
- 19,
- 23,
- 29,
- 31,
- 37,
- 41,
- 43,
- 47,
- 53,
- 59,
- 61,
- 67,
- 71,
- 73,
- 79,
- 83,
- 89,
- 97,
- 101,
- 103,
- 107,
- 109,
- 113,
- 121,
- 127,
- 131,
- 137,
- 139,
- 143,
- 149,
- 151,
- 157,
- 163,
- 167,
- 169,
- 173,
- 179,
- 181,
- 187,
- 191,
- 193,
- 197,
- 199,
- 209
-};
+const unsigned indices[] = {
+ 1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
+ 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139,
+ 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209};
-}
+} // namespace
// Returns: If n == 0, returns 0. Else returns the lowest prime number that
// is greater than or equal to n.
@@ -147,413 +53,400 @@ const unsigned indices[] =
// against.
template <size_t _Sz = sizeof(size_t)>
-inline _LIBCPP_HIDE_FROM_ABI
-typename enable_if<_Sz == 4, void>::type
-__check_for_overflow(size_t N)
-{
- if (N > 0xFFFFFFFB)
- __throw_overflow_error("__next_prime overflow");
+inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 4, void>::type __check_for_overflow(size_t N) {
+ if (N > 0xFFFFFFFB)
+ __throw_overflow_error("__next_prime overflow");
}
template <size_t _Sz = sizeof(size_t)>
-inline _LIBCPP_HIDE_FROM_ABI
-typename enable_if<_Sz == 8, void>::type
-__check_for_overflow(size_t N)
-{
- if (N > 0xFFFFFFFFFFFFFFC5ull)
- __throw_overflow_error("__next_prime overflow");
+inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 8, void>::type __check_for_overflow(size_t N) {
+ if (N > 0xFFFFFFFFFFFFFFC5ull)
+ __throw_overflow_error("__next_prime overflow");
}
-size_t
-__next_prime(size_t n)
-{
- const size_t L = 210;
- const size_t N = sizeof(small_primes) / sizeof(small_primes[0]);
- // If n is small enough, search in small_primes
- if (n <= small_primes[N-1])
- return *std::lower_bound(small_primes, small_primes + N, n);
- // Else n > largest small_primes
- // Check for overflow
- __check_for_overflow(n);
- // Start searching list of potential primes: L * k0 + indices[in]
- const size_t M = sizeof(indices) / sizeof(indices[0]);
- // Select first potential prime >= n
- // Known a-priori n >= L
- size_t k0 = n / L;
- size_t in = static_cast<size_t>(std::lower_bound(indices, indices + M, n - k0 * L)
- - indices);
- n = L * k0 + indices[in];
- while (true)
+size_t __next_prime(size_t n) {
+ const size_t L = 210;
+ const size_t N = sizeof(small_primes) / sizeof(small_primes[0]);
+ // If n is small enough, search in small_primes
+ if (n <= small_primes[N - 1])
+ return *std::lower_bound(small_primes, small_primes + N, n);
+ // Else n > largest small_primes
+ // Check for overflow
+ __check_for_overflow(n);
+ // Start searching list of potential primes: L * k0 + indices[in]
+ const size_t M = sizeof(indices) / sizeof(indices[0]);
+ // Select first potential prime >= n
+ // Known a-priori n >= L
+ size_t k0 = n / L;
+ size_t in = static_cast<size_t>(std::lower_bound(indices, indices + M, n - k0 * L) - indices);
+ n = L * k0 + indices[in];
+ while (true) {
+ // Divide n by all primes or potential primes (i) until:
+ // 1. The division is even, so try next potential prime.
+ // 2. The i > sqrt(n), in which case n is prime.
+ // It is known a-priori that n is not divisible by 2, 3, 5 or 7,
+ // so don't test those (j == 5 -> divide by 11 first). And the
+ // potential primes start with 211, so don't test against the last
+ // small prime.
+ for (size_t j = 5; j < N - 1; ++j) {
+ const std::size_t p = small_primes[j];
+ const std::size_t q = n / p;
+ if (q < p)
+ return n;
+ if (n == q * p)
+ goto next;
+ }
+ // n wasn't divisible by small primes, try potential primes
{
- // Divide n by all primes or potential primes (i) until:
- // 1. The division is even, so try next potential prime.
- // 2. The i > sqrt(n), in which case n is prime.
- // It is known a-priori that n is not divisible by 2, 3, 5 or 7,
- // so don't test those (j == 5 -> divide by 11 first). And the
- // potential primes start with 211, so don't test against the last
- // small prime.
- for (size_t j = 5; j < N - 1; ++j)
- {
- const std::size_t p = small_primes[j];
- const std::size_t q = n / p;
- if (q < p)
- return n;
- if (n == q * p)
- goto next;
- }
- // n wasn't divisible by small primes, try potential primes
- {
- size_t i = 211;
- while (true)
- {
- std::size_t q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 10;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 8;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 8;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 6;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 4;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 2;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- i += 10;
- q = n / i;
- if (q < i)
- return n;
- if (n == q * i)
- break;
-
- // This will loop i to the next "plane" of potential primes
- i += 2;
- }
- }
-next:
- // n is not prime. Increment n to next potential prime.
- if (++in == M)
- {
- ++k0;
- in = 0;
- }
- n = L * k0 + indices[in];
+ size_t i = 211;
+ while (true) {
+ std::size_t q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 10;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 8;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 8;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 6;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 4;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 2;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ i += 10;
+ q = n / i;
+ if (q < i)
+ return n;
+ if (n == q * i)
+ break;
+
+ // This will loop i to the next "plane" of potential primes
+ i += 2;
+ }
}
+ next:
+ // n is not prime. Increment n to next potential prime.
+ if (++in == M) {
+ ++k0;
+ in = 0;
+ }
+ n = L * k0 + indices[in];
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/include/apple_availability.h b/contrib/llvm-project/libcxx/src/include/apple_availability.h
index c8d158e990e2..fc2ad1506541 100644
--- a/contrib/llvm-project/libcxx/src/include/apple_availability.h
+++ b/contrib/llvm-project/libcxx/src/include/apple_availability.h
@@ -11,23 +11,23 @@
#if defined(__APPLE__)
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500
-#define _LIBCPP_USE_ULOCK
-#endif
-#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000
-#define _LIBCPP_USE_ULOCK
-#endif
-#elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000
-#define _LIBCPP_USE_ULOCK
-#endif
-#elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000
-#define _LIBCPP_USE_ULOCK
-#endif
-#endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__
+# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500
+# define _LIBCPP_USE_ULOCK
+# endif
+# elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
+# if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000
+# define _LIBCPP_USE_ULOCK
+# endif
+# elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
+# if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000
+# define _LIBCPP_USE_ULOCK
+# endif
+# elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
+# if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000
+# define _LIBCPP_USE_ULOCK
+# endif
+# endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__
#endif // __APPLE__
diff --git a/contrib/llvm-project/libcxx/src/include/atomic_support.h b/contrib/llvm-project/libcxx/src/include/atomic_support.h
index debeb745f466..9ce41b3229f5 100644
--- a/contrib/llvm-project/libcxx/src/include/atomic_support.h
+++ b/contrib/llvm-project/libcxx/src/include/atomic_support.h
@@ -12,28 +12,21 @@
#include <__config>
#include <memory> // for __libcpp_relaxed_load
-#if defined(__clang__) && __has_builtin(__atomic_load_n) \
- && __has_builtin(__atomic_store_n) \
- && __has_builtin(__atomic_add_fetch) \
- && __has_builtin(__atomic_exchange_n) \
- && __has_builtin(__atomic_compare_exchange_n) \
- && defined(__ATOMIC_RELAXED) \
- && defined(__ATOMIC_CONSUME) \
- && defined(__ATOMIC_ACQUIRE) \
- && defined(__ATOMIC_RELEASE) \
- && defined(__ATOMIC_ACQ_REL) \
- && defined(__ATOMIC_SEQ_CST)
-# define _LIBCPP_HAS_ATOMIC_BUILTINS
+#if defined(__clang__) && __has_builtin(__atomic_load_n) && __has_builtin(__atomic_store_n) && \
+ __has_builtin(__atomic_add_fetch) && __has_builtin(__atomic_exchange_n) && \
+ __has_builtin(__atomic_compare_exchange_n) && defined(__ATOMIC_RELAXED) && defined(__ATOMIC_CONSUME) && \
+ defined(__ATOMIC_ACQUIRE) && defined(__ATOMIC_RELEASE) && defined(__ATOMIC_ACQ_REL) && defined(__ATOMIC_SEQ_CST)
+# define _LIBCPP_HAS_ATOMIC_BUILTINS
#elif defined(_LIBCPP_COMPILER_GCC)
-# define _LIBCPP_HAS_ATOMIC_BUILTINS
+# define _LIBCPP_HAS_ATOMIC_BUILTINS
#endif
#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-# if defined(_LIBCPP_WARNING)
- _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
-# else
-# warning Building libc++ without __atomic builtins is unsupported
-# endif
+# if defined(_LIBCPP_WARNING)
+_LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
+# else
+# warning Building libc++ without __atomic builtins is unsupported
+# endif
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -43,128 +36,91 @@ namespace {
#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
enum __libcpp_atomic_order {
- _AO_Relaxed = __ATOMIC_RELAXED,
- _AO_Consume = __ATOMIC_CONSUME,
- _AO_Acquire = __ATOMIC_ACQUIRE,
- _AO_Release = __ATOMIC_RELEASE,
- _AO_Acq_Rel = __ATOMIC_ACQ_REL,
- _AO_Seq = __ATOMIC_SEQ_CST
+ _AO_Relaxed = __ATOMIC_RELAXED,
+ _AO_Consume = __ATOMIC_CONSUME,
+ _AO_Acquire = __ATOMIC_ACQUIRE,
+ _AO_Release = __ATOMIC_RELEASE,
+ _AO_Acq_Rel = __ATOMIC_ACQ_REL,
+ _AO_Seq = __ATOMIC_SEQ_CST
};
template <class _ValueType, class _FromType>
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_atomic_store(_ValueType* __dest, _FromType __val,
- int __order = _AO_Seq)
-{
- __atomic_store_n(__dest, __val, __order);
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_atomic_store(_ValueType* __dest, _FromType __val, int __order = _AO_Seq) {
+ __atomic_store_n(__dest, __val, __order);
}
template <class _ValueType, class _FromType>
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val)
-{
- __atomic_store_n(__dest, __val, _AO_Relaxed);
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val) {
+ __atomic_store_n(__dest, __val, _AO_Relaxed);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_atomic_load(_ValueType const* __val,
- int __order = _AO_Seq)
-{
- return __atomic_load_n(__val, __order);
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_atomic_load(_ValueType const* __val, int __order = _AO_Seq) {
+ return __atomic_load_n(__val, __order);
}
template <class _ValueType, class _AddType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a,
- int __order = _AO_Seq)
-{
- return __atomic_add_fetch(__val, __a, __order);
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a, int __order = _AO_Seq) {
+ return __atomic_add_fetch(__val, __a, __order);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_atomic_exchange(_ValueType* __target,
- _ValueType __value, int __order = _AO_Seq)
-{
- return __atomic_exchange_n(__target, __value, __order);
+inline _LIBCPP_HIDE_FROM_ABI _ValueType
+__libcpp_atomic_exchange(_ValueType* __target, _ValueType __value, int __order = _AO_Seq) {
+ return __atomic_exchange_n(__target, __value, __order);
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-bool __libcpp_atomic_compare_exchange(_ValueType* __val,
- _ValueType* __expected, _ValueType __after,
+inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_atomic_compare_exchange(
+ _ValueType* __val,
+ _ValueType* __expected,
+ _ValueType __after,
int __success_order = _AO_Seq,
- int __fail_order = _AO_Seq)
-{
- return __atomic_compare_exchange_n(__val, __expected, __after, true,
- __success_order, __fail_order);
+ int __fail_order = _AO_Seq) {
+ return __atomic_compare_exchange_n(__val, __expected, __after, true, __success_order, __fail_order);
}
#else // _LIBCPP_HAS_NO_THREADS
-enum __libcpp_atomic_order {
- _AO_Relaxed,
- _AO_Consume,
- _AO_Acquire,
- _AO_Release,
- _AO_Acq_Rel,
- _AO_Seq
-};
+enum __libcpp_atomic_order { _AO_Relaxed, _AO_Consume, _AO_Acquire, _AO_Release, _AO_Acq_Rel, _AO_Seq };
template <class _ValueType, class _FromType>
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_atomic_store(_ValueType* __dest, _FromType __val,
- int = 0)
-{
- *__dest = __val;
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_atomic_store(_ValueType* __dest, _FromType __val, int = 0) {
+ *__dest = __val;
}
template <class _ValueType, class _FromType>
-inline _LIBCPP_HIDE_FROM_ABI
-void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val)
-{
- *__dest = __val;
+inline _LIBCPP_HIDE_FROM_ABI void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val) {
+ *__dest = __val;
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_atomic_load(_ValueType const* __val,
- int = 0)
-{
- return *__val;
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_atomic_load(_ValueType const* __val, int = 0) {
+ return *__val;
}
template <class _ValueType, class _AddType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a,
- int = 0)
-{
- return *__val += __a;
+inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a, int = 0) {
+ return *__val += __a;
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-_ValueType __libcpp_atomic_exchange(_ValueType* __target,
- _ValueType __value, int = _AO_Seq)
-{
- _ValueType old = *__target;
- *__target = __value;
- return old;
+inline _LIBCPP_HIDE_FROM_ABI _ValueType
+__libcpp_atomic_exchange(_ValueType* __target, _ValueType __value, int = _AO_Seq) {
+ _ValueType old = *__target;
+ *__target = __value;
+ return old;
}
template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI
-bool __libcpp_atomic_compare_exchange(_ValueType* __val,
- _ValueType* __expected, _ValueType __after,
- int = 0, int = 0)
-{
- if (*__val == *__expected) {
- *__val = __after;
- return true;
- }
- *__expected = *__val;
- return false;
+inline _LIBCPP_HIDE_FROM_ABI bool
+__libcpp_atomic_compare_exchange(_ValueType* __val, _ValueType* __expected, _ValueType __after, int = 0, int = 0) {
+ if (*__val == *__expected) {
+ *__val = __after;
+ return true;
+ }
+ *__expected = *__val;
+ return false;
}
#endif // _LIBCPP_HAS_NO_THREADS
diff --git a/contrib/llvm-project/libcxx/src/include/config_elast.h b/contrib/llvm-project/libcxx/src/include/config_elast.h
index a772ea7a01bc..899e124ad261 100644
--- a/contrib/llvm-project/libcxx/src/include/config_elast.h
+++ b/contrib/llvm-project/libcxx/src/include/config_elast.h
@@ -12,17 +12,17 @@
#include <__config>
#if defined(_LIBCPP_MSVCRT_LIKE)
-#include <stdlib.h>
+# include <stdlib.h>
#else
-#include <errno.h>
+# include <errno.h>
#endif
// Note: _LIBCPP_ELAST needs to be defined only on platforms
// where strerror/strerror_r can't handle out-of-range errno values.
#if defined(ELAST)
-#define _LIBCPP_ELAST ELAST
+# define _LIBCPP_ELAST ELAST
#elif defined(_NEWLIB_VERSION)
-#define _LIBCPP_ELAST __ELASTERROR
+# define _LIBCPP_ELAST __ELASTERROR
#elif defined(__NuttX__)
// No _LIBCPP_ELAST needed on NuttX
#elif defined(__Fuchsia__)
@@ -32,18 +32,18 @@
#elif defined(__EMSCRIPTEN__)
// No _LIBCPP_ELAST needed on Emscripten
#elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC)
-#define _LIBCPP_ELAST 4095
+# define _LIBCPP_ELAST 4095
#elif defined(__APPLE__)
// No _LIBCPP_ELAST needed on Apple
#elif defined(__MVS__)
-#define _LIBCPP_ELAST 1160
+# define _LIBCPP_ELAST 1160
#elif defined(_LIBCPP_MSVCRT_LIKE)
-#define _LIBCPP_ELAST (_sys_nerr - 1)
+# define _LIBCPP_ELAST (_sys_nerr - 1)
#elif defined(_AIX)
-#define _LIBCPP_ELAST 127
+# define _LIBCPP_ELAST 127
#else
// Warn here so that the person doing the libcxx port has an easier time:
-#warning ELAST for this platform not yet implemented
+# warning ELAST for this platform not yet implemented
#endif
#endif // _LIBCPP_CONFIG_ELAST
diff --git a/contrib/llvm-project/libcxx/src/include/refstring.h b/contrib/llvm-project/libcxx/src/include/refstring.h
index 0675b393beb4..78452249f4fe 100644
--- a/contrib/llvm-project/libcxx/src/include/refstring.h
+++ b/contrib/llvm-project/libcxx/src/include/refstring.h
@@ -9,11 +9,11 @@
#ifndef _LIBCPP_REFSTRING_H
#define _LIBCPP_REFSTRING_H
+#include "atomic_support.h"
#include <__config>
-#include <stdexcept>
#include <cstddef>
#include <cstring>
-#include "atomic_support.h"
+#include <stdexcept>
// MacOS and iOS used to ship with libstdc++, and still support old applications
// linking against libstdc++. The libc++ and libstdc++ exceptions are supposed
@@ -25,113 +25,100 @@
// string singleton before manipulating the reference count. This is done so that
// if an exception is created with a zero-length string in libstdc++, libc++abi
// won't try to delete the memory.
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || \
- defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
-# define _LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE
-# include <dlfcn.h>
-# include <mach-o/dyld.h>
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
+# define _LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE
+# include <dlfcn.h>
+# include <mach-o/dyld.h>
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __refstring_imp { namespace {
+namespace __refstring_imp {
+namespace {
typedef int count_t;
struct _Rep_base {
- std::size_t len;
- std::size_t cap;
- count_t count;
+ std::size_t len;
+ std::size_t cap;
+ count_t count;
};
-inline _Rep_base* rep_from_data(const char *data_) noexcept {
- char *data = const_cast<char *>(data_);
- return reinterpret_cast<_Rep_base *>(data - sizeof(_Rep_base));
+inline _Rep_base* rep_from_data(const char* data_) noexcept {
+ char* data = const_cast<char*>(data_);
+ return reinterpret_cast<_Rep_base*>(data - sizeof(_Rep_base));
}
-inline char * data_from_rep(_Rep_base *rep) noexcept {
- char *data = reinterpret_cast<char *>(rep);
- return data + sizeof(*rep);
+inline char* data_from_rep(_Rep_base* rep) noexcept {
+ char* data = reinterpret_cast<char*>(rep);
+ return data + sizeof(*rep);
}
#if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE)
-inline
-const char* compute_gcc_empty_string_storage() noexcept
-{
- void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD);
- if (handle == nullptr)
- return nullptr;
- void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE");
- if (sym == nullptr)
- return nullptr;
- return data_from_rep(reinterpret_cast<_Rep_base *>(sym));
+inline const char* compute_gcc_empty_string_storage() noexcept {
+ void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD);
+ if (handle == nullptr)
+ return nullptr;
+ void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE");
+ if (sym == nullptr)
+ return nullptr;
+ return data_from_rep(reinterpret_cast<_Rep_base*>(sym));
}
-inline
-const char*
-get_gcc_empty_string_storage() noexcept
-{
- static const char* p = compute_gcc_empty_string_storage();
- return p;
+inline const char* get_gcc_empty_string_storage() noexcept {
+ static const char* p = compute_gcc_empty_string_storage();
+ return p;
}
#endif
-}} // namespace __refstring_imp
+} // namespace
+} // namespace __refstring_imp
using namespace __refstring_imp;
-inline
-__libcpp_refstring::__libcpp_refstring(const char* msg) {
- std::size_t len = strlen(msg);
- _Rep_base* rep = static_cast<_Rep_base *>(::operator new(sizeof(*rep) + len + 1));
- rep->len = len;
- rep->cap = len;
- rep->count = 0;
- char *data = data_from_rep(rep);
- std::memcpy(data, msg, len + 1);
- __imp_ = data;
+inline __libcpp_refstring::__libcpp_refstring(const char* msg) {
+ std::size_t len = strlen(msg);
+ _Rep_base* rep = static_cast<_Rep_base*>(::operator new(sizeof(*rep) + len + 1));
+ rep->len = len;
+ rep->cap = len;
+ rep->count = 0;
+ char* data = data_from_rep(rep);
+ std::memcpy(data, msg, len + 1);
+ __imp_ = data;
}
-inline
-__libcpp_refstring::__libcpp_refstring(const __libcpp_refstring &s) noexcept
- : __imp_(s.__imp_)
-{
- if (__uses_refcount())
- __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
+inline __libcpp_refstring::__libcpp_refstring(const __libcpp_refstring& s) noexcept : __imp_(s.__imp_) {
+ if (__uses_refcount())
+ __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
}
-inline
-__libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) noexcept {
- bool adjust_old_count = __uses_refcount();
- struct _Rep_base *old_rep = rep_from_data(__imp_);
- __imp_ = s.__imp_;
- if (__uses_refcount())
- __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
- if (adjust_old_count)
- {
- if (__libcpp_atomic_add(&old_rep->count, count_t(-1)) < 0)
- {
- ::operator delete(old_rep);
- }
+inline __libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) noexcept {
+ bool adjust_old_count = __uses_refcount();
+ struct _Rep_base* old_rep = rep_from_data(__imp_);
+ __imp_ = s.__imp_;
+ if (__uses_refcount())
+ __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
+ if (adjust_old_count) {
+ if (__libcpp_atomic_add(&old_rep->count, count_t(-1)) < 0) {
+ ::operator delete(old_rep);
}
- return *this;
+ }
+ return *this;
}
-inline
-__libcpp_refstring::~__libcpp_refstring() {
- if (__uses_refcount()) {
- _Rep_base* rep = rep_from_data(__imp_);
- if (__libcpp_atomic_add(&rep->count, count_t(-1)) < 0) {
- ::operator delete(rep);
- }
+inline __libcpp_refstring::~__libcpp_refstring() {
+ if (__uses_refcount()) {
+ _Rep_base* rep = rep_from_data(__imp_);
+ if (__libcpp_atomic_add(&rep->count, count_t(-1)) < 0) {
+ ::operator delete(rep);
}
+ }
}
-inline
-bool __libcpp_refstring::__uses_refcount() const {
+inline bool __libcpp_refstring::__uses_refcount() const {
#if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE)
- return __imp_ != get_gcc_empty_string_storage();
+ return __imp_ != get_gcc_empty_string_storage();
#else
- return true;
+ return true;
#endif
}
diff --git a/contrib/llvm-project/libcxx/src/include/ryu/ryu.h b/contrib/llvm-project/libcxx/src/include/ryu/ryu.h
index 3f4afa5d60cf..7b19ecfec591 100644
--- a/contrib/llvm-project/libcxx/src/include/ryu/ryu.h
+++ b/contrib/llvm-project/libcxx/src/include/ryu/ryu.h
@@ -10,7 +10,6 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
// Copyright 2018 Ulf Adams
// Copyright (c) Microsoft Corporation. All rights reserved.
diff --git a/contrib/llvm-project/libcxx/src/include/sso_allocator.h b/contrib/llvm-project/libcxx/src/include/sso_allocator.h
index 679a3b9a158d..4e6761c580b5 100644
--- a/contrib/llvm-project/libcxx/src/include/sso_allocator.h
+++ b/contrib/llvm-project/libcxx/src/include/sso_allocator.h
@@ -17,65 +17,62 @@
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
+# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
+template <class _Tp, size_t _Np>
+class _LIBCPP_HIDDEN __sso_allocator;
template <size_t _Np>
-class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
-{
+class _LIBCPP_HIDDEN __sso_allocator<void, _Np> {
public:
- typedef const void* const_pointer;
- typedef void value_type;
+ typedef const void* const_pointer;
+ typedef void value_type;
};
template <class _Tp, size_t _Np>
-class _LIBCPP_HIDDEN __sso_allocator
-{
- alignas(_Tp) std::byte buf_[sizeof(_Tp) * _Np];
- bool __allocated_;
+class _LIBCPP_HIDDEN __sso_allocator {
+ alignas(_Tp) std::byte buf_[sizeof(_Tp) * _Np];
+ bool __allocated_;
+
public:
- typedef size_t size_type;
- typedef _Tp* pointer;
- typedef _Tp value_type;
+ typedef size_t size_type;
+ typedef _Tp* pointer;
+ typedef _Tp value_type;
+
+ template <class U>
+ struct rebind {
+ using other = __sso_allocator<U, _Np>;
+ };
- template <class U>
- struct rebind {
- using other = __sso_allocator<U, _Np>;
- };
+ _LIBCPP_HIDE_FROM_ABI __sso_allocator() throw() : __allocated_(false) {}
+ _LIBCPP_HIDE_FROM_ABI __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
+ template <class _Up>
+ _LIBCPP_HIDE_FROM_ABI __sso_allocator(const __sso_allocator<_Up, _Np>&) throw() : __allocated_(false) {}
- _LIBCPP_HIDE_FROM_ABI __sso_allocator() throw() : __allocated_(false) {}
- _LIBCPP_HIDE_FROM_ABI __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
- template <class _Up> _LIBCPP_HIDE_FROM_ABI __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
- : __allocated_(false) {}
private:
- __sso_allocator& operator=(const __sso_allocator&);
+ __sso_allocator& operator=(const __sso_allocator&);
+
public:
- _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = nullptr)
- {
- if (!__allocated_ && __n <= _Np)
- {
- __allocated_ = true;
- return (pointer)&buf_;
- }
- return allocator<_Tp>().allocate(__n);
- }
- _LIBCPP_HIDE_FROM_ABI void deallocate(pointer __p, size_type __n)
- {
- if (__p == (pointer)&buf_)
- __allocated_ = false;
- else
- allocator<_Tp>().deallocate(__p, __n);
+ _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = nullptr) {
+ if (!__allocated_ && __n <= _Np) {
+ __allocated_ = true;
+ return (pointer)&buf_;
}
- _LIBCPP_HIDE_FROM_ABI size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
+ return allocator<_Tp>().allocate(__n);
+ }
+ _LIBCPP_HIDE_FROM_ABI void deallocate(pointer __p, size_type __n) {
+ if (__p == (pointer)&buf_)
+ __allocated_ = false;
+ else
+ allocator<_Tp>().deallocate(__p, __n);
+ }
+ _LIBCPP_HIDE_FROM_ABI size_type max_size() const throw() { return size_type(~0) / sizeof(_Tp); }
- _LIBCPP_HIDE_FROM_ABI
- bool operator==(const __sso_allocator& __a) const {return &buf_ == &__a.buf_;}
- _LIBCPP_HIDE_FROM_ABI
- bool operator!=(const __sso_allocator& __a) const {return &buf_ != &__a.buf_;}
+ _LIBCPP_HIDE_FROM_ABI bool operator==(const __sso_allocator& __a) const { return &buf_ == &__a.buf_; }
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const __sso_allocator& __a) const { return &buf_ != &__a.buf_; }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/ios.cpp b/contrib/llvm-project/libcxx/src/ios.cpp
index e80007d42c9d..d58827fa1255 100644
--- a/contrib/llvm-project/libcxx/src/ios.cpp
+++ b/contrib/llvm-project/libcxx/src/ios.cpp
@@ -23,59 +23,41 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-class _LIBCPP_HIDDEN __iostream_category
- : public __do_message
-{
+class _LIBCPP_HIDDEN __iostream_category : public __do_message {
public:
- virtual const char* name() const noexcept;
- virtual string message(int ev) const;
+ virtual const char* name() const noexcept;
+ virtual string message(int ev) const;
};
-const char*
-__iostream_category::name() const noexcept
-{
- return "iostream";
-}
+const char* __iostream_category::name() const noexcept { return "iostream"; }
-string
-__iostream_category::message(int ev) const
-{
- if (ev != static_cast<int>(io_errc::stream)
+string __iostream_category::message(int ev) const {
+ if (ev != static_cast<int>(io_errc::stream)
#ifdef _LIBCPP_ELAST
- && ev <= _LIBCPP_ELAST
+ && ev <= _LIBCPP_ELAST
#endif // _LIBCPP_ELAST
- )
- return __do_message::message(ev);
- return string("unspecified iostream_category error");
+ )
+ return __do_message::message(ev);
+ return string("unspecified iostream_category error");
}
-const error_category&
-iostream_category() noexcept
-{
- union AvoidDestroyingIostreamCategory {
- __iostream_category iostream_error_category;
- constexpr explicit AvoidDestroyingIostreamCategory() : iostream_error_category() {}
- ~AvoidDestroyingIostreamCategory() {}
- };
- constinit static AvoidDestroyingIostreamCategory helper;
- return helper.iostream_error_category;
+const error_category& iostream_category() noexcept {
+ union AvoidDestroyingIostreamCategory {
+ __iostream_category iostream_error_category;
+ constexpr explicit AvoidDestroyingIostreamCategory() : iostream_error_category() {}
+ ~AvoidDestroyingIostreamCategory() {}
+ };
+ constinit static AvoidDestroyingIostreamCategory helper;
+ return helper.iostream_error_category;
}
// ios_base::failure
-ios_base::failure::failure(const string& msg, const error_code& ec)
- : system_error(ec, msg)
-{
-}
+ios_base::failure::failure(const string& msg, const error_code& ec) : system_error(ec, msg) {}
-ios_base::failure::failure(const char* msg, const error_code& ec)
- : system_error(ec, msg)
-{
-}
+ios_base::failure::failure(const char* msg, const error_code& ec) : system_error(ec, msg) {}
-ios_base::failure::~failure() throw()
-{
-}
+ios_base::failure::~failure() throw() {}
// ios_base locale
@@ -110,34 +92,27 @@ const ios_base::openmode ios_base::in;
const ios_base::openmode ios_base::out;
const ios_base::openmode ios_base::trunc;
-void
-ios_base::__call_callbacks(event ev)
-{
- for (size_t i = __event_size_; i;)
- {
- --i;
- __fn_[i](ev, *this, __index_[i]);
- }
+void ios_base::__call_callbacks(event ev) {
+ for (size_t i = __event_size_; i;) {
+ --i;
+ __fn_[i](ev, *this, __index_[i]);
+ }
}
// locale
-locale
-ios_base::imbue(const locale& newloc)
-{
- static_assert(sizeof(locale) == sizeof(__loc_), "");
- locale& loc_storage = *reinterpret_cast<locale*>(&__loc_);
- locale oldloc = loc_storage;
- loc_storage = newloc;
- __call_callbacks(imbue_event);
- return oldloc;
+locale ios_base::imbue(const locale& newloc) {
+ static_assert(sizeof(locale) == sizeof(__loc_), "");
+ locale& loc_storage = *reinterpret_cast<locale*>(&__loc_);
+ locale oldloc = loc_storage;
+ loc_storage = newloc;
+ __call_callbacks(imbue_event);
+ return oldloc;
}
-locale
-ios_base::getloc() const
-{
- const locale& loc_storage = *reinterpret_cast<const locale*>(&__loc_);
- return loc_storage;
+locale ios_base::getloc() const {
+ const locale& loc_storage = *reinterpret_cast<const locale*>(&__loc_);
+ return loc_storage;
}
// xalloc
@@ -148,299 +123,259 @@ int ios_base::__xindex_ = 0;
#endif
template <typename _Tp>
-static size_t __ios_new_cap(size_t __req_size, size_t __current_cap)
-{ // Precondition: __req_size > __current_cap
- const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp);
- if (__req_size < mx/2)
- return std::max(2 * __current_cap, __req_size);
- else
- return mx;
-}
-
-int
-ios_base::xalloc()
-{
- return __xindex_++;
+static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precondition: __req_size > __current_cap
+ const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp);
+ if (__req_size < mx / 2)
+ return std::max(2 * __current_cap, __req_size);
+ else
+ return mx;
}
-long&
-ios_base::iword(int index)
-{
- size_t req_size = static_cast<size_t>(index)+1;
- if (req_size > __iarray_cap_)
- {
- size_t newcap = __ios_new_cap<long>(req_size, __iarray_cap_);
- long* iarray = static_cast<long*>(realloc(__iarray_, newcap * sizeof(long)));
- if (iarray == 0)
- {
- setstate(badbit);
- static long error;
- error = 0;
- return error;
- }
- __iarray_ = iarray;
- for (long* p = __iarray_ + __iarray_size_; p < __iarray_ + newcap; ++p)
- *p = 0;
- __iarray_cap_ = newcap;
+int ios_base::xalloc() { return __xindex_++; }
+
+long& ios_base::iword(int index) {
+ size_t req_size = static_cast<size_t>(index) + 1;
+ if (req_size > __iarray_cap_) {
+ size_t newcap = __ios_new_cap<long>(req_size, __iarray_cap_);
+ long* iarray = static_cast<long*>(realloc(__iarray_, newcap * sizeof(long)));
+ if (iarray == 0) {
+ setstate(badbit);
+ static long error;
+ error = 0;
+ return error;
}
- __iarray_size_ = max<size_t>(__iarray_size_, req_size);
- return __iarray_[index];
+ __iarray_ = iarray;
+ for (long* p = __iarray_ + __iarray_size_; p < __iarray_ + newcap; ++p)
+ *p = 0;
+ __iarray_cap_ = newcap;
+ }
+ __iarray_size_ = max<size_t>(__iarray_size_, req_size);
+ return __iarray_[index];
}
-void*&
-ios_base::pword(int index)
-{
- size_t req_size = static_cast<size_t>(index)+1;
- if (req_size > __parray_cap_)
- {
- size_t newcap = __ios_new_cap<void *>(req_size, __iarray_cap_);
- void** parray = static_cast<void**>(realloc(__parray_, newcap * sizeof(void *)));
- if (parray == 0)
- {
- setstate(badbit);
- static void* error;
- error = 0;
- return error;
- }
- __parray_ = parray;
- for (void** p = __parray_ + __parray_size_; p < __parray_ + newcap; ++p)
- *p = 0;
- __parray_cap_ = newcap;
+void*& ios_base::pword(int index) {
+ size_t req_size = static_cast<size_t>(index) + 1;
+ if (req_size > __parray_cap_) {
+ size_t newcap = __ios_new_cap<void*>(req_size, __iarray_cap_);
+ void** parray = static_cast<void**>(realloc(__parray_, newcap * sizeof(void*)));
+ if (parray == 0) {
+ setstate(badbit);
+ static void* error;
+ error = 0;
+ return error;
}
- __parray_size_ = max<size_t>(__parray_size_, req_size);
- return __parray_[index];
+ __parray_ = parray;
+ for (void** p = __parray_ + __parray_size_; p < __parray_ + newcap; ++p)
+ *p = 0;
+ __parray_cap_ = newcap;
+ }
+ __parray_size_ = max<size_t>(__parray_size_, req_size);
+ return __parray_[index];
}
// register_callback
-void
-ios_base::register_callback(event_callback fn, int index)
-{
- size_t req_size = __event_size_ + 1;
- if (req_size > __event_cap_)
- {
- size_t newcap = __ios_new_cap<event_callback>(req_size, __event_cap_);
- event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newcap * sizeof(event_callback)));
- if (fns == 0)
- setstate(badbit);
- __fn_ = fns;
- int* indxs = static_cast<int *>(realloc(__index_, newcap * sizeof(int)));
- if (indxs == 0)
- setstate(badbit);
- __index_ = indxs;
- __event_cap_ = newcap;
- }
- __fn_[__event_size_] = fn;
- __index_[__event_size_] = index;
- ++__event_size_;
+void ios_base::register_callback(event_callback fn, int index) {
+ size_t req_size = __event_size_ + 1;
+ if (req_size > __event_cap_) {
+ size_t newcap = __ios_new_cap<event_callback>(req_size, __event_cap_);
+ event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newcap * sizeof(event_callback)));
+ if (fns == 0)
+ setstate(badbit);
+ __fn_ = fns;
+ int* indxs = static_cast<int*>(realloc(__index_, newcap * sizeof(int)));
+ if (indxs == 0)
+ setstate(badbit);
+ __index_ = indxs;
+ __event_cap_ = newcap;
+ }
+ __fn_[__event_size_] = fn;
+ __index_[__event_size_] = index;
+ ++__event_size_;
}
-ios_base::~ios_base()
-{
- __call_callbacks(erase_event);
- locale& loc_storage = *reinterpret_cast<locale*>(&__loc_);
- loc_storage.~locale();
- free(__fn_);
- free(__index_);
- free(__iarray_);
- free(__parray_);
+ios_base::~ios_base() {
+ __call_callbacks(erase_event);
+ locale& loc_storage = *reinterpret_cast<locale*>(&__loc_);
+ loc_storage.~locale();
+ free(__fn_);
+ free(__index_);
+ free(__iarray_);
+ free(__parray_);
}
// iostate
-void
-ios_base::clear(iostate state)
-{
- if (__rdbuf_)
- __rdstate_ = state;
- else
- __rdstate_ = state | badbit;
+void ios_base::clear(iostate state) {
+ if (__rdbuf_)
+ __rdstate_ = state;
+ else
+ __rdstate_ = state | badbit;
- if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0)
- __throw_failure("ios_base::clear");
+ if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0)
+ __throw_failure("ios_base::clear");
}
// init
-void
-ios_base::init(void* sb)
-{
- __rdbuf_ = sb;
- __rdstate_ = __rdbuf_ ? goodbit : badbit;
- __exceptions_ = goodbit;
- __fmtflags_ = skipws | dec;
- __width_ = 0;
- __precision_ = 6;
- __fn_ = 0;
- __index_ = 0;
- __event_size_ = 0;
- __event_cap_ = 0;
- __iarray_ = 0;
- __iarray_size_ = 0;
- __iarray_cap_ = 0;
- __parray_ = 0;
- __parray_size_ = 0;
- __parray_cap_ = 0;
- ::new(&__loc_) locale;
+void ios_base::init(void* sb) {
+ __rdbuf_ = sb;
+ __rdstate_ = __rdbuf_ ? goodbit : badbit;
+ __exceptions_ = goodbit;
+ __fmtflags_ = skipws | dec;
+ __width_ = 0;
+ __precision_ = 6;
+ __fn_ = 0;
+ __index_ = 0;
+ __event_size_ = 0;
+ __event_cap_ = 0;
+ __iarray_ = 0;
+ __iarray_size_ = 0;
+ __iarray_cap_ = 0;
+ __parray_ = 0;
+ __parray_size_ = 0;
+ __parray_cap_ = 0;
+ ::new (&__loc_) locale;
}
-void
-ios_base::copyfmt(const ios_base& rhs)
-{
- // If we can't acquire the needed resources, throw bad_alloc (can't set badbit)
- // Don't alter *this until all needed resources are acquired
- unique_ptr<event_callback, void (*)(void*)> new_callbacks(0, free);
- unique_ptr<int, void (*)(void*)> new_ints(0, free);
- unique_ptr<long, void (*)(void*)> new_longs(0, free);
- unique_ptr<void*, void (*)(void*)> new_pointers(0, free);
- if (__event_cap_ < rhs.__event_size_)
- {
- size_t newesize = sizeof(event_callback) * rhs.__event_size_;
- new_callbacks.reset(static_cast<event_callback*>(malloc(newesize)));
- if (!new_callbacks)
- __throw_bad_alloc();
-
- size_t newisize = sizeof(int) * rhs.__event_size_;
- new_ints.reset(static_cast<int *>(malloc(newisize)));
- if (!new_ints)
- __throw_bad_alloc();
- }
- if (__iarray_cap_ < rhs.__iarray_size_)
- {
- size_t newsize = sizeof(long) * rhs.__iarray_size_;
- new_longs.reset(static_cast<long*>(malloc(newsize)));
- if (!new_longs)
- __throw_bad_alloc();
- }
- if (__parray_cap_ < rhs.__parray_size_)
- {
- size_t newsize = sizeof(void*) * rhs.__parray_size_;
- new_pointers.reset(static_cast<void**>(malloc(newsize)));
- if (!new_pointers)
- __throw_bad_alloc();
- }
- // Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_
- __fmtflags_ = rhs.__fmtflags_;
- __precision_ = rhs.__precision_;
- __width_ = rhs.__width_;
- locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_);
- const locale& rhs_loc = *reinterpret_cast<const locale*>(&rhs.__loc_);
- lhs_loc = rhs_loc;
- if (__event_cap_ < rhs.__event_size_)
- {
- free(__fn_);
- __fn_ = new_callbacks.release();
- free(__index_);
- __index_ = new_ints.release();
- __event_cap_ = rhs.__event_size_;
- }
- for (__event_size_ = 0; __event_size_ < rhs.__event_size_; ++__event_size_)
- {
- __fn_[__event_size_] = rhs.__fn_[__event_size_];
- __index_[__event_size_] = rhs.__index_[__event_size_];
- }
- if (__iarray_cap_ < rhs.__iarray_size_)
- {
- free(__iarray_);
- __iarray_ = new_longs.release();
- __iarray_cap_ = rhs.__iarray_size_;
- }
- for (__iarray_size_ = 0; __iarray_size_ < rhs.__iarray_size_; ++__iarray_size_)
- __iarray_[__iarray_size_] = rhs.__iarray_[__iarray_size_];
- if (__parray_cap_ < rhs.__parray_size_)
- {
- free(__parray_);
- __parray_ = new_pointers.release();
- __parray_cap_ = rhs.__parray_size_;
- }
- for (__parray_size_ = 0; __parray_size_ < rhs.__parray_size_; ++__parray_size_)
- __parray_[__parray_size_] = rhs.__parray_[__parray_size_];
+void ios_base::copyfmt(const ios_base& rhs) {
+ // If we can't acquire the needed resources, throw bad_alloc (can't set badbit)
+ // Don't alter *this until all needed resources are acquired
+ unique_ptr<event_callback, void (*)(void*)> new_callbacks(0, free);
+ unique_ptr<int, void (*)(void*)> new_ints(0, free);
+ unique_ptr<long, void (*)(void*)> new_longs(0, free);
+ unique_ptr<void*, void (*)(void*)> new_pointers(0, free);
+ if (__event_cap_ < rhs.__event_size_) {
+ size_t newesize = sizeof(event_callback) * rhs.__event_size_;
+ new_callbacks.reset(static_cast<event_callback*>(malloc(newesize)));
+ if (!new_callbacks)
+ __throw_bad_alloc();
+
+ size_t newisize = sizeof(int) * rhs.__event_size_;
+ new_ints.reset(static_cast<int*>(malloc(newisize)));
+ if (!new_ints)
+ __throw_bad_alloc();
+ }
+ if (__iarray_cap_ < rhs.__iarray_size_) {
+ size_t newsize = sizeof(long) * rhs.__iarray_size_;
+ new_longs.reset(static_cast<long*>(malloc(newsize)));
+ if (!new_longs)
+ __throw_bad_alloc();
+ }
+ if (__parray_cap_ < rhs.__parray_size_) {
+ size_t newsize = sizeof(void*) * rhs.__parray_size_;
+ new_pointers.reset(static_cast<void**>(malloc(newsize)));
+ if (!new_pointers)
+ __throw_bad_alloc();
+ }
+ // Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_
+ __fmtflags_ = rhs.__fmtflags_;
+ __precision_ = rhs.__precision_;
+ __width_ = rhs.__width_;
+ locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_);
+ const locale& rhs_loc = *reinterpret_cast<const locale*>(&rhs.__loc_);
+ lhs_loc = rhs_loc;
+ if (__event_cap_ < rhs.__event_size_) {
+ free(__fn_);
+ __fn_ = new_callbacks.release();
+ free(__index_);
+ __index_ = new_ints.release();
+ __event_cap_ = rhs.__event_size_;
+ }
+ for (__event_size_ = 0; __event_size_ < rhs.__event_size_; ++__event_size_) {
+ __fn_[__event_size_] = rhs.__fn_[__event_size_];
+ __index_[__event_size_] = rhs.__index_[__event_size_];
+ }
+ if (__iarray_cap_ < rhs.__iarray_size_) {
+ free(__iarray_);
+ __iarray_ = new_longs.release();
+ __iarray_cap_ = rhs.__iarray_size_;
+ }
+ for (__iarray_size_ = 0; __iarray_size_ < rhs.__iarray_size_; ++__iarray_size_)
+ __iarray_[__iarray_size_] = rhs.__iarray_[__iarray_size_];
+ if (__parray_cap_ < rhs.__parray_size_) {
+ free(__parray_);
+ __parray_ = new_pointers.release();
+ __parray_cap_ = rhs.__parray_size_;
+ }
+ for (__parray_size_ = 0; __parray_size_ < rhs.__parray_size_; ++__parray_size_)
+ __parray_[__parray_size_] = rhs.__parray_[__parray_size_];
}
-void
-ios_base::move(ios_base& rhs)
-{
- // *this is uninitialized
- __fmtflags_ = rhs.__fmtflags_;
- __precision_ = rhs.__precision_;
- __width_ = rhs.__width_;
- __rdstate_ = rhs.__rdstate_;
- __exceptions_ = rhs.__exceptions_;
- __rdbuf_ = 0;
- locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_);
- ::new(&__loc_) locale(rhs_loc);
- __fn_ = rhs.__fn_;
- rhs.__fn_ = 0;
- __index_ = rhs.__index_;
- rhs.__index_ = 0;
- __event_size_ = rhs.__event_size_;
- rhs.__event_size_ = 0;
- __event_cap_ = rhs.__event_cap_;
- rhs.__event_cap_ = 0;
- __iarray_ = rhs.__iarray_;
- rhs.__iarray_ = 0;
- __iarray_size_ = rhs.__iarray_size_;
- rhs.__iarray_size_ = 0;
- __iarray_cap_ = rhs.__iarray_cap_;
- rhs.__iarray_cap_ = 0;
- __parray_ = rhs.__parray_;
- rhs.__parray_ = 0;
- __parray_size_ = rhs.__parray_size_;
- rhs.__parray_size_ = 0;
- __parray_cap_ = rhs.__parray_cap_;
- rhs.__parray_cap_ = 0;
+void ios_base::move(ios_base& rhs) {
+ // *this is uninitialized
+ __fmtflags_ = rhs.__fmtflags_;
+ __precision_ = rhs.__precision_;
+ __width_ = rhs.__width_;
+ __rdstate_ = rhs.__rdstate_;
+ __exceptions_ = rhs.__exceptions_;
+ __rdbuf_ = 0;
+ locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_);
+ ::new (&__loc_) locale(rhs_loc);
+ __fn_ = rhs.__fn_;
+ rhs.__fn_ = 0;
+ __index_ = rhs.__index_;
+ rhs.__index_ = 0;
+ __event_size_ = rhs.__event_size_;
+ rhs.__event_size_ = 0;
+ __event_cap_ = rhs.__event_cap_;
+ rhs.__event_cap_ = 0;
+ __iarray_ = rhs.__iarray_;
+ rhs.__iarray_ = 0;
+ __iarray_size_ = rhs.__iarray_size_;
+ rhs.__iarray_size_ = 0;
+ __iarray_cap_ = rhs.__iarray_cap_;
+ rhs.__iarray_cap_ = 0;
+ __parray_ = rhs.__parray_;
+ rhs.__parray_ = 0;
+ __parray_size_ = rhs.__parray_size_;
+ rhs.__parray_size_ = 0;
+ __parray_cap_ = rhs.__parray_cap_;
+ rhs.__parray_cap_ = 0;
}
-void
-ios_base::swap(ios_base& rhs) noexcept
-{
- std::swap(__fmtflags_, rhs.__fmtflags_);
- std::swap(__precision_, rhs.__precision_);
- std::swap(__width_, rhs.__width_);
- std::swap(__rdstate_, rhs.__rdstate_);
- std::swap(__exceptions_, rhs.__exceptions_);
- locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_);
- locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_);
- std::swap(lhs_loc, rhs_loc);
- std::swap(__fn_, rhs.__fn_);
- std::swap(__index_, rhs.__index_);
- std::swap(__event_size_, rhs.__event_size_);
- std::swap(__event_cap_, rhs.__event_cap_);
- std::swap(__iarray_, rhs.__iarray_);
- std::swap(__iarray_size_, rhs.__iarray_size_);
- std::swap(__iarray_cap_, rhs.__iarray_cap_);
- std::swap(__parray_, rhs.__parray_);
- std::swap(__parray_size_, rhs.__parray_size_);
- std::swap(__parray_cap_, rhs.__parray_cap_);
+void ios_base::swap(ios_base& rhs) noexcept {
+ std::swap(__fmtflags_, rhs.__fmtflags_);
+ std::swap(__precision_, rhs.__precision_);
+ std::swap(__width_, rhs.__width_);
+ std::swap(__rdstate_, rhs.__rdstate_);
+ std::swap(__exceptions_, rhs.__exceptions_);
+ locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_);
+ locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_);
+ std::swap(lhs_loc, rhs_loc);
+ std::swap(__fn_, rhs.__fn_);
+ std::swap(__index_, rhs.__index_);
+ std::swap(__event_size_, rhs.__event_size_);
+ std::swap(__event_cap_, rhs.__event_cap_);
+ std::swap(__iarray_, rhs.__iarray_);
+ std::swap(__iarray_size_, rhs.__iarray_size_);
+ std::swap(__iarray_cap_, rhs.__iarray_cap_);
+ std::swap(__parray_, rhs.__parray_);
+ std::swap(__parray_size_, rhs.__parray_size_);
+ std::swap(__parray_cap_, rhs.__parray_cap_);
}
-void
-ios_base::__set_badbit_and_consider_rethrow()
-{
- __rdstate_ |= badbit;
+void ios_base::__set_badbit_and_consider_rethrow() {
+ __rdstate_ |= badbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- if (__exceptions_ & badbit)
- throw;
+ if (__exceptions_ & badbit)
+ throw;
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-void
-ios_base::__set_failbit_and_consider_rethrow()
-{
- __rdstate_ |= failbit;
+void ios_base::__set_failbit_and_consider_rethrow() {
+ __rdstate_ |= failbit;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- if (__exceptions_ & failbit)
- throw;
+ if (__exceptions_ & failbit)
+ throw;
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-bool
-ios_base::sync_with_stdio(bool sync)
-{
- static bool previous_state = true;
- bool r = previous_state;
- previous_state = sync;
- return r;
+bool ios_base::sync_with_stdio(bool sync) {
+ static bool previous_state = true;
+ bool r = previous_state;
+ previous_state = sync;
+ return r;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/iostream.cpp b/contrib/llvm-project/libcxx/src/iostream.cpp
index 83ee7a6408a1..bb49e265ba0e 100644
--- a/contrib/llvm-project/libcxx/src/iostream.cpp
+++ b/contrib/llvm-project/libcxx/src/iostream.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#include <__locale>
#include "std_stream.h"
+#include <__locale>
#include <new>
#include <string>
@@ -21,72 +21,88 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-_ALIGNAS_TYPE (istream) _LIBCPP_EXPORTED_FROM_ABI char cin[sizeof(istream)]
+_ALIGNAS_TYPE(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")
+ __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_TYPE(__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)]
-#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_TYPE(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>)];
static mbstate_t mb_wcin;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_ALIGNAS_TYPE (ostream) _LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)]
+_ALIGNAS_TYPE(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")
+ __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_TYPE(__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)]
-#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_TYPE(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>)];
static mbstate_t mb_wcout;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_ALIGNAS_TYPE (ostream) _LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)]
+_ALIGNAS_TYPE(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")
+ __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_TYPE(__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)]
-#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_TYPE(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>)];
static mbstate_t mb_wcerr;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_ALIGNAS_TYPE (ostream) _LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)]
+_ALIGNAS_TYPE(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")
+ __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)]
-#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")
-#endif
-;
+_ALIGNAS_TYPE(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")
+# endif
+ ;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority
@@ -101,8 +117,8 @@ static void force_locale_initialization() {
static bool once = []() {
auto loc = newlocale(LC_ALL_MASK, "C", 0);
{
- __libcpp_locale_guard g(loc); // forces initialization of locale TLS
- ((void)g);
+ __libcpp_locale_guard g(loc); // forces initialization of locale TLS
+ ((void)g);
}
freelocale(loc);
return true;
@@ -113,56 +129,51 @@ static void force_locale_initialization() {
class DoIOSInit {
public:
- DoIOSInit();
- ~DoIOSInit();
+ DoIOSInit();
+ ~DoIOSInit();
};
-DoIOSInit::DoIOSInit()
-{
- force_locale_initialization();
+DoIOSInit::DoIOSInit() {
+ force_locale_initialization();
- istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, &mb_cin));
- ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, &mb_cout));
- ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, &mb_cerr));
- ::new(clog) ostream(cerr_ptr->rdbuf());
- cin_ptr->tie(cout_ptr);
- std::unitbuf(*cerr_ptr);
- cerr_ptr->tie(cout_ptr);
+ istream* cin_ptr = ::new (cin) istream(::new (__cin) __stdinbuf<char>(stdin, &mb_cin));
+ ostream* cout_ptr = ::new (cout) ostream(::new (__cout) __stdoutbuf<char>(stdout, &mb_cout));
+ ostream* cerr_ptr = ::new (cerr) ostream(::new (__cerr) __stdoutbuf<char>(stderr, &mb_cerr));
+ ::new (clog) ostream(cerr_ptr->rdbuf());
+ cin_ptr->tie(cout_ptr);
+ std::unitbuf(*cerr_ptr);
+ cerr_ptr->tie(cout_ptr);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin));
- wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout));
- wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr));
- ::new(wclog) wostream(wcerr_ptr->rdbuf());
-
- wcin_ptr->tie(wcout_ptr);
- std::unitbuf(*wcerr_ptr);
- wcerr_ptr->tie(wcout_ptr);
+ wistream* wcin_ptr = ::new (wcin) wistream(::new (__wcin) __stdinbuf<wchar_t>(stdin, &mb_wcin));
+ wostream* wcout_ptr = ::new (wcout) wostream(::new (__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout));
+ wostream* wcerr_ptr = ::new (wcerr) wostream(::new (__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr));
+ ::new (wclog) wostream(wcerr_ptr->rdbuf());
+
+ wcin_ptr->tie(wcout_ptr);
+ std::unitbuf(*wcerr_ptr);
+ wcerr_ptr->tie(wcout_ptr);
#endif
}
-DoIOSInit::~DoIOSInit()
-{
- ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
- cout_ptr->flush();
- ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
- clog_ptr->flush();
+DoIOSInit::~DoIOSInit() {
+ ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
+ cout_ptr->flush();
+ ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
+ clog_ptr->flush();
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
- wcout_ptr->flush();
- wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
- wclog_ptr->flush();
+ wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
+ wcout_ptr->flush();
+ wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
+ wclog_ptr->flush();
#endif
}
-ios_base::Init::Init()
-{
- static DoIOSInit init_the_streams; // gets initialized once
+ios_base::Init::Init() {
+ static DoIOSInit init_the_streams; // gets initialized once
}
-ios_base::Init::~Init()
-{
-}
+ios_base::Init::~Init() {}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/locale.cpp b/contrib/llvm-project/libcxx/src/locale.cpp
index 71f7ca482d50..73b24dbf595a 100644
--- a/contrib/llvm-project/libcxx/src/locale.cpp
+++ b/contrib/llvm-project/libcxx/src/locale.cpp
@@ -23,21 +23,21 @@
#include <vector>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-# include <cwctype>
+# include <cwctype>
#endif
#if defined(_AIX)
-# include <sys/localedef.h> // for __lc_ctype_ptr
+# include <sys/localedef.h> // for __lc_ctype_ptr
#endif
#if defined(_LIBCPP_MSVCRT)
-# define _CTYPE_DISABLE_MACROS
+# define _CTYPE_DISABLE_MACROS
#endif
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-# include "__support/win32/locale_win32.h"
+# include "__support/win32/locale_win32.h"
#elif !defined(__BIONIC__) && !defined(__NuttX__)
-# include <langinfo.h>
+# include <langinfo.h>
#endif
#include "include/atomic_support.h"
@@ -65,6 +65,7 @@ struct __libcpp_unique_locale {
locale_t& get() { return __loc_; }
locale_t __loc_;
+
private:
__libcpp_unique_locale(__libcpp_unique_locale const&);
__libcpp_unique_locale& operator=(__libcpp_unique_locale const&);
@@ -86,44 +87,34 @@ struct releaser {
void operator()(locale::facet* p) { p->__release_shared(); }
};
-template <class T, class ...Args>
-T& make(Args ...args)
-{
- alignas(T) static std::byte buf[sizeof(T)];
- auto *obj = ::new (&buf) T(args...);
- return *obj;
+template <class T, class... Args>
+T& make(Args... args) {
+ alignas(T) static std::byte buf[sizeof(T)];
+ auto* obj = ::new (&buf) T(args...);
+ return *obj;
}
template <typename T, size_t N>
-inline
-constexpr
-size_t
-countof(const T (&)[N])
-{
- return N;
+inline constexpr size_t countof(const T (&)[N]) {
+ return N;
}
template <typename T>
-inline
-constexpr
-size_t
-countof(const T * const begin, const T * const end)
-{
- return static_cast<size_t>(end - begin);
-}
-
+inline constexpr size_t countof(const T* const begin, const T* const end) {
+ return static_cast<size_t>(end - begin);
}
-string
-build_name(const string& other, const string& one, locale::category c) {
- if (other == "*" || one == "*")
- return "*";
- if (c == locale::none || other == one)
- return other;
+} // namespace
- // FIXME: Handle the more complicated cases, such as when the locale has
- // different names for different categories.
+string build_name(const string& other, const string& one, locale::category c) {
+ if (other == "*" || one == "*")
return "*";
+ if (c == locale::none || other == one)
+ return other;
+
+ // FIXME: Handle the more complicated cases, such as when the locale has
+ // different names for different categories.
+ return "*";
}
const locale::category locale::none;
@@ -135,408 +126,366 @@ const locale::category locale::time;
const locale::category locale::messages;
const locale::category locale::all;
-class _LIBCPP_HIDDEN locale::__imp
- : public facet
-{
- enum {N = 30};
- vector<facet*, __sso_allocator<facet*, N> > facets_;
- string name_;
+class _LIBCPP_HIDDEN locale::__imp : public facet {
+ enum { N = 30 };
+ vector<facet*, __sso_allocator<facet*, N> > facets_;
+ string name_;
+
public:
- explicit __imp(size_t refs = 0);
- explicit __imp(const string& name, size_t refs = 0);
- __imp(const __imp&);
- __imp(const __imp&, const string&, locale::category c);
- __imp(const __imp& other, const __imp& one, locale::category c);
- __imp(const __imp&, facet* f, long id);
- ~__imp();
-
- const string& name() const {return name_;}
- bool has_facet(long id) const
- {return static_cast<size_t>(id) < facets_.size() && facets_[static_cast<size_t>(id)];}
- const locale::facet* use_facet(long id) const;
-
- void acquire();
- void release();
- static __no_destroy<__imp> classic_locale_imp_;
-
- private:
- void install(facet* f, long id);
- template <class F> void install(F* f) {install(f, f->id.__get());}
- template <class F> void install_from(const __imp& other);
+ explicit __imp(size_t refs = 0);
+ explicit __imp(const string& name, size_t refs = 0);
+ __imp(const __imp&);
+ __imp(const __imp&, const string&, locale::category c);
+ __imp(const __imp& other, const __imp& one, locale::category c);
+ __imp(const __imp&, facet* f, long id);
+ ~__imp();
+
+ const string& name() const { return name_; }
+ bool has_facet(long id) const { return static_cast<size_t>(id) < facets_.size() && facets_[static_cast<size_t>(id)]; }
+ const locale::facet* use_facet(long id) const;
+
+ void acquire();
+ void release();
+ static __no_destroy<__imp> classic_locale_imp_;
+
+private:
+ void install(facet* f, long id);
+ template <class F>
+ void install(F* f) {
+ install(f, f->id.__get());
+ }
+ template <class F>
+ void install_from(const __imp& other);
};
-locale::__imp::__imp(size_t refs)
- : facet(refs),
- facets_(N),
- name_("C")
-{
- facets_.clear();
- install(&make<std::collate<char> >(1u));
+locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") {
+ facets_.clear();
+ install(&make<std::collate<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<std::collate<wchar_t> >(1u));
+ install(&make<std::collate<wchar_t> >(1u));
#endif
- install(&make<std::ctype<char> >(nullptr, false, 1u));
+ install(&make<std::ctype<char> >(nullptr, false, 1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<std::ctype<wchar_t> >(1u));
+ install(&make<std::ctype<wchar_t> >(1u));
#endif
- install(&make<codecvt<char, char, mbstate_t> >(1u));
+ install(&make<codecvt<char, char, mbstate_t> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
+ install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
- install(&make<codecvt<char32_t, char, mbstate_t> >(1u));
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
+ install(&make<codecvt<char32_t, char, mbstate_t> >(1u));
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
#ifndef _LIBCPP_HAS_NO_CHAR8_T
- install(&make<codecvt<char16_t, char8_t, mbstate_t> >(1u));
- install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u));
+ install(&make<codecvt<char16_t, char8_t, mbstate_t> >(1u));
+ install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u));
#endif
- install(&make<numpunct<char> >(1u));
+ install(&make<numpunct<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<numpunct<wchar_t> >(1u));
+ install(&make<numpunct<wchar_t> >(1u));
#endif
- install(&make<num_get<char> >(1u));
+ install(&make<num_get<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<num_get<wchar_t> >(1u));
+ install(&make<num_get<wchar_t> >(1u));
#endif
- install(&make<num_put<char> >(1u));
+ install(&make<num_put<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<num_put<wchar_t> >(1u));
+ install(&make<num_put<wchar_t> >(1u));
#endif
- install(&make<moneypunct<char, false> >(1u));
- install(&make<moneypunct<char, true> >(1u));
+ install(&make<moneypunct<char, false> >(1u));
+ install(&make<moneypunct<char, true> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<moneypunct<wchar_t, false> >(1u));
- install(&make<moneypunct<wchar_t, true> >(1u));
+ install(&make<moneypunct<wchar_t, false> >(1u));
+ install(&make<moneypunct<wchar_t, true> >(1u));
#endif
- install(&make<money_get<char> >(1u));
+ install(&make<money_get<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<money_get<wchar_t> >(1u));
+ install(&make<money_get<wchar_t> >(1u));
#endif
- install(&make<money_put<char> >(1u));
+ install(&make<money_put<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<money_put<wchar_t> >(1u));
+ install(&make<money_put<wchar_t> >(1u));
#endif
- install(&make<time_get<char> >(1u));
+ install(&make<time_get<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<time_get<wchar_t> >(1u));
+ install(&make<time_get<wchar_t> >(1u));
#endif
- install(&make<time_put<char> >(1u));
+ install(&make<time_put<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<time_put<wchar_t> >(1u));
+ install(&make<time_put<wchar_t> >(1u));
#endif
- install(&make<std::messages<char> >(1u));
+ install(&make<std::messages<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(&make<std::messages<wchar_t> >(1u));
+ install(&make<std::messages<wchar_t> >(1u));
#endif
}
-locale::__imp::__imp(const string& name, size_t refs)
- : facet(refs),
- facets_(N),
- name_(name)
-{
+locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), name_(name) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- facets_ = locale::classic().__locale_->facets_;
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__add_shared();
- install(new collate_byname<char>(name_));
+ facets_ = locale::classic().__locale_->facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
+ install(new collate_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new collate_byname<wchar_t>(name_));
+ install(new collate_byname<wchar_t>(name_));
#endif
- install(new ctype_byname<char>(name_));
+ install(new ctype_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new ctype_byname<wchar_t>(name_));
+ install(new ctype_byname<wchar_t>(name_));
#endif
- install(new codecvt_byname<char, char, mbstate_t>(name_));
+ install(new codecvt_byname<char, char, mbstate_t>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
+ install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
- install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
+ install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
#ifndef _LIBCPP_HAS_NO_CHAR8_T
- install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_));
- install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
+ install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_));
+ install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
#endif
- install(new numpunct_byname<char>(name_));
+ install(new numpunct_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new numpunct_byname<wchar_t>(name_));
+ install(new numpunct_byname<wchar_t>(name_));
#endif
- install(new moneypunct_byname<char, false>(name_));
- install(new moneypunct_byname<char, true>(name_));
+ install(new moneypunct_byname<char, false>(name_));
+ install(new moneypunct_byname<char, true>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new moneypunct_byname<wchar_t, false>(name_));
- install(new moneypunct_byname<wchar_t, true>(name_));
+ install(new moneypunct_byname<wchar_t, false>(name_));
+ install(new moneypunct_byname<wchar_t, true>(name_));
#endif
- install(new time_get_byname<char>(name_));
+ install(new time_get_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new time_get_byname<wchar_t>(name_));
+ install(new time_get_byname<wchar_t>(name_));
#endif
- install(new time_put_byname<char>(name_));
+ install(new time_put_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new time_put_byname<wchar_t>(name_));
+ install(new time_put_byname<wchar_t>(name_));
#endif
- install(new messages_byname<char>(name_));
+ install(new messages_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new messages_byname<wchar_t>(name_));
+ install(new messages_byname<wchar_t>(name_));
#endif
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__release_shared();
- throw;
- }
+ } catch (...) {
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
+ throw;
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-locale::__imp::__imp(const __imp& other)
- : facets_(max<size_t>(N, other.facets_.size())),
- name_(other.name_)
-{
- facets_ = other.facets_;
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__add_shared();
+locale::__imp::__imp(const __imp& other) : facets_(max<size_t>(N, other.facets_.size())), name_(other.name_) {
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
}
locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
- : facets_(N), name_(build_name(other.name_, name, c))
-{
- facets_ = other.facets_;
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__add_shared();
+ : facets_(N), name_(build_name(other.name_, name, c)) {
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (c & locale::collate)
- {
- install(new collate_byname<char>(name));
+ if (c & locale::collate) {
+ install(new collate_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new collate_byname<wchar_t>(name));
+ install(new collate_byname<wchar_t>(name));
#endif
- }
- if (c & locale::ctype)
- {
- install(new ctype_byname<char>(name));
+ }
+ if (c & locale::ctype) {
+ install(new ctype_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new ctype_byname<wchar_t>(name));
+ install(new ctype_byname<wchar_t>(name));
#endif
- install(new codecvt_byname<char, char, mbstate_t>(name));
+ install(new codecvt_byname<char, char, mbstate_t>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
+ install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
#endif
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- install(new codecvt_byname<char16_t, char, mbstate_t>(name));
- install(new codecvt_byname<char32_t, char, mbstate_t>(name));
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ install(new codecvt_byname<char16_t, char, mbstate_t>(name));
+ install(new codecvt_byname<char32_t, char, mbstate_t>(name));
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
#ifndef _LIBCPP_HAS_NO_CHAR8_T
- install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name));
- install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name));
+ install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name));
+ install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name));
#endif
- }
- if (c & locale::monetary)
- {
- install(new moneypunct_byname<char, false>(name));
- install(new moneypunct_byname<char, true>(name));
+ }
+ if (c & locale::monetary) {
+ install(new moneypunct_byname<char, false>(name));
+ install(new moneypunct_byname<char, true>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new moneypunct_byname<wchar_t, false>(name));
- install(new moneypunct_byname<wchar_t, true>(name));
+ install(new moneypunct_byname<wchar_t, false>(name));
+ install(new moneypunct_byname<wchar_t, true>(name));
#endif
- }
- if (c & locale::numeric)
- {
- install(new numpunct_byname<char>(name));
+ }
+ if (c & locale::numeric) {
+ install(new numpunct_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new numpunct_byname<wchar_t>(name));
+ install(new numpunct_byname<wchar_t>(name));
#endif
- }
- if (c & locale::time)
- {
- install(new time_get_byname<char>(name));
+ }
+ if (c & locale::time) {
+ install(new time_get_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new time_get_byname<wchar_t>(name));
+ install(new time_get_byname<wchar_t>(name));
#endif
- install(new time_put_byname<char>(name));
+ install(new time_put_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new time_put_byname<wchar_t>(name));
+ install(new time_put_byname<wchar_t>(name));
#endif
- }
- if (c & locale::messages)
- {
- install(new messages_byname<char>(name));
+ }
+ if (c & locale::messages) {
+ install(new messages_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install(new messages_byname<wchar_t>(name));
+ install(new messages_byname<wchar_t>(name));
#endif
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__release_shared();
- throw;
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
+ throw;
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
-template<class F>
-inline
-void
-locale::__imp::install_from(const locale::__imp& one)
-{
- long id = F::id.__get();
- install(const_cast<F*>(static_cast<const F*>(one.use_facet(id))), id);
+template <class F>
+inline void locale::__imp::install_from(const locale::__imp& one) {
+ long id = F::id.__get();
+ install(const_cast<F*>(static_cast<const F*>(one.use_facet(id))), id);
}
locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
- : facets_(N), name_(build_name(other.name_, one.name_, c))
-{
- facets_ = other.facets_;
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__add_shared();
+ : facets_(N), name_(build_name(other.name_, one.name_, c)) {
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- if (c & locale::collate)
- {
- install_from<std::collate<char> >(one);
+ if (c & locale::collate) {
+ install_from<std::collate<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<std::collate<wchar_t> >(one);
+ install_from<std::collate<wchar_t> >(one);
#endif
- }
- if (c & locale::ctype)
- {
- install_from<std::ctype<char> >(one);
+ }
+ if (c & locale::ctype) {
+ install_from<std::ctype<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<std::ctype<wchar_t> >(one);
+ install_from<std::ctype<wchar_t> >(one);
#endif
- install_from<std::codecvt<char, char, mbstate_t> >(one);
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- install_from<std::codecvt<char16_t, char, mbstate_t> >(one);
- install_from<std::codecvt<char32_t, char, mbstate_t> >(one);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
+ install_from<std::codecvt<char, char, mbstate_t> >(one);
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+ install_from<std::codecvt<char16_t, char, mbstate_t> >(one);
+ install_from<std::codecvt<char32_t, char, mbstate_t> >(one);
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
#ifndef _LIBCPP_HAS_NO_CHAR8_T
- install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one);
- install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one);
+ install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one);
+ install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one);
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<std::codecvt<wchar_t, char, mbstate_t> >(one);
+ install_from<std::codecvt<wchar_t, char, mbstate_t> >(one);
#endif
- }
- if (c & locale::monetary)
- {
- install_from<moneypunct<char, false> >(one);
- install_from<moneypunct<char, true> >(one);
+ }
+ if (c & locale::monetary) {
+ install_from<moneypunct<char, false> >(one);
+ install_from<moneypunct<char, true> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<moneypunct<wchar_t, false> >(one);
- install_from<moneypunct<wchar_t, true> >(one);
+ install_from<moneypunct<wchar_t, false> >(one);
+ install_from<moneypunct<wchar_t, true> >(one);
#endif
- install_from<money_get<char> >(one);
+ install_from<money_get<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<money_get<wchar_t> >(one);
+ install_from<money_get<wchar_t> >(one);
#endif
- install_from<money_put<char> >(one);
+ install_from<money_put<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<money_put<wchar_t> >(one);
+ install_from<money_put<wchar_t> >(one);
#endif
- }
- if (c & locale::numeric)
- {
- install_from<numpunct<char> >(one);
+ }
+ if (c & locale::numeric) {
+ install_from<numpunct<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<numpunct<wchar_t> >(one);
+ install_from<numpunct<wchar_t> >(one);
#endif
- install_from<num_get<char> >(one);
+ install_from<num_get<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<num_get<wchar_t> >(one);
+ install_from<num_get<wchar_t> >(one);
#endif
- install_from<num_put<char> >(one);
+ install_from<num_put<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<num_put<wchar_t> >(one);
+ install_from<num_put<wchar_t> >(one);
#endif
- }
- if (c & locale::time)
- {
- install_from<time_get<char> >(one);
+ }
+ if (c & locale::time) {
+ install_from<time_get<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<time_get<wchar_t> >(one);
+ install_from<time_get<wchar_t> >(one);
#endif
- install_from<time_put<char> >(one);
+ install_from<time_put<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<time_put<wchar_t> >(one);
+ install_from<time_put<wchar_t> >(one);
#endif
- }
- if (c & locale::messages)
- {
- install_from<std::messages<char> >(one);
+ }
+ if (c & locale::messages) {
+ install_from<std::messages<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- install_from<std::messages<wchar_t> >(one);
+ install_from<std::messages<wchar_t> >(one);
#endif
- }
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__release_shared();
- throw;
}
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
+ throw;
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
locale::__imp::__imp(const __imp& other, facet* f, long id)
- : facets_(max<size_t>(N, other.facets_.size()+1)),
- name_("*")
-{
- f->__add_shared();
- unique_ptr<facet, releaser> hold(f);
- facets_ = other.facets_;
- for (unsigned i = 0; i < other.facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__add_shared();
- install(hold.get(), id);
-}
-
-locale::__imp::~__imp()
-{
- for (unsigned i = 0; i < facets_.size(); ++i)
- if (facets_[i])
- facets_[i]->__release_shared();
+ : facets_(max<size_t>(N, other.facets_.size() + 1)), name_("*") {
+ f->__add_shared();
+ unique_ptr<facet, releaser> hold(f);
+ facets_ = other.facets_;
+ for (unsigned i = 0; i < other.facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__add_shared();
+ install(hold.get(), id);
+}
+
+locale::__imp::~__imp() {
+ for (unsigned i = 0; i < facets_.size(); ++i)
+ if (facets_[i])
+ facets_[i]->__release_shared();
}
-void
-locale::__imp::install(facet* f, long id)
-{
- f->__add_shared();
- unique_ptr<facet, releaser> hold(f);
- if (static_cast<size_t>(id) >= facets_.size())
- facets_.resize(static_cast<size_t>(id+1));
- if (facets_[static_cast<size_t>(id)])
- facets_[static_cast<size_t>(id)]->__release_shared();
- facets_[static_cast<size_t>(id)] = hold.release();
+void locale::__imp::install(facet* f, long id) {
+ f->__add_shared();
+ unique_ptr<facet, releaser> hold(f);
+ if (static_cast<size_t>(id) >= facets_.size())
+ facets_.resize(static_cast<size_t>(id + 1));
+ if (facets_[static_cast<size_t>(id)])
+ facets_[static_cast<size_t>(id)]->__release_shared();
+ facets_[static_cast<size_t>(id)] = hold.release();
}
-const locale::facet*
-locale::__imp::use_facet(long id) const
-{
- if (!has_facet(id))
- __throw_bad_cast();
- return facets_[static_cast<size_t>(id)];
+const locale::facet* locale::__imp::use_facet(long id) const {
+ if (!has_facet(id))
+ __throw_bad_cast();
+ return facets_[static_cast<size_t>(id)];
}
// locale
@@ -579,9 +528,7 @@ locale::locale(const locale& l) noexcept : __locale_(l.__locale_) { __locale_->a
locale::~locale() { __locale_->release(); }
-const locale&
-locale::operator=(const locale& other) noexcept
-{
+const locale& locale::operator=(const locale& other) noexcept {
other.__locale_->acquire();
__locale_->release();
__locale_ = other.__locale_;
@@ -589,9 +536,7 @@ locale::operator=(const locale& other) noexcept
}
locale::locale(const char* name)
- : __locale_(name ? new __imp(name)
- : (__throw_runtime_error("locale constructed with null"), nullptr))
-{
+ : __locale_(name ? new __imp(name) : (__throw_runtime_error("locale constructed with null"), nullptr)) {
__locale_->acquire();
}
@@ -599,185 +544,147 @@ locale::locale(const string& name) : __locale_(new __imp(name)) { __locale_->acq
locale::locale(const locale& other, const char* name, category c)
: __locale_(name ? new __imp(*other.__locale_, name, c)
- : (__throw_runtime_error("locale constructed with null"), nullptr))
-{
+ : (__throw_runtime_error("locale constructed with null"), nullptr)) {
__locale_->acquire();
}
-locale::locale(const locale& other, const string& name, category c)
- : __locale_(new __imp(*other.__locale_, name, c))
-{
+locale::locale(const locale& other, const string& name, category c) : __locale_(new __imp(*other.__locale_, name, c)) {
__locale_->acquire();
}
locale::locale(const locale& other, const locale& one, category c)
- : __locale_(new __imp(*other.__locale_, *one.__locale_, c))
-{
+ : __locale_(new __imp(*other.__locale_, *one.__locale_, c)) {
__locale_->acquire();
}
-string
-locale::name() const
-{
- return __locale_->name();
-}
+string locale::name() const { return __locale_->name(); }
-void
-locale::__install_ctor(const locale& other, facet* f, long id)
-{
- if (f)
- __locale_ = new __imp(*other.__locale_, f, id);
- else
- __locale_ = other.__locale_;
- __locale_->acquire();
+void locale::__install_ctor(const locale& other, facet* f, long id) {
+ if (f)
+ __locale_ = new __imp(*other.__locale_, f, id);
+ else
+ __locale_ = other.__locale_;
+ __locale_->acquire();
}
-locale
-locale::global(const locale& loc)
-{
- locale& g = __global();
- locale r = g;
- g = loc;
- if (g.name() != "*")
- setlocale(LC_ALL, g.name().c_str());
- return r;
+locale locale::global(const locale& loc) {
+ locale& g = __global();
+ locale r = g;
+ g = loc;
+ if (g.name() != "*")
+ setlocale(LC_ALL, g.name().c_str());
+ return r;
}
-bool
-locale::has_facet(id& x) const
-{
- return __locale_->has_facet(x.__get());
-}
+bool locale::has_facet(id& x) const { return __locale_->has_facet(x.__get()); }
-const locale::facet*
-locale::use_facet(id& x) const
-{
- return __locale_->use_facet(x.__get());
-}
+const locale::facet* locale::use_facet(id& x) const { return __locale_->use_facet(x.__get()); }
-bool
-locale::operator==(const locale& y) const
-{
- return (__locale_ == y.__locale_)
- || (__locale_->name() != "*" && __locale_->name() == y.__locale_->name());
+bool locale::operator==(const locale& y) const {
+ return (__locale_ == y.__locale_) || (__locale_->name() != "*" && __locale_->name() == y.__locale_->name());
}
// locale::facet
-locale::facet::~facet()
-{
-}
+locale::facet::~facet() {}
-void
-locale::facet::__on_zero_shared() noexcept
-{
- delete this;
-}
+void locale::facet::__on_zero_shared() noexcept { delete this; }
// locale::id
constinit int32_t locale::id::__next_id = 0;
long locale::id::__get() {
- call_once(__flag_, [&] { __id_ = __libcpp_atomic_add(&__next_id, 1); });
- return __id_ - 1;
+ call_once(__flag_, [&] { __id_ = __libcpp_atomic_add(&__next_id, 1); });
+ return __id_ - 1;
}
// template <> class collate_byname<char>
collate_byname<char>::collate_byname(const char* n, size_t refs)
- : collate<char>(refs),
- __l_(newlocale(LC_ALL_MASK, n, 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("collate_byname<char>::collate_byname"
- " failed to construct for " + string(n)).c_str());
+ : collate<char>(refs), __l_(newlocale(LC_ALL_MASK, n, 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("collate_byname<char>::collate_byname"
+ " failed to construct for " +
+ string(n))
+ .c_str());
}
collate_byname<char>::collate_byname(const string& name, size_t refs)
- : collate<char>(refs),
- __l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("collate_byname<char>::collate_byname"
- " failed to construct for " + name).c_str());
-}
-
-collate_byname<char>::~collate_byname()
-{
- freelocale(__l_);
-}
-
-int
-collate_byname<char>::do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const
-{
- string_type lhs(__lo1, __hi1);
- string_type rhs(__lo2, __hi2);
- int r = strcoll_l(lhs.c_str(), rhs.c_str(), __l_);
- if (r < 0)
- return -1;
- if (r > 0)
- return 1;
- return r;
+ : collate<char>(refs), __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("collate_byname<char>::collate_byname"
+ " failed to construct for " +
+ name)
+ .c_str());
+}
+
+collate_byname<char>::~collate_byname() { freelocale(__l_); }
+
+int collate_byname<char>::do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const {
+ string_type lhs(__lo1, __hi1);
+ string_type rhs(__lo2, __hi2);
+ int r = strcoll_l(lhs.c_str(), rhs.c_str(), __l_);
+ if (r < 0)
+ return -1;
+ if (r > 0)
+ return 1;
+ return r;
}
-collate_byname<char>::string_type
-collate_byname<char>::do_transform(const char_type* lo, const char_type* hi) const
-{
- const string_type in(lo, hi);
- string_type out(strxfrm_l(0, in.c_str(), 0, __l_), char());
- strxfrm_l(const_cast<char*>(out.c_str()), in.c_str(), out.size()+1, __l_);
- return out;
+collate_byname<char>::string_type collate_byname<char>::do_transform(const char_type* lo, const char_type* hi) const {
+ const string_type in(lo, hi);
+ string_type out(strxfrm_l(0, in.c_str(), 0, __l_), char());
+ strxfrm_l(const_cast<char*>(out.c_str()), in.c_str(), out.size() + 1, __l_);
+ return out;
}
// template <> class collate_byname<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
- : collate<wchar_t>(refs),
- __l_(newlocale(LC_ALL_MASK, n, 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("collate_byname<wchar_t>::collate_byname(size_t refs)"
- " failed to construct for " + string(n)).c_str());
+ : collate<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, n, 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("collate_byname<wchar_t>::collate_byname(size_t refs)"
+ " failed to construct for " +
+ string(n))
+ .c_str());
}
collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
- : collate<wchar_t>(refs),
- __l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("collate_byname<wchar_t>::collate_byname(size_t refs)"
- " failed to construct for " + name).c_str());
-}
-
-collate_byname<wchar_t>::~collate_byname()
-{
- freelocale(__l_);
-}
-
-int
-collate_byname<wchar_t>::do_compare(const char_type* __lo1, const char_type* __hi1,
- const char_type* __lo2, const char_type* __hi2) const
-{
- string_type lhs(__lo1, __hi1);
- string_type rhs(__lo2, __hi2);
- int r = wcscoll_l(lhs.c_str(), rhs.c_str(), __l_);
- if (r < 0)
- return -1;
- if (r > 0)
- return 1;
- return r;
+ : collate<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("collate_byname<wchar_t>::collate_byname(size_t refs)"
+ " failed to construct for " +
+ name)
+ .c_str());
+}
+
+collate_byname<wchar_t>::~collate_byname() { freelocale(__l_); }
+
+int collate_byname<wchar_t>::do_compare(
+ const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const {
+ string_type lhs(__lo1, __hi1);
+ string_type rhs(__lo2, __hi2);
+ int r = wcscoll_l(lhs.c_str(), rhs.c_str(), __l_);
+ if (r < 0)
+ return -1;
+ if (r > 0)
+ return 1;
+ return r;
}
collate_byname<wchar_t>::string_type
-collate_byname<wchar_t>::do_transform(const char_type* lo, const char_type* hi) const
-{
- const string_type in(lo, hi);
- string_type out(wcsxfrm_l(0, in.c_str(), 0, __l_), wchar_t());
- wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size()+1, __l_);
- return out;
+collate_byname<wchar_t>::do_transform(const char_type* lo, const char_type* hi) const {
+ const string_type in(lo, hi);
+ string_type out(wcsxfrm_l(0, in.c_str(), 0, __l_), wchar_t());
+ wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size() + 1, __l_);
+ return out;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -799,132 +706,97 @@ const ctype_base::mask ctype_base::graph;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
constinit locale::id ctype<wchar_t>::id;
-ctype<wchar_t>::~ctype()
-{
-}
+ctype<wchar_t>::~ctype() {}
-bool
-ctype<wchar_t>::do_is(mask m, char_type c) const
-{
- return isascii(c) ? (ctype<char>::classic_table()[c] & m) != 0 : false;
+bool ctype<wchar_t>::do_is(mask m, char_type c) const {
+ return isascii(c) ? (ctype<char>::classic_table()[c] & m) != 0 : false;
}
-const wchar_t*
-ctype<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
-{
- for (; low != high; ++low, ++vec)
- *vec = static_cast<mask>(isascii(*low) ?
- ctype<char>::classic_table()[*low] : 0);
- return low;
+const wchar_t* ctype<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const {
+ for (; low != high; ++low, ++vec)
+ *vec = static_cast<mask>(isascii(*low) ? ctype<char>::classic_table()[*low] : 0);
+ return low;
}
-const wchar_t*
-ctype<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- if (isascii(*low) && (ctype<char>::classic_table()[*low] & m))
- break;
- return low;
+const wchar_t* ctype<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+ if (isascii(*low) && (ctype<char>::classic_table()[*low] & m))
+ break;
+ return low;
}
-const wchar_t*
-ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- if (!(isascii(*low) && (ctype<char>::classic_table()[*low] & m)))
- break;
- return low;
+const wchar_t* ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+ if (!(isascii(*low) && (ctype<char>::classic_table()[*low] & m)))
+ break;
+ return low;
}
-wchar_t
-ctype<wchar_t>::do_toupper(char_type c) const
-{
-#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
- defined(__NetBSD__) || defined(__MVS__)
- return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
-#else
- return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
-#endif
+wchar_t ctype<wchar_t>::do_toupper(char_type c) const {
+# ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
+ return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
+# elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__MVS__)
+ return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
+# else
+ return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c - L'a' + L'A' : c;
+# endif
}
-const wchar_t*
-ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
-#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
- defined(__NetBSD__) || defined(__MVS__)
- *low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
- : *low;
-#else
- *low = (isascii(*low) && islower_l(*low, _LIBCPP_GET_C_LOCALE)) ? (*low-L'a'+L'A') : *low;
-#endif
- return low;
+const wchar_t* ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+# ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
+ *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
+# elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__MVS__)
+ *low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low] : *low;
+# else
+ *low = (isascii(*low) && islower_l(*low, _LIBCPP_GET_C_LOCALE)) ? (*low - L'a' + L'A') : *low;
+# endif
+ return low;
}
-wchar_t
-ctype<wchar_t>::do_tolower(char_type c) const
-{
-#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
- defined(__NetBSD__) || defined(__MVS__)
- return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
-#else
- return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
-#endif
+wchar_t ctype<wchar_t>::do_tolower(char_type c) const {
+# ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
+ return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
+# elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__MVS__)
+ return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
+# else
+ return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c - L'A' + 'a' : c;
+# endif
}
-const wchar_t*
-ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
-#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
- defined(__NetBSD__) || defined(__MVS__)
- *low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
- : *low;
-#else
- *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-L'A'+L'a' : *low;
-#endif
- return low;
+const wchar_t* ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+# ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
+ *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
+# elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__MVS__)
+ *low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low] : *low;
+# else
+ *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low - L'A' + L'a' : *low;
+# endif
+ return low;
}
-wchar_t
-ctype<wchar_t>::do_widen(char c) const
-{
- return c;
-}
+wchar_t ctype<wchar_t>::do_widen(char c) const { return c; }
-const char*
-ctype<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
-{
- for (; low != high; ++low, ++dest)
- *dest = *low;
- return low;
+const char* ctype<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const {
+ for (; low != high; ++low, ++dest)
+ *dest = *low;
+ return low;
}
-char
-ctype<wchar_t>::do_narrow(char_type c, char dfault) const
-{
- if (isascii(c))
- return static_cast<char>(c);
- return dfault;
+char ctype<wchar_t>::do_narrow(char_type c, char dfault) const {
+ if (isascii(c))
+ return static_cast<char>(c);
+ return dfault;
}
-const wchar_t*
-ctype<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
-{
- for (; low != high; ++low, ++dest)
- if (isascii(*low))
- *dest = static_cast<char>(*low);
- else
- *dest = dfault;
- return low;
+const wchar_t* ctype<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const {
+ for (; low != high; ++low, ++dest)
+ if (isascii(*low))
+ *dest = static_cast<char>(*low);
+ else
+ *dest = dfault;
+ return low;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -934,130 +806,99 @@ constinit locale::id ctype<char>::id;
const size_t ctype<char>::table_size;
-ctype<char>::ctype(const mask* tab, bool del, size_t refs)
- : locale::facet(refs),
- __tab_(tab),
- __del_(del)
-{
+ctype<char>::ctype(const mask* tab, bool del, size_t refs) : locale::facet(refs), __tab_(tab), __del_(del) {
if (__tab_ == 0)
- __tab_ = classic_table();
+ __tab_ = classic_table();
}
-ctype<char>::~ctype()
-{
- if (__tab_ && __del_)
- delete [] __tab_;
+ctype<char>::~ctype() {
+ if (__tab_ && __del_)
+ delete[] __tab_;
}
-char
-ctype<char>::do_toupper(char_type c) const
-{
+char ctype<char>::do_toupper(char_type c) const {
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ?
- static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
+ return isascii(c) ? static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__NetBSD__)
- return static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]);
+ return static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__MVS__)
- return isascii(c) ?
- static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c;
+ return isascii(c) ? static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c;
#else
- return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
+ return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c - 'a' + 'A' : c;
#endif
}
-const char*
-ctype<char>::do_toupper(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
+const char* ctype<char>::do_toupper(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ?
- static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
+ *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__NetBSD__)
- *low = static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(*low)]);
+ *low = static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(*low)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__MVS__)
- *low = isascii(*low) ?
- static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
+ *low = isascii(*low) ? static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
#else
- *low = (isascii(*low) && islower_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'a'+'A' : *low;
+ *low = (isascii(*low) && islower_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low - 'a' + 'A' : *low;
#endif
- return low;
+ return low;
}
-char
-ctype<char>::do_tolower(char_type c) const
-{
+char ctype<char>::do_tolower(char_type c) const {
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ?
- static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
+ return isascii(c) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__NetBSD__)
- return static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(c)]);
+ return static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__MVS__)
- return isascii(c) ?
- static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
+ return isascii(c) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
#else
- return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'A'+'a' : c;
+ return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c - 'A' + 'a' : c;
#endif
}
-const char*
-ctype<char>::do_tolower(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
+const char* ctype<char>::do_tolower(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
+ *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__NetBSD__)
- *low = static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(*low)]);
+ *low = static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(*low)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__MVS__)
- *low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
+ *low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
#else
- *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
+ *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low - 'A' + 'a' : *low;
#endif
- return low;
+ return low;
}
-char
-ctype<char>::do_widen(char c) const
-{
- return c;
-}
+char ctype<char>::do_widen(char c) const { return c; }
-const char*
-ctype<char>::do_widen(const char* low, const char* high, char_type* dest) const
-{
- for (; low != high; ++low, ++dest)
- *dest = *low;
- return low;
+const char* ctype<char>::do_widen(const char* low, const char* high, char_type* dest) const {
+ for (; low != high; ++low, ++dest)
+ *dest = *low;
+ return low;
}
-char
-ctype<char>::do_narrow(char_type c, char dfault) const
-{
- if (isascii(c))
- return static_cast<char>(c);
- return dfault;
+char ctype<char>::do_narrow(char_type c, char dfault) const {
+ if (isascii(c))
+ return static_cast<char>(c);
+ return dfault;
}
-const char*
-ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
-{
- for (; low != high; ++low, ++dest)
- if (isascii(*low))
- *dest = *low;
- else
- *dest = dfault;
- return low;
+const char* ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const {
+ for (; low != high; ++low, ++dest)
+ if (isascii(*low))
+ *dest = *low;
+ else
+ *dest = dfault;
+ return low;
}
#if defined(__EMSCRIPTEN__)
-extern "C" const unsigned short ** __ctype_b_loc();
-extern "C" const int ** __ctype_tolower_loc();
-extern "C" const int ** __ctype_toupper_loc();
+extern "C" const unsigned short** __ctype_b_loc();
+extern "C" const int** __ctype_tolower_loc();
+extern "C" const int** __ctype_toupper_loc();
#endif
#ifdef _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
-const ctype<char>::mask*
-ctype<char>::classic_table() noexcept
-{
+const ctype<char>::mask* ctype<char>::classic_table() noexcept {
// clang-format off
static constexpr const ctype<char>::mask builtin_table[table_size] = {
cntrl, cntrl,
@@ -1134,354 +975,310 @@ ctype<char>::classic_table() noexcept
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
// clang-format on
- return builtin_table;
+ return builtin_table;
}
#else
-const ctype<char>::mask*
-ctype<char>::classic_table() noexcept
-{
-#if defined(__APPLE__) || defined(__FreeBSD__)
- return _DefaultRuneLocale.__runetype;
-#elif defined(__NetBSD__)
- return _C_ctype_tab_ + 1;
-#elif defined(__GLIBC__)
- return _LIBCPP_GET_C_LOCALE->__ctype_b;
-#elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- return __pctype_func();
-#elif defined(__EMSCRIPTEN__)
- return *__ctype_b_loc();
-#elif defined(_NEWLIB_VERSION)
- // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
- return _ctype_ + 1;
-#elif defined(_AIX)
- return (const unsigned int *)__lc_ctype_ptr->obj->mask;
-#elif defined(__MVS__)
-# if defined(__NATIVE_ASCII_F)
- return const_cast<const ctype<char>::mask*> (__OBJ_DATA(__lc_ctype_a)->mask);
-# else
- return const_cast<const ctype<char>::mask*> (__ctypec);
-# endif
-#else
- // Platform not supported: abort so the person doing the port knows what to
- // fix
-# warning ctype<char>::classic_table() is not implemented
- printf("ctype<char>::classic_table() is not implemented\n");
- abort();
- return NULL;
-#endif
+const ctype<char>::mask* ctype<char>::classic_table() noexcept {
+# if defined(__APPLE__) || defined(__FreeBSD__)
+ return _DefaultRuneLocale.__runetype;
+# elif defined(__NetBSD__)
+ return _C_ctype_tab_ + 1;
+# elif defined(__GLIBC__)
+ return _LIBCPP_GET_C_LOCALE->__ctype_b;
+# elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+ return __pctype_func();
+# elif defined(__EMSCRIPTEN__)
+ return *__ctype_b_loc();
+# elif defined(_NEWLIB_VERSION)
+ // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
+ return _ctype_ + 1;
+# elif defined(_AIX)
+ return (const unsigned int*)__lc_ctype_ptr->obj->mask;
+# elif defined(__MVS__)
+# if defined(__NATIVE_ASCII_F)
+ return const_cast<const ctype<char>::mask*>(__OBJ_DATA(__lc_ctype_a)->mask);
+# else
+ return const_cast<const ctype<char>::mask*>(__ctypec);
+# endif
+# else
+ // Platform not supported: abort so the person doing the port knows what to
+ // fix
+# warning ctype<char>::classic_table() is not implemented
+ printf("ctype<char>::classic_table() is not implemented\n");
+ abort();
+ return NULL;
+# endif
}
#endif
#if defined(__GLIBC__)
-const int*
-ctype<char>::__classic_lower_table() noexcept
-{
- return _LIBCPP_GET_C_LOCALE->__ctype_tolower;
-}
+const int* ctype<char>::__classic_lower_table() noexcept { return _LIBCPP_GET_C_LOCALE->__ctype_tolower; }
-const int*
-ctype<char>::__classic_upper_table() noexcept
-{
- return _LIBCPP_GET_C_LOCALE->__ctype_toupper;
-}
+const int* ctype<char>::__classic_upper_table() noexcept { return _LIBCPP_GET_C_LOCALE->__ctype_toupper; }
#elif defined(__NetBSD__)
-const short*
-ctype<char>::__classic_lower_table() noexcept
-{
- return _C_tolower_tab_ + 1;
-}
+const short* ctype<char>::__classic_lower_table() noexcept { return _C_tolower_tab_ + 1; }
-const short*
-ctype<char>::__classic_upper_table() noexcept
-{
- return _C_toupper_tab_ + 1;
-}
+const short* ctype<char>::__classic_upper_table() noexcept { return _C_toupper_tab_ + 1; }
#elif defined(__EMSCRIPTEN__)
-const int*
-ctype<char>::__classic_lower_table() noexcept
-{
- return *__ctype_tolower_loc();
-}
+const int* ctype<char>::__classic_lower_table() noexcept { return *__ctype_tolower_loc(); }
-const int*
-ctype<char>::__classic_upper_table() noexcept
-{
- return *__ctype_toupper_loc();
-}
+const int* ctype<char>::__classic_upper_table() noexcept { return *__ctype_toupper_loc(); }
#elif defined(__MVS__)
-const unsigned short*
-ctype<char>::__classic_lower_table() _NOEXCEPT
-{
-# if defined(__NATIVE_ASCII_F)
+const unsigned short* ctype<char>::__classic_lower_table() _NOEXCEPT {
+# if defined(__NATIVE_ASCII_F)
return const_cast<const unsigned short*>(__OBJ_DATA(__lc_ctype_a)->lower);
-# else
+# else
return const_cast<const unsigned short*>(__ctype + __TOLOWER_INDEX);
-# endif
+# endif
}
-const unsigned short *
-ctype<char>::__classic_upper_table() _NOEXCEPT
-{
-# if defined(__NATIVE_ASCII_F)
+const unsigned short* ctype<char>::__classic_upper_table() _NOEXCEPT {
+# if defined(__NATIVE_ASCII_F)
return const_cast<const unsigned short*>(__OBJ_DATA(__lc_ctype_a)->upper);
-# else
+# else
return const_cast<const unsigned short*>(__ctype + __TOUPPER_INDEX);
-# endif
+# endif
}
#endif // __GLIBC__ || __NETBSD__ || __EMSCRIPTEN__ || __MVS__
// template <> class ctype_byname<char>
ctype_byname<char>::ctype_byname(const char* name, size_t refs)
- : ctype<char>(0, false, refs),
- __l_(newlocale(LC_ALL_MASK, name, 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("ctype_byname<char>::ctype_byname"
- " failed to construct for " + string(name)).c_str());
+ : ctype<char>(0, false, refs), __l_(newlocale(LC_ALL_MASK, name, 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("ctype_byname<char>::ctype_byname"
+ " failed to construct for " +
+ string(name))
+ .c_str());
}
ctype_byname<char>::ctype_byname(const string& name, size_t refs)
- : ctype<char>(0, false, refs),
- __l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("ctype_byname<char>::ctype_byname"
- " failed to construct for " + name).c_str());
+ : ctype<char>(0, false, refs), __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("ctype_byname<char>::ctype_byname"
+ " failed to construct for " +
+ name)
+ .c_str());
}
-ctype_byname<char>::~ctype_byname()
-{
- freelocale(__l_);
-}
+ctype_byname<char>::~ctype_byname() { freelocale(__l_); }
-char
-ctype_byname<char>::do_toupper(char_type c) const
-{
- return static_cast<char>(toupper_l(static_cast<unsigned char>(c), __l_));
+char ctype_byname<char>::do_toupper(char_type c) const {
+ return static_cast<char>(toupper_l(static_cast<unsigned char>(c), __l_));
}
-const char*
-ctype_byname<char>::do_toupper(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- *low = static_cast<char>(toupper_l(static_cast<unsigned char>(*low), __l_));
- return low;
+const char* ctype_byname<char>::do_toupper(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+ *low = static_cast<char>(toupper_l(static_cast<unsigned char>(*low), __l_));
+ return low;
}
-char
-ctype_byname<char>::do_tolower(char_type c) const
-{
- return static_cast<char>(tolower_l(static_cast<unsigned char>(c), __l_));
+char ctype_byname<char>::do_tolower(char_type c) const {
+ return static_cast<char>(tolower_l(static_cast<unsigned char>(c), __l_));
}
-const char*
-ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- *low = static_cast<char>(tolower_l(static_cast<unsigned char>(*low), __l_));
- return low;
+const char* ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+ *low = static_cast<char>(tolower_l(static_cast<unsigned char>(*low), __l_));
+ return low;
}
// template <> class ctype_byname<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
- : ctype<wchar_t>(refs),
- __l_(newlocale(LC_ALL_MASK, name, 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("ctype_byname<wchar_t>::ctype_byname"
- " failed to construct for " + string(name)).c_str());
+ : ctype<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, name, 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("ctype_byname<wchar_t>::ctype_byname"
+ " failed to construct for " +
+ string(name))
+ .c_str());
}
ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
- : ctype<wchar_t>(refs),
- __l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("ctype_byname<wchar_t>::ctype_byname"
- " failed to construct for " + name).c_str());
-}
-
-ctype_byname<wchar_t>::~ctype_byname()
-{
- freelocale(__l_);
-}
-
-bool
-ctype_byname<wchar_t>::do_is(mask m, char_type c) const
-{
-#ifdef _LIBCPP_WCTYPE_IS_MASK
- return static_cast<bool>(iswctype_l(c, m, __l_));
-#else
- bool result = false;
- wint_t ch = static_cast<wint_t>(c);
- if ((m & space) == space) result |= (iswspace_l(ch, __l_) != 0);
- if ((m & print) == print) result |= (iswprint_l(ch, __l_) != 0);
- if ((m & cntrl) == cntrl) result |= (iswcntrl_l(ch, __l_) != 0);
- if ((m & upper) == upper) result |= (iswupper_l(ch, __l_) != 0);
- if ((m & lower) == lower) result |= (iswlower_l(ch, __l_) != 0);
- if ((m & alpha) == alpha) result |= (iswalpha_l(ch, __l_) != 0);
- if ((m & digit) == digit) result |= (iswdigit_l(ch, __l_) != 0);
- if ((m & punct) == punct) result |= (iswpunct_l(ch, __l_) != 0);
- if ((m & xdigit) == xdigit) result |= (iswxdigit_l(ch, __l_) != 0);
- if ((m & blank) == blank) result |= (iswblank_l(ch, __l_) != 0);
- return result;
-#endif
-}
-
-const wchar_t*
-ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
-{
- for (; low != high; ++low, ++vec)
- {
- if (isascii(*low))
- *vec = static_cast<mask>(ctype<char>::classic_table()[*low]);
- else
- {
- *vec = 0;
- wint_t ch = static_cast<wint_t>(*low);
- if (iswspace_l(ch, __l_))
- *vec |= space;
-#ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
- if (iswprint_l(ch, __l_))
- *vec |= print;
-#endif
- if (iswcntrl_l(ch, __l_))
- *vec |= cntrl;
- if (iswupper_l(ch, __l_))
- *vec |= upper;
- if (iswlower_l(ch, __l_))
- *vec |= lower;
-#ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
- if (iswalpha_l(ch, __l_))
- *vec |= alpha;
-#endif
- if (iswdigit_l(ch, __l_))
- *vec |= digit;
- if (iswpunct_l(ch, __l_))
- *vec |= punct;
-#ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
- if (iswxdigit_l(ch, __l_))
- *vec |= xdigit;
-#endif
- if (iswblank_l(ch, __l_))
- *vec |= blank;
- }
- }
- return low;
-}
-
-const wchar_t*
-ctype_byname<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- {
-#ifdef _LIBCPP_WCTYPE_IS_MASK
- if (iswctype_l(*low, m, __l_))
- break;
-#else
- wint_t ch = static_cast<wint_t>(*low);
- if ((m & space) == space && iswspace_l(ch, __l_)) break;
- if ((m & print) == print && iswprint_l(ch, __l_)) break;
- if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l_)) break;
- if ((m & upper) == upper && iswupper_l(ch, __l_)) break;
- if ((m & lower) == lower && iswlower_l(ch, __l_)) break;
- if ((m & alpha) == alpha && iswalpha_l(ch, __l_)) break;
- if ((m & digit) == digit && iswdigit_l(ch, __l_)) break;
- if ((m & punct) == punct && iswpunct_l(ch, __l_)) break;
- if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l_)) break;
- if ((m & blank) == blank && iswblank_l(ch, __l_)) break;
-#endif
- }
- return low;
-}
-
-const wchar_t*
-ctype_byname<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- {
-#ifdef _LIBCPP_WCTYPE_IS_MASK
- if (!iswctype_l(*low, m, __l_))
- break;
-#else
- wint_t ch = static_cast<wint_t>(*low);
- if ((m & space) == space && iswspace_l(ch, __l_)) continue;
- if ((m & print) == print && iswprint_l(ch, __l_)) continue;
- if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l_)) continue;
- if ((m & upper) == upper && iswupper_l(ch, __l_)) continue;
- if ((m & lower) == lower && iswlower_l(ch, __l_)) continue;
- if ((m & alpha) == alpha && iswalpha_l(ch, __l_)) continue;
- if ((m & digit) == digit && iswdigit_l(ch, __l_)) continue;
- if ((m & punct) == punct && iswpunct_l(ch, __l_)) continue;
- if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l_)) continue;
- if ((m & blank) == blank && iswblank_l(ch, __l_)) continue;
- break;
-#endif
+ : ctype<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("ctype_byname<wchar_t>::ctype_byname"
+ " failed to construct for " +
+ name)
+ .c_str());
+}
+
+ctype_byname<wchar_t>::~ctype_byname() { freelocale(__l_); }
+
+bool ctype_byname<wchar_t>::do_is(mask m, char_type c) const {
+# ifdef _LIBCPP_WCTYPE_IS_MASK
+ return static_cast<bool>(iswctype_l(c, m, __l_));
+# else
+ bool result = false;
+ wint_t ch = static_cast<wint_t>(c);
+ if ((m & space) == space)
+ result |= (iswspace_l(ch, __l_) != 0);
+ if ((m & print) == print)
+ result |= (iswprint_l(ch, __l_) != 0);
+ if ((m & cntrl) == cntrl)
+ result |= (iswcntrl_l(ch, __l_) != 0);
+ if ((m & upper) == upper)
+ result |= (iswupper_l(ch, __l_) != 0);
+ if ((m & lower) == lower)
+ result |= (iswlower_l(ch, __l_) != 0);
+ if ((m & alpha) == alpha)
+ result |= (iswalpha_l(ch, __l_) != 0);
+ if ((m & digit) == digit)
+ result |= (iswdigit_l(ch, __l_) != 0);
+ if ((m & punct) == punct)
+ result |= (iswpunct_l(ch, __l_) != 0);
+ if ((m & xdigit) == xdigit)
+ result |= (iswxdigit_l(ch, __l_) != 0);
+ if ((m & blank) == blank)
+ result |= (iswblank_l(ch, __l_) != 0);
+ return result;
+# endif
+}
+
+const wchar_t* ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const {
+ for (; low != high; ++low, ++vec) {
+ if (isascii(*low))
+ *vec = static_cast<mask>(ctype<char>::classic_table()[*low]);
+ else {
+ *vec = 0;
+ wint_t ch = static_cast<wint_t>(*low);
+ if (iswspace_l(ch, __l_))
+ *vec |= space;
+# ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
+ if (iswprint_l(ch, __l_))
+ *vec |= print;
+# endif
+ if (iswcntrl_l(ch, __l_))
+ *vec |= cntrl;
+ if (iswupper_l(ch, __l_))
+ *vec |= upper;
+ if (iswlower_l(ch, __l_))
+ *vec |= lower;
+# ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
+ if (iswalpha_l(ch, __l_))
+ *vec |= alpha;
+# endif
+ if (iswdigit_l(ch, __l_))
+ *vec |= digit;
+ if (iswpunct_l(ch, __l_))
+ *vec |= punct;
+# ifndef _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
+ if (iswxdigit_l(ch, __l_))
+ *vec |= xdigit;
+# endif
+ if (iswblank_l(ch, __l_))
+ *vec |= blank;
}
- return low;
+ }
+ return low;
+}
+
+const wchar_t* ctype_byname<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const {
+ for (; low != high; ++low) {
+# ifdef _LIBCPP_WCTYPE_IS_MASK
+ if (iswctype_l(*low, m, __l_))
+ break;
+# else
+ wint_t ch = static_cast<wint_t>(*low);
+ if ((m & space) == space && iswspace_l(ch, __l_))
+ break;
+ if ((m & print) == print && iswprint_l(ch, __l_))
+ break;
+ if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l_))
+ break;
+ if ((m & upper) == upper && iswupper_l(ch, __l_))
+ break;
+ if ((m & lower) == lower && iswlower_l(ch, __l_))
+ break;
+ if ((m & alpha) == alpha && iswalpha_l(ch, __l_))
+ break;
+ if ((m & digit) == digit && iswdigit_l(ch, __l_))
+ break;
+ if ((m & punct) == punct && iswpunct_l(ch, __l_))
+ break;
+ if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l_))
+ break;
+ if ((m & blank) == blank && iswblank_l(ch, __l_))
+ break;
+# endif
+ }
+ return low;
+}
+
+const wchar_t* ctype_byname<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const {
+ for (; low != high; ++low) {
+# ifdef _LIBCPP_WCTYPE_IS_MASK
+ if (!iswctype_l(*low, m, __l_))
+ break;
+# else
+ wint_t ch = static_cast<wint_t>(*low);
+ if ((m & space) == space && iswspace_l(ch, __l_))
+ continue;
+ if ((m & print) == print && iswprint_l(ch, __l_))
+ continue;
+ if ((m & cntrl) == cntrl && iswcntrl_l(ch, __l_))
+ continue;
+ if ((m & upper) == upper && iswupper_l(ch, __l_))
+ continue;
+ if ((m & lower) == lower && iswlower_l(ch, __l_))
+ continue;
+ if ((m & alpha) == alpha && iswalpha_l(ch, __l_))
+ continue;
+ if ((m & digit) == digit && iswdigit_l(ch, __l_))
+ continue;
+ if ((m & punct) == punct && iswpunct_l(ch, __l_))
+ continue;
+ if ((m & xdigit) == xdigit && iswxdigit_l(ch, __l_))
+ continue;
+ if ((m & blank) == blank && iswblank_l(ch, __l_))
+ continue;
+ break;
+# endif
+ }
+ return low;
}
-wchar_t
-ctype_byname<wchar_t>::do_toupper(char_type c) const
-{
- return towupper_l(c, __l_);
-}
+wchar_t ctype_byname<wchar_t>::do_toupper(char_type c) const { return towupper_l(c, __l_); }
-const wchar_t*
-ctype_byname<wchar_t>::do_toupper(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- *low = towupper_l(*low, __l_);
- return low;
+const wchar_t* ctype_byname<wchar_t>::do_toupper(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+ *low = towupper_l(*low, __l_);
+ return low;
}
-wchar_t
-ctype_byname<wchar_t>::do_tolower(char_type c) const
-{
- return towlower_l(c, __l_);
-}
+wchar_t ctype_byname<wchar_t>::do_tolower(char_type c) const { return towlower_l(c, __l_); }
-const wchar_t*
-ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const
-{
- for (; low != high; ++low)
- *low = towlower_l(*low, __l_);
- return low;
+const wchar_t* ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const {
+ for (; low != high; ++low)
+ *low = towlower_l(*low, __l_);
+ return low;
}
-wchar_t
-ctype_byname<wchar_t>::do_widen(char c) const
-{
- return __libcpp_btowc_l(c, __l_);
-}
+wchar_t ctype_byname<wchar_t>::do_widen(char c) const { return __libcpp_btowc_l(c, __l_); }
-const char*
-ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
-{
- for (; low != high; ++low, ++dest)
- *dest = __libcpp_btowc_l(*low, __l_);
- return low;
+const char* ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const {
+ for (; low != high; ++low, ++dest)
+ *dest = __libcpp_btowc_l(*low, __l_);
+ return low;
}
-char
-ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
-{
- int r = __libcpp_wctob_l(c, __l_);
- return (r != EOF) ? static_cast<char>(r) : dfault;
+char ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const {
+ int r = __libcpp_wctob_l(c, __l_);
+ return (r != EOF) ? static_cast<char>(r) : dfault;
}
const wchar_t*
-ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
-{
- for (; low != high; ++low, ++dest)
- {
- int r = __libcpp_wctob_l(*low, __l_);
- *dest = (r != EOF) ? static_cast<char>(r) : dfault;
- }
- return low;
+ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const {
+ for (; low != high; ++low, ++dest) {
+ int r = __libcpp_wctob_l(*low, __l_);
+ *dest = (r != EOF) ? static_cast<char>(r) : dfault;
+ }
+ return low;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -1489,277 +1286,245 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
constinit locale::id codecvt<char, char, mbstate_t>::id;
-codecvt<char, char, mbstate_t>::~codecvt()
-{
+codecvt<char, char, mbstate_t>::~codecvt() {}
+
+codecvt<char, char, mbstate_t>::result codecvt<char, char, mbstate_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type*,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type*,
+ extern_type*& to_nxt) const {
+ frm_nxt = frm;
+ to_nxt = to;
+ return noconv;
+}
+
+codecvt<char, char, mbstate_t>::result codecvt<char, char, mbstate_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type*,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type*,
+ intern_type*& to_nxt) const {
+ frm_nxt = frm;
+ to_nxt = to;
+ return noconv;
}
codecvt<char, char, mbstate_t>::result
-codecvt<char, char, mbstate_t>::do_out(state_type&,
- const intern_type* frm, const intern_type*, const intern_type*& frm_nxt,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- frm_nxt = frm;
- to_nxt = to;
- return noconv;
+codecvt<char, char, mbstate_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-codecvt<char, char, mbstate_t>::result
-codecvt<char, char, mbstate_t>::do_in(state_type&,
- const extern_type* frm, const extern_type*, const extern_type*& frm_nxt,
- intern_type* to, intern_type*, intern_type*& to_nxt) const
-{
- frm_nxt = frm;
- to_nxt = to;
- return noconv;
-}
+int codecvt<char, char, mbstate_t>::do_encoding() const noexcept { return 1; }
-codecvt<char, char, mbstate_t>::result
-codecvt<char, char, mbstate_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
-
-int
-codecvt<char, char, mbstate_t>::do_encoding() const noexcept
-{
- return 1;
-}
-
-bool
-codecvt<char, char, mbstate_t>::do_always_noconv() const noexcept
-{
- return true;
-}
+bool codecvt<char, char, mbstate_t>::do_always_noconv() const noexcept { return true; }
-int
-codecvt<char, char, mbstate_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* end, size_t mx) const
-{
- return static_cast<int>(min<size_t>(mx, static_cast<size_t>(end-frm)));
+int codecvt<char, char, mbstate_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* end, size_t mx) const {
+ return static_cast<int>(min<size_t>(mx, static_cast<size_t>(end - frm)));
}
-int
-codecvt<char, char, mbstate_t>::do_max_length() const noexcept
-{
- return 1;
-}
+int codecvt<char, char, mbstate_t>::do_max_length() const noexcept { return 1; }
// template <> class codecvt<wchar_t, char, mbstate_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
constinit locale::id codecvt<wchar_t, char, mbstate_t>::id;
-codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs)
- : locale::facet(refs),
- __l_(_LIBCPP_GET_C_LOCALE)
-{
-}
+codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs) : locale::facet(refs), __l_(_LIBCPP_GET_C_LOCALE) {}
codecvt<wchar_t, char, mbstate_t>::codecvt(const char* nm, size_t refs)
- : locale::facet(refs),
- __l_(newlocale(LC_ALL_MASK, nm, 0))
-{
- if (__l_ == 0)
- __throw_runtime_error(("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
- " failed to construct for " + string(nm)).c_str());
-}
-
-codecvt<wchar_t, char, mbstate_t>::~codecvt()
-{
- if (__l_ != _LIBCPP_GET_C_LOCALE)
- freelocale(__l_);
-}
-
-codecvt<wchar_t, char, mbstate_t>::result
-codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- // look for first internal null in frm
- const intern_type* fend = frm;
- for (; fend != frm_end; ++fend)
- if (*fend == 0)
- break;
- // loop over all null-terminated sequences in frm
- to_nxt = to;
- for (frm_nxt = frm; frm != frm_end && to != to_end; frm = frm_nxt, to = to_nxt)
- {
- // save state in case it is needed to recover to_nxt on error
- mbstate_t save_state = st;
- size_t n = __libcpp_wcsnrtombs_l(to, &frm_nxt, static_cast<size_t>(fend-frm),
- static_cast<size_t>(to_end-to), &st, __l_);
- if (n == size_t(-1))
- {
- // need to recover to_nxt
- for (to_nxt = to; frm != frm_nxt; ++frm)
- {
- n = __libcpp_wcrtomb_l(to_nxt, *frm, &save_state, __l_);
- if (n == size_t(-1))
- break;
- to_nxt += n;
- }
- frm_nxt = frm;
- return error;
- }
- if (n == 0)
- return partial;
- to_nxt += n;
- if (to_nxt == to_end)
- break;
- if (fend != frm_end) // set up next null terminated sequence
- {
- // Try to write the terminating null
- extern_type tmp[MB_LEN_MAX];
- n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l_);
- if (n == size_t(-1)) // on error
- return error;
- if (n > static_cast<size_t>(to_end-to_nxt)) // is there room?
- return partial;
- for (extern_type* p = tmp; n; --n) // write it
- *to_nxt++ = *p++;
- ++frm_nxt;
- // look for next null in frm
- for (fend = frm_nxt; fend != frm_end; ++fend)
- if (*fend == 0)
- break;
- }
- }
- return frm_nxt == frm_end ? ok : partial;
+ : locale::facet(refs), __l_(newlocale(LC_ALL_MASK, nm, 0)) {
+ if (__l_ == 0)
+ __throw_runtime_error(
+ ("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
+ " failed to construct for " +
+ string(nm))
+ .c_str());
}
-codecvt<wchar_t, char, mbstate_t>::result
-codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- // look for first internal null in frm
- const extern_type* fend = frm;
- for (; fend != frm_end; ++fend)
- if (*fend == 0)
- break;
- // loop over all null-terminated sequences in frm
- to_nxt = to;
- for (frm_nxt = frm; frm != frm_end && to != to_end; frm = frm_nxt, to = to_nxt)
- {
- // save state in case it is needed to recover to_nxt on error
- mbstate_t save_state = st;
- size_t n = __libcpp_mbsnrtowcs_l(to, &frm_nxt, static_cast<size_t>(fend-frm),
- static_cast<size_t>(to_end-to), &st, __l_);
- if (n == size_t(-1))
- {
- // need to recover to_nxt
- for (to_nxt = to; frm != frm_nxt; ++to_nxt)
- {
- n = __libcpp_mbrtowc_l(to_nxt, frm, static_cast<size_t>(fend-frm),
- &save_state, __l_);
- switch (n)
- {
- case 0:
- ++frm;
- break;
- case size_t(-1):
- frm_nxt = frm;
- return error;
- case size_t(-2):
- frm_nxt = frm;
- return partial;
- default:
- frm += n;
- break;
- }
- }
- frm_nxt = frm;
- return frm_nxt == frm_end ? ok : partial;
- }
+codecvt<wchar_t, char, mbstate_t>::~codecvt() {
+ if (__l_ != _LIBCPP_GET_C_LOCALE)
+ freelocale(__l_);
+}
+
+codecvt<wchar_t, char, mbstate_t>::result codecvt<wchar_t, char, mbstate_t>::do_out(
+ state_type& st,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ // look for first internal null in frm
+ const intern_type* fend = frm;
+ for (; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ // loop over all null-terminated sequences in frm
+ to_nxt = to;
+ for (frm_nxt = frm; frm != frm_end && to != to_end; frm = frm_nxt, to = to_nxt) {
+ // save state in case it is needed to recover to_nxt on error
+ mbstate_t save_state = st;
+ size_t n = __libcpp_wcsnrtombs_l(
+ to, &frm_nxt, static_cast<size_t>(fend - frm), static_cast<size_t>(to_end - to), &st, __l_);
+ if (n == size_t(-1)) {
+ // need to recover to_nxt
+ for (to_nxt = to; frm != frm_nxt; ++frm) {
+ n = __libcpp_wcrtomb_l(to_nxt, *frm, &save_state, __l_);
if (n == size_t(-1))
- return error;
+ break;
to_nxt += n;
- if (to_nxt == to_end)
- break;
- if (fend != frm_end) // set up next null terminated sequence
- {
- // Try to write the terminating null
- n = __libcpp_mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l_);
- if (n != 0) // on error
- return error;
- ++to_nxt;
- ++frm_nxt;
- // look for next null in frm
- for (fend = frm_nxt; fend != frm_end; ++fend)
- if (*fend == 0)
- break;
- }
+ }
+ frm_nxt = frm;
+ return error;
}
- return frm_nxt == frm_end ? ok : partial;
-}
-
-codecvt<wchar_t, char, mbstate_t>::result
-codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- to_nxt = to;
- extern_type tmp[MB_LEN_MAX];
- size_t n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l_);
- if (n == size_t(-1) || n == 0) // on error
+ if (n == 0)
+ return partial;
+ to_nxt += n;
+ if (to_nxt == to_end)
+ break;
+ if (fend != frm_end) // set up next null terminated sequence
+ {
+ // Try to write the terminating null
+ extern_type tmp[MB_LEN_MAX];
+ n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l_);
+ if (n == size_t(-1)) // on error
return error;
- --n;
- if (n > static_cast<size_t>(to_end-to_nxt)) // is there room?
+ if (n > static_cast<size_t>(to_end - to_nxt)) // is there room?
return partial;
- for (extern_type* p = tmp; n; --n) // write it
+ for (extern_type* p = tmp; n; --n) // write it
*to_nxt++ = *p++;
- return ok;
-}
-
-int
-codecvt<wchar_t, char, mbstate_t>::do_encoding() const noexcept
-{
- if (__libcpp_mbtowc_l(nullptr, nullptr, MB_LEN_MAX, __l_) != 0)
- return -1;
-
- // stateless encoding
- if (__l_ == 0 || __libcpp_mb_cur_max_l(__l_) == 1) // there are no known constant length encodings
- return 1; // which take more than 1 char to form a wchar_t
- return 0;
-}
-
-bool
-codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- int nbytes = 0;
- for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
- {
- size_t n = __libcpp_mbrlen_l(frm, static_cast<size_t>(frm_end-frm), &st, __l_);
- switch (n)
- {
+ ++frm_nxt;
+ // look for next null in frm
+ for (fend = frm_nxt; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ }
+ }
+ return frm_nxt == frm_end ? ok : partial;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result codecvt<wchar_t, char, mbstate_t>::do_in(
+ state_type& st,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ // look for first internal null in frm
+ const extern_type* fend = frm;
+ for (; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ // loop over all null-terminated sequences in frm
+ to_nxt = to;
+ for (frm_nxt = frm; frm != frm_end && to != to_end; frm = frm_nxt, to = to_nxt) {
+ // save state in case it is needed to recover to_nxt on error
+ mbstate_t save_state = st;
+ size_t n = __libcpp_mbsnrtowcs_l(
+ to, &frm_nxt, static_cast<size_t>(fend - frm), static_cast<size_t>(to_end - to), &st, __l_);
+ if (n == size_t(-1)) {
+ // need to recover to_nxt
+ for (to_nxt = to; frm != frm_nxt; ++to_nxt) {
+ n = __libcpp_mbrtowc_l(to_nxt, frm, static_cast<size_t>(fend - frm), &save_state, __l_);
+ switch (n) {
case 0:
- ++nbytes;
- ++frm;
- break;
+ ++frm;
+ break;
case size_t(-1):
+ frm_nxt = frm;
+ return error;
case size_t(-2):
- return nbytes;
+ frm_nxt = frm;
+ return partial;
default:
- nbytes += n;
- frm += n;
- break;
+ frm += n;
+ break;
}
+ }
+ frm_nxt = frm;
+ return frm_nxt == frm_end ? ok : partial;
}
- return nbytes;
+ if (n == size_t(-1))
+ return error;
+ to_nxt += n;
+ if (to_nxt == to_end)
+ break;
+ if (fend != frm_end) // set up next null terminated sequence
+ {
+ // Try to write the terminating null
+ n = __libcpp_mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l_);
+ if (n != 0) // on error
+ return error;
+ ++to_nxt;
+ ++frm_nxt;
+ // look for next null in frm
+ for (fend = frm_nxt; fend != frm_end; ++fend)
+ if (*fend == 0)
+ break;
+ }
+ }
+ return frm_nxt == frm_end ? ok : partial;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result codecvt<wchar_t, char, mbstate_t>::do_unshift(
+ state_type& st, extern_type* to, extern_type* to_end, extern_type*& to_nxt) const {
+ to_nxt = to;
+ extern_type tmp[MB_LEN_MAX];
+ size_t n = __libcpp_wcrtomb_l(tmp, intern_type(), &st, __l_);
+ if (n == size_t(-1) || n == 0) // on error
+ return error;
+ --n;
+ if (n > static_cast<size_t>(to_end - to_nxt)) // is there room?
+ return partial;
+ for (extern_type* p = tmp; n; --n) // write it
+ *to_nxt++ = *p++;
+ return ok;
+}
+
+int codecvt<wchar_t, char, mbstate_t>::do_encoding() const noexcept {
+ if (__libcpp_mbtowc_l(nullptr, nullptr, MB_LEN_MAX, __l_) != 0)
+ return -1;
+
+ // stateless encoding
+ if (__l_ == 0 || __libcpp_mb_cur_max_l(__l_) == 1) // there are no known constant length encodings
+ return 1; // which take more than 1 char to form a wchar_t
+ return 0;
+}
+
+bool codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const noexcept { return false; }
+
+int codecvt<wchar_t, char, mbstate_t>::do_length(
+ state_type& st, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ int nbytes = 0;
+ for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t) {
+ size_t n = __libcpp_mbrlen_l(frm, static_cast<size_t>(frm_end - frm), &st, __l_);
+ switch (n) {
+ case 0:
+ ++nbytes;
+ ++frm;
+ break;
+ case size_t(-1):
+ case size_t(-2):
+ return nbytes;
+ default:
+ nbytes += n;
+ frm += n;
+ break;
+ }
+ }
+ return nbytes;
}
-int
-codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept
-{
- return __l_ == 0 ? 1 : static_cast<int>(__libcpp_mb_cur_max_l(__l_));
+int codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept {
+ return __l_ == 0 ? 1 : static_cast<int>(__libcpp_mb_cur_max_l(__l_));
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -1778,1403 +1543,1211 @@ codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept
// 100000 - 10FFFF DBC0 - DBFF, DC00 - DFFF F4 - F4, 80 - 8F, 80 - BF, 80 - BF 65536
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-static
-codecvt_base::result
-utf16_to_utf8(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xEF);
- *to_nxt++ = static_cast<uint8_t>(0xBB);
- *to_nxt++ = static_cast<uint8_t>(0xBF);
- }
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint16_t wc1 = *frm_nxt;
- if (wc1 > Maxcode)
- return codecvt_base::error;
- if (wc1 < 0x0080)
- {
- if (to_end-to_nxt < 1)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc1);
- }
- else if (wc1 < 0x0800)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc1 >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x03F));
- }
- else if (wc1 < 0xD800)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
- }
- else if (wc1 < 0xDC00)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint16_t wc2 = frm_nxt[1];
- if ((wc2 & 0xFC00) != 0xDC00)
- return codecvt_base::error;
- if (to_end-to_nxt < 4)
- return codecvt_base::partial;
- if (((((wc1 & 0x03C0UL) >> 6) + 1) << 16) +
- ((wc1 & 0x003FUL) << 10) + (wc2 & 0x03FF) > Maxcode)
- return codecvt_base::error;
- ++frm_nxt;
- uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
- *to_nxt++ = static_cast<uint8_t>(0xF0 | (z >> 2));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((z & 0x03) << 4) | ((wc1 & 0x003C) >> 2));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0003) << 4) | ((wc2 & 0x03C0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc2 & 0x003F));
- }
- else if (wc1 < 0xE000)
- {
- return codecvt_base::error;
- }
- else
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
- }
- }
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf16_to_utf8(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xEF);
- *to_nxt++ = static_cast<uint8_t>(0xBB);
- *to_nxt++ = static_cast<uint8_t>(0xBF);
- }
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint16_t wc1 = static_cast<uint16_t>(*frm_nxt);
- if (wc1 > Maxcode)
- return codecvt_base::error;
- if (wc1 < 0x0080)
- {
- if (to_end-to_nxt < 1)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc1);
- }
- else if (wc1 < 0x0800)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc1 >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x03F));
- }
- else if (wc1 < 0xD800)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
- }
- else if (wc1 < 0xDC00)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint16_t wc2 = static_cast<uint16_t>(frm_nxt[1]);
- if ((wc2 & 0xFC00) != 0xDC00)
- return codecvt_base::error;
- if (to_end-to_nxt < 4)
- return codecvt_base::partial;
- if (((((wc1 & 0x03C0UL) >> 6) + 1) << 16) +
- ((wc1 & 0x003FUL) << 10) + (wc2 & 0x03FF) > Maxcode)
- return codecvt_base::error;
- ++frm_nxt;
- uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
- *to_nxt++ = static_cast<uint8_t>(0xF0 | (z >> 2));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((z & 0x03) << 4) | ((wc1 & 0x003C) >> 2));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0003) << 4) | ((wc2 & 0x03C0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc2 & 0x003F));
- }
- else if (wc1 < 0xE000)
- {
- return codecvt_base::error;
- }
- else
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
- }
- }
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf8_to_utf16(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
- frm_nxt[2] == 0xBF)
- frm_nxt += 3;
- }
- for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
- {
- uint8_t c1 = *frm_nxt;
- if (c1 > Maxcode)
- return codecvt_base::error;
- if (c1 < 0x80)
- {
- *to_nxt = static_cast<uint16_t>(c1);
- ++frm_nxt;
- }
- else if (c1 < 0xC2)
- {
- return codecvt_base::error;
- }
- else if (c1 < 0xE0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 2;
- }
- else if (c1 < 0xF0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- switch (c1)
- {
- case 0xE0:
- if ((c2 & 0xE0) != 0xA0)
- return codecvt_base::error;
- break;
- case 0xED:
- if ((c2 & 0xE0) != 0x80)
- return codecvt_base::error;
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- break;
- }
- if (frm_end-frm_nxt < 3)
- return codecvt_base::partial;
- uint8_t c3 = frm_nxt[2];
- if ((c3 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
- | ((c2 & 0x3F) << 6)
- | (c3 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 3;
- }
- else if (c1 < 0xF5)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- switch (c1)
- {
- case 0xF0:
- if (!(0x90 <= c2 && c2 <= 0xBF))
- return codecvt_base::error;
- break;
- case 0xF4:
- if ((c2 & 0xF0) != 0x80)
- return codecvt_base::error;
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- break;
- }
- if (frm_end-frm_nxt < 3)
- return codecvt_base::partial;
- uint8_t c3 = frm_nxt[2];
- if ((c3 & 0xC0) != 0x80)
- return codecvt_base::error;
- if (frm_end-frm_nxt < 4)
- return codecvt_base::partial;
- uint8_t c4 = frm_nxt[3];
- if ((c4 & 0xC0) != 0x80)
- return codecvt_base::error;
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- if ((((c1 & 7UL) << 18) +
- ((c2 & 0x3FUL) << 12) +
- ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint16_t>(
- 0xD800
- | (((((c1 & 0x07) << 2) | ((c2 & 0x30) >> 4)) - 1) << 6)
- | ((c2 & 0x0F) << 2)
- | ((c3 & 0x30) >> 4));
- *++to_nxt = static_cast<uint16_t>(
- 0xDC00
- | ((c3 & 0x0F) << 6)
- | (c4 & 0x3F));
- frm_nxt += 4;
- }
- else
- {
- return codecvt_base::error;
- }
- }
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf8_to_utf16(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
- frm_nxt[2] == 0xBF)
- frm_nxt += 3;
- }
- for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
- {
- uint8_t c1 = *frm_nxt;
- if (c1 > Maxcode)
- return codecvt_base::error;
- if (c1 < 0x80)
- {
- *to_nxt = static_cast<uint32_t>(c1);
- ++frm_nxt;
- }
- else if (c1 < 0xC2)
- {
- return codecvt_base::error;
- }
- else if (c1 < 0xE0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint32_t>(t);
- frm_nxt += 2;
- }
- else if (c1 < 0xF0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- switch (c1)
- {
- case 0xE0:
- if ((c2 & 0xE0) != 0xA0)
- return codecvt_base::error;
- break;
- case 0xED:
- if ((c2 & 0xE0) != 0x80)
- return codecvt_base::error;
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- break;
- }
- if (frm_end-frm_nxt < 3)
- return codecvt_base::partial;
- uint8_t c3 = frm_nxt[2];
- if ((c3 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
- | ((c2 & 0x3F) << 6)
- | (c3 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint32_t>(t);
- frm_nxt += 3;
- }
- else if (c1 < 0xF5)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- switch (c1)
- {
- case 0xF0:
- if (!(0x90 <= c2 && c2 <= 0xBF))
- return codecvt_base::error;
- break;
- case 0xF4:
- if ((c2 & 0xF0) != 0x80)
- return codecvt_base::error;
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- break;
- }
- if (frm_end-frm_nxt < 3)
- return codecvt_base::partial;
- uint8_t c3 = frm_nxt[2];
- if ((c3 & 0xC0) != 0x80)
- return codecvt_base::error;
- if (frm_end-frm_nxt < 4)
- return codecvt_base::partial;
- uint8_t c4 = frm_nxt[3];
- if ((c4 & 0xC0) != 0x80)
- return codecvt_base::error;
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- if ((((c1 & 7UL) << 18) +
- ((c2 & 0x3FUL) << 12) +
- ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint32_t>(
- 0xD800
- | (((((c1 & 0x07) << 2) | ((c2 & 0x30) >> 4)) - 1) << 6)
- | ((c2 & 0x0F) << 2)
- | ((c3 & 0x30) >> 4));
- *++to_nxt = static_cast<uint32_t>(
- 0xDC00
- | ((c3 & 0x0F) << 6)
- | (c4 & 0x3F));
- frm_nxt += 4;
- }
- else
- {
- return codecvt_base::error;
- }
- }
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-int
-utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end,
- size_t mx, unsigned long Maxcode = 0x10FFFF,
- codecvt_mode mode = codecvt_mode(0))
-{
- const uint8_t* frm_nxt = frm;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
- frm_nxt[2] == 0xBF)
- frm_nxt += 3;
- }
- for (size_t nchar16_t = 0; frm_nxt < frm_end && nchar16_t < mx; ++nchar16_t)
- {
- uint8_t c1 = *frm_nxt;
- if (c1 > Maxcode)
- break;
- if (c1 < 0x80)
- {
- ++frm_nxt;
- }
- else if (c1 < 0xC2)
- {
- break;
- }
- else if (c1 < 0xE0)
- {
- if ((frm_end-frm_nxt < 2) || (frm_nxt[1] & 0xC0) != 0x80)
- break;
- uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F));
- if (t > Maxcode)
- break;
- frm_nxt += 2;
- }
- else if (c1 < 0xF0)
- {
- if (frm_end-frm_nxt < 3)
- break;
- uint8_t c2 = frm_nxt[1];
- uint8_t c3 = frm_nxt[2];
- switch (c1)
- {
- case 0xE0:
- if ((c2 & 0xE0) != 0xA0)
- return static_cast<int>(frm_nxt - frm);
- break;
- case 0xED:
- if ((c2 & 0xE0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- }
- if ((c3 & 0xC0) != 0x80)
- break;
- if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
- break;
- frm_nxt += 3;
- }
- else if (c1 < 0xF5)
- {
- if (frm_end-frm_nxt < 4 || mx-nchar16_t < 2)
- break;
- uint8_t c2 = frm_nxt[1];
- uint8_t c3 = frm_nxt[2];
- uint8_t c4 = frm_nxt[3];
- switch (c1)
- {
- case 0xF0:
- if (!(0x90 <= c2 && c2 <= 0xBF))
- return static_cast<int>(frm_nxt - frm);
- break;
- case 0xF4:
- if ((c2 & 0xF0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- }
- if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
- break;
- if ((((c1 & 7UL) << 18) +
- ((c2 & 0x3FUL) << 12) +
- ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
- break;
- ++nchar16_t;
- frm_nxt += 4;
- }
- else
- {
- break;
- }
- }
- return static_cast<int>(frm_nxt - frm);
-}
-
-static
-codecvt_base::result
-ucs4_to_utf8(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xEF);
- *to_nxt++ = static_cast<uint8_t>(0xBB);
- *to_nxt++ = static_cast<uint8_t>(0xBF);
- }
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint32_t wc = *frm_nxt;
- if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
- return codecvt_base::error;
- if (wc < 0x000080)
- {
- if (to_end-to_nxt < 1)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc);
- }
- else if (wc < 0x000800)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x03F));
- }
- else if (wc < 0x010000)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc >> 12));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x0FC0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x003F));
- }
- else // if (wc < 0x110000)
- {
- if (to_end-to_nxt < 4)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xF0 | (wc >> 18));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x03F000) >> 12));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x000FC0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x00003F));
- }
- }
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf8_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
- frm_nxt[2] == 0xBF)
- frm_nxt += 3;
- }
- for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
- {
- uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
- if (c1 < 0x80)
- {
- if (c1 > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint32_t>(c1);
- ++frm_nxt;
- }
- else if (c1 < 0xC2)
- {
- return codecvt_base::error;
- }
- else if (c1 < 0xE0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint32_t t = static_cast<uint32_t>(((c1 & 0x1F) << 6)
- | (c2 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 2;
- }
- else if (c1 < 0xF0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- switch (c1)
- {
- case 0xE0:
- if ((c2 & 0xE0) != 0xA0)
- return codecvt_base::error;
- break;
- case 0xED:
- if ((c2 & 0xE0) != 0x80)
- return codecvt_base::error;
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- break;
- }
- if (frm_end-frm_nxt < 3)
- return codecvt_base::partial;
- uint8_t c3 = frm_nxt[2];
- if ((c3 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint32_t t = static_cast<uint32_t>(((c1 & 0x0F) << 12)
- | ((c2 & 0x3F) << 6)
- | (c3 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 3;
- }
- else if (c1 < 0xF5)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- switch (c1)
- {
- case 0xF0:
- if (!(0x90 <= c2 && c2 <= 0xBF))
- return codecvt_base::error;
- break;
- case 0xF4:
- if ((c2 & 0xF0) != 0x80)
- return codecvt_base::error;
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- break;
- }
- if (frm_end-frm_nxt < 3)
- return codecvt_base::partial;
- uint8_t c3 = frm_nxt[2];
- if ((c3 & 0xC0) != 0x80)
- return codecvt_base::error;
- if (frm_end-frm_nxt < 4)
- return codecvt_base::partial;
- uint8_t c4 = frm_nxt[3];
- if ((c4 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint32_t t = static_cast<uint32_t>(((c1 & 0x07) << 18)
- | ((c2 & 0x3F) << 12)
- | ((c3 & 0x3F) << 6)
- | (c4 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 4;
- }
- else
- {
- return codecvt_base::error;
- }
- }
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-int
-utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
- size_t mx, unsigned long Maxcode = 0x10FFFF,
- codecvt_mode mode = codecvt_mode(0))
-{
- const uint8_t* frm_nxt = frm;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
- frm_nxt[2] == 0xBF)
- frm_nxt += 3;
- }
- for (size_t nchar32_t = 0; frm_nxt < frm_end && nchar32_t < mx; ++nchar32_t)
- {
- uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
- if (c1 < 0x80)
- {
- if (c1 > Maxcode)
- break;
- ++frm_nxt;
- }
- else if (c1 < 0xC2)
- {
- break;
- }
- else if (c1 < 0xE0)
- {
- if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
- break;
- if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
- break;
- frm_nxt += 2;
- }
- else if (c1 < 0xF0)
- {
- if (frm_end-frm_nxt < 3)
- break;
- uint8_t c2 = frm_nxt[1];
- uint8_t c3 = frm_nxt[2];
- switch (c1)
- {
- case 0xE0:
- if ((c2 & 0xE0) != 0xA0)
- return static_cast<int>(frm_nxt - frm);
- break;
- case 0xED:
- if ((c2 & 0xE0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- }
- if ((c3 & 0xC0) != 0x80)
- break;
- if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
- break;
- frm_nxt += 3;
- }
- else if (c1 < 0xF5)
- {
- if (frm_end-frm_nxt < 4)
- break;
- uint8_t c2 = frm_nxt[1];
- uint8_t c3 = frm_nxt[2];
- uint8_t c4 = frm_nxt[3];
- switch (c1)
- {
- case 0xF0:
- if (!(0x90 <= c2 && c2 <= 0xBF))
- return static_cast<int>(frm_nxt - frm);
- break;
- case 0xF4:
- if ((c2 & 0xF0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- }
- if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
- break;
- if ((((c1 & 0x07u) << 18) | ((c2 & 0x3Fu) << 12) |
- ((c3 & 0x3Fu) << 6) | (c4 & 0x3Fu)) > Maxcode)
- break;
- frm_nxt += 4;
- }
- else
- {
- break;
- }
- }
- return static_cast<int>(frm_nxt - frm);
-}
-
-static
-codecvt_base::result
-ucs2_to_utf8(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xEF);
- *to_nxt++ = static_cast<uint8_t>(0xBB);
- *to_nxt++ = static_cast<uint8_t>(0xBF);
- }
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint16_t wc = *frm_nxt;
- if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
- return codecvt_base::error;
- if (wc < 0x0080)
- {
- if (to_end-to_nxt < 1)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc);
- }
- else if (wc < 0x0800)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x03F));
- }
- else // if (wc <= 0xFFFF)
- {
- if (to_end-to_nxt < 3)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc >> 12));
- *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x0FC0) >> 6));
- *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x003F));
- }
- }
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf8_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
- frm_nxt[2] == 0xBF)
- frm_nxt += 3;
- }
- for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt)
- {
- uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
- if (c1 < 0x80)
- {
- if (c1 > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint16_t>(c1);
- ++frm_nxt;
- }
- else if (c1 < 0xC2)
- {
- return codecvt_base::error;
- }
- else if (c1 < 0xE0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6)
- | (c2 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 2;
- }
- else if (c1 < 0xF0)
- {
- if (frm_end-frm_nxt < 2)
- return codecvt_base::partial;
- uint8_t c2 = frm_nxt[1];
- switch (c1)
- {
- case 0xE0:
- if ((c2 & 0xE0) != 0xA0)
- return codecvt_base::error;
- break;
- case 0xED:
- if ((c2 & 0xE0) != 0x80)
- return codecvt_base::error;
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return codecvt_base::error;
- break;
- }
- if (frm_end-frm_nxt < 3)
- return codecvt_base::partial;
- uint8_t c3 = frm_nxt[2];
- if ((c3 & 0xC0) != 0x80)
- return codecvt_base::error;
- uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
- | ((c2 & 0x3F) << 6)
- | (c3 & 0x3F));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 3;
- }
- else
- {
- return codecvt_base::error;
- }
- }
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-int
-utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
- size_t mx, unsigned long Maxcode = 0x10FFFF,
- codecvt_mode mode = codecvt_mode(0))
-{
- const uint8_t* frm_nxt = frm;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB &&
- frm_nxt[2] == 0xBF)
- frm_nxt += 3;
- }
- for (size_t nchar32_t = 0; frm_nxt < frm_end && nchar32_t < mx; ++nchar32_t)
- {
- uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
- if (c1 < 0x80)
- {
- if (c1 > Maxcode)
- break;
- ++frm_nxt;
- }
- else if (c1 < 0xC2)
- {
- break;
- }
- else if (c1 < 0xE0)
- {
- if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
- break;
- if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
- break;
- frm_nxt += 2;
- }
- else if (c1 < 0xF0)
- {
- if (frm_end-frm_nxt < 3)
- break;
- uint8_t c2 = frm_nxt[1];
- uint8_t c3 = frm_nxt[2];
- switch (c1)
- {
- case 0xE0:
- if ((c2 & 0xE0) != 0xA0)
- return static_cast<int>(frm_nxt - frm);
- break;
- case 0xED:
- if ((c2 & 0xE0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- default:
- if ((c2 & 0xC0) != 0x80)
- return static_cast<int>(frm_nxt - frm);
- break;
- }
- if ((c3 & 0xC0) != 0x80)
- break;
- if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
- break;
- frm_nxt += 3;
- }
- else
- {
- break;
- }
- }
- return static_cast<int>(frm_nxt - frm);
-}
-
-static
-codecvt_base::result
-ucs4_to_utf16be(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xFE);
- *to_nxt++ = static_cast<uint8_t>(0xFF);
- }
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint32_t wc = *frm_nxt;
- if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
- return codecvt_base::error;
- if (wc < 0x010000)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc >> 8);
- *to_nxt++ = static_cast<uint8_t>(wc);
- }
- else
- {
- if (to_end-to_nxt < 4)
- return codecvt_base::partial;
- uint16_t t = static_cast<uint16_t>(
- 0xD800
- | ((((wc & 0x1F0000) >> 16) - 1) << 6)
- | ((wc & 0x00FC00) >> 10));
- *to_nxt++ = static_cast<uint8_t>(t >> 8);
- *to_nxt++ = static_cast<uint8_t>(t);
- t = static_cast<uint16_t>(0xDC00 | (wc & 0x03FF));
- *to_nxt++ = static_cast<uint8_t>(t >> 8);
- *to_nxt++ = static_cast<uint8_t>(t);
- }
- }
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
- frm_nxt += 2;
- }
- for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
- {
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
- if ((c1 & 0xFC00) == 0xDC00)
- return codecvt_base::error;
- if ((c1 & 0xFC00) != 0xD800)
- {
- if (c1 > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint32_t>(c1);
- frm_nxt += 2;
- }
- else
- {
- if (frm_end-frm_nxt < 4)
- return codecvt_base::partial;
- uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
- if ((c2 & 0xFC00) != 0xDC00)
- return codecvt_base::error;
- uint32_t t = static_cast<uint32_t>(
- ((((c1 & 0x03C0) >> 6) + 1) << 16)
- | ((c1 & 0x003F) << 10)
- | (c2 & 0x03FF));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 4;
- }
- }
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-int
-utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
- size_t mx, unsigned long Maxcode = 0x10FFFF,
- codecvt_mode mode = codecvt_mode(0))
-{
- const uint8_t* frm_nxt = frm;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
- frm_nxt += 2;
- }
- for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
- {
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
- if ((c1 & 0xFC00) == 0xDC00)
- break;
- if ((c1 & 0xFC00) != 0xD800)
- {
- if (c1 > Maxcode)
- break;
- frm_nxt += 2;
- }
- else
- {
- if (frm_end-frm_nxt < 4)
- break;
- uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
- if ((c2 & 0xFC00) != 0xDC00)
- break;
- uint32_t t = static_cast<uint32_t>(
- ((((c1 & 0x03C0) >> 6) + 1) << 16)
- | ((c1 & 0x003F) << 10)
- | (c2 & 0x03FF));
- if (t > Maxcode)
- break;
- frm_nxt += 4;
- }
- }
- return static_cast<int>(frm_nxt - frm);
-}
-
-static
-codecvt_base::result
-ucs4_to_utf16le(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
- {
- if (to_end - to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xFF);
- *to_nxt++ = static_cast<uint8_t>(0xFE);
- }
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint32_t wc = *frm_nxt;
- if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
- return codecvt_base::error;
- if (wc < 0x010000)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc);
- *to_nxt++ = static_cast<uint8_t>(wc >> 8);
- }
- else
- {
- if (to_end-to_nxt < 4)
- return codecvt_base::partial;
- uint16_t t = static_cast<uint16_t>(
- 0xD800
- | ((((wc & 0x1F0000) >> 16) - 1) << 6)
- | ((wc & 0x00FC00) >> 10));
- *to_nxt++ = static_cast<uint8_t>(t);
- *to_nxt++ = static_cast<uint8_t>(t >> 8);
- t = static_cast<uint16_t>(0xDC00 | (wc & 0x03FF));
- *to_nxt++ = static_cast<uint8_t>(t);
- *to_nxt++ = static_cast<uint8_t>(t >> 8);
- }
+static codecvt_base::result utf16_to_utf8(
+ const uint16_t* frm,
+ const uint16_t* frm_end,
+ const uint16_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint16_t wc1 = *frm_nxt;
+ if (wc1 > Maxcode)
+ return codecvt_base::error;
+ if (wc1 < 0x0080) {
+ if (to_end - to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc1);
+ } else if (wc1 < 0x0800) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc1 >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x03F));
+ } else if (wc1 < 0xD800) {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
+ } else if (wc1 < 0xDC00) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint16_t wc2 = frm_nxt[1];
+ if ((wc2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ if (to_end - to_nxt < 4)
+ return codecvt_base::partial;
+ if (((((wc1 & 0x03C0UL) >> 6) + 1) << 16) + ((wc1 & 0x003FUL) << 10) + (wc2 & 0x03FF) > Maxcode)
+ return codecvt_base::error;
+ ++frm_nxt;
+ uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
+ *to_nxt++ = static_cast<uint8_t>(0xF0 | (z >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((z & 0x03) << 4) | ((wc1 & 0x003C) >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0003) << 4) | ((wc2 & 0x03C0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc2 & 0x003F));
+ } else if (wc1 < 0xE000) {
+ return codecvt_base::error;
+ } else {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
}
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint32_t* to, uint32_t* to_end, uint32_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
- frm_nxt += 2;
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf16_to_utf8(
+ const uint32_t* frm,
+ const uint32_t* frm_end,
+ const uint32_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint16_t wc1 = static_cast<uint16_t>(*frm_nxt);
+ if (wc1 > Maxcode)
+ return codecvt_base::error;
+ if (wc1 < 0x0080) {
+ if (to_end - to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc1);
+ } else if (wc1 < 0x0800) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc1 >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x03F));
+ } else if (wc1 < 0xD800) {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
+ } else if (wc1 < 0xDC00) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint16_t wc2 = static_cast<uint16_t>(frm_nxt[1]);
+ if ((wc2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ if (to_end - to_nxt < 4)
+ return codecvt_base::partial;
+ if (((((wc1 & 0x03C0UL) >> 6) + 1) << 16) + ((wc1 & 0x003FUL) << 10) + (wc2 & 0x03FF) > Maxcode)
+ return codecvt_base::error;
+ ++frm_nxt;
+ uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
+ *to_nxt++ = static_cast<uint8_t>(0xF0 | (z >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((z & 0x03) << 4) | ((wc1 & 0x003C) >> 2));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0003) << 4) | ((wc2 & 0x03C0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc2 & 0x003F));
+ } else if (wc1 < 0xE000) {
+ return codecvt_base::error;
+ } else {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc1 >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc1 & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc1 & 0x003F));
}
- for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
- {
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
- if ((c1 & 0xFC00) == 0xDC00)
- return codecvt_base::error;
- if ((c1 & 0xFC00) != 0xD800)
- {
- if (c1 > Maxcode)
- return codecvt_base::error;
- *to_nxt = static_cast<uint32_t>(c1);
- frm_nxt += 2;
- }
- else
- {
- if (frm_end-frm_nxt < 4)
- return codecvt_base::partial;
- uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
- if ((c2 & 0xFC00) != 0xDC00)
- return codecvt_base::error;
- uint32_t t = static_cast<uint32_t>(
- ((((c1 & 0x03C0) >> 6) + 1) << 16)
- | ((c1 & 0x003F) << 10)
- | (c2 & 0x03FF));
- if (t > Maxcode)
- return codecvt_base::error;
- *to_nxt = t;
- frm_nxt += 4;
- }
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf8_to_utf16(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint16_t* to,
+ uint16_t* to_end,
+ uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB && frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt) {
+ uint8_t c1 = *frm_nxt;
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ if (c1 < 0x80) {
+ *to_nxt = static_cast<uint16_t>(c1);
+ ++frm_nxt;
+ } else if (c1 < 0xC2) {
+ return codecvt_base::error;
+ } else if (c1 < 0xE0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 2;
+ } else if (c1 < 0xF0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ switch (c1) {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if (frm_end - frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c3 = frm_nxt[2];
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 3;
+ } else if (c1 < 0xF5) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ switch (c1) {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return codecvt_base::error;
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if (frm_end - frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c3 = frm_nxt[2];
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ if (frm_end - frm_nxt < 4)
+ return codecvt_base::partial;
+ uint8_t c4 = frm_nxt[3];
+ if ((c4 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ if ((((c1 & 7UL) << 18) + ((c2 & 0x3FUL) << 12) + ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint16_t>(
+ 0xD800 | (((((c1 & 0x07) << 2) | ((c2 & 0x30) >> 4)) - 1) << 6) | ((c2 & 0x0F) << 2) | ((c3 & 0x30) >> 4));
+ *++to_nxt = static_cast<uint16_t>(0xDC00 | ((c3 & 0x0F) << 6) | (c4 & 0x3F));
+ frm_nxt += 4;
+ } else {
+ return codecvt_base::error;
}
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-int
-utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
- size_t mx, unsigned long Maxcode = 0x10FFFF,
- codecvt_mode mode = codecvt_mode(0))
-{
- const uint8_t* frm_nxt = frm;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
- frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static codecvt_base::result utf8_to_utf16(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint32_t* to,
+ uint32_t* to_end,
+ uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB && frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt) {
+ uint8_t c1 = *frm_nxt;
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ if (c1 < 0x80) {
+ *to_nxt = static_cast<uint32_t>(c1);
+ ++frm_nxt;
+ } else if (c1 < 0xC2) {
+ return codecvt_base::error;
+ } else if (c1 < 0xE0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(t);
+ frm_nxt += 2;
+ } else if (c1 < 0xF0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ switch (c1) {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if (frm_end - frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c3 = frm_nxt[2];
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(t);
+ frm_nxt += 3;
+ } else if (c1 < 0xF5) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ switch (c1) {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return codecvt_base::error;
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if (frm_end - frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c3 = frm_nxt[2];
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ if (frm_end - frm_nxt < 4)
+ return codecvt_base::partial;
+ uint8_t c4 = frm_nxt[3];
+ if ((c4 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ if ((((c1 & 7UL) << 18) + ((c2 & 0x3FUL) << 12) + ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(
+ 0xD800 | (((((c1 & 0x07) << 2) | ((c2 & 0x30) >> 4)) - 1) << 6) | ((c2 & 0x0F) << 2) | ((c3 & 0x30) >> 4));
+ *++to_nxt = static_cast<uint32_t>(0xDC00 | ((c3 & 0x0F) << 6) | (c4 & 0x3F));
+ frm_nxt += 4;
+ } else {
+ return codecvt_base::error;
}
- for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
- {
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
- if ((c1 & 0xFC00) == 0xDC00)
- break;
- if ((c1 & 0xFC00) != 0xD800)
- {
- if (c1 > Maxcode)
- break;
- frm_nxt += 2;
- }
- else
- {
- if (frm_end-frm_nxt < 4)
- break;
- uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
- if ((c2 & 0xFC00) != 0xDC00)
- break;
- uint32_t t = static_cast<uint32_t>(
- ((((c1 & 0x03C0) >> 6) + 1) << 16)
- | ((c1 & 0x003F) << 10)
- | (c2 & 0x03FF));
- if (t > Maxcode)
- break;
- frm_nxt += 4;
- }
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static int utf8_to_utf16_length(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ size_t mx,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB && frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (size_t nchar16_t = 0; frm_nxt < frm_end && nchar16_t < mx; ++nchar16_t) {
+ uint8_t c1 = *frm_nxt;
+ if (c1 > Maxcode)
+ break;
+ if (c1 < 0x80) {
+ ++frm_nxt;
+ } else if (c1 < 0xC2) {
+ break;
+ } else if (c1 < 0xE0) {
+ if ((frm_end - frm_nxt < 2) || (frm_nxt[1] & 0xC0) != 0x80)
+ break;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F));
+ if (t > Maxcode)
+ break;
+ frm_nxt += 2;
+ } else if (c1 < 0xF0) {
+ if (frm_end - frm_nxt < 3)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1) {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
+ break;
+ frm_nxt += 3;
+ } else if (c1 < 0xF5) {
+ if (frm_end - frm_nxt < 4 || mx - nchar16_t < 2)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint8_t c4 = frm_nxt[3];
+ switch (c1) {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 7UL) << 18) + ((c2 & 0x3FUL) << 12) + ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
+ break;
+ ++nchar16_t;
+ frm_nxt += 4;
+ } else {
+ break;
}
- return static_cast<int>(frm_nxt - frm);
-}
-
-static
-codecvt_base::result
-ucs2_to_utf16be(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static codecvt_base::result ucs4_to_utf8(
+ const uint32_t* frm,
+ const uint32_t* frm_end,
+ const uint32_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint32_t wc = *frm_nxt;
+ if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x000080) {
+ if (to_end - to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ } else if (wc < 0x000800) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x03F));
+ } else if (wc < 0x010000) {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x003F));
+ } else // if (wc < 0x110000)
{
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xFE);
- *to_nxt++ = static_cast<uint8_t>(0xFF);
+ if (to_end - to_nxt < 4)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xF0 | (wc >> 18));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x03F000) >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x000FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x00003F));
}
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint16_t wc = *frm_nxt;
- if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
- return codecvt_base::error;
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc >> 8);
- *to_nxt++ = static_cast<uint8_t>(wc);
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf8_to_ucs4(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint32_t* to,
+ uint32_t* to_end,
+ uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB && frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt) {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80) {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(c1);
+ ++frm_nxt;
+ } else if (c1 < 0xC2) {
+ return codecvt_base::error;
+ } else if (c1 < 0xE0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 2;
+ } else if (c1 < 0xF0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ switch (c1) {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if (frm_end - frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c3 = frm_nxt[2];
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 3;
+ } else if (c1 < 0xF5) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ switch (c1) {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return codecvt_base::error;
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if (frm_end - frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c3 = frm_nxt[2];
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ if (frm_end - frm_nxt < 4)
+ return codecvt_base::partial;
+ uint8_t c4 = frm_nxt[3];
+ if ((c4 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) | ((c3 & 0x3F) << 6) | (c4 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 4;
+ } else {
+ return codecvt_base::error;
}
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf16be_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
- frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static int utf8_to_ucs4_length(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ size_t mx,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB && frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end && nchar32_t < mx; ++nchar32_t) {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80) {
+ if (c1 > Maxcode)
+ break;
+ ++frm_nxt;
+ } else if (c1 < 0xC2) {
+ break;
+ } else if (c1 < 0xE0) {
+ if ((frm_end - frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
+ break;
+ if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
+ break;
+ frm_nxt += 2;
+ } else if (c1 < 0xF0) {
+ if (frm_end - frm_nxt < 3)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1) {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
+ break;
+ frm_nxt += 3;
+ } else if (c1 < 0xF5) {
+ if (frm_end - frm_nxt < 4)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ uint8_t c4 = frm_nxt[3];
+ switch (c1) {
+ case 0xF0:
+ if (!(0x90 <= c2 && c2 <= 0xBF))
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xF4:
+ if ((c2 & 0xF0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 0x07u) << 18) | ((c2 & 0x3Fu) << 12) | ((c3 & 0x3Fu) << 6) | (c4 & 0x3Fu)) > Maxcode)
+ break;
+ frm_nxt += 4;
+ } else {
+ break;
}
- for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static codecvt_base::result ucs2_to_utf8(
+ const uint16_t* frm,
+ const uint16_t* frm_end,
+ const uint16_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xEF);
+ *to_nxt++ = static_cast<uint8_t>(0xBB);
+ *to_nxt++ = static_cast<uint8_t>(0xBF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint16_t wc = *frm_nxt;
+ if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x0080) {
+ if (to_end - to_nxt < 1)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ } else if (wc < 0x0800) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xC0 | (wc >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x03F));
+ } else // if (wc <= 0xFFFF)
{
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
- if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
- return codecvt_base::error;
- *to_nxt = c1;
- frm_nxt += 2;
+ if (to_end - to_nxt < 3)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xE0 | (wc >> 12));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | ((wc & 0x0FC0) >> 6));
+ *to_nxt++ = static_cast<uint8_t>(0x80 | (wc & 0x003F));
}
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-int
-utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
- size_t mx, unsigned long Maxcode = 0x10FFFF,
- codecvt_mode mode = codecvt_mode(0))
-{
- const uint8_t* frm_nxt = frm;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
- frm_nxt += 2;
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf8_to_ucs2(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint16_t* to,
+ uint16_t* to_end,
+ uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB && frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (; frm_nxt < frm_end && to_nxt < to_end; ++to_nxt) {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80) {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint16_t>(c1);
+ ++frm_nxt;
+ } else if (c1 < 0xC2) {
+ return codecvt_base::error;
+ } else if (c1 < 0xE0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x1F) << 6) | (c2 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 2;
+ } else if (c1 < 0xF0) {
+ if (frm_end - frm_nxt < 2)
+ return codecvt_base::partial;
+ uint8_t c2 = frm_nxt[1];
+ switch (c1) {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return codecvt_base::error;
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return codecvt_base::error;
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ break;
+ }
+ if (frm_end - frm_nxt < 3)
+ return codecvt_base::partial;
+ uint8_t c3 = frm_nxt[2];
+ if ((c3 & 0xC0) != 0x80)
+ return codecvt_base::error;
+ uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 3;
+ } else {
+ return codecvt_base::error;
}
- for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
- {
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
- if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
- break;
- frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static int utf8_to_ucs2_length(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ size_t mx,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 3 && frm_nxt[0] == 0xEF && frm_nxt[1] == 0xBB && frm_nxt[2] == 0xBF)
+ frm_nxt += 3;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end && nchar32_t < mx; ++nchar32_t) {
+ uint8_t c1 = static_cast<uint8_t>(*frm_nxt);
+ if (c1 < 0x80) {
+ if (c1 > Maxcode)
+ break;
+ ++frm_nxt;
+ } else if (c1 < 0xC2) {
+ break;
+ } else if (c1 < 0xE0) {
+ if ((frm_end - frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
+ break;
+ if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
+ break;
+ frm_nxt += 2;
+ } else if (c1 < 0xF0) {
+ if (frm_end - frm_nxt < 3)
+ break;
+ uint8_t c2 = frm_nxt[1];
+ uint8_t c3 = frm_nxt[2];
+ switch (c1) {
+ case 0xE0:
+ if ((c2 & 0xE0) != 0xA0)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ case 0xED:
+ if ((c2 & 0xE0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ default:
+ if ((c2 & 0xC0) != 0x80)
+ return static_cast<int>(frm_nxt - frm);
+ break;
+ }
+ if ((c3 & 0xC0) != 0x80)
+ break;
+ if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
+ break;
+ frm_nxt += 3;
+ } else {
+ break;
}
- return static_cast<int>(frm_nxt - frm);
-}
-
-static
-codecvt_base::result
-ucs2_to_utf16le(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm_nxt,
- uint8_t* to, uint8_t* to_end, uint8_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & generate_header)
- {
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(0xFF);
- *to_nxt++ = static_cast<uint8_t>(0xFE);
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static codecvt_base::result ucs4_to_utf16be(
+ const uint32_t* frm,
+ const uint32_t* frm_end,
+ const uint32_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint32_t wc = *frm_nxt;
+ if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x010000) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ } else {
+ if (to_end - to_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t t = static_cast<uint16_t>(0xD800 | ((((wc & 0x1F0000) >> 16) - 1) << 6) | ((wc & 0x00FC00) >> 10));
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
+ *to_nxt++ = static_cast<uint8_t>(t);
+ t = static_cast<uint16_t>(0xDC00 | (wc & 0x03FF));
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
+ *to_nxt++ = static_cast<uint8_t>(t);
}
- for (; frm_nxt < frm_end; ++frm_nxt)
- {
- uint16_t wc = *frm_nxt;
- if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
- return codecvt_base::error;
- if (to_end-to_nxt < 2)
- return codecvt_base::partial;
- *to_nxt++ = static_cast<uint8_t>(wc);
- *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf16be_to_ucs4(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint32_t* to,
+ uint32_t* to_end,
+ uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
+ if ((c1 & 0xFC00) == 0xDC00)
+ return codecvt_base::error;
+ if ((c1 & 0xFC00) != 0xD800) {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(c1);
+ frm_nxt += 2;
+ } else {
+ if (frm_end - frm_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
+ if ((c2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 4;
}
- return codecvt_base::ok;
-}
-
-static
-codecvt_base::result
-utf16le_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nxt,
- uint16_t* to, uint16_t* to_end, uint16_t*& to_nxt,
- unsigned long Maxcode = 0x10FFFF, codecvt_mode mode = codecvt_mode(0))
-{
- frm_nxt = frm;
- to_nxt = to;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
- frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static int utf16be_to_ucs4_length(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ size_t mx,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
+ if ((c1 & 0xFC00) == 0xDC00)
+ break;
+ if ((c1 & 0xFC00) != 0xD800) {
+ if (c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ } else {
+ if (frm_end - frm_nxt < 4)
+ break;
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
+ if ((c2 & 0xFC00) != 0xDC00)
+ break;
+ uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
+ if (t > Maxcode)
+ break;
+ frm_nxt += 4;
}
- for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
- {
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
- if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
- return codecvt_base::error;
- *to_nxt = c1;
- frm_nxt += 2;
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static codecvt_base::result ucs4_to_utf16le(
+ const uint32_t* frm,
+ const uint32_t* frm_end,
+ const uint32_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint32_t wc = *frm_nxt;
+ if ((wc & 0xFFFFF800) == 0x00D800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (wc < 0x010000) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ } else {
+ if (to_end - to_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t t = static_cast<uint16_t>(0xD800 | ((((wc & 0x1F0000) >> 16) - 1) << 6) | ((wc & 0x00FC00) >> 10));
+ *to_nxt++ = static_cast<uint8_t>(t);
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
+ t = static_cast<uint16_t>(0xDC00 | (wc & 0x03FF));
+ *to_nxt++ = static_cast<uint8_t>(t);
+ *to_nxt++ = static_cast<uint8_t>(t >> 8);
}
- return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
-}
-
-static
-int
-utf16le_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
- size_t mx, unsigned long Maxcode = 0x10FFFF,
- codecvt_mode mode = codecvt_mode(0))
-{
- const uint8_t* frm_nxt = frm;
- frm_nxt = frm;
- if (mode & consume_header)
- {
- if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
- frm_nxt += 2;
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf16le_to_ucs4(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint32_t* to,
+ uint32_t* to_end,
+ uint32_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
+ if ((c1 & 0xFC00) == 0xDC00)
+ return codecvt_base::error;
+ if ((c1 & 0xFC00) != 0xD800) {
+ if (c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = static_cast<uint32_t>(c1);
+ frm_nxt += 2;
+ } else {
+ if (frm_end - frm_nxt < 4)
+ return codecvt_base::partial;
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
+ if ((c2 & 0xFC00) != 0xDC00)
+ return codecvt_base::error;
+ uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
+ if (t > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = t;
+ frm_nxt += 4;
}
- for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
- {
- uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
- if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
- break;
- frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static int utf16le_to_ucs4_length(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ size_t mx,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
+ if ((c1 & 0xFC00) == 0xDC00)
+ break;
+ if ((c1 & 0xFC00) != 0xD800) {
+ if (c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ } else {
+ if (frm_end - frm_nxt < 4)
+ break;
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
+ if ((c2 & 0xFC00) != 0xDC00)
+ break;
+ uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
+ if (t > Maxcode)
+ break;
+ frm_nxt += 4;
}
- return static_cast<int>(frm_nxt - frm);
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static codecvt_base::result ucs2_to_utf16be(
+ const uint16_t* frm,
+ const uint16_t* frm_end,
+ const uint16_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint16_t wc = *frm_nxt;
+ if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf16be_to_ucs2(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint16_t* to,
+ uint16_t* to_end,
+ uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = c1;
+ frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static int utf16be_to_ucs2_length(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ size_t mx,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ const uint8_t* frm_nxt = frm;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF)
+ frm_nxt += 2;
+ }
+ for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ return static_cast<int>(frm_nxt - frm);
+}
+
+static codecvt_base::result ucs2_to_utf16le(
+ const uint16_t* frm,
+ const uint16_t* frm_end,
+ const uint16_t*& frm_nxt,
+ uint8_t* to,
+ uint8_t* to_end,
+ uint8_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & generate_header) {
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(0xFF);
+ *to_nxt++ = static_cast<uint8_t>(0xFE);
+ }
+ for (; frm_nxt < frm_end; ++frm_nxt) {
+ uint16_t wc = *frm_nxt;
+ if ((wc & 0xF800) == 0xD800 || wc > Maxcode)
+ return codecvt_base::error;
+ if (to_end - to_nxt < 2)
+ return codecvt_base::partial;
+ *to_nxt++ = static_cast<uint8_t>(wc);
+ *to_nxt++ = static_cast<uint8_t>(wc >> 8);
+ }
+ return codecvt_base::ok;
+}
+
+static codecvt_base::result utf16le_to_ucs2(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ const uint8_t*& frm_nxt,
+ uint16_t* to,
+ uint16_t* to_end,
+ uint16_t*& to_nxt,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ frm_nxt = frm;
+ to_nxt = to;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ return codecvt_base::error;
+ *to_nxt = c1;
+ frm_nxt += 2;
+ }
+ return frm_nxt < frm_end ? codecvt_base::partial : codecvt_base::ok;
+}
+
+static int utf16le_to_ucs2_length(
+ const uint8_t* frm,
+ const uint8_t* frm_end,
+ size_t mx,
+ unsigned long Maxcode = 0x10FFFF,
+ codecvt_mode mode = codecvt_mode(0)) {
+ const uint8_t* frm_nxt = frm;
+ frm_nxt = frm;
+ if (mode & consume_header) {
+ if (frm_end - frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE)
+ frm_nxt += 2;
+ }
+ for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) {
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
+ if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
+ break;
+ frm_nxt += 2;
+ }
+ return static_cast<int>(frm_nxt - frm);
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
@@ -3183,78 +2756,66 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
constinit locale::id codecvt<char16_t, char, mbstate_t>::id;
-codecvt<char16_t, char, mbstate_t>::~codecvt()
-{
-}
-
-codecvt<char16_t, char, mbstate_t>::result
-codecvt<char16_t, char, mbstate_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-codecvt<char16_t, char, mbstate_t>::result
-codecvt<char16_t, char, mbstate_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+codecvt<char16_t, char, mbstate_t>::~codecvt() {}
+
+codecvt<char16_t, char, mbstate_t>::result codecvt<char16_t, char, mbstate_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char16_t, char, mbstate_t>::result codecvt<char16_t, char, mbstate_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
codecvt<char16_t, char, mbstate_t>::result
-codecvt<char16_t, char, mbstate_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
+codecvt<char16_t, char, mbstate_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-int
-codecvt<char16_t, char, mbstate_t>::do_encoding() const noexcept
-{
- return 0;
-}
+int codecvt<char16_t, char, mbstate_t>::do_encoding() const noexcept { return 0; }
-bool
-codecvt<char16_t, char, mbstate_t>::do_always_noconv() const noexcept
-{
- return false;
-}
+bool codecvt<char16_t, char, mbstate_t>::do_always_noconv() const noexcept { return false; }
-int
-codecvt<char16_t, char, mbstate_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_utf16_length(_frm, _frm_end, mx);
+int codecvt<char16_t, char, mbstate_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx);
}
-int
-codecvt<char16_t, char, mbstate_t>::do_max_length() const noexcept
-{
- return 4;
-}
+int codecvt<char16_t, char, mbstate_t>::do_max_length() const noexcept { return 4; }
#ifndef _LIBCPP_HAS_NO_CHAR8_T
@@ -3262,78 +2823,66 @@ codecvt<char16_t, char, mbstate_t>::do_max_length() const noexcept
constinit locale::id codecvt<char16_t, char8_t, mbstate_t>::id;
-codecvt<char16_t, char8_t, mbstate_t>::~codecvt()
-{
-}
-
-codecvt<char16_t, char8_t, mbstate_t>::result
-codecvt<char16_t, char8_t, mbstate_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-codecvt<char16_t, char8_t, mbstate_t>::result
-codecvt<char16_t, char8_t, mbstate_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-codecvt<char16_t, char8_t, mbstate_t>::result
-codecvt<char16_t, char8_t, mbstate_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
-
-int
-codecvt<char16_t, char8_t, mbstate_t>::do_encoding() const noexcept
-{
- return 0;
-}
-
-bool
-codecvt<char16_t, char8_t, mbstate_t>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-codecvt<char16_t, char8_t, mbstate_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_utf16_length(_frm, _frm_end, mx);
-}
-
-int
-codecvt<char16_t, char8_t, mbstate_t>::do_max_length() const noexcept
-{
- return 4;
-}
+codecvt<char16_t, char8_t, mbstate_t>::~codecvt() {}
+
+codecvt<char16_t, char8_t, mbstate_t>::result codecvt<char16_t, char8_t, mbstate_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char16_t, char8_t, mbstate_t>::result codecvt<char16_t, char8_t, mbstate_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char16_t, char8_t, mbstate_t>::result codecvt<char16_t, char8_t, mbstate_t>::do_unshift(
+ state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
+}
+
+int codecvt<char16_t, char8_t, mbstate_t>::do_encoding() const noexcept { return 0; }
+
+bool codecvt<char16_t, char8_t, mbstate_t>::do_always_noconv() const noexcept { return false; }
+
+int codecvt<char16_t, char8_t, mbstate_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx);
+}
+
+int codecvt<char16_t, char8_t, mbstate_t>::do_max_length() const noexcept { return 4; }
#endif
@@ -3341,78 +2890,66 @@ codecvt<char16_t, char8_t, mbstate_t>::do_max_length() const noexcept
constinit locale::id codecvt<char32_t, char, mbstate_t>::id;
-codecvt<char32_t, char, mbstate_t>::~codecvt()
-{
+codecvt<char32_t, char, mbstate_t>::~codecvt() {}
+
+codecvt<char32_t, char, mbstate_t>::result codecvt<char32_t, char, mbstate_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char32_t, char, mbstate_t>::result codecvt<char32_t, char, mbstate_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
codecvt<char32_t, char, mbstate_t>::result
-codecvt<char32_t, char, mbstate_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+codecvt<char32_t, char, mbstate_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-codecvt<char32_t, char, mbstate_t>::result
-codecvt<char32_t, char, mbstate_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
+int codecvt<char32_t, char, mbstate_t>::do_encoding() const noexcept { return 0; }
-codecvt<char32_t, char, mbstate_t>::result
-codecvt<char32_t, char, mbstate_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+bool codecvt<char32_t, char, mbstate_t>::do_always_noconv() const noexcept { return false; }
-int
-codecvt<char32_t, char, mbstate_t>::do_encoding() const noexcept
-{
- return 0;
+int codecvt<char32_t, char, mbstate_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs4_length(_frm, _frm_end, mx);
}
-bool
-codecvt<char32_t, char, mbstate_t>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-codecvt<char32_t, char, mbstate_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_ucs4_length(_frm, _frm_end, mx);
-}
-
-int
-codecvt<char32_t, char, mbstate_t>::do_max_length() const noexcept
-{
- return 4;
-}
+int codecvt<char32_t, char, mbstate_t>::do_max_length() const noexcept { return 4; }
#ifndef _LIBCPP_HAS_NO_CHAR8_T
@@ -3420,1131 +2957,983 @@ codecvt<char32_t, char, mbstate_t>::do_max_length() const noexcept
constinit locale::id codecvt<char32_t, char8_t, mbstate_t>::id;
-codecvt<char32_t, char8_t, mbstate_t>::~codecvt()
-{
-}
-
-codecvt<char32_t, char8_t, mbstate_t>::result
-codecvt<char32_t, char8_t, mbstate_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-codecvt<char32_t, char8_t, mbstate_t>::result
-codecvt<char32_t, char8_t, mbstate_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-codecvt<char32_t, char8_t, mbstate_t>::result
-codecvt<char32_t, char8_t, mbstate_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
-
-int
-codecvt<char32_t, char8_t, mbstate_t>::do_encoding() const noexcept
-{
- return 0;
-}
-
-bool
-codecvt<char32_t, char8_t, mbstate_t>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-codecvt<char32_t, char8_t, mbstate_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_ucs4_length(_frm, _frm_end, mx);
-}
-
-int
-codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const noexcept
-{
- return 4;
-}
+codecvt<char32_t, char8_t, mbstate_t>::~codecvt() {}
+
+codecvt<char32_t, char8_t, mbstate_t>::result codecvt<char32_t, char8_t, mbstate_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char32_t, char8_t, mbstate_t>::result codecvt<char32_t, char8_t, mbstate_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+codecvt<char32_t, char8_t, mbstate_t>::result codecvt<char32_t, char8_t, mbstate_t>::do_unshift(
+ state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
+}
+
+int codecvt<char32_t, char8_t, mbstate_t>::do_encoding() const noexcept { return 0; }
+
+bool codecvt<char32_t, char8_t, mbstate_t>::do_always_noconv() const noexcept { return false; }
+
+int codecvt<char32_t, char8_t, mbstate_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs4_length(_frm, _frm_end, mx);
+}
+
+int codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const noexcept { return 4; }
#endif
// __codecvt_utf8<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-__codecvt_utf8<wchar_t>::result
-__codecvt_utf8<wchar_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
-#if defined(_LIBCPP_SHORT_WCHAR)
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
-#else
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
-#endif
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
-#if defined(_LIBCPP_SHORT_WCHAR)
- result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#else
- result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#endif
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8<wchar_t>::result __codecvt_utf8<wchar_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+# if defined(_LIBCPP_SHORT_WCHAR)
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+# else
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+# endif
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+# if defined(_LIBCPP_SHORT_WCHAR)
+ result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# else
+ result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# endif
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<wchar_t>::result __codecvt_utf8<wchar_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+# if defined(_LIBCPP_SHORT_WCHAR)
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# else
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# endif
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf8<wchar_t>::result
-__codecvt_utf8<wchar_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
-#if defined(_LIBCPP_SHORT_WCHAR)
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#else
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#endif
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8<wchar_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf8<wchar_t>::result
-__codecvt_utf8<wchar_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf8<wchar_t>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf8<wchar_t>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf8<wchar_t>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf8<wchar_t>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-__codecvt_utf8<wchar_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
-#if defined(_LIBCPP_SHORT_WCHAR)
- return utf8_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
-#else
- return utf8_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
-#endif
+int __codecvt_utf8<wchar_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+# if defined(_LIBCPP_SHORT_WCHAR)
+ return utf8_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+# else
+ return utf8_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+# endif
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf8<wchar_t>::do_max_length() const noexcept
-{
-#if defined(_LIBCPP_SHORT_WCHAR)
- if (__mode_ & consume_header)
- return 6;
- return 3;
-#else
- if (__mode_ & consume_header)
- return 7;
- return 4;
-#endif
+int __codecvt_utf8<wchar_t>::do_max_length() const noexcept {
+# if defined(_LIBCPP_SHORT_WCHAR)
+ if (__mode_ & consume_header)
+ return 6;
+ return 3;
+# else
+ if (__mode_ & consume_header)
+ return 7;
+ return 4;
+# endif
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// __codecvt_utf8<char16_t>
-__codecvt_utf8<char16_t>::result
-__codecvt_utf8<char16_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-__codecvt_utf8<char16_t>::result
-__codecvt_utf8<char16_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8<char16_t>::result __codecvt_utf8<char16_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<char16_t>::result __codecvt_utf8<char16_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf8<char16_t>::result
-__codecvt_utf8<char16_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
+__codecvt_utf8<char16_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-int
-__codecvt_utf8<char16_t>::do_encoding() const noexcept
-{
- return 0;
-}
+int __codecvt_utf8<char16_t>::do_encoding() const noexcept { return 0; }
-bool
-__codecvt_utf8<char16_t>::do_always_noconv() const noexcept
-{
- return false;
-}
+bool __codecvt_utf8<char16_t>::do_always_noconv() const noexcept { return false; }
-int
-__codecvt_utf8<char16_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf8<char16_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf8<char16_t>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 6;
- return 3;
+int __codecvt_utf8<char16_t>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 6;
+ return 3;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __codecvt_utf8<char32_t>
-__codecvt_utf8<char32_t>::result
-__codecvt_utf8<char32_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8<char32_t>::result __codecvt_utf8<char32_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8<char32_t>::result __codecvt_utf8<char32_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf8<char32_t>::result
-__codecvt_utf8<char32_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8<char32_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf8<char32_t>::result
-__codecvt_utf8<char32_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf8<char32_t>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf8<char32_t>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf8<char32_t>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf8<char32_t>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-__codecvt_utf8<char32_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf8<char32_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf8<char32_t>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 7;
- return 4;
+int __codecvt_utf8<char32_t>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 7;
+ return 4;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __codecvt_utf16<wchar_t, false>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-__codecvt_utf16<wchar_t, false>::result
-__codecvt_utf16<wchar_t, false>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
-#if defined(_LIBCPP_SHORT_WCHAR)
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
-#else
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
-#endif
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
-#if defined(_LIBCPP_SHORT_WCHAR)
- result r = ucs2_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#else
- result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#endif
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<wchar_t, false>::result __codecvt_utf16<wchar_t, false>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+# if defined(_LIBCPP_SHORT_WCHAR)
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+# else
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+# endif
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+# if defined(_LIBCPP_SHORT_WCHAR)
+ result r = ucs2_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# else
+ result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# endif
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<wchar_t, false>::result __codecvt_utf16<wchar_t, false>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+# if defined(_LIBCPP_SHORT_WCHAR)
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf16be_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# else
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# endif
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf16<wchar_t, false>::result
-__codecvt_utf16<wchar_t, false>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
-#if defined(_LIBCPP_SHORT_WCHAR)
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf16be_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#else
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#endif
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<wchar_t, false>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf16<wchar_t, false>::result
-__codecvt_utf16<wchar_t, false>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf16<wchar_t, false>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf16<wchar_t, false>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf16<wchar_t, false>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf16<wchar_t, false>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-__codecvt_utf16<wchar_t, false>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
-#if defined(_LIBCPP_SHORT_WCHAR)
- return utf16be_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
-#else
- return utf16be_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
-#endif
+int __codecvt_utf16<wchar_t, false>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+# if defined(_LIBCPP_SHORT_WCHAR)
+ return utf16be_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+# else
+ return utf16be_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+# endif
}
-int
-__codecvt_utf16<wchar_t, false>::do_max_length() const noexcept
-{
-#if defined(_LIBCPP_SHORT_WCHAR)
- if (__mode_ & consume_header)
- return 4;
- return 2;
-#else
- if (__mode_ & consume_header)
- return 6;
+int __codecvt_utf16<wchar_t, false>::do_max_length() const noexcept {
+# if defined(_LIBCPP_SHORT_WCHAR)
+ if (__mode_ & consume_header)
return 4;
-#endif
+ return 2;
+# else
+ if (__mode_ & consume_header)
+ return 6;
+ return 4;
+# endif
}
// __codecvt_utf16<wchar_t, true>
-__codecvt_utf16<wchar_t, true>::result
-__codecvt_utf16<wchar_t, true>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
-#if defined(_LIBCPP_SHORT_WCHAR)
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
-#else
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
-#endif
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
-#if defined(_LIBCPP_SHORT_WCHAR)
- result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#else
- result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#endif
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<wchar_t, true>::result __codecvt_utf16<wchar_t, true>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+# if defined(_LIBCPP_SHORT_WCHAR)
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+# else
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+# endif
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+# if defined(_LIBCPP_SHORT_WCHAR)
+ result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# else
+ result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# endif
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<wchar_t, true>::result __codecvt_utf16<wchar_t, true>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+# if defined(_LIBCPP_SHORT_WCHAR)
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf16le_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# else
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+# endif
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf16<wchar_t, true>::result
-__codecvt_utf16<wchar_t, true>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
-#if defined(_LIBCPP_SHORT_WCHAR)
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf16le_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#else
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
-#endif
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<wchar_t, true>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf16<wchar_t, true>::result
-__codecvt_utf16<wchar_t, true>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf16<wchar_t, true>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf16<wchar_t, true>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf16<wchar_t, true>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf16<wchar_t, true>::do_always_noconv() const noexcept
-{
- return false;
+int __codecvt_utf16<wchar_t, true>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+# if defined(_LIBCPP_SHORT_WCHAR)
+ return utf16le_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+# else
+ return utf16le_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+# endif
}
-int
-__codecvt_utf16<wchar_t, true>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
-#if defined(_LIBCPP_SHORT_WCHAR)
- return utf16le_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
-#else
- return utf16le_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
-#endif
-}
-
-int
-__codecvt_utf16<wchar_t, true>::do_max_length() const noexcept
-{
-#if defined(_LIBCPP_SHORT_WCHAR)
- if (__mode_ & consume_header)
- return 4;
- return 2;
-#else
- if (__mode_ & consume_header)
- return 6;
+int __codecvt_utf16<wchar_t, true>::do_max_length() const noexcept {
+# if defined(_LIBCPP_SHORT_WCHAR)
+ if (__mode_ & consume_header)
return 4;
-#endif
+ return 2;
+# else
+ if (__mode_ & consume_header)
+ return 6;
+ return 4;
+# endif
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// __codecvt_utf16<char16_t, false>
-__codecvt_utf16<char16_t, false>::result
-__codecvt_utf16<char16_t, false>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs2_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<char16_t, false>::result __codecvt_utf16<char16_t, false>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs2_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char16_t, false>::result __codecvt_utf16<char16_t, false>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf16be_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf16<char16_t, false>::result
-__codecvt_utf16<char16_t, false>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf16be_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<char16_t, false>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf16<char16_t, false>::result
-__codecvt_utf16<char16_t, false>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf16<char16_t, false>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf16<char16_t, false>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf16<char16_t, false>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf16<char16_t, false>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-__codecvt_utf16<char16_t, false>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf16be_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf16<char16_t, false>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16be_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf16<char16_t, false>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 4;
- return 2;
+int __codecvt_utf16<char16_t, false>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 4;
+ return 2;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __codecvt_utf16<char16_t, true>
-__codecvt_utf16<char16_t, true>::result
-__codecvt_utf16<char16_t, true>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-__codecvt_utf16<char16_t, true>::result
-__codecvt_utf16<char16_t, true>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf16le_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<char16_t, true>::result __codecvt_utf16<char16_t, true>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs2_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char16_t, true>::result __codecvt_utf16<char16_t, true>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf16le_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf16<char16_t, true>::result
-__codecvt_utf16<char16_t, true>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
+__codecvt_utf16<char16_t, true>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-int
-__codecvt_utf16<char16_t, true>::do_encoding() const noexcept
-{
- return 0;
-}
+int __codecvt_utf16<char16_t, true>::do_encoding() const noexcept { return 0; }
-bool
-__codecvt_utf16<char16_t, true>::do_always_noconv() const noexcept
-{
- return false;
-}
+bool __codecvt_utf16<char16_t, true>::do_always_noconv() const noexcept { return false; }
-int
-__codecvt_utf16<char16_t, true>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf16le_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf16<char16_t, true>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16le_to_ucs2_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf16<char16_t, true>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 4;
- return 2;
+int __codecvt_utf16<char16_t, true>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 4;
+ return 2;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __codecvt_utf16<char32_t, false>
-__codecvt_utf16<char32_t, false>::result
-__codecvt_utf16<char32_t, false>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<char32_t, false>::result __codecvt_utf16<char32_t, false>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf16be(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char32_t, false>::result __codecvt_utf16<char32_t, false>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf16<char32_t, false>::result
-__codecvt_utf16<char32_t, false>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf16be_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<char32_t, false>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf16<char32_t, false>::result
-__codecvt_utf16<char32_t, false>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf16<char32_t, false>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf16<char32_t, false>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf16<char32_t, false>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf16<char32_t, false>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-__codecvt_utf16<char32_t, false>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf16be_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf16<char32_t, false>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16be_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf16<char32_t, false>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 6;
- return 4;
+int __codecvt_utf16<char32_t, false>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 6;
+ return 4;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __codecvt_utf16<char32_t, true>
-__codecvt_utf16<char32_t, true>::result
-__codecvt_utf16<char32_t, true>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<char32_t, true>::result __codecvt_utf16<char32_t, true>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = ucs4_to_utf16le(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf16<char32_t, true>::result __codecvt_utf16<char32_t, true>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf16<char32_t, true>::result
-__codecvt_utf16<char32_t, true>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf16le_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf16<char32_t, true>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf16<char32_t, true>::result
-__codecvt_utf16<char32_t, true>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf16<char32_t, true>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf16<char32_t, true>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf16<char32_t, true>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf16<char32_t, true>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-__codecvt_utf16<char32_t, true>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf16le_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf16<char32_t, true>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf16le_to_ucs4_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf16<char32_t, true>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 6;
- return 4;
+int __codecvt_utf16<char32_t, true>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 6;
+ return 4;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __codecvt_utf8_utf16<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-__codecvt_utf8_utf16<wchar_t>::result
-__codecvt_utf8_utf16<wchar_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
-#if defined(_LIBCPP_SHORT_WCHAR)
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
-#else
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
-#endif
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+# if defined(_LIBCPP_SHORT_WCHAR)
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+# else
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+# endif
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+# if defined(_LIBCPP_SHORT_WCHAR)
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+# else
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+# endif
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf8_utf16<wchar_t>::result
-__codecvt_utf8_utf16<wchar_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
-#if defined(_LIBCPP_SHORT_WCHAR)
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
-#else
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
-#endif
- result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8_utf16<wchar_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf8_utf16<wchar_t>::result
-__codecvt_utf8_utf16<wchar_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
-
-int
-__codecvt_utf8_utf16<wchar_t>::do_encoding() const noexcept
-{
- return 0;
-}
+int __codecvt_utf8_utf16<wchar_t>::do_encoding() const noexcept { return 0; }
-bool
-__codecvt_utf8_utf16<wchar_t>::do_always_noconv() const noexcept
-{
- return false;
-}
+bool __codecvt_utf8_utf16<wchar_t>::do_always_noconv() const noexcept { return false; }
-int
-__codecvt_utf8_utf16<wchar_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf8_utf16<wchar_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
-int
-__codecvt_utf8_utf16<wchar_t>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 7;
- return 4;
+int __codecvt_utf8_utf16<wchar_t>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 7;
+ return 4;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// __codecvt_utf8_utf16<char16_t>
-__codecvt_utf8_utf16<char16_t>::result
-__codecvt_utf8_utf16<char16_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
- const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
- const uint16_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
-}
-
-__codecvt_utf8_utf16<char16_t>::result
-__codecvt_utf8_utf16<char16_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint16_t* _to = reinterpret_cast<uint16_t*>(to);
- uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
- uint16_t* _to_nxt = _to;
- result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8_utf16<char16_t>::result __codecvt_utf8_utf16<char16_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
+ const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
+ const uint16_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<char16_t>::result __codecvt_utf8_utf16<char16_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint16_t* _to = reinterpret_cast<uint16_t*>(to);
+ uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
+ uint16_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf8_utf16<char16_t>::result
-__codecvt_utf8_utf16<char16_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
+__codecvt_utf8_utf16<char16_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-int
-__codecvt_utf8_utf16<char16_t>::do_encoding() const noexcept
-{
- return 0;
-}
+int __codecvt_utf8_utf16<char16_t>::do_encoding() const noexcept { return 0; }
-bool
-__codecvt_utf8_utf16<char16_t>::do_always_noconv() const noexcept
-{
- return false;
-}
+bool __codecvt_utf8_utf16<char16_t>::do_always_noconv() const noexcept { return false; }
-int
-__codecvt_utf8_utf16<char16_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf8_utf16<char16_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf8_utf16<char16_t>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 7;
- return 4;
+int __codecvt_utf8_utf16<char16_t>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 7;
+ return 4;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __codecvt_utf8_utf16<char32_t>
-__codecvt_utf8_utf16<char32_t>::result
-__codecvt_utf8_utf16<char32_t>::do_out(state_type&,
- const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
- extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
-{
- const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
- const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
- const uint32_t* _frm_nxt = _frm;
- uint8_t* _to = reinterpret_cast<uint8_t*>(to);
- uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
- uint8_t* _to_nxt = _to;
- result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8_utf16<char32_t>::result __codecvt_utf8_utf16<char32_t>::do_out(
+ state_type&,
+ const intern_type* frm,
+ const intern_type* frm_end,
+ const intern_type*& frm_nxt,
+ extern_type* to,
+ extern_type* to_end,
+ extern_type*& to_nxt) const {
+ const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
+ const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
+ const uint32_t* _frm_nxt = _frm;
+ uint8_t* _to = reinterpret_cast<uint8_t*>(to);
+ uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
+ uint8_t* _to_nxt = _to;
+ result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
+}
+
+__codecvt_utf8_utf16<char32_t>::result __codecvt_utf8_utf16<char32_t>::do_in(
+ state_type&,
+ const extern_type* frm,
+ const extern_type* frm_end,
+ const extern_type*& frm_nxt,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_nxt) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ const uint8_t* _frm_nxt = _frm;
+ uint32_t* _to = reinterpret_cast<uint32_t*>(to);
+ uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
+ uint32_t* _to_nxt = _to;
+ result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt, __maxcode_, __mode_);
+ frm_nxt = frm + (_frm_nxt - _frm);
+ to_nxt = to + (_to_nxt - _to);
+ return r;
}
__codecvt_utf8_utf16<char32_t>::result
-__codecvt_utf8_utf16<char32_t>::do_in(state_type&,
- const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
- intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- const uint8_t* _frm_nxt = _frm;
- uint32_t* _to = reinterpret_cast<uint32_t*>(to);
- uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
- uint32_t* _to_nxt = _to;
- result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
- __maxcode_, __mode_);
- frm_nxt = frm + (_frm_nxt - _frm);
- to_nxt = to + (_to_nxt - _to);
- return r;
+__codecvt_utf8_utf16<char32_t>::do_unshift(state_type&, extern_type* to, extern_type*, extern_type*& to_nxt) const {
+ to_nxt = to;
+ return noconv;
}
-__codecvt_utf8_utf16<char32_t>::result
-__codecvt_utf8_utf16<char32_t>::do_unshift(state_type&,
- extern_type* to, extern_type*, extern_type*& to_nxt) const
-{
- to_nxt = to;
- return noconv;
-}
+int __codecvt_utf8_utf16<char32_t>::do_encoding() const noexcept { return 0; }
-int
-__codecvt_utf8_utf16<char32_t>::do_encoding() const noexcept
-{
- return 0;
-}
+bool __codecvt_utf8_utf16<char32_t>::do_always_noconv() const noexcept { return false; }
-bool
-__codecvt_utf8_utf16<char32_t>::do_always_noconv() const noexcept
-{
- return false;
-}
-
-int
-__codecvt_utf8_utf16<char32_t>::do_length(state_type&,
- const extern_type* frm, const extern_type* frm_end, size_t mx) const
-{
- const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
- const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
- return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_);
+int __codecvt_utf8_utf16<char32_t>::do_length(
+ state_type&, const extern_type* frm, const extern_type* frm_end, size_t mx) const {
+ const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
+ const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
+ return utf8_to_utf16_length(_frm, _frm_end, mx, __maxcode_, __mode_);
}
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-int
-__codecvt_utf8_utf16<char32_t>::do_max_length() const noexcept
-{
- if (__mode_ & consume_header)
- return 7;
- return 4;
+int __codecvt_utf8_utf16<char32_t>::do_max_length() const noexcept {
+ if (__mode_ & consume_header)
+ return 7;
+ return 4;
}
_LIBCPP_SUPPRESS_DEPRECATED_POP
// __narrow_to_utf8<16>
-__narrow_to_utf8<16>::~__narrow_to_utf8()
-{
-}
+__narrow_to_utf8<16>::~__narrow_to_utf8() {}
// __narrow_to_utf8<32>
-__narrow_to_utf8<32>::~__narrow_to_utf8()
-{
-}
+__narrow_to_utf8<32>::~__narrow_to_utf8() {}
// __widen_from_utf8<16>
-__widen_from_utf8<16>::~__widen_from_utf8()
-{
-}
+__widen_from_utf8<16>::~__widen_from_utf8() {}
// __widen_from_utf8<32>
-__widen_from_utf8<32>::~__widen_from_utf8()
-{
-}
+__widen_from_utf8<32>::~__widen_from_utf8() {}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-static bool checked_string_to_wchar_convert(wchar_t& dest,
- const char* ptr,
- locale_t loc) {
+static bool checked_string_to_wchar_convert(wchar_t& dest, const char* ptr, locale_t loc) {
if (*ptr == '\0')
return false;
mbstate_t mb = {};
@@ -4570,9 +3959,7 @@ static bool is_non_breaking_space(const char* ptr) {
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-static bool checked_string_to_char_convert(char& dest,
- const char* ptr,
- locale_t __loc) {
+static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t __loc) {
if (*ptr == '\0')
return false;
if (!ptr[1]) {
@@ -4601,7 +3988,7 @@ static bool checked_string_to_char_convert(char& dest,
default:
return false;
}
-#else // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#else // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// FIXME: Work around specific multibyte sequences that we can reasonably
// translate into a different single byte.
if (is_narrow_non_breaking_space(ptr) || is_non_breaking_space(ptr)) {
@@ -4614,7 +4001,6 @@ static bool checked_string_to_char_convert(char& dest,
__libcpp_unreachable();
}
-
// numpunct<char> && numpunct<wchar_t>
constinit locale::id numpunct<char>::id;
@@ -4622,1941 +4008,1707 @@ constinit locale::id numpunct<char>::id;
constinit locale::id numpunct<wchar_t>::id;
#endif
-numpunct<char>::numpunct(size_t refs)
- : locale::facet(refs),
- __decimal_point_('.'),
- __thousands_sep_(',')
-{
-}
+numpunct<char>::numpunct(size_t refs) : locale::facet(refs), __decimal_point_('.'), __thousands_sep_(',') {}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-numpunct<wchar_t>::numpunct(size_t refs)
- : locale::facet(refs),
- __decimal_point_(L'.'),
- __thousands_sep_(L',')
-{
-}
+numpunct<wchar_t>::numpunct(size_t refs) : locale::facet(refs), __decimal_point_(L'.'), __thousands_sep_(L',') {}
#endif
-numpunct<char>::~numpunct()
-{
-}
+numpunct<char>::~numpunct() {}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-numpunct<wchar_t>::~numpunct()
-{
-}
+numpunct<wchar_t>::~numpunct() {}
#endif
- char numpunct< char >::do_decimal_point() const {return __decimal_point_;}
+char numpunct< char >::do_decimal_point() const { return __decimal_point_; }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-wchar_t numpunct<wchar_t>::do_decimal_point() const {return __decimal_point_;}
+wchar_t numpunct<wchar_t>::do_decimal_point() const { return __decimal_point_; }
#endif
- char numpunct< char >::do_thousands_sep() const {return __thousands_sep_;}
+char numpunct< char >::do_thousands_sep() const { return __thousands_sep_; }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-wchar_t numpunct<wchar_t>::do_thousands_sep() const {return __thousands_sep_;}
+wchar_t numpunct<wchar_t>::do_thousands_sep() const { return __thousands_sep_; }
#endif
-string numpunct< char >::do_grouping() const {return __grouping_;}
+string numpunct< char >::do_grouping() const { return __grouping_; }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-string numpunct<wchar_t>::do_grouping() const {return __grouping_;}
+string numpunct<wchar_t>::do_grouping() const { return __grouping_; }
#endif
- string numpunct< char >::do_truename() const {return "true";}
+string numpunct< char >::do_truename() const { return "true"; }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-wstring numpunct<wchar_t>::do_truename() const {return L"true";}
+wstring numpunct<wchar_t>::do_truename() const { return L"true"; }
#endif
- string numpunct< char >::do_falsename() const {return "false";}
+string numpunct< char >::do_falsename() const { return "false"; }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-wstring numpunct<wchar_t>::do_falsename() const {return L"false";}
+wstring numpunct<wchar_t>::do_falsename() const { return L"false"; }
#endif
// numpunct_byname<char>
-numpunct_byname<char>::numpunct_byname(const char* nm, size_t refs)
- : numpunct<char>(refs)
-{
- __init(nm);
-}
+numpunct_byname<char>::numpunct_byname(const char* nm, size_t refs) : numpunct<char>(refs) { __init(nm); }
-numpunct_byname<char>::numpunct_byname(const string& nm, size_t refs)
- : numpunct<char>(refs)
-{
- __init(nm.c_str());
-}
+numpunct_byname<char>::numpunct_byname(const string& nm, size_t refs) : numpunct<char>(refs) { __init(nm.c_str()); }
-numpunct_byname<char>::~numpunct_byname()
-{
-}
+numpunct_byname<char>::~numpunct_byname() {}
-void
-numpunct_byname<char>::__init(const char* nm)
-{
- typedef numpunct<char> base;
- if (strcmp(nm, "C") != 0)
- {
- __libcpp_unique_locale loc(nm);
- if (!loc)
- __throw_runtime_error(("numpunct_byname<char>::numpunct_byname"
- " failed to construct for " + string(nm)).c_str());
-
- lconv* lc = __libcpp_localeconv_l(loc.get());
- if (!checked_string_to_char_convert(__decimal_point_, lc->decimal_point,
- loc.get()))
- __decimal_point_ = base::do_decimal_point();
- if (!checked_string_to_char_convert(__thousands_sep_, lc->thousands_sep,
- loc.get()))
- __thousands_sep_ = base::do_thousands_sep();
- __grouping_ = lc->grouping;
- // localization for truename and falsename is not available
- }
+void numpunct_byname<char>::__init(const char* nm) {
+ typedef numpunct<char> base;
+ if (strcmp(nm, "C") != 0) {
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
+ __throw_runtime_error(
+ ("numpunct_byname<char>::numpunct_byname"
+ " failed to construct for " +
+ string(nm))
+ .c_str());
+
+ lconv* lc = __libcpp_localeconv_l(loc.get());
+ if (!checked_string_to_char_convert(__decimal_point_, lc->decimal_point, loc.get()))
+ __decimal_point_ = base::do_decimal_point();
+ if (!checked_string_to_char_convert(__thousands_sep_, lc->thousands_sep, loc.get()))
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->grouping;
+ // localization for truename and falsename is not available
+ }
}
// numpunct_byname<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs)
- : numpunct<wchar_t>(refs)
-{
- __init(nm);
-}
+numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs) : numpunct<wchar_t>(refs) { __init(nm); }
-numpunct_byname<wchar_t>::numpunct_byname(const string& nm, size_t refs)
- : numpunct<wchar_t>(refs)
-{
- __init(nm.c_str());
+numpunct_byname<wchar_t>::numpunct_byname(const string& nm, size_t refs) : numpunct<wchar_t>(refs) {
+ __init(nm.c_str());
}
-numpunct_byname<wchar_t>::~numpunct_byname()
-{
-}
+numpunct_byname<wchar_t>::~numpunct_byname() {}
-void
-numpunct_byname<wchar_t>::__init(const char* nm)
-{
- if (strcmp(nm, "C") != 0)
- {
- __libcpp_unique_locale loc(nm);
- if (!loc)
- __throw_runtime_error(("numpunct_byname<wchar_t>::numpunct_byname"
- " failed to construct for " + string(nm)).c_str());
-
- lconv* lc = __libcpp_localeconv_l(loc.get());
- checked_string_to_wchar_convert(__decimal_point_, lc->decimal_point,
- loc.get());
- checked_string_to_wchar_convert(__thousands_sep_, lc->thousands_sep,
- loc.get());
- __grouping_ = lc->grouping;
- // localization for truename and falsename is not available
- }
+void numpunct_byname<wchar_t>::__init(const char* nm) {
+ if (strcmp(nm, "C") != 0) {
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
+ __throw_runtime_error(
+ ("numpunct_byname<wchar_t>::numpunct_byname"
+ " failed to construct for " +
+ string(nm))
+ .c_str());
+
+ lconv* lc = __libcpp_localeconv_l(loc.get());
+ checked_string_to_wchar_convert(__decimal_point_, lc->decimal_point, loc.get());
+ checked_string_to_wchar_convert(__thousands_sep_, lc->thousands_sep, loc.get());
+ __grouping_ = lc->grouping;
+ // localization for truename and falsename is not available
+ }
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// num_get helpers
-int
-__num_get_base::__get_base(ios_base& iob)
-{
- ios_base::fmtflags __basefield = iob.flags() & ios_base::basefield;
- if (__basefield == ios_base::oct)
- return 8;
- else if (__basefield == ios_base::hex)
- return 16;
- else if (__basefield == 0)
- return 0;
- return 10;
+int __num_get_base::__get_base(ios_base& iob) {
+ ios_base::fmtflags __basefield = iob.flags() & ios_base::basefield;
+ if (__basefield == ios_base::oct)
+ return 8;
+ else if (__basefield == ios_base::hex)
+ return 16;
+ else if (__basefield == 0)
+ return 0;
+ return 10;
}
const char __num_get_base::__src[33] = "0123456789abcdefABCDEFxX+-pPiInN";
-void
-__check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
- ios_base::iostate& __err)
-{
-// if the grouping pattern is empty _or_ there are no grouping bits, then do nothing
-// we always have at least a single entry in [__g, __g_end); the end of the input sequence
- if (__grouping.size() != 0 && __g_end - __g > 1)
- {
- reverse(__g, __g_end);
- const char* __ig = __grouping.data();
- const char* __eg = __ig + __grouping.size();
- for (unsigned* __r = __g; __r < __g_end-1; ++__r)
- {
- if (0 < *__ig && *__ig < numeric_limits<char>::max())
- {
- if (static_cast<unsigned>(*__ig) != *__r)
- {
- __err = ios_base::failbit;
- return;
- }
- }
- if (__eg - __ig > 1)
- ++__ig;
- }
- if (0 < *__ig && *__ig < numeric_limits<char>::max())
- {
- if (static_cast<unsigned>(*__ig) < __g_end[-1] || __g_end[-1] == 0)
- __err = ios_base::failbit;
+void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err) {
+ // if the grouping pattern is empty _or_ there are no grouping bits, then do nothing
+ // we always have at least a single entry in [__g, __g_end); the end of the input sequence
+ if (__grouping.size() != 0 && __g_end - __g > 1) {
+ reverse(__g, __g_end);
+ const char* __ig = __grouping.data();
+ const char* __eg = __ig + __grouping.size();
+ for (unsigned* __r = __g; __r < __g_end - 1; ++__r) {
+ if (0 < *__ig && *__ig < numeric_limits<char>::max()) {
+ if (static_cast<unsigned>(*__ig) != *__r) {
+ __err = ios_base::failbit;
+ return;
}
+ }
+ if (__eg - __ig > 1)
+ ++__ig;
}
+ if (0 < *__ig && *__ig < numeric_limits<char>::max()) {
+ if (static_cast<unsigned>(*__ig) < __g_end[-1] || __g_end[-1] == 0)
+ __err = ios_base::failbit;
+ }
+ }
}
-void
-__num_put_base::__format_int(char* __fmtp, const char* __len, bool __signd,
- ios_base::fmtflags __flags)
-{
- if ((__flags & ios_base::showpos) &&
- (__flags & ios_base::basefield) != ios_base::oct &&
- (__flags & ios_base::basefield) != ios_base::hex &&
- __signd)
- *__fmtp++ = '+';
- if (__flags & ios_base::showbase)
- *__fmtp++ = '#';
- while(*__len)
- *__fmtp++ = *__len++;
- if ((__flags & ios_base::basefield) == ios_base::oct)
- *__fmtp = 'o';
- else if ((__flags & ios_base::basefield) == ios_base::hex)
- {
- if (__flags & ios_base::uppercase)
- *__fmtp = 'X';
- else
- *__fmtp = 'x';
- }
- else if (__signd)
- *__fmtp = 'd';
+void __num_put_base::__format_int(char* __fmtp, const char* __len, bool __signd, ios_base::fmtflags __flags) {
+ if ((__flags & ios_base::showpos) && (__flags & ios_base::basefield) != ios_base::oct &&
+ (__flags & ios_base::basefield) != ios_base::hex && __signd)
+ *__fmtp++ = '+';
+ if (__flags & ios_base::showbase)
+ *__fmtp++ = '#';
+ while (*__len)
+ *__fmtp++ = *__len++;
+ if ((__flags & ios_base::basefield) == ios_base::oct)
+ *__fmtp = 'o';
+ else if ((__flags & ios_base::basefield) == ios_base::hex) {
+ if (__flags & ios_base::uppercase)
+ *__fmtp = 'X';
else
- *__fmtp = 'u';
-}
-
-bool
-__num_put_base::__format_float(char* __fmtp, const char* __len,
- ios_base::fmtflags __flags)
-{
- bool specify_precision = true;
- if (__flags & ios_base::showpos)
- *__fmtp++ = '+';
- if (__flags & ios_base::showpoint)
- *__fmtp++ = '#';
- ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
- bool uppercase = (__flags & ios_base::uppercase) != 0;
- if (floatfield == (ios_base::fixed | ios_base::scientific))
- specify_precision = false;
+ *__fmtp = 'x';
+ } else if (__signd)
+ *__fmtp = 'd';
+ else
+ *__fmtp = 'u';
+}
+
+bool __num_put_base::__format_float(char* __fmtp, const char* __len, ios_base::fmtflags __flags) {
+ bool specify_precision = true;
+ if (__flags & ios_base::showpos)
+ *__fmtp++ = '+';
+ if (__flags & ios_base::showpoint)
+ *__fmtp++ = '#';
+ ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
+ bool uppercase = (__flags & ios_base::uppercase) != 0;
+ if (floatfield == (ios_base::fixed | ios_base::scientific))
+ specify_precision = false;
+ else {
+ *__fmtp++ = '.';
+ *__fmtp++ = '*';
+ }
+ while (*__len)
+ *__fmtp++ = *__len++;
+ if (floatfield == ios_base::fixed) {
+ if (uppercase)
+ *__fmtp = 'F';
else
- {
- *__fmtp++ = '.';
- *__fmtp++ = '*';
- }
- while(*__len)
- *__fmtp++ = *__len++;
- if (floatfield == ios_base::fixed)
- {
- if (uppercase)
- *__fmtp = 'F';
- else
- *__fmtp = 'f';
- }
- else if (floatfield == ios_base::scientific)
- {
- if (uppercase)
- *__fmtp = 'E';
- else
- *__fmtp = 'e';
- }
- else if (floatfield == (ios_base::fixed | ios_base::scientific))
- {
- if (uppercase)
- *__fmtp = 'A';
- else
- *__fmtp = 'a';
- }
+ *__fmtp = 'f';
+ } else if (floatfield == ios_base::scientific) {
+ if (uppercase)
+ *__fmtp = 'E';
else
- {
- if (uppercase)
- *__fmtp = 'G';
- else
- *__fmtp = 'g';
- }
- return specify_precision;
-}
-
-char*
-__num_put_base::__identify_padding(char* __nb, char* __ne,
- const ios_base& __iob)
-{
- switch (__iob.flags() & ios_base::adjustfield)
- {
- case ios_base::internal:
- if (__nb[0] == '-' || __nb[0] == '+')
- return __nb+1;
- if (__ne - __nb >= 2 && __nb[0] == '0'
- && (__nb[1] == 'x' || __nb[1] == 'X'))
- return __nb+2;
- break;
- case ios_base::left:
- return __ne;
- case ios_base::right:
- default:
- break;
- }
- return __nb;
+ *__fmtp = 'e';
+ } else if (floatfield == (ios_base::fixed | ios_base::scientific)) {
+ if (uppercase)
+ *__fmtp = 'A';
+ else
+ *__fmtp = 'a';
+ } else {
+ if (uppercase)
+ *__fmtp = 'G';
+ else
+ *__fmtp = 'g';
+ }
+ return specify_precision;
+}
+
+char* __num_put_base::__identify_padding(char* __nb, char* __ne, const ios_base& __iob) {
+ switch (__iob.flags() & ios_base::adjustfield) {
+ case ios_base::internal:
+ if (__nb[0] == '-' || __nb[0] == '+')
+ return __nb + 1;
+ if (__ne - __nb >= 2 && __nb[0] == '0' && (__nb[1] == 'x' || __nb[1] == 'X'))
+ return __nb + 2;
+ break;
+ case ios_base::left:
+ return __ne;
+ case ios_base::right:
+ default:
+ break;
+ }
+ return __nb;
}
// time_get
-static
-string*
-init_weeks()
-{
- static string weeks[14];
- weeks[0] = "Sunday";
- weeks[1] = "Monday";
- weeks[2] = "Tuesday";
- weeks[3] = "Wednesday";
- weeks[4] = "Thursday";
- weeks[5] = "Friday";
- weeks[6] = "Saturday";
- weeks[7] = "Sun";
- weeks[8] = "Mon";
- weeks[9] = "Tue";
- weeks[10] = "Wed";
- weeks[11] = "Thu";
- weeks[12] = "Fri";
- weeks[13] = "Sat";
- return weeks;
+static string* init_weeks() {
+ static string weeks[14];
+ weeks[0] = "Sunday";
+ weeks[1] = "Monday";
+ weeks[2] = "Tuesday";
+ weeks[3] = "Wednesday";
+ weeks[4] = "Thursday";
+ weeks[5] = "Friday";
+ weeks[6] = "Saturday";
+ weeks[7] = "Sun";
+ weeks[8] = "Mon";
+ weeks[9] = "Tue";
+ weeks[10] = "Wed";
+ weeks[11] = "Thu";
+ weeks[12] = "Fri";
+ weeks[13] = "Sat";
+ return weeks;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-static
-wstring*
-init_wweeks()
-{
- static wstring weeks[14];
- weeks[0] = L"Sunday";
- weeks[1] = L"Monday";
- weeks[2] = L"Tuesday";
- weeks[3] = L"Wednesday";
- weeks[4] = L"Thursday";
- weeks[5] = L"Friday";
- weeks[6] = L"Saturday";
- weeks[7] = L"Sun";
- weeks[8] = L"Mon";
- weeks[9] = L"Tue";
- weeks[10] = L"Wed";
- weeks[11] = L"Thu";
- weeks[12] = L"Fri";
- weeks[13] = L"Sat";
- return weeks;
+static wstring* init_wweeks() {
+ static wstring weeks[14];
+ weeks[0] = L"Sunday";
+ weeks[1] = L"Monday";
+ weeks[2] = L"Tuesday";
+ weeks[3] = L"Wednesday";
+ weeks[4] = L"Thursday";
+ weeks[5] = L"Friday";
+ weeks[6] = L"Saturday";
+ weeks[7] = L"Sun";
+ weeks[8] = L"Mon";
+ weeks[9] = L"Tue";
+ weeks[10] = L"Wed";
+ weeks[11] = L"Thu";
+ weeks[12] = L"Fri";
+ weeks[13] = L"Sat";
+ return weeks;
}
#endif
template <>
-const string*
-__time_get_c_storage<char>::__weeks() const
-{
- static const string* weeks = init_weeks();
- return weeks;
+const string* __time_get_c_storage<char>::__weeks() const {
+ static const string* weeks = init_weeks();
+ return weeks;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-const wstring*
-__time_get_c_storage<wchar_t>::__weeks() const
-{
- static const wstring* weeks = init_wweeks();
- return weeks;
+const wstring* __time_get_c_storage<wchar_t>::__weeks() const {
+ static const wstring* weeks = init_wweeks();
+ return weeks;
}
#endif
-static
-string*
-init_months()
-{
- static string months[24];
- months[0] = "January";
- months[1] = "February";
- months[2] = "March";
- months[3] = "April";
- months[4] = "May";
- months[5] = "June";
- months[6] = "July";
- months[7] = "August";
- months[8] = "September";
- months[9] = "October";
- months[10] = "November";
- months[11] = "December";
- months[12] = "Jan";
- months[13] = "Feb";
- months[14] = "Mar";
- months[15] = "Apr";
- months[16] = "May";
- months[17] = "Jun";
- months[18] = "Jul";
- months[19] = "Aug";
- months[20] = "Sep";
- months[21] = "Oct";
- months[22] = "Nov";
- months[23] = "Dec";
- return months;
+static string* init_months() {
+ static string months[24];
+ months[0] = "January";
+ months[1] = "February";
+ months[2] = "March";
+ months[3] = "April";
+ months[4] = "May";
+ months[5] = "June";
+ months[6] = "July";
+ months[7] = "August";
+ months[8] = "September";
+ months[9] = "October";
+ months[10] = "November";
+ months[11] = "December";
+ months[12] = "Jan";
+ months[13] = "Feb";
+ months[14] = "Mar";
+ months[15] = "Apr";
+ months[16] = "May";
+ months[17] = "Jun";
+ months[18] = "Jul";
+ months[19] = "Aug";
+ months[20] = "Sep";
+ months[21] = "Oct";
+ months[22] = "Nov";
+ months[23] = "Dec";
+ return months;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-static
-wstring*
-init_wmonths()
-{
- static wstring months[24];
- months[0] = L"January";
- months[1] = L"February";
- months[2] = L"March";
- months[3] = L"April";
- months[4] = L"May";
- months[5] = L"June";
- months[6] = L"July";
- months[7] = L"August";
- months[8] = L"September";
- months[9] = L"October";
- months[10] = L"November";
- months[11] = L"December";
- months[12] = L"Jan";
- months[13] = L"Feb";
- months[14] = L"Mar";
- months[15] = L"Apr";
- months[16] = L"May";
- months[17] = L"Jun";
- months[18] = L"Jul";
- months[19] = L"Aug";
- months[20] = L"Sep";
- months[21] = L"Oct";
- months[22] = L"Nov";
- months[23] = L"Dec";
- return months;
+static wstring* init_wmonths() {
+ static wstring months[24];
+ months[0] = L"January";
+ months[1] = L"February";
+ months[2] = L"March";
+ months[3] = L"April";
+ months[4] = L"May";
+ months[5] = L"June";
+ months[6] = L"July";
+ months[7] = L"August";
+ months[8] = L"September";
+ months[9] = L"October";
+ months[10] = L"November";
+ months[11] = L"December";
+ months[12] = L"Jan";
+ months[13] = L"Feb";
+ months[14] = L"Mar";
+ months[15] = L"Apr";
+ months[16] = L"May";
+ months[17] = L"Jun";
+ months[18] = L"Jul";
+ months[19] = L"Aug";
+ months[20] = L"Sep";
+ months[21] = L"Oct";
+ months[22] = L"Nov";
+ months[23] = L"Dec";
+ return months;
}
#endif
template <>
-const string*
-__time_get_c_storage<char>::__months() const
-{
- static const string* months = init_months();
- return months;
+const string* __time_get_c_storage<char>::__months() const {
+ static const string* months = init_months();
+ return months;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-const wstring*
-__time_get_c_storage<wchar_t>::__months() const
-{
- static const wstring* months = init_wmonths();
- return months;
+const wstring* __time_get_c_storage<wchar_t>::__months() const {
+ static const wstring* months = init_wmonths();
+ return months;
}
#endif
-static
-string*
-init_am_pm()
-{
- static string am_pm[2];
- am_pm[0] = "AM";
- am_pm[1] = "PM";
- return am_pm;
+static string* init_am_pm() {
+ static string am_pm[2];
+ am_pm[0] = "AM";
+ am_pm[1] = "PM";
+ return am_pm;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-static
-wstring*
-init_wam_pm()
-{
- static wstring am_pm[2];
- am_pm[0] = L"AM";
- am_pm[1] = L"PM";
- return am_pm;
+static wstring* init_wam_pm() {
+ static wstring am_pm[2];
+ am_pm[0] = L"AM";
+ am_pm[1] = L"PM";
+ return am_pm;
}
#endif
template <>
-const string*
-__time_get_c_storage<char>::__am_pm() const
-{
- static const string* am_pm = init_am_pm();
- return am_pm;
+const string* __time_get_c_storage<char>::__am_pm() const {
+ static const string* am_pm = init_am_pm();
+ return am_pm;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-const wstring*
-__time_get_c_storage<wchar_t>::__am_pm() const
-{
- static const wstring* am_pm = init_wam_pm();
- return am_pm;
+const wstring* __time_get_c_storage<wchar_t>::__am_pm() const {
+ static const wstring* am_pm = init_wam_pm();
+ return am_pm;
}
#endif
template <>
-const string&
-__time_get_c_storage<char>::__x() const
-{
- static string s("%m/%d/%y");
- return s;
+const string& __time_get_c_storage<char>::__x() const {
+ static string s("%m/%d/%y");
+ return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-const wstring&
-__time_get_c_storage<wchar_t>::__x() const
-{
- static wstring s(L"%m/%d/%y");
- return s;
+const wstring& __time_get_c_storage<wchar_t>::__x() const {
+ static wstring s(L"%m/%d/%y");
+ return s;
}
#endif
template <>
-const string&
-__time_get_c_storage<char>::__X() const
-{
- static string s("%H:%M:%S");
- return s;
+const string& __time_get_c_storage<char>::__X() const {
+ static string s("%H:%M:%S");
+ return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-const wstring&
-__time_get_c_storage<wchar_t>::__X() const
-{
- static wstring s(L"%H:%M:%S");
- return s;
+const wstring& __time_get_c_storage<wchar_t>::__X() const {
+ static wstring s(L"%H:%M:%S");
+ return s;
}
#endif
template <>
-const string&
-__time_get_c_storage<char>::__c() const
-{
- static string s("%a %b %d %H:%M:%S %Y");
- return s;
+const string& __time_get_c_storage<char>::__c() const {
+ static string s("%a %b %d %H:%M:%S %Y");
+ return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-const wstring&
-__time_get_c_storage<wchar_t>::__c() const
-{
- static wstring s(L"%a %b %d %H:%M:%S %Y");
- return s;
+const wstring& __time_get_c_storage<wchar_t>::__c() const {
+ static wstring s(L"%a %b %d %H:%M:%S %Y");
+ return s;
}
#endif
template <>
-const string&
-__time_get_c_storage<char>::__r() const
-{
- static string s("%I:%M:%S %p");
- return s;
+const string& __time_get_c_storage<char>::__r() const {
+ static string s("%I:%M:%S %p");
+ return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-const wstring&
-__time_get_c_storage<wchar_t>::__r() const
-{
- static wstring s(L"%I:%M:%S %p");
- return s;
+const wstring& __time_get_c_storage<wchar_t>::__r() const {
+ static wstring s(L"%I:%M:%S %p");
+ return s;
}
#endif
// time_get_byname
-__time_get::__time_get(const char* nm)
- : __loc_(newlocale(LC_ALL_MASK, nm, 0))
-{
- if (__loc_ == 0)
- __throw_runtime_error(("time_get_byname failed to construct for " + string(nm)).c_str());
+__time_get::__time_get(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {
+ if (__loc_ == 0)
+ __throw_runtime_error(("time_get_byname failed to construct for " + string(nm)).c_str());
}
-__time_get::__time_get(const string& nm)
- : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0))
-{
- if (__loc_ == 0)
- __throw_runtime_error(("time_get_byname failed to construct for " + nm).c_str());
+__time_get::__time_get(const string& nm) : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0)) {
+ if (__loc_ == 0)
+ __throw_runtime_error(("time_get_byname failed to construct for " + nm).c_str());
}
-__time_get::~__time_get()
-{
- freelocale(__loc_);
-}
+__time_get::~__time_get() { freelocale(__loc_); }
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-field-initializers")
template <>
-string
-__time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
-{
- tm t = {0};
- t.tm_sec = 59;
- t.tm_min = 55;
- t.tm_hour = 23;
- t.tm_mday = 31;
- t.tm_mon = 11;
- t.tm_year = 161;
- t.tm_wday = 6;
- t.tm_yday = 364;
- t.tm_isdst = -1;
- char buf[100];
- char f[3] = {0};
- f[0] = '%';
- f[1] = fmt;
- size_t n = strftime_l(buf, countof(buf), f, &t, __loc_);
- char* bb = buf;
- char* be = buf + n;
- string result;
- while (bb != be)
- {
- if (ct.is(ctype_base::space, *bb))
- {
- result.push_back(' ');
- for (++bb; bb != be && ct.is(ctype_base::space, *bb); ++bb)
- ;
- continue;
- }
- char* w = bb;
- ios_base::iostate err = ios_base::goodbit;
- ptrdiff_t i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14,
- ct, err, false)
- - this->__weeks_;
- if (i < 14)
- {
- result.push_back('%');
- if (i < 7)
- result.push_back('A');
- else
- result.push_back('a');
- bb = w;
- continue;
- }
- w = bb;
- i = __scan_keyword(w, be, this->__months_, this->__months_+24,
- ct, err, false)
- - this->__months_;
- if (i < 24)
- {
- result.push_back('%');
- if (i < 12)
- result.push_back('B');
- else
- result.push_back('b');
- if (fmt == 'x' && ct.is(ctype_base::digit, this->__months_[i][0]))
- result.back() = 'm';
- bb = w;
- continue;
- }
- if (this->__am_pm_[0].size() + this->__am_pm_[1].size() > 0)
- {
- w = bb;
- i = __scan_keyword(w, be, this->__am_pm_, this->__am_pm_+2,
- ct, err, false) - this->__am_pm_;
- if (i < 2)
- {
- result.push_back('%');
- result.push_back('p');
- bb = w;
- continue;
- }
- }
- w = bb;
- if (ct.is(ctype_base::digit, *bb))
- {
- switch(__get_up_to_n_digits(bb, be, err, ct, 4))
- {
- case 6:
- result.push_back('%');
- result.push_back('w');
- break;
- case 7:
- result.push_back('%');
- result.push_back('u');
- break;
- case 11:
- result.push_back('%');
- result.push_back('I');
- break;
- case 12:
- result.push_back('%');
- result.push_back('m');
- break;
- case 23:
- result.push_back('%');
- result.push_back('H');
- break;
- case 31:
- result.push_back('%');
- result.push_back('d');
- break;
- case 55:
- result.push_back('%');
- result.push_back('M');
- break;
- case 59:
- result.push_back('%');
- result.push_back('S');
- break;
- case 61:
- result.push_back('%');
- result.push_back('y');
- break;
- case 364:
- result.push_back('%');
- result.push_back('j');
- break;
- case 2061:
- result.push_back('%');
- result.push_back('Y');
- break;
- default:
- for (; w != bb; ++w)
- result.push_back(*w);
- break;
- }
- continue;
- }
- if (*bb == '%')
- {
- result.push_back('%');
- result.push_back('%');
- ++bb;
- continue;
- }
- result.push_back(*bb);
- ++bb;
+string __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) {
+ tm t = {0};
+ t.tm_sec = 59;
+ t.tm_min = 55;
+ t.tm_hour = 23;
+ t.tm_mday = 31;
+ t.tm_mon = 11;
+ t.tm_year = 161;
+ t.tm_wday = 6;
+ t.tm_yday = 364;
+ t.tm_isdst = -1;
+ char buf[100];
+ char f[3] = {0};
+ f[0] = '%';
+ f[1] = fmt;
+ size_t n = strftime_l(buf, countof(buf), f, &t, __loc_);
+ char* bb = buf;
+ char* be = buf + n;
+ string result;
+ while (bb != be) {
+ if (ct.is(ctype_base::space, *bb)) {
+ result.push_back(' ');
+ for (++bb; bb != be && ct.is(ctype_base::space, *bb); ++bb)
+ ;
+ continue;
+ }
+ char* w = bb;
+ ios_base::iostate err = ios_base::goodbit;
+ ptrdiff_t i = __scan_keyword(w, be, this->__weeks_, this->__weeks_ + 14, ct, err, false) - this->__weeks_;
+ if (i < 14) {
+ result.push_back('%');
+ if (i < 7)
+ result.push_back('A');
+ else
+ result.push_back('a');
+ bb = w;
+ continue;
+ }
+ w = bb;
+ i = __scan_keyword(w, be, this->__months_, this->__months_ + 24, ct, err, false) - this->__months_;
+ if (i < 24) {
+ result.push_back('%');
+ if (i < 12)
+ result.push_back('B');
+ else
+ result.push_back('b');
+ if (fmt == 'x' && ct.is(ctype_base::digit, this->__months_[i][0]))
+ result.back() = 'm';
+ bb = w;
+ continue;
+ }
+ if (this->__am_pm_[0].size() + this->__am_pm_[1].size() > 0) {
+ w = bb;
+ i = __scan_keyword(w, be, this->__am_pm_, this->__am_pm_ + 2, ct, err, false) - this->__am_pm_;
+ if (i < 2) {
+ result.push_back('%');
+ result.push_back('p');
+ bb = w;
+ continue;
+ }
}
- return result;
+ w = bb;
+ if (ct.is(ctype_base::digit, *bb)) {
+ switch (__get_up_to_n_digits(bb, be, err, ct, 4)) {
+ case 6:
+ result.push_back('%');
+ result.push_back('w');
+ break;
+ case 7:
+ result.push_back('%');
+ result.push_back('u');
+ break;
+ case 11:
+ result.push_back('%');
+ result.push_back('I');
+ break;
+ case 12:
+ result.push_back('%');
+ result.push_back('m');
+ break;
+ case 23:
+ result.push_back('%');
+ result.push_back('H');
+ break;
+ case 31:
+ result.push_back('%');
+ result.push_back('d');
+ break;
+ case 55:
+ result.push_back('%');
+ result.push_back('M');
+ break;
+ case 59:
+ result.push_back('%');
+ result.push_back('S');
+ break;
+ case 61:
+ result.push_back('%');
+ result.push_back('y');
+ break;
+ case 364:
+ result.push_back('%');
+ result.push_back('j');
+ break;
+ case 2061:
+ result.push_back('%');
+ result.push_back('Y');
+ break;
+ default:
+ for (; w != bb; ++w)
+ result.push_back(*w);
+ break;
+ }
+ continue;
+ }
+ if (*bb == '%') {
+ result.push_back('%');
+ result.push_back('%');
+ ++bb;
+ continue;
+ }
+ result.push_back(*bb);
+ ++bb;
+ }
+ return result;
}
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-braces")
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-wstring
-__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
-{
- tm t = {0};
- t.tm_sec = 59;
- t.tm_min = 55;
- t.tm_hour = 23;
- t.tm_mday = 31;
- t.tm_mon = 11;
- t.tm_year = 161;
- t.tm_wday = 6;
- t.tm_yday = 364;
- t.tm_isdst = -1;
- char buf[100];
- char f[3] = {0};
- f[0] = '%';
- f[1] = fmt;
- strftime_l(buf, countof(buf), f, &t, __loc_);
- wchar_t wbuf[100];
- wchar_t* wbb = wbuf;
- mbstate_t mb = {0};
- const char* bb = buf;
- size_t j = __libcpp_mbsrtowcs_l( wbb, &bb, countof(wbuf), &mb, __loc_);
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- wchar_t* wbe = wbb + j;
- wstring result;
- while (wbb != wbe)
- {
- if (ct.is(ctype_base::space, *wbb))
- {
- result.push_back(L' ');
- for (++wbb; wbb != wbe && ct.is(ctype_base::space, *wbb); ++wbb)
- ;
- continue;
- }
- wchar_t* w = wbb;
- ios_base::iostate err = ios_base::goodbit;
- ptrdiff_t i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14,
- ct, err, false)
- - this->__weeks_;
- if (i < 14)
- {
- result.push_back(L'%');
- if (i < 7)
- result.push_back(L'A');
- else
- result.push_back(L'a');
- wbb = w;
- continue;
- }
- w = wbb;
- i = __scan_keyword(w, wbe, this->__months_, this->__months_+24,
- ct, err, false)
- - this->__months_;
- if (i < 24)
- {
- result.push_back(L'%');
- if (i < 12)
- result.push_back(L'B');
- else
- result.push_back(L'b');
- if (fmt == 'x' && ct.is(ctype_base::digit, this->__months_[i][0]))
- result.back() = L'm';
- wbb = w;
- continue;
- }
- if (this->__am_pm_[0].size() + this->__am_pm_[1].size() > 0)
- {
- w = wbb;
- i = __scan_keyword(w, wbe, this->__am_pm_, this->__am_pm_+2,
- ct, err, false) - this->__am_pm_;
- if (i < 2)
- {
- result.push_back(L'%');
- result.push_back(L'p');
- wbb = w;
- continue;
- }
- }
- w = wbb;
- if (ct.is(ctype_base::digit, *wbb))
- {
- switch(__get_up_to_n_digits(wbb, wbe, err, ct, 4))
- {
- case 6:
- result.push_back(L'%');
- result.push_back(L'w');
- break;
- case 7:
- result.push_back(L'%');
- result.push_back(L'u');
- break;
- case 11:
- result.push_back(L'%');
- result.push_back(L'I');
- break;
- case 12:
- result.push_back(L'%');
- result.push_back(L'm');
- break;
- case 23:
- result.push_back(L'%');
- result.push_back(L'H');
- break;
- case 31:
- result.push_back(L'%');
- result.push_back(L'd');
- break;
- case 55:
- result.push_back(L'%');
- result.push_back(L'M');
- break;
- case 59:
- result.push_back(L'%');
- result.push_back(L'S');
- break;
- case 61:
- result.push_back(L'%');
- result.push_back(L'y');
- break;
- case 364:
- result.push_back(L'%');
- result.push_back(L'j');
- break;
- case 2061:
- result.push_back(L'%');
- result.push_back(L'Y');
- break;
- default:
- for (; w != wbb; ++w)
- result.push_back(*w);
- break;
- }
- continue;
- }
- if (ct.narrow(*wbb, 0) == '%')
- {
- result.push_back(L'%');
- result.push_back(L'%');
- ++wbb;
- continue;
- }
- result.push_back(*wbb);
- ++wbb;
+wstring __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) {
+ tm t = {0};
+ t.tm_sec = 59;
+ t.tm_min = 55;
+ t.tm_hour = 23;
+ t.tm_mday = 31;
+ t.tm_mon = 11;
+ t.tm_year = 161;
+ t.tm_wday = 6;
+ t.tm_yday = 364;
+ t.tm_isdst = -1;
+ char buf[100];
+ char f[3] = {0};
+ f[0] = '%';
+ f[1] = fmt;
+ strftime_l(buf, countof(buf), f, &t, __loc_);
+ wchar_t wbuf[100];
+ wchar_t* wbb = wbuf;
+ mbstate_t mb = {0};
+ const char* bb = buf;
+ size_t j = __libcpp_mbsrtowcs_l(wbb, &bb, countof(wbuf), &mb, __loc_);
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ wchar_t* wbe = wbb + j;
+ wstring result;
+ while (wbb != wbe) {
+ if (ct.is(ctype_base::space, *wbb)) {
+ result.push_back(L' ');
+ for (++wbb; wbb != wbe && ct.is(ctype_base::space, *wbb); ++wbb)
+ ;
+ continue;
+ }
+ wchar_t* w = wbb;
+ ios_base::iostate err = ios_base::goodbit;
+ ptrdiff_t i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_ + 14, ct, err, false) - this->__weeks_;
+ if (i < 14) {
+ result.push_back(L'%');
+ if (i < 7)
+ result.push_back(L'A');
+ else
+ result.push_back(L'a');
+ wbb = w;
+ continue;
+ }
+ w = wbb;
+ i = __scan_keyword(w, wbe, this->__months_, this->__months_ + 24, ct, err, false) - this->__months_;
+ if (i < 24) {
+ result.push_back(L'%');
+ if (i < 12)
+ result.push_back(L'B');
+ else
+ result.push_back(L'b');
+ if (fmt == 'x' && ct.is(ctype_base::digit, this->__months_[i][0]))
+ result.back() = L'm';
+ wbb = w;
+ continue;
+ }
+ if (this->__am_pm_[0].size() + this->__am_pm_[1].size() > 0) {
+ w = wbb;
+ i = __scan_keyword(w, wbe, this->__am_pm_, this->__am_pm_ + 2, ct, err, false) - this->__am_pm_;
+ if (i < 2) {
+ result.push_back(L'%');
+ result.push_back(L'p');
+ wbb = w;
+ continue;
+ }
+ }
+ w = wbb;
+ if (ct.is(ctype_base::digit, *wbb)) {
+ switch (__get_up_to_n_digits(wbb, wbe, err, ct, 4)) {
+ case 6:
+ result.push_back(L'%');
+ result.push_back(L'w');
+ break;
+ case 7:
+ result.push_back(L'%');
+ result.push_back(L'u');
+ break;
+ case 11:
+ result.push_back(L'%');
+ result.push_back(L'I');
+ break;
+ case 12:
+ result.push_back(L'%');
+ result.push_back(L'm');
+ break;
+ case 23:
+ result.push_back(L'%');
+ result.push_back(L'H');
+ break;
+ case 31:
+ result.push_back(L'%');
+ result.push_back(L'd');
+ break;
+ case 55:
+ result.push_back(L'%');
+ result.push_back(L'M');
+ break;
+ case 59:
+ result.push_back(L'%');
+ result.push_back(L'S');
+ break;
+ case 61:
+ result.push_back(L'%');
+ result.push_back(L'y');
+ break;
+ case 364:
+ result.push_back(L'%');
+ result.push_back(L'j');
+ break;
+ case 2061:
+ result.push_back(L'%');
+ result.push_back(L'Y');
+ break;
+ default:
+ for (; w != wbb; ++w)
+ result.push_back(*w);
+ break;
+ }
+ continue;
+ }
+ if (ct.narrow(*wbb, 0) == '%') {
+ result.push_back(L'%');
+ result.push_back(L'%');
+ ++wbb;
+ continue;
}
- return result;
+ result.push_back(*wbb);
+ ++wbb;
+ }
+ return result;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-void
-__time_get_storage<char>::init(const ctype<char>& ct)
-{
- tm t = {0};
- char buf[100];
- // __weeks_
- for (int i = 0; i < 7; ++i)
- {
- t.tm_wday = i;
- strftime_l(buf, countof(buf), "%A", &t, __loc_);
- __weeks_[i] = buf;
- strftime_l(buf, countof(buf), "%a", &t, __loc_);
- __weeks_[i+7] = buf;
- }
- // __months_
- for (int i = 0; i < 12; ++i)
- {
- t.tm_mon = i;
- strftime_l(buf, countof(buf), "%B", &t, __loc_);
- __months_[i] = buf;
- strftime_l(buf, countof(buf), "%b", &t, __loc_);
- __months_[i+12] = buf;
- }
- // __am_pm_
- t.tm_hour = 1;
- strftime_l(buf, countof(buf), "%p", &t, __loc_);
- __am_pm_[0] = buf;
- t.tm_hour = 13;
- strftime_l(buf, countof(buf), "%p", &t, __loc_);
- __am_pm_[1] = buf;
- __c_ = __analyze('c', ct);
- __r_ = __analyze('r', ct);
- __x_ = __analyze('x', ct);
- __X_ = __analyze('X', ct);
+void __time_get_storage<char>::init(const ctype<char>& ct) {
+ tm t = {0};
+ char buf[100];
+ // __weeks_
+ for (int i = 0; i < 7; ++i) {
+ t.tm_wday = i;
+ strftime_l(buf, countof(buf), "%A", &t, __loc_);
+ __weeks_[i] = buf;
+ strftime_l(buf, countof(buf), "%a", &t, __loc_);
+ __weeks_[i + 7] = buf;
+ }
+ // __months_
+ for (int i = 0; i < 12; ++i) {
+ t.tm_mon = i;
+ strftime_l(buf, countof(buf), "%B", &t, __loc_);
+ __months_[i] = buf;
+ strftime_l(buf, countof(buf), "%b", &t, __loc_);
+ __months_[i + 12] = buf;
+ }
+ // __am_pm_
+ t.tm_hour = 1;
+ strftime_l(buf, countof(buf), "%p", &t, __loc_);
+ __am_pm_[0] = buf;
+ t.tm_hour = 13;
+ strftime_l(buf, countof(buf), "%p", &t, __loc_);
+ __am_pm_[1] = buf;
+ __c_ = __analyze('c', ct);
+ __r_ = __analyze('r', ct);
+ __x_ = __analyze('x', ct);
+ __X_ = __analyze('X', ct);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-void
-__time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
-{
- tm t = {0};
- char buf[100];
- wchar_t wbuf[100];
- wchar_t* wbe;
- mbstate_t mb = {0};
- // __weeks_
- for (int i = 0; i < 7; ++i)
- {
- t.tm_wday = i;
- strftime_l(buf, countof(buf), "%A", &t, __loc_);
- mb = mbstate_t();
- const char* bb = buf;
- size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
- if (j == size_t(-1) || j == 0)
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __weeks_[i].assign(wbuf, wbe);
- strftime_l(buf, countof(buf), "%a", &t, __loc_);
- mb = mbstate_t();
- bb = buf;
- j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
- if (j == size_t(-1) || j == 0)
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __weeks_[i+7].assign(wbuf, wbe);
- }
- // __months_
- for (int i = 0; i < 12; ++i)
- {
- t.tm_mon = i;
- strftime_l(buf, countof(buf), "%B", &t, __loc_);
- mb = mbstate_t();
- const char* bb = buf;
- size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
- if (j == size_t(-1) || j == 0)
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __months_[i].assign(wbuf, wbe);
- strftime_l(buf, countof(buf), "%b", &t, __loc_);
- mb = mbstate_t();
- bb = buf;
- j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
- if (j == size_t(-1) || j == 0)
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __months_[i+12].assign(wbuf, wbe);
- }
- // __am_pm_
- t.tm_hour = 1;
- strftime_l(buf, countof(buf), "%p", &t, __loc_);
+void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
+ tm t = {0};
+ char buf[100];
+ wchar_t wbuf[100];
+ wchar_t* wbe;
+ mbstate_t mb = {0};
+ // __weeks_
+ for (int i = 0; i < 7; ++i) {
+ t.tm_wday = i;
+ strftime_l(buf, countof(buf), "%A", &t, __loc_);
+ mb = mbstate_t();
+ const char* bb = buf;
+ size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
+ if (j == size_t(-1) || j == 0)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __weeks_[i].assign(wbuf, wbe);
+ strftime_l(buf, countof(buf), "%a", &t, __loc_);
mb = mbstate_t();
+ bb = buf;
+ j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
+ if (j == size_t(-1) || j == 0)
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __weeks_[i + 7].assign(wbuf, wbe);
+ }
+ // __months_
+ for (int i = 0; i < 12; ++i) {
+ t.tm_mon = i;
+ strftime_l(buf, countof(buf), "%B", &t, __loc_);
+ mb = mbstate_t();
const char* bb = buf;
- size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
+ size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
+ if (j == size_t(-1) || j == 0)
+ __throw_runtime_error("locale not supported");
wbe = wbuf + j;
- __am_pm_[0].assign(wbuf, wbe);
- t.tm_hour = 13;
- strftime_l(buf, countof(buf), "%p", &t, __loc_);
+ __months_[i].assign(wbuf, wbe);
+ strftime_l(buf, countof(buf), "%b", &t, __loc_);
mb = mbstate_t();
bb = buf;
- j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
+ j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
+ if (j == size_t(-1) || j == 0)
+ __throw_runtime_error("locale not supported");
wbe = wbuf + j;
- __am_pm_[1].assign(wbuf, wbe);
- __c_ = __analyze('c', ct);
- __r_ = __analyze('r', ct);
- __x_ = __analyze('x', ct);
- __X_ = __analyze('X', ct);
+ __months_[i + 12].assign(wbuf, wbe);
+ }
+ // __am_pm_
+ t.tm_hour = 1;
+ strftime_l(buf, countof(buf), "%p", &t, __loc_);
+ mb = mbstate_t();
+ const char* bb = buf;
+ size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __am_pm_[0].assign(wbuf, wbe);
+ t.tm_hour = 13;
+ strftime_l(buf, countof(buf), "%p", &t, __loc_);
+ mb = mbstate_t();
+ bb = buf;
+ j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __am_pm_[1].assign(wbuf, wbe);
+ __c_ = __analyze('c', ct);
+ __r_ = __analyze('r', ct);
+ __x_ = __analyze('x', ct);
+ __X_ = __analyze('X', ct);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class CharT>
-struct _LIBCPP_HIDDEN __time_get_temp
- : public ctype_byname<CharT>
-{
- explicit __time_get_temp(const char* nm)
- : ctype_byname<CharT>(nm, 1) {}
- explicit __time_get_temp(const string& nm)
- : ctype_byname<CharT>(nm, 1) {}
+struct _LIBCPP_HIDDEN __time_get_temp : public ctype_byname<CharT> {
+ explicit __time_get_temp(const char* nm) : ctype_byname<CharT>(nm, 1) {}
+ explicit __time_get_temp(const string& nm) : ctype_byname<CharT>(nm, 1) {}
};
template <>
-__time_get_storage<char>::__time_get_storage(const char* __nm)
- : __time_get(__nm)
-{
- const __time_get_temp<char> ct(__nm);
- init(ct);
+__time_get_storage<char>::__time_get_storage(const char* __nm) : __time_get(__nm) {
+ const __time_get_temp<char> ct(__nm);
+ init(ct);
}
template <>
-__time_get_storage<char>::__time_get_storage(const string& __nm)
- : __time_get(__nm)
-{
- const __time_get_temp<char> ct(__nm);
- init(ct);
+__time_get_storage<char>::__time_get_storage(const string& __nm) : __time_get(__nm) {
+ const __time_get_temp<char> ct(__nm);
+ init(ct);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-__time_get_storage<wchar_t>::__time_get_storage(const char* __nm)
- : __time_get(__nm)
-{
- const __time_get_temp<wchar_t> ct(__nm);
- init(ct);
+__time_get_storage<wchar_t>::__time_get_storage(const char* __nm) : __time_get(__nm) {
+ const __time_get_temp<wchar_t> ct(__nm);
+ init(ct);
}
template <>
-__time_get_storage<wchar_t>::__time_get_storage(const string& __nm)
- : __time_get(__nm)
-{
- const __time_get_temp<wchar_t> ct(__nm);
- init(ct);
+__time_get_storage<wchar_t>::__time_get_storage(const string& __nm) : __time_get(__nm) {
+ const __time_get_temp<wchar_t> ct(__nm);
+ init(ct);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-time_base::dateorder
-__time_get_storage<char>::__do_date_order() const
-{
- unsigned i;
- for (i = 0; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- ++i;
- switch (__x_[i])
- {
- case 'y':
- case 'Y':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- switch (__x_[i])
- {
- case 'm':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == 'd')
- return time_base::ymd;
- break;
- case 'd':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == 'm')
- return time_base::ydm;
- break;
- }
+time_base::dateorder __time_get_storage<char>::__do_date_order() const {
+ unsigned i;
+ for (i = 0; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ ++i;
+ switch (__x_[i]) {
+ case 'y':
+ case 'Y':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ switch (__x_[i]) {
case 'm':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == 'd')
- {
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == 'y' || __x_[i] == 'Y')
- return time_base::mdy;
- break;
- }
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
break;
+ ++i;
+ if (__x_[i] == 'd')
+ return time_base::ymd;
+ break;
case 'd':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == 'm')
- {
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == '%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == 'y' || __x_[i] == 'Y')
- return time_base::dmy;
- break;
- }
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
break;
+ ++i;
+ if (__x_[i] == 'm')
+ return time_base::ydm;
+ break;
}
- return time_base::no_order;
+ break;
+ case 'm':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'd') {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'y' || __x_[i] == 'Y')
+ return time_base::mdy;
+ break;
+ }
+ break;
+ case 'd':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'm') {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == '%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == 'y' || __x_[i] == 'Y')
+ return time_base::dmy;
+ break;
+ }
+ break;
+ }
+ return time_base::no_order;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
-time_base::dateorder
-__time_get_storage<wchar_t>::__do_date_order() const
-{
- unsigned i;
- for (i = 0; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- ++i;
- switch (__x_[i])
- {
- case L'y':
- case L'Y':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- switch (__x_[i])
- {
- case L'm':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == L'd')
- return time_base::ymd;
- break;
- case L'd':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == L'm')
- return time_base::ydm;
- break;
- }
+time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const {
+ unsigned i;
+ for (i = 0; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ ++i;
+ switch (__x_[i]) {
+ case L'y':
+ case L'Y':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ switch (__x_[i]) {
case L'm':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == L'd')
- {
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == L'y' || __x_[i] == L'Y')
- return time_base::mdy;
- break;
- }
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
break;
+ ++i;
+ if (__x_[i] == L'd')
+ return time_base::ymd;
+ break;
case L'd':
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == L'm')
- {
- for (++i; i < __x_.size(); ++i)
- if (__x_[i] == L'%')
- break;
- if (i == __x_.size())
- break;
- ++i;
- if (__x_[i] == L'y' || __x_[i] == L'Y')
- return time_base::dmy;
- break;
- }
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
break;
+ ++i;
+ if (__x_[i] == L'm')
+ return time_base::ydm;
+ break;
}
- return time_base::no_order;
+ break;
+ case L'm':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'd') {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'y' || __x_[i] == L'Y')
+ return time_base::mdy;
+ break;
+ }
+ break;
+ case L'd':
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'm') {
+ for (++i; i < __x_.size(); ++i)
+ if (__x_[i] == L'%')
+ break;
+ if (i == __x_.size())
+ break;
+ ++i;
+ if (__x_[i] == L'y' || __x_[i] == L'Y')
+ return time_base::dmy;
+ break;
+ }
+ break;
+ }
+ return time_base::no_order;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// time_put
-__time_put::__time_put(const char* nm)
- : __loc_(newlocale(LC_ALL_MASK, nm, 0))
-{
- if (__loc_ == 0)
- __throw_runtime_error(("time_put_byname failed to construct for " + string(nm)).c_str());
+__time_put::__time_put(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {
+ if (__loc_ == 0)
+ __throw_runtime_error(("time_put_byname failed to construct for " + string(nm)).c_str());
}
-__time_put::__time_put(const string& nm)
- : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0))
-{
- if (__loc_ == 0)
- __throw_runtime_error(("time_put_byname failed to construct for " + nm).c_str());
+__time_put::__time_put(const string& nm) : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0)) {
+ if (__loc_ == 0)
+ __throw_runtime_error(("time_put_byname failed to construct for " + nm).c_str());
}
-__time_put::~__time_put()
-{
- if (__loc_ != _LIBCPP_GET_C_LOCALE)
- freelocale(__loc_);
+__time_put::~__time_put() {
+ if (__loc_ != _LIBCPP_GET_C_LOCALE)
+ freelocale(__loc_);
}
-void
-__time_put::__do_put(char* __nb, char*& __ne, const tm* __tm,
- char __fmt, char __mod) const
-{
- char fmt[] = {'%', __fmt, __mod, 0};
- if (__mod != 0)
- swap(fmt[1], fmt[2]);
- size_t n = strftime_l(__nb, countof(__nb, __ne), fmt, __tm, __loc_);
- __ne = __nb + n;
+void __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, char __mod) const {
+ char fmt[] = {'%', __fmt, __mod, 0};
+ if (__mod != 0)
+ swap(fmt[1], fmt[2]);
+ size_t n = strftime_l(__nb, countof(__nb, __ne), fmt, __tm, __loc_);
+ __ne = __nb + n;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-void
-__time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
- char __fmt, char __mod) const
-{
- char __nar[100];
- char* __ne = __nar + 100;
- __do_put(__nar, __ne, __tm, __fmt, __mod);
- mbstate_t mb = {0};
- const char* __nb = __nar;
- size_t j = __libcpp_mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_);
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- __we = __wb + j;
+void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const {
+ char __nar[100];
+ char* __ne = __nar + 100;
+ __do_put(__nar, __ne, __tm, __fmt, __mod);
+ mbstate_t mb = {0};
+ const char* __nb = __nar;
+ size_t j = __libcpp_mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_);
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ __we = __wb + j;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// moneypunct_byname
template <class charT>
-static
-void
-__init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_,
- bool intl, char cs_precedes, char sep_by_space, char sign_posn,
- charT space_char)
-{
- const char sign = static_cast<char>(money_base::sign);
- const char space = static_cast<char>(money_base::space);
- const char none = static_cast<char>(money_base::none);
- const char symbol = static_cast<char>(money_base::symbol);
- const char value = static_cast<char>(money_base::value);
- const bool symbol_contains_sep = intl && __curr_symbol_.size() == 4;
-
- // Comments on case branches reflect 'C11 7.11.2.1 The localeconv
- // function'. "Space between sign and symbol or value" means that
- // if the sign is adjacent to the symbol, there's a space between
- // them, and otherwise there's a space between the sign and value.
- //
- // C11's localeconv specifies that the fourth character of an
- // international curr_symbol is used to separate the sign and
- // value when sep_by_space says to do so. C++ can't represent
- // that, so we just use a space. When sep_by_space says to
- // separate the symbol and value-or-sign with a space, we rearrange the
- // curr_symbol to put its spacing character on the correct side of
- // the symbol.
- //
- // We also need to avoid adding an extra space between the sign
- // and value when the currency symbol is suppressed (by not
- // setting showbase). We match glibc's strfmon by interpreting
- // sep_by_space==1 as "omit the space when the currency symbol is
- // absent".
- //
- // Users who want to get this right should use ICU instead.
-
- switch (cs_precedes)
- {
- case 0: // value before curr_symbol
+static void __init_pat(
+ money_base::pattern& pat,
+ basic_string<charT>& __curr_symbol_,
+ bool intl,
+ char cs_precedes,
+ char sep_by_space,
+ char sign_posn,
+ charT space_char) {
+ const char sign = static_cast<char>(money_base::sign);
+ const char space = static_cast<char>(money_base::space);
+ const char none = static_cast<char>(money_base::none);
+ const char symbol = static_cast<char>(money_base::symbol);
+ const char value = static_cast<char>(money_base::value);
+ const bool symbol_contains_sep = intl && __curr_symbol_.size() == 4;
+
+ // Comments on case branches reflect 'C11 7.11.2.1 The localeconv
+ // function'. "Space between sign and symbol or value" means that
+ // if the sign is adjacent to the symbol, there's a space between
+ // them, and otherwise there's a space between the sign and value.
+ //
+ // C11's localeconv specifies that the fourth character of an
+ // international curr_symbol is used to separate the sign and
+ // value when sep_by_space says to do so. C++ can't represent
+ // that, so we just use a space. When sep_by_space says to
+ // separate the symbol and value-or-sign with a space, we rearrange the
+ // curr_symbol to put its spacing character on the correct side of
+ // the symbol.
+ //
+ // We also need to avoid adding an extra space between the sign
+ // and value when the currency symbol is suppressed (by not
+ // setting showbase). We match glibc's strfmon by interpreting
+ // sep_by_space==1 as "omit the space when the currency symbol is
+ // absent".
+ //
+ // Users who want to get this right should use ICU instead.
+
+ switch (cs_precedes) {
+ case 0: // value before curr_symbol
+ if (symbol_contains_sep) {
+ // Move the separator to before the symbol, to place it
+ // between the value and symbol.
+ rotate(__curr_symbol_.begin(), __curr_symbol_.begin() + 3, __curr_symbol_.end());
+ }
+ switch (sign_posn) {
+ case 0: // Parentheses surround the quantity and currency symbol.
+ pat.field[0] = sign;
+ pat.field[1] = value;
+ pat.field[2] = none; // Any space appears in the symbol.
+ pat.field[3] = symbol;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ // This case may have changed between C99 and C11;
+ // assume the currency symbol matches the intention.
+ case 2: // Space between sign and currency or value.
+ // The "sign" is two parentheses, so no space here either.
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
+ return;
+ default:
+ break;
+ }
+ break;
+ case 1: // The sign string precedes the quantity and currency symbol.
+ pat.field[0] = sign;
+ pat.field[3] = symbol;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = value;
+ pat.field[2] = none;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = value;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = space;
+ pat.field[2] = value;
if (symbol_contains_sep) {
- // Move the separator to before the symbol, to place it
- // between the value and symbol.
- rotate(__curr_symbol_.begin(), __curr_symbol_.begin() + 3,
- __curr_symbol_.end());
+ // Remove the separator from the symbol, since it
+ // has already appeared after the sign.
+ __curr_symbol_.erase(__curr_symbol_.begin());
}
- switch (sign_posn)
- {
- case 0: // Parentheses surround the quantity and currency symbol.
- pat.field[0] = sign;
- pat.field[1] = value;
- pat.field[2] = none; // Any space appears in the symbol.
- pat.field[3] = symbol;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- // This case may have changed between C99 and C11;
- // assume the currency symbol matches the intention.
- case 2: // Space between sign and currency or value.
- // The "sign" is two parentheses, so no space here either.
- return;
- case 1: // Space between currency-and-sign or currency and value.
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[2]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.insert(0, 1, space_char);
- }
- return;
- default:
- break;
- }
- break;
- case 1: // The sign string precedes the quantity and currency symbol.
- pat.field[0] = sign;
- pat.field[3] = symbol;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = value;
- pat.field[2] = none;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- pat.field[1] = value;
- pat.field[2] = none;
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[2]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.insert(0, 1, space_char);
- }
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = space;
- pat.field[2] = value;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // has already appeared after the sign.
- __curr_symbol_.erase(__curr_symbol_.begin());
- }
- return;
- default:
- break;
- }
- break;
- case 2: // The sign string succeeds the quantity and currency symbol.
- pat.field[0] = value;
- pat.field[3] = sign;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = none;
- pat.field[2] = symbol;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[1]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.insert(0, 1, space_char);
- }
- pat.field[1] = none;
- pat.field[2] = symbol;
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = symbol;
- pat.field[2] = space;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // should not be removed if showbase is absent.
- __curr_symbol_.erase(__curr_symbol_.begin());
- }
- return;
- default:
- break;
- }
- break;
- case 3: // The sign string immediately precedes the currency symbol.
- pat.field[0] = value;
- pat.field[3] = symbol;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = none;
- pat.field[2] = sign;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- pat.field[1] = space;
- pat.field[2] = sign;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // has already appeared before the sign.
- __curr_symbol_.erase(__curr_symbol_.begin());
- }
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = sign;
- pat.field[2] = none;
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[2]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.insert(0, 1, space_char);
- }
- return;
- default:
- break;
- }
- break;
- case 4: // The sign string immediately succeeds the currency symbol.
- pat.field[0] = value;
- pat.field[3] = sign;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = none;
- pat.field[2] = symbol;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- pat.field[1] = none;
- pat.field[2] = symbol;
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[1]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.insert(0, 1, space_char);
- }
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = symbol;
- pat.field[2] = space;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // should not disappear when showbase is absent.
- __curr_symbol_.erase(__curr_symbol_.begin());
- }
- return;
- default:
- break;
- }
- break;
- default:
- break;
+ return;
+ default:
+ break;
+ }
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ pat.field[0] = value;
+ pat.field[3] = sign;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = none;
+ pat.field[2] = symbol;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
+ pat.field[1] = none;
+ pat.field[2] = symbol;
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = symbol;
+ pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // should not be removed if showbase is absent.
+ __curr_symbol_.erase(__curr_symbol_.begin());
}
+ return;
+ default:
break;
- case 1: // curr_symbol before value
- switch (sign_posn)
- {
- case 0: // Parentheses surround the quantity and currency symbol.
- pat.field[0] = sign;
- pat.field[1] = symbol;
- pat.field[2] = none; // Any space appears in the symbol.
- pat.field[3] = value;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- // This case may have changed between C99 and C11;
- // assume the currency symbol matches the intention.
- case 2: // Space between sign and currency or value.
- // The "sign" is two parentheses, so no space here either.
- return;
- case 1: // Space between currency-and-sign or currency and value.
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[2]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.insert(0, 1, space_char);
- }
- return;
- default:
- break;
- }
- break;
- case 1: // The sign string precedes the quantity and currency symbol.
- pat.field[0] = sign;
- pat.field[3] = value;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = symbol;
- pat.field[2] = none;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- pat.field[1] = symbol;
- pat.field[2] = none;
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[2]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.push_back(space_char);
- }
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = space;
- pat.field[2] = symbol;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // has already appeared after the sign.
- __curr_symbol_.pop_back();
- }
- return;
- default:
- break;
- }
- break;
- case 2: // The sign string succeeds the quantity and currency symbol.
- pat.field[0] = symbol;
- pat.field[3] = sign;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = none;
- pat.field[2] = value;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- pat.field[1] = none;
- pat.field[2] = value;
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[1]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.push_back(space_char);
- }
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = value;
- pat.field[2] = space;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // will appear before the sign.
- __curr_symbol_.pop_back();
- }
- return;
- default:
- break;
- }
- break;
- case 3: // The sign string immediately precedes the currency symbol.
- pat.field[0] = sign;
- pat.field[3] = value;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = symbol;
- pat.field[2] = none;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- pat.field[1] = symbol;
- pat.field[2] = none;
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[2]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.push_back(space_char);
- }
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = space;
- pat.field[2] = symbol;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // has already appeared after the sign.
- __curr_symbol_.pop_back();
- }
- return;
- default:
- break;
- }
- break;
- case 4: // The sign string immediately succeeds the currency symbol.
- pat.field[0] = symbol;
- pat.field[3] = value;
- switch (sep_by_space)
- {
- case 0: // No space separates the currency symbol and value.
- pat.field[1] = sign;
- pat.field[2] = none;
- return;
- case 1: // Space between currency-and-sign or currency and value.
- pat.field[1] = sign;
- pat.field[2] = space;
- if (symbol_contains_sep) {
- // Remove the separator from the symbol, since it
- // should not disappear when showbase is absent.
- __curr_symbol_.pop_back();
- }
- return;
- case 2: // Space between sign and currency or value.
- pat.field[1] = none;
- pat.field[2] = sign;
- if (!symbol_contains_sep) {
- // We insert the space into the symbol instead of
- // setting pat.field[1]=space so that when
- // showbase is not set, the space goes away too.
- __curr_symbol_.push_back(space_char);
- }
- return;
- default:
- break;
- }
- break;
- default:
- break;
+ }
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ pat.field[0] = value;
+ pat.field[3] = symbol;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = none;
+ pat.field[2] = sign;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = space;
+ pat.field[2] = sign;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // has already appeared before the sign.
+ __curr_symbol_.erase(__curr_symbol_.begin());
+ }
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = sign;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
}
+ return;
+ default:
break;
+ }
+ break;
+ case 4: // The sign string immediately succeeds the currency symbol.
+ pat.field[0] = value;
+ pat.field[3] = sign;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = none;
+ pat.field[2] = symbol;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = none;
+ pat.field[2] = symbol;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = symbol;
+ pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // should not disappear when showbase is absent.
+ __curr_symbol_.erase(__curr_symbol_.begin());
+ }
+ return;
+ default:
+ break;
+ }
+ break;
default:
+ break;
+ }
+ break;
+ case 1: // curr_symbol before value
+ switch (sign_posn) {
+ case 0: // Parentheses surround the quantity and currency symbol.
+ pat.field[0] = sign;
+ pat.field[1] = symbol;
+ pat.field[2] = none; // Any space appears in the symbol.
+ pat.field[3] = value;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ // This case may have changed between C99 and C11;
+ // assume the currency symbol matches the intention.
+ case 2: // Space between sign and currency or value.
+ // The "sign" is two parentheses, so no space here either.
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
+ return;
+ default:
+ break;
+ }
+ break;
+ case 1: // The sign string precedes the quantity and currency symbol.
+ pat.field[0] = sign;
+ pat.field[3] = value;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = symbol;
+ pat.field[2] = none;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = symbol;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = space;
+ pat.field[2] = symbol;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // has already appeared after the sign.
+ __curr_symbol_.pop_back();
+ }
+ return;
+ default:
break;
+ }
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ pat.field[0] = symbol;
+ pat.field[3] = sign;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = none;
+ pat.field[2] = value;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = none;
+ pat.field[2] = value;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = value;
+ pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // will appear before the sign.
+ __curr_symbol_.pop_back();
+ }
+ return;
+ default:
+ break;
+ }
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ pat.field[0] = sign;
+ pat.field[3] = value;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = symbol;
+ pat.field[2] = none;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = symbol;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = space;
+ pat.field[2] = symbol;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // has already appeared after the sign.
+ __curr_symbol_.pop_back();
+ }
+ return;
+ default:
+ break;
+ }
+ break;
+ case 4: // The sign string immediately succeeds the currency symbol.
+ pat.field[0] = symbol;
+ pat.field[3] = value;
+ switch (sep_by_space) {
+ case 0: // No space separates the currency symbol and value.
+ pat.field[1] = sign;
+ pat.field[2] = none;
+ return;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = sign;
+ pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // should not disappear when showbase is absent.
+ __curr_symbol_.pop_back();
+ }
+ return;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = none;
+ pat.field[2] = sign;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
+ return;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
}
- pat.field[0] = symbol;
- pat.field[1] = sign;
- pat.field[2] = none;
- pat.field[3] = value;
+ break;
+ default:
+ break;
+ }
+ pat.field[0] = symbol;
+ pat.field[1] = sign;
+ pat.field[2] = none;
+ pat.field[3] = value;
}
-template<>
-void
-moneypunct_byname<char, false>::init(const char* nm)
-{
- typedef moneypunct<char, false> base;
- __libcpp_unique_locale loc(nm);
- if (!loc)
- __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
-
- lconv* lc = __libcpp_localeconv_l(loc.get());
- if (!checked_string_to_char_convert(__decimal_point_,
- lc->mon_decimal_point,
- loc.get()))
- __decimal_point_ = base::do_decimal_point();
- if (!checked_string_to_char_convert(__thousands_sep_,
- lc->mon_thousands_sep,
- loc.get()))
- __thousands_sep_ = base::do_thousands_sep();
-
- __grouping_ = lc->mon_grouping;
- __curr_symbol_ = lc->currency_symbol;
- if (lc->frac_digits != CHAR_MAX)
- __frac_digits_ = lc->frac_digits;
- else
- __frac_digits_ = base::do_frac_digits();
- if (lc->p_sign_posn == 0)
- __positive_sign_ = "()";
- else
- __positive_sign_ = lc->positive_sign;
- if (lc->n_sign_posn == 0)
- __negative_sign_ = "()";
- else
- __negative_sign_ = lc->negative_sign;
- // Assume the positive and negative formats will want spaces in
- // the same places in curr_symbol since there's no way to
- // represent anything else.
- string_type __dummy_curr_symbol = __curr_symbol_;
- __init_pat(__pos_format_, __dummy_curr_symbol, false,
- lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
- __init_pat(__neg_format_, __curr_symbol_, false,
- lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
-}
-
-template<>
-void
-moneypunct_byname<char, true>::init(const char* nm)
-{
- typedef moneypunct<char, true> base;
- __libcpp_unique_locale loc(nm);
- if (!loc)
- __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+template <>
+void moneypunct_byname<char, false>::init(const char* nm) {
+ typedef moneypunct<char, false> base;
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
+ __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+
+ lconv* lc = __libcpp_localeconv_l(loc.get());
+ if (!checked_string_to_char_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
+ __decimal_point_ = base::do_decimal_point();
+ if (!checked_string_to_char_convert(__thousands_sep_, lc->mon_thousands_sep, loc.get()))
+ __thousands_sep_ = base::do_thousands_sep();
+
+ __grouping_ = lc->mon_grouping;
+ __curr_symbol_ = lc->currency_symbol;
+ if (lc->frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
+ if (lc->p_sign_posn == 0)
+ __positive_sign_ = "()";
+ else
+ __positive_sign_ = lc->positive_sign;
+ if (lc->n_sign_posn == 0)
+ __negative_sign_ = "()";
+ else
+ __negative_sign_ = lc->negative_sign;
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
+ __init_pat(__pos_format_, __dummy_curr_symbol, false, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
+ __init_pat(__neg_format_, __curr_symbol_, false, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
+}
- lconv* lc = __libcpp_localeconv_l(loc.get());
- if (!checked_string_to_char_convert(__decimal_point_,
- lc->mon_decimal_point,
- loc.get()))
- __decimal_point_ = base::do_decimal_point();
- if (!checked_string_to_char_convert(__thousands_sep_,
- lc->mon_thousands_sep,
- loc.get()))
- __thousands_sep_ = base::do_thousands_sep();
- __grouping_ = lc->mon_grouping;
- __curr_symbol_ = lc->int_curr_symbol;
- if (lc->int_frac_digits != CHAR_MAX)
- __frac_digits_ = lc->int_frac_digits;
- else
- __frac_digits_ = base::do_frac_digits();
+template <>
+void moneypunct_byname<char, true>::init(const char* nm) {
+ typedef moneypunct<char, true> base;
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
+ __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+
+ lconv* lc = __libcpp_localeconv_l(loc.get());
+ if (!checked_string_to_char_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
+ __decimal_point_ = base::do_decimal_point();
+ if (!checked_string_to_char_convert(__thousands_sep_, lc->mon_thousands_sep, loc.get()))
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->mon_grouping;
+ __curr_symbol_ = lc->int_curr_symbol;
+ if (lc->int_frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->int_frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- if (lc->p_sign_posn == 0)
-#else // _LIBCPP_MSVCRT
- if (lc->int_p_sign_posn == 0)
+ if (lc->p_sign_posn == 0)
+#else // _LIBCPP_MSVCRT
+ if (lc->int_p_sign_posn == 0)
#endif // !_LIBCPP_MSVCRT
- __positive_sign_ = "()";
- else
- __positive_sign_ = lc->positive_sign;
+ __positive_sign_ = "()";
+ else
+ __positive_sign_ = lc->positive_sign;
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- if(lc->n_sign_posn == 0)
-#else // _LIBCPP_MSVCRT
- if (lc->int_n_sign_posn == 0)
+ if (lc->n_sign_posn == 0)
+#else // _LIBCPP_MSVCRT
+ if (lc->int_n_sign_posn == 0)
#endif // !_LIBCPP_MSVCRT
- __negative_sign_ = "()";
- else
- __negative_sign_ = lc->negative_sign;
- // Assume the positive and negative formats will want spaces in
- // the same places in curr_symbol since there's no way to
- // represent anything else.
- string_type __dummy_curr_symbol = __curr_symbol_;
+ __negative_sign_ = "()";
+ else
+ __negative_sign_ = lc->negative_sign;
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- __init_pat(__pos_format_, __dummy_curr_symbol, true,
- lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
- __init_pat(__neg_format_, __curr_symbol_, true,
- lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
-#else // _LIBCPP_MSVCRT
- __init_pat(__pos_format_, __dummy_curr_symbol, true,
- lc->int_p_cs_precedes, lc->int_p_sep_by_space,
- lc->int_p_sign_posn, ' ');
- __init_pat(__neg_format_, __curr_symbol_, true,
- lc->int_n_cs_precedes, lc->int_n_sep_by_space,
- lc->int_n_sign_posn, ' ');
+ __init_pat(__pos_format_, __dummy_curr_symbol, true, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
+ __init_pat(__neg_format_, __curr_symbol_, true, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
+#else // _LIBCPP_MSVCRT
+ __init_pat(
+ __pos_format_,
+ __dummy_curr_symbol,
+ true,
+ lc->int_p_cs_precedes,
+ lc->int_p_sep_by_space,
+ lc->int_p_sign_posn,
+ ' ');
+ __init_pat(
+ __neg_format_, __curr_symbol_, true, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn, ' ');
#endif // !_LIBCPP_MSVCRT
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template<>
-void
-moneypunct_byname<wchar_t, false>::init(const char* nm)
-{
- typedef moneypunct<wchar_t, false> base;
- __libcpp_unique_locale loc(nm);
- if (!loc)
- __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
- lconv* lc = __libcpp_localeconv_l(loc.get());
- if (!checked_string_to_wchar_convert(__decimal_point_,
- lc->mon_decimal_point,
- loc.get()))
- __decimal_point_ = base::do_decimal_point();
- if (!checked_string_to_wchar_convert(__thousands_sep_,
- lc->mon_thousands_sep,
- loc.get()))
- __thousands_sep_ = base::do_thousands_sep();
- __grouping_ = lc->mon_grouping;
- wchar_t wbuf[100];
- mbstate_t mb = {0};
- const char* bb = lc->currency_symbol;
- size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
+template <>
+void moneypunct_byname<wchar_t, false>::init(const char* nm) {
+ typedef moneypunct<wchar_t, false> base;
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
+ __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+ lconv* lc = __libcpp_localeconv_l(loc.get());
+ if (!checked_string_to_wchar_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
+ __decimal_point_ = base::do_decimal_point();
+ if (!checked_string_to_wchar_convert(__thousands_sep_, lc->mon_thousands_sep, loc.get()))
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->mon_grouping;
+ wchar_t wbuf[100];
+ mbstate_t mb = {0};
+ const char* bb = lc->currency_symbol;
+ size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ wchar_t* wbe = wbuf + j;
+ __curr_symbol_.assign(wbuf, wbe);
+ if (lc->frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
+ if (lc->p_sign_posn == 0)
+ __positive_sign_ = L"()";
+ else {
+ mb = mbstate_t();
+ bb = lc->positive_sign;
+ j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- wchar_t* wbe = wbuf + j;
- __curr_symbol_.assign(wbuf, wbe);
- if (lc->frac_digits != CHAR_MAX)
- __frac_digits_ = lc->frac_digits;
- else
- __frac_digits_ = base::do_frac_digits();
- if (lc->p_sign_posn == 0)
- __positive_sign_ = L"()";
- else
- {
- mb = mbstate_t();
- bb = lc->positive_sign;
- j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __positive_sign_.assign(wbuf, wbe);
- }
- if (lc->n_sign_posn == 0)
- __negative_sign_ = L"()";
- else
- {
- mb = mbstate_t();
- bb = lc->negative_sign;
- j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __negative_sign_.assign(wbuf, wbe);
- }
- // Assume the positive and negative formats will want spaces in
- // the same places in curr_symbol since there's no way to
- // represent anything else.
- string_type __dummy_curr_symbol = __curr_symbol_;
- __init_pat(__pos_format_, __dummy_curr_symbol, false,
- lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
- __init_pat(__neg_format_, __curr_symbol_, false,
- lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
-}
-
-template<>
-void
-moneypunct_byname<wchar_t, true>::init(const char* nm)
-{
- typedef moneypunct<wchar_t, true> base;
- __libcpp_unique_locale loc(nm);
- if (!loc)
- __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __positive_sign_.assign(wbuf, wbe);
+ }
+ if (lc->n_sign_posn == 0)
+ __negative_sign_ = L"()";
+ else {
+ mb = mbstate_t();
+ bb = lc->negative_sign;
+ j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __negative_sign_.assign(wbuf, wbe);
+ }
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
+ __init_pat(__pos_format_, __dummy_curr_symbol, false, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
+ __init_pat(__neg_format_, __curr_symbol_, false, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
+}
- lconv* lc = __libcpp_localeconv_l(loc.get());
- if (!checked_string_to_wchar_convert(__decimal_point_,
- lc->mon_decimal_point,
- loc.get()))
- __decimal_point_ = base::do_decimal_point();
- if (!checked_string_to_wchar_convert(__thousands_sep_,
- lc->mon_thousands_sep,
- loc.get()))
- __thousands_sep_ = base::do_thousands_sep();
- __grouping_ = lc->mon_grouping;
- wchar_t wbuf[100];
- mbstate_t mb = {0};
- const char* bb = lc->int_curr_symbol;
- size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
+template <>
+void moneypunct_byname<wchar_t, true>::init(const char* nm) {
+ typedef moneypunct<wchar_t, true> base;
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
+ __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+
+ lconv* lc = __libcpp_localeconv_l(loc.get());
+ if (!checked_string_to_wchar_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
+ __decimal_point_ = base::do_decimal_point();
+ if (!checked_string_to_wchar_convert(__thousands_sep_, lc->mon_thousands_sep, loc.get()))
+ __thousands_sep_ = base::do_thousands_sep();
+ __grouping_ = lc->mon_grouping;
+ wchar_t wbuf[100];
+ mbstate_t mb = {0};
+ const char* bb = lc->int_curr_symbol;
+ size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ wchar_t* wbe = wbuf + j;
+ __curr_symbol_.assign(wbuf, wbe);
+ if (lc->int_frac_digits != CHAR_MAX)
+ __frac_digits_ = lc->int_frac_digits;
+ else
+ __frac_digits_ = base::do_frac_digits();
+# if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+ if (lc->p_sign_posn == 0)
+# else // _LIBCPP_MSVCRT
+ if (lc->int_p_sign_posn == 0)
+# endif // !_LIBCPP_MSVCRT
+ __positive_sign_ = L"()";
+ else {
+ mb = mbstate_t();
+ bb = lc->positive_sign;
+ j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- wchar_t* wbe = wbuf + j;
- __curr_symbol_.assign(wbuf, wbe);
- if (lc->int_frac_digits != CHAR_MAX)
- __frac_digits_ = lc->int_frac_digits;
- else
- __frac_digits_ = base::do_frac_digits();
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- if (lc->p_sign_posn == 0)
-#else // _LIBCPP_MSVCRT
- if (lc->int_p_sign_posn == 0)
-#endif // !_LIBCPP_MSVCRT
- __positive_sign_ = L"()";
- else
- {
- mb = mbstate_t();
- bb = lc->positive_sign;
- j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __positive_sign_.assign(wbuf, wbe);
- }
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- if (lc->n_sign_posn == 0)
-#else // _LIBCPP_MSVCRT
- if (lc->int_n_sign_posn == 0)
-#endif // !_LIBCPP_MSVCRT
- __negative_sign_ = L"()";
- else
- {
- mb = mbstate_t();
- bb = lc->negative_sign;
- j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
- if (j == size_t(-1))
- __throw_runtime_error("locale not supported");
- wbe = wbuf + j;
- __negative_sign_.assign(wbuf, wbe);
- }
- // Assume the positive and negative formats will want spaces in
- // the same places in curr_symbol since there's no way to
- // represent anything else.
- string_type __dummy_curr_symbol = __curr_symbol_;
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
- __init_pat(__pos_format_, __dummy_curr_symbol, true,
- lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
- __init_pat(__neg_format_, __curr_symbol_, true,
- lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
-#else // _LIBCPP_MSVCRT
- __init_pat(__pos_format_, __dummy_curr_symbol, true,
- lc->int_p_cs_precedes, lc->int_p_sep_by_space,
- lc->int_p_sign_posn, L' ');
- __init_pat(__neg_format_, __curr_symbol_, true,
- lc->int_n_cs_precedes, lc->int_n_sep_by_space,
- lc->int_n_sign_posn, L' ');
-#endif // !_LIBCPP_MSVCRT
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __positive_sign_.assign(wbuf, wbe);
+ }
+# if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+ if (lc->n_sign_posn == 0)
+# else // _LIBCPP_MSVCRT
+ if (lc->int_n_sign_posn == 0)
+# endif // !_LIBCPP_MSVCRT
+ __negative_sign_ = L"()";
+ else {
+ mb = mbstate_t();
+ bb = lc->negative_sign;
+ j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
+ if (j == size_t(-1))
+ __throw_runtime_error("locale not supported");
+ wbe = wbuf + j;
+ __negative_sign_.assign(wbuf, wbe);
+ }
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
+# if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+ __init_pat(__pos_format_, __dummy_curr_symbol, true, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
+ __init_pat(__neg_format_, __curr_symbol_, true, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
+# else // _LIBCPP_MSVCRT
+ __init_pat(
+ __pos_format_,
+ __dummy_curr_symbol,
+ true,
+ lc->int_p_cs_precedes,
+ lc->int_p_sep_by_space,
+ lc->int_p_sign_posn,
+ L' ');
+ __init_pat(
+ __neg_format_, __curr_symbol_, true, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn, L' ');
+# endif // !_LIBCPP_MSVCRT
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
void __do_nothing(void*) {}
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_get<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_get<wchar_t>;)
- template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_get<char>;
+template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_get<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_put<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_put<wchar_t>;)
- template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_put<char>;
+template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_put<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get_byname<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get_byname<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get_byname<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put_byname<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put_byname<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put_byname<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, false>;
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, true>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, false>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, true>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<wchar_t, false>;)
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<wchar_t, true>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, false>;
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, true>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, false>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, true>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<wchar_t, false>;)
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<wchar_t, true>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_get<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_get<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_get<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_get<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_put<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_put<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_put<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_put<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<char>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<wchar_t>;)
- template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char, char, mbstate_t>;
-_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>;)
-template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char, mbstate_t>;
-template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char, mbstate_t>;
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char, char, mbstate_t>;
+_LIBCPP_IF_WIDE_CHARACTERS(
+ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>;)
+template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
+ codecvt_byname<char16_t, char, mbstate_t>;
+template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
+ codecvt_byname<char32_t, char, mbstate_t>;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char8_t, mbstate_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char8_t, mbstate_t>;
diff --git a/contrib/llvm-project/libcxx/src/memory.cpp b/contrib/llvm-project/libcxx/src/memory.cpp
index 4b2a369d89f1..7a1c283d885e 100644
--- a/contrib/llvm-project/libcxx/src/memory.cpp
+++ b/contrib/llvm-project/libcxx/src/memory.cpp
@@ -8,7 +8,7 @@
#include <__config>
#ifdef _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
-# define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
+# define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
#endif
#include <memory>
@@ -27,118 +27,79 @@ _LIBCPP_BEGIN_NAMESPACE_STD
bad_weak_ptr::~bad_weak_ptr() noexcept {}
-const char*
-bad_weak_ptr::what() const noexcept
-{
- return "bad_weak_ptr";
-}
+const char* bad_weak_ptr::what() const noexcept { return "bad_weak_ptr"; }
-__shared_count::~__shared_count()
-{
-}
+__shared_count::~__shared_count() {}
-__shared_weak_count::~__shared_weak_count()
-{
-}
+__shared_weak_count::~__shared_weak_count() {}
#if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS)
-void
-__shared_count::__add_shared() noexcept
-{
- __libcpp_atomic_refcount_increment(__shared_owners_);
-}
+void __shared_count::__add_shared() noexcept { __libcpp_atomic_refcount_increment(__shared_owners_); }
-bool
-__shared_count::__release_shared() noexcept
-{
- if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1)
- {
- __on_zero_shared();
- return true;
- }
- return false;
+bool __shared_count::__release_shared() noexcept {
+ if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) {
+ __on_zero_shared();
+ return true;
+ }
+ return false;
}
-void
-__shared_weak_count::__add_shared() noexcept
-{
- __shared_count::__add_shared();
-}
+void __shared_weak_count::__add_shared() noexcept { __shared_count::__add_shared(); }
-void
-__shared_weak_count::__add_weak() noexcept
-{
- __libcpp_atomic_refcount_increment(__shared_weak_owners_);
-}
+void __shared_weak_count::__add_weak() noexcept { __libcpp_atomic_refcount_increment(__shared_weak_owners_); }
-void
-__shared_weak_count::__release_shared() noexcept
-{
- if (__shared_count::__release_shared())
- __release_weak();
+void __shared_weak_count::__release_shared() noexcept {
+ if (__shared_count::__release_shared())
+ __release_weak();
}
#endif // _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
-void
-__shared_weak_count::__release_weak() noexcept
-{
- // NOTE: The acquire load here is an optimization of the very
- // common case where a shared pointer is being destructed while
- // having no other contended references.
- //
- // BENEFIT: We avoid expensive atomic stores like XADD and STREX
- // in a common case. Those instructions are slow and do nasty
- // things to caches.
- //
- // IS THIS SAFE? Yes. During weak destruction, if we see that we
- // are the last reference, we know that no-one else is accessing
- // us. If someone were accessing us, then they would be doing so
- // while the last shared / weak_ptr was being destructed, and
- // that's undefined anyway.
- //
- // If we see anything other than a 0, then we have possible
- // contention, and need to use an atomicrmw primitive.
- // The same arguments don't apply for increment, where it is legal
- // (though inadvisable) to share shared_ptr references between
- // threads, and have them all get copied at once. The argument
- // also doesn't apply for __release_shared, because an outstanding
- // weak_ptr::lock() could read / modify the shared count.
- if (__libcpp_atomic_load(&__shared_weak_owners_, _AO_Acquire) == 0)
- {
- // no need to do this store, because we are about
- // to destroy everything.
- //__libcpp_atomic_store(&__shared_weak_owners_, -1, _AO_Release);
- __on_zero_shared_weak();
- }
- else if (__libcpp_atomic_refcount_decrement(__shared_weak_owners_) == -1)
- __on_zero_shared_weak();
-}
-
-__shared_weak_count*
-__shared_weak_count::lock() noexcept
-{
- long object_owners = __libcpp_atomic_load(&__shared_owners_);
- while (object_owners != -1)
- {
- if (__libcpp_atomic_compare_exchange(&__shared_owners_,
- &object_owners,
- object_owners+1))
- return this;
- }
- return nullptr;
-}
-
-const void*
-__shared_weak_count::__get_deleter(const type_info&) const noexcept
-{
- return nullptr;
-}
+void __shared_weak_count::__release_weak() noexcept {
+ // NOTE: The acquire load here is an optimization of the very
+ // common case where a shared pointer is being destructed while
+ // having no other contended references.
+ //
+ // BENEFIT: We avoid expensive atomic stores like XADD and STREX
+ // in a common case. Those instructions are slow and do nasty
+ // things to caches.
+ //
+ // IS THIS SAFE? Yes. During weak destruction, if we see that we
+ // are the last reference, we know that no-one else is accessing
+ // us. If someone were accessing us, then they would be doing so
+ // while the last shared / weak_ptr was being destructed, and
+ // that's undefined anyway.
+ //
+ // If we see anything other than a 0, then we have possible
+ // contention, and need to use an atomicrmw primitive.
+ // The same arguments don't apply for increment, where it is legal
+ // (though inadvisable) to share shared_ptr references between
+ // threads, and have them all get copied at once. The argument
+ // also doesn't apply for __release_shared, because an outstanding
+ // weak_ptr::lock() could read / modify the shared count.
+ if (__libcpp_atomic_load(&__shared_weak_owners_, _AO_Acquire) == 0) {
+ // no need to do this store, because we are about
+ // to destroy everything.
+ //__libcpp_atomic_store(&__shared_weak_owners_, -1, _AO_Release);
+ __on_zero_shared_weak();
+ } else if (__libcpp_atomic_refcount_decrement(__shared_weak_owners_) == -1)
+ __on_zero_shared_weak();
+}
+
+__shared_weak_count* __shared_weak_count::lock() noexcept {
+ long object_owners = __libcpp_atomic_load(&__shared_owners_);
+ while (object_owners != -1) {
+ if (__libcpp_atomic_compare_exchange(&__shared_owners_, &object_owners, object_owners + 1))
+ return this;
+ }
+ return nullptr;
+}
+
+const void* __shared_weak_count::__get_deleter(const type_info&) const noexcept { return nullptr; }
#if !defined(_LIBCPP_HAS_NO_THREADS)
-static constexpr std::size_t __sp_mut_count = 32;
-static constinit __libcpp_mutex_t mut_back[__sp_mut_count] =
-{
+static constexpr std::size_t __sp_mut_count = 32;
+static constinit __libcpp_mutex_t mut_back[__sp_mut_count] = {
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER,
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER,
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER,
@@ -146,62 +107,42 @@ static constinit __libcpp_mutex_t mut_back[__sp_mut_count] =
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER,
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER,
_LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER,
- _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER
-};
+ _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER};
-constexpr __sp_mut::__sp_mut(void* p) noexcept
- : __lx_(p)
-{
-}
+constexpr __sp_mut::__sp_mut(void* p) noexcept : __lx_(p) {}
-void
-__sp_mut::lock() noexcept
-{
- auto m = static_cast<__libcpp_mutex_t*>(__lx_);
- __libcpp_mutex_lock(m);
+void __sp_mut::lock() noexcept {
+ auto m = static_cast<__libcpp_mutex_t*>(__lx_);
+ __libcpp_mutex_lock(m);
}
-void
-__sp_mut::unlock() noexcept
-{
- __libcpp_mutex_unlock(static_cast<__libcpp_mutex_t*>(__lx_));
-}
+void __sp_mut::unlock() noexcept { __libcpp_mutex_unlock(static_cast<__libcpp_mutex_t*>(__lx_)); }
-__sp_mut&
-__get_sp_mut(const void* p)
-{
- static constinit __sp_mut muts[__sp_mut_count] = {
- &mut_back[ 0], &mut_back[ 1], &mut_back[ 2], &mut_back[ 3],
- &mut_back[ 4], &mut_back[ 5], &mut_back[ 6], &mut_back[ 7],
- &mut_back[ 8], &mut_back[ 9], &mut_back[10], &mut_back[11],
- &mut_back[12], &mut_back[13], &mut_back[14], &mut_back[15],
- &mut_back[16], &mut_back[17], &mut_back[18], &mut_back[19],
- &mut_back[20], &mut_back[21], &mut_back[22], &mut_back[23],
- &mut_back[24], &mut_back[25], &mut_back[26], &mut_back[27],
- &mut_back[28], &mut_back[29], &mut_back[30], &mut_back[31]
- };
- return muts[hash<const void*>()(p) & (__sp_mut_count-1)];
+__sp_mut& __get_sp_mut(const void* p) {
+ static constinit __sp_mut muts[__sp_mut_count] = {
+ &mut_back[0], &mut_back[1], &mut_back[2], &mut_back[3], &mut_back[4], &mut_back[5], &mut_back[6],
+ &mut_back[7], &mut_back[8], &mut_back[9], &mut_back[10], &mut_back[11], &mut_back[12], &mut_back[13],
+ &mut_back[14], &mut_back[15], &mut_back[16], &mut_back[17], &mut_back[18], &mut_back[19], &mut_back[20],
+ &mut_back[21], &mut_back[22], &mut_back[23], &mut_back[24], &mut_back[25], &mut_back[26], &mut_back[27],
+ &mut_back[28], &mut_back[29], &mut_back[30], &mut_back[31]};
+ return muts[hash<const void*>()(p) & (__sp_mut_count - 1)];
}
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
-void*
-align(size_t alignment, size_t size, void*& ptr, size_t& space)
-{
- void* r = nullptr;
- if (size <= space)
- {
- char* p1 = static_cast<char*>(ptr);
- char* p2 = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(p1 + (alignment - 1)) & -alignment);
- size_t d = static_cast<size_t>(p2 - p1);
- if (d <= space - size)
- {
- r = p2;
- ptr = r;
- space -= d;
- }
+void* align(size_t alignment, size_t size, void*& ptr, size_t& space) {
+ void* r = nullptr;
+ if (size <= space) {
+ char* p1 = static_cast<char*>(ptr);
+ char* p2 = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(p1 + (alignment - 1)) & -alignment);
+ size_t d = static_cast<size_t>(p2 - p1);
+ if (d <= space - size) {
+ r = p2;
+ ptr = r;
+ space -= d;
}
- return r;
+ }
+ return r;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/mutex.cpp b/contrib/llvm-project/libcxx/src/mutex.cpp
index fe7a970ee1c4..ce854757ac08 100644
--- a/contrib/llvm-project/libcxx/src/mutex.cpp
+++ b/contrib/llvm-project/libcxx/src/mutex.cpp
@@ -25,164 +25,117 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// ~mutex is defined elsewhere
-void
-mutex::lock()
-{
- int ec = __libcpp_mutex_lock(&__m_);
- if (ec)
- __throw_system_error(ec, "mutex lock failed");
+void mutex::lock() {
+ int ec = __libcpp_mutex_lock(&__m_);
+ if (ec)
+ __throw_system_error(ec, "mutex lock failed");
}
-bool
-mutex::try_lock() noexcept
-{
- return __libcpp_mutex_trylock(&__m_);
-}
+bool mutex::try_lock() noexcept { return __libcpp_mutex_trylock(&__m_); }
-void
-mutex::unlock() noexcept
-{
- int ec = __libcpp_mutex_unlock(&__m_);
- (void)ec;
- _LIBCPP_ASSERT_UNCATEGORIZED(ec == 0, "call to mutex::unlock failed");
+void mutex::unlock() noexcept {
+ int ec = __libcpp_mutex_unlock(&__m_);
+ (void)ec;
+ _LIBCPP_ASSERT_UNCATEGORIZED(ec == 0, "call to mutex::unlock failed");
}
// recursive_mutex
-recursive_mutex::recursive_mutex()
-{
- int ec = __libcpp_recursive_mutex_init(&__m_);
- if (ec)
- __throw_system_error(ec, "recursive_mutex constructor failed");
+recursive_mutex::recursive_mutex() {
+ int ec = __libcpp_recursive_mutex_init(&__m_);
+ if (ec)
+ __throw_system_error(ec, "recursive_mutex constructor failed");
}
-recursive_mutex::~recursive_mutex()
-{
- int e = __libcpp_recursive_mutex_destroy(&__m_);
- (void)e;
- _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to ~recursive_mutex() failed");
+recursive_mutex::~recursive_mutex() {
+ int e = __libcpp_recursive_mutex_destroy(&__m_);
+ (void)e;
+ _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to ~recursive_mutex() failed");
}
-void
-recursive_mutex::lock()
-{
- int ec = __libcpp_recursive_mutex_lock(&__m_);
- if (ec)
- __throw_system_error(ec, "recursive_mutex lock failed");
+void recursive_mutex::lock() {
+ int ec = __libcpp_recursive_mutex_lock(&__m_);
+ if (ec)
+ __throw_system_error(ec, "recursive_mutex lock failed");
}
-void
-recursive_mutex::unlock() noexcept
-{
- int e = __libcpp_recursive_mutex_unlock(&__m_);
- (void)e;
- _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to recursive_mutex::unlock() failed");
+void recursive_mutex::unlock() noexcept {
+ int e = __libcpp_recursive_mutex_unlock(&__m_);
+ (void)e;
+ _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to recursive_mutex::unlock() failed");
}
-bool
-recursive_mutex::try_lock() noexcept
-{
- return __libcpp_recursive_mutex_trylock(&__m_);
-}
+bool recursive_mutex::try_lock() noexcept { return __libcpp_recursive_mutex_trylock(&__m_); }
// timed_mutex
-timed_mutex::timed_mutex()
- : __locked_(false)
-{
-}
+timed_mutex::timed_mutex() : __locked_(false) {}
-timed_mutex::~timed_mutex()
-{
- lock_guard<mutex> _(__m_);
-}
+timed_mutex::~timed_mutex() { lock_guard<mutex> _(__m_); }
-void
-timed_mutex::lock()
-{
- unique_lock<mutex> lk(__m_);
- while (__locked_)
- __cv_.wait(lk);
- __locked_ = true;
+void timed_mutex::lock() {
+ unique_lock<mutex> lk(__m_);
+ while (__locked_)
+ __cv_.wait(lk);
+ __locked_ = true;
}
-bool
-timed_mutex::try_lock() noexcept
-{
- unique_lock<mutex> lk(__m_, try_to_lock);
- if (lk.owns_lock() && !__locked_)
- {
- __locked_ = true;
- return true;
- }
- return false;
+bool timed_mutex::try_lock() noexcept {
+ unique_lock<mutex> lk(__m_, try_to_lock);
+ if (lk.owns_lock() && !__locked_) {
+ __locked_ = true;
+ return true;
+ }
+ return false;
}
-void
-timed_mutex::unlock() noexcept
-{
- lock_guard<mutex> _(__m_);
- __locked_ = false;
- __cv_.notify_one();
+void timed_mutex::unlock() noexcept {
+ lock_guard<mutex> _(__m_);
+ __locked_ = false;
+ __cv_.notify_one();
}
// recursive_timed_mutex
-recursive_timed_mutex::recursive_timed_mutex()
- : __count_(0),
- __id_{}
-{
-}
-
-recursive_timed_mutex::~recursive_timed_mutex()
-{
- lock_guard<mutex> _(__m_);
-}
-
-void
-recursive_timed_mutex::lock()
-{
- __thread_id id = this_thread::get_id();
- unique_lock<mutex> lk(__m_);
- if (id ==__id_)
- {
- if (__count_ == numeric_limits<size_t>::max())
- __throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached");
- ++__count_;
- return;
- }
- while (__count_ != 0)
- __cv_.wait(lk);
- __count_ = 1;
+recursive_timed_mutex::recursive_timed_mutex() : __count_(0), __id_{} {}
+
+recursive_timed_mutex::~recursive_timed_mutex() { lock_guard<mutex> _(__m_); }
+
+void recursive_timed_mutex::lock() {
+ __thread_id id = this_thread::get_id();
+ unique_lock<mutex> lk(__m_);
+ if (id == __id_) {
+ if (__count_ == numeric_limits<size_t>::max())
+ __throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached");
+ ++__count_;
+ return;
+ }
+ while (__count_ != 0)
+ __cv_.wait(lk);
+ __count_ = 1;
+ __id_ = id;
+}
+
+bool recursive_timed_mutex::try_lock() noexcept {
+ __thread_id id = this_thread::get_id();
+ unique_lock<mutex> lk(__m_, try_to_lock);
+ if (lk.owns_lock() && (__count_ == 0 || id == __id_)) {
+ if (__count_ == numeric_limits<size_t>::max())
+ return false;
+ ++__count_;
__id_ = id;
+ return true;
+ }
+ return false;
}
-bool
-recursive_timed_mutex::try_lock() noexcept
-{
- __thread_id id = this_thread::get_id();
- unique_lock<mutex> lk(__m_, try_to_lock);
- if (lk.owns_lock() && (__count_ == 0 || id == __id_))
- {
- if (__count_ == numeric_limits<size_t>::max())
- return false;
- ++__count_;
- __id_ = id;
- return true;
- }
- return false;
-}
-
-void
-recursive_timed_mutex::unlock() noexcept
-{
- unique_lock<mutex> lk(__m_);
- if (--__count_ == 0)
- {
- __id_.__reset();
- lk.unlock();
- __cv_.notify_one();
- }
+void recursive_timed_mutex::unlock() noexcept {
+ unique_lock<mutex> lk(__m_);
+ if (--__count_ == 0) {
+ __id_.__reset();
+ lk.unlock();
+ __cv_.notify_one();
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/mutex_destructor.cpp b/contrib/llvm-project/libcxx/src/mutex_destructor.cpp
index 5f063703324a..d5ac257f94d5 100644
--- a/contrib/llvm-project/libcxx/src/mutex_destructor.cpp
+++ b/contrib/llvm-project/libcxx/src/mutex_destructor.cpp
@@ -26,23 +26,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef NEEDS_MUTEX_DESTRUCTOR
-class _LIBCPP_EXPORTED_FROM_ABI mutex
-{
- __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
+class _LIBCPP_EXPORTED_FROM_ABI mutex {
+ __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
public:
- _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI
- constexpr mutex() = default;
- mutex(const mutex&) = delete;
- mutex& operator=(const mutex&) = delete;
- ~mutex() noexcept;
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI constexpr mutex() = default;
+ mutex(const mutex&) = delete;
+ mutex& operator=(const mutex&) = delete;
+ ~mutex() noexcept;
};
-
-mutex::~mutex() noexcept
-{
- __libcpp_mutex_destroy(&__m_);
-}
+mutex::~mutex() noexcept { __libcpp_mutex_destroy(&__m_); }
#endif // !NEEDS_MUTEX_DESTRUCTOR
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/optional.cpp b/contrib/llvm-project/libcxx/src/optional.cpp
index fc91152f011c..6ba63f2d89f5 100644
--- a/contrib/llvm-project/libcxx/src/optional.cpp
+++ b/contrib/llvm-project/libcxx/src/optional.cpp
@@ -10,17 +10,13 @@
#include <optional>
#include <stdexcept>
-namespace std
-{
+namespace std {
bad_optional_access::~bad_optional_access() noexcept = default;
-const char* bad_optional_access::what() const noexcept {
- return "bad_optional_access";
-}
-
-} // std
+const char* bad_optional_access::what() const noexcept { return "bad_optional_access"; }
+} // namespace std
#include <experimental/__config>
@@ -28,9 +24,7 @@ const char* bad_optional_access::what() const noexcept {
// Even though it no longer exists in a header file
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
- : public std::logic_error
-{
+class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access : public std::logic_error {
public:
bad_optional_access() : std::logic_error("Bad optional Access") {}
diff --git a/contrib/llvm-project/libcxx/src/ostream.cpp b/contrib/llvm-project/libcxx/src/ostream.cpp
new file mode 100644
index 000000000000..bba8e6550710
--- /dev/null
+++ b/contrib/llvm-project/libcxx/src/ostream.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 <__availability>
+#include <__config>
+#ifndef _LIBCPP_HAS_NO_FILESYSTEM
+# include <fstream>
+#endif
+#include <ostream>
+
+#include "std_stream.h"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+_LIBCPP_AVAILABILITY_PRINT _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) {
+ // dynamic_cast requires RTTI, this only affects users whose vendor builds
+ // the dylib with RTTI disabled. It does not affect users who build with RTTI
+ // disabled but use a dylib where the RTTI is enabled.
+ //
+ // Returning a nullptr means the stream is not considered a terminal and the
+ // special terminal handling is not done. The terminal handling is mainly of
+ // importance on Windows.
+#ifndef _LIBCPP_HAS_NO_RTTI
+ auto* __rdbuf = __os.rdbuf();
+# ifndef _LIBCPP_HAS_NO_FILESYSTEM
+ if (auto* __buffer = dynamic_cast<filebuf*>(__rdbuf))
+ return __buffer->__file_;
+# endif
+
+ if (auto* __buffer = dynamic_cast<__stdoutbuf<char>*>(__rdbuf))
+ return __buffer->__file_;
+#endif // _LIBCPP_HAS_NO_RTTI
+
+ return nullptr;
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/random.cpp b/contrib/llvm-project/libcxx/src/random.cpp
index dfac89f75b5a..c7073c54da6b 100644
--- a/contrib/llvm-project/libcxx/src/random.cpp
+++ b/contrib/llvm-project/libcxx/src/random.cpp
@@ -9,8 +9,8 @@
#include <__config>
#if defined(_LIBCPP_USING_WIN32_RANDOM)
- // Must be defined before including stdlib.h to enable rand_s().
-# define _CRT_RAND_S
+// Must be defined before including stdlib.h to enable rand_s().
+# define _CRT_RAND_S
#endif // defined(_LIBCPP_USING_WIN32_RANDOM)
#include <__system_error/system_error.h>
@@ -22,148 +22,115 @@
#include <stdlib.h>
#if defined(_LIBCPP_USING_GETENTROPY)
-# include <sys/random.h>
+# include <sys/random.h>
#elif defined(_LIBCPP_USING_DEV_RANDOM)
-# include <fcntl.h>
-# include <unistd.h>
-# if __has_include(<sys/ioctl.h>) && __has_include(<linux/random.h>)
-# include <sys/ioctl.h>
-# include <linux/random.h>
-# endif
+# include <fcntl.h>
+# include <unistd.h>
+# if __has_include(<sys/ioctl.h>) && __has_include(<linux/random.h>)
+# include <linux/random.h>
+# include <sys/ioctl.h>
+# endif
#elif defined(_LIBCPP_USING_NACL_RANDOM)
-# include <nacl/nacl_random.h>
+# include <nacl/nacl_random.h>
#elif defined(_LIBCPP_USING_FUCHSIA_CPRNG)
# include <zircon/syscalls.h>
#endif
-
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(_LIBCPP_USING_GETENTROPY)
-random_device::random_device(const string& __token)
-{
- if (__token != "/dev/urandom")
- __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+random_device::random_device(const string& __token) {
+ if (__token != "/dev/urandom")
+ __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
}
-random_device::~random_device()
-{
-}
+random_device::~random_device() {}
-unsigned
-random_device::operator()()
-{
- unsigned r;
- size_t n = sizeof(r);
- int err = getentropy(&r, n);
- if (err)
- __throw_system_error(errno, "random_device getentropy failed");
- return r;
+unsigned random_device::operator()() {
+ unsigned r;
+ size_t n = sizeof(r);
+ int err = getentropy(&r, n);
+ if (err)
+ __throw_system_error(errno, "random_device getentropy failed");
+ return r;
}
#elif defined(_LIBCPP_USING_ARC4_RANDOM)
-random_device::random_device(const string&)
-{
-}
+random_device::random_device(const string&) {}
-random_device::~random_device()
-{
-}
+random_device::~random_device() {}
-unsigned
-random_device::operator()()
-{
- return arc4random();
-}
+unsigned random_device::operator()() { return arc4random(); }
#elif defined(_LIBCPP_USING_DEV_RANDOM)
-random_device::random_device(const string& __token)
- : __f_(open(__token.c_str(), O_RDONLY))
-{
- if (__f_ < 0)
- __throw_system_error(errno, ("random_device failed to open " + __token).c_str());
+random_device::random_device(const string& __token) : __f_(open(__token.c_str(), O_RDONLY)) {
+ if (__f_ < 0)
+ __throw_system_error(errno, ("random_device failed to open " + __token).c_str());
}
-random_device::~random_device()
-{
- close(__f_);
-}
+random_device::~random_device() { close(__f_); }
-unsigned
-random_device::operator()()
-{
- unsigned r;
- size_t n = sizeof(r);
- char* p = reinterpret_cast<char*>(&r);
- while (n > 0)
- {
- ssize_t s = read(__f_, p, n);
- if (s == 0)
- __throw_system_error(ENODATA, "random_device got EOF");
- if (s == -1)
- {
- if (errno != EINTR)
- __throw_system_error(errno, "random_device got an unexpected error");
- continue;
- }
- n -= static_cast<size_t>(s);
- p += static_cast<size_t>(s);
+unsigned random_device::operator()() {
+ unsigned r;
+ size_t n = sizeof(r);
+ char* p = reinterpret_cast<char*>(&r);
+ while (n > 0) {
+ ssize_t s = read(__f_, p, n);
+ if (s == 0)
+ __throw_system_error(ENODATA, "random_device got EOF");
+ if (s == -1) {
+ if (errno != EINTR)
+ __throw_system_error(errno, "random_device got an unexpected error");
+ continue;
}
- return r;
+ n -= static_cast<size_t>(s);
+ p += static_cast<size_t>(s);
+ }
+ return r;
}
#elif defined(_LIBCPP_USING_NACL_RANDOM)
-random_device::random_device(const string& __token)
-{
- if (__token != "/dev/urandom")
- __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
- int error = nacl_secure_random_init();
- if (error)
- __throw_system_error(error, ("random device failed to open " + __token).c_str());
+random_device::random_device(const string& __token) {
+ if (__token != "/dev/urandom")
+ __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+ int error = nacl_secure_random_init();
+ if (error)
+ __throw_system_error(error, ("random device failed to open " + __token).c_str());
}
-random_device::~random_device()
-{
-}
+random_device::~random_device() {}
-unsigned
-random_device::operator()()
-{
- unsigned r;
- size_t n = sizeof(r);
- size_t bytes_written;
- int error = nacl_secure_random(&r, n, &bytes_written);
- if (error != 0)
- __throw_system_error(error, "random_device failed getting bytes");
- else if (bytes_written != n)
- __throw_runtime_error("random_device failed to obtain enough bytes");
- return r;
+unsigned random_device::operator()() {
+ unsigned r;
+ size_t n = sizeof(r);
+ size_t bytes_written;
+ int error = nacl_secure_random(&r, n, &bytes_written);
+ if (error != 0)
+ __throw_system_error(error, "random_device failed getting bytes");
+ else if (bytes_written != n)
+ __throw_runtime_error("random_device failed to obtain enough bytes");
+ return r;
}
#elif defined(_LIBCPP_USING_WIN32_RANDOM)
-random_device::random_device(const string& __token)
-{
- if (__token != "/dev/urandom")
- __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+random_device::random_device(const string& __token) {
+ if (__token != "/dev/urandom")
+ __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
}
-random_device::~random_device()
-{
-}
+random_device::~random_device() {}
-unsigned
-random_device::operator()()
-{
- unsigned r;
- errno_t err = rand_s(&r);
- if (err)
- __throw_system_error(err, "random_device rand_s failed.");
- return r;
+unsigned random_device::operator()() {
+ unsigned r;
+ errno_t err = rand_s(&r);
+ if (err)
+ __throw_system_error(err, "random_device rand_s failed.");
+ return r;
}
#elif defined(_LIBCPP_USING_FUCHSIA_CPRNG)
@@ -188,12 +155,10 @@ unsigned random_device::operator()() {
}
#else
-#error "Random device not implemented for this architecture"
+# error "Random device not implemented for this architecture"
#endif
-double
-random_device::entropy() const noexcept
-{
+double random_device::entropy() const noexcept {
#if defined(_LIBCPP_USING_DEV_RANDOM) && defined(RNDGETENTCNT)
int ent;
if (::ioctl(__f_, RNDGETENTCNT, &ent) < 0)
diff --git a/contrib/llvm-project/libcxx/src/random_shuffle.cpp b/contrib/llvm-project/libcxx/src/random_shuffle.cpp
index e9087a97014f..3aaf71d84643 100644
--- a/contrib/llvm-project/libcxx/src/random_shuffle.cpp
+++ b/contrib/llvm-project/libcxx/src/random_shuffle.cpp
@@ -23,40 +23,29 @@ static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER;
#endif
unsigned __rs_default::__c_ = 0;
-__rs_default::__rs_default()
-{
+__rs_default::__rs_default() {
#ifndef _LIBCPP_HAS_NO_THREADS
- __libcpp_mutex_lock(&__rs_mut);
+ __libcpp_mutex_lock(&__rs_mut);
#endif
- __c_ = 1;
+ __c_ = 1;
}
-__rs_default::__rs_default(const __rs_default&)
-{
- ++__c_;
-}
+__rs_default::__rs_default(const __rs_default&) { ++__c_; }
-__rs_default::~__rs_default()
-{
+__rs_default::~__rs_default() {
#ifndef _LIBCPP_HAS_NO_THREADS
- if (--__c_ == 0)
- __libcpp_mutex_unlock(&__rs_mut);
+ if (--__c_ == 0)
+ __libcpp_mutex_unlock(&__rs_mut);
#else
- --__c_;
+ --__c_;
#endif
}
-__rs_default::result_type
-__rs_default::operator()()
-{
- static mt19937 __rs_g;
- return __rs_g();
+__rs_default::result_type __rs_default::operator()() {
+ static mt19937 __rs_g;
+ return __rs_g();
}
-__rs_default
-__rs_get()
-{
- return __rs_default();
-}
+__rs_default __rs_get() { return __rs_default(); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/regex.cpp b/contrib/llvm-project/libcxx/src/regex.cpp
index 0825c758bf0c..9dc0c698541c 100644
--- a/contrib/llvm-project/libcxx/src/regex.cpp
+++ b/contrib/llvm-project/libcxx/src/regex.cpp
@@ -12,75 +12,67 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-static
-const char*
-make_error_type_string(regex_constants::error_type ecode)
-{
- switch (ecode)
- {
- case regex_constants::error_collate:
- return "The expression contained an invalid collating element name.";
- case regex_constants::error_ctype:
- return "The expression contained an invalid character class name.";
- case regex_constants::error_escape:
- return "The expression contained an invalid escaped character, or a "
- "trailing escape.";
- case regex_constants::error_backref:
- return "The expression contained an invalid back reference.";
- case regex_constants::error_brack:
- return "The expression contained mismatched [ and ].";
- case regex_constants::error_paren:
- return "The expression contained mismatched ( and ).";
- case regex_constants::error_brace:
- return "The expression contained mismatched { and }.";
- case regex_constants::error_badbrace:
- return "The expression contained an invalid range in a {} expression.";
- case regex_constants::error_range:
- return "The expression contained an invalid character range, "
- "such as [b-a] in most encodings.";
- case regex_constants::error_space:
- return "There was insufficient memory to convert the expression into "
- "a finite state machine.";
- case regex_constants::error_badrepeat:
- return "One of *?+{ was not preceded by a valid regular expression.";
- case regex_constants::error_complexity:
- return "The complexity of an attempted match against a regular "
- "expression exceeded a pre-set level.";
- case regex_constants::error_stack:
- return "There was insufficient memory to determine whether the regular "
- "expression could match the specified character sequence.";
- case regex_constants::__re_err_grammar:
- return "An invalid regex grammar has been requested.";
- case regex_constants::__re_err_empty:
- return "An empty regex is not allowed in the POSIX grammar.";
- case regex_constants::__re_err_parse:
- return "The parser did not consume the entire regular expression.";
- default:
- break;
- }
- return "Unknown error type";
+static const char* make_error_type_string(regex_constants::error_type ecode) {
+ switch (ecode) {
+ case regex_constants::error_collate:
+ return "The expression contained an invalid collating element name.";
+ case regex_constants::error_ctype:
+ return "The expression contained an invalid character class name.";
+ case regex_constants::error_escape:
+ return "The expression contained an invalid escaped character, or a "
+ "trailing escape.";
+ case regex_constants::error_backref:
+ return "The expression contained an invalid back reference.";
+ case regex_constants::error_brack:
+ return "The expression contained mismatched [ and ].";
+ case regex_constants::error_paren:
+ return "The expression contained mismatched ( and ).";
+ case regex_constants::error_brace:
+ return "The expression contained mismatched { and }.";
+ case regex_constants::error_badbrace:
+ return "The expression contained an invalid range in a {} expression.";
+ case regex_constants::error_range:
+ return "The expression contained an invalid character range, "
+ "such as [b-a] in most encodings.";
+ case regex_constants::error_space:
+ return "There was insufficient memory to convert the expression into "
+ "a finite state machine.";
+ case regex_constants::error_badrepeat:
+ return "One of *?+{ was not preceded by a valid regular expression.";
+ case regex_constants::error_complexity:
+ return "The complexity of an attempted match against a regular "
+ "expression exceeded a pre-set level.";
+ case regex_constants::error_stack:
+ return "There was insufficient memory to determine whether the regular "
+ "expression could match the specified character sequence.";
+ case regex_constants::__re_err_grammar:
+ return "An invalid regex grammar has been requested.";
+ case regex_constants::__re_err_empty:
+ return "An empty regex is not allowed in the POSIX grammar.";
+ case regex_constants::__re_err_parse:
+ return "The parser did not consume the entire regular expression.";
+ default:
+ break;
+ }
+ return "Unknown error type";
}
regex_error::regex_error(regex_constants::error_type ecode)
- : runtime_error(make_error_type_string(ecode)),
- __code_(ecode)
-{}
+ : runtime_error(make_error_type_string(ecode)), __code_(ecode) {}
regex_error::~regex_error() throw() {}
namespace {
-struct collationnames
-{
- const char* elem_;
- char char_;
+struct collationnames {
+ const char* elem_;
+ char char_;
};
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
// EBCDIC IBM-1047
// Sorted via the EBCDIC collating sequence
-const collationnames collatenames[] =
-{
+const collationnames collatenames[] = {
{"a", 0x81},
{"alert", 0x2f},
{"ampersand", 0x50},
@@ -191,12 +183,10 @@ const collationnames collatenames[] =
{"W", 0xe6},
{"X", 0xe7},
{"Y", 0xe8},
- {"Z", 0xe9}
-};
+ {"Z", 0xe9}};
#else
// ASCII
-const collationnames collatenames[] =
-{
+const collationnames collatenames[] = {
{"A", 0x41},
{"B", 0x42},
{"C", 0x43},
@@ -307,130 +297,103 @@ const collationnames collatenames[] =
{"x", 0x78},
{"y", 0x79},
{"z", 0x7a},
- {"zero", 0x30}
-};
+ {"zero", 0x30}};
#endif
-struct classnames
-{
- const char* elem_;
- regex_traits<char>::char_class_type mask_;
+struct classnames {
+ const char* elem_;
+ regex_traits<char>::char_class_type mask_;
};
-const classnames ClassNames[] =
-{
- {"alnum", ctype_base::alnum},
- {"alpha", ctype_base::alpha},
- {"blank", ctype_base::blank},
- {"cntrl", ctype_base::cntrl},
- {"d", ctype_base::digit},
- {"digit", ctype_base::digit},
- {"graph", ctype_base::graph},
- {"lower", ctype_base::lower},
- {"print", ctype_base::print},
- {"punct", ctype_base::punct},
- {"s", ctype_base::space},
- {"space", ctype_base::space},
- {"upper", ctype_base::upper},
- {"w", regex_traits<char>::__regex_word},
- {"xdigit", ctype_base::xdigit}
-};
+const classnames ClassNames[] = {
+ {"alnum", ctype_base::alnum},
+ {"alpha", ctype_base::alpha},
+ {"blank", ctype_base::blank},
+ {"cntrl", ctype_base::cntrl},
+ {"d", ctype_base::digit},
+ {"digit", ctype_base::digit},
+ {"graph", ctype_base::graph},
+ {"lower", ctype_base::lower},
+ {"print", ctype_base::print},
+ {"punct", ctype_base::punct},
+ {"s", ctype_base::space},
+ {"space", ctype_base::space},
+ {"upper", ctype_base::upper},
+ {"w", regex_traits<char>::__regex_word},
+ {"xdigit", ctype_base::xdigit}};
-struct use_strcmp
-{
- bool operator()(const collationnames& x, const char* y)
- {return strcmp(x.elem_, y) < 0;}
- bool operator()(const classnames& x, const char* y)
- {return strcmp(x.elem_, y) < 0;}
+struct use_strcmp {
+ bool operator()(const collationnames& x, const char* y) { return strcmp(x.elem_, y) < 0; }
+ bool operator()(const classnames& x, const char* y) { return strcmp(x.elem_, y) < 0; }
};
-}
+} // namespace
-string
-__get_collation_name(const char* s)
-{
- const collationnames* i =
- std::lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
- string r;
- if (i != end(collatenames) && strcmp(s, i->elem_) == 0)
- r = char(i->char_);
- return r;
+string __get_collation_name(const char* s) {
+ const collationnames* i = std::lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
+ string r;
+ if (i != end(collatenames) && strcmp(s, i->elem_) == 0)
+ r = char(i->char_);
+ return r;
}
-regex_traits<char>::char_class_type
-__get_classname(const char* s, bool __icase)
-{
- const classnames* i =
- std::lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
- regex_traits<char>::char_class_type r = 0;
- if (i != end(ClassNames) && strcmp(s, i->elem_) == 0)
- {
- r = i->mask_;
- if (r == regex_traits<char>::__regex_word)
- r |= ctype_base::alnum | ctype_base::upper | ctype_base::lower;
- else if (__icase)
- {
- if (r & (ctype_base::lower | ctype_base::upper))
- r |= ctype_base::alpha;
- }
+regex_traits<char>::char_class_type __get_classname(const char* s, bool __icase) {
+ const classnames* i = std::lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
+ regex_traits<char>::char_class_type r = 0;
+ if (i != end(ClassNames) && strcmp(s, i->elem_) == 0) {
+ r = i->mask_;
+ if (r == regex_traits<char>::__regex_word)
+ r |= ctype_base::alnum | ctype_base::upper | ctype_base::lower;
+ else if (__icase) {
+ if (r & (ctype_base::lower | ctype_base::upper))
+ r |= ctype_base::alpha;
}
- return r;
+ }
+ return r;
}
template <>
-void
-__match_any_but_newline<char>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_)
- {
- switch (*__s.__current_)
- {
- case '\r':
- case '\n':
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- break;
- default:
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- break;
- }
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __match_any_but_newline<char>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_) {
+ switch (*__s.__current_) {
+ case '\r':
+ case '\n':
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ break;
+ default:
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ break;
}
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
template <>
-void
-__match_any_but_newline<wchar_t>::__exec(__state& __s) const
-{
- if (__s.__current_ != __s.__last_)
- {
- switch (*__s.__current_)
- {
- case '\r':
- case '\n':
- case 0x2028:
- case 0x2029:
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
- break;
- default:
- __s.__do_ = __state::__accept_and_consume;
- ++__s.__current_;
- __s.__node_ = this->first();
- break;
- }
- }
- else
- {
- __s.__do_ = __state::__reject;
- __s.__node_ = nullptr;
+void __match_any_but_newline<wchar_t>::__exec(__state& __s) const {
+ if (__s.__current_ != __s.__last_) {
+ switch (*__s.__current_) {
+ case '\r':
+ case '\n':
+ case 0x2028:
+ case 0x2029:
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ break;
+ default:
+ __s.__do_ = __state::__accept_and_consume;
+ ++__s.__current_;
+ __s.__node_ = this->first();
+ break;
}
+ } else {
+ __s.__do_ = __state::__reject;
+ __s.__node_ = nullptr;
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/std_stream.h b/contrib/llvm-project/libcxx/src/std_stream.h
index 39a2b70b4f47..e55cd0b6b77a 100644
--- a/contrib/llvm-project/libcxx/src/std_stream.h
+++ b/contrib/llvm-project/libcxx/src/std_stream.h
@@ -23,7 +23,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
static const int __limit = 8;
@@ -31,281 +30,247 @@ static const int __limit = 8;
// __stdinbuf
template <class _CharT>
-class _LIBCPP_HIDDEN __stdinbuf
- : public basic_streambuf<_CharT, char_traits<_CharT> >
-{
+class _LIBCPP_HIDDEN __stdinbuf : public basic_streambuf<_CharT, char_traits<_CharT> > {
public:
- typedef _CharT char_type;
- typedef char_traits<char_type> traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef typename traits_type::state_type state_type;
+ typedef _CharT char_type;
+ typedef char_traits<char_type> traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef typename traits_type::state_type state_type;
- __stdinbuf(FILE* __fp, state_type* __st);
+ __stdinbuf(FILE* __fp, state_type* __st);
protected:
- virtual int_type underflow();
- virtual int_type uflow();
- virtual int_type pbackfail(int_type __c = traits_type::eof());
- virtual void imbue(const locale& __loc);
+ virtual int_type underflow();
+ virtual int_type uflow();
+ virtual int_type pbackfail(int_type __c = traits_type::eof());
+ virtual void imbue(const locale& __loc);
private:
-
- FILE* __file_;
- const codecvt<char_type, char, state_type>* __cv_;
- state_type* __st_;
- int __encoding_;
- int_type __last_consumed_;
- bool __last_consumed_is_next_;
- bool __always_noconv_;
+ FILE* __file_;
+ const codecvt<char_type, char, state_type>* __cv_;
+ state_type* __st_;
+ int __encoding_;
+ int_type __last_consumed_;
+ bool __last_consumed_is_next_;
+ bool __always_noconv_;
#if defined(_LIBCPP_WIN32API)
- static constexpr bool __is_win32api_wide_char = !is_same_v<_CharT, char>;
+ static constexpr bool __is_win32api_wide_char = !is_same_v<_CharT, char>;
#else
- static constexpr bool __is_win32api_wide_char = false;
+ static constexpr bool __is_win32api_wide_char = false;
#endif
- __stdinbuf(const __stdinbuf&);
- __stdinbuf& operator=(const __stdinbuf&);
+ __stdinbuf(const __stdinbuf&);
+ __stdinbuf& operator=(const __stdinbuf&);
- int_type __getchar(bool __consume);
+ int_type __getchar(bool __consume);
};
template <class _CharT>
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
- : __file_(__fp),
- __st_(__st),
- __last_consumed_(traits_type::eof()),
- __last_consumed_is_next_(false)
-{
- imbue(this->getloc());
- // On Windows, in wchar_t mode, ignore the codecvt from the locale by
- // default and assume noconv; this passes wchar_t through unmodified from
- // getwc. If the user sets a custom locale with imbue(), that gets honored,
- // the IO is done with getc() and converted with the provided codecvt.
- if constexpr (__is_win32api_wide_char)
- __always_noconv_ = true;
+ : __file_(__fp), __st_(__st), __last_consumed_(traits_type::eof()), __last_consumed_is_next_(false) {
+ imbue(this->getloc());
+ // On Windows, in wchar_t mode, ignore the codecvt from the locale by
+ // default and assume noconv; this passes wchar_t through unmodified from
+ // getwc. If the user sets a custom locale with imbue(), that gets honored,
+ // the IO is done with getc() and converted with the provided codecvt.
+ if constexpr (__is_win32api_wide_char)
+ __always_noconv_ = true;
}
template <class _CharT>
-void
-__stdinbuf<_CharT>::imbue(const locale& __loc)
-{
- __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
- __encoding_ = __cv_->encoding();
- __always_noconv_ = __cv_->always_noconv();
- if (__encoding_ > __limit)
- __throw_runtime_error("unsupported locale for standard input");
+void __stdinbuf<_CharT>::imbue(const locale& __loc) {
+ __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
+ __encoding_ = __cv_->encoding();
+ __always_noconv_ = __cv_->always_noconv();
+ if (__encoding_ > __limit)
+ __throw_runtime_error("unsupported locale for standard input");
}
template <class _CharT>
-typename __stdinbuf<_CharT>::int_type
-__stdinbuf<_CharT>::underflow()
-{
- return __getchar(false);
+typename __stdinbuf<_CharT>::int_type __stdinbuf<_CharT>::underflow() {
+ return __getchar(false);
}
template <class _CharT>
-typename __stdinbuf<_CharT>::int_type
-__stdinbuf<_CharT>::uflow()
-{
- return __getchar(true);
+typename __stdinbuf<_CharT>::int_type __stdinbuf<_CharT>::uflow() {
+ return __getchar(true);
}
-inline bool __do_getc(FILE *__fp, char *__pbuf) {
- int __c = getc(__fp);
- if (__c == EOF)
- return false;
- *__pbuf = static_cast<char>(__c);
- return true;
+inline bool __do_getc(FILE* __fp, char* __pbuf) {
+ int __c = getc(__fp);
+ if (__c == EOF)
+ return false;
+ *__pbuf = static_cast<char>(__c);
+ return true;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline bool __do_getc(FILE *__fp, wchar_t *__pbuf) {
- wint_t __c = getwc(__fp);
- if (__c == WEOF)
- return false;
- *__pbuf = static_cast<wchar_t>(__c);
- return true;
+inline bool __do_getc(FILE* __fp, wchar_t* __pbuf) {
+ wint_t __c = getwc(__fp);
+ if (__c == WEOF)
+ return false;
+ *__pbuf = static_cast<wchar_t>(__c);
+ return true;
}
#endif
-inline bool __do_ungetc(int __c, FILE *__fp, char __dummy) {
- if (ungetc(__c, __fp) == EOF)
- return false;
- return true;
+inline bool __do_ungetc(int __c, FILE* __fp, char __dummy) {
+ if (ungetc(__c, __fp) == EOF)
+ return false;
+ return true;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline bool __do_ungetc(std::wint_t __c, FILE *__fp, wchar_t __dummy) {
- if (ungetwc(__c, __fp) == WEOF)
- return false;
- return true;
+inline bool __do_ungetc(std::wint_t __c, FILE* __fp, wchar_t __dummy) {
+ if (ungetwc(__c, __fp) == WEOF)
+ return false;
+ return true;
}
#endif
template <class _CharT>
-typename __stdinbuf<_CharT>::int_type
-__stdinbuf<_CharT>::__getchar(bool __consume)
-{
- if (__last_consumed_is_next_)
- {
- int_type __result = __last_consumed_;
- if (__consume)
- {
- __last_consumed_ = traits_type::eof();
- __last_consumed_is_next_ = false;
- }
- return __result;
- }
- if (__always_noconv_) {
- char_type __1buf;
- if (!__do_getc(__file_, &__1buf))
- return traits_type::eof();
- if (!__consume)
- {
- if (!__do_ungetc(traits_type::to_int_type(__1buf), __file_, __1buf))
- return traits_type::eof();
- }
- else
- __last_consumed_ = traits_type::to_int_type(__1buf);
- return traits_type::to_int_type(__1buf);
+typename __stdinbuf<_CharT>::int_type __stdinbuf<_CharT>::__getchar(bool __consume) {
+ if (__last_consumed_is_next_) {
+ int_type __result = __last_consumed_;
+ if (__consume) {
+ __last_consumed_ = traits_type::eof();
+ __last_consumed_is_next_ = false;
}
+ return __result;
+ }
+ if (__always_noconv_) {
+ char_type __1buf;
+ if (!__do_getc(__file_, &__1buf))
+ return traits_type::eof();
+ if (!__consume) {
+ if (!__do_ungetc(traits_type::to_int_type(__1buf), __file_, __1buf))
+ return traits_type::eof();
+ } else
+ __last_consumed_ = traits_type::to_int_type(__1buf);
+ return traits_type::to_int_type(__1buf);
+ }
- char __extbuf[__limit];
- int __nread = std::max(1, __encoding_);
- for (int __i = 0; __i < __nread; ++__i)
- {
+ char __extbuf[__limit];
+ int __nread = std::max(1, __encoding_);
+ for (int __i = 0; __i < __nread; ++__i) {
+ int __c = getc(__file_);
+ if (__c == EOF)
+ return traits_type::eof();
+ __extbuf[__i] = static_cast<char>(__c);
+ }
+ char_type __1buf;
+ const char* __enxt;
+ char_type* __inxt;
+ codecvt_base::result __r;
+ do {
+ state_type __sv_st = *__st_;
+ __r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt, &__1buf, &__1buf + 1, __inxt);
+ switch (__r) {
+ case std::codecvt_base::ok:
+ break;
+ case codecvt_base::partial:
+ *__st_ = __sv_st;
+ if (__nread == sizeof(__extbuf))
+ return traits_type::eof();
+ {
int __c = getc(__file_);
if (__c == EOF)
- return traits_type::eof();
- __extbuf[__i] = static_cast<char>(__c);
+ return traits_type::eof();
+ __extbuf[__nread] = static_cast<char>(__c);
+ }
+ ++__nread;
+ break;
+ case codecvt_base::error:
+ return traits_type::eof();
+ case std::codecvt_base::noconv:
+ __1buf = static_cast<char_type>(__extbuf[0]);
+ break;
}
- char_type __1buf;
- const char* __enxt;
- char_type* __inxt;
- codecvt_base::result __r;
- do
- {
- state_type __sv_st = *__st_;
- __r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
- &__1buf, &__1buf + 1, __inxt);
- switch (__r)
- {
- case std::codecvt_base::ok:
- break;
- case codecvt_base::partial:
- *__st_ = __sv_st;
- if (__nread == sizeof(__extbuf))
- return traits_type::eof();
- {
- int __c = getc(__file_);
- if (__c == EOF)
- return traits_type::eof();
- __extbuf[__nread] = static_cast<char>(__c);
- }
- ++__nread;
- break;
- case codecvt_base::error:
- return traits_type::eof();
- case std::codecvt_base::noconv:
- __1buf = static_cast<char_type>(__extbuf[0]);
- break;
- }
- } while (__r == std::codecvt_base::partial);
- if (!__consume)
- {
- for (int __i = __nread; __i > 0;)
- {
- if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
- return traits_type::eof();
- }
+ } while (__r == std::codecvt_base::partial);
+ if (!__consume) {
+ for (int __i = __nread; __i > 0;) {
+ if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
+ return traits_type::eof();
}
- else
- __last_consumed_ = traits_type::to_int_type(__1buf);
- return traits_type::to_int_type(__1buf);
+ } else
+ __last_consumed_ = traits_type::to_int_type(__1buf);
+ return traits_type::to_int_type(__1buf);
}
template <class _CharT>
-typename __stdinbuf<_CharT>::int_type
-__stdinbuf<_CharT>::pbackfail(int_type __c)
-{
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- {
- if (!__last_consumed_is_next_)
- {
- __c = __last_consumed_;
- __last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
- traits_type::eof());
- }
- return __c;
+typename __stdinbuf<_CharT>::int_type __stdinbuf<_CharT>::pbackfail(int_type __c) {
+ if (traits_type::eq_int_type(__c, traits_type::eof())) {
+ if (!__last_consumed_is_next_) {
+ __c = __last_consumed_;
+ __last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_, traits_type::eof());
}
- if (__always_noconv_ && __last_consumed_is_next_) {
- if (!__do_ungetc(__last_consumed_, __file_,
- traits_type::to_char_type(__last_consumed_)))
- return traits_type::eof();
- } else if (__last_consumed_is_next_) {
- char __extbuf[__limit];
- char* __enxt;
- const char_type __ci = traits_type::to_char_type(__last_consumed_);
- const char_type* __inxt;
- switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
- __extbuf, __extbuf + sizeof(__extbuf), __enxt))
- {
- case std::codecvt_base::ok:
- break;
- case std::codecvt_base::noconv:
- __extbuf[0] = static_cast<char>(__last_consumed_);
- __enxt = __extbuf + 1;
- break;
- case codecvt_base::partial:
- case codecvt_base::error:
- return traits_type::eof();
- }
- while (__enxt > __extbuf)
- if (ungetc(*--__enxt, __file_) == EOF)
- return traits_type::eof();
- }
- __last_consumed_ = __c;
- __last_consumed_is_next_ = true;
return __c;
+ }
+ if (__always_noconv_ && __last_consumed_is_next_) {
+ if (!__do_ungetc(__last_consumed_, __file_, traits_type::to_char_type(__last_consumed_)))
+ return traits_type::eof();
+ } else if (__last_consumed_is_next_) {
+ char __extbuf[__limit];
+ char* __enxt;
+ const char_type __ci = traits_type::to_char_type(__last_consumed_);
+ const char_type* __inxt;
+ switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt, __extbuf, __extbuf + sizeof(__extbuf), __enxt)) {
+ case std::codecvt_base::ok:
+ break;
+ case std::codecvt_base::noconv:
+ __extbuf[0] = static_cast<char>(__last_consumed_);
+ __enxt = __extbuf + 1;
+ break;
+ case codecvt_base::partial:
+ case codecvt_base::error:
+ return traits_type::eof();
+ }
+ while (__enxt > __extbuf)
+ if (ungetc(*--__enxt, __file_) == EOF)
+ return traits_type::eof();
+ }
+ __last_consumed_ = __c;
+ __last_consumed_is_next_ = true;
+ return __c;
}
// __stdoutbuf
template <class _CharT>
-class _LIBCPP_HIDDEN __stdoutbuf
- : public basic_streambuf<_CharT, char_traits<_CharT> >
-{
+class _LIBCPP_HIDDEN __stdoutbuf : public basic_streambuf<_CharT, char_traits<_CharT> > {
public:
- typedef _CharT char_type;
- typedef char_traits<char_type> traits_type;
- typedef typename traits_type::int_type int_type;
- typedef typename traits_type::pos_type pos_type;
- typedef typename traits_type::off_type off_type;
- typedef typename traits_type::state_type state_type;
+ typedef _CharT char_type;
+ typedef char_traits<char_type> traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef typename traits_type::state_type state_type;
- __stdoutbuf(FILE* __fp, state_type* __st);
+ __stdoutbuf(FILE* __fp, state_type* __st);
protected:
- virtual int_type overflow (int_type __c = traits_type::eof());
- virtual streamsize xsputn(const char_type* __s, streamsize __n);
- virtual int sync();
- virtual void imbue(const locale& __loc);
+ virtual int_type overflow(int_type __c = traits_type::eof());
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+ virtual int sync();
+ virtual void imbue(const locale& __loc);
private:
- FILE* __file_;
- const codecvt<char_type, char, state_type>* __cv_;
- state_type* __st_;
- bool __always_noconv_;
+ FILE* __file_;
+ const codecvt<char_type, char, state_type>* __cv_;
+ state_type* __st_;
+ bool __always_noconv_;
#if defined(_LIBCPP_WIN32API)
- static constexpr bool __is_win32api_wide_char = !is_same_v<_CharT, char>;
+ static constexpr bool __is_win32api_wide_char = !is_same_v<_CharT, char>;
#else
- static constexpr bool __is_win32api_wide_char = false;
+ static constexpr bool __is_win32api_wide_char = false;
#endif
- __stdoutbuf(const __stdoutbuf&);
- __stdoutbuf& operator=(const __stdoutbuf&);
+ __stdoutbuf(const __stdoutbuf&);
+ __stdoutbuf& operator=(const __stdoutbuf&);
+
+ _LIBCPP_EXPORTED_FROM_ABI friend FILE* __get_ostream_file(ostream&);
};
template <class _CharT>
@@ -313,131 +278,106 @@ __stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
: __file_(__fp),
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
__st_(__st),
- __always_noconv_(__cv_->always_noconv())
-{
- // On Windows, in wchar_t mode, ignore the codecvt from the locale by
- // default and assume noconv; this passes wchar_t through unmodified to
- // fputwc, which handles it correctly depending on the actual mode of the
- // output stream. If the user sets a custom locale with imbue(), that
- // gets honored.
- if constexpr (__is_win32api_wide_char)
- __always_noconv_ = true;
+ __always_noconv_(__cv_->always_noconv()) {
+ // On Windows, in wchar_t mode, ignore the codecvt from the locale by
+ // default and assume noconv; this passes wchar_t through unmodified to
+ // fputwc, which handles it correctly depending on the actual mode of the
+ // output stream. If the user sets a custom locale with imbue(), that
+ // gets honored.
+ if constexpr (__is_win32api_wide_char)
+ __always_noconv_ = true;
}
inline bool __do_fputc(char __c, FILE* __fp) {
- if (fwrite(&__c, sizeof(__c), 1, __fp) != 1)
- return false;
- return true;
+ if (fwrite(&__c, sizeof(__c), 1, __fp) != 1)
+ return false;
+ return true;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline bool __do_fputc(wchar_t __c, FILE* __fp) {
- // fputwc works regardless of wide/narrow mode of stdout, while
- // fwrite of wchar_t only works if the stream actually has been set
- // into wide mode.
- if (fputwc(__c, __fp) == WEOF)
- return false;
- return true;
+ // fputwc works regardless of wide/narrow mode of stdout, while
+ // fwrite of wchar_t only works if the stream actually has been set
+ // into wide mode.
+ if (fputwc(__c, __fp) == WEOF)
+ return false;
+ return true;
}
#endif
template <class _CharT>
-typename __stdoutbuf<_CharT>::int_type
-__stdoutbuf<_CharT>::overflow(int_type __c)
-{
- char __extbuf[__limit];
- char_type __1buf;
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- {
- __1buf = traits_type::to_char_type(__c);
- if (__always_noconv_)
- {
- if (!__do_fputc(__1buf, __file_))
- return traits_type::eof();
- }
- else
- {
- char* __extbe = __extbuf;
- codecvt_base::result __r;
- char_type* pbase = &__1buf;
- char_type* pptr = pbase + 1;
- do
- {
- const char_type* __e;
- __r = __cv_->out(*__st_, pbase, pptr, __e,
- __extbuf,
- __extbuf + sizeof(__extbuf),
- __extbe);
- if (__e == pbase)
- return traits_type::eof();
- if (__r == codecvt_base::noconv)
- {
- if (fwrite(pbase, 1, 1, __file_) != 1)
- return traits_type::eof();
- }
- else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
- {
- size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
- if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
- return traits_type::eof();
- if (__r == codecvt_base::partial)
- {
- pbase = const_cast<char_type*>(__e);
- }
- }
- else
- return traits_type::eof();
- } while (__r == codecvt_base::partial);
- }
+typename __stdoutbuf<_CharT>::int_type __stdoutbuf<_CharT>::overflow(int_type __c) {
+ char __extbuf[__limit];
+ char_type __1buf;
+ if (!traits_type::eq_int_type(__c, traits_type::eof())) {
+ __1buf = traits_type::to_char_type(__c);
+ if (__always_noconv_) {
+ if (!__do_fputc(__1buf, __file_))
+ return traits_type::eof();
+ } else {
+ char* __extbe = __extbuf;
+ codecvt_base::result __r;
+ char_type* pbase = &__1buf;
+ char_type* pptr = pbase + 1;
+ do {
+ const char_type* __e;
+ __r = __cv_->out(*__st_, pbase, pptr, __e, __extbuf, __extbuf + sizeof(__extbuf), __extbe);
+ if (__e == pbase)
+ return traits_type::eof();
+ if (__r == codecvt_base::noconv) {
+ if (fwrite(pbase, 1, 1, __file_) != 1)
+ return traits_type::eof();
+ } else if (__r == codecvt_base::ok || __r == codecvt_base::partial) {
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
+ if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
+ return traits_type::eof();
+ if (__r == codecvt_base::partial) {
+ pbase = const_cast<char_type*>(__e);
+ }
+ } else
+ return traits_type::eof();
+ } while (__r == codecvt_base::partial);
}
- return traits_type::not_eof(__c);
+ }
+ return traits_type::not_eof(__c);
}
template <class _CharT>
-streamsize
-__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
-{
- // For wchar_t on Windows, don't call fwrite(), but write characters one
- // at a time with fputwc(); that works both when stdout is in the default
- // mode and when it is set to Unicode mode.
- if (__always_noconv_ && !__is_win32api_wide_char)
- return fwrite(__s, sizeof(char_type), __n, __file_);
- streamsize __i = 0;
- for (; __i < __n; ++__i, ++__s)
- if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
- break;
- return __i;
+streamsize __stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n) {
+ // For wchar_t on Windows, don't call fwrite(), but write characters one
+ // at a time with fputwc(); that works both when stdout is in the default
+ // mode and when it is set to Unicode mode.
+ if (__always_noconv_ && !__is_win32api_wide_char)
+ return fwrite(__s, sizeof(char_type), __n, __file_);
+ streamsize __i = 0;
+ for (; __i < __n; ++__i, ++__s)
+ if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
+ break;
+ return __i;
}
template <class _CharT>
-int
-__stdoutbuf<_CharT>::sync()
-{
- char __extbuf[__limit];
- codecvt_base::result __r;
- do
- {
- char* __extbe;
- __r = __cv_->unshift(*__st_, __extbuf,
- __extbuf + sizeof(__extbuf),
- __extbe);
- size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
- if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
- return -1;
- } while (__r == codecvt_base::partial);
- if (__r == codecvt_base::error)
- return -1;
- if (fflush(__file_))
- return -1;
- return 0;
+int __stdoutbuf<_CharT>::sync() {
+ char __extbuf[__limit];
+ codecvt_base::result __r;
+ do {
+ char* __extbe;
+ __r = __cv_->unshift(*__st_, __extbuf, __extbuf + sizeof(__extbuf), __extbe);
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
+ if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
+ return -1;
+ } while (__r == codecvt_base::partial);
+ if (__r == codecvt_base::error)
+ return -1;
+ if (fflush(__file_))
+ return -1;
+ return 0;
}
template <class _CharT>
-void
-__stdoutbuf<_CharT>::imbue(const locale& __loc)
-{
- sync();
- __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
- __always_noconv_ = __cv_->always_noconv();
+void __stdoutbuf<_CharT>::imbue(const locale& __loc) {
+ sync();
+ __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
+ __always_noconv_ = __cv_->always_noconv();
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/string.cpp b/contrib/llvm-project/libcxx/src/string.cpp
index 4f3de555e3a9..cf07b3ef1ef2 100644
--- a/contrib/llvm-project/libcxx/src/string.cpp
+++ b/contrib/llvm-project/libcxx/src/string.cpp
@@ -28,281 +28,247 @@ struct __basic_string_common;
// The struct isn't declared anymore in the headers. It's only here for ABI compatibility.
template <>
struct __basic_string_common<true> {
- _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_length_error() const;
- _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_out_of_range() const;
+ _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_length_error() const;
+ _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_out_of_range() const;
};
-void __basic_string_common<true>::__throw_length_error() const {
- std::__throw_length_error("basic_string");
-}
-void __basic_string_common<true>::__throw_out_of_range() const {
- std::__throw_out_of_range("basic_string");
-}
+void __basic_string_common<true>::__throw_length_error() const { std::__throw_length_error("basic_string"); }
+void __basic_string_common<true>::__throw_out_of_range() const { std::__throw_out_of_range("basic_string"); }
#endif // _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
- _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
-# endif
+_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
+# endif
#else
- _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
-# endif
+_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
+# endif
#endif
#undef _LIBCPP_EXTERN_TEMPLATE_DEFINE
-template string operator+<char, char_traits<char>, allocator<char>>(char const*, string const&);
+template string operator+ <char, char_traits<char>, allocator<char>>(char const*, string const&);
-namespace
-{
+namespace {
inline void throw_from_string_out_of_range(const string& func) {
- std::__throw_out_of_range((func + ": out of range").c_str());
+ std::__throw_out_of_range((func + ": out of range").c_str());
}
inline void throw_from_string_invalid_arg(const string& func) {
- std::__throw_invalid_argument((func + ": no conversion").c_str());
+ std::__throw_invalid_argument((func + ": no conversion").c_str());
}
// as_integer
-template<typename V, typename S, typename F>
+template <typename V, typename S, typename F>
inline V as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f) {
- typename S::value_type* ptr = nullptr;
- const typename S::value_type* const p = str.c_str();
- __libcpp_remove_reference_t<decltype(errno)> errno_save = errno;
- errno = 0;
- V r = f(p, &ptr, base);
- swap(errno, errno_save);
- if (errno_save == ERANGE)
- throw_from_string_out_of_range(func);
- if (ptr == p)
- throw_from_string_invalid_arg(func);
- if (idx)
- *idx = static_cast<size_t>(ptr - p);
- return r;
-}
-
-template<typename V, typename S>
+ typename S::value_type* ptr = nullptr;
+ const typename S::value_type* const p = str.c_str();
+ __libcpp_remove_reference_t<decltype(errno)> errno_save = errno;
+ errno = 0;
+ V r = f(p, &ptr, base);
+ swap(errno, errno_save);
+ if (errno_save == ERANGE)
+ throw_from_string_out_of_range(func);
+ if (ptr == p)
+ throw_from_string_invalid_arg(func);
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+template <typename V, typename S>
inline V as_integer(const string& func, const S& s, size_t* idx, int base);
// string
-template<>
+template <>
inline int as_integer(const string& func, const string& s, size_t* idx, int base) {
- // Use long as no Standard string to integer exists.
- long r = as_integer_helper<long>(func, s, idx, base, strtol);
- if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
- throw_from_string_out_of_range(func);
- return static_cast<int>(r);
+ // Use long as no Standard string to integer exists.
+ long r = as_integer_helper<long>(func, s, idx, base, strtol);
+ if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
+ throw_from_string_out_of_range(func);
+ return static_cast<int>(r);
}
-template<>
+template <>
inline long as_integer(const string& func, const string& s, size_t* idx, int base) {
- return as_integer_helper<long>(func, s, idx, base, strtol);
+ return as_integer_helper<long>(func, s, idx, base, strtol);
}
-template<>
+template <>
inline unsigned long as_integer(const string& func, const string& s, size_t* idx, int base) {
- return as_integer_helper<unsigned long>(func, s, idx, base, strtoul);
+ return as_integer_helper<unsigned long>(func, s, idx, base, strtoul);
}
-template<>
+template <>
inline long long as_integer(const string& func, const string& s, size_t* idx, int base) {
- return as_integer_helper<long long>(func, s, idx, base, strtoll);
+ return as_integer_helper<long long>(func, s, idx, base, strtoll);
}
-template<>
+template <>
inline unsigned long long as_integer(const string& func, const string& s, size_t* idx, int base) {
- return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull);
+ return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
// wstring
-template<>
+template <>
inline int as_integer(const string& func, const wstring& s, size_t* idx, int base) {
- // Use long as no Stantard string to integer exists.
- long r = as_integer_helper<long>(func, s, idx, base, wcstol);
- if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
- throw_from_string_out_of_range(func);
- return static_cast<int>(r);
+ // Use long as no Stantard string to integer exists.
+ long r = as_integer_helper<long>(func, s, idx, base, wcstol);
+ if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r)
+ throw_from_string_out_of_range(func);
+ return static_cast<int>(r);
}
-template<>
+template <>
inline long as_integer(const string& func, const wstring& s, size_t* idx, int base) {
- return as_integer_helper<long>(func, s, idx, base, wcstol);
+ return as_integer_helper<long>(func, s, idx, base, wcstol);
}
-template<>
-inline
-unsigned long
-as_integer(const string& func, const wstring& s, size_t* idx, int base)
-{
- return as_integer_helper<unsigned long>(func, s, idx, base, wcstoul);
+template <>
+inline unsigned long as_integer(const string& func, const wstring& s, size_t* idx, int base) {
+ return as_integer_helper<unsigned long>(func, s, idx, base, wcstoul);
}
-template<>
+template <>
inline long long as_integer(const string& func, const wstring& s, size_t* idx, int base) {
- return as_integer_helper<long long>(func, s, idx, base, wcstoll);
+ return as_integer_helper<long long>(func, s, idx, base, wcstoll);
}
-template<>
+template <>
inline unsigned long long as_integer(const string& func, const wstring& s, size_t* idx, int base) {
- return as_integer_helper<unsigned long long>(func, s, idx, base, wcstoull);
+ return as_integer_helper<unsigned long long>(func, s, idx, base, wcstoull);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// as_float
-template<typename V, typename S, typename F>
+template <typename V, typename S, typename F>
inline V as_float_helper(const string& func, const S& str, size_t* idx, F f) {
- typename S::value_type* ptr = nullptr;
- const typename S::value_type* const p = str.c_str();
- __libcpp_remove_reference_t<decltype(errno)> errno_save = errno;
- errno = 0;
- V r = f(p, &ptr);
- swap(errno, errno_save);
- if (errno_save == ERANGE)
- throw_from_string_out_of_range(func);
- if (ptr == p)
- throw_from_string_invalid_arg(func);
- if (idx)
- *idx = static_cast<size_t>(ptr - p);
- return r;
-}
-
-template<typename V, typename S>
+ typename S::value_type* ptr = nullptr;
+ const typename S::value_type* const p = str.c_str();
+ __libcpp_remove_reference_t<decltype(errno)> errno_save = errno;
+ errno = 0;
+ V r = f(p, &ptr);
+ swap(errno, errno_save);
+ if (errno_save == ERANGE)
+ throw_from_string_out_of_range(func);
+ if (ptr == p)
+ throw_from_string_invalid_arg(func);
+ if (idx)
+ *idx = static_cast<size_t>(ptr - p);
+ return r;
+}
+
+template <typename V, typename S>
inline V as_float(const string& func, const S& s, size_t* idx = nullptr);
-template<>
+template <>
inline float as_float(const string& func, const string& s, size_t* idx) {
- return as_float_helper<float>(func, s, idx, strtof);
+ return as_float_helper<float>(func, s, idx, strtof);
}
-template<>
+template <>
inline double as_float(const string& func, const string& s, size_t* idx) {
- return as_float_helper<double>(func, s, idx, strtod);
+ return as_float_helper<double>(func, s, idx, strtod);
}
-template<>
+template <>
inline long double as_float(const string& func, const string& s, size_t* idx) {
- return as_float_helper<long double>(func, s, idx, strtold);
+ return as_float_helper<long double>(func, s, idx, strtold);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template<>
+template <>
inline float as_float(const string& func, const wstring& s, size_t* idx) {
- return as_float_helper<float>(func, s, idx, wcstof);
+ return as_float_helper<float>(func, s, idx, wcstof);
}
-template<>
+template <>
inline double as_float(const string& func, const wstring& s, size_t* idx) {
- return as_float_helper<double>(func, s, idx, wcstod);
+ return as_float_helper<double>(func, s, idx, wcstod);
}
-template<>
+template <>
inline long double as_float(const string& func, const wstring& s, size_t* idx) {
- return as_float_helper<long double>(func, s, idx, wcstold);
+ return as_float_helper<long double>(func, s, idx, wcstold);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-} // unnamed namespace
+} // unnamed namespace
-int stoi(const string& str, size_t* idx, int base) {
- return as_integer<int>("stoi", str, idx, base);
-}
+int stoi(const string& str, size_t* idx, int base) { return as_integer<int>("stoi", str, idx, base); }
-long stol(const string& str, size_t* idx, int base) {
- return as_integer<long>("stol", str, idx, base);
-}
+long stol(const string& str, size_t* idx, int base) { return as_integer<long>("stol", str, idx, base); }
unsigned long stoul(const string& str, size_t* idx, int base) {
- return as_integer<unsigned long>("stoul", str, idx, base);
+ return as_integer<unsigned long>("stoul", str, idx, base);
}
-long long stoll(const string& str, size_t* idx, int base) {
- return as_integer<long long>("stoll", str, idx, base);
-}
+long long stoll(const string& str, size_t* idx, int base) { return as_integer<long long>("stoll", str, idx, base); }
unsigned long long stoull(const string& str, size_t* idx, int base) {
- return as_integer<unsigned long long>("stoull", str, idx, base);
+ return as_integer<unsigned long long>("stoull", str, idx, base);
}
-float stof(const string& str, size_t* idx) {
- return as_float<float>("stof", str, idx);
-}
+float stof(const string& str, size_t* idx) { return as_float<float>("stof", str, idx); }
-double stod(const string& str, size_t* idx) {
- return as_float<double>("stod", str, idx);
-}
+double stod(const string& str, size_t* idx) { return as_float<double>("stod", str, idx); }
-long double stold(const string& str, size_t* idx) {
- return as_float<long double>("stold", str, idx);
-}
+long double stold(const string& str, size_t* idx) { return as_float<long double>("stold", str, idx); }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-int stoi(const wstring& str, size_t* idx, int base) {
- return as_integer<int>("stoi", str, idx, base);
-}
+int stoi(const wstring& str, size_t* idx, int base) { return as_integer<int>("stoi", str, idx, base); }
-long stol(const wstring& str, size_t* idx, int base) {
- return as_integer<long>("stol", str, idx, base);
-}
+long stol(const wstring& str, size_t* idx, int base) { return as_integer<long>("stol", str, idx, base); }
unsigned long stoul(const wstring& str, size_t* idx, int base) {
- return as_integer<unsigned long>("stoul", str, idx, base);
+ return as_integer<unsigned long>("stoul", str, idx, base);
}
-long long stoll(const wstring& str, size_t* idx, int base) {
- return as_integer<long long>("stoll", str, idx, base);
-}
+long long stoll(const wstring& str, size_t* idx, int base) { return as_integer<long long>("stoll", str, idx, base); }
unsigned long long stoull(const wstring& str, size_t* idx, int base) {
- return as_integer<unsigned long long>("stoull", str, idx, base);
+ return as_integer<unsigned long long>("stoull", str, idx, base);
}
-float stof(const wstring& str, size_t* idx) {
- return as_float<float>("stof", str, idx);
-}
+float stof(const wstring& str, size_t* idx) { return as_float<float>("stof", str, idx); }
-double stod(const wstring& str, size_t* idx) {
- return as_float<double>("stod", str, idx);
-}
+double stod(const wstring& str, size_t* idx) { return as_float<double>("stod", str, idx); }
-long double stold(const wstring& str, size_t* idx) {
- return as_float<long double>("stold", str, idx);
-}
+long double stold(const wstring& str, size_t* idx) { return as_float<long double>("stold", str, idx); }
#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS
// to_string
-namespace
-{
+namespace {
// as_string
-template<typename S, typename P, typename V >
+template <typename S, typename P, typename V >
inline S as_string(P sprintf_like, S s, const typename S::value_type* fmt, V a) {
- typedef typename S::size_type size_type;
- size_type available = s.size();
- while (true) {
- int status = sprintf_like(&s[0], available + 1, fmt, a);
- if (status >= 0) {
- size_type used = static_cast<size_type>(status);
- if (used <= available) {
- s.resize(used);
- break;
- }
- available = used; // Assume this is advice of how much space we need.
- }
- else
- available = available * 2 + 1;
- s.resize(available);
- }
- return s;
+ typedef typename S::size_type size_type;
+ size_type available = s.size();
+ while (true) {
+ int status = sprintf_like(&s[0], available + 1, fmt, a);
+ if (status >= 0) {
+ size_type used = static_cast<size_type>(status);
+ if (used <= available) {
+ s.resize(used);
+ break;
+ }
+ available = used; // Assume this is advice of how much space we need.
+ } else
+ available = available * 2 + 1;
+ s.resize(available);
+ }
+ return s;
}
template <class S>
@@ -310,71 +276,71 @@ struct initial_string;
template <>
struct initial_string<string> {
- string operator()() const {
- string s;
- s.resize(s.capacity());
- return s;
- }
+ string operator()() const {
+ string s;
+ s.resize(s.capacity());
+ return s;
+ }
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
struct initial_string<wstring> {
- wstring operator()() const {
- wstring s(20, wchar_t());
- s.resize(s.capacity());
- return s;
- }
+ wstring operator()() const {
+ wstring s(20, wchar_t());
+ s.resize(s.capacity());
+ return s;
+ }
};
-typedef int (*wide_printf)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...);
+typedef int (*wide_printf)(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...);
inline wide_printf get_swprintf() {
-#ifndef _LIBCPP_MSVCRT
- return swprintf;
-#else
- return static_cast<int (__cdecl*)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...)>(_snwprintf);
-#endif
+# ifndef _LIBCPP_MSVCRT
+ return swprintf;
+# else
+ return static_cast<int(__cdecl*)(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...)>(_snwprintf);
+# endif
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <typename S, typename V>
S i_to_string(V v) {
-// numeric_limits::digits10 returns value less on 1 than desired for unsigned numbers.
-// For example, for 1-byte unsigned value digits10 is 2 (999 can not be represented),
-// so we need +1 here.
- constexpr size_t bufsize = numeric_limits<V>::digits10 + 2; // +1 for minus, +1 for digits10
- char buf[bufsize];
- const auto res = to_chars(buf, buf + bufsize, v);
- _LIBCPP_ASSERT_INTERNAL(res.ec == errc(), "bufsize must be large enough to accomodate the value");
- return S(buf, res.ptr);
+ // numeric_limits::digits10 returns value less on 1 than desired for unsigned numbers.
+ // For example, for 1-byte unsigned value digits10 is 2 (999 can not be represented),
+ // so we need +1 here.
+ constexpr size_t bufsize = numeric_limits<V>::digits10 + 2; // +1 for minus, +1 for digits10
+ char buf[bufsize];
+ const auto res = to_chars(buf, buf + bufsize, v);
+ _LIBCPP_ASSERT_INTERNAL(res.ec == errc(), "bufsize must be large enough to accomodate the value");
+ return S(buf, res.ptr);
}
-} // unnamed namespace
+} // unnamed namespace
-string to_string (int val) { return i_to_string< string>(val); }
-string to_string (long val) { return i_to_string< string>(val); }
-string to_string (long long val) { return i_to_string< string>(val); }
-string to_string (unsigned val) { return i_to_string< string>(val); }
-string to_string (unsigned long val) { return i_to_string< string>(val); }
-string to_string (unsigned long long val) { return i_to_string< string>(val); }
+string to_string(int val) { return i_to_string< string>(val); }
+string to_string(long val) { return i_to_string< string>(val); }
+string to_string(long long val) { return i_to_string< string>(val); }
+string to_string(unsigned val) { return i_to_string< string>(val); }
+string to_string(unsigned long val) { return i_to_string< string>(val); }
+string to_string(unsigned long long val) { return i_to_string< string>(val); }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-wstring to_wstring(int val) { return i_to_string<wstring>(val); }
-wstring to_wstring(long val) { return i_to_string<wstring>(val); }
-wstring to_wstring(long long val) { return i_to_string<wstring>(val); }
-wstring to_wstring(unsigned val) { return i_to_string<wstring>(val); }
-wstring to_wstring(unsigned long val) { return i_to_string<wstring>(val); }
+wstring to_wstring(int val) { return i_to_string<wstring>(val); }
+wstring to_wstring(long val) { return i_to_string<wstring>(val); }
+wstring to_wstring(long long val) { return i_to_string<wstring>(val); }
+wstring to_wstring(unsigned val) { return i_to_string<wstring>(val); }
+wstring to_wstring(unsigned long val) { return i_to_string<wstring>(val); }
wstring to_wstring(unsigned long long val) { return i_to_string<wstring>(val); }
#endif
-string to_string (float val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
-string to_string (double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
-string to_string (long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); }
+string to_string(float val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
+string to_string(double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
+string to_string(long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
-wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
+wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
+wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); }
#endif
diff --git a/contrib/llvm-project/libcxx/src/support/ibm/mbsnrtowcs.cpp b/contrib/llvm-project/libcxx/src/support/ibm/mbsnrtowcs.cpp
index 6edc3c254dea..122dc5ed892f 100644
--- a/contrib/llvm-project/libcxx/src/support/ibm/mbsnrtowcs.cpp
+++ b/contrib/llvm-project/libcxx/src/support/ibm/mbsnrtowcs.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#include <cstddef> // size_t
-#include <cwchar> // mbstate_t
+#include <cstddef> // size_t
+#include <cwchar> // mbstate_t
#include <limits.h> // MB_LEN_MAX
#include <string.h> // wmemcpy
@@ -18,12 +18,14 @@
// Returns (size_t) -1 when an invalid sequence is encountered.
// Leaves *`src` pointing to the next character to convert or NULL
// if a null character was converted from *`src`.
-_LIBCPP_EXPORTED_FROM_ABI
-size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
- size_t src_size_bytes, size_t max_dest_chars,
- mbstate_t *__restrict ps) {
+_LIBCPP_EXPORTED_FROM_ABI size_t mbsnrtowcs(
+ wchar_t* __restrict dst,
+ const char** __restrict src,
+ size_t src_size_bytes,
+ size_t max_dest_chars,
+ mbstate_t* __restrict ps) {
const size_t terminated_sequence = static_cast<size_t>(0);
- const size_t invalid_sequence = static_cast<size_t>(-1);
+ const size_t invalid_sequence = static_cast<size_t>(-1);
const size_t incomplete_sequence = static_cast<size_t>(-2);
size_t source_converted;
@@ -43,7 +45,7 @@ size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
// If result (char_size) is zero, it indicates that the null character has been found.
// Otherwise, it's an error and errno may be set.
size_t source_remaining = src_size_bytes - source_converted;
- size_t dest_remaining = max_dest_chars - dest_converted;
+ size_t dest_remaining = max_dest_chars - dest_converted;
if (dst == nullptr) {
result = mbrtowc(NULL, *src + source_converted, source_remaining, ps);
@@ -52,12 +54,12 @@ size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
result = mbrtowc(dst + dest_converted, *src + source_converted, source_remaining, ps);
} else {
/*
- * dst may not have enough space, so use a temporary buffer.
- *
- * We need to save a copy of the conversion state
- * here so we can restore it if the multibyte
- * character is too long for the buffer.
- */
+ * dst may not have enough space, so use a temporary buffer.
+ *
+ * We need to save a copy of the conversion state
+ * here so we can restore it if the multibyte
+ * character is too long for the buffer.
+ */
wchar_t buff[MB_LEN_MAX];
mbstate_t mbstate_tmp;
diff --git a/contrib/llvm-project/libcxx/src/support/ibm/wcsnrtombs.cpp b/contrib/llvm-project/libcxx/src/support/ibm/wcsnrtombs.cpp
index d6333fe5f1fa..f0372152339f 100644
--- a/contrib/llvm-project/libcxx/src/support/ibm/wcsnrtombs.cpp
+++ b/contrib/llvm-project/libcxx/src/support/ibm/wcsnrtombs.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include <cwchar> // mbstate_t
+#include <cwchar> // mbstate_t
#include <limits.h> // MB_LEN_MAX
#include <stdlib.h> // MB_CUR_MAX, size_t
#include <string.h> // memcpy
@@ -17,11 +17,12 @@
// converted from *src, excluding the null terminator.
// Returns (size_t) -1 if an error occurs and sets errno.
// If `dst` is NULL, `dst_size_bytes` is ignored and no bytes are copied to `dst`.
-_LIBCPP_EXPORTED_FROM_ABI
-size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
- size_t max_source_chars, size_t dst_size_bytes,
- mbstate_t *__restrict ps) {
-
+_LIBCPP_EXPORTED_FROM_ABI size_t wcsnrtombs(
+ char* __restrict dst,
+ const wchar_t** __restrict src,
+ size_t max_source_chars,
+ size_t dst_size_bytes,
+ mbstate_t* __restrict ps) {
const size_t invalid_wchar = static_cast<size_t>(-1);
size_t source_converted;
@@ -36,7 +37,7 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
for (dest_converted = source_converted = 0;
source_converted < max_source_chars && (!dst || dest_converted < dst_size_bytes);
++source_converted, dest_converted += result) {
- wchar_t c = (*src)[source_converted];
+ wchar_t c = (*src)[source_converted];
size_t dest_remaining = dst_size_bytes - dest_converted;
if (dst == nullptr) {
@@ -46,12 +47,12 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
result = wcrtomb(dst + dest_converted, c, ps);
} else {
/*
- * dst may not have enough space, so use a temporary buffer.
- *
- * We need to save a copy of the conversion state
- * here so we can restore it if the multibyte
- * character is too long for the buffer.
- */
+ * dst may not have enough space, so use a temporary buffer.
+ *
+ * We need to save a copy of the conversion state
+ * here so we can restore it if the multibyte
+ * character is too long for the buffer.
+ */
char buff[MB_LEN_MAX];
mbstate_t mbstate_tmp;
diff --git a/contrib/llvm-project/libcxx/src/support/ibm/xlocale_zos.cpp b/contrib/llvm-project/libcxx/src/support/ibm/xlocale_zos.cpp
index 034a5b966052..9a90e08e11cf 100644
--- a/contrib/llvm-project/libcxx/src/support/ibm/xlocale_zos.cpp
+++ b/contrib/llvm-project/libcxx/src/support/ibm/xlocale_zos.cpp
@@ -39,7 +39,7 @@ locale_t newlocale(int category_mask, const char* locale, locale_t base) {
if (base) {
if (category_mask != LC_ALL_MASK) {
// Copy base when it will not be overwritten.
- memcpy(newloc, base, sizeof (locale_struct));
+ memcpy(newloc, base, sizeof(locale_struct));
newloc->category_mask = category_mask | base->category_mask;
}
delete base;
@@ -65,9 +65,7 @@ locale_t newlocale(int category_mask, const char* locale, locale_t base) {
return (locale_t)newloc;
}
-void freelocale(locale_t locobj) {
- delete locobj;
-}
+void freelocale(locale_t locobj) { delete locobj; }
locale_t uselocale(locale_t newloc) {
// Maintain current locale name(s).
@@ -76,18 +74,12 @@ locale_t uselocale(locale_t newloc) {
if (newloc) {
// Set locales and check for errors.
bool is_error =
- (newloc->category_mask & LC_COLLATE_MASK &&
- setlocale(LC_COLLATE, newloc->lc_collate.c_str()) == NULL) ||
- (newloc->category_mask & LC_CTYPE_MASK &&
- setlocale(LC_CTYPE, newloc->lc_ctype.c_str()) == NULL) ||
- (newloc->category_mask & LC_MONETARY_MASK &&
- setlocale(LC_MONETARY, newloc->lc_monetary.c_str()) == NULL) ||
- (newloc->category_mask & LC_NUMERIC_MASK &&
- setlocale(LC_NUMERIC, newloc->lc_numeric.c_str()) == NULL) ||
- (newloc->category_mask & LC_TIME_MASK &&
- setlocale(LC_TIME, newloc->lc_time.c_str()) == NULL) ||
- (newloc->category_mask & LC_MESSAGES_MASK &&
- setlocale(LC_MESSAGES, newloc->lc_messages.c_str()) == NULL);
+ (newloc->category_mask & LC_COLLATE_MASK && setlocale(LC_COLLATE, newloc->lc_collate.c_str()) == NULL) ||
+ (newloc->category_mask & LC_CTYPE_MASK && setlocale(LC_CTYPE, newloc->lc_ctype.c_str()) == NULL) ||
+ (newloc->category_mask & LC_MONETARY_MASK && setlocale(LC_MONETARY, newloc->lc_monetary.c_str()) == NULL) ||
+ (newloc->category_mask & LC_NUMERIC_MASK && setlocale(LC_NUMERIC, newloc->lc_numeric.c_str()) == NULL) ||
+ (newloc->category_mask & LC_TIME_MASK && setlocale(LC_TIME, newloc->lc_time.c_str()) == NULL) ||
+ (newloc->category_mask & LC_MESSAGES_MASK && setlocale(LC_MESSAGES, newloc->lc_messages.c_str()) == NULL);
if (is_error) {
setlocale(LC_ALL, current_loc_name.c_str());
@@ -108,24 +100,24 @@ locale_t uselocale(locale_t newloc) {
std::string s;
while (std::getline(ss, s, delimiter)) {
- tokenized.push_back(s);
+ tokenized.push_back(s);
}
- _LIBCPP_ASSERT_UNCATEGORIZED(tokenized.size() >= _NCAT, "locale-name list is too short");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(tokenized.size() >= _NCAT, "locale-name list is too short");
- previous_loc->lc_collate = tokenized[LC_COLLATE];
- previous_loc->lc_ctype = tokenized[LC_CTYPE];
+ previous_loc->lc_collate = tokenized[LC_COLLATE];
+ previous_loc->lc_ctype = tokenized[LC_CTYPE];
previous_loc->lc_monetary = tokenized[LC_MONETARY];
- previous_loc->lc_numeric = tokenized[LC_NUMERIC];
- previous_loc->lc_time = tokenized[LC_TIME];
+ previous_loc->lc_numeric = tokenized[LC_NUMERIC];
+ previous_loc->lc_time = tokenized[LC_TIME];
// Skip LC_TOD.
previous_loc->lc_messages = tokenized[LC_MESSAGES];
} else {
- previous_loc->lc_collate = current_loc_name;
- previous_loc->lc_ctype = current_loc_name;
+ previous_loc->lc_collate = current_loc_name;
+ previous_loc->lc_ctype = current_loc_name;
previous_loc->lc_monetary = current_loc_name;
- previous_loc->lc_numeric = current_loc_name;
- previous_loc->lc_time = current_loc_name;
+ previous_loc->lc_numeric = current_loc_name;
+ previous_loc->lc_time = current_loc_name;
previous_loc->lc_messages = current_loc_name;
}
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_fallback.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_fallback.ipp
index 3b2716d36f0e..18ff4b83d876 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_fallback.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_fallback.ipp
@@ -11,148 +11,83 @@
namespace std {
-static constinit std::terminate_handler __terminate_handler = nullptr;
+static constinit std::terminate_handler __terminate_handler = nullptr;
static constinit std::unexpected_handler __unexpected_handler = nullptr;
// libcxxrt provides implementations of these functions itself.
-unexpected_handler
-set_unexpected(unexpected_handler func) noexcept
-{
+unexpected_handler set_unexpected(unexpected_handler func) noexcept {
return __libcpp_atomic_exchange(&__unexpected_handler, func);
}
-unexpected_handler
-get_unexpected() noexcept
-{
- return __libcpp_atomic_load(&__unexpected_handler);
-}
+unexpected_handler get_unexpected() noexcept { return __libcpp_atomic_load(&__unexpected_handler); }
-_LIBCPP_NORETURN
-void unexpected()
-{
- (*get_unexpected())();
- // unexpected handler should not return
- terminate();
+_LIBCPP_NORETURN void unexpected() {
+ (*get_unexpected())();
+ // unexpected handler should not return
+ terminate();
}
-terminate_handler
-set_terminate(terminate_handler func) noexcept
-{
+terminate_handler set_terminate(terminate_handler func) noexcept {
return __libcpp_atomic_exchange(&__terminate_handler, func);
}
-terminate_handler
-get_terminate() noexcept
-{
- return __libcpp_atomic_load(&__terminate_handler);
-}
+terminate_handler get_terminate() noexcept { return __libcpp_atomic_load(&__terminate_handler); }
-_LIBCPP_NORETURN
-void
-terminate() noexcept
-{
+_LIBCPP_NORETURN void terminate() noexcept {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- (*get_terminate())();
- // handler should not return
- fprintf(stderr, "terminate_handler unexpectedly returned\n");
- ::abort();
+ (*get_terminate())();
+ // handler should not return
+ fprintf(stderr, "terminate_handler unexpectedly returned\n");
+ ::abort();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- // handler should not throw exception
- fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
- ::abort();
- }
+ } catch (...) {
+ // handler should not throw exception
+ fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
+ ::abort();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
-int uncaught_exceptions() noexcept
-{
+int uncaught_exceptions() noexcept {
#warning uncaught_exception not yet implemented
fprintf(stderr, "uncaught_exceptions not yet implemented\n");
::abort();
}
+exception::~exception() noexcept {}
-exception::~exception() noexcept
-{
-}
-
-const char* exception::what() const noexcept
-{
- return "std::exception";
-}
-
-bad_exception::~bad_exception() noexcept
-{
-}
+const char* exception::what() const noexcept { return "std::exception"; }
-const char* bad_exception::what() const noexcept
-{
- return "std::bad_exception";
-}
+bad_exception::~bad_exception() noexcept {}
+const char* bad_exception::what() const noexcept { return "std::bad_exception"; }
-bad_alloc::bad_alloc() noexcept
-{
-}
+bad_alloc::bad_alloc() noexcept {}
-bad_alloc::~bad_alloc() noexcept
-{
-}
+bad_alloc::~bad_alloc() noexcept {}
-const char*
-bad_alloc::what() const noexcept
-{
- return "std::bad_alloc";
-}
+const char* bad_alloc::what() const noexcept { return "std::bad_alloc"; }
-bad_array_new_length::bad_array_new_length() noexcept
-{
-}
+bad_array_new_length::bad_array_new_length() noexcept {}
-bad_array_new_length::~bad_array_new_length() noexcept
-{
-}
+bad_array_new_length::~bad_array_new_length() noexcept {}
-const char*
-bad_array_new_length::what() const noexcept
-{
- return "bad_array_new_length";
-}
+const char* bad_array_new_length::what() const noexcept { return "bad_array_new_length"; }
-bad_cast::bad_cast() noexcept
-{
-}
+bad_cast::bad_cast() noexcept {}
-bad_typeid::bad_typeid() noexcept
-{
-}
+bad_typeid::bad_typeid() noexcept {}
-bad_cast::~bad_cast() noexcept
-{
-}
+bad_cast::~bad_cast() noexcept {}
-const char*
-bad_cast::what() const noexcept
-{
- return "std::bad_cast";
-}
+const char* bad_cast::what() const noexcept { return "std::bad_cast"; }
-bad_typeid::~bad_typeid() noexcept
-{
-}
+bad_typeid::~bad_typeid() noexcept {}
-const char*
-bad_typeid::what() const noexcept
-{
- return "std::bad_typeid";
-}
+const char* bad_typeid::what() const noexcept { return "std::bad_typeid"; }
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_glibcxx.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_glibcxx.ipp
index e478ccbb6e31..aa67cab6bc23 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_glibcxx.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_glibcxx.ipp
@@ -8,25 +8,17 @@
//===----------------------------------------------------------------------===//
#ifndef __GLIBCXX__
-#error header can only be used when targeting libstdc++ or libsupc++
+# error header can only be used when targeting libstdc++ or libsupc++
#endif
namespace std {
-bad_alloc::bad_alloc() noexcept
-{
-}
+bad_alloc::bad_alloc() noexcept {}
-bad_array_new_length::bad_array_new_length() noexcept
-{
-}
+bad_array_new_length::bad_array_new_length() noexcept {}
-bad_cast::bad_cast() noexcept
-{
-}
+bad_cast::bad_cast() noexcept {}
-bad_typeid::bad_typeid() noexcept
-{
-}
+bad_typeid::bad_typeid() noexcept {}
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxabi.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxabi.ipp
index ee15e437e602..df6bd6574bde 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxabi.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxabi.ipp
@@ -8,20 +8,19 @@
//===----------------------------------------------------------------------===//
#ifndef _LIBCPPABI_VERSION
-#error this header can only be used with libc++abi
+# error this header can only be used with libc++abi
#endif
namespace std {
bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
-int uncaught_exceptions() noexcept
-{
-# if _LIBCPPABI_VERSION > 1001
- return __cxa_uncaught_exceptions();
-# else
- return __cxa_uncaught_exception() ? 1 : 0;
-# endif
+int uncaught_exceptions() noexcept {
+#if _LIBCPPABI_VERSION > 1001
+ return __cxa_uncaught_exceptions();
+#else
+ return __cxa_uncaught_exception() ? 1 : 0;
+#endif
}
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxrt.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxrt.ipp
index 62aa3229ed36..f17fecc71e34 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxrt.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_libcxxrt.ipp
@@ -8,18 +8,13 @@
//===----------------------------------------------------------------------===//
#ifndef LIBCXXRT
-#error this header may only be used when targeting libcxxrt
+# error this header may only be used when targeting libcxxrt
#endif
namespace std {
-bad_exception::~bad_exception() noexcept
-{
-}
+bad_exception::~bad_exception() noexcept {}
-const char* bad_exception::what() const noexcept
-{
- return "std::bad_exception";
-}
+const char* bad_exception::what() const noexcept { return "std::bad_exception"; }
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_msvc.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_msvc.ipp
index 0114d5adee16..323cd9d18005 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_msvc.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_msvc.ipp
@@ -8,21 +8,19 @@
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_ABI_MICROSOFT
-#error this header can only be used when targeting the MSVC ABI
+# error this header can only be used when targeting the MSVC ABI
#endif
#include <stdio.h>
#include <stdlib.h>
extern "C" {
-typedef void (__cdecl* terminate_handler)();
-_LIBCPP_CRT_FUNC terminate_handler __cdecl set_terminate(
- terminate_handler _NewTerminateHandler) throw();
+typedef void(__cdecl* terminate_handler)();
+_LIBCPP_CRT_FUNC terminate_handler __cdecl set_terminate(terminate_handler _NewTerminateHandler) throw();
_LIBCPP_CRT_FUNC terminate_handler __cdecl _get_terminate();
-typedef void (__cdecl* unexpected_handler)();
-unexpected_handler __cdecl set_unexpected(
- unexpected_handler _NewUnexpectedHandler) throw();
+typedef void(__cdecl* unexpected_handler)();
+unexpected_handler __cdecl set_unexpected(unexpected_handler _NewUnexpectedHandler) throw();
unexpected_handler __cdecl _get_unexpected();
int __cdecl __uncaught_exceptions();
@@ -30,134 +28,73 @@ int __cdecl __uncaught_exceptions();
namespace std {
-unexpected_handler
-set_unexpected(unexpected_handler func) noexcept {
- return ::set_unexpected(func);
-}
+unexpected_handler set_unexpected(unexpected_handler func) noexcept { return ::set_unexpected(func); }
-unexpected_handler get_unexpected() noexcept {
- return ::_get_unexpected();
-}
+unexpected_handler get_unexpected() noexcept { return ::_get_unexpected(); }
-_LIBCPP_NORETURN
-void unexpected() {
- (*get_unexpected())();
- // unexpected handler should not return
- terminate();
+_LIBCPP_NORETURN void unexpected() {
+ (*get_unexpected())();
+ // unexpected handler should not return
+ terminate();
}
-terminate_handler set_terminate(terminate_handler func) noexcept {
- return ::set_terminate(func);
-}
+terminate_handler set_terminate(terminate_handler func) noexcept { return ::set_terminate(func); }
-terminate_handler get_terminate() noexcept {
- return ::_get_terminate();
-}
+terminate_handler get_terminate() noexcept { return ::_get_terminate(); }
-_LIBCPP_NORETURN
-void terminate() noexcept
-{
+_LIBCPP_NORETURN void terminate() noexcept {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try
- {
+ try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
- (*get_terminate())();
- // handler should not return
- fprintf(stderr, "terminate_handler unexpectedly returned\n");
- ::abort();
+ (*get_terminate())();
+ // handler should not return
+ fprintf(stderr, "terminate_handler unexpectedly returned\n");
+ ::abort();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- }
- catch (...)
- {
- // handler should not throw exception
- fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
- ::abort();
- }
+ } catch (...) {
+ // handler should not throw exception
+ fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
+ ::abort();
+ }
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
-int uncaught_exceptions() noexcept {
- return __uncaught_exceptions();
-}
+int uncaught_exceptions() noexcept { return __uncaught_exceptions(); }
#if !defined(_LIBCPP_ABI_VCRUNTIME)
-bad_cast::bad_cast() noexcept
-{
-}
+bad_cast::bad_cast() noexcept {}
-bad_cast::~bad_cast() noexcept
-{
-}
+bad_cast::~bad_cast() noexcept {}
-const char *
-bad_cast::what() const noexcept
-{
- return "std::bad_cast";
-}
+const char* bad_cast::what() const noexcept { return "std::bad_cast"; }
-bad_typeid::bad_typeid() noexcept
-{
-}
+bad_typeid::bad_typeid() noexcept {}
-bad_typeid::~bad_typeid() noexcept
-{
-}
+bad_typeid::~bad_typeid() noexcept {}
-const char *
-bad_typeid::what() const noexcept
-{
- return "std::bad_typeid";
-}
+const char* bad_typeid::what() const noexcept { return "std::bad_typeid"; }
-exception::~exception() noexcept
-{
-}
+exception::~exception() noexcept {}
-const char* exception::what() const noexcept
-{
- return "std::exception";
-}
+const char* exception::what() const noexcept { return "std::exception"; }
+bad_exception::~bad_exception() noexcept {}
-bad_exception::~bad_exception() noexcept
-{
-}
+const char* bad_exception::what() const noexcept { return "std::bad_exception"; }
-const char* bad_exception::what() const noexcept
-{
- return "std::bad_exception";
-}
+bad_alloc::bad_alloc() noexcept {}
+bad_alloc::~bad_alloc() noexcept {}
-bad_alloc::bad_alloc() noexcept
-{
-}
+const char* bad_alloc::what() const noexcept { return "std::bad_alloc"; }
-bad_alloc::~bad_alloc() noexcept
-{
-}
+bad_array_new_length::bad_array_new_length() noexcept {}
-const char*
-bad_alloc::what() const noexcept
-{
- return "std::bad_alloc";
-}
+bad_array_new_length::~bad_array_new_length() noexcept {}
-bad_array_new_length::bad_array_new_length() noexcept
-{
-}
-
-bad_array_new_length::~bad_array_new_length() noexcept
-{
-}
-
-const char*
-bad_array_new_length::what() const noexcept
-{
- return "bad_array_new_length";
-}
+const char* bad_array_new_length::what() const noexcept { return "bad_array_new_length"; }
#endif // !_LIBCPP_ABI_VCRUNTIME
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
index 33aa94502b73..c07de5838b14 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
@@ -8,66 +8,49 @@
//===----------------------------------------------------------------------===//
#ifndef HAVE_DEPENDENT_EH_ABI
-#error this header may only be used with libc++abi or libcxxrt
+# error this header may only be used with libc++abi or libcxxrt
#endif
namespace std {
-exception_ptr::~exception_ptr() noexcept {
- __cxa_decrement_exception_refcount(__ptr_);
-}
+exception_ptr::~exception_ptr() noexcept { __cxa_decrement_exception_refcount(__ptr_); }
-exception_ptr::exception_ptr(const exception_ptr& other) noexcept
- : __ptr_(other.__ptr_)
-{
- __cxa_increment_exception_refcount(__ptr_);
+exception_ptr::exception_ptr(const exception_ptr& other) noexcept : __ptr_(other.__ptr_) {
+ __cxa_increment_exception_refcount(__ptr_);
}
-exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept
-{
- if (__ptr_ != other.__ptr_)
- {
- __cxa_increment_exception_refcount(other.__ptr_);
- __cxa_decrement_exception_refcount(__ptr_);
- __ptr_ = other.__ptr_;
- }
- return *this;
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
+ if (__ptr_ != other.__ptr_) {
+ __cxa_increment_exception_refcount(other.__ptr_);
+ __cxa_decrement_exception_refcount(__ptr_);
+ __ptr_ = other.__ptr_;
+ }
+ return *this;
}
-nested_exception::nested_exception() noexcept
- : __ptr_(current_exception())
-{
-}
+nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
-nested_exception::~nested_exception() noexcept
-{
-}
+nested_exception::~nested_exception() noexcept {}
-_LIBCPP_NORETURN
-void
-nested_exception::rethrow_nested() const
-{
- if (__ptr_ == nullptr)
- terminate();
- rethrow_exception(__ptr_);
+_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
+ if (__ptr_ == nullptr)
+ terminate();
+ rethrow_exception(__ptr_);
}
-exception_ptr current_exception() noexcept
-{
- // be nicer if there was a constructor that took a ptr, then
- // this whole function would be just:
- // return exception_ptr(__cxa_current_primary_exception());
- exception_ptr ptr;
- ptr.__ptr_ = __cxa_current_primary_exception();
- return ptr;
+exception_ptr current_exception() noexcept {
+ // be nicer if there was a constructor that took a ptr, then
+ // this whole function would be just:
+ // return exception_ptr(__cxa_current_primary_exception());
+ exception_ptr ptr;
+ ptr.__ptr_ = __cxa_current_primary_exception();
+ return ptr;
}
-_LIBCPP_NORETURN
-void rethrow_exception(exception_ptr p)
-{
- __cxa_rethrow_primary_exception(p.__ptr_);
- // if p.__ptr_ is NULL, above returns so we terminate
- terminate();
+_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) {
+ __cxa_rethrow_primary_exception(p.__ptr_);
+ // if p.__ptr_ is NULL, above returns so we terminate
+ terminate();
}
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
index 983a08808dcc..8e0e63cd4d49 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
@@ -18,60 +18,43 @@
namespace std {
-namespace __exception_ptr
-{
+namespace __exception_ptr {
-struct exception_ptr
-{
- void* __ptr_;
+struct exception_ptr {
+ void* __ptr_;
- exception_ptr(const exception_ptr&) noexcept;
- exception_ptr& operator=(const exception_ptr&) noexcept;
- ~exception_ptr() noexcept;
+ exception_ptr(const exception_ptr&) noexcept;
+ exception_ptr& operator=(const exception_ptr&) noexcept;
+ ~exception_ptr() noexcept;
};
-}
+} // namespace __exception_ptr
_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
-exception_ptr::~exception_ptr() noexcept
-{
- reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
-}
-
-exception_ptr::exception_ptr(const exception_ptr& other) noexcept
- : __ptr_(other.__ptr_)
-{
- new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
- reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
-}
+exception_ptr::~exception_ptr() noexcept { reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr(); }
-exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept
-{
- *reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
- reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
- return *this;
+exception_ptr::exception_ptr(const exception_ptr& other) noexcept : __ptr_(other.__ptr_) {
+ new (reinterpret_cast<void*>(this))
+ __exception_ptr::exception_ptr(reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
}
-nested_exception::nested_exception() noexcept
- : __ptr_(current_exception())
-{
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
+ *reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
+ reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
+ return *this;
}
+nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
-_LIBCPP_NORETURN
-void
-nested_exception::rethrow_nested() const
-{
- if (__ptr_ == nullptr)
- terminate();
- rethrow_exception(__ptr_);
+_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
+ if (__ptr_ == nullptr)
+ terminate();
+ rethrow_exception(__ptr_);
}
-_LIBCPP_NORETURN
-void rethrow_exception(exception_ptr p)
-{
- rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
+_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) {
+ rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
}
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_msvc.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_msvc.ipp
index 9e7f392e764d..b87742b32ded 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_msvc.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_msvc.ipp
@@ -19,17 +19,14 @@ _LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrToBool(const void*);
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrSwap(void*, void*);
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCurrentException(void*);
[[noreturn]] _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrRethrow(const void*);
-_LIBCPP_CRT_FUNC void __cdecl
-__ExceptionPtrCopyException(void*, const void*, const void*);
+_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCopyException(void*, const void*, const void*);
namespace std {
exception_ptr::exception_ptr() noexcept { __ExceptionPtrCreate(this); }
exception_ptr::exception_ptr(nullptr_t) noexcept { __ExceptionPtrCreate(this); }
-exception_ptr::exception_ptr(const exception_ptr& __other) noexcept {
- __ExceptionPtrCopy(this, &__other);
-}
+exception_ptr::exception_ptr(const exception_ptr& __other) noexcept { __ExceptionPtrCopy(this, &__other); }
exception_ptr& exception_ptr::operator=(const exception_ptr& __other) noexcept {
__ExceptionPtrAssign(this, &__other);
return *this;
@@ -43,18 +40,13 @@ exception_ptr& exception_ptr::operator=(nullptr_t) noexcept {
exception_ptr::~exception_ptr() noexcept { __ExceptionPtrDestroy(this); }
-exception_ptr::operator bool() const noexcept {
- return __ExceptionPtrToBool(this);
-}
+exception_ptr::operator bool() const noexcept { return __ExceptionPtrToBool(this); }
bool operator==(const exception_ptr& __x, const exception_ptr& __y) noexcept {
return __ExceptionPtrCompare(&__x, &__y);
}
-
-void swap(exception_ptr& lhs, exception_ptr& rhs) noexcept {
- __ExceptionPtrSwap(&rhs, &lhs);
-}
+void swap(exception_ptr& lhs, exception_ptr& rhs) noexcept { __ExceptionPtrSwap(&rhs, &lhs); }
exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) {
exception_ptr __ret = nullptr;
@@ -69,15 +61,13 @@ exception_ptr current_exception() noexcept {
return __ret;
}
-_LIBCPP_NORETURN
-void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); }
+_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); }
nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
nested_exception::~nested_exception() noexcept {}
-_LIBCPP_NORETURN
-void nested_exception::rethrow_nested() const {
+_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
index 9e8ec04e1196..de0605d7774b 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
@@ -12,46 +12,34 @@
namespace std {
-exception_ptr::~exception_ptr() noexcept
-{
-# warning exception_ptr not yet implemented
+exception_ptr::~exception_ptr() noexcept {
+#warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
-exception_ptr::exception_ptr(const exception_ptr& other) noexcept
- : __ptr_(other.__ptr_)
-{
-# warning exception_ptr not yet implemented
+exception_ptr::exception_ptr(const exception_ptr& other) noexcept : __ptr_(other.__ptr_) {
+#warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
-exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept
-{
-# warning exception_ptr not yet implemented
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
+#warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
-nested_exception::nested_exception() noexcept
- : __ptr_(current_exception())
-{
-}
+nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
#if !defined(__GLIBCXX__)
-nested_exception::~nested_exception() noexcept
-{
-}
+nested_exception::~nested_exception() noexcept {}
#endif
-_LIBCPP_NORETURN
-void
-nested_exception::rethrow_nested() const
-{
-# warning exception_ptr not yet implemented
+_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
+#warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
#if 0
@@ -61,17 +49,14 @@ nested_exception::rethrow_nested() const
#endif // FIXME
}
-exception_ptr current_exception() noexcept
-{
-# warning exception_ptr not yet implemented
+exception_ptr current_exception() noexcept {
+#warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
-_LIBCPP_NORETURN
-void rethrow_exception(exception_ptr p)
-{
-# warning exception_ptr not yet implemented
+_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) {
+#warning exception_ptr not yet implemented
fprintf(stderr, "exception_ptr not yet implemented\n");
::abort();
}
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp b/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp
index 99d30453562f..1f47a0325d76 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp
@@ -9,9 +9,8 @@
#include "../../include/refstring.h"
/* For _LIBCPPABI_VERSION */
-#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
- (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT))
-#include <cxxabi.h>
+#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && (defined(LIBCXX_BUILDING_LIBCXXABI) || defined(LIBCXXRT))
+# include <cxxabi.h>
#endif
static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char*), "");
@@ -34,8 +33,7 @@ runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str()) {}
runtime_error::runtime_error(const char* msg) : __imp_(msg) {}
-runtime_error::runtime_error(const runtime_error& re) noexcept
- : __imp_(re.__imp_) {}
+runtime_error::runtime_error(const runtime_error& re) noexcept : __imp_(re.__imp_) {}
runtime_error& runtime_error::operator=(const runtime_error& re) noexcept {
__imp_ = re.__imp_;
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_vcruntime.ipp b/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_vcruntime.ipp
index db9097d097ca..e6ecbf782f2a 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_vcruntime.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/stdexcept_vcruntime.ipp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_ABI_VCRUNTIME
-#error This file may only be used when deferring to vcruntime
+# error This file may only be used when deferring to vcruntime
#endif
namespace std {
diff --git a/contrib/llvm-project/libcxx/src/system_error.cpp b/contrib/llvm-project/libcxx/src/system_error.cpp
index 1cc6b7d7e1e6..034b73c5480a 100644
--- a/contrib/llvm-project/libcxx/src/system_error.cpp
+++ b/contrib/llvm-project/libcxx/src/system_error.cpp
@@ -13,14 +13,14 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include <string>
#include <string.h>
+#include <string>
#include <system_error>
#include "include/config_elast.h"
#if defined(__ANDROID__)
-#include <android/api-level.h>
+# include <android/api-level.h>
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -33,7 +33,7 @@ constexpr size_t strerror_buff_size = 1024;
string do_strerror_r(int ev);
-#if defined(_LIBCPP_MSVCRT_LIKE)
+# if defined(_LIBCPP_MSVCRT_LIKE)
string do_strerror_r(int ev) {
char buffer[strerror_buff_size];
if (::strerror_s(buffer, strerror_buff_size, ev) == 0)
@@ -41,14 +41,13 @@ string do_strerror_r(int ev) {
std::snprintf(buffer, strerror_buff_size, "unknown error %d", ev);
return string(buffer);
}
-#else
+# else
// Only one of the two following functions will be used, depending on
// the return type of strerror_r:
// For the GNU variant, a char* return value:
-__attribute__((unused)) const char *
-handle_strerror_r_return(char *strerror_return, char *buffer) {
+__attribute__((unused)) const char* handle_strerror_r_return(char* strerror_return, char* buffer) {
// GNU always returns a string pointer in its return value. The
// string might point to either the input buffer, or a static
// buffer, but we don't care which.
@@ -56,8 +55,7 @@ handle_strerror_r_return(char *strerror_return, char *buffer) {
}
// For the POSIX variant: an int return value.
-__attribute__((unused)) const char *
-handle_strerror_r_return(int strerror_return, char *buffer) {
+__attribute__((unused)) const char* handle_strerror_r_return(int strerror_return, char* buffer) {
// The POSIX variant either:
// - fills in the provided buffer and returns 0
// - returns a positive error value, or
@@ -79,201 +77,146 @@ handle_strerror_r_return(int strerror_return, char *buffer) {
// This function handles both GNU and POSIX variants, dispatching to
// one of the two above functions.
string do_strerror_r(int ev) {
- char buffer[strerror_buff_size];
- // Preserve errno around the call. (The C++ standard requires that
- // system_error functions not modify errno).
- const int old_errno = errno;
- const char *error_message = handle_strerror_r_return(
- ::strerror_r(ev, buffer, strerror_buff_size), buffer);
- // If we didn't get any message, print one now.
- if (!error_message[0]) {
- std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev);
- error_message = buffer;
- }
- errno = old_errno;
- return string(error_message);
-}
-#endif
+ char buffer[strerror_buff_size];
+ // Preserve errno around the call. (The C++ standard requires that
+ // system_error functions not modify errno).
+ const int old_errno = errno;
+ const char* error_message = handle_strerror_r_return(::strerror_r(ev, buffer, strerror_buff_size), buffer);
+ // If we didn't get any message, print one now.
+ if (!error_message[0]) {
+ std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev);
+ error_message = buffer;
+ }
+ errno = old_errno;
+ return string(error_message);
+}
+# endif
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
string make_error_str(const error_code& ec, string what_arg) {
- if (ec) {
- if (!what_arg.empty()) {
- what_arg += ": ";
- }
- what_arg += ec.message();
+ if (ec) {
+ if (!what_arg.empty()) {
+ what_arg += ": ";
}
- return what_arg;
+ what_arg += ec.message();
+ }
+ return what_arg;
}
string make_error_str(const error_code& ec) {
- if (ec) {
- return ec.message();
- }
- return string();
+ if (ec) {
+ return ec.message();
+ }
+ return string();
}
} // end namespace
-string
-__do_message::message(int ev) const
-{
+string __do_message::message(int ev) const {
#if defined(_LIBCPP_HAS_NO_THREADS)
- return string(::strerror(ev));
+ return string(::strerror(ev));
#else
- return do_strerror_r(ev);
+ return do_strerror_r(ev);
#endif
}
-class _LIBCPP_HIDDEN __generic_error_category
- : public __do_message
-{
+class _LIBCPP_HIDDEN __generic_error_category : public __do_message {
public:
- virtual const char* name() const noexcept;
- virtual string message(int ev) const;
+ virtual const char* name() const noexcept;
+ virtual string message(int ev) const;
};
-const char*
-__generic_error_category::name() const noexcept
-{
- return "generic";
-}
+const char* __generic_error_category::name() const noexcept { return "generic"; }
-string
-__generic_error_category::message(int ev) const
-{
+string __generic_error_category::message(int ev) const {
#ifdef _LIBCPP_ELAST
- if (ev > _LIBCPP_ELAST)
- return string("unspecified generic_category error");
+ if (ev > _LIBCPP_ELAST)
+ return string("unspecified generic_category error");
#endif // _LIBCPP_ELAST
- return __do_message::message(ev);
+ return __do_message::message(ev);
}
-const error_category&
-generic_category() noexcept
-{
- union AvoidDestroyingGenericCategory {
- __generic_error_category generic_error_category;
- constexpr explicit AvoidDestroyingGenericCategory() : generic_error_category() {}
- ~AvoidDestroyingGenericCategory() {}
- };
- constinit static AvoidDestroyingGenericCategory helper;
- return helper.generic_error_category;
+const error_category& generic_category() noexcept {
+ union AvoidDestroyingGenericCategory {
+ __generic_error_category generic_error_category;
+ constexpr explicit AvoidDestroyingGenericCategory() : generic_error_category() {}
+ ~AvoidDestroyingGenericCategory() {}
+ };
+ constinit static AvoidDestroyingGenericCategory helper;
+ return helper.generic_error_category;
}
-class _LIBCPP_HIDDEN __system_error_category
- : public __do_message
-{
+class _LIBCPP_HIDDEN __system_error_category : public __do_message {
public:
- virtual const char* name() const noexcept;
- virtual string message(int ev) const;
- virtual error_condition default_error_condition(int ev) const noexcept;
+ virtual const char* name() const noexcept;
+ virtual string message(int ev) const;
+ virtual error_condition default_error_condition(int ev) const noexcept;
};
-const char*
-__system_error_category::name() const noexcept
-{
- return "system";
-}
+const char* __system_error_category::name() const noexcept { return "system"; }
-string
-__system_error_category::message(int ev) const
-{
+string __system_error_category::message(int ev) const {
#ifdef _LIBCPP_ELAST
- if (ev > _LIBCPP_ELAST)
- return string("unspecified system_category error");
+ if (ev > _LIBCPP_ELAST)
+ return string("unspecified system_category error");
#endif // _LIBCPP_ELAST
- return __do_message::message(ev);
+ return __do_message::message(ev);
}
-error_condition
-__system_error_category::default_error_condition(int ev) const noexcept
-{
+error_condition __system_error_category::default_error_condition(int ev) const noexcept {
#ifdef _LIBCPP_ELAST
- if (ev > _LIBCPP_ELAST)
- return error_condition(ev, system_category());
+ if (ev > _LIBCPP_ELAST)
+ return error_condition(ev, system_category());
#endif // _LIBCPP_ELAST
- return error_condition(ev, generic_category());
+ return error_condition(ev, generic_category());
}
-const error_category&
-system_category() noexcept
-{
- union AvoidDestroyingSystemCategory {
- __system_error_category system_error_category;
- constexpr explicit AvoidDestroyingSystemCategory() : system_error_category() {}
- ~AvoidDestroyingSystemCategory() {}
- };
- constinit static AvoidDestroyingSystemCategory helper;
- return helper.system_error_category;
+const error_category& system_category() noexcept {
+ union AvoidDestroyingSystemCategory {
+ __system_error_category system_error_category;
+ constexpr explicit AvoidDestroyingSystemCategory() : system_error_category() {}
+ ~AvoidDestroyingSystemCategory() {}
+ };
+ constinit static AvoidDestroyingSystemCategory helper;
+ return helper.system_error_category;
}
// error_condition
-string
-error_condition::message() const
-{
- return __cat_->message(__val_);
-}
+string error_condition::message() const { return __cat_->message(__val_); }
// error_code
-string
-error_code::message() const
-{
- return __cat_->message(__val_);
-}
+string error_code::message() const { return __cat_->message(__val_); }
// system_error
system_error::system_error(error_code ec, const string& what_arg)
- : runtime_error(make_error_str(ec, what_arg)),
- __ec_(ec)
-{
-}
+ : runtime_error(make_error_str(ec, what_arg)), __ec_(ec) {}
system_error::system_error(error_code ec, const char* what_arg)
- : runtime_error(make_error_str(ec, what_arg)),
- __ec_(ec)
-{
-}
+ : runtime_error(make_error_str(ec, what_arg)), __ec_(ec) {}
-system_error::system_error(error_code ec)
- : runtime_error(make_error_str(ec)),
- __ec_(ec)
-{
-}
+system_error::system_error(error_code ec) : runtime_error(make_error_str(ec)), __ec_(ec) {}
system_error::system_error(int ev, const error_category& ecat, const string& what_arg)
- : runtime_error(make_error_str(error_code(ev, ecat), what_arg)),
- __ec_(error_code(ev, ecat))
-{
-}
+ : runtime_error(make_error_str(error_code(ev, ecat), what_arg)), __ec_(error_code(ev, ecat)) {}
system_error::system_error(int ev, const error_category& ecat, const char* what_arg)
- : runtime_error(make_error_str(error_code(ev, ecat), what_arg)),
- __ec_(error_code(ev, ecat))
-{
-}
+ : runtime_error(make_error_str(error_code(ev, ecat), what_arg)), __ec_(error_code(ev, ecat)) {}
system_error::system_error(int ev, const error_category& ecat)
- : runtime_error(make_error_str(error_code(ev, ecat))),
- __ec_(error_code(ev, ecat))
-{
-}
+ : runtime_error(make_error_str(error_code(ev, ecat))), __ec_(error_code(ev, ecat)) {}
-system_error::~system_error() noexcept
-{
-}
+system_error::~system_error() noexcept {}
-void
-__throw_system_error(int ev, const char* what_arg)
-{
+void __throw_system_error(int ev, const char* what_arg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- std::__throw_system_error(error_code(ev, system_category()), what_arg);
+ std::__throw_system_error(error_code(ev, system_category()), what_arg);
#else
- // The above could also handle the no-exception case, but for size, avoid referencing system_category() unnecessarily.
- _LIBCPP_VERBOSE_ABORT("system_error was thrown in -fno-exceptions mode with error %i and message \"%s\"", ev, what_arg);
+ // The above could also handle the no-exception case, but for size, avoid referencing system_category() unnecessarily.
+ _LIBCPP_VERBOSE_ABORT(
+ "system_error was thrown in -fno-exceptions mode with error %i and message \"%s\"", ev, what_arg);
#endif
}
diff --git a/contrib/llvm-project/libcxx/src/thread.cpp b/contrib/llvm-project/libcxx/src/thread.cpp
index 289c457cd5a5..73f22f12d8cc 100644
--- a/contrib/llvm-project/libcxx/src/thread.cpp
+++ b/contrib/llvm-project/libcxx/src/thread.cpp
@@ -15,104 +15,89 @@
#include <vector>
#if __has_include(<unistd.h>)
-# include <unistd.h> // for sysconf
+# include <unistd.h> // for sysconf
#endif
#if defined(__NetBSD__)
-#pragma weak pthread_create // Do not create libpthread dependency
+# pragma weak pthread_create // Do not create libpthread dependency
#endif
#if defined(_LIBCPP_WIN32API)
-#include <windows.h>
+# include <windows.h>
#endif
#if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
-#pragma comment(lib, "pthread")
+# pragma comment(lib, "pthread")
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-thread::~thread()
-{
- if (!__libcpp_thread_isnull(&__t_))
- terminate();
+thread::~thread() {
+ if (!__libcpp_thread_isnull(&__t_))
+ terminate();
}
-void
-thread::join()
-{
- int ec = EINVAL;
- if (!__libcpp_thread_isnull(&__t_))
- {
- ec = __libcpp_thread_join(&__t_);
- if (ec == 0)
- __t_ = _LIBCPP_NULL_THREAD;
- }
-
- if (ec)
- __throw_system_error(ec, "thread::join failed");
+void thread::join() {
+ int ec = EINVAL;
+ if (!__libcpp_thread_isnull(&__t_)) {
+ ec = __libcpp_thread_join(&__t_);
+ if (ec == 0)
+ __t_ = _LIBCPP_NULL_THREAD;
+ }
+
+ if (ec)
+ __throw_system_error(ec, "thread::join failed");
}
-void
-thread::detach()
-{
- int ec = EINVAL;
- if (!__libcpp_thread_isnull(&__t_))
- {
- ec = __libcpp_thread_detach(&__t_);
- if (ec == 0)
- __t_ = _LIBCPP_NULL_THREAD;
- }
-
- if (ec)
- __throw_system_error(ec, "thread::detach failed");
+void thread::detach() {
+ int ec = EINVAL;
+ if (!__libcpp_thread_isnull(&__t_)) {
+ ec = __libcpp_thread_detach(&__t_);
+ if (ec == 0)
+ __t_ = _LIBCPP_NULL_THREAD;
+ }
+
+ if (ec)
+ __throw_system_error(ec, "thread::detach failed");
}
-unsigned
-thread::hardware_concurrency() noexcept
-{
+unsigned thread::hardware_concurrency() noexcept {
#if defined(_SC_NPROCESSORS_ONLN)
- long result = sysconf(_SC_NPROCESSORS_ONLN);
- // sysconf returns -1 if the name is invalid, the option does not exist or
- // does not have a definite limit.
- // if sysconf returns some other negative number, we have no idea
- // what is going on. Default to something safe.
- if (result < 0)
- return 0;
- return static_cast<unsigned>(result);
+ long result = sysconf(_SC_NPROCESSORS_ONLN);
+ // sysconf returns -1 if the name is invalid, the option does not exist or
+ // does not have a definite limit.
+ // if sysconf returns some other negative number, we have no idea
+ // what is going on. Default to something safe.
+ if (result < 0)
+ return 0;
+ return static_cast<unsigned>(result);
#elif defined(_LIBCPP_WIN32API)
- SYSTEM_INFO info;
- GetSystemInfo(&info);
- return info.dwNumberOfProcessors;
-#else // defined(CTL_HW) && defined(HW_NCPU)
- // TODO: grovel through /proc or check cpuid on x86 and similar
- // instructions on other architectures.
-# if defined(_LIBCPP_WARNING)
- _LIBCPP_WARNING("hardware_concurrency not yet implemented")
-# else
-# warning hardware_concurrency not yet implemented
-# endif
- return 0; // Means not computable [thread.thread.static]
+ SYSTEM_INFO info;
+ GetSystemInfo(&info);
+ return info.dwNumberOfProcessors;
+#else // defined(CTL_HW) && defined(HW_NCPU)
+ // TODO: grovel through /proc or check cpuid on x86 and similar
+ // instructions on other architectures.
+# if defined(_LIBCPP_WARNING)
+ _LIBCPP_WARNING("hardware_concurrency not yet implemented")
+# else
+# warning hardware_concurrency not yet implemented
+# endif
+ return 0; // Means not computable [thread.thread.static]
#endif // defined(CTL_HW) && defined(HW_NCPU)
}
-namespace this_thread
-{
+namespace this_thread {
-void
-sleep_for(const chrono::nanoseconds& ns)
-{
- if (ns > chrono::nanoseconds::zero())
- {
- __libcpp_thread_sleep_for(ns);
- }
+void sleep_for(const chrono::nanoseconds& ns) {
+ if (ns > chrono::nanoseconds::zero()) {
+ __libcpp_thread_sleep_for(ns);
+ }
}
-} // this_thread
+} // namespace this_thread
-__thread_specific_ptr<__thread_struct>&
-__thread_local_data()
-{
+__thread_specific_ptr<__thread_struct>& __thread_local_data() {
// Even though __thread_specific_ptr's destructor doesn't actually destroy
// anything (see comments there), we can't call it at all because threads may
// outlive the static variable and calling its destructor means accessing an
@@ -125,89 +110,64 @@ __thread_local_data()
// __thread_struct_imp
template <class T>
-class _LIBCPP_HIDDEN __hidden_allocator
-{
+class _LIBCPP_HIDDEN __hidden_allocator {
public:
- typedef T value_type;
+ typedef T value_type;
- T* allocate(size_t __n)
- {return static_cast<T*>(::operator new(__n * sizeof(T)));}
- void deallocate(T* __p, size_t) {::operator delete(static_cast<void*>(__p));}
+ T* allocate(size_t __n) { return static_cast<T*>(::operator new(__n * sizeof(T))); }
+ void deallocate(T* __p, size_t) { ::operator delete(static_cast<void*>(__p)); }
- size_t max_size() const {return size_t(~0) / sizeof(T);}
+ size_t max_size() const { return size_t(~0) / sizeof(T); }
};
-class _LIBCPP_HIDDEN __thread_struct_imp
-{
- typedef vector<__assoc_sub_state*,
- __hidden_allocator<__assoc_sub_state*> > _AsyncStates;
- typedef vector<pair<condition_variable*, mutex*>,
- __hidden_allocator<pair<condition_variable*, mutex*> > > _Notify;
+class _LIBCPP_HIDDEN __thread_struct_imp {
+ typedef vector<__assoc_sub_state*, __hidden_allocator<__assoc_sub_state*> > _AsyncStates;
+ typedef vector<pair<condition_variable*, mutex*>, __hidden_allocator<pair<condition_variable*, mutex*> > > _Notify;
+
+ _AsyncStates async_states_;
+ _Notify notify_;
- _AsyncStates async_states_;
- _Notify notify_;
+ __thread_struct_imp(const __thread_struct_imp&);
+ __thread_struct_imp& operator=(const __thread_struct_imp&);
- __thread_struct_imp(const __thread_struct_imp&);
- __thread_struct_imp& operator=(const __thread_struct_imp&);
public:
- __thread_struct_imp() {}
- ~__thread_struct_imp();
+ __thread_struct_imp() {}
+ ~__thread_struct_imp();
- void notify_all_at_thread_exit(condition_variable* cv, mutex* m);
- void __make_ready_at_thread_exit(__assoc_sub_state* __s);
+ void notify_all_at_thread_exit(condition_variable* cv, mutex* m);
+ void __make_ready_at_thread_exit(__assoc_sub_state* __s);
};
-__thread_struct_imp::~__thread_struct_imp()
-{
- for (_Notify::iterator i = notify_.begin(), e = notify_.end();
- i != e; ++i)
- {
- i->first->notify_all();
- i->second->unlock();
- }
- for (_AsyncStates::iterator i = async_states_.begin(), e = async_states_.end();
- i != e; ++i)
- {
- (*i)->__make_ready();
- (*i)->__release_shared();
- }
+__thread_struct_imp::~__thread_struct_imp() {
+ for (_Notify::iterator i = notify_.begin(), e = notify_.end(); i != e; ++i) {
+ i->first->notify_all();
+ i->second->unlock();
+ }
+ for (_AsyncStates::iterator i = async_states_.begin(), e = async_states_.end(); i != e; ++i) {
+ (*i)->__make_ready();
+ (*i)->__release_shared();
+ }
}
-void
-__thread_struct_imp::notify_all_at_thread_exit(condition_variable* cv, mutex* m)
-{
- notify_.push_back(pair<condition_variable*, mutex*>(cv, m));
+void __thread_struct_imp::notify_all_at_thread_exit(condition_variable* cv, mutex* m) {
+ notify_.push_back(pair<condition_variable*, mutex*>(cv, m));
}
-void
-__thread_struct_imp::__make_ready_at_thread_exit(__assoc_sub_state* __s)
-{
- async_states_.push_back(__s);
- __s->__add_shared();
+void __thread_struct_imp::__make_ready_at_thread_exit(__assoc_sub_state* __s) {
+ async_states_.push_back(__s);
+ __s->__add_shared();
}
// __thread_struct
-__thread_struct::__thread_struct()
- : __p_(new __thread_struct_imp)
-{
-}
+__thread_struct::__thread_struct() : __p_(new __thread_struct_imp) {}
-__thread_struct::~__thread_struct()
-{
- delete __p_;
-}
+__thread_struct::~__thread_struct() { delete __p_; }
-void
-__thread_struct::notify_all_at_thread_exit(condition_variable* cv, mutex* m)
-{
- __p_->notify_all_at_thread_exit(cv, m);
+void __thread_struct::notify_all_at_thread_exit(condition_variable* cv, mutex* m) {
+ __p_->notify_all_at_thread_exit(cv, m);
}
-void
-__thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s)
-{
- __p_->__make_ready_at_thread_exit(__s);
-}
+void __thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s) { __p_->__make_ready_at_thread_exit(__s); }
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/typeinfo.cpp b/contrib/llvm-project/libcxx/src/typeinfo.cpp
index c7f0a70f85c5..e5f59da31cff 100644
--- a/contrib/llvm-project/libcxx/src/typeinfo.cpp
+++ b/contrib/llvm-project/libcxx/src/typeinfo.cpp
@@ -10,27 +10,27 @@
#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_ABI_VCRUNTIME)
-#include <string.h>
+# include <string.h>
-int std::type_info::__compare(const type_info &__rhs) const noexcept {
+int std::type_info::__compare(const type_info& __rhs) const noexcept {
if (&__data == &__rhs.__data)
return 0;
return strcmp(&__data.__decorated_name[1], &__rhs.__data.__decorated_name[1]);
}
-const char *std::type_info::name() const noexcept {
+const char* std::type_info::name() const noexcept {
// TODO(compnerd) cache demangled &__data.__decorated_name[1]
return &__data.__decorated_name[1];
}
size_t std::type_info::hash_code() const noexcept {
-#if defined(_WIN64)
+# if defined(_WIN64)
constexpr size_t fnv_offset_basis = 14695981039346656037ull;
- constexpr size_t fnv_prime = 10995116282110ull;
-#else
+ constexpr size_t fnv_prime = 10995116282110ull;
+# else
constexpr size_t fnv_offset_basis = 2166136261ull;
- constexpr size_t fnv_prime = 16777619ull;
-#endif
+ constexpr size_t fnv_prime = 16777619ull;
+# endif
size_t value = fnv_offset_basis;
for (const char* c = &__data.__decorated_name[1]; *c; ++c) {
@@ -38,21 +38,17 @@ size_t std::type_info::hash_code() const noexcept {
value *= fnv_prime;
}
-#if defined(_WIN64)
+# if defined(_WIN64)
value ^= value >> 32;
-#endif
+# endif
return value;
}
#endif // _LIBCPP_ABI_MICROSOFT
// FIXME: Remove the _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY configuration.
-#if (!defined(LIBCXX_BUILDING_LIBCXXABI) && \
- !defined(LIBCXXRT) && \
- !defined(__GLIBCXX__) && \
- !defined(_LIBCPP_ABI_VCRUNTIME)) || \
+#if (!defined(LIBCXX_BUILDING_LIBCXXABI) && !defined(LIBCXXRT) && !defined(__GLIBCXX__) && \
+ !defined(_LIBCPP_ABI_VCRUNTIME)) || \
defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
-std::type_info::~type_info()
-{
-}
+std::type_info::~type_info() {}
#endif
diff --git a/contrib/llvm-project/libcxx/src/valarray.cpp b/contrib/llvm-project/libcxx/src/valarray.cpp
index f377e0f4e871..6ef1f1cafc0e 100644
--- a/contrib/llvm-project/libcxx/src/valarray.cpp
+++ b/contrib/llvm-project/libcxx/src/valarray.cpp
@@ -18,40 +18,32 @@ template _LIBCPP_EXPORTED_FROM_ABI valarray<size_t>::~valarray();
template void valarray<size_t>::resize(size_t, size_t);
-void
-gslice::__init(size_t __start)
-{
- valarray<size_t> __indices(__size_.size());
- size_t __k = __size_.size() != 0;
- for (size_t __i = 0; __i < __size_.size(); ++__i)
- __k *= __size_[__i];
- __1d_.resize(__k);
- if (__1d_.size())
- {
- __k = 0;
- __1d_[__k] = __start;
- while (true)
- {
- size_t __i = __indices.size() - 1;
- while (true)
- {
- if (++__indices[__i] < __size_[__i])
- {
- ++__k;
- __1d_[__k] = __1d_[__k-1] + __stride_[__i];
- for (size_t __j = __i + 1; __j != __indices.size(); ++__j)
- __1d_[__k] -= __stride_[__j] * (__size_[__j] - 1);
- break;
- }
- else
- {
- if (__i == 0)
- return;
- __indices[__i--] = 0;
- }
- }
+void gslice::__init(size_t __start) {
+ valarray<size_t> __indices(__size_.size());
+ size_t __k = __size_.size() != 0;
+ for (size_t __i = 0; __i < __size_.size(); ++__i)
+ __k *= __size_[__i];
+ __1d_.resize(__k);
+ if (__1d_.size()) {
+ __k = 0;
+ __1d_[__k] = __start;
+ while (true) {
+ size_t __i = __indices.size() - 1;
+ while (true) {
+ if (++__indices[__i] < __size_[__i]) {
+ ++__k;
+ __1d_[__k] = __1d_[__k - 1] + __stride_[__i];
+ for (size_t __j = __i + 1; __j != __indices.size(); ++__j)
+ __1d_[__k] -= __stride_[__j] * (__size_[__j] - 1);
+ break;
+ } else {
+ if (__i == 0)
+ return;
+ __indices[__i--] = 0;
}
+ }
}
+ }
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/src/variant.cpp b/contrib/llvm-project/libcxx/src/variant.cpp
index b6ec448081a9..b5462d64fe95 100644
--- a/contrib/llvm-project/libcxx/src/variant.cpp
+++ b/contrib/llvm-project/libcxx/src/variant.cpp
@@ -10,8 +10,6 @@
namespace std {
-const char* bad_variant_access::what() const noexcept {
- return "bad_variant_access";
-}
+const char* bad_variant_access::what() const noexcept { return "bad_variant_access"; }
-} // namespace std
+} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/vector.cpp b/contrib/llvm-project/libcxx/src/vector.cpp
index b09db92cf862..b6153b0e9bf9 100644
--- a/contrib/llvm-project/libcxx/src/vector.cpp
+++ b/contrib/llvm-project/libcxx/src/vector.cpp
@@ -21,13 +21,9 @@ struct __vector_base_common<true> {
_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_out_of_range() const;
};
-void __vector_base_common<true>::__throw_length_error() const {
- std::__throw_length_error("vector");
-}
+void __vector_base_common<true>::__throw_length_error() const { std::__throw_length_error("vector"); }
-void __vector_base_common<true>::__throw_out_of_range() const {
- std::__throw_out_of_range("vector");
-}
+void __vector_base_common<true>::__throw_out_of_range() const { std::__throw_out_of_range("vector"); }
#endif // _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON
diff --git a/contrib/llvm-project/libcxx/src/verbose_abort.cpp b/contrib/llvm-project/libcxx/src/verbose_abort.cpp
index a9fba5e3c007..719134e2ae55 100644
--- a/contrib/llvm-project/libcxx/src/verbose_abort.cpp
+++ b/contrib/llvm-project/libcxx/src/verbose_abort.cpp
@@ -28,8 +28,7 @@ extern "C" void android_set_abort_message(const char* msg);
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_WEAK
-void __libcpp_verbose_abort(char const* format, ...) {
+_LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) {
// Write message to stderr. We do this before formatting into a
// buffer so that we still get some information out if that fails.
{
@@ -41,7 +40,8 @@ void __libcpp_verbose_abort(char const* format, ...) {
// Format the arguments into an allocated buffer for CrashReport & friends.
// We leak the buffer on purpose, since we're about to abort() anyway.
- char* buffer; (void)buffer;
+ char* buffer;
+ (void)buffer;
va_list list;
va_start(list, format);
diff --git a/contrib/llvm-project/lld/ELF/Arch/LoongArch.cpp b/contrib/llvm-project/lld/ELF/Arch/LoongArch.cpp
index 1c3e015efc16..996f9957a63c 100644
--- a/contrib/llvm-project/lld/ELF/Arch/LoongArch.cpp
+++ b/contrib/llvm-project/lld/ELF/Arch/LoongArch.cpp
@@ -463,6 +463,7 @@ RelExpr LoongArch::getRelExpr(const RelType type, const Symbol &s,
case R_LARCH_B16:
case R_LARCH_B21:
case R_LARCH_B26:
+ case R_LARCH_CALL36:
return R_PLT_PC;
case R_LARCH_GOT_PC_HI20:
case R_LARCH_GOT64_PC_LO20:
@@ -590,6 +591,25 @@ void LoongArch::relocate(uint8_t *loc, const Relocation &rel,
write32le(loc, setD10k16(read32le(loc), val >> 2));
return;
+ case R_LARCH_CALL36: {
+ // This relocation is designed for adjancent pcaddu18i+jirl pairs that
+ // are patched in one time. Because of sign extension of these insns'
+ // immediate fields, the relocation range is [-128G - 0x20000, +128G -
+ // 0x20000) (of course must be 4-byte aligned).
+ if (((int64_t)val + 0x20000) != llvm::SignExtend64(val + 0x20000, 38))
+ reportRangeError(loc, rel, Twine(val), llvm::minIntN(38) - 0x20000,
+ llvm::maxIntN(38) - 0x20000);
+ checkAlignment(loc, val, 4, rel);
+ // Since jirl performs sign extension on the offset immediate, adds (1<<17)
+ // to original val to get the correct hi20.
+ uint32_t hi20 = extractBits(val + (1 << 17), 37, 18);
+ // Despite the name, the lower part is actually 18 bits with 4-byte aligned.
+ uint32_t lo16 = extractBits(val, 17, 2);
+ write32le(loc, setJ20(read32le(loc), hi20));
+ write32le(loc + 4, setK16(read32le(loc + 4), lo16));
+ return;
+ }
+
// Relocs intended for `addi`, `ld` or `st`.
case R_LARCH_PCALA_LO12:
// We have to again inspect the insn word to handle the R_LARCH_PCALA_LO12
diff --git a/contrib/llvm-project/lld/ELF/InputSection.cpp b/contrib/llvm-project/lld/ELF/InputSection.cpp
index 81468a20dfb5..5dfb57fda432 100644
--- a/contrib/llvm-project/lld/ELF/InputSection.cpp
+++ b/contrib/llvm-project/lld/ELF/InputSection.cpp
@@ -898,10 +898,16 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) {
const TargetInfo &target = *elf::target;
const auto emachine = config->emachine;
const bool isDebug = isDebugSection(*this);
- const bool isDebugLocOrRanges =
- isDebug && (name == ".debug_loc" || name == ".debug_ranges");
const bool isDebugLine = isDebug && name == ".debug_line";
std::optional<uint64_t> tombstone;
+ if (isDebug) {
+ if (name == ".debug_loc" || name == ".debug_ranges")
+ tombstone = 1;
+ else if (name == ".debug_names")
+ tombstone = UINT64_MAX; // tombstone value
+ else
+ tombstone = 0;
+ }
for (const auto &patAndValue : llvm::reverse(config->deadRelocInNonAlloc))
if (patAndValue.first.match(this->name)) {
tombstone = patAndValue.second;
@@ -946,8 +952,7 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) {
return;
}
- if (tombstone ||
- (isDebug && (type == target.symbolicRel || expr == R_DTPREL))) {
+ if (tombstone && (expr == R_ABS || expr == R_DTPREL)) {
// Resolve relocations in .debug_* referencing (discarded symbols or ICF
// folded section symbols) to a tombstone value. Resolving to addend is
// unsatisfactory because the result address range may collide with a
@@ -978,8 +983,13 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) {
// value. Enable -1 in a future release.
if (!sym.getOutputSection() || (ds && ds->folded && !isDebugLine)) {
// If -z dead-reloc-in-nonalloc= is specified, respect it.
- const uint64_t value = tombstone ? SignExtend64<bits>(*tombstone)
- : (isDebugLocOrRanges ? 1 : 0);
+ uint64_t value = SignExtend64<bits>(*tombstone);
+ // For a 32-bit local TU reference in .debug_names, X86_64::relocate
+ // requires that the unsigned value for R_X86_64_32 is truncated to
+ // 32-bit. Other 64-bit targets's don't discern signed/unsigned 32-bit
+ // absolute relocations and do not need this change.
+ if (emachine == EM_X86_64 && type == R_X86_64_32)
+ value = static_cast<uint32_t>(value);
target.relocateNoSym(bufLoc, type, value);
continue;
}
diff --git a/contrib/llvm-project/lld/MachO/InputFiles.h b/contrib/llvm-project/lld/MachO/InputFiles.h
index 2e37e7ba5a00..5e550c167c23 100644
--- a/contrib/llvm-project/lld/MachO/InputFiles.h
+++ b/contrib/llvm-project/lld/MachO/InputFiles.h
@@ -140,7 +140,7 @@ protected:
InputFile(Kind, const llvm::MachO::InterfaceFile &);
- // If true, this input's arch is compatiable with target.
+ // If true, this input's arch is compatible with target.
bool compatArch = true;
private:
diff --git a/contrib/llvm-project/lld/MachO/Options.td b/contrib/llvm-project/lld/MachO/Options.td
index f92e6cda31e5..01e73b789f9a 100644
--- a/contrib/llvm-project/lld/MachO/Options.td
+++ b/contrib/llvm-project/lld/MachO/Options.td
@@ -132,7 +132,7 @@ def check_category_conflicts : Flag<["--"], "check-category-conflicts">,
def lto_debug_pass_manager: Flag<["--"], "lto-debug-pass-manager">,
HelpText<"Debug new pass manager">, Group<grp_lld>;
def cs_profile_generate: Flag<["--"], "cs-profile-generate">,
- HelpText<"Perform context senstive PGO instrumentation">, Group<grp_lld>;
+ HelpText<"Perform context sensitive PGO instrumentation">, Group<grp_lld>;
def cs_profile_path: Joined<["--"], "cs-profile-path=">,
HelpText<"Context sensitive profile file path">, Group<grp_lld>;
defm pgo_warn_mismatch: BB<"pgo-warn-mismatch",
diff --git a/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig b/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig
index 7660e0282c8f..8d4b740e5f35 100644
--- a/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig
+++ b/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig
@@ -110,7 +110,7 @@ AND call SWIG_fail at the same time, because it will result in a double free.
SWIG_fail;
}
- if (llvm::StringRef(type_name.get()).startswith("SB")) {
+ if (llvm::StringRef(type_name.get()).starts_with("SB")) {
std::string error_msg = "Input type is invalid: " + type_name.get();
PyErr_SetString(PyExc_TypeError, error_msg.c_str());
SWIG_fail;
diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h b/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h
index a158199e7fab..3f8005ba696c 100644
--- a/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h
+++ b/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h
@@ -469,14 +469,6 @@ public:
bool can_create = true);
// The method always creates missing children in the path, if necessary.
- lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs,
- size_t *index_of_error = nullptr);
-
- lldb::ValueObjectSP
- GetChildAtIndexPath(llvm::ArrayRef<std::pair<size_t, bool>> idxs,
- size_t *index_of_error = nullptr);
-
- // The method always creates missing children in the path, if necessary.
lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names);
virtual lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,
diff --git a/contrib/llvm-project/lldb/include/lldb/Host/HostGetOpt.h b/contrib/llvm-project/lldb/include/lldb/Host/HostGetOpt.h
index 746e03e1bd1e..52cfdf4dbb89 100644
--- a/contrib/llvm-project/lldb/include/lldb/Host/HostGetOpt.h
+++ b/contrib/llvm-project/lldb/include/lldb/Host/HostGetOpt.h
@@ -11,10 +11,6 @@
#if !defined(_MSC_VER) && !defined(__NetBSD__)
-#ifdef _WIN32
-#define _BSD_SOURCE // Required so that getopt.h defines optreset
-#endif
-
#include <getopt.h>
#include <unistd.h>
diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h b/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h
index ccd25a81c11f..e4276e8398b4 100644
--- a/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h
+++ b/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h
@@ -386,21 +386,6 @@ public:
/// The triple which is used to set the Path style.
void SetFile(llvm::StringRef path, const llvm::Triple &triple);
- bool IsResolved() const { return m_is_resolved; }
-
- /// Set if the file path has been resolved or not.
- ///
- /// If you know a file path is already resolved and avoided passing a \b
- /// true parameter for any functions that take a "bool resolve_path"
- /// parameter, you can set the value manually using this call to make sure
- /// we don't try and resolve it later, or try and resolve a path that has
- /// already been resolved.
- ///
- /// \param[in] is_resolved
- /// A boolean value that will replace the current value that
- /// indicates if the paths in this object have been resolved.
- void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; }
-
FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const;
FileSpec CopyByRemovingLastPathComponent() const;
@@ -440,7 +425,6 @@ protected:
/// state in this object.
void PathWasModified() {
m_checksum = Checksum();
- m_is_resolved = false;
m_absolute = Absolute::Calculate;
}
@@ -459,9 +443,6 @@ protected:
/// The optional MD5 checksum of the file.
Checksum m_checksum;
- /// True if this path has been resolved.
- mutable bool m_is_resolved = false;
-
/// Cache whether this path is absolute.
mutable Absolute m_absolute = Absolute::Calculate;
diff --git a/contrib/llvm-project/lldb/source/API/SBValue.cpp b/contrib/llvm-project/lldb/source/API/SBValue.cpp
index 34d01d759ba5..89d26a1fbe28 100644
--- a/contrib/llvm-project/lldb/source/API/SBValue.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBValue.cpp
@@ -24,6 +24,7 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/DataFormatters/DataVisualization.h"
+#include "lldb/DataFormatters/DumpValueObjectOptions.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Type.h"
@@ -1209,10 +1210,14 @@ bool SBValue::GetDescription(SBStream &description) {
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
- if (value_sp)
- value_sp->Dump(strm);
- else
+ if (value_sp) {
+ DumpValueObjectOptions options;
+ options.SetUseDynamicType(m_opaque_sp->GetUseDynamic());
+ options.SetUseSyntheticValue(m_opaque_sp->GetUseSynthetic());
+ value_sp->Dump(strm, options);
+ } else {
strm.PutCString("No value");
+ }
return true;
}
diff --git a/contrib/llvm-project/lldb/source/Core/ValueObject.cpp b/contrib/llvm-project/lldb/source/Core/ValueObject.cpp
index b82e6082eebd..b2a6d9412ab4 100644
--- a/contrib/llvm-project/lldb/source/Core/ValueObject.cpp
+++ b/contrib/llvm-project/lldb/source/Core/ValueObject.cpp
@@ -393,46 +393,6 @@ ValueObjectSP ValueObject::GetChildAtIndex(size_t idx, bool can_create) {
}
lldb::ValueObjectSP
-ValueObject::GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs,
- size_t *index_of_error) {
- if (idxs.size() == 0)
- return GetSP();
- ValueObjectSP root(GetSP());
-
- size_t current_index = 0;
- for (size_t idx : idxs) {
- root = root->GetChildAtIndex(idx);
- if (!root) {
- if (index_of_error)
- *index_of_error = current_index;
- return root;
- }
- current_index += 1;
- }
- return root;
-}
-
-lldb::ValueObjectSP ValueObject::GetChildAtIndexPath(
- llvm::ArrayRef<std::pair<size_t, bool>> idxs, size_t *index_of_error) {
- if (idxs.size() == 0)
- return GetSP();
- ValueObjectSP root(GetSP());
-
- size_t current_index = 0;
- for (std::pair<size_t, bool> idx : idxs) {
- root = root->GetChildAtIndex(idx.first, idx.second);
- if (!root) {
- if (index_of_error)
- *index_of_error = current_index;
- return root;
- }
-
- current_index += 1;
- }
- return root;
-}
-
-lldb::ValueObjectSP
ValueObject::GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names) {
if (names.size() == 0)
return GetSP();
diff --git a/contrib/llvm-project/lldb/source/Host/common/FileSystem.cpp b/contrib/llvm-project/lldb/source/Host/common/FileSystem.cpp
index 52227a9f63a5..5153a0a9ec51 100644
--- a/contrib/llvm-project/lldb/source/Host/common/FileSystem.cpp
+++ b/contrib/llvm-project/lldb/source/Host/common/FileSystem.cpp
@@ -259,7 +259,6 @@ void FileSystem::Resolve(FileSpec &file_spec) {
file_spec.SetDirectory(path);
else
file_spec.SetPath(path);
- file_spec.SetIsResolved(true);
}
template <typename T>
diff --git a/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp b/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp
index e1275ce711fc..00651df48b62 100644
--- a/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1160,7 +1160,11 @@ Status CommandInterpreter::AddUserCommand(llvm::StringRef name,
if (UserCommandExists(name)) {
if (!can_replace) {
- result.SetErrorString("user command exists and force replace not set");
+ result.SetErrorStringWithFormatv(
+ "user command \"{0}\" already exists and force replace was not set "
+ "by --overwrite or 'settings set interpreter.require-overwrite "
+ "false'",
+ name);
return result;
}
if (cmd_sp->IsMultiwordObject()) {
diff --git a/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 334876620249..3e08f2550081 100644
--- a/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -175,7 +175,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const SymbolContext &sc,
*sc.comp_unit, results.GetSearchedSymbolFiles(), [&](Module &module) {
module.FindTypes(query, results);
pcm_type_sp = results.GetTypeMap().FirstType();
- return !pcm_type_sp;
+ return (bool)pcm_type_sp;
});
}
diff --git a/contrib/llvm-project/lldb/source/Target/JITLoaderList.cpp b/contrib/llvm-project/lldb/source/Target/JITLoaderList.cpp
index 9158d0a5e546..9fa070edd4b8 100644
--- a/contrib/llvm-project/lldb/source/Target/JITLoaderList.cpp
+++ b/contrib/llvm-project/lldb/source/Target/JITLoaderList.cpp
@@ -24,7 +24,7 @@ void JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) {
void JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) {
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
- llvm::erase_value(m_jit_loaders_vec, jit_loader_sp);
+ llvm::erase(m_jit_loaders_vec, jit_loader_sp);
}
size_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); }
diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h
index 4e69d5b63354..d892333de391 100644
--- a/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h
+++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h
@@ -258,7 +258,9 @@ namespace llvm {
return Length >= Prefix.Length &&
compareMemory(Data, Prefix.Data, Prefix.Length) == 0;
}
- [[nodiscard]] bool startswith(StringRef Prefix) const {
+ [[nodiscard]] LLVM_DEPRECATED(
+ "Use starts_with instead",
+ "starts_with") bool startswith(StringRef Prefix) const {
return starts_with(Prefix);
}
@@ -271,7 +273,9 @@ namespace llvm {
compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) ==
0;
}
- [[nodiscard]] bool endswith(StringRef Suffix) const {
+ [[nodiscard]] LLVM_DEPRECATED(
+ "Use ends_with instead",
+ "ends_with") bool endswith(StringRef Suffix) const {
return ends_with(Suffix);
}
diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h b/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h
index 8dfbe4f72e07..1f1fd1967efb 100644
--- a/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h
+++ b/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h
@@ -37,7 +37,7 @@ namespace llvm {
/// A Twine is not intended for use directly and should not be stored, its
/// implementation relies on the ability to store pointers to temporary stack
/// objects which may be deallocated at the end of a statement. Twines should
- /// only be used accepted as const references in arguments, when an API wishes
+ /// only be used as const references in arguments, when an API wishes
/// to accept possibly-concatenated strings.
///
/// Twines support a special 'null' value, which always concatenates to form
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h
index cb5fa35d2995..25a2c9ffa534 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h
@@ -32,7 +32,6 @@ namespace llvm {
friend class LazyValueInfoWrapperPass;
AssumptionCache *AC = nullptr;
const DataLayout *DL = nullptr;
- class TargetLibraryInfo *TLI = nullptr;
LazyValueInfoImpl *PImpl = nullptr;
LazyValueInfo(const LazyValueInfo &) = delete;
void operator=(const LazyValueInfo &) = delete;
@@ -43,18 +42,16 @@ namespace llvm {
public:
~LazyValueInfo();
LazyValueInfo() = default;
- LazyValueInfo(AssumptionCache *AC_, const DataLayout *DL_,
- TargetLibraryInfo *TLI_)
- : AC(AC_), DL(DL_), TLI(TLI_) {}
+ LazyValueInfo(AssumptionCache *AC_, const DataLayout *DL_)
+ : AC(AC_), DL(DL_) {}
LazyValueInfo(LazyValueInfo &&Arg)
- : AC(Arg.AC), DL(Arg.DL), TLI(Arg.TLI), PImpl(Arg.PImpl) {
+ : AC(Arg.AC), DL(Arg.DL), PImpl(Arg.PImpl) {
Arg.PImpl = nullptr;
}
LazyValueInfo &operator=(LazyValueInfo &&Arg) {
releaseMemory();
AC = Arg.AC;
DL = Arg.DL;
- TLI = Arg.TLI;
PImpl = Arg.PImpl;
Arg.PImpl = nullptr;
return *this;
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index 2ffd4d4b7143..daf1d8e2079f 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -156,6 +156,10 @@ public:
/// FDecl is assumed to have a parent Module when using this function.
bool getLibFunc(const Function &FDecl, LibFunc &F) const;
+ /// Searches for a function name using an Instruction \p Opcode.
+ /// Currently, only the frem instruction is supported.
+ bool getLibFunc(unsigned int Opcode, Type *Ty, LibFunc &F) const;
+
/// Forces a function to be marked as unavailable.
void setUnavailable(LibFunc F) {
setState(F, Unavailable);
@@ -360,6 +364,12 @@ public:
getLibFunc(*(CB.getCalledFunction()), F);
}
+ /// Searches for a function name using an Instruction \p Opcode.
+ /// Currently, only the frem instruction is supported.
+ bool getLibFunc(unsigned int Opcode, Type *Ty, LibFunc &F) const {
+ return Impl->getLibFunc(Opcode, Ty, F);
+ }
+
/// Disables all builtins.
///
/// This can be used for options like -fno-builtin.
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h
index f5114fa40c70..735be3680aea 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -560,6 +560,10 @@ public:
// (set to UINT_MAX to disable). This does not apply in cases where the
// loop is being fully unrolled.
unsigned MaxCount;
+ /// Set the maximum upper bound of trip count. Allowing the MaxUpperBound
+ /// to be overrided by a target gives more flexiblity on certain cases.
+ /// By default, MaxUpperBound uses UnrollMaxUpperBound which value is 8.
+ unsigned MaxUpperBound;
/// Set the maximum unrolling factor for full unrolling. Like MaxCount, but
/// applies even if full unrolling is selected. This allows a target to fall
/// back to Partial unrolling if full unrolling is above FullUnrollMaxCount.
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h
index 5ae32b5e775e..2898cdd3d7b0 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h
@@ -202,10 +202,7 @@ public:
static ValueLatticeElement get(Constant *C) {
ValueLatticeElement Res;
- if (isa<UndefValue>(C))
- Res.markUndef();
- else
- Res.markConstant(C);
+ Res.markConstant(C);
return Res;
}
static ValueLatticeElement getNot(Constant *C) {
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h
index a3186e61b94a..baa16306ebf5 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h
@@ -863,6 +863,11 @@ ConstantRange computeConstantRange(const Value *V, bool ForSigned,
const DominatorTree *DT = nullptr,
unsigned Depth = 0);
+/// Combine constant ranges from computeConstantRange() and computeKnownBits().
+ConstantRange
+computeConstantRangeIncludingKnownBits(const WithCache<const Value *> &V,
+ bool ForSigned, const SimplifyQuery &SQ);
+
/// Return true if this function can prove that the instruction I will
/// always transfer execution to one of its successors (including the next
/// instruction that follows within a basic block). E.g. this is not
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def b/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def
index c628e72b24d1..4bffcdee6f9c 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def
@@ -493,6 +493,7 @@ TLI_DEFINE_VECFUNC( "llvm.exp2.f64", "_ZGVnN2v_exp2", FIXED(2), "_ZGV_LLVM_N2v")
TLI_DEFINE_VECFUNC( "exp10", "_ZGVnN2v_exp10", FIXED(2), "_ZGV_LLVM_N2v")
TLI_DEFINE_VECFUNC( "llvm.exp10.f64", "_ZGVnN2v_exp10", FIXED(2), "_ZGV_LLVM_N2v")
+TLI_DEFINE_VECFUNC("fmod", "_ZGVnN2vv_fmod", FIXED(2), "_ZGV_LLVM_N2vv")
TLI_DEFINE_VECFUNC( "lgamma", "_ZGVnN2v_lgamma", FIXED(2), "_ZGV_LLVM_N2v")
@@ -546,6 +547,7 @@ TLI_DEFINE_VECFUNC( "llvm.exp2.f32", "_ZGVnN4v_exp2f", FIXED(4), "_ZGV_LLVM_N4v"
TLI_DEFINE_VECFUNC( "exp10f", "_ZGVnN4v_exp10f", FIXED(4), "_ZGV_LLVM_N4v")
TLI_DEFINE_VECFUNC( "llvm.exp10.f32", "_ZGVnN4v_exp10f", FIXED(4), "_ZGV_LLVM_N4v")
+TLI_DEFINE_VECFUNC("fmodf", "_ZGVnN4vv_fmodf", FIXED(4), "_ZGV_LLVM_N4vv")
TLI_DEFINE_VECFUNC( "lgammaf", "_ZGVnN4v_lgammaf", FIXED(4), "_ZGV_LLVM_N4v")
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h b/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h
index 55a6aa645a86..b1ecc8777c16 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h
@@ -195,6 +195,16 @@ static constexpr char const *MappingsAttrName = "vector-function-abi-variant";
/// the presence of the attribute (see InjectTLIMappings).
void getVectorVariantNames(const CallInst &CI,
SmallVectorImpl<std::string> &VariantMappings);
+
+/// Constructs a FunctionType by applying vector function information to the
+/// type of a matching scalar function.
+/// \param Info gets the vectorization factor (VF) and the VFParamKind of the
+/// parameters.
+/// \param ScalarFTy gets the Type information of parameters, as it is not
+/// stored in \p Info.
+/// \returns a pointer to a newly created vector FunctionType
+FunctionType *createFunctionType(const VFInfo &Info,
+ const FunctionType *ScalarFTy);
} // end namespace VFABI
/// The Vector Function Database.
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h
index af874aa5e91a..6eb09f32f9f9 100644
--- a/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h
@@ -270,16 +270,14 @@ public:
#endif
uint64_t getDieOffset() const {
- assert(std::holds_alternative<uint64_t>(OffsetVal) &&
- "Accessing DIE Offset before normalizing.");
+ assert(isNormalized() && "Accessing DIE Offset before normalizing.");
return std::get<uint64_t>(OffsetVal);
}
unsigned getDieTag() const { return DieTag; }
unsigned getUnitID() const { return UnitID; }
bool isTU() const { return IsTU; }
void normalizeDIEToOffset() {
- assert(std::holds_alternative<const DIE *>(OffsetVal) &&
- "Accessing offset after normalizing.");
+ assert(!isNormalized() && "Accessing offset after normalizing.");
OffsetVal = std::get<const DIE *>(OffsetVal)->getOffset();
}
bool isNormalized() const {
@@ -309,7 +307,7 @@ class DWARF5AccelTable : public AccelTable<DWARF5AccelTableData> {
public:
struct UnitIndexAndEncoding {
unsigned Index;
- DWARF5AccelTableData::AttributeEncoding Endoding;
+ DWARF5AccelTableData::AttributeEncoding Encoding;
};
/// Returns type units that were constructed.
const TUVectorTy &getTypeUnitsSymbols() { return TUSymbolsOrHashes; }
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
index ac9e66c4dc2f..06da9fb57902 100644
--- a/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
@@ -32,6 +32,7 @@
#include "llvm/CodeGen/InterleavedAccess.h"
#include "llvm/CodeGen/InterleavedLoadCombine.h"
#include "llvm/CodeGen/JMCInstrumenter.h"
+#include "llvm/CodeGen/LowerEmuTLS.h"
#include "llvm/CodeGen/MachinePassManager.h"
#include "llvm/CodeGen/PreISelIntrinsicLowering.h"
#include "llvm/CodeGen/ReplaceWithVeclib.h"
@@ -77,13 +78,6 @@ namespace llvm {
return PreservedAnalyses::all(); \
} \
};
-#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
- struct PASS_NAME : public PassInfoMixin<PASS_NAME> { \
- template <typename... Ts> PASS_NAME(Ts &&...) {} \
- PreservedAnalyses run(Module &, ModuleAnalysisManager &) { \
- return PreservedAnalyses::all(); \
- } \
- };
#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
struct PASS_NAME : public MachinePassInfoMixin<PASS_NAME> { \
template <typename... Ts> PASS_NAME(Ts &&...) {} \
@@ -701,6 +695,7 @@ void CodeGenPassBuilder<Derived>::addPassesToHandleExceptions(
case ExceptionHandling::DwarfCFI:
case ExceptionHandling::ARM:
case ExceptionHandling::AIX:
+ case ExceptionHandling::ZOS:
addPass(DwarfEHPreparePass(&TM));
break;
case ExceptionHandling::WinEH:
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/LowerEmuTLS.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/LowerEmuTLS.h
new file mode 100644
index 000000000000..ecd1352a89f4
--- /dev/null
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/LowerEmuTLS.h
@@ -0,0 +1,29 @@
+//==------ llvm/CodeGen/LowerEmuTLS.h -------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+/// \file Add Add __emutls_[vt].* variables.
+///
+/// This file provide declaration of LowerEmuTLSPass.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_LOWEREMUTLS_H
+#define LLVM_CODEGEN_LOWEREMUTLS_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class LowerEmuTLSPass : public PassInfoMixin<LowerEmuTLSPass> {
+public:
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+};
+
+} // namespace llvm
+
+#endif // LLVM_CODEGEN_LOWEREMUTLS_H
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def
index 04f2cd5ff581..f950dfae7e33 100644
--- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def
@@ -25,6 +25,7 @@ MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, (PIC))
#endif
MODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass, ())
MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass, ())
+MODULE_PASS("lower-emutls", LowerEmuTLSPass, ())
#undef MODULE_PASS
#ifndef FUNCTION_ANALYSIS
@@ -136,12 +137,6 @@ DUMMY_FUNCTION_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass, ())
DUMMY_FUNCTION_PASS("stack-protector", StackProtectorPass, ())
#undef DUMMY_FUNCTION_PASS
-#ifndef DUMMY_MODULE_PASS
-#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR)
-#endif
-DUMMY_MODULE_PASS("lower-emutls", LowerEmuTLSPass, ())
-#undef DUMMY_MODULE_PASS
-
#ifndef DUMMY_MACHINE_MODULE_PASS
#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR)
#endif
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h
index a359fca60426..191c906e9ef6 100644
--- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h
@@ -50,15 +50,11 @@ bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
/// for instructions that benefit according to the target-specific
/// predicate functions. shouldScheduleAdjacent will be true if any of the
/// provided predicates are true.
+/// If BranchOnly is true, only branch instructions with one of their
+/// predecessors will be fused.
std::unique_ptr<ScheduleDAGMutation>
-createMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates);
-
-/// Create a DAG scheduling mutation to pair branch instructions with one
-/// of their predecessors back to back for instructions that benefit according
-/// to the target-specific predicate functions. shouldScheduleAdjacent will be
-/// true if any of the provided predicates are true.
-std::unique_ptr<ScheduleDAGMutation>
-createBranchMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates);
+createMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates,
+ bool BranchOnly = false);
} // end namespace llvm
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h
index c604e7eaa088..40046e0a8dec 100644
--- a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h
@@ -223,6 +223,8 @@ public:
// Space-optimized forms that implicitly encode integer VT.
OPC_EmitStringInteger32,
OPC_EmitRegister,
+ OPC_EmitRegisterI32,
+ OPC_EmitRegisterI64,
OPC_EmitRegister2,
OPC_EmitConvertToTarget,
OPC_EmitConvertToTarget0,
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h
index 490125164ab3..ed2b513be960 100644
--- a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -2869,6 +2869,12 @@ public:
getApproximateEVTForLLT(ToTy, DL, Ctx));
}
+ /// Return true if truncating the specific node Val to type VT2 is free.
+ virtual bool isTruncateFree(SDValue Val, EVT VT2) const {
+ // Fallback to type matching.
+ return isTruncateFree(Val.getValueType(), VT2);
+ }
+
virtual bool isProfitableToHoist(Instruction *I) const { return true; }
/// Return true if the extension represented by \p I is free.
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
index 9f92b919824d..4a7c1ca4a571 100644
--- a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
+++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
@@ -309,6 +309,8 @@ public:
const TargetMachine &TM) const override;
MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
const TargetMachine &TM) const override;
+ MCSection *getSectionForLSDA(const Function &F, const MCSymbol &FnSym,
+ const TargetMachine &TM) const override;
};
} // end namespace llvm
diff --git a/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
index eedecaea4e58..068b4c66711e 100644
--- a/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
+++ b/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
@@ -54,6 +54,30 @@ enum class ResourceKind : uint32_t {
NumEntries,
};
+// The value ordering of this enumeration is part of the DXIL ABI. Elements
+// can only be added to the end, and not removed.
+enum class ElementType : uint32_t {
+ Invalid = 0,
+ I1,
+ I16,
+ U16,
+ I32,
+ U32,
+ I64,
+ U64,
+ F16,
+ F32,
+ F64,
+ SNormF16,
+ UNormF16,
+ SNormF32,
+ UNormF32,
+ SNormF64,
+ UNormF64,
+ PackedS8x32,
+ PackedU8x32,
+};
+
class FrontendResource {
MDNode *Entry;
@@ -62,12 +86,13 @@ public:
assert(Entry->getNumOperands() == 6 && "Unexpected metadata shape");
}
- FrontendResource(GlobalVariable *GV, StringRef TypeStr, ResourceKind RK,
+ FrontendResource(GlobalVariable *GV, ResourceKind RK, ElementType ElTy,
bool IsROV, uint32_t ResIndex, uint32_t Space);
GlobalVariable *getGlobalVariable();
StringRef getSourceType();
ResourceKind getResourceKind();
+ ElementType getElementType();
bool getIsROV();
uint32_t getResourceIndex();
uint32_t getSpace();
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Constants.h b/contrib/llvm-project/llvm/include/llvm/IR/Constants.h
index 0b9f89830b79..b5dcc7fbc1d9 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/Constants.h
+++ b/contrib/llvm-project/llvm/include/llvm/IR/Constants.h
@@ -171,10 +171,9 @@ public:
/// Determine if this constant's value is same as an unsigned char.
bool equalsInt(uint64_t V) const { return Val == V; }
- /// getType - Specialize the getType() method to always return an IntegerType,
- /// which reduces the amount of casting needed in parts of the compiler.
- ///
- inline IntegerType *getType() const {
+ /// Variant of the getType() method to always return an IntegerType, which
+ /// reduces the amount of casting needed in parts of the compiler.
+ inline IntegerType *getIntegerType() const {
return cast<IntegerType>(Value::getType());
}
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h b/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h
index 55e5e5975808..db7d7444f75f 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h
+++ b/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h
@@ -23,6 +23,7 @@ class DiagnosticInfo;
/// which remarks are enabled.
struct DiagnosticHandler {
void *DiagnosticContext = nullptr;
+ bool HasErrors = false;
DiagnosticHandler(void *DiagContext = nullptr)
: DiagnosticContext(DiagContext) {}
virtual ~DiagnosticHandler() = default;
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h b/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
index e2ece30b1864..f6eb5066d553 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
+++ b/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
@@ -29,7 +29,7 @@
#include "llvm/ADT/GenericConvergenceVerifier.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/IntrinsicInst.h"
#define Check(C, ...) \
do { \
@@ -48,17 +48,6 @@
} while (false)
namespace llvm {
-static bool isConvergenceControlIntrinsic(unsigned IntrinsicID) {
- switch (IntrinsicID) {
- default:
- return false;
- case Intrinsic::experimental_convergence_anchor:
- case Intrinsic::experimental_convergence_entry:
- case Intrinsic::experimental_convergence_loop:
- return true;
- }
-}
-
template <class ContextT> void GenericConvergenceVerifier<ContextT>::clear() {
Tokens.clear();
CI.clear();
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h b/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h
index d1891c157099..e97a7f2b9636 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h
+++ b/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h
@@ -41,6 +41,10 @@ namespace Intrinsic {
typedef unsigned ID;
} // end namespace Intrinsic
+// Choose ';' as the delimiter. ':' was used once but it doesn't work well for
+// Objective-C functions which commonly have :'s in their names.
+inline constexpr char kGlobalIdentifierDelimiter = ';';
+
class GlobalValue : public Constant {
public:
/// An enumeration for the kinds of linkage for global values.
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h
index 8940bebd2c9a..b8d578d0fee0 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h
@@ -1724,6 +1724,30 @@ public:
}
};
+/// Check if \p ID corresponds to a convergence control intrinsic.
+static inline bool isConvergenceControlIntrinsic(unsigned IntrinsicID) {
+ switch (IntrinsicID) {
+ default:
+ return false;
+ case Intrinsic::experimental_convergence_anchor:
+ case Intrinsic::experimental_convergence_entry:
+ case Intrinsic::experimental_convergence_loop:
+ return true;
+ }
+}
+
+/// Represents calls to the llvm.experimintal.convergence.* intrinsics.
+class ConvergenceControlInst : public IntrinsicInst {
+public:
+ static bool classof(const IntrinsicInst *I) {
+ return isConvergenceControlIntrinsic(I->getIntrinsicID());
+ }
+
+ static bool classof(const Value *V) {
+ return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
+ }
+};
+
} // end namespace llvm
#endif // LLVM_IR_INTRINSICINST_H
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
index 51bd9b63c127..cb48f54b13a6 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
+++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td
@@ -2353,14 +2353,14 @@ def int_amdgcn_s_get_waveid_in_workgroup :
Intrinsic<[llvm_i32_ty], [],
[IntrNoMem, IntrHasSideEffects, IntrWillReturn, IntrNoCallback, IntrNoFree]>;
-class AMDGPUGlobalAtomicRtn<LLVMType vt> : Intrinsic <
+class AMDGPUAtomicRtn<LLVMType vt> : Intrinsic <
[vt],
[llvm_anyptr_ty, // vaddr
vt], // vdata(VGPR)
[IntrArgMemOnly, IntrWillReturn, NoCapture<ArgIndex<0>>, IntrNoCallback, IntrNoFree], "",
[SDNPMemOperand]>;
-def int_amdgcn_global_atomic_csub : AMDGPUGlobalAtomicRtn<llvm_i32_ty>;
+def int_amdgcn_global_atomic_csub : AMDGPUAtomicRtn<llvm_i32_ty>;
// uint4 llvm.amdgcn.image.bvh.intersect.ray <node_ptr>, <ray_extent>, <ray_origin>,
// <ray_dir>, <ray_inv_dir>, <texture_descr>
@@ -2486,10 +2486,10 @@ def int_amdgcn_permlanex16_var : ClangBuiltin<"__builtin_amdgcn_permlanex16_var"
[IntrNoMem, IntrConvergent, IntrWillReturn,
ImmArg<ArgIndex<3>>, ImmArg<ArgIndex<4>>, IntrNoCallback, IntrNoFree]>;
-def int_amdgcn_flat_atomic_fmin_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
-def int_amdgcn_flat_atomic_fmax_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
-def int_amdgcn_global_atomic_fmin_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
-def int_amdgcn_global_atomic_fmax_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_flat_atomic_fmin_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_flat_atomic_fmax_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_global_atomic_fmin_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_global_atomic_fmax_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
//===----------------------------------------------------------------------===//
// Deep learning intrinsics.
@@ -2692,7 +2692,7 @@ def int_amdgcn_udot8 :
// gfx908 intrinsics
// ===----------------------------------------------------------------------===//
-def int_amdgcn_global_atomic_fadd : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_global_atomic_fadd : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
// llvm.amdgcn.mfma.*.* vdst, srcA, srcB, srcC, cbsz, abid, blgp
class AMDGPUMfmaIntrinsic<LLVMType DestTy, LLVMType SrcABTy> :
@@ -2728,11 +2728,11 @@ def int_amdgcn_mfma_f32_16x16x8bf16 : AMDGPUMfmaIntrinsic<llvm_v4f32_ty, llvm_v
// gfx90a intrinsics
// ===----------------------------------------------------------------------===//
-def int_amdgcn_global_atomic_fmin : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
-def int_amdgcn_global_atomic_fmax : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
-def int_amdgcn_flat_atomic_fadd : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
-def int_amdgcn_flat_atomic_fmin : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
-def int_amdgcn_flat_atomic_fmax : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_global_atomic_fmin : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_global_atomic_fmax : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_flat_atomic_fadd : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_flat_atomic_fmin : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
+def int_amdgcn_flat_atomic_fmax : AMDGPUAtomicRtn<llvm_anyfloat_ty>;
def int_amdgcn_mfma_f32_32x32x4bf16_1k : AMDGPUMfmaIntrinsic<llvm_v32f32_ty, llvm_v4i16_ty>;
def int_amdgcn_mfma_f32_16x16x4bf16_1k : AMDGPUMfmaIntrinsic<llvm_v16f32_ty, llvm_v4i16_ty>;
@@ -2751,8 +2751,8 @@ def int_amdgcn_mfma_f64_4x4x4f64 : AMDGPUMfmaIntrinsic<llvm_double_ty, ll
// ===----------------------------------------------------------------------===//
// bf16 atomics use v2i16 argument since there is no bf16 data type in the llvm.
-def int_amdgcn_global_atomic_fadd_v2bf16 : AMDGPUGlobalAtomicRtn<llvm_v2i16_ty>;
-def int_amdgcn_flat_atomic_fadd_v2bf16 : AMDGPUGlobalAtomicRtn<llvm_v2i16_ty>;
+def int_amdgcn_global_atomic_fadd_v2bf16 : AMDGPUAtomicRtn<llvm_v2i16_ty>;
+def int_amdgcn_flat_atomic_fadd_v2bf16 : AMDGPUAtomicRtn<llvm_v2i16_ty>;
def int_amdgcn_ds_fadd_v2bf16 : DefaultAttrsIntrinsic<
[llvm_v2i16_ty],
[LLVMQualPointerType<3>, llvm_v2i16_ty],
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td
index fc830fca392f..a391bc53cdb0 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td
+++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td
@@ -702,7 +702,7 @@ let TargetPrefix = "riscv" in {
LLVMMatchType<2>, LLVMMatchType<2>],
[ImmArg<ArgIndex<4>>,ImmArg<ArgIndex<6>>, IntrNoMem, IntrHasSideEffects]>,
RISCVVIntrinsic {
- let VLOperand = 6;
+ let VLOperand = 5;
}
// For Saturating binary operations.
// The destination vector type is NOT the same as first source vector.
diff --git a/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h b/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h
index 096d1688af3f..48afdb867ba6 100644
--- a/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h
+++ b/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h
@@ -1656,6 +1656,19 @@ template <typename Op_t> struct PtrToIntSameSize_match {
}
};
+template <typename Op_t> struct NNegZExt_match {
+ Op_t Op;
+
+ NNegZExt_match(const Op_t &OpMatch) : Op(OpMatch) {}
+
+ template <typename OpTy> bool match(OpTy *V) {
+ if (auto *I = dyn_cast<Instruction>(V))
+ return I->getOpcode() == Instruction::ZExt && I->hasNonNeg() &&
+ Op.match(I->getOperand(0));
+ return false;
+ }
+};
+
/// Matches BitCast.
template <typename OpTy>
inline CastOperator_match<OpTy, Instruction::BitCast>
@@ -1708,6 +1721,11 @@ inline CastInst_match<OpTy, Instruction::ZExt> m_ZExt(const OpTy &Op) {
}
template <typename OpTy>
+inline NNegZExt_match<OpTy> m_NNegZExt(const OpTy &Op) {
+ return NNegZExt_match<OpTy>(Op);
+}
+
+template <typename OpTy>
inline match_combine_or<CastInst_match<OpTy, Instruction::ZExt>, OpTy>
m_ZExtOrSelf(const OpTy &Op) {
return m_CombineOr(m_ZExt(Op), Op);
@@ -1719,6 +1737,14 @@ m_SExtOrSelf(const OpTy &Op) {
return m_CombineOr(m_SExt(Op), Op);
}
+/// Match either "sext" or "zext nneg".
+template <typename OpTy>
+inline match_combine_or<CastInst_match<OpTy, Instruction::SExt>,
+ NNegZExt_match<OpTy>>
+m_SExtLike(const OpTy &Op) {
+ return m_CombineOr(m_SExt(Op), m_NNegZExt(Op));
+}
+
template <typename OpTy>
inline match_combine_or<CastInst_match<OpTy, Instruction::ZExt>,
CastInst_match<OpTy, Instruction::SExt>>
diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h b/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h
index a3c9b19e859d..56492368bd98 100644
--- a/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h
@@ -799,7 +799,8 @@ public:
/// frame information to unwind.
bool usesCFIForEH() const {
return (ExceptionsType == ExceptionHandling::DwarfCFI ||
- ExceptionsType == ExceptionHandling::ARM || usesWindowsCFI());
+ ExceptionsType == ExceptionHandling::ARM ||
+ ExceptionsType == ExceptionHandling::ZOS || usesWindowsCFI());
}
bool usesWindowsCFI() const {
diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h b/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h
index afb329eb6f93..e2dd1e0433db 100644
--- a/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h
+++ b/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h
@@ -24,6 +24,8 @@ enum class ExceptionHandling {
WinEH, ///< Windows Exception Handling
Wasm, ///< WebAssembly Exception Handling
AIX, ///< AIX Exception Handling
+ ZOS, ///< z/OS MVS Exception Handling. Very similar to DwarfCFI, but the PPA1
+ ///< is used instead of an .eh_frame section.
};
enum class EmitDwarfUnwindType {
diff --git a/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h b/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h
index de418a1782ac..99477644de4d 100644
--- a/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h
@@ -64,6 +64,7 @@ class ELFObjectFileBase : public ObjectFile {
SubtargetFeatures getLoongArchFeatures() const;
StringRef getAMDGPUCPUName() const;
+ StringRef getNVPTXCPUName() const;
protected:
ELFObjectFileBase(unsigned int Type, MemoryBufferRef Source);
diff --git a/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h b/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h
index dfab4c68d18f..6b8edb90e144 100644
--- a/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h
+++ b/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h
@@ -144,7 +144,6 @@ public:
ArrayRef<wasm::WasmGlobal> globals() const { return Globals; }
ArrayRef<wasm::WasmTag> tags() const { return Tags; }
ArrayRef<wasm::WasmExport> exports() const { return Exports; }
- ArrayRef<WasmSymbol> syms() const { return Symbols; }
const wasm::WasmLinkingData &linkingData() const { return LinkingData; }
uint32_t getNumberOfSymbols() const { return Symbols.size(); }
ArrayRef<wasm::WasmElemSegment> elements() const { return ElemSegments; }
diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
index 493689f6a61e..2757b8cd54a6 100644
--- a/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
+++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
@@ -447,7 +447,7 @@ public:
bool isConditionIndependencePairCovered(unsigned Condition) const {
auto It = PosToID.find(Condition);
if (It != PosToID.end())
- return (IndependencePairs.find(It->second) != IndependencePairs.end());
+ return IndependencePairs.contains(It->second);
llvm_unreachable("Condition ID without an Ordinal mapping");
}
diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h
index 288dc71d756a..36be2e7d869e 100644
--- a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h
@@ -171,6 +171,8 @@ inline StringRef getInstrProfCounterBiasVarName() {
/// Return the marker used to separate PGO names during serialization.
inline StringRef getInstrProfNameSeparator() { return "\01"; }
+/// Please use getIRPGOFuncName for LLVM IR instrumentation. This function is
+/// for front-end (Clang, etc) instrumentation.
/// Return the modified name for function \c F suitable to be
/// used the key for profile lookup. Variable \c InLTO indicates if this
/// is called in LTO optimization passes.
@@ -196,20 +198,22 @@ std::string getIRPGOFuncName(const Function &F, bool InLTO = false);
std::pair<StringRef, StringRef> getParsedIRPGOFuncName(StringRef IRPGOFuncName);
/// Return the name of the global variable used to store a function
-/// name in PGO instrumentation. \c FuncName is the name of the function
-/// returned by the \c getPGOFuncName call.
+/// name in PGO instrumentation. \c FuncName is the IRPGO function name
+/// (returned by \c getIRPGOFuncName) for LLVM IR instrumentation and PGO
+/// function name (returned by \c getPGOFuncName) for front-end instrumentation.
std::string getPGOFuncNameVarName(StringRef FuncName,
GlobalValue::LinkageTypes Linkage);
/// Create and return the global variable for function name used in PGO
-/// instrumentation. \c FuncName is the name of the function returned
-/// by \c getPGOFuncName call.
+/// instrumentation. \c FuncName is the IRPGO function name (returned by
+/// \c getIRPGOFuncName) for LLVM IR instrumentation and PGO function name
+/// (returned by \c getPGOFuncName) for front-end instrumentation.
GlobalVariable *createPGOFuncNameVar(Function &F, StringRef PGOFuncName);
/// Create and return the global variable for function name used in PGO
-/// instrumentation. /// \c FuncName is the name of the function
-/// returned by \c getPGOFuncName call, \c M is the owning module,
-/// and \c Linkage is the linkage of the instrumented function.
+/// instrumentation. \c FuncName is the IRPGO function name (returned by
+/// \c getIRPGOFuncName) for LLVM IR instrumentation and PGO function name
+/// (returned by \c getPGOFuncName) for front-end instrumentation.
GlobalVariable *createPGOFuncNameVar(Module &M,
GlobalValue::LinkageTypes Linkage,
StringRef PGOFuncName);
@@ -417,11 +421,11 @@ uint64_t ComputeHash(StringRef K);
} // end namespace IndexedInstrProf
-/// A symbol table used for function PGO name look-up with keys
+/// A symbol table used for function [IR]PGO name look-up with keys
/// (such as pointers, md5hash values) to the function. A function's
-/// PGO name or name's md5hash are used in retrieving the profile
-/// data of the function. See \c getPGOFuncName() method for details
-/// on how PGO name is formed.
+/// [IR]PGO name or name's md5hash are used in retrieving the profile
+/// data of the function. See \c getIRPGOFuncName() and \c getPGOFuncName
+/// methods for details how [IR]PGO name is formed.
class InstrProfSymtab {
public:
using AddrHashMap = std::vector<std::pair<uint64_t, uint64_t>>;
diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h
index 796183aacc72..6aa5caec65f7 100644
--- a/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h
+++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h
@@ -147,14 +147,14 @@ public:
llvm::SmallVectorImpl<SegmentEntry> &Seg,
llvm::MapVector<uint64_t, MemInfoBlock> &Prof,
CallStackMap &SM, bool KeepName = false)
- : Symbolizer(std::move(Sym)), SegmentInfo(Seg.begin(), Seg.end()),
- CallstackProfileData(Prof), StackMap(SM), KeepSymbolName(KeepName) {
+ : SegmentInfo(Seg.begin(), Seg.end()), CallstackProfileData(Prof),
+ StackMap(SM), KeepSymbolName(KeepName) {
// We don't call initialize here since there is no raw profile to read. The
// test should pass in the raw profile as structured data.
// If there is an error here then the mock symbolizer has not been
// initialized properly.
- if (Error E = symbolizeAndFilterStackFrames())
+ if (Error E = symbolizeAndFilterStackFrames(std::move(Sym)))
report_fatal_error(std::move(E));
if (Error E = mapRawProfileToRecords())
report_fatal_error(std::move(E));
@@ -173,7 +173,8 @@ private:
// callstacks from the raw profile. Also prune callstack frames which we can't
// symbolize or those that belong to the runtime. For profile entries where
// the entire callstack is pruned, we drop the entry from the profile.
- Error symbolizeAndFilterStackFrames();
+ Error symbolizeAndFilterStackFrames(
+ std::unique_ptr<llvm::symbolize::SymbolizableModule> Symbolizer);
// Construct memprof records for each function and store it in the
// `FunctionProfileData` map. A function may have allocation profile data or
// callsite data or both.
@@ -183,8 +184,6 @@ private:
// The profiled binary.
object::OwningBinary<object::Binary> Binary;
- // A symbolizer to translate virtual addresses to code locations.
- std::unique_ptr<llvm::symbolize::SymbolizableModule> Symbolizer;
// The preferred load address of the executable segment.
uint64_t PreferredTextSegmentAddress = 0;
// The base address of the text segment in the process during profiling.
diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h
index d995cc69af89..66aaf602d0e1 100644
--- a/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h
@@ -883,7 +883,7 @@ public:
/// Returns the call target map collected at a given location.
/// Each location is specified by \p LineOffset and \p Discriminator.
/// If the location is not found in profile, return error.
- ErrorOr<SampleRecord::CallTargetMap>
+ ErrorOr<const SampleRecord::CallTargetMap &>
findCallTargetMapAt(uint32_t LineOffset, uint32_t Discriminator) const {
const auto &ret = BodySamples.find(
mapIRLocToProfileLoc(LineLocation(LineOffset, Discriminator)));
@@ -894,7 +894,7 @@ public:
/// Returns the call target map collected at a given location specified by \p
/// CallSite. If the location is not found in profile, return error.
- ErrorOr<SampleRecord::CallTargetMap>
+ ErrorOr<const SampleRecord::CallTargetMap &>
findCallTargetMapAt(const LineLocation &CallSite) const {
const auto &Ret = BodySamples.find(mapIRLocToProfileLoc(CallSite));
if (Ret == BodySamples.end())
diff --git a/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h b/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h
index 58ef176551b6..8929f9b1db15 100644
--- a/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h
+++ b/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h
@@ -243,6 +243,15 @@ extern ManagedStatic<SubCommand> TopLevelSubCommand;
// A special subcommand that can be used to put an option into all subcommands.
extern ManagedStatic<SubCommand> AllSubCommands;
+class SubCommandGroup {
+ SmallVector<SubCommand *, 4> Subs;
+
+public:
+ SubCommandGroup(std::initializer_list<SubCommand *> IL) : Subs(IL) {}
+
+ ArrayRef<SubCommand *> getSubCommands() const { return Subs; }
+};
+
//===----------------------------------------------------------------------===//
//
class Option {
@@ -314,10 +323,6 @@ public:
return getNumOccurrencesFlag() == cl::ConsumeAfter;
}
- bool isInAllSubCommands() const {
- return Subs.contains(&SubCommand::getAll());
- }
-
//-------------------------------------------------------------------------===
// Accessor functions set by OptionModifiers
//
@@ -477,11 +482,19 @@ struct cat {
// Specify the subcommand that this option belongs to.
struct sub {
- SubCommand &Sub;
+ SubCommand *Sub = nullptr;
+ SubCommandGroup *Group = nullptr;
- sub(SubCommand &S) : Sub(S) {}
+ sub(SubCommand &S) : Sub(&S) {}
+ sub(SubCommandGroup &G) : Group(&G) {}
- template <class Opt> void apply(Opt &O) const { O.addSubCommand(Sub); }
+ template <class Opt> void apply(Opt &O) const {
+ if (Sub)
+ O.addSubCommand(*Sub);
+ else if (Group)
+ for (SubCommand *SC : Group->getSubCommands())
+ O.addSubCommand(*SC);
+ }
};
// Specify a callback function to be called when an option is seen.
diff --git a/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h b/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h
index 99074105a556..3b1f4bad57fc 100644
--- a/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h
+++ b/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h
@@ -1058,6 +1058,19 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
}
}
+namespace detail {
+
+template <typename T, typename Context>
+std::string doValidate(IO &io, T &Val, Context &Ctx) {
+ return MappingContextTraits<T, Context>::validate(io, Val, Ctx);
+}
+
+template <typename T> std::string doValidate(IO &io, T &Val, EmptyContext &) {
+ return MappingTraits<T>::validate(io, Val);
+}
+
+} // namespace detail
+
template <typename T, typename Context>
std::enable_if_t<validatedMappingTraits<T, Context>::value, void>
yamlize(IO &io, T &Val, bool, Context &Ctx) {
@@ -1066,7 +1079,7 @@ yamlize(IO &io, T &Val, bool, Context &Ctx) {
else
io.beginMapping();
if (io.outputting()) {
- std::string Err = MappingTraits<T>::validate(io, Val);
+ std::string Err = detail::doValidate(io, Val, Ctx);
if (!Err.empty()) {
errs() << Err << "\n";
assert(Err.empty() && "invalid struct trying to be written as yaml");
@@ -1074,7 +1087,7 @@ yamlize(IO &io, T &Val, bool, Context &Ctx) {
}
detail::doMapping(io, Val, Ctx);
if (!io.outputting()) {
- std::string Err = MappingTraits<T>::validate(io, Val);
+ std::string Err = detail::doValidate(io, Val, Ctx);
if (!Err.empty())
io.setError(Err);
}
diff --git a/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h b/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h
index 7c8d264afeff..42663a9adf2e 100644
--- a/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h
+++ b/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h
@@ -16,7 +16,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Threading.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
@@ -634,54 +633,6 @@ public:
};
//===----------------------------------------------------------------------===//
-// Socket Streams
-//===----------------------------------------------------------------------===//
-
-/// A raw stream for sockets reading/writing
-
-class raw_socket_stream;
-
-// Make sure that calls to WSAStartup and WSACleanup are balanced.
-#ifdef _WIN32
-class WSABalancer {
-public:
- WSABalancer();
- ~WSABalancer();
-};
-#endif // _WIN32
-
-class ListeningSocket {
- int FD;
- std::string SocketPath;
- ListeningSocket(int SocketFD, StringRef SocketPath);
-#ifdef _WIN32
- WSABalancer _;
-#endif // _WIN32
-
-public:
- static Expected<ListeningSocket> createUnix(
- StringRef SocketPath,
- int MaxBacklog = llvm::hardware_concurrency().compute_thread_count());
- Expected<std::unique_ptr<raw_socket_stream>> accept();
- ListeningSocket(ListeningSocket &&LS);
- ~ListeningSocket();
-};
-class raw_socket_stream : public raw_fd_stream {
- uint64_t current_pos() const override { return 0; }
-#ifdef _WIN32
- WSABalancer _;
-#endif // _WIN32
-
-public:
- raw_socket_stream(int SocketFD);
- /// Create a \p raw_socket_stream connected to the Unix domain socket at \p
- /// SocketPath.
- static Expected<std::unique_ptr<raw_socket_stream>>
- createConnectedUnix(StringRef SocketPath);
- ~raw_socket_stream();
-};
-
-//===----------------------------------------------------------------------===//
// Output Stream Adaptors
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/include/llvm/Support/raw_socket_stream.h b/contrib/llvm-project/llvm/include/llvm/Support/raw_socket_stream.h
new file mode 100644
index 000000000000..c219792d8246
--- /dev/null
+++ b/contrib/llvm-project/llvm/include/llvm/Support/raw_socket_stream.h
@@ -0,0 +1,66 @@
+//===-- llvm/Support/raw_socket_stream.h - Socket streams --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains raw_ostream implementations for streams to communicate
+// via UNIX sockets
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_RAW_SOCKET_STREAM_H
+#define LLVM_SUPPORT_RAW_SOCKET_STREAM_H
+
+#include "llvm/Support/Threading.h"
+#include "llvm/Support/raw_ostream.h"
+
+namespace llvm {
+
+class raw_socket_stream;
+
+// Make sure that calls to WSAStartup and WSACleanup are balanced.
+#ifdef _WIN32
+class WSABalancer {
+public:
+ WSABalancer();
+ ~WSABalancer();
+};
+#endif // _WIN32
+
+class ListeningSocket {
+ int FD;
+ std::string SocketPath;
+ ListeningSocket(int SocketFD, StringRef SocketPath);
+#ifdef _WIN32
+ WSABalancer _;
+#endif // _WIN32
+
+public:
+ static Expected<ListeningSocket> createUnix(
+ StringRef SocketPath,
+ int MaxBacklog = llvm::hardware_concurrency().compute_thread_count());
+ Expected<std::unique_ptr<raw_socket_stream>> accept();
+ ListeningSocket(ListeningSocket &&LS);
+ ~ListeningSocket();
+};
+class raw_socket_stream : public raw_fd_stream {
+ uint64_t current_pos() const override { return 0; }
+#ifdef _WIN32
+ WSABalancer _;
+#endif // _WIN32
+
+public:
+ raw_socket_stream(int SocketFD);
+ /// Create a \p raw_socket_stream connected to the Unix domain socket at \p
+ /// SocketPath.
+ static Expected<std::unique_ptr<raw_socket_stream>>
+ createConnectedUnix(StringRef SocketPath);
+ ~raw_socket_stream();
+};
+
+} // end namespace llvm
+
+#endif
diff --git a/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h
index 56c32fae712c..53dc2be825f2 100644
--- a/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ b/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -173,6 +173,9 @@ enum ArchExtKind : unsigned {
AEK_SMEF8F16 = 69, // FEAT_SME_F8F16
AEK_SMEF8F32 = 70, // FEAT_SME_F8F32
AEK_SMEFA64 = 71, // FEAT_SME_FA64
+ AEK_CPA = 72, // FEAT_CPA
+ AEK_PAUTHLR = 73, // FEAT_PAuth_LR
+ AEK_TLBIW = 74, // FEAT_TLBIW
AEK_NUM_EXTENSIONS
};
using ExtensionBitset = Bitset<AEK_NUM_EXTENSIONS>;
@@ -295,6 +298,9 @@ inline constexpr ExtensionInfo Extensions[] = {
{"sme-f8f16", AArch64::AEK_SMEF8F16, "+sme-f8f16", "-sme-f8f16", FEAT_INIT, "+sme2,+fp8", 0},
{"sme-f8f32", AArch64::AEK_SMEF8F32, "+sme-f8f32", "-sme-f8f32", FEAT_INIT, "+sme2,+fp8", 0},
{"sme-fa64", AArch64::AEK_SMEFA64, "+sme-fa64", "-sme-fa64", FEAT_INIT, "", 0},
+ {"cpa", AArch64::AEK_CPA, "+cpa", "-cpa", FEAT_INIT, "", 0},
+ {"pauth-lr", AArch64::AEK_PAUTHLR, "+pauth-lr", "-pauth-lr", FEAT_INIT, "", 0},
+ {"tlbiw", AArch64::AEK_TLBIW, "+tlbiw", "-tlbiw", FEAT_INIT, "", 0},
// Special cases
{"none", AArch64::AEK_NONE, {}, {}, FEAT_INIT, "", ExtensionInfo::MaxFMVPriority},
};
@@ -378,7 +384,8 @@ inline constexpr ArchInfo ARMV9_3A = { VersionTuple{9, 3}, AProfile, "armv9.3-a
AArch64::ExtensionBitset({AArch64::AEK_MOPS, AArch64::AEK_HBC}))};
inline constexpr ArchInfo ARMV9_4A = { VersionTuple{9, 4}, AProfile, "armv9.4-a", "+v9.4a", (ARMV9_3A.DefaultExts |
AArch64::ExtensionBitset({AArch64::AEK_SPECRES2, AArch64::AEK_CSSC, AArch64::AEK_RASv2}))};
-inline constexpr ArchInfo ARMV9_5A = { VersionTuple{9, 5}, AProfile, "armv9.5-a", "+v9.5a", (ARMV9_4A.DefaultExts)};
+inline constexpr ArchInfo ARMV9_5A = { VersionTuple{9, 5}, AProfile, "armv9.5-a", "+v9.5a", (ARMV9_4A.DefaultExts |
+ AArch64::ExtensionBitset({AArch64::AEK_CPA}))};
// For v8-R, we do not enable crypto and align with GCC that enables a more minimal set of optional architecture extensions.
inline constexpr ArchInfo ARMV8R = { VersionTuple{8, 0}, RProfile, "armv8-r", "+v8r", (ARMV8_5A.DefaultExts |
AArch64::ExtensionBitset({AArch64::AEK_SSBS,
diff --git a/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h b/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
index e3d9ffc1d4db..1e4187c6fb11 100644
--- a/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
+++ b/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
@@ -41,6 +41,7 @@ struct ParsedBranchProtection {
StringRef Scope;
StringRef Key;
bool BranchTargetEnforcement;
+ bool BranchProtectionPAuthLR;
};
bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP,
diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h
new file mode 100644
index 000000000000..b556fbf6832a
--- /dev/null
+++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h
@@ -0,0 +1,48 @@
+//===- TextAPI/DylibReader.h - TAPI MachO Dylib Reader ----------*- 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// Defines the MachO Dynamic Library Reader.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TEXTAPI_DYLIBREADER_H
+#define LLVM_TEXTAPI_DYLIBREADER_H
+
+#include "llvm/Support/Error.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/TextAPI/ArchitectureSet.h"
+#include "llvm/TextAPI/RecordsSlice.h"
+
+namespace llvm::MachO::DylibReader {
+
+struct ParseOption {
+ /// Determines arch slice to parse.
+ ArchitectureSet Archs = ArchitectureSet::All();
+ /// Capture Mach-O header from binary, primarily load commands.
+ bool MachOHeader = true;
+ /// Capture defined symbols out of export trie and n-list.
+ bool SymbolTable = true;
+ /// Capture undefined symbols too.
+ bool Undefineds = true;
+};
+
+/// Parse Mach-O dynamic libraries to extract TAPI attributes.
+///
+/// \param Buffer Data that points to dylib.
+/// \param Options Determines which attributes to extract.
+/// \return List of record slices.
+Expected<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt);
+
+/// Get TAPI file representation of binary dylib.
+///
+/// \param Buffer Data that points to dylib.
+Expected<std::unique_ptr<InterfaceFile>> get(MemoryBufferRef Buffer);
+
+} // namespace llvm::MachO::DylibReader
+
+#endif // LLVM_TEXTAPI_DYLIBREADER_H
diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h
index 3b62af49902b..4bb1be9d0ad4 100644
--- a/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h
+++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TEXTAPI_RECORD_H
#define LLVM_TEXTAPI_RECORD_H
+#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/TextAPI/Symbol.h"
@@ -50,7 +51,7 @@ class Record {
public:
Record() = default;
Record(StringRef Name, RecordLinkage Linkage, SymbolFlags Flags)
- : Name(Name), Linkage(Linkage), Flags(Flags) {}
+ : Name(Name), Linkage(Linkage), Flags(mergeFlags(Flags, Linkage)) {}
bool isWeakDefined() const {
return (Flags & SymbolFlags::WeakDefined) == SymbolFlags::WeakDefined;
@@ -79,6 +80,10 @@ public:
bool isRexported() const { return Linkage == RecordLinkage::Rexported; }
StringRef getName() const { return Name; }
+ SymbolFlags getFlags() const { return Flags; }
+
+private:
+ SymbolFlags mergeFlags(SymbolFlags Flags, RecordLinkage Linkage);
protected:
StringRef Name;
@@ -103,6 +108,10 @@ public:
bool isFunction() const { return GV == Kind::Function; }
bool isVariable() const { return GV == Kind::Variable; }
+ void setKind(const Kind &V) {
+ if (GV == Kind::Unknown)
+ GV = V;
+ }
private:
Kind GV;
@@ -133,6 +142,7 @@ public:
ObjCIVarRecord *addObjCIVar(StringRef IVar, RecordLinkage Linkage);
ObjCIVarRecord *findObjCIVar(StringRef IVar) const;
+ std::vector<ObjCIVarRecord *> getObjCIVars() const;
private:
RecordMap<ObjCIVarRecord> IVars;
@@ -159,6 +169,7 @@ public:
bool hasExceptionAttribute() const { return HasEHType; }
bool addObjCCategory(ObjCCategoryRecord *Record);
+ std::vector<ObjCCategoryRecord *> getObjCCategories() const;
private:
bool HasEHType;
diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordVisitor.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordVisitor.h
new file mode 100644
index 000000000000..34e43f5b0027
--- /dev/null
+++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordVisitor.h
@@ -0,0 +1,54 @@
+//===- llvm/TextAPI/RecordSlice.h - TAPI RecordSlice ------------*- 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// Defines the TAPI Record Visitor.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TEXTAPI_RECORDVISITOR_H
+#define LLVM_TEXTAPI_RECORDVISITOR_H
+
+#include "llvm/TextAPI/Record.h"
+#include "llvm/TextAPI/SymbolSet.h"
+
+namespace llvm {
+namespace MachO {
+
+/// Base class for any usage of traversing over collected Records.
+class RecordVisitor {
+public:
+ virtual ~RecordVisitor();
+
+ virtual void visitGlobal(const GlobalRecord &) = 0;
+ virtual void visitObjCInterface(const ObjCInterfaceRecord &);
+ virtual void visitObjCCategory(const ObjCCategoryRecord &);
+};
+
+/// Specialized RecordVisitor for collecting exported symbols
+/// and undefined symbols if RecordSlice being visited represents a
+/// flat-namespaced library.
+class SymbolConverter : public RecordVisitor {
+public:
+ SymbolConverter(SymbolSet *Symbols, const Target &T,
+ const bool RecordUndefs = false)
+ : Symbols(Symbols), Targ(T), RecordUndefs(RecordUndefs) {}
+ void visitGlobal(const GlobalRecord &) override;
+ void visitObjCInterface(const ObjCInterfaceRecord &) override;
+ void visitObjCCategory(const ObjCCategoryRecord &) override;
+
+private:
+ void addIVars(const ArrayRef<ObjCIVarRecord *>, StringRef ContainerName);
+ SymbolSet *Symbols;
+ const Target Targ;
+ const bool RecordUndefs;
+};
+
+} // end namespace MachO.
+} // end namespace llvm.
+
+#endif // LLVM_TEXTAPI_RECORDVISITOR_H
diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h
index 8d733fd797ec..0f9e3fad1a30 100644
--- a/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h
+++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h
@@ -14,11 +14,11 @@
#ifndef LLVM_TEXTAPI_RECORDSLICE_H
#define LLVM_TEXTAPI_RECORDSLICE_H
-#include "llvm/ADT/MapVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/TextAPI/InterfaceFile.h"
#include "llvm/TextAPI/PackedVersion.h"
#include "llvm/TextAPI/Record.h"
+#include "llvm/TextAPI/RecordVisitor.h"
namespace llvm {
namespace MachO {
@@ -133,6 +133,9 @@ public:
Categories.empty();
}
+ // Visit all records known to RecordsSlice.
+ void visit(RecordVisitor &V) const;
+
struct BinaryAttrs {
std::vector<StringRef> AllowableClients;
std::vector<StringRef> RexportedLibraries;
@@ -174,6 +177,12 @@ private:
R->Linkage = std::max(R->Linkage, L);
}
+ /// Update set flags of requested record.
+ ///
+ /// \param R The global record to update.
+ /// \param F Flags to update to.
+ void updateFlags(GlobalRecord *R, SymbolFlags F) { R->Flags = F; }
+
RecordMap<GlobalRecord> Globals;
RecordMap<ObjCInterfaceRecord> Classes;
RecordMap<ObjCCategoryRecord, std::pair<StringRef, StringRef>> Categories;
@@ -181,6 +190,9 @@ private:
std::unique_ptr<BinaryAttrs> BA{nullptr};
};
+using Records = llvm::SmallVector<std::shared_ptr<RecordsSlice>, 4>;
+std::unique_ptr<InterfaceFile> convertToInterfaceFile(const Records &Slices);
+
} // namespace MachO
} // namespace llvm
#endif // LLVM_TEXTAPI_RECORDSLICE_H
diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h
index de19f7894d35..f0578654697b 100644
--- a/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h
+++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h
@@ -21,7 +21,8 @@ enum class TextAPIErrorCode {
NoSuchArchitecture,
EmptyResults,
GenericFrontendError,
- InvalidInputFormat
+ InvalidInputFormat,
+ UnsupportedTarget
};
class TextAPIError : public llvm::ErrorInfo<TextAPIError> {
diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/Utils.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/Utils.h
new file mode 100644
index 000000000000..bb22ea5e9606
--- /dev/null
+++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/Utils.h
@@ -0,0 +1,34 @@
+//===- llvm/TextAPI/Utils.h - TAPI Utils -----------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Helper functionality used for Darwin specific operations.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TEXTAPI_UTILS_H
+#define LLVM_TEXTAPI_UTILS_H
+
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+
+#if !defined(PATH_MAX)
+#define PATH_MAX 1024
+#endif
+
+namespace llvm::MachO {
+
+using PathSeq = std::vector<std::string>;
+
+/// Replace extension considering frameworks.
+///
+/// \param Path Location of file.
+/// \param Extension File extension to update with.
+void replace_extension(SmallVectorImpl<char> &Path, const Twine &Extension);
+} // namespace llvm::MachO
+#endif // LLVM_TEXTAPI_UTILS_H
diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h
index 50167708163e..30c51250af61 100644
--- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1157,6 +1157,12 @@ struct AnalysisGetter {
return nullptr;
}
+ /// Invalidates the analyses. Valid only when using the new pass manager.
+ void invalidateAnalyses() {
+ assert(FAM && "Can only be used from the new PM!");
+ FAM->clear();
+ }
+
AnalysisGetter(FunctionAnalysisManager &FAM, bool CachedOnly = false)
: FAM(&FAM), CachedOnly(CachedOnly) {}
AnalysisGetter(Pass *P, bool CachedOnly = false)
@@ -1286,6 +1292,10 @@ struct InformationCache {
return AssumeOnlyValues.contains(&I);
}
+ /// Invalidates the cached analyses. Valid only when using the new pass
+ /// manager.
+ void invalidateAnalyses() { AG.invalidateAnalyses(); }
+
/// Return the analysis result from a pass \p AP for function \p F.
template <typename AP>
typename AP::Result *getAnalysisResultForFunction(const Function &F,
diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
index 9a0abdfa8954..8bf902fc8d28 100644
--- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
+++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
@@ -114,9 +114,8 @@ public:
uint64_t CallsiteCount = 0;
LineLocation Callsite = Callee->getCallSiteLoc();
if (auto CallTargets = CallerSamples->findCallTargetMapAt(Callsite)) {
- SampleRecord::CallTargetMap &TargetCounts = CallTargets.get();
- auto It = TargetCounts.find(CalleeSamples->getFunction());
- if (It != TargetCounts.end())
+ auto It = CallTargets->find(CalleeSamples->getFunction());
+ if (It != CallTargets->end())
CallsiteCount = It->second;
}
Weight = std::max(CallsiteCount, CalleeEntryCount);
diff --git a/contrib/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp b/contrib/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp
index 2a45acf63aa2..5beac5547d65 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -6079,7 +6079,7 @@ static Value *simplifyRelativeLoad(Constant *Ptr, Constant *Offset,
Type *Int32Ty = Type::getInt32Ty(Ptr->getContext());
auto *OffsetConstInt = dyn_cast<ConstantInt>(Offset);
- if (!OffsetConstInt || OffsetConstInt->getType()->getBitWidth() > 64)
+ if (!OffsetConstInt || OffsetConstInt->getBitWidth() > 64)
return nullptr;
APInt OffsetInt = OffsetConstInt->getValue().sextOrTrunc(
diff --git a/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp b/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp
index 910f6b72afef..89cc7ea15ec1 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -1566,7 +1566,6 @@ void LazyValueInfoImpl::threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc,
bool LazyValueInfoWrapperPass::runOnFunction(Function &F) {
Info.AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
- Info.TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
if (auto *Impl = Info.getImpl())
Impl->clear();
@@ -1627,9 +1626,8 @@ void LazyValueInfoWrapperPass::releaseMemory() { Info.releaseMemory(); }
LazyValueInfo LazyValueAnalysis::run(Function &F,
FunctionAnalysisManager &FAM) {
auto &AC = FAM.getResult<AssumptionAnalysis>(F);
- auto &TLI = FAM.getResult<TargetLibraryAnalysis>(F);
- return LazyValueInfo(&AC, &F.getParent()->getDataLayout(), &TLI);
+ return LazyValueInfo(&AC, &F.getParent()->getDataLayout());
}
/// Returns true if we can statically tell that this value will never be a
@@ -1714,11 +1712,11 @@ ConstantRange LazyValueInfo::getConstantRangeOnEdge(Value *V,
static LazyValueInfo::Tristate
getPredicateResult(unsigned Pred, Constant *C, const ValueLatticeElement &Val,
- const DataLayout &DL, TargetLibraryInfo *TLI) {
+ const DataLayout &DL) {
// If we know the value is a constant, evaluate the conditional.
Constant *Res = nullptr;
if (Val.isConstant()) {
- Res = ConstantFoldCompareInstOperands(Pred, Val.getConstant(), C, DL, TLI);
+ Res = ConstantFoldCompareInstOperands(Pred, Val.getConstant(), C, DL);
if (ConstantInt *ResCI = dyn_cast_or_null<ConstantInt>(Res))
return ResCI->isZero() ? LazyValueInfo::False : LazyValueInfo::True;
return LazyValueInfo::Unknown;
@@ -1759,15 +1757,13 @@ getPredicateResult(unsigned Pred, Constant *C, const ValueLatticeElement &Val,
if (Pred == ICmpInst::ICMP_EQ) {
// !C1 == C -> false iff C1 == C.
Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE,
- Val.getNotConstant(), C, DL,
- TLI);
+ Val.getNotConstant(), C, DL);
if (Res && Res->isNullValue())
return LazyValueInfo::False;
} else if (Pred == ICmpInst::ICMP_NE) {
// !C1 != C -> true iff C1 == C.
Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE,
- Val.getNotConstant(), C, DL,
- TLI);
+ Val.getNotConstant(), C, DL);
if (Res && Res->isNullValue())
return LazyValueInfo::True;
}
@@ -1787,7 +1783,7 @@ LazyValueInfo::getPredicateOnEdge(unsigned Pred, Value *V, Constant *C,
ValueLatticeElement Result =
getOrCreateImpl(M).getValueOnEdge(V, FromBB, ToBB, CxtI);
- return getPredicateResult(Pred, C, Result, M->getDataLayout(), TLI);
+ return getPredicateResult(Pred, C, Result, M->getDataLayout());
}
LazyValueInfo::Tristate
@@ -1811,7 +1807,7 @@ LazyValueInfo::getPredicateAt(unsigned Pred, Value *V, Constant *C,
ValueLatticeElement Result =
UseBlockValue ? Impl.getValueInBlock(V, CxtI->getParent(), CxtI)
: Impl.getValueAt(V, CxtI);
- Tristate Ret = getPredicateResult(Pred, C, Result, DL, TLI);
+ Tristate Ret = getPredicateResult(Pred, C, Result, DL);
if (Ret != Unknown)
return Ret;
diff --git a/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 0894560fd078..89666018d925 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -143,7 +143,7 @@ static cl::opt<bool, true> HoistRuntimeChecks(
"hoist-runtime-checks", cl::Hidden,
cl::desc(
"Hoist inner loop runtime memory checks to outer loop if possible"),
- cl::location(VectorizerParams::HoistRuntimeChecks), cl::init(false));
+ cl::location(VectorizerParams::HoistRuntimeChecks), cl::init(true));
bool VectorizerParams::HoistRuntimeChecks;
bool VectorizerParams::isInterleaveForced() {
diff --git a/contrib/llvm-project/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/contrib/llvm-project/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 49eccde45f31..951e00e34142 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -1292,16 +1292,16 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
if (InsertRes.first->second != Pointer.getAddr()) {
// Make sure to clean up the Visited map before continuing on to
// PredTranslationFailure.
- for (unsigned i = 0; i < NewBlocks.size(); i++)
- Visited.erase(NewBlocks[i]);
+ for (auto *NewBlock : NewBlocks)
+ Visited.erase(NewBlock);
goto PredTranslationFailure;
}
}
if (NewBlocks.size() > WorklistEntries) {
// Make sure to clean up the Visited map before continuing on to
// PredTranslationFailure.
- for (unsigned i = 0; i < NewBlocks.size(); i++)
- Visited.erase(NewBlocks[i]);
+ for (auto *NewBlock : NewBlocks)
+ Visited.erase(NewBlock);
GotWorklistLimit = true;
goto PredTranslationFailure;
}
@@ -1359,8 +1359,8 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
// Make sure to clean up the Visited map before continuing on to
// PredTranslationFailure.
- for (unsigned i = 0, n = PredList.size(); i < n; ++i)
- Visited.erase(PredList[i].first);
+ for (const auto &Pred : PredList)
+ Visited.erase(Pred.first);
goto PredTranslationFailure;
}
@@ -1371,9 +1371,9 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
// any results for. (getNonLocalPointerDepFromBB will modify our
// datastructures in ways the code after the PredTranslationFailure label
// doesn't expect.)
- for (unsigned i = 0, n = PredList.size(); i < n; ++i) {
- BasicBlock *Pred = PredList[i].first;
- PHITransAddr &PredPointer = PredList[i].second;
+ for (auto &I : PredList) {
+ BasicBlock *Pred = I.first;
+ PHITransAddr &PredPointer = I.second;
Value *PredPtrVal = PredPointer.getAddr();
bool CanTranslate = true;
diff --git a/contrib/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp b/contrib/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp
index 580fe112fcd7..623814c038a7 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7914,9 +7914,10 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
// expression. We already checked that ShlAmt < BitWidth, so
// the multiplier, 1 << (ShlAmt - AShrAmt), fits into TruncTy as
// ShlAmt - AShrAmt < Amt.
- uint64_t ShlAmt = ShlAmtCI->getZExtValue();
- if (ShlAmtCI->getValue().ult(BitWidth) && ShlAmt >= AShrAmt) {
- APInt Mul = APInt::getOneBitSet(BitWidth - AShrAmt, ShlAmt - AShrAmt);
+ const APInt &ShlAmt = ShlAmtCI->getValue();
+ if (ShlAmt.ult(BitWidth) && ShlAmt.uge(AShrAmt)) {
+ APInt Mul = APInt::getOneBitSet(BitWidth - AShrAmt,
+ ShlAmtCI->getZExtValue() - AShrAmt);
const SCEV *CompositeExpr =
getMulExpr(AddTruncateExpr, getConstant(Mul));
if (L->getOpcode() != Instruction::Shl)
diff --git a/contrib/llvm-project/llvm/lib/Analysis/TargetLibraryInfo.cpp b/contrib/llvm-project/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 20959cf6948f..bbb7c86d2185 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -1149,6 +1149,16 @@ bool TargetLibraryInfoImpl::getLibFunc(const Function &FDecl,
return isValidProtoForLibFunc(*FDecl.getFunctionType(), F, *M);
}
+bool TargetLibraryInfoImpl::getLibFunc(unsigned int Opcode, Type *Ty,
+ LibFunc &F) const {
+ // Must be a frem instruction with float or double arguments.
+ if (Opcode != Instruction::FRem || (!Ty->isDoubleTy() && !Ty->isFloatTy()))
+ return false;
+
+ F = Ty->isDoubleTy() ? LibFunc_fmod : LibFunc_fmodf;
+ return true;
+}
+
void TargetLibraryInfoImpl::disableAllFunctions() {
memset(AvailableArray, 0, sizeof(AvailableArray));
}
diff --git a/contrib/llvm-project/llvm/lib/Analysis/VFABIDemangling.cpp b/contrib/llvm-project/llvm/lib/Analysis/VFABIDemangling.cpp
index ad918ef7245b..426f98c0c628 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/VFABIDemangling.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/VFABIDemangling.cpp
@@ -126,7 +126,7 @@ static ParseRet tryParseLinearTokenWithRuntimeStep(StringRef &ParseString,
return ParseRet::None;
}
-/// The function looks for the following stringt at the beginning of
+/// The function looks for the following string at the beginning of
/// the input string `ParseString`:
///
/// <token> <number>
@@ -376,7 +376,7 @@ std::optional<VFInfo> VFABI::tryDemangleForVFABI(StringRef MangledName,
// _ZGV<isa><mask><vlen><parameters>_<scalarname>.
StringRef VectorName = MangledName;
- // Parse the fixed size part of the manled name
+ // Parse the fixed size part of the mangled name
if (!MangledName.consume_front("_ZGV"))
return std::nullopt;
diff --git a/contrib/llvm-project/llvm/lib/Analysis/ValueTracking.cpp b/contrib/llvm-project/llvm/lib/Analysis/ValueTracking.cpp
index 9ae05a4b5ccc..cac2602d455f 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/ValueTracking.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/ValueTracking.cpp
@@ -1826,6 +1826,8 @@ void computeKnownBits(const Value *V, const APInt &DemandedElts,
Known.Zero &= ~Elt;
Known.One &= Elt;
}
+ if (Known.hasConflict())
+ Known.resetAll();
return;
}
@@ -1849,6 +1851,8 @@ void computeKnownBits(const Value *V, const APInt &DemandedElts,
Known.Zero &= ~Elt;
Known.One &= Elt;
}
+ if (Known.hasConflict())
+ Known.resetAll();
return;
}
@@ -2368,19 +2372,12 @@ static bool isNonZeroAdd(const APInt &DemandedElts, unsigned Depth,
static bool isNonZeroSub(const APInt &DemandedElts, unsigned Depth,
const SimplifyQuery &Q, unsigned BitWidth, Value *X,
Value *Y) {
+ // TODO: Move this case into isKnownNonEqual().
if (auto *C = dyn_cast<Constant>(X))
if (C->isNullValue() && isKnownNonZero(Y, DemandedElts, Depth, Q))
return true;
- KnownBits XKnown = computeKnownBits(X, DemandedElts, Depth, Q);
- if (XKnown.isUnknown())
- return false;
- KnownBits YKnown = computeKnownBits(Y, DemandedElts, Depth, Q);
- // If X != Y then X - Y is non zero.
- std::optional<bool> ne = KnownBits::ne(XKnown, YKnown);
- // If we are unable to compute if X != Y, we won't be able to do anything
- // computing the knownbits of the sub expression so just return here.
- return ne && *ne;
+ return ::isKnownNonEqual(X, Y, Depth, Q);
}
static bool isNonZeroShift(const Operator *I, const APInt &DemandedElts,
@@ -3191,11 +3188,12 @@ static bool isKnownNonEqual(const Value *V1, const Value *V2, unsigned Depth,
// Are any known bits in V1 contradictory to known bits in V2? If V1
// has a known zero where V2 has a known one, they must not be equal.
KnownBits Known1 = computeKnownBits(V1, Depth, Q);
- KnownBits Known2 = computeKnownBits(V2, Depth, Q);
-
- if (Known1.Zero.intersects(Known2.One) ||
- Known2.Zero.intersects(Known1.One))
- return true;
+ if (!Known1.isUnknown()) {
+ KnownBits Known2 = computeKnownBits(V2, Depth, Q);
+ if (Known1.Zero.intersects(Known2.One) ||
+ Known2.Zero.intersects(Known1.One))
+ return true;
+ }
}
if (isNonEqualSelect(V1, V2, Depth, Q) || isNonEqualSelect(V2, V1, Depth, Q))
@@ -3205,6 +3203,13 @@ static bool isKnownNonEqual(const Value *V1, const Value *V2, unsigned Depth,
isNonEqualPointersWithRecursiveGEP(V2, V1, Q))
return true;
+ Value *A, *B;
+ // PtrToInts are NonEqual if their Ptrs are NonEqual.
+ // Check PtrToInt type matches the pointer size.
+ if (match(V1, m_PtrToIntSameSize(Q.DL, m_Value(A))) &&
+ match(V2, m_PtrToIntSameSize(Q.DL, m_Value(B))))
+ return isKnownNonEqual(A, B, Depth + 1, Q);
+
return false;
}
@@ -6284,10 +6289,10 @@ static OverflowResult mapOverflowResult(ConstantRange::OverflowResult OR) {
}
/// Combine constant ranges from computeConstantRange() and computeKnownBits().
-static ConstantRange
-computeConstantRangeIncludingKnownBits(const WithCache<const Value *> &V,
- bool ForSigned,
- const SimplifyQuery &SQ) {
+ConstantRange
+llvm::computeConstantRangeIncludingKnownBits(const WithCache<const Value *> &V,
+ bool ForSigned,
+ const SimplifyQuery &SQ) {
ConstantRange CR1 =
ConstantRange::fromKnownBits(V.getKnownBits(SQ), ForSigned);
ConstantRange CR2 = computeConstantRange(V, ForSigned, SQ.IIQ.UseInstrInfo);
@@ -6555,10 +6560,25 @@ static bool shiftAmountKnownInRange(const Value *ShiftAmount) {
return Safe;
}
-static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly,
+enum class UndefPoisonKind {
+ PoisonOnly = (1 << 0),
+ UndefOnly = (1 << 1),
+ UndefOrPoison = PoisonOnly | UndefOnly,
+};
+
+static bool includesPoison(UndefPoisonKind Kind) {
+ return (unsigned(Kind) & unsigned(UndefPoisonKind::PoisonOnly)) != 0;
+}
+
+static bool includesUndef(UndefPoisonKind Kind) {
+ return (unsigned(Kind) & unsigned(UndefPoisonKind::UndefOnly)) != 0;
+}
+
+static bool canCreateUndefOrPoison(const Operator *Op, UndefPoisonKind Kind,
bool ConsiderFlagsAndMetadata) {
- if (ConsiderFlagsAndMetadata && Op->hasPoisonGeneratingFlagsOrMetadata())
+ if (ConsiderFlagsAndMetadata && includesPoison(Kind) &&
+ Op->hasPoisonGeneratingFlagsOrMetadata())
return true;
unsigned Opcode = Op->getOpcode();
@@ -6568,7 +6588,7 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly,
case Instruction::Shl:
case Instruction::AShr:
case Instruction::LShr:
- return !shiftAmountKnownInRange(Op->getOperand(1));
+ return includesPoison(Kind) && !shiftAmountKnownInRange(Op->getOperand(1));
case Instruction::FPToSI:
case Instruction::FPToUI:
// fptosi/ui yields poison if the resulting value does not fit in the
@@ -6609,7 +6629,8 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly,
return false;
case Intrinsic::sshl_sat:
case Intrinsic::ushl_sat:
- return !shiftAmountKnownInRange(II->getArgOperand(1));
+ return includesPoison(Kind) &&
+ !shiftAmountKnownInRange(II->getArgOperand(1));
case Intrinsic::fma:
case Intrinsic::fmuladd:
case Intrinsic::sqrt:
@@ -6664,18 +6685,16 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly,
auto *VTy = cast<VectorType>(Op->getOperand(0)->getType());
unsigned IdxOp = Op->getOpcode() == Instruction::InsertElement ? 2 : 1;
auto *Idx = dyn_cast<ConstantInt>(Op->getOperand(IdxOp));
- if (!Idx || Idx->getValue().uge(VTy->getElementCount().getKnownMinValue()))
- return true;
+ if (includesPoison(Kind))
+ return !Idx ||
+ Idx->getValue().uge(VTy->getElementCount().getKnownMinValue());
return false;
}
case Instruction::ShuffleVector: {
- // shufflevector may return undef.
- if (PoisonOnly)
- return false;
ArrayRef<int> Mask = isa<ConstantExpr>(Op)
? cast<ConstantExpr>(Op)->getShuffleMask()
: cast<ShuffleVectorInst>(Op)->getShuffleMask();
- return is_contained(Mask, PoisonMaskElem);
+ return includesPoison(Kind) && is_contained(Mask, PoisonMaskElem);
}
case Instruction::FNeg:
case Instruction::PHI:
@@ -6711,17 +6730,17 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly,
bool llvm::canCreateUndefOrPoison(const Operator *Op,
bool ConsiderFlagsAndMetadata) {
- return ::canCreateUndefOrPoison(Op, /*PoisonOnly=*/false,
+ return ::canCreateUndefOrPoison(Op, UndefPoisonKind::UndefOrPoison,
ConsiderFlagsAndMetadata);
}
bool llvm::canCreatePoison(const Operator *Op, bool ConsiderFlagsAndMetadata) {
- return ::canCreateUndefOrPoison(Op, /*PoisonOnly=*/true,
+ return ::canCreateUndefOrPoison(Op, UndefPoisonKind::PoisonOnly,
ConsiderFlagsAndMetadata);
}
-static bool directlyImpliesPoison(const Value *ValAssumedPoison,
- const Value *V, unsigned Depth) {
+static bool directlyImpliesPoison(const Value *ValAssumedPoison, const Value *V,
+ unsigned Depth) {
if (ValAssumedPoison == V)
return true;
@@ -6773,14 +6792,11 @@ bool llvm::impliesPoison(const Value *ValAssumedPoison, const Value *V) {
return ::impliesPoison(ValAssumedPoison, V, /* Depth */ 0);
}
-static bool programUndefinedIfUndefOrPoison(const Value *V,
- bool PoisonOnly);
+static bool programUndefinedIfUndefOrPoison(const Value *V, bool PoisonOnly);
-static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
- AssumptionCache *AC,
- const Instruction *CtxI,
- const DominatorTree *DT,
- unsigned Depth, bool PoisonOnly) {
+static bool isGuaranteedNotToBeUndefOrPoison(
+ const Value *V, AssumptionCache *AC, const Instruction *CtxI,
+ const DominatorTree *DT, unsigned Depth, UndefPoisonKind Kind) {
if (Depth >= MaxAnalysisRecursionDepth)
return false;
@@ -6795,16 +6811,19 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
}
if (auto *C = dyn_cast<Constant>(V)) {
+ if (isa<PoisonValue>(C))
+ return !includesPoison(Kind);
+
if (isa<UndefValue>(C))
- return PoisonOnly && !isa<PoisonValue>(C);
+ return !includesUndef(Kind);
if (isa<ConstantInt>(C) || isa<GlobalVariable>(C) || isa<ConstantFP>(V) ||
isa<ConstantPointerNull>(C) || isa<Function>(C))
return true;
if (C->getType()->isVectorTy() && !isa<ConstantExpr>(C))
- return (PoisonOnly ? !C->containsPoisonElement()
- : !C->containsUndefOrPoisonElement()) &&
+ return (!includesUndef(Kind) ? !C->containsPoisonElement()
+ : !C->containsUndefOrPoisonElement()) &&
!C->containsConstantExpression();
}
@@ -6822,8 +6841,7 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
return true;
auto OpCheck = [&](const Value *V) {
- return isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth + 1,
- PoisonOnly);
+ return isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth + 1, Kind);
};
if (auto *Opr = dyn_cast<Operator>(V)) {
@@ -6845,14 +6863,16 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
for (unsigned i = 0; i < Num; ++i) {
auto *TI = PN->getIncomingBlock(i)->getTerminator();
if (!isGuaranteedNotToBeUndefOrPoison(PN->getIncomingValue(i), AC, TI,
- DT, Depth + 1, PoisonOnly)) {
+ DT, Depth + 1, Kind)) {
IsWellDefined = false;
break;
}
}
if (IsWellDefined)
return true;
- } else if (!canCreateUndefOrPoison(Opr) && all_of(Opr->operands(), OpCheck))
+ } else if (!::canCreateUndefOrPoison(Opr, Kind,
+ /*ConsiderFlagsAndMetadata*/ true) &&
+ all_of(Opr->operands(), OpCheck))
return true;
}
@@ -6862,7 +6882,7 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
I->hasMetadata(LLVMContext::MD_dereferenceable_or_null))
return true;
- if (programUndefinedIfUndefOrPoison(V, PoisonOnly))
+ if (programUndefinedIfUndefOrPoison(V, !includesUndef(Kind)))
return true;
// CxtI may be null or a cloned instruction.
@@ -6894,7 +6914,7 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
if (Cond) {
if (Cond == V)
return true;
- else if (PoisonOnly && isa<Operator>(Cond)) {
+ else if (!includesUndef(Kind) && isa<Operator>(Cond)) {
// For poison, we can analyze further
auto *Opr = cast<Operator>(Cond);
if (any_of(Opr->operands(),
@@ -6916,20 +6936,22 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V, AssumptionCache *AC,
const Instruction *CtxI,
const DominatorTree *DT,
unsigned Depth) {
- return ::isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth, false);
+ return ::isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth,
+ UndefPoisonKind::UndefOrPoison);
}
bool llvm::isGuaranteedNotToBePoison(const Value *V, AssumptionCache *AC,
const Instruction *CtxI,
const DominatorTree *DT, unsigned Depth) {
- return ::isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth, true);
+ return ::isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth,
+ UndefPoisonKind::PoisonOnly);
}
bool llvm::isGuaranteedNotToBeUndef(const Value *V, AssumptionCache *AC,
const Instruction *CtxI,
const DominatorTree *DT, unsigned Depth) {
- // TODO: This is currently equivalent to isGuaranteedNotToBeUndefOrPoison().
- return ::isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth, false);
+ return ::isGuaranteedNotToBeUndefOrPoison(V, AC, CtxI, DT, Depth,
+ UndefPoisonKind::UndefOnly);
}
/// Return true if undefined behavior would provably be executed on the path to
diff --git a/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp b/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
index 91d8c31fa062..f90fca9d937f 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp
@@ -12,6 +12,7 @@
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/ADT/EquivalenceClasses.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopIterator.h"
@@ -20,6 +21,7 @@
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Value.h"
@@ -1477,6 +1479,32 @@ void VFABI::getVectorVariantNames(
}
}
+FunctionType *VFABI::createFunctionType(const VFInfo &Info,
+ const FunctionType *ScalarFTy) {
+ // Create vector parameter types
+ SmallVector<Type *, 8> VecTypes;
+ ElementCount VF = Info.Shape.VF;
+ int ScalarParamIndex = 0;
+ for (auto VFParam : Info.Shape.Parameters) {
+ if (VFParam.ParamKind == VFParamKind::GlobalPredicate) {
+ VectorType *MaskTy =
+ VectorType::get(Type::getInt1Ty(ScalarFTy->getContext()), VF);
+ VecTypes.push_back(MaskTy);
+ continue;
+ }
+
+ Type *OperandTy = ScalarFTy->getParamType(ScalarParamIndex++);
+ if (VFParam.ParamKind == VFParamKind::Vector)
+ OperandTy = VectorType::get(OperandTy, VF);
+ VecTypes.push_back(OperandTy);
+ }
+
+ auto *RetTy = ScalarFTy->getReturnType();
+ if (!RetTy->isVoidTy())
+ RetTy = VectorType::get(RetTy, VF);
+ return FunctionType::get(RetTy, VecTypes, false);
+}
+
bool VFShape::hasValidParameterList() const {
for (unsigned Pos = 0, NumParams = Parameters.size(); Pos < NumParams;
++Pos) {
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
index d6f487c18b03..30ea7eef3a12 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
@@ -412,7 +412,7 @@ static uint32_t constructAbbreviationTag(
const std::optional<DWARF5AccelTable::UnitIndexAndEncoding> &EntryRet) {
uint32_t AbbrvTag = 0;
if (EntryRet)
- AbbrvTag |= 1 << EntryRet->Endoding.Index;
+ AbbrvTag |= 1 << EntryRet->Encoding.Index;
AbbrvTag |= 1 << dwarf::DW_IDX_die_offset;
AbbrvTag |= Tag << LowerBitSize;
return AbbrvTag;
@@ -429,7 +429,7 @@ void Dwarf5AccelTableWriter<DataT>::populateAbbrevsMap() {
if (Abbreviations.count(AbbrvTag) == 0) {
SmallVector<DWARF5AccelTableData::AttributeEncoding, 2> UA;
if (EntryRet)
- UA.push_back(EntryRet->Endoding);
+ UA.push_back(EntryRet->Encoding);
UA.push_back({dwarf::DW_IDX_die_offset, dwarf::DW_FORM_ref4});
Abbreviations.try_emplace(AbbrvTag, UA);
}
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 61309c51336e..4dd27702786e 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -583,6 +583,7 @@ bool AsmPrinter::doInitialization(Module &M) {
[[fallthrough]];
case ExceptionHandling::SjLj:
case ExceptionHandling::DwarfCFI:
+ case ExceptionHandling::ZOS:
ES = new DwarfCFIException(this);
break;
case ExceptionHandling::ARM:
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 87a0ba58b14c..9037f752dc4f 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -1375,16 +1375,9 @@ bool InstrRefBasedLDV::transferDebugValue(const MachineInstr &MI) {
if (!MI.isDebugValue())
return false;
- const DILocalVariable *Var = MI.getDebugVariable();
- const DIExpression *Expr = MI.getDebugExpression();
- const DILocation *DebugLoc = MI.getDebugLoc();
- const DILocation *InlinedAt = DebugLoc->getInlinedAt();
- assert(Var->isValidLocationForIntrinsic(DebugLoc) &&
+ assert(MI.getDebugVariable()->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
"Expected inlined-at fields to agree");
- DebugVariable V(Var, Expr, InlinedAt);
- DbgValueProperties Properties(MI);
-
// If there are no instructions in this lexical scope, do no location tracking
// at all, this variable shouldn't get a legitimate location range.
auto *Scope = LS.findLexicalScope(MI.getDebugLoc().get());
@@ -1417,7 +1410,7 @@ bool InstrRefBasedLDV::transferDebugValue(const MachineInstr &MI) {
}
}
}
- VTracker->defVar(MI, Properties, DebugOps);
+ VTracker->defVar(MI, DbgValueProperties(MI), DebugOps);
}
// If performing final tracking of transfers, report this variable definition
@@ -2420,7 +2413,7 @@ bool InstrRefBasedLDV::mlocJoin(
// Pick out the first predecessors live-out value for this location. It's
// guaranteed to not be a backedge, as we order by RPO.
- ValueIDNum FirstVal = OutLocs[BlockOrders[0]->getNumber()][Idx.asU64()];
+ ValueIDNum FirstVal = OutLocs[*BlockOrders[0]][Idx.asU64()];
// If we've already eliminated a PHI here, do no further checking, just
// propagate the first live-in value into this block.
@@ -2437,8 +2430,7 @@ bool InstrRefBasedLDV::mlocJoin(
bool Disagree = false;
for (unsigned int I = 1; I < BlockOrders.size(); ++I) {
const MachineBasicBlock *PredMBB = BlockOrders[I];
- const ValueIDNum &PredLiveOut =
- OutLocs[PredMBB->getNumber()][Idx.asU64()];
+ const ValueIDNum &PredLiveOut = OutLocs[*PredMBB][Idx.asU64()];
// Incoming values agree, continue trying to eliminate this PHI.
if (FirstVal == PredLiveOut)
@@ -2563,7 +2555,7 @@ void InstrRefBasedLDV::placeMLocPHIs(
auto InstallPHIsAtLoc = [&PHIBlocks, &MInLocs](LocIdx L) {
for (const MachineBasicBlock *MBB : PHIBlocks)
- MInLocs[MBB->getNumber()][L.asU64()] = ValueIDNum(MBB->getNumber(), 0, L);
+ MInLocs[*MBB][L.asU64()] = ValueIDNum(MBB->getNumber(), 0, L);
};
// For locations with no reg units, just place PHIs.
@@ -2642,7 +2634,8 @@ void InstrRefBasedLDV::buildMLocValueMap(
// Initialize entry block to PHIs. These represent arguments.
for (auto Location : MTracker->locations())
- MInLocs[0][Location.Idx.asU64()] = ValueIDNum(0, 0, Location.Idx);
+ MInLocs.tableForEntryMBB()[Location.Idx.asU64()] =
+ ValueIDNum(0, 0, Location.Idx);
MTracker->reset();
@@ -2671,7 +2664,7 @@ void InstrRefBasedLDV::buildMLocValueMap(
// Join the values in all predecessor blocks.
bool InLocsChanged;
- InLocsChanged = mlocJoin(*MBB, Visited, MOutLocs, MInLocs[CurBB]);
+ InLocsChanged = mlocJoin(*MBB, Visited, MOutLocs, MInLocs[*MBB]);
InLocsChanged |= Visited.insert(MBB).second;
// Don't examine transfer function if we've visited this loc at least
@@ -2680,7 +2673,7 @@ void InstrRefBasedLDV::buildMLocValueMap(
continue;
// Load the current set of live-ins into MLocTracker.
- MTracker->loadFromArray(MInLocs[CurBB], CurBB);
+ MTracker->loadFromArray(MInLocs[*MBB], CurBB);
// Each element of the transfer function can be a new def, or a read of
// a live-in value. Evaluate each element, and store to "ToRemap".
@@ -2707,8 +2700,8 @@ void InstrRefBasedLDV::buildMLocValueMap(
// the transfer function, and mlocJoin.
bool OLChanged = false;
for (auto Location : MTracker->locations()) {
- OLChanged |= MOutLocs[CurBB][Location.Idx.asU64()] != Location.Value;
- MOutLocs[CurBB][Location.Idx.asU64()] = Location.Value;
+ OLChanged |= MOutLocs[*MBB][Location.Idx.asU64()] != Location.Value;
+ MOutLocs[*MBB][Location.Idx.asU64()] = Location.Value;
}
MTracker->reset();
@@ -2851,7 +2844,6 @@ std::optional<ValueIDNum> InstrRefBasedLDV::pickOperandPHILoc(
unsigned NumLocs = MTracker->getNumLocs();
for (const auto p : BlockOrders) {
- unsigned ThisBBNum = p->getNumber();
auto OutValIt = LiveOuts.find(p);
assert(OutValIt != LiveOuts.end());
const DbgValue &OutVal = *OutValIt->second;
@@ -2870,7 +2862,7 @@ std::optional<ValueIDNum> InstrRefBasedLDV::pickOperandPHILoc(
ValueIDNum ValToLookFor = OutValOp.ID;
// Search the live-outs of the predecessor for the specified value.
for (unsigned int I = 0; I < NumLocs; ++I) {
- if (MOutLocs[ThisBBNum][I] == ValToLookFor)
+ if (MOutLocs[*p][I] == ValToLookFor)
Locs.back().push_back(LocIdx(I));
}
} else {
@@ -2883,7 +2875,7 @@ std::optional<ValueIDNum> InstrRefBasedLDV::pickOperandPHILoc(
// machine-value PHI locations.
for (unsigned int I = 0; I < NumLocs; ++I) {
ValueIDNum MPHI(MBB.getNumber(), 0, LocIdx(I));
- if (MOutLocs[ThisBBNum][I] == MPHI)
+ if (MOutLocs[*p][I] == MPHI)
Locs.back().push_back(LocIdx(I));
}
}
@@ -3505,19 +3497,15 @@ bool InstrRefBasedLDV::depthFirstVLocAndEmit(
// Helper lambda for ejecting a block -- if nothing is going to use the block,
// we can translate the variable location information into DBG_VALUEs and then
// free all of InstrRefBasedLDV's data structures.
- SmallPtrSet<const MachineBasicBlock *, 8> EjectedBBs;
auto EjectBlock = [&](MachineBasicBlock &MBB) -> void {
- if (EjectedBBs.insert(&MBB).second == false)
- return;
unsigned BBNum = MBB.getNumber();
AllTheVLocs[BBNum].clear();
// Prime the transfer-tracker, and then step through all the block
// instructions, installing transfers.
MTracker->reset();
- MTracker->loadFromArray(MInLocs[BBNum], BBNum);
- TTracker->loadInlocs(MBB, MInLocs[BBNum], DbgOpStore, Output[BBNum],
- NumLocs);
+ MTracker->loadFromArray(MInLocs[MBB], BBNum);
+ TTracker->loadInlocs(MBB, MInLocs[MBB], DbgOpStore, Output[BBNum], NumLocs);
CurBB = BBNum;
CurInst = 1;
@@ -3528,8 +3516,8 @@ bool InstrRefBasedLDV::depthFirstVLocAndEmit(
}
// Free machine-location tables for this block.
- MInLocs[BBNum] = ValueTable();
- MOutLocs[BBNum] = ValueTable();
+ MInLocs.ejectTableForBlock(MBB);
+ MOutLocs.ejectTableForBlock(MBB);
// We don't need live-in variable values for this block either.
Output[BBNum].clear();
AllTheVLocs[BBNum].clear();
@@ -3594,7 +3582,8 @@ bool InstrRefBasedLDV::depthFirstVLocAndEmit(
// anything for such out-of-scope blocks, but for the sake of being similar
// to VarLocBasedLDV, eject these too.
for (auto *MBB : ArtificialBlocks)
- EjectBlock(*MBB);
+ if (MInLocs.hasTableFor(*MBB))
+ EjectBlock(*MBB);
return emitTransfers(AllVarsNumbering);
}
@@ -3693,8 +3682,8 @@ bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF,
// machine values. The outer dimension is the block number; while the inner
// dimension is a LocIdx from MLocTracker.
unsigned NumLocs = MTracker->getNumLocs();
- FuncValueTable MOutLocs(MaxNumBlocks, ValueTable(NumLocs));
- FuncValueTable MInLocs(MaxNumBlocks, ValueTable(NumLocs));
+ FuncValueTable MOutLocs(MaxNumBlocks, NumLocs);
+ FuncValueTable MInLocs(MaxNumBlocks, NumLocs);
// Solve the machine value dataflow problem using the MLocTransfer function,
// storing the computed live-ins / live-outs into the array-of-arrays. We use
@@ -3732,7 +3721,7 @@ bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF,
CurBB = MBB.getNumber();
VTracker = &vlocs[CurBB];
VTracker->MBB = &MBB;
- MTracker->loadFromArray(MInLocs[CurBB], CurBB);
+ MTracker->loadFromArray(MInLocs[MBB], CurBB);
CurInst = 1;
for (auto &MI : MBB) {
process(MI, &MOutLocs, &MInLocs);
@@ -3946,7 +3935,7 @@ public:
/// Find the live-in value number for the given block. Looks up the value at
/// the PHI location on entry.
BlockValueNum getValue(LDVSSABlock *LDVBB) {
- return MLiveIns[LDVBB->BB.getNumber()][Loc.asU64()].asU64();
+ return MLiveIns[LDVBB->BB][Loc.asU64()].asU64();
}
};
@@ -4186,8 +4175,7 @@ std::optional<ValueIDNum> InstrRefBasedLDV::resolveDbgPHIsImpl(
});
for (auto &PHI : SortedPHIs) {
- ValueIDNum ThisBlockValueNum =
- MLiveIns[PHI->ParentBlock->BB.getNumber()][Loc.asU64()];
+ ValueIDNum ThisBlockValueNum = MLiveIns[PHI->ParentBlock->BB][Loc.asU64()];
// Are all these things actually defined?
for (auto &PHIIt : PHI->IncomingValues) {
@@ -4196,7 +4184,7 @@ std::optional<ValueIDNum> InstrRefBasedLDV::resolveDbgPHIsImpl(
return std::nullopt;
ValueIDNum ValueToCheck;
- const ValueTable &BlockLiveOuts = MLiveOuts[PHIIt.first->BB.getNumber()];
+ const ValueTable &BlockLiveOuts = MLiveOuts[PHIIt.first->BB];
auto VVal = ValidatedValues.find(PHIIt.first);
if (VVal == ValidatedValues.end()) {
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index d6dbb1feda3e..ccc284b62331 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/contrib/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -207,9 +207,48 @@ using namespace llvm;
/// Type for a table of values in a block.
using ValueTable = SmallVector<ValueIDNum, 0>;
-/// Type for a table-of-table-of-values, i.e., the collection of either
-/// live-in or live-out values for each block in the function.
-using FuncValueTable = SmallVector<ValueTable, 0>;
+/// A collection of ValueTables, one per BB in a function, with convenient
+/// accessor methods.
+struct FuncValueTable {
+ FuncValueTable(int NumBBs, int NumLocs) {
+ Storage.reserve(NumBBs);
+ for (int i = 0; i != NumBBs; ++i)
+ Storage.push_back(
+ std::make_unique<ValueTable>(NumLocs, ValueIDNum::EmptyValue));
+ }
+
+ /// Returns the ValueTable associated with MBB.
+ ValueTable &operator[](const MachineBasicBlock &MBB) const {
+ return (*this)[MBB.getNumber()];
+ }
+
+ /// Returns the ValueTable associated with the MachineBasicBlock whose number
+ /// is MBBNum.
+ ValueTable &operator[](int MBBNum) const {
+ auto &TablePtr = Storage[MBBNum];
+ assert(TablePtr && "Trying to access a deleted table");
+ return *TablePtr;
+ }
+
+ /// Returns the ValueTable associated with the entry MachineBasicBlock.
+ ValueTable &tableForEntryMBB() const { return (*this)[0]; }
+
+ /// Returns true if the ValueTable associated with MBB has not been freed.
+ bool hasTableFor(MachineBasicBlock &MBB) const {
+ return Storage[MBB.getNumber()] != nullptr;
+ }
+
+ /// Frees the memory of the ValueTable associated with MBB.
+ void ejectTableForBlock(const MachineBasicBlock &MBB) {
+ Storage[MBB.getNumber()].reset();
+ }
+
+private:
+ /// ValueTables are stored as unique_ptrs to allow for deallocation during
+ /// LDV; this was measured to have a significant impact on compiler memory
+ /// usage.
+ SmallVector<std::unique_ptr<ValueTable>, 0> Storage;
+};
/// Thin wrapper around an integer -- designed to give more type safety to
/// spill location numbers.
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/LiveRangeEdit.cpp b/contrib/llvm-project/llvm/lib/CodeGen/LiveRangeEdit.cpp
index 0203034b5a01..643370f0573d 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -426,8 +426,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) {
// Erase any virtregs that are now empty and unused. There may be <undef>
// uses around. Keep the empty live range in that case.
- for (unsigned i = 0, e = RegsToErase.size(); i != e; ++i) {
- Register Reg = RegsToErase[i];
+ for (Register Reg : RegsToErase) {
if (LIS.hasInterval(Reg) && MRI.reg_nodbg_empty(Reg)) {
ToShrink.remove(&LIS.getInterval(Reg));
eraseVirtReg(Reg);
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/LowerEmuTLS.cpp b/contrib/llvm-project/llvm/lib/CodeGen/LowerEmuTLS.cpp
index f3b5069d351b..af0b0a20c856 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/LowerEmuTLS.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/LowerEmuTLS.cpp
@@ -13,7 +13,11 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/CodeGen/LowerEmuTLS.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Analysis/GlobalsModRef.h"
+#include "llvm/Analysis/ModuleSummaryAnalysis.h"
+#include "llvm/Analysis/StackSafetyAnalysis.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/Constants.h"
@@ -24,7 +28,7 @@
using namespace llvm;
-#define DEBUG_TYPE "loweremutls"
+#define DEBUG_TYPE "lower-emutls"
namespace {
@@ -36,22 +40,41 @@ public:
}
bool runOnModule(Module &M) override;
-private:
- bool addEmuTlsVar(Module &M, const GlobalVariable *GV);
- static void copyLinkageVisibility(Module &M,
- const GlobalVariable *from,
- GlobalVariable *to) {
- to->setLinkage(from->getLinkage());
- to->setVisibility(from->getVisibility());
- to->setDSOLocal(from->isDSOLocal());
- if (from->hasComdat()) {
- to->setComdat(M.getOrInsertComdat(to->getName()));
- to->getComdat()->setSelectionKind(from->getComdat()->getSelectionKind());
- }
- }
};
}
+static bool addEmuTlsVar(Module &M, const GlobalVariable *GV);
+
+static void copyLinkageVisibility(Module &M, const GlobalVariable *from,
+ GlobalVariable *to) {
+ to->setLinkage(from->getLinkage());
+ to->setVisibility(from->getVisibility());
+ to->setDSOLocal(from->isDSOLocal());
+ if (from->hasComdat()) {
+ to->setComdat(M.getOrInsertComdat(to->getName()));
+ to->getComdat()->setSelectionKind(from->getComdat()->getSelectionKind());
+ }
+}
+
+PreservedAnalyses LowerEmuTLSPass::run(Module &M, ModuleAnalysisManager &MAM) {
+ bool Changed = false;
+ SmallVector<const GlobalVariable *, 8> TlsVars;
+ for (const auto &G : M.globals()) {
+ if (G.isThreadLocal())
+ TlsVars.push_back(&G);
+ }
+ for (const auto *G : TlsVars)
+ Changed |= addEmuTlsVar(M, G);
+
+ if (!Changed)
+ return PreservedAnalyses::all();
+ PreservedAnalyses PA = PreservedAnalyses::all();
+ PA.abandon<GlobalsAA>();
+ PA.abandon<ModuleSummaryIndexAnalysis>();
+ PA.abandon<StackSafetyGlobalAnalysis>();
+ return PA;
+}
+
char LowerEmuTLS::ID = 0;
INITIALIZE_PASS(LowerEmuTLS, DEBUG_TYPE,
@@ -83,7 +106,7 @@ bool LowerEmuTLS::runOnModule(Module &M) {
return Changed;
}
-bool LowerEmuTLS::addEmuTlsVar(Module &M, const GlobalVariable *GV) {
+bool addEmuTlsVar(Module &M, const GlobalVariable *GV) {
LLVMContext &C = M.getContext();
PointerType *VoidPtrType = PointerType::getUnqual(C);
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp
index b9db34f7be95..6eeed8b5c3f7 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp
@@ -208,8 +208,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
}
SmallSet<Register, 32> Added;
- for (unsigned i = 0, e = LocalDefs.size(); i != e; ++i) {
- Register Reg = LocalDefs[i];
+ for (Register Reg : LocalDefs) {
if (Added.insert(Reg).second) {
// If it's not live beyond end of the bundle, mark it dead.
bool isDead = DeadDefSet.count(Reg) || KilledDefSet.count(Reg);
@@ -218,8 +217,7 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,
}
}
- for (unsigned i = 0, e = ExternUses.size(); i != e; ++i) {
- Register Reg = ExternUses[i];
+ for (Register Reg : ExternUses) {
bool isKill = KilledUseSet.count(Reg);
bool isUndef = UndefUseSet.count(Reg);
MIB.addReg(Reg, getKillRegState(isKill) | getUndefRegState(isUndef) |
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp
index aff4d95781f4..5bd6ca0978a4 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/MacroFusion.cpp
@@ -212,15 +212,9 @@ bool MacroFusion::scheduleAdjacentImpl(ScheduleDAGInstrs &DAG, SUnit &AnchorSU)
}
std::unique_ptr<ScheduleDAGMutation>
-llvm::createMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates) {
+llvm::createMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates,
+ bool BranchOnly) {
if (EnableMacroFusion)
- return std::make_unique<MacroFusion>(Predicates, true);
- return nullptr;
-}
-
-std::unique_ptr<ScheduleDAGMutation> llvm::createBranchMacroFusionDAGMutation(
- ArrayRef<MacroFusionPredTy> Predicates) {
- if (EnableMacroFusion)
- return std::make_unique<MacroFusion>(Predicates, false);
+ return std::make_unique<MacroFusion>(Predicates, !BranchOnly);
return nullptr;
}
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/RegAllocFast.cpp b/contrib/llvm-project/llvm/lib/CodeGen/RegAllocFast.cpp
index 40c42cabf776..e81d47930136 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -62,6 +62,118 @@ static RegisterRegAlloc fastRegAlloc("fast", "fast register allocator",
namespace {
+/// Assign ascending index for instructions in machine basic block. The index
+/// can be used to determine dominance between instructions in same MBB.
+class InstrPosIndexes {
+public:
+ void unsetInitialized() { IsInitialized = false; }
+
+ void init(const MachineBasicBlock &MBB) {
+ CurMBB = &MBB;
+ Instr2PosIndex.clear();
+ uint64_t LastIndex = 0;
+ for (const MachineInstr &MI : MBB) {
+ LastIndex += InstrDist;
+ Instr2PosIndex[&MI] = LastIndex;
+ }
+ }
+
+ /// Set \p Index to index of \p MI. If \p MI is new inserted, it try to assign
+ /// index without affecting existing instruction's index. Return true if all
+ /// instructions index has been reassigned.
+ bool getIndex(const MachineInstr &MI, uint64_t &Index) {
+ if (!IsInitialized) {
+ init(*MI.getParent());
+ IsInitialized = true;
+ Index = Instr2PosIndex.at(&MI);
+ return true;
+ }
+
+ assert(MI.getParent() == CurMBB && "MI is not in CurMBB");
+ auto It = Instr2PosIndex.find(&MI);
+ if (It != Instr2PosIndex.end()) {
+ Index = It->second;
+ return false;
+ }
+
+ // Distance is the number of consecutive unassigned instructions including
+ // MI. Start is the first instruction of them. End is the next of last
+ // instruction of them.
+ // e.g.
+ // |Instruction| A | B | C | MI | D | E |
+ // | Index | 1024 | | | | | 2048 |
+ //
+ // In this case, B, C, MI, D are unassigned. Distance is 4, Start is B, End
+ // is E.
+ unsigned Distance = 1;
+ MachineBasicBlock::const_iterator Start = MI.getIterator(),
+ End = std::next(Start);
+ while (Start != CurMBB->begin() &&
+ !Instr2PosIndex.count(&*std::prev(Start))) {
+ --Start;
+ ++Distance;
+ }
+ while (End != CurMBB->end() && !Instr2PosIndex.count(&*(End))) {
+ ++End;
+ ++Distance;
+ }
+
+ // LastIndex is initialized to last used index prior to MI or zero.
+ // In previous example, LastIndex is 1024, EndIndex is 2048;
+ uint64_t LastIndex =
+ Start == CurMBB->begin() ? 0 : Instr2PosIndex.at(&*std::prev(Start));
+ uint64_t Step;
+ if (End == CurMBB->end())
+ Step = static_cast<uint64_t>(InstrDist);
+ else {
+ // No instruction uses index zero.
+ uint64_t EndIndex = Instr2PosIndex.at(&*End);
+ assert(EndIndex > LastIndex && "Index must be ascending order");
+ unsigned NumAvailableIndexes = EndIndex - LastIndex - 1;
+ // We want index gap between two adjacent MI is as same as possible. Given
+ // total A available indexes, D is number of consecutive unassigned
+ // instructions, S is the step.
+ // |<- S-1 -> MI <- S-1 -> MI <- A-S*D ->|
+ // There're S-1 available indexes between unassigned instruction and its
+ // predecessor. There're A-S*D available indexes between the last
+ // unassigned instruction and its successor.
+ // Ideally, we want
+ // S-1 = A-S*D
+ // then
+ // S = (A+1)/(D+1)
+ // An valid S must be integer greater than zero, so
+ // S <= (A+1)/(D+1)
+ // =>
+ // A-S*D >= 0
+ // That means we can safely use (A+1)/(D+1) as step.
+ // In previous example, Step is 204, Index of B, C, MI, D is 1228, 1432,
+ // 1636, 1840.
+ Step = (NumAvailableIndexes + 1) / (Distance + 1);
+ }
+
+ // Reassign index for all instructions if number of new inserted
+ // instructions exceed slot or all instructions are new.
+ if (LLVM_UNLIKELY(!Step || (!LastIndex && Step == InstrDist))) {
+ init(*CurMBB);
+ Index = Instr2PosIndex.at(&MI);
+ return true;
+ }
+
+ for (auto I = Start; I != End; ++I) {
+ LastIndex += Step;
+ Instr2PosIndex[&*I] = LastIndex;
+ }
+ Index = Instr2PosIndex.at(&MI);
+ return false;
+ }
+
+private:
+ bool IsInitialized = false;
+ enum { InstrDist = 1024 };
+ const MachineBasicBlock *CurMBB = nullptr;
+ DenseMap<const MachineInstr *, uint64_t> Instr2PosIndex;
+};
+
class RegAllocFast : public MachineFunctionPass {
public:
static char ID;
@@ -153,6 +265,9 @@ private:
// Register masks attached to the current instruction.
SmallVector<const uint32_t *> RegMasks;
+ // Assign index for each instruction to quickly determine dominance.
+ InstrPosIndexes PosIndexes;
+
void setPhysRegState(MCPhysReg PhysReg, unsigned NewState);
bool isPhysRegFree(MCPhysReg PhysReg) const;
@@ -339,18 +454,13 @@ int RegAllocFast::getStackSpaceFor(Register VirtReg) {
return FrameIdx;
}
-static bool dominates(MachineBasicBlock &MBB,
- MachineBasicBlock::const_iterator A,
- MachineBasicBlock::const_iterator B) {
- auto MBBEnd = MBB.end();
- if (B == MBBEnd)
- return true;
-
- MachineBasicBlock::const_iterator I = MBB.begin();
- for (; &*I != A && &*I != B; ++I)
- ;
-
- return &*I == A;
+static bool dominates(InstrPosIndexes &PosIndexes, const MachineInstr &A,
+ const MachineInstr &B) {
+ uint64_t IndexA, IndexB;
+ PosIndexes.getIndex(A, IndexA);
+ if (LLVM_UNLIKELY(PosIndexes.getIndex(B, IndexB)))
+ PosIndexes.getIndex(A, IndexA);
+ return IndexA < IndexB;
}
/// Returns false if \p VirtReg is known to not live out of the current block.
@@ -371,7 +481,7 @@ bool RegAllocFast::mayLiveOut(Register VirtReg) {
MayLiveAcrossBlocks.set(Register::virtReg2Index(VirtReg));
return true;
} else {
- if (!SelfLoopDef || dominates(*MBB, DefInst.getIterator(), SelfLoopDef))
+ if (!SelfLoopDef || dominates(PosIndexes, DefInst, *SelfLoopDef))
SelfLoopDef = &DefInst;
}
}
@@ -396,7 +506,7 @@ bool RegAllocFast::mayLiveOut(Register VirtReg) {
// Try to handle some simple cases to avoid spilling and reloading every
// value inside a self looping block.
if (SelfLoopDef == &UseInst ||
- !dominates(*MBB, SelfLoopDef->getIterator(), UseInst.getIterator())) {
+ !dominates(PosIndexes, *SelfLoopDef, UseInst)) {
MayLiveAcrossBlocks.set(Register::virtReg2Index(VirtReg));
return true;
}
@@ -1565,6 +1675,7 @@ void RegAllocFast::allocateBasicBlock(MachineBasicBlock &MBB) {
this->MBB = &MBB;
LLVM_DEBUG(dbgs() << "\nAllocating " << MBB);
+ PosIndexes.unsetInitialized();
RegUnitStates.assign(TRI->getNumRegUnits(), regFree);
assert(LiveVirtRegs.empty() && "Mapping not cleared from last block?");
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/RegisterClassInfo.cpp b/contrib/llvm-project/llvm/lib/CodeGen/RegisterClassInfo.cpp
index fba8c35ecec2..17a9f55cccc0 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/RegisterClassInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/RegisterClassInfo.cpp
@@ -165,8 +165,7 @@ void RegisterClassInfo::compute(const TargetRegisterClass *RC) const {
assert(RCI.NumRegs <= NumRegs && "Allocation order larger than regclass");
// CSR aliases go after the volatile registers, preserve the target's order.
- for (unsigned i = 0, e = CSRAlias.size(); i != e; ++i) {
- unsigned PhysReg = CSRAlias[i];
+ for (unsigned PhysReg : CSRAlias) {
uint8_t Cost = RegCosts[PhysReg];
if (Cost != LastCost)
LastCostChange = N;
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp b/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp
index c1af37c8510f..3fbb93795075 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -305,7 +305,11 @@ namespace {
/// number if it is not zero. If DstReg is a physical register and the
/// existing subregister number of the def / use being updated is not zero,
/// make sure to set it to the correct physical subregister.
- void updateRegDefsUses(Register SrcReg, Register DstReg, unsigned SubIdx);
+ ///
+ /// If \p IsSubregToReg, we are coalescing a DstReg = SUBREG_TO_REG
+ /// SrcReg. This introduces an implicit-def of DstReg on coalesced users.
+ void updateRegDefsUses(Register SrcReg, Register DstReg, unsigned SubIdx,
+ bool IsSubregToReg);
/// If the given machine operand reads only undefined lanes add an undef
/// flag.
@@ -1343,8 +1347,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
if (DstReg.isPhysical()) {
Register NewDstReg = DstReg;
- unsigned NewDstIdx = TRI->composeSubRegIndices(CP.getSrcIdx(),
- DefMI->getOperand(0).getSubReg());
+ unsigned NewDstIdx = TRI->composeSubRegIndices(CP.getSrcIdx(), DefSubIdx);
if (NewDstIdx)
NewDstReg = TRI->getSubReg(DstReg, NewDstIdx);
@@ -1493,7 +1496,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
MRI->setRegClass(DstReg, NewRC);
// Update machine operands and add flags.
- updateRegDefsUses(DstReg, DstReg, DstIdx);
+ updateRegDefsUses(DstReg, DstReg, DstIdx, false);
NewMI.getOperand(0).setSubReg(NewIdx);
// updateRegDefUses can add an "undef" flag to the definition, since
// it will replace DstReg with DstReg.DstIdx. If NewIdx is 0, make
@@ -1618,8 +1621,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
NewMI.addOperand(MO);
SlotIndex NewMIIdx = LIS->getInstructionIndex(NewMI);
- for (unsigned i = 0, e = NewMIImplDefs.size(); i != e; ++i) {
- MCRegister Reg = NewMIImplDefs[i];
+ for (MCRegister Reg : NewMIImplDefs) {
for (MCRegUnit Unit : TRI->regunits(Reg))
if (LiveRange *LR = LIS->getCachedRegUnit(Unit))
LR->createDeadDef(NewMIIdx.getRegSlot(), LIS->getVNInfoAllocator());
@@ -1814,7 +1816,7 @@ void RegisterCoalescer::addUndefFlag(const LiveInterval &Int, SlotIndex UseIdx,
}
void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg,
- unsigned SubIdx) {
+ unsigned SubIdx, bool IsSubregToReg) {
bool DstIsPhys = DstReg.isPhysical();
LiveInterval *DstInt = DstIsPhys ? nullptr : &LIS->getInterval(DstReg);
@@ -1854,6 +1856,8 @@ void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg,
if (DstInt && !Reads && SubIdx && !UseMI->isDebugInstr())
Reads = DstInt->liveAt(LIS->getInstructionIndex(*UseMI));
+ bool FullDef = true;
+
// Replace SrcReg with DstReg in all UseMI operands.
for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
MachineOperand &MO = UseMI->getOperand(Ops[i]);
@@ -1861,9 +1865,13 @@ void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg,
// Adjust <undef> flags in case of sub-register joins. We don't want to
// turn a full def into a read-modify-write sub-register def and vice
// versa.
- if (SubIdx && MO.isDef())
+ if (SubIdx && MO.isDef()) {
MO.setIsUndef(!Reads);
+ if (!Reads)
+ FullDef = false;
+ }
+
// A subreg use of a partially undef (super) register may be a complete
// undef use now and then has to be marked that way.
if (MO.isUse() && !DstIsPhys) {
@@ -1895,6 +1903,25 @@ void RegisterCoalescer::updateRegDefsUses(Register SrcReg, Register DstReg,
MO.substVirtReg(DstReg, SubIdx, *TRI);
}
+ if (IsSubregToReg && !FullDef) {
+ // If the coalesed instruction doesn't fully define the register, we need
+ // to preserve the original super register liveness for SUBREG_TO_REG.
+ //
+ // We pretended SUBREG_TO_REG was a regular copy for coalescing purposes,
+ // but it introduces liveness for other subregisters. Downstream users may
+ // have been relying on those bits, so we need to ensure their liveness is
+ // captured with a def of other lanes.
+
+ // FIXME: Need to add new subrange if tracking subranges. We could also
+ // skip adding this if we knew the other lanes are dead, and only for
+ // other lanes.
+
+ assert(!MRI->shouldTrackSubRegLiveness(DstReg) &&
+ "this should update subranges");
+ MachineInstrBuilder MIB(*MF, UseMI);
+ MIB.addReg(DstReg, RegState::ImplicitDefine);
+ }
+
LLVM_DEBUG({
dbgs() << "\t\tupdated: ";
if (!UseMI->isDebugInstr())
@@ -2094,6 +2121,8 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
});
}
+ const bool IsSubregToReg = CopyMI->isSubregToReg();
+
ShrinkMask = LaneBitmask::getNone();
ShrinkMainRange = false;
@@ -2161,9 +2190,12 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
// Rewrite all SrcReg operands to DstReg.
// Also update DstReg operands to include DstIdx if it is set.
- if (CP.getDstIdx())
- updateRegDefsUses(CP.getDstReg(), CP.getDstReg(), CP.getDstIdx());
- updateRegDefsUses(CP.getSrcReg(), CP.getDstReg(), CP.getSrcIdx());
+ if (CP.getDstIdx()) {
+ assert(!IsSubregToReg && "can this happen?");
+ updateRegDefsUses(CP.getDstReg(), CP.getDstReg(), CP.getDstIdx(), false);
+ }
+ updateRegDefsUses(CP.getSrcReg(), CP.getDstReg(), CP.getSrcIdx(),
+ IsSubregToReg);
// Shrink subregister ranges if necessary.
if (ShrinkMask.any()) {
@@ -4236,8 +4268,7 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) {
InflateRegs.end());
LLVM_DEBUG(dbgs() << "Trying to inflate " << InflateRegs.size()
<< " regs.\n");
- for (unsigned i = 0, e = InflateRegs.size(); i != e; ++i) {
- Register Reg = InflateRegs[i];
+ for (Register Reg : InflateRegs) {
if (MRI->reg_nodbg_empty(Reg))
continue;
if (MRI->recomputeRegClass(Reg)) {
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/ReplaceWithVeclib.cpp b/contrib/llvm-project/llvm/lib/CodeGen/ReplaceWithVeclib.cpp
index 36c91b7fa97e..893aa4a91828 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/ReplaceWithVeclib.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/ReplaceWithVeclib.cpp
@@ -15,14 +15,17 @@
#include "llvm/CodeGen/ReplaceWithVeclib.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/CodeGen/Passes.h"
+#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
+#include "llvm/Support/TypeSize.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
using namespace llvm;
@@ -38,138 +41,137 @@ STATISTIC(NumTLIFuncDeclAdded,
STATISTIC(NumFuncUsedAdded,
"Number of functions added to `llvm.compiler.used`");
-static bool replaceWithTLIFunction(CallInst &CI, const StringRef TLIName) {
- Module *M = CI.getModule();
-
- Function *OldFunc = CI.getCalledFunction();
-
- // Check if the vector library function is already declared in this module,
- // otherwise insert it.
+/// Returns a vector Function that it adds to the Module \p M. When an \p
+/// ScalarFunc is not null, it copies its attributes to the newly created
+/// Function.
+Function *getTLIFunction(Module *M, FunctionType *VectorFTy,
+ const StringRef TLIName,
+ Function *ScalarFunc = nullptr) {
Function *TLIFunc = M->getFunction(TLIName);
if (!TLIFunc) {
- TLIFunc = Function::Create(OldFunc->getFunctionType(),
- Function::ExternalLinkage, TLIName, *M);
- TLIFunc->copyAttributesFrom(OldFunc);
+ TLIFunc =
+ Function::Create(VectorFTy, Function::ExternalLinkage, TLIName, *M);
+ if (ScalarFunc)
+ TLIFunc->copyAttributesFrom(ScalarFunc);
LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Added vector library function `"
<< TLIName << "` of type `" << *(TLIFunc->getType())
<< "` to module.\n");
++NumTLIFuncDeclAdded;
-
- // Add the freshly created function to llvm.compiler.used,
- // similar to as it is done in InjectTLIMappings
+ // Add the freshly created function to llvm.compiler.used, similar to as it
+ // is done in InjectTLIMappings.
appendToCompilerUsed(*M, {TLIFunc});
-
LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Adding `" << TLIName
<< "` to `@llvm.compiler.used`.\n");
++NumFuncUsedAdded;
}
+ return TLIFunc;
+}
- // Replace the call to the vector intrinsic with a call
- // to the corresponding function from the vector library.
- IRBuilder<> IRBuilder(&CI);
- SmallVector<Value *> Args(CI.args());
- // Preserve the operand bundles.
- SmallVector<OperandBundleDef, 1> OpBundles;
- CI.getOperandBundlesAsDefs(OpBundles);
- CallInst *Replacement = IRBuilder.CreateCall(TLIFunc, Args, OpBundles);
- assert(OldFunc->getFunctionType() == TLIFunc->getFunctionType() &&
- "Expecting function types to be identical");
- CI.replaceAllUsesWith(Replacement);
- if (isa<FPMathOperator>(Replacement)) {
- // Preserve fast math flags for FP math.
- Replacement->copyFastMathFlags(&CI);
+/// Replace the call to the vector intrinsic ( \p CalltoReplace ) with a call to
+/// the corresponding function from the vector library ( \p TLIVecFunc ).
+static void replaceWithTLIFunction(CallInst &CalltoReplace, VFInfo &Info,
+ Function *TLIVecFunc) {
+ IRBuilder<> IRBuilder(&CalltoReplace);
+ SmallVector<Value *> Args(CalltoReplace.args());
+ if (auto OptMaskpos = Info.getParamIndexForOptionalMask()) {
+ auto *MaskTy = VectorType::get(Type::getInt1Ty(CalltoReplace.getContext()),
+ Info.Shape.VF);
+ Args.insert(Args.begin() + OptMaskpos.value(),
+ Constant::getAllOnesValue(MaskTy));
}
- LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Replaced call to `"
- << OldFunc->getName() << "` with call to `" << TLIName
- << "`.\n");
- ++NumCallsReplaced;
- return true;
+ // Preserve the operand bundles.
+ SmallVector<OperandBundleDef, 1> OpBundles;
+ CalltoReplace.getOperandBundlesAsDefs(OpBundles);
+ CallInst *Replacement = IRBuilder.CreateCall(TLIVecFunc, Args, OpBundles);
+ CalltoReplace.replaceAllUsesWith(Replacement);
+ // Preserve fast math flags for FP math.
+ if (isa<FPMathOperator>(Replacement))
+ Replacement->copyFastMathFlags(&CalltoReplace);
}
+/// Returns true when successfully replaced \p CallToReplace with a suitable
+/// function taking vector arguments, based on available mappings in the \p TLI.
+/// Currently only works when \p CallToReplace is a call to vectorized
+/// intrinsic.
static bool replaceWithCallToVeclib(const TargetLibraryInfo &TLI,
- CallInst &CI) {
- if (!CI.getCalledFunction()) {
+ CallInst &CallToReplace) {
+ if (!CallToReplace.getCalledFunction())
return false;
- }
- auto IntrinsicID = CI.getCalledFunction()->getIntrinsicID();
- if (IntrinsicID == Intrinsic::not_intrinsic) {
- // Replacement is only performed for intrinsic functions
+ auto IntrinsicID = CallToReplace.getCalledFunction()->getIntrinsicID();
+ // Replacement is only performed for intrinsic functions.
+ if (IntrinsicID == Intrinsic::not_intrinsic)
return false;
- }
- // Convert vector arguments to scalar type and check that
- // all vector operands have identical vector width.
+ // Compute arguments types of the corresponding scalar call. Additionally
+ // checks if in the vector call, all vector operands have the same EC.
ElementCount VF = ElementCount::getFixed(0);
- SmallVector<Type *> ScalarTypes;
- for (auto Arg : enumerate(CI.args())) {
- auto *ArgType = Arg.value()->getType();
- // Vector calls to intrinsics can still have
- // scalar operands for specific arguments.
+ SmallVector<Type *> ScalarArgTypes;
+ for (auto Arg : enumerate(CallToReplace.args())) {
+ auto *ArgTy = Arg.value()->getType();
if (isVectorIntrinsicWithScalarOpAtArg(IntrinsicID, Arg.index())) {
- ScalarTypes.push_back(ArgType);
- } else {
- // The argument in this place should be a vector if
- // this is a call to a vector intrinsic.
- auto *VectorArgTy = dyn_cast<VectorType>(ArgType);
- if (!VectorArgTy) {
- // The argument is not a vector, do not perform
- // the replacement.
- return false;
- }
- ElementCount NumElements = VectorArgTy->getElementCount();
- if (NumElements.isScalable()) {
- // The current implementation does not support
- // scalable vectors.
+ ScalarArgTypes.push_back(ArgTy);
+ } else if (auto *VectorArgTy = dyn_cast<VectorType>(ArgTy)) {
+ ScalarArgTypes.push_back(ArgTy->getScalarType());
+ // Disallow vector arguments with different VFs. When processing the first
+ // vector argument, store it's VF, and for the rest ensure that they match
+ // it.
+ if (VF.isZero())
+ VF = VectorArgTy->getElementCount();
+ else if (VF != VectorArgTy->getElementCount())
return false;
- }
- if (VF.isNonZero() && VF != NumElements) {
- // The different arguments differ in vector size.
- return false;
- } else {
- VF = NumElements;
- }
- ScalarTypes.push_back(VectorArgTy->getElementType());
- }
+ } else
+ // Exit when it is supposed to be a vector argument but it isn't.
+ return false;
}
- // Try to reconstruct the name for the scalar version of this
- // intrinsic using the intrinsic ID and the argument types
- // converted to scalar above.
- std::string ScalarName;
- if (Intrinsic::isOverloaded(IntrinsicID)) {
- ScalarName = Intrinsic::getName(IntrinsicID, ScalarTypes, CI.getModule());
- } else {
- ScalarName = Intrinsic::getName(IntrinsicID).str();
- }
+ // Try to reconstruct the name for the scalar version of this intrinsic using
+ // the intrinsic ID and the argument types converted to scalar above.
+ std::string ScalarName =
+ (Intrinsic::isOverloaded(IntrinsicID)
+ ? Intrinsic::getName(IntrinsicID, ScalarArgTypes,
+ CallToReplace.getModule())
+ : Intrinsic::getName(IntrinsicID).str());
+
+ // Try to find the mapping for the scalar version of this intrinsic and the
+ // exact vector width of the call operands in the TargetLibraryInfo. First,
+ // check with a non-masked variant, and if that fails try with a masked one.
+ const VecDesc *VD =
+ TLI.getVectorMappingInfo(ScalarName, VF, /*Masked*/ false);
+ if (!VD && !(VD = TLI.getVectorMappingInfo(ScalarName, VF, /*Masked*/ true)))
+ return false;
- if (!TLI.isFunctionVectorizable(ScalarName)) {
- // The TargetLibraryInfo does not contain a vectorized version of
- // the scalar function.
+ LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Found TLI mapping from: `" << ScalarName
+ << "` and vector width " << VF << " to: `"
+ << VD->getVectorFnName() << "`.\n");
+
+ // Replace the call to the intrinsic with a call to the vector library
+ // function.
+ Type *ScalarRetTy = CallToReplace.getType()->getScalarType();
+ FunctionType *ScalarFTy =
+ FunctionType::get(ScalarRetTy, ScalarArgTypes, /*isVarArg*/ false);
+ const std::string MangledName = VD->getVectorFunctionABIVariantString();
+ auto OptInfo = VFABI::tryDemangleForVFABI(MangledName, ScalarFTy);
+ if (!OptInfo)
return false;
- }
- // Try to find the mapping for the scalar version of this intrinsic
- // and the exact vector width of the call operands in the
- // TargetLibraryInfo.
- StringRef TLIName = TLI.getVectorizedFunction(ScalarName, VF);
-
- LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Looking up TLI mapping for `"
- << ScalarName << "` and vector width " << VF << ".\n");
-
- if (!TLIName.empty()) {
- // Found the correct mapping in the TargetLibraryInfo,
- // replace the call to the intrinsic with a call to
- // the vector library function.
- LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Found TLI function `" << TLIName
- << "`.\n");
- return replaceWithTLIFunction(CI, TLIName);
- }
+ FunctionType *VectorFTy = VFABI::createFunctionType(*OptInfo, ScalarFTy);
+ if (!VectorFTy)
+ return false;
+
+ Function *FuncToReplace = CallToReplace.getCalledFunction();
+ Function *TLIFunc = getTLIFunction(CallToReplace.getModule(), VectorFTy,
+ VD->getVectorFnName(), FuncToReplace);
+ replaceWithTLIFunction(CallToReplace, *OptInfo, TLIFunc);
- return false;
+ LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Replaced call to `"
+ << FuncToReplace->getName() << "` with call to `"
+ << TLIFunc->getName() << "`.\n");
+ ++NumCallsReplaced;
+ return true;
}
static bool runImpl(const TargetLibraryInfo &TLI, Function &F) {
@@ -185,9 +187,8 @@ static bool runImpl(const TargetLibraryInfo &TLI, Function &F) {
}
// Erase the calls to the intrinsics that have been replaced
// with calls to the vector library.
- for (auto *CI : ReplacedCalls) {
+ for (auto *CI : ReplacedCalls)
CI->eraseFromParent();
- }
return Changed;
}
@@ -207,10 +208,10 @@ PreservedAnalyses ReplaceWithVeclib::run(Function &F,
PA.preserve<DemandedBitsAnalysis>();
PA.preserve<OptimizationRemarkEmitterAnalysis>();
return PA;
- } else {
- // The pass did not replace any calls, hence it preserves all analyses.
- return PreservedAnalyses::all();
}
+
+ // The pass did not replace any calls, hence it preserves all analyses.
+ return PreservedAnalyses::all();
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c782ad117ce6..0d46c7868d87 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -13703,8 +13703,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
if (N0.getOpcode() == ISD::AND &&
N0.getOperand(0).getOpcode() == ISD::TRUNCATE &&
N0.getOperand(1).getOpcode() == ISD::Constant &&
- (!TLI.isTruncateFree(N0.getOperand(0).getOperand(0).getValueType(),
- N0.getValueType()) ||
+ (!TLI.isTruncateFree(N0.getOperand(0).getOperand(0), N0.getValueType()) ||
!TLI.isZExtFree(N0.getValueType(), VT))) {
SDValue X = N0.getOperand(0).getOperand(0);
X = DAG.getAnyExtOrTrunc(X, SDLoc(X), VT);
@@ -13935,8 +13934,7 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
if (N0.getOpcode() == ISD::AND &&
N0.getOperand(0).getOpcode() == ISD::TRUNCATE &&
N0.getOperand(1).getOpcode() == ISD::Constant &&
- !TLI.isTruncateFree(N0.getOperand(0).getOperand(0).getValueType(),
- N0.getValueType())) {
+ !TLI.isTruncateFree(N0.getOperand(0).getOperand(0), N0.getValueType())) {
SDLoc DL(N);
SDValue X = DAG.getAnyExtOrTrunc(N0.getOperand(0).getOperand(0), DL, VT);
SDValue Y = DAG.getNode(ISD::ANY_EXTEND, DL, VT, N0.getOperand(1));
@@ -14759,6 +14757,7 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
// Attempt to pre-truncate BUILD_VECTOR sources.
if (N0.getOpcode() == ISD::BUILD_VECTOR && !LegalOperations &&
+ N0.hasOneUse() &&
TLI.isTruncateFree(SrcVT.getScalarType(), VT.getScalarType()) &&
// Avoid creating illegal types if running after type legalizer.
(!LegalTypes || TLI.isTypeLegal(VT.getScalarType()))) {
@@ -14818,11 +14817,11 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
if (SDValue Reduced = reduceLoadWidth(N))
return Reduced;
- // Handle the case where the load remains an extending load even
- // after truncation.
+ // Handle the case where the truncated result is at least as wide as the
+ // loaded type.
if (N0.hasOneUse() && ISD::isUNINDEXEDLoad(N0.getNode())) {
auto *LN0 = cast<LoadSDNode>(N0);
- if (LN0->isSimple() && LN0->getMemoryVT().bitsLT(VT)) {
+ if (LN0->isSimple() && LN0->getMemoryVT().bitsLE(VT)) {
SDValue NewLoad = DAG.getExtLoad(
LN0->getExtensionType(), SDLoc(LN0), VT, LN0->getChain(),
LN0->getBasePtr(), LN0->getMemoryVT(), LN0->getMemOperand());
@@ -15165,8 +15164,7 @@ SDValue DAGCombiner::visitBITCAST(SDNode *N) {
*LN0->getMemOperand())) {
SDValue Load =
DAG.getLoad(VT, SDLoc(N), LN0->getChain(), LN0->getBasePtr(),
- LN0->getPointerInfo(), LN0->getAlign(),
- LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
+ LN0->getMemOperand());
DAG.ReplaceAllUsesOfValueWith(N0.getValue(1), Load.getValue(1));
return Load;
}
@@ -18855,8 +18853,7 @@ struct LoadedSlice {
void addSliceGain(const LoadedSlice &LS) {
// Each slice saves a truncate.
const TargetLowering &TLI = LS.DAG->getTargetLoweringInfo();
- if (!TLI.isTruncateFree(LS.Inst->getOperand(0).getValueType(),
- LS.Inst->getValueType(0)))
+ if (!TLI.isTruncateFree(LS.Inst->getOperand(0), LS.Inst->getValueType(0)))
++Truncates;
// If there is a shift amount, this slice gets rid of it.
if (LS.Shift)
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index a83129586339..f3d8edb8926b 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1000,8 +1000,7 @@ bool FastISel::lowerCallTo(CallLoweringInfo &CLI) {
if (!CanLowerReturn)
return false;
- for (unsigned I = 0, E = RetTys.size(); I != E; ++I) {
- EVT VT = RetTys[I];
+ for (EVT VT : RetTys) {
MVT RegisterVT = TLI.getRegisterType(CLI.RetTy->getContext(), VT);
unsigned NumRegs = TLI.getNumRegisters(CLI.RetTy->getContext(), VT);
for (unsigned i = 0; i != NumRegs; ++i) {
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 03cba892a167..5926a6058111 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -377,8 +377,7 @@ Register FunctionLoweringInfo::CreateRegs(Type *Ty, bool isDivergent) {
ComputeValueVTs(*TLI, MF->getDataLayout(), Ty, ValueVTs);
Register FirstReg;
- for (unsigned Value = 0, e = ValueVTs.size(); Value != e; ++Value) {
- EVT ValueVT = ValueVTs[Value];
+ for (EVT ValueVT : ValueVTs) {
MVT RegisterVT = TLI->getRegisterType(Ty->getContext(), ValueVT);
unsigned NumRegs = TLI->getNumRegisters(Ty->getContext(), ValueVT);
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 5e1f9fbcdde0..4e317062cec4 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -913,14 +913,17 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
// normal undefined upper bits behavior to allow using an in-reg extend
// with the illegal FP type, so load as an integer and do the
// from-integer conversion.
- if (SrcVT.getScalarType() == MVT::f16) {
+ EVT SVT = SrcVT.getScalarType();
+ if (SVT == MVT::f16 || SVT == MVT::bf16) {
EVT ISrcVT = SrcVT.changeTypeToInteger();
EVT IDestVT = DestVT.changeTypeToInteger();
EVT ILoadVT = TLI.getRegisterType(IDestVT.getSimpleVT());
SDValue Result = DAG.getExtLoad(ISD::ZEXTLOAD, dl, ILoadVT, Chain,
Ptr, ISrcVT, LD->getMemOperand());
- Value = DAG.getNode(ISD::FP16_TO_FP, dl, DestVT, Result);
+ Value =
+ DAG.getNode(SVT == MVT::f16 ? ISD::FP16_TO_FP : ISD::BF16_TO_FP,
+ dl, DestVT, Result);
Chain = Result.getValue(1);
break;
}
@@ -4905,7 +4908,9 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
static MVT getPromotedVectorElementType(const TargetLowering &TLI,
MVT EltVT, MVT NewEltVT) {
unsigned OldEltsPerNewElt = EltVT.getSizeInBits() / NewEltVT.getSizeInBits();
- MVT MidVT = MVT::getVectorVT(NewEltVT, OldEltsPerNewElt);
+ MVT MidVT = OldEltsPerNewElt == 1
+ ? NewEltVT
+ : MVT::getVectorVT(NewEltVT, OldEltsPerNewElt);
assert(TLI.isTypeLegal(MidVT) && "unexpected");
return MidVT;
}
@@ -5349,6 +5354,7 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
case ISD::FEXP:
case ISD::FEXP2:
case ISD::FEXP10:
+ case ISD::FCANONICALIZE:
Tmp1 = DAG.getNode(ISD::FP_EXTEND, dl, NVT, Node->getOperand(0));
Tmp2 = DAG.getNode(Node->getOpcode(), dl, NVT, Tmp1);
Results.push_back(
@@ -5391,7 +5397,7 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
assert(NVT.isVector() && OVT.getSizeInBits() == NVT.getSizeInBits() &&
"Invalid promote type for build_vector");
- assert(NewEltVT.bitsLT(EltVT) && "not handled");
+ assert(NewEltVT.bitsLE(EltVT) && "not handled");
MVT MidVT = getPromotedVectorElementType(TLI, EltVT, NewEltVT);
@@ -5402,7 +5408,9 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
}
SDLoc SL(Node);
- SDValue Concat = DAG.getNode(ISD::CONCAT_VECTORS, SL, NVT, NewOps);
+ SDValue Concat =
+ DAG.getNode(MidVT == NewEltVT ? ISD::BUILD_VECTOR : ISD::CONCAT_VECTORS,
+ SL, NVT, NewOps);
SDValue CvtVec = DAG.getNode(ISD::BITCAST, SL, OVT, Concat);
Results.push_back(CvtVec);
break;
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
index c4605a6b9598..65919a64b806 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -2214,6 +2214,9 @@ bool DAGTypeLegalizer::PromoteFloatOperand(SDNode *N, unsigned OpNo) {
case ISD::FP_TO_UINT_SAT:
R = PromoteFloatOp_FP_TO_XINT_SAT(N, OpNo); break;
case ISD::FP_EXTEND: R = PromoteFloatOp_FP_EXTEND(N, OpNo); break;
+ case ISD::STRICT_FP_EXTEND:
+ R = PromoteFloatOp_STRICT_FP_EXTEND(N, OpNo);
+ break;
case ISD::SELECT_CC: R = PromoteFloatOp_SELECT_CC(N, OpNo); break;
case ISD::SETCC: R = PromoteFloatOp_SETCC(N, OpNo); break;
case ISD::STORE: R = PromoteFloatOp_STORE(N, OpNo); break;
@@ -2276,6 +2279,26 @@ SDValue DAGTypeLegalizer::PromoteFloatOp_FP_EXTEND(SDNode *N, unsigned OpNo) {
return DAG.getNode(ISD::FP_EXTEND, SDLoc(N), VT, Op);
}
+SDValue DAGTypeLegalizer::PromoteFloatOp_STRICT_FP_EXTEND(SDNode *N,
+ unsigned OpNo) {
+ assert(OpNo == 1);
+
+ SDValue Op = GetPromotedFloat(N->getOperand(1));
+ EVT VT = N->getValueType(0);
+
+ // Desired VT is same as promoted type. Use promoted float directly.
+ if (VT == Op->getValueType(0)) {
+ ReplaceValueWith(SDValue(N, 1), N->getOperand(0));
+ return Op;
+ }
+
+ // Else, extend the promoted float value to the desired VT.
+ SDValue Res = DAG.getNode(ISD::STRICT_FP_EXTEND, SDLoc(N), N->getVTList(),
+ N->getOperand(0), Op);
+ ReplaceValueWith(SDValue(N, 1), Res.getValue(1));
+ return Res;
+}
+
// Promote the float operands used for comparison. The true- and false-
// operands have the same type as the result and are promoted, if needed, by
// PromoteFloatRes_SELECT_CC
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 362fa92dd44b..3d21bd22e6ef 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -1871,6 +1871,9 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {
case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
Res = PromoteIntOp_VP_STRIDED(N, OpNo);
break;
+ case ISD::EXPERIMENTAL_VP_SPLICE:
+ Res = PromoteIntOp_VP_SPLICE(N, OpNo);
+ break;
}
// If the result is null, the sub-method took care of registering results etc.
@@ -2549,6 +2552,20 @@ SDValue DAGTypeLegalizer::PromoteIntOp_VP_STRIDED(SDNode *N, unsigned OpNo) {
return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
}
+SDValue DAGTypeLegalizer::PromoteIntOp_VP_SPLICE(SDNode *N, unsigned OpNo) {
+ SmallVector<SDValue, 6> NewOps(N->op_begin(), N->op_end());
+
+ if (OpNo == 2) { // Offset operand
+ NewOps[OpNo] = SExtPromotedInteger(N->getOperand(OpNo));
+ return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
+ }
+
+ assert((OpNo == 4 || OpNo == 5) && "Unexpected operand for promotion");
+
+ NewOps[OpNo] = ZExtPromotedInteger(N->getOperand(OpNo));
+ return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
+}
+
//===----------------------------------------------------------------------===//
// Integer Result Expansion
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index 9d5931b44ac6..84b1b2c71fd0 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -410,6 +410,7 @@ private:
SDValue PromoteIntOp_STACKMAP(SDNode *N, unsigned OpNo);
SDValue PromoteIntOp_PATCHPOINT(SDNode *N, unsigned OpNo);
SDValue PromoteIntOp_VP_STRIDED(SDNode *N, unsigned OpNo);
+ SDValue PromoteIntOp_VP_SPLICE(SDNode *N, unsigned OpNo);
void PromoteSetCCOperands(SDValue &LHS,SDValue &RHS, ISD::CondCode Code);
@@ -712,6 +713,7 @@ private:
SDValue PromoteFloatOp_BITCAST(SDNode *N, unsigned OpNo);
SDValue PromoteFloatOp_FCOPYSIGN(SDNode *N, unsigned OpNo);
SDValue PromoteFloatOp_FP_EXTEND(SDNode *N, unsigned OpNo);
+ SDValue PromoteFloatOp_STRICT_FP_EXTEND(SDNode *N, unsigned OpNo);
SDValue PromoteFloatOp_UnaryOp(SDNode *N, unsigned OpNo);
SDValue PromoteFloatOp_FP_TO_XINT_SAT(SDNode *N, unsigned OpNo);
SDValue PromoteFloatOp_STORE(SDNode *N, unsigned OpNo);
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
index ab4c33c9e976..f73ddfee2b90 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
@@ -296,28 +296,24 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
if (isNewLoad)
AddPred(LoadSU, ChainPred);
}
- for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
- const SDep &Pred = LoadPreds[i];
+ for (const SDep &Pred : LoadPreds) {
RemovePred(SU, Pred);
if (isNewLoad) {
AddPred(LoadSU, Pred);
}
}
- for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
- const SDep &Pred = NodePreds[i];
+ for (const SDep &Pred : NodePreds) {
RemovePred(SU, Pred);
AddPred(NewSU, Pred);
}
- for (unsigned i = 0, e = NodeSuccs.size(); i != e; ++i) {
- SDep D = NodeSuccs[i];
+ for (SDep D : NodeSuccs) {
SUnit *SuccDep = D.getSUnit();
D.setSUnit(SU);
RemovePred(SuccDep, D);
D.setSUnit(NewSU);
AddPred(SuccDep, D);
}
- for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
- SDep D = ChainSuccs[i];
+ for (SDep D : ChainSuccs) {
SUnit *SuccDep = D.getSUnit();
D.setSUnit(SU);
RemovePred(SuccDep, D);
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 5be1892a44f6..81facf92e55a 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -6858,8 +6858,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
// expanding copies of large vectors from registers. This only works for
// fixed length vectors, since we need to know the exact number of
// elements.
- if (N2C && N1.getOperand(0).getValueType().isFixedLengthVector() &&
- N1.getOpcode() == ISD::CONCAT_VECTORS && N1.getNumOperands() > 0) {
+ if (N2C && N1.getOpcode() == ISD::CONCAT_VECTORS &&
+ N1.getOperand(0).getValueType().isFixedLengthVector()) {
unsigned Factor =
N1.getOperand(0).getValueType().getVectorNumElements();
return getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT,
@@ -6976,7 +6976,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
// EXTRACT_SUBVECTOR of CONCAT_VECTOR can be simplified if the pieces of
// the concat have the same type as the extract.
- if (N1.getOpcode() == ISD::CONCAT_VECTORS && N1.getNumOperands() > 0 &&
+ if (N1.getOpcode() == ISD::CONCAT_VECTORS &&
VT == N1.getOperand(0).getValueType()) {
unsigned Factor = VT.getVectorMinNumElements();
return N1.getOperand(N2C->getZExtValue() / Factor);
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 12ed4a82ee91..3c4b285cb067 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -10627,8 +10627,7 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const {
else if (CLI.RetZExt)
AssertOp = ISD::AssertZext;
unsigned CurReg = 0;
- for (unsigned I = 0, E = RetTys.size(); I != E; ++I) {
- EVT VT = RetTys[I];
+ for (EVT VT : RetTys) {
MVT RegisterVT = getRegisterTypeForCallingConv(CLI.RetTy->getContext(),
CLI.CallConv, VT);
unsigned NumRegs = getNumRegistersForCallingConv(CLI.RetTy->getContext(),
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index a1cf4cbbee1b..3dc6e4bbcf46 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2786,7 +2786,7 @@ CheckInteger(const unsigned char *MatcherTable, unsigned &MatcherIndex,
Val = decodeSignRotatedValue(Val);
ConstantSDNode *C = dyn_cast<ConstantSDNode>(N);
- return C && C->getSExtValue() == Val;
+ return C && C->getAPIntValue().trySExtValue() == Val;
}
LLVM_ATTRIBUTE_ALWAYS_INLINE static bool
@@ -3612,12 +3612,24 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
CurDAG->getTargetConstant(Val, SDLoc(NodeToMatch), VT), nullptr));
continue;
}
- case OPC_EmitRegister: {
- MVT::SimpleValueType VT =
- static_cast<MVT::SimpleValueType>(MatcherTable[MatcherIndex++]);
+ case OPC_EmitRegister:
+ case OPC_EmitRegisterI32:
+ case OPC_EmitRegisterI64: {
+ MVT::SimpleValueType VT;
+ switch (Opcode) {
+ case OPC_EmitRegisterI32:
+ VT = MVT::i32;
+ break;
+ case OPC_EmitRegisterI64:
+ VT = MVT::i64;
+ break;
+ default:
+ VT = static_cast<MVT::SimpleValueType>(MatcherTable[MatcherIndex++]);
+ break;
+ }
unsigned RegNo = MatcherTable[MatcherIndex++];
- RecordedNodes.push_back(std::pair<SDValue, SDNode*>(
- CurDAG->getRegister(RegNo, VT), nullptr));
+ RecordedNodes.push_back(std::pair<SDValue, SDNode *>(
+ CurDAG->getRegister(RegNo, VT), nullptr));
continue;
}
case OPC_EmitRegister2: {
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/ShadowStackGCLowering.cpp b/contrib/llvm-project/llvm/lib/CodeGen/ShadowStackGCLowering.cpp
index 38f658084294..d4840d117110 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/ShadowStackGCLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/ShadowStackGCLowering.cpp
@@ -115,7 +115,7 @@ Constant *ShadowStackGCLowering::GetFrameMap(Function &F) {
Constant *C = cast<Constant>(Roots[I].first->getArgOperand(1));
if (!C->isNullValue())
NumMeta = I + 1;
- Metadata.push_back(ConstantExpr::getBitCast(C, VoidPtr));
+ Metadata.push_back(C);
}
Metadata.resize(NumMeta);
@@ -173,7 +173,7 @@ Type *ShadowStackGCLowering::GetConcreteStackEntryType(Function &F) {
bool ShadowStackGCLowering::doInitialization(Module &M) {
bool Active = false;
for (Function &F : M) {
- if (F.hasGC() && F.getGC() == std::string("shadow-stack")) {
+ if (F.hasGC() && F.getGC() == "shadow-stack") {
Active = true;
break;
}
@@ -292,8 +292,7 @@ void ShadowStackGCLowering::getAnalysisUsage(AnalysisUsage &AU) const {
/// runOnFunction - Insert code to maintain the shadow stack.
bool ShadowStackGCLowering::runOnFunction(Function &F) {
// Quick exit for functions that do not use the shadow stack GC.
- if (!F.hasGC() ||
- F.getGC() != std::string("shadow-stack"))
+ if (!F.hasGC() || F.getGC() != "shadow-stack")
return false;
LLVMContext &Context = F.getContext();
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 9a0dd92bb58e..6e69dc66429d 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -2681,6 +2681,13 @@ MCSection *TargetLoweringObjectFileGOFF::getExplicitSectionGlobal(
return SelectSectionForGlobal(GO, Kind, TM);
}
+MCSection *TargetLoweringObjectFileGOFF::getSectionForLSDA(
+ const Function &F, const MCSymbol &FnSym, const TargetMachine &TM) const {
+ std::string Name = ".gcc_exception_table." + F.getName().str();
+ return getContext().getGOFFSection(Name, SectionKind::getData(), nullptr,
+ nullptr);
+}
+
MCSection *TargetLoweringObjectFileGOFF::SelectSectionForGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
auto *Symbol = TM.getSymbol(GO);
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TargetPassConfig.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TargetPassConfig.cpp
index faa5466b69e8..4003a08a5422 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -947,6 +947,7 @@ void TargetPassConfig::addPassesToHandleExceptions() {
case ExceptionHandling::DwarfCFI:
case ExceptionHandling::ARM:
case ExceptionHandling::AIX:
+ case ExceptionHandling::ZOS:
addPass(createDwarfEHPass(getOptLevel()));
break;
case ExceptionHandling::WinEH:
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index bf689dbd308f..526cb847e8a0 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1124,8 +1124,7 @@ bool TwoAddressInstructionPass::rescheduleKillAboveMI(
}
}
- for (unsigned i = 0, e = OtherDefs.size(); i != e; ++i) {
- Register MOReg = OtherDefs[i];
+ for (Register MOReg : OtherDefs) {
if (regOverlapsSet(Uses, MOReg))
return false;
if (MOReg.isPhysical() && regOverlapsSet(LiveDefs, MOReg))
diff --git a/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp b/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp
index 409bec7a874b..809b2d51f059 100644
--- a/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp
+++ b/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp
@@ -188,21 +188,41 @@ private:
Edge::Kind DeltaKind;
Symbol *TargetSymbol;
uint64_t Addend;
+
+ bool FixingFromSymbol = true;
if (&BlockToFix == &FromSymbol->getAddressable()) {
+ if (LLVM_UNLIKELY(&BlockToFix == &ToSymbol->getAddressable())) {
+ // From and To are symbols in the same block. Decide direction by offset
+ // instead.
+ if (ToSymbol->getAddress() > FixupAddress)
+ FixingFromSymbol = true;
+ else if (FromSymbol->getAddress() > FixupAddress)
+ FixingFromSymbol = false;
+ else
+ FixingFromSymbol = FromSymbol->getAddress() >= ToSymbol->getAddress();
+ } else
+ FixingFromSymbol = true;
+ } else {
+ if (&BlockToFix == &ToSymbol->getAddressable())
+ FixingFromSymbol = false;
+ else {
+ // BlockToFix was neither FromSymbol nor ToSymbol.
+ return make_error<JITLinkError>("SUBTRACTOR relocation must fix up "
+ "either 'A' or 'B' (or a symbol in one "
+ "of their alt-entry groups)");
+ }
+ }
+
+ if (FixingFromSymbol) {
TargetSymbol = ToSymbol;
DeltaKind = (SubRI.r_length == 3) ? aarch64::Delta64 : aarch64::Delta32;
Addend = FixupValue + (FixupAddress - FromSymbol->getAddress());
// FIXME: handle extern 'from'.
- } else if (&BlockToFix == &ToSymbol->getAddressable()) {
+ } else {
TargetSymbol = &*FromSymbol;
DeltaKind =
(SubRI.r_length == 3) ? aarch64::NegDelta64 : aarch64::NegDelta32;
Addend = FixupValue - (FixupAddress - ToSymbol->getAddress());
- } else {
- // BlockToFix was neither FromSymbol nor ToSymbol.
- return make_error<JITLinkError>("SUBTRACTOR relocation must fix up "
- "either 'A' or 'B' (or a symbol in one "
- "of their alt-entry groups)");
}
return PairRelocInfo(DeltaKind, TargetSymbol, Addend);
diff --git a/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp b/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
index 49f619357f08..eeca27771ad6 100644
--- a/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
+++ b/contrib/llvm-project/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
@@ -179,21 +179,41 @@ private:
Edge::Kind DeltaKind;
Symbol *TargetSymbol;
uint64_t Addend;
+
+ bool FixingFromSymbol = true;
if (&BlockToFix == &FromSymbol->getAddressable()) {
+ if (LLVM_UNLIKELY(&BlockToFix == &ToSymbol->getAddressable())) {
+ // From and To are symbols in the same block. Decide direction by offset
+ // instead.
+ if (ToSymbol->getAddress() > FixupAddress)
+ FixingFromSymbol = true;
+ else if (FromSymbol->getAddress() > FixupAddress)
+ FixingFromSymbol = false;
+ else
+ FixingFromSymbol = FromSymbol->getAddress() >= ToSymbol->getAddress();
+ } else
+ FixingFromSymbol = true;
+ } else {
+ if (&BlockToFix == &ToSymbol->getAddressable())
+ FixingFromSymbol = false;
+ else {
+ // BlockToFix was neither FromSymbol nor ToSymbol.
+ return make_error<JITLinkError>("SUBTRACTOR relocation must fix up "
+ "either 'A' or 'B' (or a symbol in one "
+ "of their alt-entry groups)");
+ }
+ }
+
+ if (FixingFromSymbol) {
TargetSymbol = ToSymbol;
DeltaKind = (SubRI.r_length == 3) ? x86_64::Delta64 : x86_64::Delta32;
Addend = FixupValue + (FixupAddress - FromSymbol->getAddress());
// FIXME: handle extern 'from'.
- } else if (&BlockToFix == &ToSymbol->getAddressable()) {
+ } else {
TargetSymbol = FromSymbol;
DeltaKind =
(SubRI.r_length == 3) ? x86_64::NegDelta64 : x86_64::NegDelta32;
Addend = FixupValue - (FixupAddress - ToSymbol->getAddress());
- } else {
- // BlockToFix was neither FromSymbol nor ToSymbol.
- return make_error<JITLinkError>("SUBTRACTOR relocation must fix up "
- "either 'A' or 'B' (or a symbol in one "
- "of their alt-entry chains)");
}
return PairRelocInfo(DeltaKind, TargetSymbol, Addend);
diff --git a/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp b/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp
index 709fe3212623..bcdbe5eadc69 100644
--- a/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp
+++ b/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp
@@ -23,13 +23,15 @@ GlobalVariable *FrontendResource::getGlobalVariable() {
cast<ConstantAsMetadata>(Entry->getOperand(0))->getValue());
}
-StringRef FrontendResource::getSourceType() {
- return cast<MDString>(Entry->getOperand(1))->getString();
-}
-
ResourceKind FrontendResource::getResourceKind() {
return static_cast<ResourceKind>(
cast<ConstantInt>(
+ cast<ConstantAsMetadata>(Entry->getOperand(1))->getValue())
+ ->getLimitedValue());
+}
+ElementType FrontendResource::getElementType() {
+ return static_cast<ElementType>(
+ cast<ConstantInt>(
cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue())
->getLimitedValue());
}
@@ -49,14 +51,15 @@ uint32_t FrontendResource::getSpace() {
->getLimitedValue();
}
-FrontendResource::FrontendResource(GlobalVariable *GV, StringRef TypeStr,
- ResourceKind RK, bool IsROV,
+FrontendResource::FrontendResource(GlobalVariable *GV, ResourceKind RK,
+ ElementType ElTy, bool IsROV,
uint32_t ResIndex, uint32_t Space) {
auto &Ctx = GV->getContext();
IRBuilder<> B(Ctx);
Entry = MDNode::get(
- Ctx, {ValueAsMetadata::get(GV), MDString::get(Ctx, TypeStr),
+ Ctx, {ValueAsMetadata::get(GV),
ConstantAsMetadata::get(B.getInt32(static_cast<int>(RK))),
+ ConstantAsMetadata::get(B.getInt32(static_cast<int>(ElTy))),
ConstantAsMetadata::get(B.getInt1(IsROV)),
ConstantAsMetadata::get(B.getInt32(ResIndex)),
ConstantAsMetadata::get(B.getInt32(Space))});
diff --git a/contrib/llvm-project/llvm/lib/IR/ConstantFold.cpp b/contrib/llvm-project/llvm/lib/IR/ConstantFold.cpp
index d499d74f7ba0..7fdc35e7fca0 100644
--- a/contrib/llvm-project/llvm/lib/IR/ConstantFold.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/ConstantFold.cpp
@@ -868,7 +868,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
}
if (GVAlign > 1) {
- unsigned DstWidth = CI2->getType()->getBitWidth();
+ unsigned DstWidth = CI2->getBitWidth();
unsigned SrcWidth = std::min(DstWidth, Log2(GVAlign));
APInt BitsNotSet(APInt::getLowBitsSet(DstWidth, SrcWidth));
diff --git a/contrib/llvm-project/llvm/lib/IR/Globals.cpp b/contrib/llvm-project/llvm/lib/IR/Globals.cpp
index 51bdbeb0abf2..239acd2181e8 100644
--- a/contrib/llvm-project/llvm/lib/IR/Globals.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/Globals.cpp
@@ -144,25 +144,27 @@ void GlobalObject::copyAttributesFrom(const GlobalObject *Src) {
std::string GlobalValue::getGlobalIdentifier(StringRef Name,
GlobalValue::LinkageTypes Linkage,
StringRef FileName) {
-
// Value names may be prefixed with a binary '1' to indicate
// that the backend should not modify the symbols due to any platform
// naming convention. Do not include that '1' in the PGO profile name.
if (Name[0] == '\1')
Name = Name.substr(1);
- std::string NewName = std::string(Name);
+ std::string GlobalName;
if (llvm::GlobalValue::isLocalLinkage(Linkage)) {
// For local symbols, prepend the main file name to distinguish them.
// Do not include the full path in the file name since there's no guarantee
// that it will stay the same, e.g., if the files are checked out from
// version control in different locations.
if (FileName.empty())
- NewName = NewName.insert(0, "<unknown>:");
+ GlobalName += "<unknown>";
else
- NewName = NewName.insert(0, FileName.str() + ":");
+ GlobalName += FileName;
+
+ GlobalName += kGlobalIdentifierDelimiter;
}
- return NewName;
+ GlobalName += Name;
+ return GlobalName;
}
std::string GlobalValue::getGlobalIdentifier() const {
diff --git a/contrib/llvm-project/llvm/lib/IR/LLVMContext.cpp b/contrib/llvm-project/llvm/lib/IR/LLVMContext.cpp
index 8ddf51537ec1..57077e786efc 100644
--- a/contrib/llvm-project/llvm/lib/IR/LLVMContext.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/LLVMContext.cpp
@@ -256,10 +256,13 @@ void LLVMContext::diagnose(const DiagnosticInfo &DI) {
RS->emit(*OptDiagBase);
// If there is a report handler, use it.
- if (pImpl->DiagHandler &&
- (!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) &&
- pImpl->DiagHandler->handleDiagnostics(DI))
- return;
+ if (pImpl->DiagHandler) {
+ if (DI.getSeverity() == DS_Error)
+ pImpl->DiagHandler->HasErrors = true;
+ if ((!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) &&
+ pImpl->DiagHandler->handleDiagnostics(DI))
+ return;
+ }
if (!isDiagnosticEnabled(DI))
return;
diff --git a/contrib/llvm-project/llvm/lib/IR/Metadata.cpp b/contrib/llvm-project/llvm/lib/IR/Metadata.cpp
index 7bc25e30b893..515893d079b8 100644
--- a/contrib/llvm-project/llvm/lib/IR/Metadata.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/Metadata.cpp
@@ -1566,7 +1566,7 @@ void Instruction::updateDIAssignIDMapping(DIAssignID *ID) {
"Expect existing attachment to be mapped");
auto &InstVec = InstrsIt->second;
- auto *InstIt = std::find(InstVec.begin(), InstVec.end(), this);
+ auto *InstIt = llvm::find(InstVec, this);
assert(InstIt != InstVec.end() &&
"Expect instruction to be mapped to attachment");
// The vector contains a ptr to this. If this is the only element in the
diff --git a/contrib/llvm-project/llvm/lib/IR/Type.cpp b/contrib/llvm-project/llvm/lib/IR/Type.cpp
index 85d779c98a9b..c59bc3622fde 100644
--- a/contrib/llvm-project/llvm/lib/IR/Type.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/Type.cpp
@@ -834,6 +834,8 @@ struct TargetTypeInfo {
static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
LLVMContext &C = Ty->getContext();
StringRef Name = Ty->getName();
+ if (Name.equals("spirv.Image"))
+ return TargetTypeInfo(PointerType::get(C, 0), TargetExtType::CanBeGlobal);
if (Name.starts_with("spirv."))
return TargetTypeInfo(PointerType::get(C, 0), TargetExtType::HasZeroInit,
TargetExtType::CanBeGlobal);
diff --git a/contrib/llvm-project/llvm/lib/IR/Verifier.cpp b/contrib/llvm-project/llvm/lib/IR/Verifier.cpp
index 8aba28026306..aeaca21a99cc 100644
--- a/contrib/llvm-project/llvm/lib/IR/Verifier.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/Verifier.cpp
@@ -2296,10 +2296,9 @@ void Verifier::verifyFunctionMetadata(
Check(isa<ConstantAsMetadata>(MD->getOperand(0)),
"expected a constant operand for !kcfi_type", MD);
Constant *C = cast<ConstantAsMetadata>(MD->getOperand(0))->getValue();
- Check(isa<ConstantInt>(C),
+ Check(isa<ConstantInt>(C) && isa<IntegerType>(C->getType()),
"expected a constant integer operand for !kcfi_type", MD);
- IntegerType *Type = cast<ConstantInt>(C)->getType();
- Check(Type->getBitWidth() == 32,
+ Check(cast<ConstantInt>(C)->getBitWidth() == 32,
"expected a 32-bit integer constant operand for !kcfi_type", MD);
}
}
@@ -5690,8 +5689,10 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
"vector of ints");
auto *Op3 = cast<ConstantInt>(Call.getArgOperand(2));
- Check(Op3->getType()->getBitWidth() <= 32,
- "third argument of [us][mul|div]_fix[_sat] must fit within 32 bits");
+ Check(Op3->getType()->isIntegerTy(),
+ "third operand of [us][mul|div]_fix[_sat] must be an int type");
+ Check(Op3->getBitWidth() <= 32,
+ "third operand of [us][mul|div]_fix[_sat] must fit within 32 bits");
if (ID == Intrinsic::smul_fix || ID == Intrinsic::smul_fix_sat ||
ID == Intrinsic::sdiv_fix || ID == Intrinsic::sdiv_fix_sat) {
diff --git a/contrib/llvm-project/llvm/lib/MC/MCAsmStreamer.cpp b/contrib/llvm-project/llvm/lib/MC/MCAsmStreamer.cpp
index 9e1d108ac14d..49668de27d67 100644
--- a/contrib/llvm-project/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/contrib/llvm-project/llvm/lib/MC/MCAsmStreamer.cpp
@@ -154,7 +154,10 @@ public:
void emitGNUAttribute(unsigned Tag, unsigned Value) override;
StringRef getMnemonic(MCInst &MI) override {
- return InstPrinter->getMnemonic(&MI).first;
+ auto [Ptr, Bits] = InstPrinter->getMnemonic(&MI);
+ assert((Bits != 0 || Ptr == nullptr) &&
+ "Invalid char pointer for instruction with no mnemonic");
+ return Ptr;
}
void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
diff --git a/contrib/llvm-project/llvm/lib/MC/MCContext.cpp b/contrib/llvm-project/llvm/lib/MC/MCContext.cpp
index 6e72b5062a1d..c1db7e3943c4 100644
--- a/contrib/llvm-project/llvm/lib/MC/MCContext.cpp
+++ b/contrib/llvm-project/llvm/lib/MC/MCContext.cpp
@@ -650,10 +650,16 @@ MCSectionGOFF *MCContext::getGOFFSection(StringRef Section, SectionKind Kind,
MCSection *Parent,
const MCExpr *SubsectionId) {
// Do the lookup. If we don't have a hit, return a new section.
- auto &GOFFSection = GOFFUniquingMap[Section.str()];
- if (!GOFFSection)
- GOFFSection = new (GOFFAllocator.Allocate())
- MCSectionGOFF(Section, Kind, Parent, SubsectionId);
+ auto IterBool =
+ GOFFUniquingMap.insert(std::make_pair(Section.str(), nullptr));
+ auto Iter = IterBool.first;
+ if (!IterBool.second)
+ return Iter->second;
+
+ StringRef CachedName = Iter->first;
+ MCSectionGOFF *GOFFSection = new (GOFFAllocator.Allocate())
+ MCSectionGOFF(CachedName, Kind, Parent, SubsectionId);
+ Iter->second = GOFFSection;
return GOFFSection;
}
diff --git a/contrib/llvm-project/llvm/lib/MC/MCExpr.cpp b/contrib/llvm-project/llvm/lib/MC/MCExpr.cpp
index 73e6569f96e4..a85182aa06ad 100644
--- a/contrib/llvm-project/llvm/lib/MC/MCExpr.cpp
+++ b/contrib/llvm-project/llvm/lib/MC/MCExpr.cpp
@@ -632,7 +632,8 @@ static void AttemptToFoldSymbolOffsetDifference(
// instructions and InSet is false (not expressions in directive like
// .size/.fill), disable the fast path.
if (Layout && (InSet || !SecA.hasInstructions() ||
- !Asm->getContext().getTargetTriple().isRISCV())) {
+ !(Asm->getContext().getTargetTriple().isRISCV() ||
+ Asm->getContext().getTargetTriple().isLoongArch()))) {
// If both symbols are in the same fragment, return the difference of their
// offsets. canGetFragmentOffset(FA) may be false.
if (FA == FB && !SA.isVariable() && !SB.isVariable()) {
@@ -942,16 +943,17 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
Addrs, InSet)) {
// Check if both are Target Expressions, see if we can compare them.
if (const MCTargetExpr *L = dyn_cast<MCTargetExpr>(ABE->getLHS())) {
- const MCTargetExpr *R = cast<MCTargetExpr>(ABE->getRHS());
- switch (ABE->getOpcode()) {
- case MCBinaryExpr::EQ:
- Res = MCValue::get(L->isEqualTo(R) ? -1 : 0);
- return true;
- case MCBinaryExpr::NE:
- Res = MCValue::get(L->isEqualTo(R) ? 0 : -1);
- return true;
- default:
- break;
+ if (const MCTargetExpr *R = dyn_cast<MCTargetExpr>(ABE->getRHS())) {
+ switch (ABE->getOpcode()) {
+ case MCBinaryExpr::EQ:
+ Res = MCValue::get(L->isEqualTo(R) ? -1 : 0);
+ return true;
+ case MCBinaryExpr::NE:
+ Res = MCValue::get(L->isEqualTo(R) ? 0 : -1);
+ return true;
+ default:
+ break;
+ }
}
}
return false;
diff --git a/contrib/llvm-project/llvm/lib/ObjCopy/ELF/ELFObject.cpp b/contrib/llvm-project/llvm/lib/ObjCopy/ELF/ELFObject.cpp
index 5352736bdcb9..c8b66d6fcb5e 100644
--- a/contrib/llvm-project/llvm/lib/ObjCopy/ELF/ELFObject.cpp
+++ b/contrib/llvm-project/llvm/lib/ObjCopy/ELF/ELFObject.cpp
@@ -2638,7 +2638,7 @@ template <class ELFT> Error ELFWriter<ELFT>::finalize() {
Error BinaryWriter::write() {
SmallVector<const SectionBase *, 30> SectionsToWrite;
for (const SectionBase &Sec : Obj.allocSections()) {
- if (Sec.Type != SHT_NOBITS)
+ if (Sec.Type != SHT_NOBITS && Sec.Size > 0)
SectionsToWrite.push_back(&Sec);
}
diff --git a/contrib/llvm-project/llvm/lib/Object/ELFObjectFile.cpp b/contrib/llvm-project/llvm/lib/Object/ELFObjectFile.cpp
index 3c86b0f25dda..95c4f9f8545d 100644
--- a/contrib/llvm-project/llvm/lib/Object/ELFObjectFile.cpp
+++ b/contrib/llvm-project/llvm/lib/Object/ELFObjectFile.cpp
@@ -358,6 +358,8 @@ std::optional<StringRef> ELFObjectFileBase::tryGetCPUName() const {
switch (getEMachine()) {
case ELF::EM_AMDGPU:
return getAMDGPUCPUName();
+ case ELF::EM_CUDA:
+ return getNVPTXCPUName();
case ELF::EM_PPC:
case ELF::EM_PPC64:
return StringRef("future");
@@ -517,6 +519,73 @@ StringRef ELFObjectFileBase::getAMDGPUCPUName() const {
}
}
+StringRef ELFObjectFileBase::getNVPTXCPUName() const {
+ assert(getEMachine() == ELF::EM_CUDA);
+ unsigned SM = getPlatformFlags() & ELF::EF_CUDA_SM;
+
+ switch (SM) {
+ // Fermi architecture.
+ case ELF::EF_CUDA_SM20:
+ return "sm_20";
+ case ELF::EF_CUDA_SM21:
+ return "sm_21";
+
+ // Kepler architecture.
+ case ELF::EF_CUDA_SM30:
+ return "sm_30";
+ case ELF::EF_CUDA_SM32:
+ return "sm_32";
+ case ELF::EF_CUDA_SM35:
+ return "sm_35";
+ case ELF::EF_CUDA_SM37:
+ return "sm_37";
+
+ // Maxwell architecture.
+ case ELF::EF_CUDA_SM50:
+ return "sm_50";
+ case ELF::EF_CUDA_SM52:
+ return "sm_52";
+ case ELF::EF_CUDA_SM53:
+ return "sm_53";
+
+ // Pascal architecture.
+ case ELF::EF_CUDA_SM60:
+ return "sm_60";
+ case ELF::EF_CUDA_SM61:
+ return "sm_61";
+ case ELF::EF_CUDA_SM62:
+ return "sm_62";
+
+ // Volta architecture.
+ case ELF::EF_CUDA_SM70:
+ return "sm_70";
+ case ELF::EF_CUDA_SM72:
+ return "sm_72";
+
+ // Turing architecture.
+ case ELF::EF_CUDA_SM75:
+ return "sm_75";
+
+ // Ampere architecture.
+ case ELF::EF_CUDA_SM80:
+ return "sm_80";
+ case ELF::EF_CUDA_SM86:
+ return "sm_86";
+ case ELF::EF_CUDA_SM87:
+ return "sm_87";
+
+ // Ada architecture.
+ case ELF::EF_CUDA_SM89:
+ return "sm_89";
+
+ // Hopper architecture.
+ case ELF::EF_CUDA_SM90:
+ return getPlatformFlags() & ELF::EF_CUDA_ACCELERATORS ? "sm_90a" : "sm_90";
+ default:
+ llvm_unreachable("Unknown EF_CUDA_SM value");
+ }
+}
+
// FIXME Encode from a tablegen description or target parser.
void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const {
if (TheTriple.getSubArch() != Triple::NoSubArch)
diff --git a/contrib/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp b/contrib/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp
index ab073e18cb46..07f76688fa43 100644
--- a/contrib/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp
+++ b/contrib/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp
@@ -16,6 +16,7 @@
#include "RecordStreamer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
@@ -68,6 +69,11 @@ void ModuleSymbolTable::addModule(Module *M) {
static void
initializeRecordStreamer(const Module &M,
function_ref<void(RecordStreamer &)> Init) {
+ // This function may be called twice, once for ModuleSummaryIndexAnalysis and
+ // the other when writing the IR symbol table. If parsing inline assembly has
+ // caused errors in the first run, suppress the second run.
+ if (M.getContext().getDiagHandlerPtr()->HasErrors)
+ return;
StringRef InlineAsm = M.getModuleInlineAsm();
if (InlineAsm.empty())
return;
@@ -95,7 +101,8 @@ initializeRecordStreamer(const Module &M,
if (!MCII)
return;
- std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer(InlineAsm));
+ std::unique_ptr<MemoryBuffer> Buffer(
+ MemoryBuffer::getMemBuffer(InlineAsm, "<inline asm>"));
SourceMgr SrcMgr;
SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc());
@@ -115,6 +122,13 @@ initializeRecordStreamer(const Module &M,
if (!TAP)
return;
+ MCCtx.setDiagnosticHandler([&](const SMDiagnostic &SMD, bool IsInlineAsm,
+ const SourceMgr &SrcMgr,
+ std::vector<const MDNode *> &LocInfos) {
+ M.getContext().diagnose(
+ DiagnosticInfoSrcMgr(SMD, M.getName(), IsInlineAsm, /*LocCookie=*/0));
+ });
+
// Module-level inline asm is assumed to use At&t syntax (see
// AsmPrinter::doInitialization()).
Parser->setAssemblerDialect(InlineAsm::AD_ATT);
diff --git a/contrib/llvm-project/llvm/lib/Object/WasmObjectFile.cpp b/contrib/llvm-project/llvm/lib/Object/WasmObjectFile.cpp
index 168fb57935d6..dfe86a45df32 100644
--- a/contrib/llvm-project/llvm/lib/Object/WasmObjectFile.cpp
+++ b/contrib/llvm-project/llvm/lib/Object/WasmObjectFile.cpp
@@ -265,7 +265,6 @@ static wasm::WasmTableType readTableType(WasmObjectFile::ReadContext &Ctx) {
static Error readSection(WasmSection &Section, WasmObjectFile::ReadContext &Ctx,
WasmSectionOrderChecker &Checker) {
- Section.Offset = Ctx.Ptr - Ctx.Start;
Section.Type = readUint8(Ctx);
LLVM_DEBUG(dbgs() << "readSection type=" << Section.Type << "\n");
// When reading the section's size, store the size of the LEB used to encode
@@ -273,6 +272,7 @@ static Error readSection(WasmSection &Section, WasmObjectFile::ReadContext &Ctx,
const uint8_t *PreSizePtr = Ctx.Ptr;
uint32_t Size = readVaruint32(Ctx);
Section.HeaderSecSizeEncodingLen = Ctx.Ptr - PreSizePtr;
+ Section.Offset = Ctx.Ptr - Ctx.Start;
if (Size == 0)
return make_error<StringError>("zero length section",
object_error::parse_failed);
@@ -599,6 +599,10 @@ Error WasmObjectFile::parseLinkingSection(ReadContext &Ctx) {
Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
uint32_t Count = readVaruint32(Ctx);
+ // Clear out any symbol information that was derived from the exports
+ // section.
+ LinkingData.SymbolTable.clear();
+ Symbols.clear();
LinkingData.SymbolTable.reserve(Count);
Symbols.reserve(Count);
StringSet<> SymbolNames;
@@ -1290,37 +1294,75 @@ Error WasmObjectFile::parseGlobalSection(ReadContext &Ctx) {
Error WasmObjectFile::parseExportSection(ReadContext &Ctx) {
uint32_t Count = readVaruint32(Ctx);
Exports.reserve(Count);
+ LinkingData.SymbolTable.reserve(Count);
+ Symbols.reserve(Count);
for (uint32_t I = 0; I < Count; I++) {
wasm::WasmExport Ex;
Ex.Name = readString(Ctx);
Ex.Kind = readUint8(Ctx);
Ex.Index = readVaruint32(Ctx);
+ const wasm::WasmSignature *Signature = nullptr;
+ const wasm::WasmGlobalType *GlobalType = nullptr;
+ const wasm::WasmTableType *TableType = nullptr;
+ wasm::WasmSymbolInfo Info;
+ Info.Name = Ex.Name;
+ Info.Flags = 0;
switch (Ex.Kind) {
- case wasm::WASM_EXTERNAL_FUNCTION:
-
+ case wasm::WASM_EXTERNAL_FUNCTION: {
if (!isDefinedFunctionIndex(Ex.Index))
return make_error<GenericBinaryError>("invalid function export",
object_error::parse_failed);
getDefinedFunction(Ex.Index).ExportName = Ex.Name;
+ Info.Kind = wasm::WASM_SYMBOL_TYPE_FUNCTION;
+ Info.ElementIndex = Ex.Index;
+ unsigned FuncIndex = Info.ElementIndex - NumImportedFunctions;
+ wasm::WasmFunction &Function = Functions[FuncIndex];
+ Signature = &Signatures[Function.SigIndex];
break;
- case wasm::WASM_EXTERNAL_GLOBAL:
+ }
+ case wasm::WASM_EXTERNAL_GLOBAL: {
if (!isValidGlobalIndex(Ex.Index))
return make_error<GenericBinaryError>("invalid global export",
object_error::parse_failed);
+ Info.Kind = wasm::WASM_SYMBOL_TYPE_DATA;
+ uint64_t Offset = 0;
+ if (isDefinedGlobalIndex(Ex.Index)) {
+ auto Global = getDefinedGlobal(Ex.Index);
+ if (!Global.InitExpr.Extended) {
+ auto Inst = Global.InitExpr.Inst;
+ if (Inst.Opcode == wasm::WASM_OPCODE_I32_CONST) {
+ Offset = Inst.Value.Int32;
+ } else if (Inst.Opcode == wasm::WASM_OPCODE_I64_CONST) {
+ Offset = Inst.Value.Int64;
+ }
+ }
+ }
+ Info.DataRef = wasm::WasmDataReference{0, Offset, 0};
break;
+ }
case wasm::WASM_EXTERNAL_TAG:
if (!isValidTagIndex(Ex.Index))
return make_error<GenericBinaryError>("invalid tag export",
object_error::parse_failed);
+ Info.Kind = wasm::WASM_SYMBOL_TYPE_TAG;
+ Info.ElementIndex = Ex.Index;
break;
case wasm::WASM_EXTERNAL_MEMORY:
+ break;
case wasm::WASM_EXTERNAL_TABLE:
+ Info.Kind = wasm::WASM_SYMBOL_TYPE_TABLE;
break;
default:
return make_error<GenericBinaryError>("unexpected export kind",
object_error::parse_failed);
}
Exports.push_back(Ex);
+ if (Ex.Kind != wasm::WASM_EXTERNAL_MEMORY) {
+ LinkingData.SymbolTable.emplace_back(Info);
+ Symbols.emplace_back(LinkingData.SymbolTable.back(), GlobalType,
+ TableType, Signature);
+ LLVM_DEBUG(dbgs() << "Adding symbol: " << Symbols.back() << "\n");
+ }
}
if (Ctx.Ptr != Ctx.End)
return make_error<GenericBinaryError>("export section ended prematurely",
@@ -1644,6 +1686,8 @@ uint64_t WasmObjectFile::getWasmSymbolValue(const WasmSymbol &Sym) const {
return Segment.Offset.Inst.Value.Int32 + Sym.Info.DataRef.Offset;
} else if (Segment.Offset.Inst.Opcode == wasm::WASM_OPCODE_I64_CONST) {
return Segment.Offset.Inst.Value.Int64 + Sym.Info.DataRef.Offset;
+ } else if (Segment.Offset.Inst.Opcode == wasm::WASM_OPCODE_GLOBAL_GET) {
+ return Sym.Info.DataRef.Offset;
} else {
llvm_unreachable("unknown init expr opcode");
}
diff --git a/contrib/llvm-project/llvm/lib/Passes/PassBuilder.cpp b/contrib/llvm-project/llvm/lib/Passes/PassBuilder.cpp
index 95b9fb7ad735..f94bd422c6b5 100644
--- a/contrib/llvm-project/llvm/lib/Passes/PassBuilder.cpp
+++ b/contrib/llvm-project/llvm/lib/Passes/PassBuilder.cpp
@@ -83,6 +83,7 @@
#include "llvm/CodeGen/InterleavedAccess.h"
#include "llvm/CodeGen/InterleavedLoadCombine.h"
#include "llvm/CodeGen/JMCInstrumenter.h"
+#include "llvm/CodeGen/LowerEmuTLS.h"
#include "llvm/CodeGen/SafeStack.h"
#include "llvm/CodeGen/SelectOptimize.h"
#include "llvm/CodeGen/SjLjEHPrepare.h"
diff --git a/contrib/llvm-project/llvm/lib/Passes/PassRegistry.def b/contrib/llvm-project/llvm/lib/Passes/PassRegistry.def
index d8fc7cd8a231..82ce040c6496 100644
--- a/contrib/llvm-project/llvm/lib/Passes/PassRegistry.def
+++ b/contrib/llvm-project/llvm/lib/Passes/PassRegistry.def
@@ -83,6 +83,7 @@ MODULE_PASS("internalize", InternalizePass())
MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
MODULE_PASS("iroutliner", IROutlinerPass())
MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass())
+MODULE_PASS("lower-emutls", LowerEmuTLSPass())
MODULE_PASS("lower-global-dtors", LowerGlobalDtorsPass())
MODULE_PASS("lower-ifunc", LowerIFuncPass())
MODULE_PASS("lowertypetests", LowerTypeTestsPass())
diff --git a/contrib/llvm-project/llvm/lib/ProfileData/InstrProf.cpp b/contrib/llvm-project/llvm/lib/ProfileData/InstrProf.cpp
index 649d814cfd9d..134a400e639c 100644
--- a/contrib/llvm-project/llvm/lib/ProfileData/InstrProf.cpp
+++ b/contrib/llvm-project/llvm/lib/ProfileData/InstrProf.cpp
@@ -246,11 +246,27 @@ std::string InstrProfError::message() const {
char InstrProfError::ID = 0;
-std::string getPGOFuncName(StringRef RawFuncName,
- GlobalValue::LinkageTypes Linkage,
+std::string getPGOFuncName(StringRef Name, GlobalValue::LinkageTypes Linkage,
StringRef FileName,
uint64_t Version LLVM_ATTRIBUTE_UNUSED) {
- return GlobalValue::getGlobalIdentifier(RawFuncName, Linkage, FileName);
+ // Value names may be prefixed with a binary '1' to indicate
+ // that the backend should not modify the symbols due to any platform
+ // naming convention. Do not include that '1' in the PGO profile name.
+ if (Name[0] == '\1')
+ Name = Name.substr(1);
+
+ std::string NewName = std::string(Name);
+ if (llvm::GlobalValue::isLocalLinkage(Linkage)) {
+ // For local symbols, prepend the main file name to distinguish them.
+ // Do not include the full path in the file name since there's no guarantee
+ // that it will stay the same, e.g., if the files are checked out from
+ // version control in different locations.
+ if (FileName.empty())
+ NewName = NewName.insert(0, "<unknown>:");
+ else
+ NewName = NewName.insert(0, FileName.str() + ":");
+ }
+ return NewName;
}
// Strip NumPrefix level of directory name from PathNameStr. If the number of
@@ -300,12 +316,10 @@ getIRPGONameForGlobalObject(const GlobalObject &GO,
GlobalValue::LinkageTypes Linkage,
StringRef FileName) {
SmallString<64> Name;
- if (llvm::GlobalValue::isLocalLinkage(Linkage)) {
- Name.append(FileName.empty() ? "<unknown>" : FileName);
- Name.append(";");
- }
+ // FIXME: Mangler's handling is kept outside of `getGlobalIdentifier` for now.
+ // For more details please check issue #74565.
Mangler().getNameWithPrefix(Name, &GO, /*CannotUsePrivateLabel=*/true);
- return Name.str().str();
+ return GlobalValue::getGlobalIdentifier(Name, Linkage, FileName);
}
static std::optional<std::string> lookupPGONameFromMetadata(MDNode *MD) {
@@ -352,6 +366,9 @@ std::string getIRPGOFuncName(const Function &F, bool InLTO) {
return getIRPGOObjectName(F, InLTO, getPGOFuncNameMetadata(F));
}
+// Please use getIRPGOFuncName for LLVM IR instrumentation. This function is
+// for front-end (Clang, etc) instrumentation.
+// The implementation is kept for profile matching from older profiles.
// This is similar to `getIRPGOFuncName` except that this function calls
// 'getPGOFuncName' to get a name and `getIRPGOFuncName` calls
// 'getIRPGONameForGlobalObject'. See the difference between two callees in the
@@ -384,7 +401,8 @@ getParsedIRPGOFuncName(StringRef IRPGOFuncName) {
StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName, StringRef FileName) {
if (FileName.empty())
return PGOFuncName;
- // Drop the file name including ':'. See also getPGOFuncName.
+ // Drop the file name including ':' or ';'. See getIRPGONameForGlobalObject as
+ // well.
if (PGOFuncName.starts_with(FileName))
PGOFuncName = PGOFuncName.drop_front(FileName.size() + 1);
return PGOFuncName;
diff --git a/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp b/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp
index 068922d421f8..8f62df79d5b7 100644
--- a/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -1008,12 +1008,13 @@ public:
/// Extract the original function name from a PGO function name.
static StringRef extractName(StringRef Name) {
- // We can have multiple :-separated pieces; there can be pieces both
- // before and after the mangled name. Find the first part that starts
- // with '_Z'; we'll assume that's the mangled name we want.
+ // We can have multiple pieces separated by kGlobalIdentifierDelimiter (
+ // semicolon now and colon in older profiles); there can be pieces both
+ // before and after the mangled name. Find the first part that starts with
+ // '_Z'; we'll assume that's the mangled name we want.
std::pair<StringRef, StringRef> Parts = {StringRef(), Name};
while (true) {
- Parts = Parts.second.split(':');
+ Parts = Parts.second.split(kGlobalIdentifierDelimiter);
if (Parts.first.starts_with("_Z"))
return Parts.first;
if (Parts.second.empty())
diff --git a/contrib/llvm-project/llvm/lib/ProfileData/RawMemProfReader.cpp b/contrib/llvm-project/llvm/lib/ProfileData/RawMemProfReader.cpp
index af2db8d61179..0e2b8668bab7 100644
--- a/contrib/llvm-project/llvm/lib/ProfileData/RawMemProfReader.cpp
+++ b/contrib/llvm-project/llvm/lib/ProfileData/RawMemProfReader.cpp
@@ -336,6 +336,13 @@ Error RawMemProfReader::initialize(std::unique_ptr<MemoryBuffer> DataBuffer) {
inconvertibleErrorCode()),
FileName);
+ // Process the raw profile.
+ if (Error E = readRawProfile(std::move(DataBuffer)))
+ return E;
+
+ if (Error E = setupForSymbolization())
+ return E;
+
auto *Object = cast<object::ObjectFile>(Binary.getBinary());
std::unique_ptr<DIContext> Context = DWARFContext::create(
*Object, DWARFContext::ProcessDebugRelocations::Process);
@@ -344,16 +351,13 @@ Error RawMemProfReader::initialize(std::unique_ptr<MemoryBuffer> DataBuffer) {
Object, std::move(Context), /*UntagAddresses=*/false);
if (!SOFOr)
return report(SOFOr.takeError(), FileName);
- Symbolizer = std::move(SOFOr.get());
-
- // Process the raw profile.
- if (Error E = readRawProfile(std::move(DataBuffer)))
- return E;
-
- if (Error E = setupForSymbolization())
- return E;
+ auto Symbolizer = std::move(SOFOr.get());
- if (Error E = symbolizeAndFilterStackFrames())
+ // The symbolizer ownership is moved into symbolizeAndFilterStackFrames so
+ // that it is freed automatically at the end, when it is no longer used. This
+ // reduces peak memory since it won't be live while also mapping the raw
+ // profile into records afterwards.
+ if (Error E = symbolizeAndFilterStackFrames(std::move(Symbolizer)))
return E;
return mapRawProfileToRecords();
@@ -469,7 +473,8 @@ Error RawMemProfReader::mapRawProfileToRecords() {
return Error::success();
}
-Error RawMemProfReader::symbolizeAndFilterStackFrames() {
+Error RawMemProfReader::symbolizeAndFilterStackFrames(
+ std::unique_ptr<llvm::symbolize::SymbolizableModule> Symbolizer) {
// The specifier to use when symbolization is requested.
const DILineInfoSpecifier Specifier(
DILineInfoSpecifier::FileLineInfoKind::RawValue,
diff --git a/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp b/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
index 088b4e4d755c..368dead44914 100644
--- a/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
@@ -175,6 +175,23 @@ public:
StringRef Overview, raw_ostream *Errs = nullptr,
bool LongOptionsUseDoubleDash = false);
+ void forEachSubCommand(Option &Opt, function_ref<void(SubCommand &)> Action) {
+ if (Opt.Subs.empty()) {
+ Action(SubCommand::getTopLevel());
+ return;
+ }
+ if (Opt.Subs.size() == 1 && *Opt.Subs.begin() == &SubCommand::getAll()) {
+ for (auto *SC : RegisteredSubCommands)
+ Action(*SC);
+ return;
+ }
+ for (auto *SC : Opt.Subs) {
+ assert(SC != &SubCommand::getAll() &&
+ "SubCommand::getAll() should not be used with other subcommands");
+ Action(*SC);
+ }
+ }
+
void addLiteralOption(Option &Opt, SubCommand *SC, StringRef Name) {
if (Opt.hasArgStr())
return;
@@ -183,25 +200,11 @@ public:
<< "' registered more than once!\n";
report_fatal_error("inconsistency in registered CommandLine options");
}
-
- // If we're adding this to all sub-commands, add it to the ones that have
- // already been registered.
- if (SC == &SubCommand::getAll()) {
- for (auto *Sub : RegisteredSubCommands) {
- if (SC == Sub)
- continue;
- addLiteralOption(Opt, Sub, Name);
- }
- }
}
void addLiteralOption(Option &Opt, StringRef Name) {
- if (Opt.Subs.empty())
- addLiteralOption(Opt, &SubCommand::getTopLevel(), Name);
- else {
- for (auto *SC : Opt.Subs)
- addLiteralOption(Opt, SC, Name);
- }
+ forEachSubCommand(
+ Opt, [&](SubCommand &SC) { addLiteralOption(Opt, &SC, Name); });
}
void addOption(Option *O, SubCommand *SC) {
@@ -238,16 +241,6 @@ public:
// linked LLVM distribution.
if (HadErrors)
report_fatal_error("inconsistency in registered CommandLine options");
-
- // If we're adding this to all sub-commands, add it to the ones that have
- // already been registered.
- if (SC == &SubCommand::getAll()) {
- for (auto *Sub : RegisteredSubCommands) {
- if (SC == Sub)
- continue;
- addOption(O, Sub);
- }
- }
}
void addOption(Option *O, bool ProcessDefaultOption = false) {
@@ -255,13 +248,7 @@ public:
DefaultOptions.push_back(O);
return;
}
-
- if (O->Subs.empty()) {
- addOption(O, &SubCommand::getTopLevel());
- } else {
- for (auto *SC : O->Subs)
- addOption(O, SC);
- }
+ forEachSubCommand(*O, [&](SubCommand &SC) { addOption(O, &SC); });
}
void removeOption(Option *O, SubCommand *SC) {
@@ -298,17 +285,7 @@ public:
}
void removeOption(Option *O) {
- if (O->Subs.empty())
- removeOption(O, &SubCommand::getTopLevel());
- else {
- if (O->isInAllSubCommands()) {
- for (auto *SC : RegisteredSubCommands)
- removeOption(O, SC);
- } else {
- for (auto *SC : O->Subs)
- removeOption(O, SC);
- }
- }
+ forEachSubCommand(*O, [&](SubCommand &SC) { removeOption(O, &SC); });
}
bool hasOptions(const SubCommand &Sub) const {
@@ -344,17 +321,8 @@ public:
}
void updateArgStr(Option *O, StringRef NewName) {
- if (O->Subs.empty())
- updateArgStr(O, NewName, &SubCommand::getTopLevel());
- else {
- if (O->isInAllSubCommands()) {
- for (auto *SC : RegisteredSubCommands)
- updateArgStr(O, NewName, SC);
- } else {
- for (auto *SC : O->Subs)
- updateArgStr(O, NewName, SC);
- }
- }
+ forEachSubCommand(*O,
+ [&](SubCommand &SC) { updateArgStr(O, NewName, &SC); });
}
void printOptionValues();
diff --git a/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp b/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp
index bbbaf26a7bd4..7256e9a29329 100644
--- a/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp
@@ -145,6 +145,9 @@ static const RISCVSupportedExtension SupportedExtensions[] = {
{"zmmul", RISCVExtensionVersion{1, 0}},
+ {"zvbb", RISCVExtensionVersion{1, 0}},
+ {"zvbc", RISCVExtensionVersion{1, 0}},
+
{"zve32f", RISCVExtensionVersion{1, 0}},
{"zve32x", RISCVExtensionVersion{1, 0}},
{"zve64d", RISCVExtensionVersion{1, 0}},
@@ -154,6 +157,22 @@ static const RISCVSupportedExtension SupportedExtensions[] = {
{"zvfh", RISCVExtensionVersion{1, 0}},
{"zvfhmin", RISCVExtensionVersion{1, 0}},
+ // vector crypto
+ {"zvkb", RISCVExtensionVersion{1, 0}},
+ {"zvkg", RISCVExtensionVersion{1, 0}},
+ {"zvkn", RISCVExtensionVersion{1, 0}},
+ {"zvknc", RISCVExtensionVersion{1, 0}},
+ {"zvkned", RISCVExtensionVersion{1, 0}},
+ {"zvkng", RISCVExtensionVersion{1, 0}},
+ {"zvknha", RISCVExtensionVersion{1, 0}},
+ {"zvknhb", RISCVExtensionVersion{1, 0}},
+ {"zvks", RISCVExtensionVersion{1, 0}},
+ {"zvksc", RISCVExtensionVersion{1, 0}},
+ {"zvksed", RISCVExtensionVersion{1, 0}},
+ {"zvksg", RISCVExtensionVersion{1, 0}},
+ {"zvksh", RISCVExtensionVersion{1, 0}},
+ {"zvkt", RISCVExtensionVersion{1, 0}},
+
{"zvl1024b", RISCVExtensionVersion{1, 0}},
{"zvl128b", RISCVExtensionVersion{1, 0}},
{"zvl16384b", RISCVExtensionVersion{1, 0}},
@@ -179,27 +198,8 @@ static const RISCVSupportedExtension SupportedExperimentalExtensions[] = {
{"ztso", RISCVExtensionVersion{0, 1}},
- {"zvbb", RISCVExtensionVersion{1, 0}},
- {"zvbc", RISCVExtensionVersion{1, 0}},
-
{"zvfbfmin", RISCVExtensionVersion{0, 8}},
{"zvfbfwma", RISCVExtensionVersion{0, 8}},
-
- // vector crypto
- {"zvkb", RISCVExtensionVersion{1, 0}},
- {"zvkg", RISCVExtensionVersion{1, 0}},
- {"zvkn", RISCVExtensionVersion{1, 0}},
- {"zvknc", RISCVExtensionVersion{1, 0}},
- {"zvkned", RISCVExtensionVersion{1, 0}},
- {"zvkng", RISCVExtensionVersion{1, 0}},
- {"zvknha", RISCVExtensionVersion{1, 0}},
- {"zvknhb", RISCVExtensionVersion{1, 0}},
- {"zvks", RISCVExtensionVersion{1, 0}},
- {"zvksc", RISCVExtensionVersion{1, 0}},
- {"zvksed", RISCVExtensionVersion{1, 0}},
- {"zvksg", RISCVExtensionVersion{1, 0}},
- {"zvksh", RISCVExtensionVersion{1, 0}},
- {"zvkt", RISCVExtensionVersion{1, 0}},
};
static void verifyTables() {
@@ -215,11 +215,12 @@ static void verifyTables() {
#endif
}
-static void PrintExtension(const std::string Name, const std::string Version,
- const std::string Description) {
- outs() << " "
- << format(Description.empty() ? "%-20s%s\n" : "%-20s%-10s%s\n",
- Name.c_str(), Version.c_str(), Description.c_str());
+static void PrintExtension(StringRef Name, StringRef Version,
+ StringRef Description) {
+ outs().indent(4);
+ unsigned VersionWidth = Description.empty() ? 0 : 10;
+ outs() << left_justify(Name, 20) << left_justify(Version, VersionWidth)
+ << Description << "\n";
}
void llvm::riscvExtensionsHelp(StringMap<StringRef> DescMap) {
@@ -233,7 +234,7 @@ void llvm::riscvExtensionsHelp(StringMap<StringRef> DescMap) {
for (const auto &E : ExtMap) {
std::string Version = std::to_string(E.second.MajorVersion) + "." +
std::to_string(E.second.MinorVersion);
- PrintExtension(E.first, Version, DescMap[E.first].str());
+ PrintExtension(E.first, Version, DescMap[E.first]);
}
outs() << "\nExperimental extensions\n";
@@ -243,7 +244,7 @@ void llvm::riscvExtensionsHelp(StringMap<StringRef> DescMap) {
for (const auto &E : ExtMap) {
std::string Version = std::to_string(E.second.MajorVersion) + "." +
std::to_string(E.second.MinorVersion);
- PrintExtension(E.first, Version, DescMap["experimental-" + E.first].str());
+ PrintExtension(E.first, Version, DescMap["experimental-" + E.first]);
}
outs() << "\nUse -march to specify the target's extension.\n"
@@ -995,25 +996,25 @@ static const char *ImpliedExtsD[] = {"f"};
static const char *ImpliedExtsF[] = {"zicsr"};
static const char *ImpliedExtsV[] = {"zvl128b", "zve64d"};
static const char *ImpliedExtsXTHeadVdot[] = {"v"};
-static const char *ImpliedExtsXsfvcp[] = {"zve32x"};
-static const char *ImpliedExtsXsfvfnrclipxfqf[] = {"zve32f"};
-static const char *ImpliedExtsXsfvfwmaccqqq[] = {"zve32f", "zvfbfmin"};
-static const char *ImpliedExtsXsfvqmaccdod[] = {"zve32x"};
-static const char *ImpliedExtsXsfvqmaccqoq[] = {"zve32x"};
+static const char *ImpliedExtsXSfvcp[] = {"zve32x"};
+static const char *ImpliedExtsXSfvfnrclipxfqf[] = {"zve32f"};
+static const char *ImpliedExtsXSfvfwmaccqqq[] = {"zvfbfmin"};
+static const char *ImpliedExtsXSfvqmaccdod[] = {"zve32x"};
+static const char *ImpliedExtsXSfvqmaccqoq[] = {"zve32x"};
static const char *ImpliedExtsZacas[] = {"a"};
static const char *ImpliedExtsZcb[] = {"zca"};
static const char *ImpliedExtsZcd[] = {"d", "zca"};
static const char *ImpliedExtsZce[] = {"zcb", "zcmp", "zcmt"};
static const char *ImpliedExtsZcf[] = {"f", "zca"};
static const char *ImpliedExtsZcmp[] = {"zca"};
-static const char *ImpliedExtsZcmt[] = {"zca"};
+static const char *ImpliedExtsZcmt[] = {"zca", "zicsr"};
static const char *ImpliedExtsZdinx[] = {"zfinx"};
static const char *ImpliedExtsZfa[] = {"f"};
static const char *ImpliedExtsZfbfmin[] = {"f"};
static const char *ImpliedExtsZfh[] = {"zfhmin"};
static const char *ImpliedExtsZfhmin[] = {"f"};
static const char *ImpliedExtsZfinx[] = {"zicsr"};
-static const char *ImpliedExtsZhinx[] = {"zfinx"};
+static const char *ImpliedExtsZhinx[] = {"zhinxmin"};
static const char *ImpliedExtsZhinxmin[] = {"zfinx"};
static const char *ImpliedExtsZicntr[] = {"zicsr"};
static const char *ImpliedExtsZihpm[] = {"zicsr"};
@@ -1027,9 +1028,9 @@ static const char *ImpliedExtsZve32x[] = {"zvl32b", "zicsr"};
static const char *ImpliedExtsZve64d[] = {"zve64f", "d"};
static const char *ImpliedExtsZve64f[] = {"zve64x", "zve32f"};
static const char *ImpliedExtsZve64x[] = {"zve32x", "zvl64b"};
-static const char *ImpliedExtsZvfbfmin[] = {"zve32f", "zfbfmin"};
-static const char *ImpliedExtsZvfbfwma[] = {"zvfbfmin"};
-static const char *ImpliedExtsZvfh[] = {"zve32f", "zfhmin"};
+static const char *ImpliedExtsZvfbfmin[] = {"zve32f"};
+static const char *ImpliedExtsZvfbfwma[] = {"zvfbfmin", "zfbfmin"};
+static const char *ImpliedExtsZvfh[] = {"zvfhmin", "zfhmin"};
static const char *ImpliedExtsZvfhmin[] = {"zve32f"};
static const char *ImpliedExtsZvkn[] = {"zvkb", "zvkned", "zvknhb", "zvkt"};
static const char *ImpliedExtsZvknc[] = {"zvbc", "zvkn"};
@@ -1066,11 +1067,11 @@ static constexpr ImpliedExtsEntry ImpliedExts[] = {
{{"d"}, {ImpliedExtsD}},
{{"f"}, {ImpliedExtsF}},
{{"v"}, {ImpliedExtsV}},
- {{"xsfvcp"}, {ImpliedExtsXsfvcp}},
- {{"xsfvfnrclipxfqf"}, {ImpliedExtsXsfvfnrclipxfqf}},
- {{"xsfvfwmaccqqq"}, {ImpliedExtsXsfvfwmaccqqq}},
- {{"xsfvqmaccdod"}, {ImpliedExtsXsfvqmaccdod}},
- {{"xsfvqmaccqoq"}, {ImpliedExtsXsfvqmaccqoq}},
+ {{"xsfvcp"}, {ImpliedExtsXSfvcp}},
+ {{"xsfvfnrclipxfqf"}, {ImpliedExtsXSfvfnrclipxfqf}},
+ {{"xsfvfwmaccqqq"}, {ImpliedExtsXSfvfwmaccqqq}},
+ {{"xsfvqmaccdod"}, {ImpliedExtsXSfvqmaccdod}},
+ {{"xsfvqmaccqoq"}, {ImpliedExtsXSfvqmaccqoq}},
{{"xtheadvdot"}, {ImpliedExtsXTHeadVdot}},
{{"zacas"}, {ImpliedExtsZacas}},
{{"zcb"}, {ImpliedExtsZcb}},
diff --git a/contrib/llvm-project/llvm/lib/Support/Signals.cpp b/contrib/llvm-project/llvm/lib/Support/Signals.cpp
index 669a9e2a8396..9f9030e79d10 100644
--- a/contrib/llvm-project/llvm/lib/Support/Signals.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/Signals.cpp
@@ -145,7 +145,7 @@ static bool printSymbolizedStackTrace(StringRef Argv0, void **StackTrace,
return false;
// Don't recursively invoke the llvm-symbolizer binary.
- if (Argv0.find("llvm-symbolizer") != std::string::npos)
+ if (Argv0.contains("llvm-symbolizer"))
return false;
// FIXME: Subtract necessary number from StackTrace entries to turn return addresses
diff --git a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
index 28ab85d4344c..3d3a564af51d 100644
--- a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
@@ -16,7 +16,6 @@
#include "llvm/Support/AutoConvert.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Duration.h"
-#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
@@ -25,17 +24,11 @@
#include "llvm/Support/NativeFormatting.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"
-#include "llvm/Support/Threading.h"
#include <algorithm>
#include <cerrno>
#include <cstdio>
#include <sys/stat.h>
-#ifndef _WIN32
-#include <sys/socket.h>
-#include <sys/un.h>
-#endif // _WIN32
-
// <fcntl.h> may provide O_BINARY.
#if defined(HAVE_FCNTL_H)
# include <fcntl.h>
@@ -66,13 +59,6 @@
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/Windows/WindowsSupport.h"
-// winsock2.h must be included before afunix.h. Briefly turn off clang-format to
-// avoid error.
-// clang-format off
-#include <winsock2.h>
-#include <afunix.h>
-// clang-format on
-#include <io.h>
#endif
using namespace llvm;
@@ -659,7 +645,7 @@ raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered,
// Check if this is a console device. This is not equivalent to isatty.
IsWindowsConsole =
::GetFileType((HANDLE)::_get_osfhandle(fd)) == FILE_TYPE_CHAR;
-#endif // _WIN32
+#endif
// Get the starting position.
off_t loc = ::lseek(FD, 0, SEEK_CUR);
@@ -969,153 +955,6 @@ bool raw_fd_stream::classof(const raw_ostream *OS) {
}
//===----------------------------------------------------------------------===//
-// raw_socket_stream
-//===----------------------------------------------------------------------===//
-
-#ifdef _WIN32
-WSABalancer::WSABalancer() {
- WSADATA WsaData;
- ::memset(&WsaData, 0, sizeof(WsaData));
- if (WSAStartup(MAKEWORD(2, 2), &WsaData) != 0) {
- llvm::report_fatal_error("WSAStartup failed");
- }
-}
-
-WSABalancer::~WSABalancer() { WSACleanup(); }
-
-#endif // _WIN32
-
-static std::error_code getLastSocketErrorCode() {
-#ifdef _WIN32
- return std::error_code(::WSAGetLastError(), std::system_category());
-#else
- return std::error_code(errno, std::system_category());
-#endif
-}
-
-ListeningSocket::ListeningSocket(int SocketFD, StringRef SocketPath)
- : FD(SocketFD), SocketPath(SocketPath) {}
-
-ListeningSocket::ListeningSocket(ListeningSocket &&LS)
- : FD(LS.FD), SocketPath(LS.SocketPath) {
- LS.FD = -1;
-}
-
-Expected<ListeningSocket> ListeningSocket::createUnix(StringRef SocketPath,
- int MaxBacklog) {
-
-#ifdef _WIN32
- WSABalancer _;
- SOCKET MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
- if (MaybeWinsocket == INVALID_SOCKET) {
-#else
- int MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
- if (MaybeWinsocket == -1) {
-#endif
- return llvm::make_error<StringError>(getLastSocketErrorCode(),
- "socket create failed");
- }
-
- struct sockaddr_un Addr;
- memset(&Addr, 0, sizeof(Addr));
- Addr.sun_family = AF_UNIX;
- strncpy(Addr.sun_path, SocketPath.str().c_str(), sizeof(Addr.sun_path) - 1);
-
- if (bind(MaybeWinsocket, (struct sockaddr *)&Addr, sizeof(Addr)) == -1) {
- std::error_code Err = getLastSocketErrorCode();
- if (Err == std::errc::address_in_use)
- ::close(MaybeWinsocket);
- return llvm::make_error<StringError>(Err, "Bind error");
- }
- if (listen(MaybeWinsocket, MaxBacklog) == -1) {
- return llvm::make_error<StringError>(getLastSocketErrorCode(),
- "Listen error");
- }
- int UnixSocket;
-#ifdef _WIN32
- UnixSocket = _open_osfhandle(MaybeWinsocket, 0);
-#else
- UnixSocket = MaybeWinsocket;
-#endif // _WIN32
- return ListeningSocket{UnixSocket, SocketPath};
-}
-
-Expected<std::unique_ptr<raw_socket_stream>> ListeningSocket::accept() {
- int AcceptFD;
-#ifdef _WIN32
- SOCKET WinServerSock = _get_osfhandle(FD);
- SOCKET WinAcceptSock = ::accept(WinServerSock, NULL, NULL);
- AcceptFD = _open_osfhandle(WinAcceptSock, 0);
-#else
- AcceptFD = ::accept(FD, NULL, NULL);
-#endif //_WIN32
- if (AcceptFD == -1)
- return llvm::make_error<StringError>(getLastSocketErrorCode(),
- "Accept failed");
- return std::make_unique<raw_socket_stream>(AcceptFD);
-}
-
-ListeningSocket::~ListeningSocket() {
- if (FD == -1)
- return;
- ::close(FD);
- unlink(SocketPath.c_str());
-}
-
-static Expected<int> GetSocketFD(StringRef SocketPath) {
-#ifdef _WIN32
- SOCKET MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
- if (MaybeWinsocket == INVALID_SOCKET) {
-#else
- int MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
- if (MaybeWinsocket == -1) {
-#endif // _WIN32
- return llvm::make_error<StringError>(getLastSocketErrorCode(),
- "Create socket failed");
- }
-
- struct sockaddr_un Addr;
- memset(&Addr, 0, sizeof(Addr));
- Addr.sun_family = AF_UNIX;
- strncpy(Addr.sun_path, SocketPath.str().c_str(), sizeof(Addr.sun_path) - 1);
-
- int status = connect(MaybeWinsocket, (struct sockaddr *)&Addr, sizeof(Addr));
- if (status == -1) {
- return llvm::make_error<StringError>(getLastSocketErrorCode(),
- "Connect socket failed");
- }
-#ifdef _WIN32
- return _open_osfhandle(MaybeWinsocket, 0);
-#else
- return MaybeWinsocket;
-#endif // _WIN32
-}
-
-raw_socket_stream::raw_socket_stream(int SocketFD)
- : raw_fd_stream(SocketFD, true) {}
-
-Expected<std::unique_ptr<raw_socket_stream>>
-raw_socket_stream::createConnectedUnix(StringRef SocketPath) {
-#ifdef _WIN32
- WSABalancer _;
-#endif // _WIN32
- Expected<int> FD = GetSocketFD(SocketPath);
- if (!FD)
- return FD.takeError();
- return std::make_unique<raw_socket_stream>(*FD);
-}
-
-raw_socket_stream::~raw_socket_stream() {}
-
-//===----------------------------------------------------------------------===//
-// raw_string_ostream
-//===----------------------------------------------------------------------===//
-
-void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
- OS.append(Ptr, Size);
-}
-
-//===----------------------------------------------------------------------===//
// raw_svector_ostream
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/lib/Support/raw_socket_stream.cpp b/contrib/llvm-project/llvm/lib/Support/raw_socket_stream.cpp
new file mode 100644
index 000000000000..4659880cfe19
--- /dev/null
+++ b/contrib/llvm-project/llvm/lib/Support/raw_socket_stream.cpp
@@ -0,0 +1,179 @@
+//===-- llvm/Support/raw_socket_stream.cpp - Socket streams --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains raw_ostream implementations for streams to communicate
+// via UNIX sockets
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/raw_socket_stream.h"
+#include "llvm/Config/config.h"
+#include "llvm/Support/Error.h"
+
+#ifndef _WIN32
+#include <sys/socket.h>
+#include <sys/un.h>
+#else
+#include "llvm/Support/Windows/WindowsSupport.h"
+// winsock2.h must be included before afunix.h. Briefly turn off clang-format to
+// avoid error.
+// clang-format off
+#include <winsock2.h>
+#include <afunix.h>
+// clang-format on
+#include <io.h>
+#endif // _WIN32
+
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+
+using namespace llvm;
+
+#ifdef _WIN32
+WSABalancer::WSABalancer() {
+ WSADATA WsaData;
+ ::memset(&WsaData, 0, sizeof(WsaData));
+ if (WSAStartup(MAKEWORD(2, 2), &WsaData) != 0) {
+ llvm::report_fatal_error("WSAStartup failed");
+ }
+}
+
+WSABalancer::~WSABalancer() { WSACleanup(); }
+
+#endif // _WIN32
+
+static std::error_code getLastSocketErrorCode() {
+#ifdef _WIN32
+ return std::error_code(::WSAGetLastError(), std::system_category());
+#else
+ return std::error_code(errno, std::system_category());
+#endif
+}
+
+ListeningSocket::ListeningSocket(int SocketFD, StringRef SocketPath)
+ : FD(SocketFD), SocketPath(SocketPath) {}
+
+ListeningSocket::ListeningSocket(ListeningSocket &&LS)
+ : FD(LS.FD), SocketPath(LS.SocketPath) {
+ LS.FD = -1;
+}
+
+Expected<ListeningSocket> ListeningSocket::createUnix(StringRef SocketPath,
+ int MaxBacklog) {
+
+#ifdef _WIN32
+ WSABalancer _;
+ SOCKET MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (MaybeWinsocket == INVALID_SOCKET) {
+#else
+ int MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (MaybeWinsocket == -1) {
+#endif
+ return llvm::make_error<StringError>(getLastSocketErrorCode(),
+ "socket create failed");
+ }
+
+ struct sockaddr_un Addr;
+ memset(&Addr, 0, sizeof(Addr));
+ Addr.sun_family = AF_UNIX;
+ strncpy(Addr.sun_path, SocketPath.str().c_str(), sizeof(Addr.sun_path) - 1);
+
+ if (bind(MaybeWinsocket, (struct sockaddr *)&Addr, sizeof(Addr)) == -1) {
+ std::error_code Err = getLastSocketErrorCode();
+ if (Err == std::errc::address_in_use)
+ ::close(MaybeWinsocket);
+ return llvm::make_error<StringError>(Err, "Bind error");
+ }
+ if (listen(MaybeWinsocket, MaxBacklog) == -1) {
+ return llvm::make_error<StringError>(getLastSocketErrorCode(),
+ "Listen error");
+ }
+ int UnixSocket;
+#ifdef _WIN32
+ UnixSocket = _open_osfhandle(MaybeWinsocket, 0);
+#else
+ UnixSocket = MaybeWinsocket;
+#endif // _WIN32
+ return ListeningSocket{UnixSocket, SocketPath};
+}
+
+Expected<std::unique_ptr<raw_socket_stream>> ListeningSocket::accept() {
+ int AcceptFD;
+#ifdef _WIN32
+ SOCKET WinServerSock = _get_osfhandle(FD);
+ SOCKET WinAcceptSock = ::accept(WinServerSock, NULL, NULL);
+ AcceptFD = _open_osfhandle(WinAcceptSock, 0);
+#else
+ AcceptFD = ::accept(FD, NULL, NULL);
+#endif //_WIN32
+ if (AcceptFD == -1)
+ return llvm::make_error<StringError>(getLastSocketErrorCode(),
+ "Accept failed");
+ return std::make_unique<raw_socket_stream>(AcceptFD);
+}
+
+ListeningSocket::~ListeningSocket() {
+ if (FD == -1)
+ return;
+ ::close(FD);
+ unlink(SocketPath.c_str());
+}
+
+static Expected<int> GetSocketFD(StringRef SocketPath) {
+#ifdef _WIN32
+ SOCKET MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (MaybeWinsocket == INVALID_SOCKET) {
+#else
+ int MaybeWinsocket = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (MaybeWinsocket == -1) {
+#endif // _WIN32
+ return llvm::make_error<StringError>(getLastSocketErrorCode(),
+ "Create socket failed");
+ }
+
+ struct sockaddr_un Addr;
+ memset(&Addr, 0, sizeof(Addr));
+ Addr.sun_family = AF_UNIX;
+ strncpy(Addr.sun_path, SocketPath.str().c_str(), sizeof(Addr.sun_path) - 1);
+
+ int status = connect(MaybeWinsocket, (struct sockaddr *)&Addr, sizeof(Addr));
+ if (status == -1) {
+ return llvm::make_error<StringError>(getLastSocketErrorCode(),
+ "Connect socket failed");
+ }
+#ifdef _WIN32
+ return _open_osfhandle(MaybeWinsocket, 0);
+#else
+ return MaybeWinsocket;
+#endif // _WIN32
+}
+
+raw_socket_stream::raw_socket_stream(int SocketFD)
+ : raw_fd_stream(SocketFD, true) {}
+
+Expected<std::unique_ptr<raw_socket_stream>>
+raw_socket_stream::createConnectedUnix(StringRef SocketPath) {
+#ifdef _WIN32
+ WSABalancer _;
+#endif // _WIN32
+ Expected<int> FD = GetSocketFD(SocketPath);
+ if (!FD)
+ return FD.takeError();
+ return std::make_unique<raw_socket_stream>(*FD);
+}
+
+raw_socket_stream::~raw_socket_stream() {}
+
+//===----------------------------------------------------------------------===//
+// raw_string_ostream
+//===----------------------------------------------------------------------===//
+
+void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
+ OS.append(Ptr, Size);
+}
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64.td
index c600bcaab2b3..68f452039c9b 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64.td
@@ -622,6 +622,17 @@ def FeatureLdpAlignedOnly : SubtargetFeature<"ldp-aligned-only", "HasLdpAlignedO
def FeatureStpAlignedOnly : SubtargetFeature<"stp-aligned-only", "HasStpAlignedOnly",
"true", "In order to emit stp, first check if the store will be aligned to 2 * element_size">;
+// AArch64 2023 Architecture Extensions (v9.5-A)
+
+def FeatureCPA : SubtargetFeature<"cpa", "HasCPA", "true",
+ "Enable Armv9.5-A Checked Pointer Arithmetic (FEAT_CPA)">;
+
+def FeaturePAuthLR : SubtargetFeature<"pauth-lr", "HasPAuthLR",
+ "true", "Enable Armv9.5-A PAC enhancements (FEAT_PAuth_LR)">;
+
+def FeatureTLBIW : SubtargetFeature<"tlbiw", "HasTLBIW", "true",
+ "Enable ARMv9.5-A TLBI VMALL for Dirty State (FEAT_TLBIW)">;
+
//===----------------------------------------------------------------------===//
// Architectures.
//
@@ -692,7 +703,7 @@ def HasV9_4aOps : SubtargetFeature<
def HasV9_5aOps : SubtargetFeature<
"v9.5a", "HasV9_5aOps", "true", "Support ARM v9.5a instructions",
- [HasV9_4aOps]>;
+ [HasV9_4aOps, FeatureCPA]>;
def HasV8_0rOps : SubtargetFeature<
"v8r", "HasV8_0rOps", "true", "Support ARM v8r instructions",
@@ -783,7 +794,7 @@ let F = [HasSVE2p1, HasSVE2p1_or_HasSME2, HasSVE2p1_or_HasSME2p1] in
def SVE2p1Unsupported : AArch64Unsupported;
def SVE2Unsupported : AArch64Unsupported {
- let F = !listconcat([HasSVE2, HasSVE2orSME, HasSSVE_FP8FMA, HasSMEF8F16,
+ let F = !listconcat([HasSVE2, HasSVE2orSME, HasSVE2orSME2, HasSSVE_FP8FMA, HasSMEF8F16,
HasSMEF8F32, HasSVE2AES, HasSVE2SHA3, HasSVE2SM4, HasSVE2BitPerm],
SVE2p1Unsupported.F);
}
@@ -797,7 +808,7 @@ let F = [HasSME2p1, HasSVE2p1_or_HasSME2p1] in
def SME2p1Unsupported : AArch64Unsupported;
def SME2Unsupported : AArch64Unsupported {
- let F = !listconcat([HasSME2, HasSVE2p1_or_HasSME2, HasSSVE_FP8FMA,
+ let F = !listconcat([HasSME2, HasSVE2orSME2, HasSVE2p1_or_HasSME2, HasSSVE_FP8FMA,
HasSMEF8F16, HasSMEF8F32],
SME2p1Unsupported.F);
}
@@ -807,7 +818,7 @@ def SMEUnsupported : AArch64Unsupported {
SME2Unsupported.F);
}
-let F = [HasPAuth] in
+let F = [HasPAuth, HasPAuthLR] in
def PAUnsupported : AArch64Unsupported;
include "AArch64SchedA53.td"
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64Combine.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64Combine.td
index d6c00be80bd9..99f256b88782 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64Combine.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64Combine.td
@@ -134,6 +134,14 @@ def shuffle_vector_lowering : GICombineGroup<[dup, rev, ext, zip, uzp, trn,
form_duplane,
shuf_to_ins]>;
+// Turn G_UNMERGE_VALUES -> G_EXTRACT_VECTOR_ELT's
+def vector_unmerge_lowering : GICombineRule <
+ (defs root:$root),
+ (match (wip_match_opcode G_UNMERGE_VALUES):$root,
+ [{ return matchScalarizeVectorUnmerge(*${root}, MRI); }]),
+ (apply [{ applyScalarizeVectorUnmerge(*${root}, MRI, B); }])
+>;
+
def adjust_icmp_imm_matchdata :
GIDefMatchData<"std::pair<uint64_t, CmpInst::Predicate>">;
def adjust_icmp_imm : GICombineRule <
@@ -251,7 +259,8 @@ def AArch64PostLegalizerLowering
icmp_lowering, build_vector_lowering,
lower_vector_fcmp, form_truncstore,
vector_sext_inreg_to_shift,
- unmerge_ext_to_unmerge, lower_mull]> {
+ unmerge_ext_to_unmerge, lower_mull,
+ vector_unmerge_lowering]> {
}
// Post-legalization combines which are primarily optimizations.
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
index 757471d6a905..bb7f4d907ffd 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
@@ -747,6 +747,15 @@ bool AArch64ExpandPseudo::expandSetTagLoop(
bool AArch64ExpandPseudo::expandSVESpillFill(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned Opc, unsigned N) {
+ assert((Opc == AArch64::LDR_ZXI || Opc == AArch64::STR_ZXI ||
+ Opc == AArch64::LDR_PXI || Opc == AArch64::STR_PXI) &&
+ "Unexpected opcode");
+ unsigned RState = (Opc == AArch64::LDR_ZXI || Opc == AArch64::LDR_PXI)
+ ? RegState::Define
+ : 0;
+ unsigned sub0 = (Opc == AArch64::LDR_ZXI || Opc == AArch64::STR_ZXI)
+ ? AArch64::zsub0
+ : AArch64::psub0;
const TargetRegisterInfo *TRI =
MBB.getParent()->getSubtarget().getRegisterInfo();
MachineInstr &MI = *MBBI;
@@ -756,9 +765,8 @@ bool AArch64ExpandPseudo::expandSVESpillFill(MachineBasicBlock &MBB,
assert(ImmOffset >= -256 && ImmOffset < 256 &&
"Immediate spill offset out of range");
BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc))
- .addReg(
- TRI->getSubReg(MI.getOperand(0).getReg(), AArch64::zsub0 + Offset),
- Opc == AArch64::LDR_ZXI ? RegState::Define : 0)
+ .addReg(TRI->getSubReg(MI.getOperand(0).getReg(), sub0 + Offset),
+ RState)
.addReg(MI.getOperand(1).getReg(), getKillRegState(Kill))
.addImm(ImmOffset);
}
@@ -1492,12 +1500,16 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock &MBB,
return expandSVESpillFill(MBB, MBBI, AArch64::STR_ZXI, 3);
case AArch64::STR_ZZXI:
return expandSVESpillFill(MBB, MBBI, AArch64::STR_ZXI, 2);
+ case AArch64::STR_PPXI:
+ return expandSVESpillFill(MBB, MBBI, AArch64::STR_PXI, 2);
case AArch64::LDR_ZZZZXI:
return expandSVESpillFill(MBB, MBBI, AArch64::LDR_ZXI, 4);
case AArch64::LDR_ZZZXI:
return expandSVESpillFill(MBB, MBBI, AArch64::LDR_ZXI, 3);
case AArch64::LDR_ZZXI:
return expandSVESpillFill(MBB, MBBI, AArch64::LDR_ZXI, 2);
+ case AArch64::LDR_PPXI:
+ return expandSVESpillFill(MBB, MBBI, AArch64::LDR_PXI, 2);
case AArch64::BLR_RVMARKER:
return expandCALL_RVMARKER(MBB, MBBI);
case AArch64::BLR_BTI:
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 3882e843fb69..dffe69bdb900 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -13708,15 +13708,18 @@ static SDValue EmitVectorComparison(SDValue LHS, SDValue RHS,
APInt SplatValue;
APInt SplatUndef;
- unsigned SplatBitSize;
+ unsigned SplatBitSize = 0;
bool HasAnyUndefs;
BuildVectorSDNode *BVN = dyn_cast<BuildVectorSDNode>(RHS.getNode());
bool IsCnst = BVN && BVN->isConstantSplat(SplatValue, SplatUndef,
SplatBitSize, HasAnyUndefs);
- bool IsZero = IsCnst && SplatValue == 0;
- bool IsOne = IsCnst && SplatValue == 1;
- bool IsMinusOne = IsCnst && SplatValue.isAllOnes();
+
+ bool IsSplatUniform =
+ SrcVT.getVectorElementType().getSizeInBits() >= SplatBitSize;
+ bool IsZero = IsCnst && SplatValue == 0 && IsSplatUniform;
+ bool IsOne = IsCnst && SplatValue == 1 && IsSplatUniform;
+ bool IsMinusOne = IsCnst && SplatValue.isAllOnes() && IsSplatUniform;
if (SrcVT.getVectorElementType().isFloatingPoint()) {
switch (CC) {
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 68e87f491a09..cb63d8726744 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -2368,6 +2368,80 @@ class ClearAuth<bits<1> data, string asm>
let Inst{4-0} = Rd;
}
+// v9.5-A FEAT_PAuth_LR
+
+class SignAuthFixedRegs<bits<5> opcode2, bits<6> opcode, string asm>
+ : I<(outs), (ins), asm, "", "", []>,
+ Sched<[WriteI, ReadI]> {
+ let Inst{31} = 0b1; // sf
+ let Inst{30} = 0b1;
+ let Inst{29} = 0b0; // S
+ let Inst{28-21} = 0b11010110;
+ let Inst{20-16} = opcode2;
+ let Inst{15-10} = opcode;
+ let Inst{9-5} = 0b11111; // Rn
+ let Inst{4-0} = 0b11110; // Rd
+}
+
+def PAuthPCRelLabel16Operand : PCRelLabel<16> {
+ let Name = "PAuthPCRelLabel16";
+ let PredicateMethod = "isPAuthPCRelLabel16Operand";
+}
+def am_pauth_pcrel : Operand<OtherVT> {
+ let EncoderMethod = "getPAuthPCRelOpValue";
+ let DecoderMethod = "DecodePCRelLabel16";
+ let PrintMethod = "printAlignedLabel";
+ let ParserMatchClass = PAuthPCRelLabel16Operand;
+ let OperandType = "OPERAND_PCREL";
+}
+
+class SignAuthPCRel<bits<2> opc, string asm>
+ : I<(outs), (ins am_pauth_pcrel:$label), asm, "\t$label", "", []>,
+ Sched<[]> {
+ bits<16> label;
+ let Inst{31} = 0b1; // sf
+ let Inst{30-23} = 0b11100111;
+ let Inst{22-21} = opc;
+ let Inst{20-5} = label; // imm
+ let Inst{4-0} = 0b11111; // Rd
+}
+
+class SignAuthOneReg<bits<5> opcode2, bits<6> opcode, string asm>
+ : I<(outs), (ins GPR64:$Rn), asm, "\t$Rn", "", []>,
+ Sched<[]> {
+ bits<5> Rn;
+ let Inst{31} = 0b1; // sf
+ let Inst{30} = 0b1;
+ let Inst{29} = 0b0; // S
+ let Inst{28-21} = 0b11010110;
+ let Inst{20-16} = opcode2;
+ let Inst{15-10} = opcode;
+ let Inst{9-5} = Rn;
+ let Inst{4-0} = 0b11110; // Rd
+}
+
+class SignAuthReturnPCRel<bits<3> opc, bits<5> op2, string asm>
+ : I<(outs), (ins am_pauth_pcrel:$label), asm, "\t$label", "", []>,
+ Sched<[WriteAtomic]> {
+ bits<16> label;
+ let Inst{31-24} = 0b01010101;
+ let Inst{23-21} = opc;
+ let Inst{20-5} = label; // imm16
+ let Inst{4-0} = op2;
+}
+
+class SignAuthReturnReg<bits<6> op3, string asm>
+ : I<(outs), (ins GPR64common:$Rm), asm, "\t$Rm", "", []>,
+ Sched<[WriteAtomic]> {
+ bits<5> Rm;
+ let Inst{31-25} = 0b1101011;
+ let Inst{24-21} = 0b0010; // opc
+ let Inst{20-16} = 0b11111; // op2
+ let Inst{15-10} = op3;
+ let Inst{9-5} = 0b11111; // Rn
+ let Inst{4-0} = Rm; // op4 (Rm)
+}
+
// Base class for the Armv8.4-A 8 and 16-bit flag manipulation instructions
class BaseFlagManipulation<bit sf, bit sz, dag iops, string asm, string ops>
: I<(outs), iops, asm, ops, "", []>,
@@ -12446,6 +12520,58 @@ class SystemPXtI<bit L, string asm> :
BaseSYSPEncoding<L, asm, "\t$op1, $Cn, $Cm, $op2, $Rt", (outs),
(ins imm0_7:$op1, sys_cr_op:$Cn, sys_cr_op:$Cm, imm0_7:$op2, XSeqPairClassOperand:$Rt)>;
+//----------------------------------------------------------------------------
+// 2023 Armv9.5 Extensions
+//----------------------------------------------------------------------------
+
+//---
+// Checked Pointer Arithmetic (FEAT_CPA)
+//---
+
+def LSLImm3ShiftOperand : AsmOperandClass {
+ let SuperClasses = [ExtendOperandLSL64];
+ let Name = "LSLImm3Shift";
+ let RenderMethod = "addLSLImm3ShifterOperands";
+ let DiagnosticType = "AddSubLSLImm3ShiftLarge";
+}
+
+def lsl_imm3_shift_operand : Operand<i32> {
+ let PrintMethod = "printShifter";
+ let ParserMatchClass = LSLImm3ShiftOperand;
+}
+
+// Base CPA scalar add/subtract with lsl #imm3 shift
+class BaseAddSubCPA<bit isSub, string asm> : I<(outs GPR64sp:$Rd),
+ (ins GPR64sp:$Rn, GPR64:$Rm, lsl_imm3_shift_operand:$shift_imm),
+ asm, "\t$Rd, $Rn, $Rm$shift_imm", "", []>, Sched<[]> {
+ bits<5> Rd;
+ bits<5> Rn;
+ bits<5> Rm;
+ bits<3> shift_imm;
+ let Inst{31} = 0b1;
+ let Inst{30} = isSub;
+ let Inst{29-21} = 0b011010000;
+ let Inst{20-16} = Rm;
+ let Inst{15-13} = 0b001;
+ let Inst{12-10} = shift_imm;
+ let Inst{9-5} = Rn;
+ let Inst{4-0} = Rd;
+}
+
+// Alias for CPA scalar add/subtract with no shift
+class AddSubCPAAlias<string asm, Instruction inst>
+ : InstAlias<asm#"\t$Rd, $Rn, $Rm",
+ (inst GPR64sp:$Rd, GPR64sp:$Rn, GPR64:$Rm, 0)>;
+
+multiclass AddSubCPA<bit isSub, string asm> {
+ def _shift : BaseAddSubCPA<isSub, asm>;
+ def _noshift : AddSubCPAAlias<asm, !cast<Instruction>(NAME#"_shift")>;
+}
+
+class MulAccumCPA<bit isSub, string asm>
+ : BaseMulAccum<isSub, 0b011, GPR64, GPR64, asm, []>, Sched<[]> {
+ let Inst{31} = 0b1;
+}
//----------------------------------------------------------------------------
// Allow the size specifier tokens to be upper case, not just lower.
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 7d71c316bcb0..1cfbf4737a6f 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -3771,6 +3771,13 @@ bool AArch64InstrInfo::getMemOpInfo(unsigned Opcode, TypeSize &Scale,
MinOffset = -256;
MaxOffset = 255;
break;
+ case AArch64::LDR_PPXI:
+ case AArch64::STR_PPXI:
+ Scale = TypeSize::getScalable(2);
+ Width = TypeSize::getScalable(2 * 2);
+ MinOffset = -256;
+ MaxOffset = 254;
+ break;
case AArch64::LDR_ZXI:
case AArch64::STR_ZXI:
Scale = TypeSize::getScalable(16);
@@ -4089,6 +4096,16 @@ AArch64InstrInfo::getLdStOffsetOp(const MachineInstr &MI) {
return MI.getOperand(Idx);
}
+const MachineOperand &
+AArch64InstrInfo::getLdStAmountOp(const MachineInstr &MI) {
+ switch (MI.getOpcode()) {
+ default:
+ llvm_unreachable("Unexpected opcode");
+ case AArch64::LDRBBroX:
+ return MI.getOperand(4);
+ }
+}
+
static const TargetRegisterClass *getRegClass(const MachineInstr &MI,
Register Reg) {
if (MI.getParent() == nullptr)
@@ -4804,6 +4821,10 @@ void AArch64InstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
assert(SrcReg != AArch64::WSP);
} else if (AArch64::FPR32RegClass.hasSubClassEq(RC))
Opc = AArch64::STRSui;
+ else if (AArch64::PPR2RegClass.hasSubClassEq(RC)) {
+ Opc = AArch64::STR_PPXI;
+ StackID = TargetStackID::ScalableVector;
+ }
break;
case 8:
if (AArch64::GPR64allRegClass.hasSubClassEq(RC)) {
@@ -4980,6 +5001,10 @@ void AArch64InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
assert(DestReg != AArch64::WSP);
} else if (AArch64::FPR32RegClass.hasSubClassEq(RC))
Opc = AArch64::LDRSui;
+ else if (AArch64::PPR2RegClass.hasSubClassEq(RC)) {
+ Opc = AArch64::LDR_PPXI;
+ StackID = TargetStackID::ScalableVector;
+ }
break;
case 8:
if (AArch64::GPR64allRegClass.hasSubClassEq(RC)) {
@@ -8779,12 +8804,23 @@ AArch64InstrInfo::getOutliningTypeImpl(MachineBasicBlock::iterator &MIT,
// Don't outline anything used for return address signing. The outlined
// function will get signed later if needed
switch (MI.getOpcode()) {
+ case AArch64::PACM:
case AArch64::PACIASP:
case AArch64::PACIBSP:
+ case AArch64::PACIASPPC:
+ case AArch64::PACIBSPPC:
case AArch64::AUTIASP:
case AArch64::AUTIBSP:
+ case AArch64::AUTIASPPCi:
+ case AArch64::AUTIASPPCr:
+ case AArch64::AUTIBSPPCi:
+ case AArch64::AUTIBSPPCr:
case AArch64::RETAA:
case AArch64::RETAB:
+ case AArch64::RETAASPPCi:
+ case AArch64::RETAASPPCr:
+ case AArch64::RETABSPPCi:
+ case AArch64::RETABSPPCr:
case AArch64::EMITBKEY:
case AArch64::PAUTH_PROLOGUE:
case AArch64::PAUTH_EPILOGUE:
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.h b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.h
index 6526f6740747..db24a19fe5f8 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.h
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.h
@@ -111,6 +111,9 @@ public:
/// Returns the immediate offset operator of a load/store.
static const MachineOperand &getLdStOffsetOp(const MachineInstr &MI);
+ /// Returns the shift amount operator of a load/store.
+ static const MachineOperand &getLdStAmountOp(const MachineInstr &MI);
+
/// Returns whether the instruction is FP or NEON.
static bool isFpOrNEON(const MachineInstr &MI);
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index 44b0337fe787..62b2bf490f37 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -61,6 +61,9 @@ def HasLOR : Predicate<"Subtarget->hasLOR()">,
def HasPAuth : Predicate<"Subtarget->hasPAuth()">,
AssemblerPredicateWithAll<(all_of FeaturePAuth), "pauth">;
+def HasPAuthLR : Predicate<"Subtarget->hasPAuthLR()">,
+ AssemblerPredicateWithAll<(all_of FeaturePAuthLR), "pauth-lr">;
+
def HasJS : Predicate<"Subtarget->hasJS()">,
AssemblerPredicateWithAll<(all_of FeatureJS), "jsconv">;
@@ -289,6 +292,8 @@ def HasCHK : Predicate<"Subtarget->hasCHK()">,
AssemblerPredicateWithAll<(all_of FeatureCHK), "chk">;
def HasGCS : Predicate<"Subtarget->hasGCS()">,
AssemblerPredicateWithAll<(all_of FeatureGCS), "gcs">;
+def HasCPA : Predicate<"Subtarget->hasCPA()">,
+ AssemblerPredicateWithAll<(all_of FeatureCPA), "cpa">;
def IsLE : Predicate<"Subtarget->isLittleEndian()">;
def IsBE : Predicate<"!Subtarget->isLittleEndian()">;
def IsWindows : Predicate<"Subtarget->isTargetWindows()">;
@@ -1644,6 +1649,47 @@ let Predicates = [HasPAuth] in {
}
+// v9.5-A pointer authentication extensions
+
+// Always accept "pacm" as an alias for "hint #39", but don't emit it when
+// disassembling if we don't have the pauth-lr feature.
+let CRm = 0b0100 in {
+ def PACM : SystemNoOperands<0b111, "hint\t#39">;
+}
+def : InstAlias<"pacm", (PACM), 0>;
+
+let Predicates = [HasPAuthLR] in {
+ let Defs = [LR], Uses = [LR, SP] in {
+ // opcode2, opcode, asm
+ def PACIASPPC : SignAuthFixedRegs<0b00001, 0b101000, "paciasppc">;
+ def PACIBSPPC : SignAuthFixedRegs<0b00001, 0b101001, "pacibsppc">;
+ def PACNBIASPPC : SignAuthFixedRegs<0b00001, 0b100000, "pacnbiasppc">;
+ def PACNBIBSPPC : SignAuthFixedRegs<0b00001, 0b100001, "pacnbibsppc">;
+ // opc, asm
+ def AUTIASPPCi : SignAuthPCRel<0b00, "autiasppc">;
+ def AUTIBSPPCi : SignAuthPCRel<0b01, "autibsppc">;
+ // opcode2, opcode, asm
+ def AUTIASPPCr : SignAuthOneReg<0b00001, 0b100100, "autiasppc">;
+ def AUTIBSPPCr : SignAuthOneReg<0b00001, 0b100101, "autibsppc">;
+ // opcode2, opcode, asm
+ def PACIA171615 : SignAuthFixedRegs<0b00001, 0b100010, "pacia171615">;
+ def PACIB171615 : SignAuthFixedRegs<0b00001, 0b100011, "pacib171615">;
+ def AUTIA171615 : SignAuthFixedRegs<0b00001, 0b101110, "autia171615">;
+ def AUTIB171615 : SignAuthFixedRegs<0b00001, 0b101111, "autib171615">;
+ }
+
+ let Uses = [LR, SP], isReturn = 1, isTerminator = 1, isBarrier = 1 in {
+ // opc, op2, asm
+ def RETAASPPCi : SignAuthReturnPCRel<0b000, 0b11111, "retaasppc">;
+ def RETABSPPCi : SignAuthReturnPCRel<0b001, 0b11111, "retabsppc">;
+ // op3, asm
+ def RETAASPPCr : SignAuthReturnReg<0b000010, "retaasppc">;
+ def RETABSPPCr : SignAuthReturnReg<0b000011, "retabsppc">;
+ }
+ def : InstAlias<"pacm", (PACM), 1>;
+}
+
+
// v8.3a floating point conversion for javascript
let Predicates = [HasJS, HasFPARMv8], Defs = [NZCV] in
def FJCVTZS : BaseFPToIntegerUnscaled<0b01, 0b11, 0b110, FPR64, GPR32,
@@ -6480,23 +6526,23 @@ def : Pat<(v2i64 (vector_insert v2i64:$src, (i64 (bitconvert (f64 FPR64:$Sn))),
// f32 bitcast(vector_extract(v4i32 src, lane)) -> EXTRACT_SUBREG(INSvi32lane(-, 0, src, lane))
def : Pat<(f32 (bitconvert (i32 (vector_extract v4i32:$src, imm:$Immd)))),
(EXTRACT_SUBREG (INSvi32lane (IMPLICIT_DEF), 0, V128:$src, imm:$Immd), ssub)>;
-def : Pat<(f32 (bitconvert (i32 (vector_extract v4i32:$src, 0)))),
+def : Pat<(f32 (bitconvert (i32 (vector_extract v4i32:$src, (i64 0))))),
(EXTRACT_SUBREG V128:$src, ssub)>;
def : Pat<(f64 (bitconvert (i64 (vector_extract v2i64:$src, imm:$Immd)))),
(EXTRACT_SUBREG (INSvi64lane (IMPLICIT_DEF), 0, V128:$src, imm:$Immd), dsub)>;
-def : Pat<(f64 (bitconvert (i64 (vector_extract v2i64:$src, 0)))),
+def : Pat<(f64 (bitconvert (i64 (vector_extract v2i64:$src, (i64 0))))),
(EXTRACT_SUBREG V128:$src, dsub)>;
// Floating point vector extractions are codegen'd as either a sequence of
// subregister extractions, or a MOV (aka DUP here) if
// the lane number is anything other than zero.
-def : Pat<(vector_extract (v2f64 V128:$Rn), 0),
+def : Pat<(f64 (vector_extract (v2f64 V128:$Rn), (i64 0))),
(f64 (EXTRACT_SUBREG V128:$Rn, dsub))>;
-def : Pat<(vector_extract (v4f32 V128:$Rn), 0),
+def : Pat<(f32 (vector_extract (v4f32 V128:$Rn), (i64 0))),
(f32 (EXTRACT_SUBREG V128:$Rn, ssub))>;
-def : Pat<(vector_extract (v8f16 V128:$Rn), 0),
+def : Pat<(f16 (vector_extract (v8f16 V128:$Rn), (i64 0))),
(f16 (EXTRACT_SUBREG V128:$Rn, hsub))>;
-def : Pat<(vector_extract (v8bf16 V128:$Rn), 0),
+def : Pat<(bf16 (vector_extract (v8bf16 V128:$Rn), (i64 0))),
(bf16 (EXTRACT_SUBREG V128:$Rn, hsub))>;
@@ -9402,6 +9448,10 @@ let Predicates = [HasD128] in {
}
}
+//===----------------------------===//
+// 2023 Architecture Extensions:
+//===----------------------------===//
+
let Predicates = [HasFP8] in {
defm F1CVTL : SIMDMixedTwoVectorFP8<0b00, "f1cvtl">;
defm F2CVTL : SIMDMixedTwoVectorFP8<0b01, "f2cvtl">;
@@ -9443,6 +9493,19 @@ let Predicates = [HasFP8DOT4] in {
defm FDOT : SIMDThreeSameVectorDOT4<"fdot">;
} // End let Predicates = [HasFP8DOT4]
+//===----------------------------------------------------------------------===//
+// Checked Pointer Arithmetic (FEAT_CPA)
+//===----------------------------------------------------------------------===//
+let Predicates = [HasCPA] in {
+ // Scalar add/subtract
+ defm ADDPT : AddSubCPA<0, "addpt">;
+ defm SUBPT : AddSubCPA<1, "subpt">;
+
+ // Scalar multiply-add/subtract
+ def MADDPT : MulAccumCPA<0, "maddpt">;
+ def MSUBPT : MulAccumCPA<1, "msubpt">;
+}
+
include "AArch64InstrAtomics.td"
include "AArch64SVEInstrInfo.td"
include "AArch64SMEInstrInfo.td"
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
index dc6d5b8950c3..b435b3ce03e7 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
@@ -62,6 +62,8 @@ STATISTIC(NumUnscaledPairCreated,
"Number of load/store from unscaled generated");
STATISTIC(NumZeroStoresPromoted, "Number of narrow zero stores promoted");
STATISTIC(NumLoadsFromStoresPromoted, "Number of loads from stores promoted");
+STATISTIC(NumConstOffsetFolded,
+ "Number of const offset of index address folded");
DEBUG_COUNTER(RegRenamingCounter, DEBUG_TYPE "-reg-renaming",
"Controls which pairs are considered for renaming");
@@ -75,6 +77,11 @@ static cl::opt<unsigned> LdStLimit("aarch64-load-store-scan-limit",
static cl::opt<unsigned> UpdateLimit("aarch64-update-scan-limit", cl::init(100),
cl::Hidden);
+// The LdStConstLimit limits how far we search for const offset instructions
+// when we form index address load/store instructions.
+static cl::opt<unsigned> LdStConstLimit("aarch64-load-store-const-scan-limit",
+ cl::init(10), cl::Hidden);
+
// Enable register renaming to find additional store pairing opportunities.
static cl::opt<bool> EnableRenaming("aarch64-load-store-renaming",
cl::init(true), cl::Hidden);
@@ -171,6 +178,13 @@ struct AArch64LoadStoreOpt : public MachineFunctionPass {
findMatchingUpdateInsnForward(MachineBasicBlock::iterator I,
int UnscaledOffset, unsigned Limit);
+ // Scan the instruction list to find a register assigned with a const
+ // value that can be combined with the current instruction (a load or store)
+ // using base addressing with writeback. Scan forwards.
+ MachineBasicBlock::iterator
+ findMatchingConstOffsetBackward(MachineBasicBlock::iterator I, unsigned Limit,
+ unsigned &Offset);
+
// Scan the instruction list to find a base register update that can
// be combined with the current instruction (a load or store) using
// pre or post indexed addressing with writeback. Scan backwards.
@@ -182,11 +196,19 @@ struct AArch64LoadStoreOpt : public MachineFunctionPass {
bool isMatchingUpdateInsn(MachineInstr &MemMI, MachineInstr &MI,
unsigned BaseReg, int Offset);
+ bool isMatchingMovConstInsn(MachineInstr &MemMI, MachineInstr &MI,
+ unsigned IndexReg, unsigned &Offset);
+
// Merge a pre- or post-index base register update into a ld/st instruction.
MachineBasicBlock::iterator
mergeUpdateInsn(MachineBasicBlock::iterator I,
MachineBasicBlock::iterator Update, bool IsPreIdx);
+ MachineBasicBlock::iterator
+ mergeConstOffsetInsn(MachineBasicBlock::iterator I,
+ MachineBasicBlock::iterator Update, unsigned Offset,
+ int Scale);
+
// Find and merge zero store instructions.
bool tryToMergeZeroStInst(MachineBasicBlock::iterator &MBBI);
@@ -199,6 +221,9 @@ struct AArch64LoadStoreOpt : public MachineFunctionPass {
// Find and merge a base register updates before or after a ld/st instruction.
bool tryToMergeLdStUpdate(MachineBasicBlock::iterator &MBBI);
+ // Find and merge a index ldr/st instructions into a base ld/st instruction.
+ bool tryToMergeIndexLdSt(MachineBasicBlock::iterator &MBBI, int Scale);
+
bool optimizeBlock(MachineBasicBlock &MBB, bool EnableNarrowZeroStOpt);
bool runOnMachineFunction(MachineFunction &Fn) override;
@@ -481,6 +506,16 @@ static unsigned getPreIndexedOpcode(unsigned Opc) {
}
}
+static unsigned getBaseAddressOpcode(unsigned Opc) {
+ // TODO: Add more index address loads/stores.
+ switch (Opc) {
+ default:
+ llvm_unreachable("Opcode has no base address equivalent!");
+ case AArch64::LDRBBroX:
+ return AArch64::LDRBBui;
+ }
+}
+
static unsigned getPostIndexedOpcode(unsigned Opc) {
switch (Opc) {
default:
@@ -722,6 +757,20 @@ static bool isMergeableLdStUpdate(MachineInstr &MI) {
}
}
+// Make sure this is a reg+reg Ld/St
+static bool isMergeableIndexLdSt(MachineInstr &MI, int &Scale) {
+ unsigned Opc = MI.getOpcode();
+ switch (Opc) {
+ default:
+ return false;
+ // Scaled instructions.
+ // TODO: Add more index address loads/stores.
+ case AArch64::LDRBBroX:
+ Scale = 1;
+ return true;
+ }
+}
+
static bool isRewritableImplicitDef(unsigned Opc) {
switch (Opc) {
default:
@@ -2018,6 +2067,63 @@ AArch64LoadStoreOpt::mergeUpdateInsn(MachineBasicBlock::iterator I,
return NextI;
}
+MachineBasicBlock::iterator
+AArch64LoadStoreOpt::mergeConstOffsetInsn(MachineBasicBlock::iterator I,
+ MachineBasicBlock::iterator Update,
+ unsigned Offset, int Scale) {
+ assert((Update->getOpcode() == AArch64::MOVKWi) &&
+ "Unexpected const mov instruction to merge!");
+ MachineBasicBlock::iterator E = I->getParent()->end();
+ MachineBasicBlock::iterator NextI = next_nodbg(I, E);
+ MachineBasicBlock::iterator PrevI = prev_nodbg(Update, E);
+ MachineInstr &MemMI = *I;
+ unsigned Mask = (1 << 12) * Scale - 1;
+ unsigned Low = Offset & Mask;
+ unsigned High = Offset - Low;
+ Register BaseReg = AArch64InstrInfo::getLdStBaseOp(MemMI).getReg();
+ Register IndexReg = AArch64InstrInfo::getLdStOffsetOp(MemMI).getReg();
+ MachineInstrBuilder AddMIB, MemMIB;
+
+ // Add IndexReg, BaseReg, High (the BaseReg may be SP)
+ AddMIB =
+ BuildMI(*I->getParent(), I, I->getDebugLoc(), TII->get(AArch64::ADDXri))
+ .addDef(IndexReg)
+ .addUse(BaseReg)
+ .addImm(High >> 12) // shifted value
+ .addImm(12); // shift 12
+ (void)AddMIB;
+ // Ld/St DestReg, IndexReg, Imm12
+ unsigned NewOpc = getBaseAddressOpcode(I->getOpcode());
+ MemMIB = BuildMI(*I->getParent(), I, I->getDebugLoc(), TII->get(NewOpc))
+ .add(getLdStRegOp(MemMI))
+ .add(AArch64InstrInfo::getLdStOffsetOp(MemMI))
+ .addImm(Low / Scale)
+ .setMemRefs(I->memoperands())
+ .setMIFlags(I->mergeFlagsWith(*Update));
+ (void)MemMIB;
+
+ ++NumConstOffsetFolded;
+ LLVM_DEBUG(dbgs() << "Creating base address load/store.\n");
+ LLVM_DEBUG(dbgs() << " Replacing instructions:\n ");
+ LLVM_DEBUG(PrevI->print(dbgs()));
+ LLVM_DEBUG(dbgs() << " ");
+ LLVM_DEBUG(Update->print(dbgs()));
+ LLVM_DEBUG(dbgs() << " ");
+ LLVM_DEBUG(I->print(dbgs()));
+ LLVM_DEBUG(dbgs() << " with instruction:\n ");
+ LLVM_DEBUG(((MachineInstr *)AddMIB)->print(dbgs()));
+ LLVM_DEBUG(dbgs() << " ");
+ LLVM_DEBUG(((MachineInstr *)MemMIB)->print(dbgs()));
+ LLVM_DEBUG(dbgs() << "\n");
+
+ // Erase the old instructions for the block.
+ I->eraseFromParent();
+ PrevI->eraseFromParent();
+ Update->eraseFromParent();
+
+ return NextI;
+}
+
bool AArch64LoadStoreOpt::isMatchingUpdateInsn(MachineInstr &MemMI,
MachineInstr &MI,
unsigned BaseReg, int Offset) {
@@ -2065,6 +2171,31 @@ bool AArch64LoadStoreOpt::isMatchingUpdateInsn(MachineInstr &MemMI,
return false;
}
+bool AArch64LoadStoreOpt::isMatchingMovConstInsn(MachineInstr &MemMI,
+ MachineInstr &MI,
+ unsigned IndexReg,
+ unsigned &Offset) {
+ // The update instruction source and destination register must be the
+ // same as the load/store index register.
+ if (MI.getOpcode() == AArch64::MOVKWi &&
+ TRI->isSuperOrSubRegisterEq(IndexReg, MI.getOperand(1).getReg())) {
+
+ // movz + movk hold a large offset of a Ld/St instruction.
+ MachineBasicBlock::iterator B = MI.getParent()->begin();
+ MachineBasicBlock::iterator MBBI = &MI;
+ MBBI = prev_nodbg(MBBI, B);
+ MachineInstr &MovzMI = *MBBI;
+ if (MovzMI.getOpcode() == AArch64::MOVZWi) {
+ unsigned Low = MovzMI.getOperand(1).getImm();
+ unsigned High = MI.getOperand(2).getImm() << MI.getOperand(3).getImm();
+ Offset = High + Low;
+ // 12-bit optionally shifted immediates are legal for adds.
+ return Offset >> 24 == 0;
+ }
+ }
+ return false;
+}
+
MachineBasicBlock::iterator AArch64LoadStoreOpt::findMatchingUpdateInsnForward(
MachineBasicBlock::iterator I, int UnscaledOffset, unsigned Limit) {
MachineBasicBlock::iterator E = I->getParent()->end();
@@ -2220,6 +2351,60 @@ MachineBasicBlock::iterator AArch64LoadStoreOpt::findMatchingUpdateInsnBackward(
return E;
}
+MachineBasicBlock::iterator
+AArch64LoadStoreOpt::findMatchingConstOffsetBackward(
+ MachineBasicBlock::iterator I, unsigned Limit, unsigned &Offset) {
+ MachineBasicBlock::iterator B = I->getParent()->begin();
+ MachineBasicBlock::iterator E = I->getParent()->end();
+ MachineInstr &MemMI = *I;
+ MachineBasicBlock::iterator MBBI = I;
+
+ // If the load is the first instruction in the block, there's obviously
+ // not any matching load or store.
+ if (MBBI == B)
+ return E;
+
+ // Make sure the IndexReg is killed and the shift amount is zero.
+ // TODO: Relex this restriction to extend, simplify processing now.
+ if (!AArch64InstrInfo::getLdStOffsetOp(MemMI).isKill() ||
+ !AArch64InstrInfo::getLdStAmountOp(MemMI).isImm() ||
+ (AArch64InstrInfo::getLdStAmountOp(MemMI).getImm() != 0))
+ return E;
+
+ Register IndexReg = AArch64InstrInfo::getLdStOffsetOp(MemMI).getReg();
+
+ // Track which register units have been modified and used between the first
+ // insn (inclusive) and the second insn.
+ ModifiedRegUnits.clear();
+ UsedRegUnits.clear();
+ unsigned Count = 0;
+ do {
+ MBBI = prev_nodbg(MBBI, B);
+ MachineInstr &MI = *MBBI;
+
+ // Don't count transient instructions towards the search limit since there
+ // may be different numbers of them if e.g. debug information is present.
+ if (!MI.isTransient())
+ ++Count;
+
+ // If we found a match, return it.
+ if (isMatchingMovConstInsn(*I, MI, IndexReg, Offset)) {
+ return MBBI;
+ }
+
+ // Update the status of what the instruction clobbered and used.
+ LiveRegUnits::accumulateUsedDefed(MI, ModifiedRegUnits, UsedRegUnits, TRI);
+
+ // Otherwise, if the index register is used or modified, we have no match,
+ // so return early.
+ if (!ModifiedRegUnits.available(IndexReg) ||
+ !UsedRegUnits.available(IndexReg))
+ return E;
+
+ } while (MBBI != B && Count < Limit);
+ return E;
+}
+
bool AArch64LoadStoreOpt::tryToPromoteLoadFromStore(
MachineBasicBlock::iterator &MBBI) {
MachineInstr &MI = *MBBI;
@@ -2404,6 +2589,34 @@ bool AArch64LoadStoreOpt::tryToMergeLdStUpdate
return false;
}
+bool AArch64LoadStoreOpt::tryToMergeIndexLdSt(MachineBasicBlock::iterator &MBBI,
+ int Scale) {
+ MachineInstr &MI = *MBBI;
+ MachineBasicBlock::iterator E = MI.getParent()->end();
+ MachineBasicBlock::iterator Update;
+
+ // Don't know how to handle unscaled pre/post-index versions below, so bail.
+ if (TII->hasUnscaledLdStOffset(MI.getOpcode()))
+ return false;
+
+ // Look back to try to find a const offset for index LdSt instruction. For
+ // example,
+ // mov x8, #LargeImm ; = a * (1<<12) + imm12
+ // ldr x1, [x0, x8]
+ // merged into:
+ // add x8, x0, a * (1<<12)
+ // ldr x1, [x8, imm12]
+ unsigned Offset;
+ Update = findMatchingConstOffsetBackward(MBBI, LdStConstLimit, Offset);
+ if (Update != E && (Offset & (Scale - 1)) == 0) {
+ // Merge the imm12 into the ld/st.
+ MBBI = mergeConstOffsetInsn(MBBI, Update, Offset, Scale);
+ return true;
+ }
+
+ return false;
+}
+
bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
bool EnableNarrowZeroStOpt) {
@@ -2482,6 +2695,22 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB,
++MBBI;
}
+ // 5) Find a register assigned with a const value that can be combined with
+ // into the load or store. e.g.,
+ // mov x8, #LargeImm ; = a * (1<<12) + imm12
+ // ldr x1, [x0, x8]
+ // ; becomes
+ // add x8, x0, a * (1<<12)
+ // ldr x1, [x8, imm12]
+ for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
+ MBBI != E;) {
+ int Scale;
+ if (isMergeableIndexLdSt(*MBBI, Scale) && tryToMergeIndexLdSt(MBBI, Scale))
+ Modified = true;
+ else
+ ++MBBI;
+ }
+
return Modified;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
index 9da59ef2a806..1a8c71888a85 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
@@ -93,16 +93,24 @@ AArch64FunctionInfo::AArch64FunctionInfo(const Function &F,
// TODO: skip functions that have no instrumented allocas for optimization
IsMTETagged = F.hasFnAttribute(Attribute::SanitizeMemTag);
- if (!F.hasFnAttribute("branch-target-enforcement")) {
- if (const auto *BTE = mdconst::extract_or_null<ConstantInt>(
- F.getParent()->getModuleFlag("branch-target-enforcement")))
- BranchTargetEnforcement = BTE->getZExtValue();
- } else {
- const StringRef BTIEnable =
- F.getFnAttribute("branch-target-enforcement").getValueAsString();
- assert(BTIEnable == "true" || BTIEnable == "false");
- BranchTargetEnforcement = BTIEnable == "true";
- }
+ // BTI/PAuthLR may be set either on the function or the module. Set Bool from
+ // either the function attribute or module attribute, depending on what is
+ // set.
+ // Note: the module attributed is numeric (0 or 1) but the function attribute
+ // is stringy ("true" or "false").
+ auto TryFnThenModule = [&](StringRef AttrName, bool &Bool) {
+ if (F.hasFnAttribute(AttrName)) {
+ const StringRef V = F.getFnAttribute(AttrName).getValueAsString();
+ assert(V.equals_insensitive("true") || V.equals_insensitive("false"));
+ Bool = V.equals_insensitive("true");
+ } else if (const auto *ModVal = mdconst::extract_or_null<ConstantInt>(
+ F.getParent()->getModuleFlag(AttrName))) {
+ Bool = ModVal->getZExtValue();
+ }
+ };
+
+ TryFnThenModule("branch-target-enforcement", BranchTargetEnforcement);
+ TryFnThenModule("branch-protection-pauth-lr", BranchProtectionPAuthLR);
// The default stack probe size is 4096 if the function has no
// stack-probe-size attribute. This is a safe default because it is the
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
index 219f83cfd32e..cd4a18bfbc23 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
@@ -22,6 +22,7 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/IR/Function.h"
#include "llvm/MC/MCLinkerOptimizationHint.h"
+#include "llvm/MC/MCSymbol.h"
#include <cassert>
#include <optional>
@@ -164,10 +165,21 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
/// SignWithBKey modifies the default PAC-RET mode to signing with the B key.
bool SignWithBKey = false;
+ /// SigningInstrOffset captures the offset of the PAC-RET signing instruction
+ /// within the prologue, so it can be re-used for authentication in the
+ /// epilogue when using PC as a second salt (FEAT_PAuth_LR)
+ MCSymbol *SignInstrLabel = nullptr;
+
/// BranchTargetEnforcement enables placing BTI instructions at potential
/// indirect branch destinations.
bool BranchTargetEnforcement = false;
+ /// Indicates that SP signing should be diversified with PC as-per PAuthLR.
+ /// This is set by -mbranch-protection and will emit NOP instructions unless
+ /// the subtarget feature +pauthlr is also used (in which case non-NOP
+ /// instructions are emitted).
+ bool BranchProtectionPAuthLR = false;
+
/// Whether this function has an extended frame record [Ctx, FP, LR]. If so,
/// bit 60 of the in-memory FP will be 1 to enable other tools to detect the
/// extended record.
@@ -436,10 +448,16 @@ public:
bool needsShadowCallStackPrologueEpilogue(MachineFunction &MF) const;
bool shouldSignWithBKey() const { return SignWithBKey; }
+
+ MCSymbol *getSigningInstrLabel() const { return SignInstrLabel; }
+ void setSigningInstrLabel(MCSymbol *Label) { SignInstrLabel = Label; }
+
bool isMTETagged() const { return IsMTETagged; }
bool branchTargetEnforcement() const { return BranchTargetEnforcement; }
+ bool branchProtectionPAuthLR() const { return BranchProtectionPAuthLR; }
+
void setHasSwiftAsyncContext(bool HasContext) {
HasSwiftAsyncContext = HasContext;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp
index 7576d2a899d1..7509afaeb5fe 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp
@@ -60,11 +60,35 @@ FunctionPass *llvm::createAArch64PointerAuthPass() {
char AArch64PointerAuth::ID = 0;
+// Where PAuthLR support is not known at compile time, it is supported using
+// PACM. PACM is in the hint space so has no effect when PAuthLR is not
+// supported by the hardware, but will alter the behaviour of PACI*SP, AUTI*SP
+// and RETAA/RETAB if the hardware supports PAuthLR.
+static void BuildPACM(const AArch64Subtarget &Subtarget, MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MBBI, DebugLoc DL,
+ MachineInstr::MIFlag Flags, MCSymbol *PACSym = nullptr) {
+ const TargetInstrInfo *TII = Subtarget.getInstrInfo();
+ auto &MFnI = *MBB.getParent()->getInfo<AArch64FunctionInfo>();
+
+ // ADR X16,<address_of_PACIASP>
+ if (PACSym) {
+ assert(Flags == MachineInstr::FrameDestroy);
+ BuildMI(MBB, MBBI, DL, TII->get(AArch64::ADR))
+ .addReg(AArch64::X16, RegState::Define)
+ .addSym(PACSym);
+ }
+
+ // Only emit PACM if -mbranch-protection has +pc and the target does not
+ // have feature +pauth-lr.
+ if (MFnI.branchProtectionPAuthLR() && !Subtarget.hasPAuthLR())
+ BuildMI(MBB, MBBI, DL, TII->get(AArch64::PACM)).setMIFlag(Flags);
+}
+
void AArch64PointerAuth::signLR(MachineFunction &MF,
MachineBasicBlock::iterator MBBI) const {
- const AArch64FunctionInfo *MFnI = MF.getInfo<AArch64FunctionInfo>();
- bool UseBKey = MFnI->shouldSignWithBKey();
- bool EmitCFI = MFnI->needsDwarfUnwindInfo(MF);
+ auto &MFnI = *MF.getInfo<AArch64FunctionInfo>();
+ bool UseBKey = MFnI.shouldSignWithBKey();
+ bool EmitCFI = MFnI.needsDwarfUnwindInfo(MF);
bool NeedsWinCFI = MF.hasWinCFI();
MachineBasicBlock &MBB = *MBBI->getParent();
@@ -77,11 +101,29 @@ void AArch64PointerAuth::signLR(MachineFunction &MF,
.setMIFlag(MachineInstr::FrameSetup);
}
+ // PAuthLR authentication instructions need to know the value of PC at the
+ // point of signing (PACI*).
+ if (MFnI.branchProtectionPAuthLR()) {
+ MCSymbol *PACSym = MF.getMMI().getContext().createTempSymbol();
+ MFnI.setSigningInstrLabel(PACSym);
+ }
+
// No SEH opcode for this one; it doesn't materialize into an
// instruction on Windows.
- BuildMI(MBB, MBBI, DL,
- TII->get(UseBKey ? AArch64::PACIBSP : AArch64::PACIASP))
- .setMIFlag(MachineInstr::FrameSetup);
+ if (MFnI.branchProtectionPAuthLR() && Subtarget->hasPAuthLR()) {
+ BuildMI(MBB, MBBI, DL,
+ TII->get(MFnI.shouldSignWithBKey() ? AArch64::PACIBSPPC
+ : AArch64::PACIASPPC))
+ .setMIFlag(MachineInstr::FrameSetup)
+ ->setPreInstrSymbol(MF, MFnI.getSigningInstrLabel());
+ } else {
+ BuildPACM(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameSetup);
+ BuildMI(MBB, MBBI, DL,
+ TII->get(MFnI.shouldSignWithBKey() ? AArch64::PACIBSP
+ : AArch64::PACIASP))
+ .setMIFlag(MachineInstr::FrameSetup)
+ ->setPreInstrSymbol(MF, MFnI.getSigningInstrLabel());
+ }
if (EmitCFI) {
unsigned CFIIndex =
@@ -118,15 +160,37 @@ void AArch64PointerAuth::authenticateLR(
// DW_CFA_AARCH64_negate_ra_state can't be emitted.
bool TerminatorIsCombinable =
TI != MBB.end() && TI->getOpcode() == AArch64::RET;
+ MCSymbol *PACSym = MFnI->getSigningInstrLabel();
+
if (Subtarget->hasPAuth() && TerminatorIsCombinable && !NeedsWinCFI &&
!MF.getFunction().hasFnAttribute(Attribute::ShadowCallStack)) {
- unsigned CombinedRetOpcode = UseBKey ? AArch64::RETAB : AArch64::RETAA;
- BuildMI(MBB, TI, DL, TII->get(CombinedRetOpcode)).copyImplicitOps(*TI);
+ if (MFnI->branchProtectionPAuthLR() && Subtarget->hasPAuthLR()) {
+ assert(PACSym && "No PAC instruction to refer to");
+ BuildMI(MBB, TI, DL,
+ TII->get(UseBKey ? AArch64::RETABSPPCi : AArch64::RETAASPPCi))
+ .addSym(PACSym)
+ .copyImplicitOps(*MBBI)
+ .setMIFlag(MachineInstr::FrameDestroy);
+ } else {
+ BuildPACM(*Subtarget, MBB, TI, DL, MachineInstr::FrameDestroy, PACSym);
+ BuildMI(MBB, TI, DL, TII->get(UseBKey ? AArch64::RETAB : AArch64::RETAA))
+ .copyImplicitOps(*MBBI)
+ .setMIFlag(MachineInstr::FrameDestroy);
+ }
MBB.erase(TI);
} else {
- unsigned AutOpcode = UseBKey ? AArch64::AUTIBSP : AArch64::AUTIASP;
- BuildMI(MBB, MBBI, DL, TII->get(AutOpcode))
- .setMIFlag(MachineInstr::FrameDestroy);
+ if (MFnI->branchProtectionPAuthLR() && Subtarget->hasPAuthLR()) {
+ assert(PACSym && "No PAC instruction to refer to");
+ BuildMI(MBB, MBBI, DL,
+ TII->get(UseBKey ? AArch64::AUTIBSPPCi : AArch64::AUTIASPPCi))
+ .addSym(PACSym)
+ .setMIFlag(MachineInstr::FrameDestroy);
+ } else {
+ BuildPACM(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameDestroy, PACSym);
+ BuildMI(MBB, MBBI, DL,
+ TII->get(UseBKey ? AArch64::AUTIBSP : AArch64::AUTIASP))
+ .setMIFlag(MachineInstr::FrameDestroy);
+ }
if (EmitAsyncCFI) {
unsigned CFIIndex =
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index 50527e08a061..344a15389063 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -316,6 +316,26 @@ def AArch64ssra : PatFrags<(ops node:$op1, node:$op2, node:$op3),
[(int_aarch64_sve_ssra node:$op1, node:$op2, node:$op3),
(add node:$op1, (AArch64asr_p (SVEAnyPredicate), node:$op2, (SVEShiftSplatImmR (i32 node:$op3))))]>;
+// Replace pattern min(max(v1,v2),v3) by clamp
+def AArch64sclamp : PatFrags<(ops node:$Zd, node:$Zn, node:$Zm),
+ [(int_aarch64_sve_sclamp node:$Zd, node:$Zn, node:$Zm),
+ (AArch64smin_p (SVEAllActive),
+ (AArch64smax_p (SVEAllActive), node:$Zd, node:$Zn),
+ node:$Zm)
+ ]>;
+def AArch64uclamp : PatFrags<(ops node:$Zd, node:$Zn, node:$Zm),
+ [(int_aarch64_sve_uclamp node:$Zd, node:$Zn, node:$Zm),
+ (AArch64umin_p (SVEAllActive),
+ (AArch64umax_p (SVEAllActive), node:$Zd, node:$Zn),
+ node:$Zm)
+ ]>;
+def AArch64fclamp : PatFrags<(ops node:$Zd, node:$Zn, node:$Zm),
+ [(int_aarch64_sve_fclamp node:$Zd, node:$Zn, node:$Zm),
+ (AArch64fminnm_p (SVEAllActive),
+ (AArch64fmaxnm_p (SVEAllActive), node:$Zd, node:$Zn),
+ node:$Zm)
+ ]>;
+
def SDT_AArch64FCVT : SDTypeProfile<1, 3, [
SDTCisVec<0>, SDTCisVec<1>, SDTCisVec<2>, SDTCisVec<3>,
SDTCVecEltisVT<1,i1>
@@ -2378,11 +2398,13 @@ let Predicates = [HasSVEorSME] in {
def LDR_ZZXI : Pseudo<(outs ZZ_b_strided_and_contiguous:$Zd), (ins GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
def LDR_ZZZXI : Pseudo<(outs ZZZ_b:$Zd), (ins GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
def LDR_ZZZZXI : Pseudo<(outs ZZZZ_b_strided_and_contiguous:$Zd), (ins GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
+ def LDR_PPXI : Pseudo<(outs PPR2:$pp), (ins GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
}
let mayStore = 1, hasSideEffects = 0 in {
def STR_ZZXI : Pseudo<(outs), (ins ZZ_b_strided_and_contiguous:$Zs, GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
def STR_ZZZXI : Pseudo<(outs), (ins ZZZ_b:$Zs, GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
def STR_ZZZZXI : Pseudo<(outs), (ins ZZZZ_b_strided_and_contiguous:$Zs, GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
+ def STR_PPXI : Pseudo<(outs), (ins PPR2:$pp, GPR64sp:$sp, simm4s1:$offset),[]>, Sched<[]>;
}
let AddedComplexity = 1 in {
@@ -3802,8 +3824,8 @@ let Predicates = [HasSVE2BitPerm] in {
let Predicates = [HasSVE2p1_or_HasSME] in {
defm REVD_ZPmZ : sve2_int_perm_revd<"revd", AArch64revd_mt>;
-defm SCLAMP_ZZZ : sve2_clamp<"sclamp", 0b0, int_aarch64_sve_sclamp>;
-defm UCLAMP_ZZZ : sve2_clamp<"uclamp", 0b1, int_aarch64_sve_uclamp>;
+defm SCLAMP_ZZZ : sve2_clamp<"sclamp", 0b0, AArch64sclamp>;
+defm UCLAMP_ZZZ : sve2_clamp<"uclamp", 0b1, AArch64uclamp>;
defm PSEL_PPPRI : sve2_int_perm_sel_p<"psel", int_aarch64_sve_psel>;
} // End HasSVE2p1_or_HasSME
@@ -3813,7 +3835,7 @@ defm PSEL_PPPRI : sve2_int_perm_sel_p<"psel", int_aarch64_sve_psel>;
//===----------------------------------------------------------------------===//
let Predicates = [HasSVE2p1_or_HasSME2] in {
-defm FCLAMP_ZZZ : sve2p1_fclamp<"fclamp", int_aarch64_sve_fclamp>;
+defm FCLAMP_ZZZ : sve2p1_fclamp<"fclamp", AArch64fclamp>;
defm FDOT_ZZZ_S : sve_float_dot<0b0, 0b0, ZPR32, ZPR16, "fdot", nxv8f16, int_aarch64_sve_fdot_x2>;
defm FDOT_ZZZI_S : sve_float_dot_indexed<0b0, 0b00, ZPR16, ZPR3b16, "fdot", nxv8f16, int_aarch64_sve_fdot_lane_x2>;
@@ -4003,10 +4025,10 @@ def : InstAlias<"pfalse\t$Pd", (PFALSE PNRasPPR8:$Pd), 0>;
} // End HasSVE2p1_or_HasSME2
//===----------------------------------------------------------------------===//
-// SVE2.1 non-widening BFloat16 to BFloat16 instructions
+// Non-widening BFloat16 to BFloat16 instructions
//===----------------------------------------------------------------------===//
-let Predicates = [HasSVE2p1, HasB16B16, UseExperimentalZeroingPseudos] in {
+let Predicates = [HasSVE2orSME2, HasB16B16, UseExperimentalZeroingPseudos] in {
defm BFADD_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fadd>;
defm BFSUB_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fsub>;
defm BFMUL_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmul>;
@@ -4014,9 +4036,9 @@ defm BFMAXNM_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmaxnm>;
defm BFMINNM_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fminnm>;
defm BFMIN_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmin>;
defm BFMAX_ZPZZ : sve2p1_bf_2op_p_zds_zeroing<int_aarch64_sve_fmax>;
-} //HasSVE2p1_or_HasSME2p1, HasB16B16, UseExperimentalZeroingPseudos
+} // HasSVE2orSME2, HasB16B16, UseExperimentalZeroingPseudos
-let Predicates = [HasSVE2p1, HasB16B16] in {
+let Predicates = [HasSVE2orSME2, HasB16B16] in {
defm BFMLA_ZPmZZ : sve_fp_3op_p_zds_a_bf<0b00, "bfmla", "BFMLA_ZPZZZ", AArch64fmla_m1>;
defm BFMLS_ZPmZZ : sve_fp_3op_p_zds_a_bf<0b01, "bfmls", "BFMLS_ZPZZZ", AArch64fmls_m1>;
@@ -4055,8 +4077,8 @@ defm BFMINNM_ZPZZ : sve2p1_bf_bin_pred_zds<AArch64fminnm_p>;
defm BFMUL_ZZZI : sve2p1_fp_bfmul_by_indexed_elem<"bfmul", int_aarch64_sve_fmul_lane>;
-defm BFCLAMP_ZZZ : sve2p1_bfclamp<"bfclamp", int_aarch64_sve_fclamp>;
-} // End HasSVE2p1_or_HasSME2p1, HasB16B16
+defm BFCLAMP_ZZZ : sve2p1_bfclamp<"bfclamp", AArch64fclamp>;
+} // End HasSVE2orSME2, HasB16B16
//===----------------------------------------------------------------------===//
@@ -4163,3 +4185,24 @@ let Predicates = [HasSVE2orSME2, HasLUT] in {
// LUTI4 (two contiguous registers)
defm LUTI4_Z2ZZI : sve2_luti4_vector_vg2_index<"luti4">;
} // End HasSVE2orSME2, HasLUT
+
+//===----------------------------------------------------------------------===//
+// Checked Pointer Arithmetic (FEAT_CPA)
+//===----------------------------------------------------------------------===//
+let Predicates = [HasSVE, HasCPA] in {
+ // Add/subtract (vectors, unpredicated)
+ def ADD_ZZZ_CPA : sve_int_bin_cons_arit_0<0b11, 0b010, "addpt", ZPR64>;
+ def SUB_ZZZ_CPA : sve_int_bin_cons_arit_0<0b11, 0b011, "subpt", ZPR64>;
+
+ // Add/subtract (vectors, predicated)
+ let DestructiveInstType = DestructiveBinaryComm in {
+ def ADD_ZPmZ_CPA : sve_int_bin_pred_arit_log<0b11, 0b00, 0b100, "addpt", ZPR64>;
+ def SUB_ZPmZ_CPA : sve_int_bin_pred_arit_log<0b11, 0b00, 0b101, "subpt", ZPR64>;
+ }
+
+ // Multiply-add vectors, writing multiplicand
+ def MAD_CPA : sve_int_mad_cpa<"madpt">;
+
+ // Multiply-add vectors, writing addend
+ def MLA_CPA : sve_int_mla_cpa<"mlapt">;
+}
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedA64FX.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedA64FX.td
index 65b97ff6956a..7edce4b61605 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedA64FX.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedA64FX.td
@@ -20,12 +20,9 @@ def A64FXModel : SchedMachineModel {
let PostRAScheduler = 1; // Using PostRA sched.
let CompleteModel = 1;
- list<Predicate> UnsupportedFeatures =
- [HasSVE2, HasSVE2AES, HasSVE2SM4, HasSVE2SHA3, HasSVE2BitPerm, HasPAuth,
- HasSVE2orSME, HasMTE, HasMatMulInt8, HasBF16, HasSME2, HasSME2p1, HasSVE2p1,
- HasSVE2p1_or_HasSME2p1, HasSMEF16F16, HasSSVE_FP8FMA, HasSMEF8F16, HasSMEF8F32,
- HasSMEFA64];
-
+ list<Predicate> UnsupportedFeatures = !listconcat(SMEUnsupported.F, SVEUnsupported.F,
+ [HasMTE, HasMatMulInt8, HasBF16,
+ HasPAuth, HasPAuthLR, HasCPA]);
let FullInstRWOverlapCheck = 0;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseN2.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseN2.td
index 503de3bee2b8..a6fab5e6245f 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseN2.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseN2.td
@@ -19,7 +19,7 @@ def NeoverseN2Model : SchedMachineModel {
let CompleteModel = 1;
list<Predicate> UnsupportedFeatures = !listconcat(SMEUnsupported.F,
- [HasSVE2p1]);
+ [HasSVE2p1, HasPAuthLR, HasCPA]);
}
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV1.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV1.td
index 726be1a547b9..75fbb85dce9d 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV1.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV1.td
@@ -28,7 +28,7 @@ def NeoverseV1Model : SchedMachineModel {
list<Predicate> UnsupportedFeatures = !listconcat(SVE2Unsupported.F,
SMEUnsupported.F,
- [HasMTE]);
+ [HasMTE, HasCPA]);
}
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
index 3367d5d0cd31..658d7cdd23a6 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
@@ -22,7 +22,7 @@ def NeoverseV2Model : SchedMachineModel {
let CompleteModel = 1;
list<Predicate> UnsupportedFeatures = !listconcat(SMEUnsupported.F,
- [HasSVE2p1]);
+ [HasSVE2p1, HasCPA]);
}
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SystemOperands.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SystemOperands.td
index e8b5f6059c9e..0b80f263e12e 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SystemOperands.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64SystemOperands.td
@@ -643,6 +643,14 @@ defm : TLBI<"PAALLOS", 0b110, 0b1000, 0b0001, 0b100, 0>;
defm : TLBI<"PAALL", 0b110, 0b1000, 0b0111, 0b100, 0>;
}
+// Armv9.5-A TLBI VMALL for Dirty State
+let Requires = ["AArch64::FeatureTLBIW"] in {
+// op1, CRn, CRm, op2, needsreg
+defm : TLBI<"VMALLWS2E1", 0b100, 0b1000, 0b0110, 0b010, 0>;
+defm : TLBI<"VMALLWS2E1IS", 0b100, 0b1000, 0b0010, 0b010, 0>;
+defm : TLBI<"VMALLWS2E1OS", 0b100, 0b1000, 0b0101, 0b010, 0>;
+}
+
//===----------------------------------------------------------------------===//
// MRS/MSR (system register read/write) instruction options.
//===----------------------------------------------------------------------===//
@@ -1946,3 +1954,22 @@ def : RWSysReg<"MDSTEPOP_EL1", 0b10, 0b000, 0b0000, 0b0101, 0b010>;
// v9.5a System PMU zero register (FEAT_SPMU2)
// Op0 Op1 CRn CRm Op2
def : WOSysReg<"SPMZR_EL0", 0b10, 0b011, 0b1001, 0b1100, 0b100>;
+
+// v9.5a Delegated SError exceptions for EL3 (FEAT_E3DSE)
+// Op0 Op1 CRn CRm Op2
+def : RWSysReg<"VDISR_EL3", 0b11, 0b110, 0b1100, 0b0001, 0b001>;
+def : RWSysReg<"VSESR_EL3", 0b11, 0b110, 0b0101, 0b0010, 0b011>;
+
+// v9.5a Hardware Dirty State Tracking Structure (FEAT_HDBSS)
+// Op0 Op1 CRn CRm Op2
+def : RWSysReg<"HDBSSBR_EL2", 0b11, 0b100, 0b0010, 0b0011, 0b010>;
+def : RWSysReg<"HDBSSPROD_EL2", 0b11, 0b100, 0b0010, 0b0011, 0b011>;
+
+// v9.5a Hardware Accelerator for Cleaning Dirty State (FEAT_HACDBS)
+// Op0 Op1 CRn CRm Op2
+def : RWSysReg<"HACDBSBR_EL2", 0b11, 0b100, 0b0010, 0b0011, 0b100>;
+def : RWSysReg<"HACDBSCONS_EL2", 0b11, 0b100, 0b0010, 0b0011, 0b101>;
+
+// v9.5a Fine Grained Write Trap EL3 (FEAT_FGWTE3)
+// Op0 Op1 CRn CRm Op2
+def : RWSysReg<"FGWTE3_EL3", 0b11, 0b110, 0b0001, 0b0001, 0b101>;
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 238269cf27bd..be66790c4277 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -1541,6 +1541,13 @@ public:
getShiftExtendAmount() <= 4;
}
+ bool isLSLImm3Shift() const {
+ if (!isShiftExtend())
+ return false;
+ AArch64_AM::ShiftExtendType ET = getShiftExtendType();
+ return ET == AArch64_AM::LSL && getShiftExtendAmount() <= 7;
+ }
+
template<int Width> bool isMemXExtend() const {
if (!isExtend())
return false;
@@ -1689,6 +1696,21 @@ public:
return DiagnosticPredicateTy::Match;
}
+ bool isPAuthPCRelLabel16Operand() const {
+ // PAuth PCRel16 operands are similar to regular branch targets, but only
+ // negative values are allowed for concrete immediates as signing instr
+ // should be in a lower address.
+ if (!isImm())
+ return false;
+ const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(getImm());
+ if (!MCE)
+ return true;
+ int64_t Val = MCE->getValue();
+ if (Val & 0b11)
+ return false;
+ return (Val <= 0) && (Val > -(1 << 18));
+ }
+
void addExpr(MCInst &Inst, const MCExpr *Expr) const {
// Add as immediates when possible. Null MCExpr = 0.
if (!Expr)
@@ -1990,6 +2012,19 @@ public:
Inst.addOperand(MCOperand::createImm(MCE->getValue() >> 2));
}
+ void addPAuthPCRelLabel16Operands(MCInst &Inst, unsigned N) const {
+ // PC-relative operands don't encode the low bits, so shift them off
+ // here. If it's a label, however, just put it on directly as there's
+ // not enough information now to do anything.
+ assert(N == 1 && "Invalid number of operands!");
+ const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(getImm());
+ if (!MCE) {
+ addExpr(Inst, getImm());
+ return;
+ }
+ Inst.addOperand(MCOperand::createImm(MCE->getValue() >> 2));
+ }
+
void addPCRelLabel19Operands(MCInst &Inst, unsigned N) const {
// Branch operands don't encode the low bits, so shift them off
// here. If it's a label, however, just put it on directly as there's
@@ -2091,6 +2126,12 @@ public:
Inst.addOperand(MCOperand::createImm(Imm));
}
+ void addLSLImm3ShifterOperands(MCInst &Inst, unsigned N) const {
+ assert(N == 1 && "Invalid number of operands!");
+ unsigned Imm = getShiftExtendAmount();
+ Inst.addOperand(MCOperand::createImm(Imm));
+ }
+
void addSyspXzrPairOperand(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!");
@@ -3664,6 +3705,8 @@ static const struct Extension {
{"sme-f8f16", {AArch64::FeatureSMEF8F16}},
{"sme-f8f32", {AArch64::FeatureSMEF8F32}},
{"sme-fa64", {AArch64::FeatureSMEFA64}},
+ {"cpa", {AArch64::FeatureCPA}},
+ {"tlbiw", {AArch64::FeatureTLBIW}},
};
static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str) {
@@ -6064,6 +6107,9 @@ bool AArch64AsmParser::showMatchError(SMLoc Loc, unsigned ErrCode,
"Invalid vector list, expected list with each SVE vector in the list "
"4 registers apart, and the first register in the range [z0, z3] or "
"[z16, z19] and with correct element type");
+ case Match_AddSubLSLImm3ShiftLarge:
+ return Error(Loc,
+ "expected 'lsl' with optional integer in range [0, 7]");
default:
llvm_unreachable("unexpected error code!");
}
@@ -6448,6 +6494,7 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
case Match_InvalidMemoryIndexed8:
case Match_InvalidMemoryIndexed16:
case Match_InvalidCondCode:
+ case Match_AddSubLSLImm3ShiftLarge:
case Match_AddSubRegExtendSmall:
case Match_AddSubRegExtendLarge:
case Match_AddSubSecondSource:
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
index cf2d3879292d..e3220d103ae0 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
@@ -165,6 +165,9 @@ static DecodeStatus DecodeFixedPointScaleImm32(MCInst &Inst, unsigned Imm,
static DecodeStatus DecodeFixedPointScaleImm64(MCInst &Inst, unsigned Imm,
uint64_t Address,
const MCDisassembler *Decoder);
+static DecodeStatus DecodePCRelLabel16(MCInst &Inst, unsigned Imm,
+ uint64_t Address,
+ const MCDisassembler *Decoder);
static DecodeStatus DecodePCRelLabel19(MCInst &Inst, unsigned Imm,
uint64_t Address,
const MCDisassembler *Decoder);
@@ -887,6 +890,21 @@ static DecodeStatus DecodeFixedPointScaleImm64(MCInst &Inst, unsigned Imm,
return Success;
}
+static DecodeStatus DecodePCRelLabel16(MCInst &Inst, unsigned Imm,
+ uint64_t Addr,
+ const MCDisassembler *Decoder) {
+ // Immediate is encoded as the top 16-bits of an unsigned 18-bit negative
+ // PC-relative offset.
+ uint64_t ImmVal = Imm;
+ if (ImmVal < 0 || ImmVal > (1 << 16))
+ return Fail;
+ ImmVal = -ImmVal;
+ if (!Decoder->tryAddingSymbolicOperand(Inst, (ImmVal << 2), Addr,
+ /*IsBranch=*/false, 0, 0, 4))
+ Inst.addOperand(MCOperand::createImm(ImmVal));
+ return Success;
+}
+
static DecodeStatus DecodePCRelLabel19(MCInst &Inst, unsigned Imm,
uint64_t Addr,
const MCDisassembler *Decoder) {
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index bdaae4dd724d..a4ace6cce463 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -6717,68 +6717,6 @@ bool AArch64InstructionSelector::selectIntrinsic(MachineInstr &I,
I.eraseFromParent();
return true;
}
- case Intrinsic::ptrauth_sign: {
- Register DstReg = I.getOperand(0).getReg();
- Register ValReg = I.getOperand(2).getReg();
- uint64_t Key = I.getOperand(3).getImm();
- Register DiscReg = I.getOperand(4).getReg();
- auto DiscVal = getIConstantVRegVal(DiscReg, MRI);
- bool IsDiscZero = DiscVal && DiscVal->isZero();
-
- if (Key > AArch64PACKey::LAST)
- return false;
-
- unsigned Opcodes[][4] = {
- {AArch64::PACIA, AArch64::PACIB, AArch64::PACDA, AArch64::PACDB},
- {AArch64::PACIZA, AArch64::PACIZB, AArch64::PACDZA, AArch64::PACDZB}};
- unsigned Opcode = Opcodes[IsDiscZero][Key];
-
- auto PAC = MIB.buildInstr(Opcode, {DstReg}, {ValReg});
-
- if (!IsDiscZero) {
- PAC.addUse(DiscReg);
- RBI.constrainGenericRegister(DiscReg, AArch64::GPR64spRegClass, MRI);
- }
-
- RBI.constrainGenericRegister(DstReg, AArch64::GPR64RegClass, MRI);
- I.eraseFromParent();
- return true;
- }
- case Intrinsic::ptrauth_strip: {
- Register DstReg = I.getOperand(0).getReg();
- Register ValReg = I.getOperand(2).getReg();
- uint64_t Key = I.getOperand(3).getImm();
-
- if (Key > AArch64PACKey::LAST)
- return false;
- unsigned Opcode = getXPACOpcodeForKey((AArch64PACKey::ID)Key);
-
- MIB.buildInstr(Opcode, {DstReg}, {ValReg});
-
- RBI.constrainGenericRegister(DstReg, AArch64::GPR64RegClass, MRI);
- RBI.constrainGenericRegister(ValReg, AArch64::GPR64RegClass, MRI);
- I.eraseFromParent();
- return true;
- }
- case Intrinsic::ptrauth_blend: {
- MachineFunction &MF = *I.getParent()->getParent();
- auto RHS = getIConstantVRegVal(I.getOperand(3).getReg(), MRI);
- if (RHS && (RHS->getZExtValue() <= 0xffff)) {
- I.setDesc(TII.get(AArch64::MOVKXi));
- I.removeOperand(3);
- I.removeOperand(1);
- MachineInstrBuilder(MF, I)
- .addImm(RHS->getZExtValue() & 0xffff)
- .addImm(48)
- .constrainAllUses(TII, TRI, RBI);
- } else {
- I.setDesc(TII.get(AArch64::BFMXri));
- I.removeOperand(1);
- MachineInstrBuilder(MF, I).addImm(16).addImm(15).constrainAllUses(
- TII, TRI, RBI);
- }
- return true;
- }
case Intrinsic::frameaddress:
case Intrinsic::returnaddress: {
MachineFunction &MF = *I.getParent()->getParent();
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
index 687063873a16..830203b61c58 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
@@ -769,6 +769,27 @@ void applyDupLane(MachineInstr &MI, MachineRegisterInfo &MRI,
MI.eraseFromParent();
}
+bool matchScalarizeVectorUnmerge(MachineInstr &MI, MachineRegisterInfo &MRI) {
+ auto &Unmerge = cast<GUnmerge>(MI);
+ Register Src1Reg = Unmerge.getReg(Unmerge.getNumOperands() - 1);
+ const LLT SrcTy = MRI.getType(Src1Reg);
+ return SrcTy.isVector() && !SrcTy.isScalable() &&
+ Unmerge.getNumOperands() == (unsigned)SrcTy.getNumElements() + 1;
+}
+
+void applyScalarizeVectorUnmerge(MachineInstr &MI, MachineRegisterInfo &MRI,
+ MachineIRBuilder &B) {
+ auto &Unmerge = cast<GUnmerge>(MI);
+ Register Src1Reg = Unmerge.getReg(Unmerge.getNumOperands() - 1);
+ const LLT SrcTy = MRI.getType(Src1Reg);
+ assert((SrcTy.isVector() && !SrcTy.isScalable()) &&
+ "Expected a fixed length vector");
+
+ for (int I = 0; I < SrcTy.getNumElements(); ++I)
+ B.buildExtractVectorElementConstant(Unmerge.getReg(I), Src1Reg, I);
+ MI.eraseFromParent();
+}
+
bool matchBuildVectorToDup(MachineInstr &MI, MachineRegisterInfo &MRI) {
assert(MI.getOpcode() == TargetOpcode::G_BUILD_VECTOR);
auto Splat = getAArch64VectorSplat(MI, MRI);
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
index a6900b8963bb..30ef3680ae79 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
@@ -67,6 +67,7 @@ public:
{"fixup_aarch64_ldr_pcrel_imm19", 5, 19, PCRelFlagVal},
{"fixup_aarch64_movw", 5, 16, 0},
{"fixup_aarch64_pcrel_branch14", 5, 14, PCRelFlagVal},
+ {"fixup_aarch64_pcrel_branch16", 5, 16, PCRelFlagVal},
{"fixup_aarch64_pcrel_branch19", 5, 19, PCRelFlagVal},
{"fixup_aarch64_pcrel_branch26", 0, 26, PCRelFlagVal},
{"fixup_aarch64_pcrel_call26", 0, 26, PCRelFlagVal}};
@@ -121,6 +122,7 @@ static unsigned getFixupKindNumBytes(unsigned Kind) {
case AArch64::fixup_aarch64_movw:
case AArch64::fixup_aarch64_pcrel_branch14:
+ case AArch64::fixup_aarch64_pcrel_branch16:
case AArch64::fixup_aarch64_add_imm12:
case AArch64::fixup_aarch64_ldst_imm12_scale1:
case AArch64::fixup_aarch64_ldst_imm12_scale2:
@@ -314,6 +316,17 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, const MCValue &Target,
if (Value & 0x3)
Ctx.reportError(Fixup.getLoc(), "fixup not sufficiently aligned");
return (Value >> 2) & 0x3fff;
+ case AArch64::fixup_aarch64_pcrel_branch16:
+ // Unsigned PC-relative offset, so invert the negative immediate.
+ SignedValue = -SignedValue;
+ Value = static_cast<uint64_t>(SignedValue);
+ // Check valid 18-bit unsigned range.
+ if (SignedValue < 0 || SignedValue > ((1 << 18) - 1))
+ Ctx.reportError(Fixup.getLoc(), "fixup value out of range");
+ // Low two bits are not encoded (4-byte alignment assumed).
+ if (Value & 0b11)
+ Ctx.reportError(Fixup.getLoc(), "fixup not sufficiently aligned");
+ return (Value >> 2) & 0xffff;
case AArch64::fixup_aarch64_pcrel_branch26:
case AArch64::fixup_aarch64_pcrel_call26:
if (TheTriple.isOSBinFormatCOFF() && !IsResolved && SignedValue != 0) {
@@ -380,6 +393,7 @@ unsigned AArch64AsmBackend::getFixupKindContainereSizeInBytes(unsigned Kind) con
case AArch64::fixup_aarch64_movw:
case AArch64::fixup_aarch64_pcrel_branch14:
+ case AArch64::fixup_aarch64_pcrel_branch16:
case AArch64::fixup_aarch64_add_imm12:
case AArch64::fixup_aarch64_ldst_imm12_scale1:
case AArch64::fixup_aarch64_ldst_imm12_scale2:
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
index 9de40661298c..496ab18e9b19 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
@@ -186,6 +186,10 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
return R_CLS(LD_PREL_LO19);
case AArch64::fixup_aarch64_pcrel_branch14:
return R_CLS(TSTBR14);
+ case AArch64::fixup_aarch64_pcrel_branch16:
+ Ctx.reportError(Fixup.getLoc(),
+ "relocation of PAC/AUT instructions is not supported");
+ return ELF::R_AARCH64_NONE;
case AArch64::fixup_aarch64_pcrel_branch19:
return R_CLS(CONDBR19);
default:
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64FixupKinds.h b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64FixupKinds.h
index 767dd8805520..fdee2d5ad2bf 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64FixupKinds.h
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64FixupKinds.h
@@ -43,6 +43,11 @@ enum Fixups {
// The high 14 bits of a 21-bit pc-relative immediate.
fixup_aarch64_pcrel_branch14,
+ // The high 16 bits of a 18-bit unsigned PC-relative immediate. Used by
+ // pointer authentication, only within a function, so no relocation can be
+ // generated.
+ fixup_aarch64_pcrel_branch16,
+
// The high 19 bits of a 21-bit pc-relative immediate. Same encoding as
// fixup_aarch64_pcrel_adrhi, except this is use by b.cc and generates
// relocations directly when necessary.
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp
index dbc4323a860f..c3e12b6d8024 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp
@@ -88,6 +88,12 @@ public:
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
+ /// getPAuthPCRelOpValue - Return the encoded value for a pointer
+ /// authentication pc-relative operand.
+ uint32_t getPAuthPCRelOpValue(const MCInst &MI, unsigned OpIdx,
+ SmallVectorImpl<MCFixup> &Fixups,
+ const MCSubtargetInfo &STI) const;
+
/// getLoadLiteralOpValue - Return the encoded value for a load-literal
/// pc-relative address.
uint32_t getLoadLiteralOpValue(const MCInst &MI, unsigned OpIdx,
@@ -327,6 +333,29 @@ uint32_t AArch64MCCodeEmitter::getCondBranchTargetOpValue(
return 0;
}
+/// getPAuthPCRelOpValue - Return the encoded value for a pointer
+/// authentication pc-relative operand.
+uint32_t
+AArch64MCCodeEmitter::getPAuthPCRelOpValue(const MCInst &MI, unsigned OpIdx,
+ SmallVectorImpl<MCFixup> &Fixups,
+ const MCSubtargetInfo &STI) const {
+ const MCOperand &MO = MI.getOperand(OpIdx);
+
+ // If the destination is an immediate, invert sign as it's a negative value
+ // that should be encoded as unsigned
+ if (MO.isImm())
+ return -(MO.getImm());
+ assert(MO.isExpr() && "Unexpected target type!");
+
+ MCFixupKind Kind = MCFixupKind(AArch64::fixup_aarch64_pcrel_branch16);
+ Fixups.push_back(MCFixup::create(0, MO.getExpr(), Kind, MI.getLoc()));
+
+ ++MCNumFixups;
+
+ // All of the information is in the fixup.
+ return 0;
+}
+
/// getLoadLiteralOpValue - Return the encoded value for a load-literal
/// pc-relative address.
uint32_t
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/SMEInstrFormats.td b/contrib/llvm-project/llvm/lib/Target/AArch64/SMEInstrFormats.td
index 4f8917618ea4..70f3c2c99f0f 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/SMEInstrFormats.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/SMEInstrFormats.td
@@ -1259,6 +1259,12 @@ multiclass sve2_int_perm_revd<string asm, SDPatternOperator op> {
def : SVE_1_Op_Passthru_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Instruction>(NAME)>;
def : SVE_1_Op_Passthru_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Instruction>(NAME)>;
def : SVE_1_Op_Passthru_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME)>;
+
+ def : SVE_1_Op_Passthru_Pat<nxv8bf16, op, nxv8i1, nxv8bf16, !cast<Instruction>(NAME)>;
+ def : SVE_1_Op_Passthru_Pat<nxv8f16, op, nxv8i1, nxv8f16, !cast<Instruction>(NAME)>;
+ def : SVE_1_Op_Passthru_Pat<nxv4f32, op, nxv4i1, nxv4f32, !cast<Instruction>(NAME)>;
+ def : SVE_1_Op_Passthru_Pat<nxv2f64, op, nxv2i1, nxv2f64, !cast<Instruction>(NAME)>;
+
}
class sve2_clamp<string asm, bits<2> sz, bit U, ZPRRegOp zpr_ty>
@@ -3712,8 +3718,14 @@ multiclass sme2_mova_vec_to_array_vg2_multi<string mnemonic, SDPatternOperator i
def NAME # _PSEUDO : sme2_move_to_za_pseudo<NAME, sme_elm_idx0_7, ZZ_d_mul_r, SMEMatrixArray>;
- def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv2i64, sme_elm_idx0_7, tileslice16>;
- def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv2f64, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv16i8, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv8i16, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv8f16, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv8bf16, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv4i32, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv4f32, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv2i64, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x2_Multi_Pat<NAME, intrinsic, nxv2f64, sme_elm_idx0_7, tileslice16>;
defm : sme2_mova_vec_to_tile_or_array_aliases<0, !cast<Instruction>(NAME),
MatrixOp8,
@@ -3805,8 +3817,14 @@ multiclass sme2_mova_vec_to_array_vg4_multi<string mnemonic, SDPatternOperator i
def NAME # _PSEUDO : sme2_move_to_za_pseudo<NAME, sme_elm_idx0_7, ZZZZ_d_mul_r, SMEMatrixArray>;
- def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv2i64, sme_elm_idx0_7, tileslice16>;
- def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv2f64, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv16i8, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv8i16, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv8f16, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv8bf16, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv4i32, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv4f32, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv2i64, sme_elm_idx0_7, tileslice16>;
+ def : SME2_ZA_VG1x4_Multi_Pat<NAME, intrinsic, nxv2f64, sme_elm_idx0_7, tileslice16>;
defm : sme2_mova_vec_to_tile_or_array_aliases<0, !cast<Instruction>(NAME),
MatrixOp8,
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/SVEInstrFormats.td b/contrib/llvm-project/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 9edf26052247..b7552541e950 100644
--- a/contrib/llvm-project/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/contrib/llvm-project/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -10433,3 +10433,34 @@ multiclass sve2_luti4_vector_vg2_index<string mnemonic> {
let Inst{23-22} = idx;
}
}
+
+//===----------------------------------------------------------------------===//
+// Checked Pointer Arithmetic (FEAT_CPA)
+//===----------------------------------------------------------------------===//
+class sve_int_mad_cpa<string asm>
+ : I<(outs ZPR64:$Zdn), (ins ZPR64:$_Zdn, ZPR64:$Zm, ZPR64:$Za),
+ asm, "\t$Zdn, $Zm, $Za", "", []>, Sched<[]> {
+ bits<5> Zdn;
+ bits<5> Zm;
+ bits<5> Za;
+ let Inst{31-24} = 0b01000100;
+ let Inst{23-22} = 0b11; // sz
+ let Inst{21} = 0b0;
+ let Inst{20-16} = Zm;
+ let Inst{15} = 0b1;
+ let Inst{14-10} = 0b10110; // opc
+ let Inst{9-5} = Za;
+ let Inst{4-0} = Zdn;
+
+ let Constraints = "$Zdn = $_Zdn";
+ let DestructiveInstType = DestructiveOther;
+ let ElementSize = ZPR64.ElementSize;
+ let hasSideEffects = 0;
+}
+
+class sve_int_mla_cpa<string asm>
+ : sve2_int_mla<0b11, 0b10100, asm, ZPR64, ZPR64> {
+ let Inst{15} = 0b1;
+
+ let ElementSize = ZPR64.ElementSize;
+}
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPU.td b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPU.td
index 060fb66d38f7..d2a325d5ad89 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -1100,8 +1100,8 @@ def FeatureGFX12 : GCNSubtargetFeatureGeneration<"GFX12",
FeatureVOP3Literal, FeatureDPP8,
FeatureNoDataDepHazard, FeaturePkFmacF16Inst,
FeatureA16, FeatureFastDenormalF32, FeatureG16,
- FeatureUnalignedBufferAccess, FeatureUnalignedDSAccess, FeatureGDS,
- FeatureGWS, FeatureTrue16BitInsts
+ FeatureUnalignedBufferAccess, FeatureUnalignedDSAccess,
+ FeatureTrue16BitInsts
]
>;
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
index 0a17b1536040..4462cd8a31f1 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
@@ -75,8 +75,9 @@ enum class SchedGroupMask {
DS = 1u << 7,
DS_READ = 1u << 8,
DS_WRITE = 1u << 9,
+ TRANS = 1u << 10,
ALL = ALU | VALU | SALU | MFMA | VMEM | VMEM_READ | VMEM_WRITE | DS |
- DS_READ | DS_WRITE,
+ DS_READ | DS_WRITE | TRANS,
LLVM_MARK_AS_BITMASK_ENUM(/* LargestFlag = */ ALL)
};
@@ -1435,11 +1436,12 @@ bool SchedGroup::canAddMI(const MachineInstr &MI) const {
Result = false;
else if (((SGMask & SchedGroupMask::ALU) != SchedGroupMask::NONE) &&
- (TII->isVALU(MI) || TII->isMFMAorWMMA(MI) || TII->isSALU(MI)))
+ (TII->isVALU(MI) || TII->isMFMAorWMMA(MI) || TII->isSALU(MI) ||
+ TII->isTRANS(MI)))
Result = true;
else if (((SGMask & SchedGroupMask::VALU) != SchedGroupMask::NONE) &&
- TII->isVALU(MI) && !TII->isMFMAorWMMA(MI))
+ TII->isVALU(MI) && !TII->isMFMAorWMMA(MI) && !TII->isTRANS(MI))
Result = true;
else if (((SGMask & SchedGroupMask::SALU) != SchedGroupMask::NONE) &&
@@ -1476,6 +1478,10 @@ bool SchedGroup::canAddMI(const MachineInstr &MI) const {
MI.mayStore() && TII->isDS(MI))
Result = true;
+ else if (((SGMask & SchedGroupMask::TRANS) != SchedGroupMask::NONE) &&
+ TII->isTRANS(MI))
+ Result = true;
+
LLVM_DEBUG(
dbgs() << "For SchedGroup with mask " << format_hex((int)SGMask, 10, true)
<< (Result ? " could classify " : " unable to classify ") << MI);
@@ -1635,10 +1641,13 @@ void IGroupLPDAGMutation::addSchedBarrierEdges(SUnit &SchedBarrier) {
// Remove all existing edges from the SCHED_BARRIER that were added due to the
// instruction having side effects.
resetEdges(SchedBarrier, DAG);
+ LLVM_DEBUG(dbgs() << "Building SchedGroup for SchedBarrier with Mask: "
+ << MI.getOperand(0).getImm() << "\n");
auto InvertedMask =
invertSchedBarrierMask((SchedGroupMask)MI.getOperand(0).getImm());
SchedGroup SG(InvertedMask, std::nullopt, DAG, TII);
SG.initSchedGroup();
+
// Preserve original instruction ordering relative to the SCHED_BARRIER.
SG.link(
SchedBarrier,
@@ -1652,14 +1661,15 @@ IGroupLPDAGMutation::invertSchedBarrierMask(SchedGroupMask Mask) const {
// allowed past the SCHED_BARRIER.
SchedGroupMask InvertedMask = ~Mask;
- // ALU implies VALU, SALU, MFMA.
+ // ALU implies VALU, SALU, MFMA, TRANS.
if ((InvertedMask & SchedGroupMask::ALU) == SchedGroupMask::NONE)
- InvertedMask &=
- ~SchedGroupMask::VALU & ~SchedGroupMask::SALU & ~SchedGroupMask::MFMA;
- // VALU, SALU, MFMA implies ALU.
+ InvertedMask &= ~SchedGroupMask::VALU & ~SchedGroupMask::SALU &
+ ~SchedGroupMask::MFMA & ~SchedGroupMask::TRANS;
+ // VALU, SALU, MFMA, TRANS implies ALU.
else if ((InvertedMask & SchedGroupMask::VALU) == SchedGroupMask::NONE ||
(InvertedMask & SchedGroupMask::SALU) == SchedGroupMask::NONE ||
- (InvertedMask & SchedGroupMask::MFMA) == SchedGroupMask::NONE)
+ (InvertedMask & SchedGroupMask::MFMA) == SchedGroupMask::NONE ||
+ (InvertedMask & SchedGroupMask::TRANS) == SchedGroupMask::NONE)
InvertedMask &= ~SchedGroupMask::ALU;
// VMEM implies VMEM_READ, VMEM_WRITE.
@@ -1678,6 +1688,9 @@ IGroupLPDAGMutation::invertSchedBarrierMask(SchedGroupMask Mask) const {
(InvertedMask & SchedGroupMask::DS_WRITE) == SchedGroupMask::NONE)
InvertedMask &= ~SchedGroupMask::DS;
+ LLVM_DEBUG(dbgs() << "After Inverting, SchedGroup Mask: " << (int)InvertedMask
+ << "\n");
+
return InvertedMask;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
index 9d7443012e3d..541a5b62450d 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -169,11 +169,17 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(const TargetMachine &TM,
setLoadExtAction(ISD::EXTLOAD, MVT::f32, MVT::f16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::f32, MVT::bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v2f32, MVT::v2f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v2f32, MVT::v2bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v3f32, MVT::v3f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v3f32, MVT::v3bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v4f32, MVT::v4f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v4f32, MVT::v4bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v8f32, MVT::v8f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v8f32, MVT::v8bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v16f32, MVT::v16f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v16f32, MVT::v16bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v32f32, MVT::v32f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v32f32, MVT::v32bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f32, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v2f64, MVT::v2f32, Expand);
@@ -185,10 +191,15 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(const TargetMachine &TM,
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v2f64, MVT::v2f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v2f64, MVT::v2bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v3f64, MVT::v3f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v3f64, MVT::v3bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v4f64, MVT::v4f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v4f64, MVT::v4bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v8f64, MVT::v8f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v8f64, MVT::v8bf16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::v16f64, MVT::v16f16, Expand);
+ setLoadExtAction(ISD::EXTLOAD, MVT::v16f64, MVT::v16bf16, Expand);
setOperationAction(ISD::STORE, MVT::f32, Promote);
AddPromotedToType(ISD::STORE, MVT::f32, MVT::i32);
@@ -506,9 +517,11 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::SELECT, MVT::v12f32, Promote);
AddPromotedToType(ISD::SELECT, MVT::v12f32, MVT::v12i32);
- // There are no libcalls of any kind.
- for (int I = 0; I < RTLIB::UNKNOWN_LIBCALL; ++I)
- setLibcallName(static_cast<RTLIB::Libcall>(I), nullptr);
+ // Disable most libcalls.
+ for (int I = 0; I < RTLIB::UNKNOWN_LIBCALL; ++I) {
+ if (I < RTLIB::ATOMIC_LOAD || I > RTLIB::ATOMIC_FETCH_NAND_16)
+ setLibcallName(static_cast<RTLIB::Libcall>(I), nullptr);
+ }
setSchedulingPreference(Sched::RegPressure);
setJumpIsExpensive(true);
@@ -556,6 +569,8 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(const TargetMachine &TM,
ISD::FSUB, ISD::FNEG,
ISD::FABS, ISD::AssertZext,
ISD::AssertSext, ISD::INTRINSIC_WO_CHAIN});
+
+ setMaxAtomicSizeInBitsSupported(64);
}
bool AMDGPUTargetLowering::mayIgnoreSignedZero(SDValue Op) const {
@@ -3055,18 +3070,26 @@ SDValue AMDGPUTargetLowering::LowerCTLZ_CTTZ(SDValue Op, SelectionDAG &DAG) cons
bool ZeroUndef = Op.getOpcode() == ISD::CTLZ_ZERO_UNDEF ||
Op.getOpcode() == ISD::CTTZ_ZERO_UNDEF;
+ bool Is64BitScalar = !Src->isDivergent() && Src.getValueType() == MVT::i64;
- if (Src.getValueType() == MVT::i32) {
+ if (Src.getValueType() == MVT::i32 || Is64BitScalar) {
// (ctlz hi:lo) -> (umin (ffbh src), 32)
// (cttz hi:lo) -> (umin (ffbl src), 32)
// (ctlz_zero_undef src) -> (ffbh src)
// (cttz_zero_undef src) -> (ffbl src)
+
+ // 64-bit scalar version produce 32-bit result
+ // (ctlz hi:lo) -> (umin (S_FLBIT_I32_B64 src), 64)
+ // (cttz hi:lo) -> (umin (S_FF1_I32_B64 src), 64)
+ // (ctlz_zero_undef src) -> (S_FLBIT_I32_B64 src)
+ // (cttz_zero_undef src) -> (S_FF1_I32_B64 src)
SDValue NewOpr = DAG.getNode(NewOpc, SL, MVT::i32, Src);
if (!ZeroUndef) {
- const SDValue Const32 = DAG.getConstant(32, SL, MVT::i32);
- NewOpr = DAG.getNode(ISD::UMIN, SL, MVT::i32, NewOpr, Const32);
+ const SDValue ConstVal = DAG.getConstant(
+ Op.getValueType().getScalarSizeInBits(), SL, MVT::i32);
+ NewOpr = DAG.getNode(ISD::UMIN, SL, MVT::i32, NewOpr, ConstVal);
}
- return NewOpr;
+ return DAG.getNode(ISD::ZERO_EXTEND, SL, Src.getValueType(), NewOpr);
}
SDValue Lo, Hi;
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
index ee93d9eb4c0a..2bb7b6bd0674 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
@@ -1241,6 +1241,10 @@ static Value *simplifyAMDGCNMemoryIntrinsicDemanded(InstCombiner &IC,
ConstantInt *DMask = cast<ConstantInt>(Args[DMaskIdx]);
unsigned DMaskVal = DMask->getZExtValue() & 0xf;
+ // dmask 0 has special semantics, do not simplify.
+ if (DMaskVal == 0)
+ return nullptr;
+
// Mask off values that are undefined because the dmask doesn't cover them
DemandedElts &= (1 << llvm::popcount(DMaskVal)) - 1;
@@ -1261,7 +1265,7 @@ static Value *simplifyAMDGCNMemoryIntrinsicDemanded(InstCombiner &IC,
unsigned NewNumElts = DemandedElts.popcount();
if (!NewNumElts)
- return UndefValue::get(IIVTy);
+ return PoisonValue::get(IIVTy);
if (NewNumElts >= VWidth && DemandedElts.isMask()) {
if (DMaskIdx >= 0)
@@ -1299,7 +1303,7 @@ static Value *simplifyAMDGCNMemoryIntrinsicDemanded(InstCombiner &IC,
if (IsLoad) {
if (NewNumElts == 1) {
- return IC.Builder.CreateInsertElement(UndefValue::get(IIVTy), NewCall,
+ return IC.Builder.CreateInsertElement(PoisonValue::get(IIVTy), NewCall,
DemandedElts.countr_zero());
}
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
index 0c21382e5c22..f03e6b8915b1 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -1050,8 +1050,7 @@ bool AMDGPULibCalls::fold_pow(FPMathOperator *FPOp, IRBuilder<> &B,
CF->isNegative();
} else {
needlog = true;
- needcopysign = needabs = FInfo.getId() != AMDGPULibFunc::EI_POWR &&
- (!CF || CF->isNegative());
+ needcopysign = needabs = FInfo.getId() != AMDGPULibFunc::EI_POWR;
}
} else {
ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(opr0);
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
index 1bed516fb5c7..5e73411cae9b 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
@@ -530,6 +530,15 @@ static Value *promoteAllocaUserToVector(
return Builder.CreateVectorSplat(VectorTy->getElementCount(), Elt);
}
+ if (auto *Intr = dyn_cast<IntrinsicInst>(Inst)) {
+ if (Intr->getIntrinsicID() == Intrinsic::objectsize) {
+ Intr->replaceAllUsesWith(
+ Builder.getIntN(Intr->getType()->getIntegerBitWidth(),
+ DL.getTypeAllocSize(VectorTy)));
+ return nullptr;
+ }
+ }
+
llvm_unreachable("Unsupported call when promoting alloca to vector");
}
@@ -773,8 +782,17 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToVector(AllocaInst &Alloca) {
continue;
}
+ if (auto *Intr = dyn_cast<IntrinsicInst>(Inst)) {
+ if (Intr->getIntrinsicID() == Intrinsic::objectsize) {
+ WorkList.push_back(Inst);
+ continue;
+ }
+ }
+
// Ignore assume-like intrinsics and comparisons used in assumes.
if (isAssumeLikeIntrinsic(Inst)) {
+ if (!Inst->use_empty())
+ return RejectUser(Inst, "assume-like intrinsic cannot have any users");
UsersToRemove.push_back(Inst);
continue;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index e8c04ecf39ba..fdc2077868cf 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -345,6 +345,11 @@ static cl::opt<bool> EnableImageIntrinsicOptimizer(
cl::desc("Enable image intrinsic optimizer pass"), cl::init(true),
cl::Hidden);
+static cl::opt<bool>
+ EnableLoopPrefetch("amdgpu-loop-prefetch",
+ cl::desc("Enable loop data prefetch on AMDGPU"),
+ cl::Hidden, cl::init(false));
+
static cl::opt<bool> EnableMaxIlpSchedStrategy(
"amdgpu-enable-max-ilp-scheduling-strategy",
cl::desc("Enable scheduling strategy to maximize ILP for a single wave."),
@@ -982,6 +987,8 @@ void AMDGPUPassConfig::addEarlyCSEOrGVNPass() {
}
void AMDGPUPassConfig::addStraightLineScalarOptimizationPasses() {
+ if (isPassEnabled(EnableLoopPrefetch, CodeGenOptLevel::Aggressive))
+ addPass(createLoopDataPrefetchPass());
addPass(createSeparateConstOffsetFromGEPPass());
// ReassociateGEPs exposes more opportunities for SLSR. See
// the example in reassociate-geps-and-slsr.ll.
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
index f1da1a61bf4d..ebe0b8551b23 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
@@ -1345,3 +1345,11 @@ GCNTTIImpl::getTypeLegalizationCost(Type *Ty) const {
Cost.first += (Size + 255) / 256;
return Cost;
}
+
+unsigned GCNTTIImpl::getPrefetchDistance() const {
+ return ST->hasPrefetch() ? 128 : 0;
+}
+
+bool GCNTTIImpl::shouldPrefetchAddressSpace(unsigned AS) const {
+ return AMDGPU::isFlatGlobalAddrSpace(AS);
+}
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
index 1e6c5bbfc0d7..cd8e9fd10bbf 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
@@ -254,6 +254,16 @@ public:
InstructionCost getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty,
FastMathFlags FMF,
TTI::TargetCostKind CostKind);
+
+ /// Data cache line size for LoopDataPrefetch pass. Has no use before GFX12.
+ unsigned getCacheLineSize() const override { return 128; }
+
+ /// How much before a load we should place the prefetch instruction.
+ /// This is currently measured in number of IR instructions.
+ unsigned getPrefetchDistance() const override;
+
+ /// \return if target want to issue a prefetch in address space \p AS.
+ bool shouldPrefetchAddressSpace(unsigned AS) const override;
};
} // end namespace llvm
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/DSInstructions.td b/contrib/llvm-project/llvm/lib/Target/AMDGPU/DSInstructions.td
index 3a895923fa4b..bc9049b4ef33 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/DSInstructions.td
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/DSInstructions.td
@@ -1147,7 +1147,8 @@ def : GCNPat <
>;
} // End SubtargetPredicate = HasAtomicDsPkAdd16Insts
-def : Pat <
+let OtherPredicates = [HasGDS] in
+def : GCNPat <
(SIds_ordered_count i32:$value, i16:$offset),
(DS_ORDERED_COUNT $value, (as_i16imm $offset))
>;
@@ -1189,7 +1190,8 @@ def : GCNPat <
//===----------------------------------------------------------------------===//
class Base_DS_Real_gfx6_gfx7_gfx10_gfx11_gfx12<bits<8> op, DS_Pseudo ps, int ef,
- string opName = ps.Mnemonic>
+ string opName = ps.Mnemonic,
+ bit hasGFX12Enc = 0>
: DS_Real<ps, opName>, SIMCInstr <ps.Mnemonic, ef> {
let Inst{7-0} = !if(ps.has_offset0, offset0, 0);
@@ -1201,6 +1203,8 @@ class Base_DS_Real_gfx6_gfx7_gfx10_gfx11_gfx12<bits<8> op, DS_Pseudo ps, int ef,
let Inst{47-40} = !if(ps.has_data0, data0{7-0}, 0);
let Inst{55-48} = !if(ps.has_data1, data1{7-0}, 0);
let Inst{63-56} = !if(ps.has_vdst, vdst{7-0}, 0);
+
+ let gds = !if(hasGFX12Enc, 0, ?);
}
//===----------------------------------------------------------------------===//
@@ -1212,7 +1216,7 @@ let AssemblerPredicate = isGFX12Plus, DecoderNamespace = "GFX12" in {
defvar ps = !cast<DS_Pseudo>(NAME);
def _gfx12 :
Base_DS_Real_gfx6_gfx7_gfx10_gfx11_gfx12<op, ps, SIEncodingFamily.GFX12,
- ps.Mnemonic>;
+ ps.Mnemonic, 1>;
}
multiclass DS_Real_Renamed_gfx12<bits<8> op, DS_Pseudo backing_pseudo,
@@ -1220,7 +1224,7 @@ let AssemblerPredicate = isGFX12Plus, DecoderNamespace = "GFX12" in {
def _gfx12 :
Base_DS_Real_gfx6_gfx7_gfx10_gfx11_gfx12<op, backing_pseudo,
SIEncodingFamily.GFX12,
- real_name>,
+ real_name, 1>,
MnemonicAlias<backing_pseudo.Mnemonic, real_name>,
Requires<[isGFX12Plus]>;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
index ed2e7e4f189e..7939d0036568 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
@@ -702,6 +702,11 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
AMDGPU::OpName::src2_modifiers);
}
+ if (Res && (MCII->get(MI.getOpcode()).TSFlags & SIInstrFlags::DS) &&
+ !AMDGPU::hasGDS(STI)) {
+ insertNamedMCOperand(MI, MCOperand::createImm(0), AMDGPU::OpName::gds);
+ }
+
if (Res && (MCII->get(MI.getOpcode()).TSFlags &
(SIInstrFlags::MUBUF | SIInstrFlags::FLAT | SIInstrFlags::SMRD))) {
int CPolPos = AMDGPU::getNamedOperandIdx(MI.getOpcode(),
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 34826809c1a6..fc119aa61d01 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -540,10 +540,7 @@ SITargetLowering::SITargetLowering(const TargetMachine &TM,
MVT::f16, Custom);
setOperationAction({ISD::SINT_TO_FP, ISD::UINT_TO_FP}, MVT::i16, Custom);
-
- setOperationAction(
- {ISD::FP_TO_SINT, ISD::FP_TO_UINT, ISD::SINT_TO_FP, ISD::UINT_TO_FP},
- MVT::f16, Promote);
+ setOperationAction({ISD::FP_TO_SINT, ISD::FP_TO_UINT}, MVT::f16, Promote);
// F16 - VOP2 Actions.
setOperationAction({ISD::BR_CC, ISD::SELECT_CC}, MVT::f16, Expand);
@@ -1145,11 +1142,10 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
MachineMemOperand::MOStore |
MachineMemOperand::MODereferenceable;
- // XXX - Should this be volatile without known ordering?
- Info.flags |= MachineMemOperand::MOVolatile;
-
switch (IntrID) {
default:
+ // XXX - Should this be volatile without known ordering?
+ Info.flags |= MachineMemOperand::MOVolatile;
break;
case Intrinsic::amdgcn_raw_buffer_load_lds:
case Intrinsic::amdgcn_raw_ptr_buffer_load_lds:
@@ -1157,6 +1153,7 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
case Intrinsic::amdgcn_struct_ptr_buffer_load_lds: {
unsigned Width = cast<ConstantInt>(CI.getArgOperand(2))->getZExtValue();
Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
+ Info.ptrVal = CI.getArgOperand(1);
return true;
}
}
@@ -1289,8 +1286,8 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
Info.opc = ISD::INTRINSIC_VOID;
unsigned Width = cast<ConstantInt>(CI.getArgOperand(2))->getZExtValue();
Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
- Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore |
- MachineMemOperand::MOVolatile;
+ Info.ptrVal = CI.getArgOperand(1);
+ Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
return true;
}
case Intrinsic::amdgcn_ds_bvh_stack_rtn: {
@@ -9231,7 +9228,9 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
MachinePointerInfo StorePtrI = LoadPtrI;
- StorePtrI.V = nullptr;
+ LoadPtrI.V = PoisonValue::get(
+ PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
+ LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
auto F = LoadMMO->getFlags() &
@@ -9309,6 +9308,8 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
LoadPtrI.Offset = Op->getConstantOperandVal(5);
MachinePointerInfo StorePtrI = LoadPtrI;
+ LoadPtrI.V = PoisonValue::get(
+ PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
auto F = LoadMMO->getFlags() &
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 8415a3d77d3b..55ddb540c51e 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -238,7 +238,7 @@ public:
bool merge(const WaitcntBrackets &Other);
- RegInterval getRegInterval(const MachineInstr *MI, const SIInstrInfo *TII,
+ RegInterval getRegInterval(const MachineInstr *MI,
const MachineRegisterInfo *MRI,
const SIRegisterInfo *TRI, unsigned OpNo) const;
@@ -500,7 +500,6 @@ public:
} // end anonymous namespace
RegInterval WaitcntBrackets::getRegInterval(const MachineInstr *MI,
- const SIInstrInfo *TII,
const MachineRegisterInfo *MRI,
const SIRegisterInfo *TRI,
unsigned OpNo) const {
@@ -534,7 +533,7 @@ RegInterval WaitcntBrackets::getRegInterval(const MachineInstr *MI,
else
return {-1, -1};
- const TargetRegisterClass *RC = TII->getOpRegClass(*MI, OpNo);
+ const TargetRegisterClass *RC = TRI->getPhysRegBaseClass(Op.getReg());
unsigned Size = TRI->getRegSizeInBits(*RC);
Result.second = Result.first + ((Size + 16) / 32);
@@ -546,7 +545,7 @@ void WaitcntBrackets::setExpScore(const MachineInstr *MI,
const SIRegisterInfo *TRI,
const MachineRegisterInfo *MRI, unsigned OpNo,
unsigned Val) {
- RegInterval Interval = getRegInterval(MI, TII, MRI, TRI, OpNo);
+ RegInterval Interval = getRegInterval(MI, MRI, TRI, OpNo);
assert(TRI->isVectorRegister(*MRI, MI->getOperand(OpNo).getReg()));
for (int RegNo = Interval.first; RegNo < Interval.second; ++RegNo) {
setRegScore(RegNo, EXP_CNT, Val);
@@ -674,7 +673,7 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII,
Inst.getOpcode() == AMDGPU::BUFFER_STORE_DWORDX4) {
MachineOperand *MO = TII->getNamedOperand(Inst, AMDGPU::OpName::data);
unsigned OpNo;//TODO: find the OpNo for this operand;
- RegInterval Interval = getRegInterval(&Inst, TII, MRI, TRI, OpNo);
+ RegInterval Interval = getRegInterval(&Inst, MRI, TRI, OpNo);
for (int RegNo = Interval.first; RegNo < Interval.second;
++RegNo) {
setRegScore(RegNo + NUM_ALL_VGPRS, t, CurrScore);
@@ -686,7 +685,7 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII,
auto &Op = Inst.getOperand(I);
if (!Op.isReg() || !Op.isDef())
continue;
- RegInterval Interval = getRegInterval(&Inst, TII, MRI, TRI, I);
+ RegInterval Interval = getRegInterval(&Inst, MRI, TRI, I);
if (T == VM_CNT) {
if (Interval.first >= NUM_ALL_VGPRS)
continue;
@@ -1140,7 +1139,7 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI,
if (MI.getOperand(CallAddrOpIdx).isReg()) {
RegInterval CallAddrOpInterval =
- ScoreBrackets.getRegInterval(&MI, TII, MRI, TRI, CallAddrOpIdx);
+ ScoreBrackets.getRegInterval(&MI, MRI, TRI, CallAddrOpIdx);
for (int RegNo = CallAddrOpInterval.first;
RegNo < CallAddrOpInterval.second; ++RegNo)
@@ -1150,7 +1149,7 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI,
AMDGPU::getNamedOperandIdx(MI.getOpcode(), AMDGPU::OpName::dst);
if (RtnAddrOpIdx != -1) {
RegInterval RtnAddrOpInterval =
- ScoreBrackets.getRegInterval(&MI, TII, MRI, TRI, RtnAddrOpIdx);
+ ScoreBrackets.getRegInterval(&MI, MRI, TRI, RtnAddrOpIdx);
for (int RegNo = RtnAddrOpInterval.first;
RegNo < RtnAddrOpInterval.second; ++RegNo)
@@ -1202,8 +1201,7 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI,
if (Op.isTied() && Op.isUse() && TII->doesNotReadTiedSource(MI))
continue;
- RegInterval Interval =
- ScoreBrackets.getRegInterval(&MI, TII, MRI, TRI, I);
+ RegInterval Interval = ScoreBrackets.getRegInterval(&MI, MRI, TRI, I);
const bool IsVGPR = TRI->isVectorRegister(*MRI, Op.getReg());
for (int RegNo = Interval.first; RegNo < Interval.second; ++RegNo) {
@@ -1782,7 +1780,7 @@ bool SIInsertWaitcnts::shouldFlushVmCnt(MachineLoop *ML,
MachineOperand &Op = MI.getOperand(I);
if (!Op.isReg() || !TRI->isVectorRegister(*MRI, Op.getReg()))
continue;
- RegInterval Interval = Brackets.getRegInterval(&MI, TII, MRI, TRI, I);
+ RegInterval Interval = Brackets.getRegInterval(&MI, MRI, TRI, I);
// Vgpr use
if (Op.isUse()) {
for (int RegNo = Interval.first; RegNo < Interval.second; ++RegNo) {
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 70ef1fff274a..ebe23a5eac57 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -245,6 +245,10 @@ bool SIInstrInfo::areLoadsFromSameBasePtr(SDNode *Load0, SDNode *Load1,
if (!get(Opc0).mayLoad() || !get(Opc1).mayLoad())
return false;
+ // A mayLoad instruction without a def is not a load. Likely a prefetch.
+ if (!get(Opc0).getNumDefs() || !get(Opc1).getNumDefs())
+ return false;
+
if (isDS(Opc0) && isDS(Opc1)) {
// FIXME: Handle this case:
@@ -3654,6 +3658,9 @@ bool SIInstrInfo::areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
if (MIa.hasOrderedMemoryRef() || MIb.hasOrderedMemoryRef())
return false;
+ if (isLDSDMA(MIa) || isLDSDMA(MIb))
+ return false;
+
// TODO: Should we check the address space from the MachineMemOperand? That
// would allow us to distinguish objects we know don't alias based on the
// underlying address space, even if it was lowered to a different one,
@@ -4976,6 +4983,14 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
}
}
+ if (isDS(MI) && !ST.hasGDS()) {
+ const MachineOperand *GDSOp = getNamedOperand(MI, AMDGPU::OpName::gds);
+ if (GDSOp && GDSOp->getImm() != 0) {
+ ErrInfo = "GDS is not supported on this subtarget";
+ return false;
+ }
+ }
+
if (isImage(MI)) {
const MachineOperand *DimOp = getNamedOperand(MI, AMDGPU::OpName::dim);
if (DimOp) {
@@ -6897,6 +6912,15 @@ void SIInstrInfo::moveToVALUImpl(SIInstrWorklist &Worklist,
Inst.eraseFromParent();
return;
+ case AMDGPU::S_FLBIT_I32_B64:
+ splitScalar64BitCountOp(Worklist, Inst, AMDGPU::V_FFBH_U32_e32);
+ Inst.eraseFromParent();
+ return;
+ case AMDGPU::S_FF1_I32_B64:
+ splitScalar64BitCountOp(Worklist, Inst, AMDGPU::V_FFBL_B32_e32);
+ Inst.eraseFromParent();
+ return;
+
case AMDGPU::S_LSHL_B32:
if (ST.hasOnlyRevVALUShifts()) {
NewOpcode = AMDGPU::V_LSHLREV_B32_e64;
@@ -7830,6 +7854,61 @@ void SIInstrInfo::splitScalar64BitBFE(SIInstrWorklist &Worklist,
addUsersToMoveToVALUWorklist(ResultReg, MRI, Worklist);
}
+void SIInstrInfo::splitScalar64BitCountOp(SIInstrWorklist &Worklist,
+ MachineInstr &Inst, unsigned Opcode,
+ MachineDominatorTree *MDT) const {
+ // (S_FLBIT_I32_B64 hi:lo) ->
+ // -> (umin (V_FFBH_U32_e32 hi), (uaddsat (V_FFBH_U32_e32 lo), 32))
+ // (S_FF1_I32_B64 hi:lo) ->
+ // ->(umin (uaddsat (V_FFBL_B32_e32 hi), 32) (V_FFBL_B32_e32 lo))
+
+ MachineBasicBlock &MBB = *Inst.getParent();
+ MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo();
+ MachineBasicBlock::iterator MII = Inst;
+ const DebugLoc &DL = Inst.getDebugLoc();
+
+ MachineOperand &Dest = Inst.getOperand(0);
+ MachineOperand &Src = Inst.getOperand(1);
+
+ const MCInstrDesc &InstDesc = get(Opcode);
+
+ bool IsCtlz = Opcode == AMDGPU::V_FFBH_U32_e32;
+ unsigned OpcodeAdd =
+ ST.hasAddNoCarry() ? AMDGPU::V_ADD_U32_e64 : AMDGPU::V_ADD_CO_U32_e32;
+
+ const TargetRegisterClass *SrcRC =
+ Src.isReg() ? MRI.getRegClass(Src.getReg()) : &AMDGPU::SGPR_32RegClass;
+ const TargetRegisterClass *SrcSubRC =
+ RI.getSubRegisterClass(SrcRC, AMDGPU::sub0);
+
+ MachineOperand SrcRegSub0 =
+ buildExtractSubRegOrImm(MII, MRI, Src, SrcRC, AMDGPU::sub0, SrcSubRC);
+ MachineOperand SrcRegSub1 =
+ buildExtractSubRegOrImm(MII, MRI, Src, SrcRC, AMDGPU::sub1, SrcSubRC);
+
+ Register MidReg1 = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
+ Register MidReg2 = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
+ Register MidReg3 = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
+ Register MidReg4 = MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);
+
+ BuildMI(MBB, MII, DL, InstDesc, MidReg1).add(SrcRegSub0);
+
+ BuildMI(MBB, MII, DL, InstDesc, MidReg2).add(SrcRegSub1);
+
+ BuildMI(MBB, MII, DL, get(OpcodeAdd), MidReg3)
+ .addReg(IsCtlz ? MidReg1 : MidReg2)
+ .addImm(32)
+ .addImm(1); // enable clamp
+
+ BuildMI(MBB, MII, DL, get(AMDGPU::V_MIN_U32_e64), MidReg4)
+ .addReg(MidReg3)
+ .addReg(IsCtlz ? MidReg2 : MidReg1);
+
+ MRI.replaceRegWith(Dest.getReg(), MidReg4);
+
+ addUsersToMoveToVALUWorklist(MidReg4, MRI, Worklist);
+}
+
void SIInstrInfo::addUsersToMoveToVALUWorklist(
Register DstReg, MachineRegisterInfo &MRI,
SIInstrWorklist &Worklist) const {
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.h
index affe52046752..46eee6fae0a5 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.h
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.h
@@ -144,6 +144,9 @@ private:
void splitScalar64BitBCNT(SIInstrWorklist &Worklist,
MachineInstr &Inst) const;
void splitScalar64BitBFE(SIInstrWorklist &Worklist, MachineInstr &Inst) const;
+ void splitScalar64BitCountOp(SIInstrWorklist &Worklist, MachineInstr &Inst,
+ unsigned Opcode,
+ MachineDominatorTree *MDT = nullptr) const;
void movePackToVALU(SIInstrWorklist &Worklist, MachineRegisterInfo &MRI,
MachineInstr &Inst) const;
diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.cpp
index a3a71a8ec09a..eeb7f64aa581 100644
--- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.cpp
@@ -1645,9 +1645,6 @@ void ARMFrameLowering::emitPopInst(MachineBasicBlock &MBB,
// Fold the return instruction into the LDM.
DeleteRet = true;
LdmOpc = AFI->isThumbFunction() ? ARM::t2LDMIA_RET : ARM::LDMIA_RET;
- // We 'restore' LR into PC so it is not live out of the return block:
- // Clear Restored bit.
- Info.setRestored(false);
}
// If NoGap is true, pop consecutive registers and then leave the rest
@@ -2695,8 +2692,7 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
const Align TargetAlign = getStackAlign();
if (TargetAlign >= Align(8) && (NumGPRSpills & 1)) {
if (CS1Spilled && !UnspilledCS1GPRs.empty()) {
- for (unsigned i = 0, e = UnspilledCS1GPRs.size(); i != e; ++i) {
- unsigned Reg = UnspilledCS1GPRs[i];
+ for (unsigned Reg : UnspilledCS1GPRs) {
// Don't spill high register if the function is thumb. In the case of
// Windows on ARM, accept R11 (frame pointer)
if (!AFI->isThumbFunction() ||
@@ -2785,6 +2781,33 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
AFI->setLRIsSpilled(SavedRegs.test(ARM::LR));
}
+void ARMFrameLowering::processFunctionBeforeFrameFinalized(
+ MachineFunction &MF, RegScavenger *RS) const {
+ TargetFrameLowering::processFunctionBeforeFrameFinalized(MF, RS);
+
+ MachineFrameInfo &MFI = MF.getFrameInfo();
+ if (!MFI.isCalleeSavedInfoValid())
+ return;
+
+ // Check if all terminators do not implicitly use LR. Then we can 'restore' LR
+ // into PC so it is not live out of the return block: Clear the Restored bit
+ // in that case.
+ for (CalleeSavedInfo &Info : MFI.getCalleeSavedInfo()) {
+ if (Info.getReg() != ARM::LR)
+ continue;
+ if (all_of(MF, [](const MachineBasicBlock &MBB) {
+ return all_of(MBB.terminators(), [](const MachineInstr &Term) {
+ return !Term.isReturn() || Term.getOpcode() == ARM::LDMIA_RET ||
+ Term.getOpcode() == ARM::t2LDMIA_RET ||
+ Term.getOpcode() == ARM::tPOP_RET;
+ });
+ })) {
+ Info.setRestored(false);
+ break;
+ }
+ }
+}
+
void ARMFrameLowering::getCalleeSaves(const MachineFunction &MF,
BitVector &SavedRegs) const {
TargetFrameLowering::getCalleeSaves(MF, SavedRegs);
diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.h b/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.h
index 16f2ce6bea6f..8d2b8beb9a58 100644
--- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.h
+++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.h
@@ -59,6 +59,9 @@ public:
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
RegScavenger *RS) const override;
+ void processFunctionBeforeFrameFinalized(
+ MachineFunction &MF, RegScavenger *RS = nullptr) const override;
+
void adjustForSegmentedStacks(MachineFunction &MF,
MachineBasicBlock &MBB) const override;
diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp
index db63facca870..d00b7853816e 100644
--- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -1415,6 +1415,9 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::GET_FPENV, MVT::i32, Legal);
setOperationAction(ISD::SET_FPENV, MVT::i32, Legal);
setOperationAction(ISD::RESET_FPENV, MVT::Other, Legal);
+ setOperationAction(ISD::GET_FPMODE, MVT::i32, Legal);
+ setOperationAction(ISD::SET_FPMODE, MVT::i32, Custom);
+ setOperationAction(ISD::RESET_FPMODE, MVT::Other, Custom);
}
// We want to custom lower some of our intrinsics.
@@ -6447,6 +6450,57 @@ SDValue ARMTargetLowering::LowerSET_ROUNDING(SDValue Op,
return DAG.getNode(ISD::INTRINSIC_VOID, DL, MVT::Other, Ops2);
}
+SDValue ARMTargetLowering::LowerSET_FPMODE(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ SDValue Chain = Op->getOperand(0);
+ SDValue Mode = Op->getOperand(1);
+
+ // Generate nodes to build:
+ // FPSCR = (FPSCR & FPStatusBits) | (Mode & ~FPStatusBits)
+ SDValue Ops[] = {Chain,
+ DAG.getConstant(Intrinsic::arm_get_fpscr, DL, MVT::i32)};
+ SDValue FPSCR =
+ DAG.getNode(ISD::INTRINSIC_W_CHAIN, DL, {MVT::i32, MVT::Other}, Ops);
+ Chain = FPSCR.getValue(1);
+ FPSCR = FPSCR.getValue(0);
+
+ SDValue FPSCRMasked =
+ DAG.getNode(ISD::AND, DL, MVT::i32, FPSCR,
+ DAG.getConstant(ARM::FPStatusBits, DL, MVT::i32));
+ SDValue InputMasked =
+ DAG.getNode(ISD::AND, DL, MVT::i32, Mode,
+ DAG.getConstant(~ARM::FPStatusBits, DL, MVT::i32));
+ FPSCR = DAG.getNode(ISD::OR, DL, MVT::i32, FPSCRMasked, InputMasked);
+
+ SDValue Ops2[] = {
+ Chain, DAG.getConstant(Intrinsic::arm_set_fpscr, DL, MVT::i32), FPSCR};
+ return DAG.getNode(ISD::INTRINSIC_VOID, DL, MVT::Other, Ops2);
+}
+
+SDValue ARMTargetLowering::LowerRESET_FPMODE(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ SDValue Chain = Op->getOperand(0);
+
+ // To get the default FP mode all control bits are cleared:
+ // FPSCR = FPSCR & (FPStatusBits | FPReservedBits)
+ SDValue Ops[] = {Chain,
+ DAG.getConstant(Intrinsic::arm_get_fpscr, DL, MVT::i32)};
+ SDValue FPSCR =
+ DAG.getNode(ISD::INTRINSIC_W_CHAIN, DL, {MVT::i32, MVT::Other}, Ops);
+ Chain = FPSCR.getValue(1);
+ FPSCR = FPSCR.getValue(0);
+
+ SDValue FPSCRMasked = DAG.getNode(
+ ISD::AND, DL, MVT::i32, FPSCR,
+ DAG.getConstant(ARM::FPStatusBits | ARM::FPReservedBits, DL, MVT::i32));
+ SDValue Ops2[] = {Chain,
+ DAG.getConstant(Intrinsic::arm_set_fpscr, DL, MVT::i32),
+ FPSCRMasked};
+ return DAG.getNode(ISD::INTRINSIC_VOID, DL, MVT::Other, Ops2);
+}
+
static SDValue LowerCTTZ(SDNode *N, SelectionDAG &DAG,
const ARMSubtarget *ST) {
SDLoc dl(N);
@@ -10557,6 +10611,10 @@ SDValue ARMTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
case ISD::ZERO_EXTEND: return LowerVectorExtend(Op.getNode(), DAG, Subtarget);
case ISD::GET_ROUNDING: return LowerGET_ROUNDING(Op, DAG);
case ISD::SET_ROUNDING: return LowerSET_ROUNDING(Op, DAG);
+ case ISD::SET_FPMODE:
+ return LowerSET_FPMODE(Op, DAG);
+ case ISD::RESET_FPMODE:
+ return LowerRESET_FPMODE(Op, DAG);
case ISD::MUL: return LowerMUL(Op, DAG);
case ISD::SDIV:
if (Subtarget->isTargetWindows() && !Op.getValueType().isVector())
diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.h b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.h
index 6c2b92de7a1d..f398b01f4186 100644
--- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.h
+++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.h
@@ -375,6 +375,14 @@ class VectorType;
// Bit position of rounding mode bits in FPSCR.
const unsigned RoundingBitsPos = 22;
+
+ // Bits of floating-point status. These are NZCV flags, QC bit and cumulative
+ // FP exception bits.
+ const unsigned FPStatusBits = 0xf800009f;
+
+ // Some bits in the FPSCR are not yet defined. They must be preserved when
+ // modifying the contents.
+ const unsigned FPReservedBits = 0x00006060;
} // namespace ARM
/// Define some predicates that are used for node matching.
@@ -835,6 +843,8 @@ class VectorType;
SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerSET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
+ SDValue LowerSET_FPMODE(SDValue Op, SelectionDAG &DAG) const;
+ SDValue LowerRESET_FPMODE(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerConstantFP(SDValue Op, SelectionDAG &DAG,
const ARMSubtarget *ST) const;
SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMInstrVFP.td b/contrib/llvm-project/llvm/lib/Target/ARM/ARMInstrVFP.td
index 800527bcf756..55d3efbd9b9a 100644
--- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMInstrVFP.td
+++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMInstrVFP.td
@@ -2675,6 +2675,7 @@ def : Pat<(get_fpenv), (VMRS)>;
def : Pat<(set_fpenv GPRnopc:$Rt), (VMSR GPRnopc:$Rt)>;
def : Pat<(reset_fpenv), (VMSR (MOVi 0))>, Requires<[IsARM]>;
def : Pat<(reset_fpenv), (VMSR (tMOVi8 0))>, Requires<[IsThumb]>;
+def : Pat<(get_fpmode), (VMRS)>;
//===----------------------------------------------------------------------===//
// Assembler aliases.
diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
index a679699a66c7..ed9d30c3c3ab 100644
--- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
@@ -2604,16 +2604,14 @@ ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) {
}
// Re-schedule loads.
- for (unsigned i = 0, e = LdBases.size(); i != e; ++i) {
- unsigned Base = LdBases[i];
+ for (unsigned Base : LdBases) {
SmallVectorImpl<MachineInstr *> &Lds = Base2LdsMap[Base];
if (Lds.size() > 1)
RetVal |= RescheduleOps(MBB, Lds, Base, true, MI2LocMap, RegisterMap);
}
// Re-schedule stores.
- for (unsigned i = 0, e = StBases.size(); i != e; ++i) {
- unsigned Base = StBases[i];
+ for (unsigned Base : StBases) {
SmallVectorImpl<MachineInstr *> &Sts = Base2StsMap[Base];
if (Sts.size() > 1)
RetVal |= RescheduleOps(MBB, Sts, Base, false, MI2LocMap, RegisterMap);
diff --git a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp
index d3ff12a1f7b3..621852f2453f 100644
--- a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp
@@ -63,57 +63,56 @@ ResourceBase::ResourceBase(uint32_t I, FrontendResource R)
RangeSize = ArrTy->getNumElements();
}
-StringRef ResourceBase::getComponentTypeName(ComponentType CompType) {
- switch (CompType) {
- case ComponentType::LastEntry:
- case ComponentType::Invalid:
+StringRef ResourceBase::getElementTypeName(ElementType ElTy) {
+ switch (ElTy) {
+ case ElementType::Invalid:
return "invalid";
- case ComponentType::I1:
+ case ElementType::I1:
return "i1";
- case ComponentType::I16:
+ case ElementType::I16:
return "i16";
- case ComponentType::U16:
+ case ElementType::U16:
return "u16";
- case ComponentType::I32:
+ case ElementType::I32:
return "i32";
- case ComponentType::U32:
+ case ElementType::U32:
return "u32";
- case ComponentType::I64:
+ case ElementType::I64:
return "i64";
- case ComponentType::U64:
+ case ElementType::U64:
return "u64";
- case ComponentType::F16:
+ case ElementType::F16:
return "f16";
- case ComponentType::F32:
+ case ElementType::F32:
return "f32";
- case ComponentType::F64:
+ case ElementType::F64:
return "f64";
- case ComponentType::SNormF16:
+ case ElementType::SNormF16:
return "snorm_f16";
- case ComponentType::UNormF16:
+ case ElementType::UNormF16:
return "unorm_f16";
- case ComponentType::SNormF32:
+ case ElementType::SNormF32:
return "snorm_f32";
- case ComponentType::UNormF32:
+ case ElementType::UNormF32:
return "unorm_f32";
- case ComponentType::SNormF64:
+ case ElementType::SNormF64:
return "snorm_f64";
- case ComponentType::UNormF64:
+ case ElementType::UNormF64:
return "unorm_f64";
- case ComponentType::PackedS8x32:
+ case ElementType::PackedS8x32:
return "p32i8";
- case ComponentType::PackedU8x32:
+ case ElementType::PackedU8x32:
return "p32u8";
}
- llvm_unreachable("All ComponentType enums are handled in switch");
+ llvm_unreachable("All ElementType enums are handled in switch");
}
-void ResourceBase::printComponentType(Kinds Kind, ComponentType CompType,
- unsigned Alignment, raw_ostream &OS) {
+void ResourceBase::printElementType(Kinds Kind, ElementType ElTy,
+ unsigned Alignment, raw_ostream &OS) {
switch (Kind) {
default:
// TODO: add vector size.
- OS << right_justify(getComponentTypeName(CompType), Alignment);
+ OS << right_justify(getElementTypeName(ElTy), Alignment);
break;
case Kinds::RawBuffer:
OS << right_justify("byte", Alignment);
@@ -232,19 +231,13 @@ void ResourceBase::print(raw_ostream &OS, StringRef IDPrefix,
OS << right_justify("unbounded", 6) << "\n";
}
-UAVResource::UAVResource(uint32_t I, FrontendResource R)
- : ResourceBase(I, R), Shape(R.getResourceKind()), GloballyCoherent(false),
- HasCounter(false), IsROV(R.getIsROV()), ExtProps() {
- parseSourceType(R.getSourceType());
-}
-
void UAVResource::print(raw_ostream &OS) const {
OS << "; " << left_justify(Name, 31);
OS << right_justify("UAV", 10);
- printComponentType(
- Shape, ExtProps.ElementType.value_or(ComponentType::Invalid), 8, OS);
+ printElementType(Shape, ExtProps.ElementType.value_or(ElementType::Invalid),
+ 8, OS);
// FIXME: support SampleCount.
// See https://github.com/llvm/llvm-project/issues/58175
@@ -253,35 +246,6 @@ void UAVResource::print(raw_ostream &OS) const {
ResourceBase::print(OS, "U", "u");
}
-// FIXME: Capture this in HLSL source. I would go do this right now, but I want
-// to get this in first so that I can make sure to capture all the extra
-// information we need to remove the source type string from here (See issue:
-// https://github.com/llvm/llvm-project/issues/57991).
-void UAVResource::parseSourceType(StringRef S) {
- S = S.substr(S.find("<") + 1);
-
- constexpr size_t PrefixLen = StringRef("vector<").size();
- if (S.starts_with("vector<"))
- S = S.substr(PrefixLen, S.find(",") - PrefixLen);
- else
- S = S.substr(0, S.find(">"));
-
- ComponentType ElTy = StringSwitch<ResourceBase::ComponentType>(S)
- .Case("bool", ComponentType::I1)
- .Case("int16_t", ComponentType::I16)
- .Case("uint16_t", ComponentType::U16)
- .Case("int32_t", ComponentType::I32)
- .Case("uint32_t", ComponentType::U32)
- .Case("int64_t", ComponentType::I64)
- .Case("uint64_t", ComponentType::U64)
- .Case("half", ComponentType::F16)
- .Case("float", ComponentType::F32)
- .Case("double", ComponentType::F64)
- .Default(ComponentType::Invalid);
- if (ElTy != ComponentType::Invalid)
- ExtProps.ElementType = ElTy;
-}
-
ConstantBuffer::ConstantBuffer(uint32_t I, hlsl::FrontendResource R)
: ResourceBase(I, R) {}
@@ -294,7 +258,7 @@ void ConstantBuffer::print(raw_ostream &OS) const {
OS << right_justify("cbuffer", 10);
- printComponentType(Kinds::CBuffer, ComponentType::Invalid, 8, OS);
+ printElementType(Kinds::CBuffer, ElementType::Invalid, 8, OS);
printKind(Kinds::CBuffer, 12, OS, /*SRV*/ false, /*HasCounter*/ false);
// Print the binding part.
diff --git a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.h b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.h
index cb39020bc61e..5f8b0badd145 100644
--- a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.h
+++ b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.h
@@ -46,38 +46,13 @@ protected:
bool SRV = false, bool HasCounter = false,
uint32_t SampleCount = 0);
- // The value ordering of this enumeration is part of the DXIL ABI. Elements
- // can only be added to the end, and not removed.
- enum class ComponentType : uint32_t {
- Invalid = 0,
- I1,
- I16,
- U16,
- I32,
- U32,
- I64,
- U64,
- F16,
- F32,
- F64,
- SNormF16,
- UNormF16,
- SNormF32,
- UNormF32,
- SNormF64,
- UNormF64,
- PackedS8x32,
- PackedU8x32,
- LastEntry
- };
-
- static StringRef getComponentTypeName(ComponentType CompType);
- static void printComponentType(Kinds Kind, ComponentType CompType,
- unsigned Alignment, raw_ostream &OS);
+ static StringRef getElementTypeName(hlsl::ElementType CompType);
+ static void printElementType(Kinds Kind, hlsl::ElementType CompType,
+ unsigned Alignment, raw_ostream &OS);
public:
struct ExtendedProperties {
- std::optional<ComponentType> ElementType;
+ std::optional<hlsl::ElementType> ElementType;
// The value ordering of this enumeration is part of the DXIL ABI. Elements
// can only be added to the end, and not removed.
@@ -102,7 +77,9 @@ class UAVResource : public ResourceBase {
void parseSourceType(StringRef S);
public:
- UAVResource(uint32_t I, hlsl::FrontendResource R);
+ UAVResource(uint32_t I, hlsl::FrontendResource R)
+ : ResourceBase(I, R), Shape(R.getResourceKind()), GloballyCoherent(false),
+ HasCounter(false), IsROV(R.getIsROV()), ExtProps{R.getElementType()} {}
MDNode *write() const;
void print(raw_ostream &O) const;
diff --git a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
index e2d0aeee092e..ebb269c6e6e0 100644
--- a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
@@ -937,8 +937,7 @@ void DXILBitcodeWriter::writeAttributeTable() {
Stream.EnterSubblock(bitc::PARAMATTR_BLOCK_ID, 3);
SmallVector<uint64_t, 64> Record;
- for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
- AttributeList AL = Attrs[i];
+ for (AttributeList AL : Attrs) {
for (unsigned i : AL.indexes()) {
AttributeSet AS = AL.getAttributes(i);
if (AS.hasAttributes())
diff --git a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
index 47fbf0a69518..dae316ccb5e9 100644
--- a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
@@ -2860,8 +2860,7 @@ bool HexagonConstEvaluator::rewriteHexConstDefs(MachineInstr &MI,
// For each defined register, if it is a constant, create an instruction
// NewR = const
// and replace all uses of the defined register with NewR.
- for (unsigned i = 0, n = DefRegs.size(); i < n; ++i) {
- unsigned R = DefRegs[i];
+ for (unsigned R : DefRegs) {
const LatticeCell &L = Inputs.get(R);
if (L.isBottom())
continue;
diff --git a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
index efb0d405fef2..e08566718d7c 100644
--- a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
@@ -1337,8 +1337,7 @@ OpRef HvxSelector::packs(ShuffleMask SM, OpRef Va, OpRef Vb,
// segments that are used in the output.
unsigned Seg0 = ~0u, Seg1 = ~0u;
- for (int I = 0, E = SegMap.size(); I != E; ++I) {
- unsigned X = SegMap[I];
+ for (unsigned X : SegMap) {
if (X == ~0u)
continue;
if (Seg0 == ~0u)
@@ -2037,8 +2036,7 @@ HvxSelector::completeToPerfect(ArrayRef<uint32_t> Completions, unsigned Width) {
#ifndef NDEBUG
// Check that we have generated a valid completion.
uint32_t OrAll = 0;
- for (unsigned I = 0, E = Comps.size(); I != E; ++I) {
- uint32_t C = Comps[I];
+ for (uint32_t C : Comps) {
assert(isPowerOf2_32(C));
OrAll |= C;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
index 51ef72b873a5..7777ae23e8ae 100644
--- a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
@@ -1062,7 +1062,7 @@ void PolynomialMultiplyRecognize::promoteTo(Instruction *In,
// Promote immediates.
for (unsigned i = 0, n = In->getNumOperands(); i != n; ++i) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(In->getOperand(i)))
- if (CI->getType()->getBitWidth() < DestBW)
+ if (CI->getBitWidth() < DestBW)
In->setOperand(i, ConstantInt::get(DestTy, CI->getZExtValue()));
}
}
@@ -1577,7 +1577,7 @@ Value *PolynomialMultiplyRecognize::generate(BasicBlock::iterator At,
static bool hasZeroSignBit(const Value *V) {
if (const auto *CI = dyn_cast<const ConstantInt>(V))
- return (CI->getType()->getSignBit() & CI->getSExtValue()) == 0;
+ return CI->getValue().isNonNegative();
const Instruction *I = dyn_cast<const Instruction>(V);
if (!I)
return false;
@@ -1688,7 +1688,7 @@ void PolynomialMultiplyRecognize::setupPreSimplifier(Simplifier &S) {
if (I->getOpcode() != Instruction::Or)
return nullptr;
ConstantInt *Msb = dyn_cast<ConstantInt>(I->getOperand(1));
- if (!Msb || Msb->getZExtValue() != Msb->getType()->getSignBit())
+ if (!Msb || !Msb->getValue().isSignMask())
return nullptr;
if (!hasZeroSignBit(I->getOperand(0)))
return nullptr;
diff --git a/contrib/llvm-project/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp b/contrib/llvm-project/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
index fffd5abd9f8b..0740ac58a338 100644
--- a/contrib/llvm-project/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
@@ -554,7 +554,7 @@ MCSubtargetInfo *Hexagon_MC::createHexagonMCSubtargetInfo(const Triple &TT,
// Add qfloat subtarget feature by default to v68 and above
// unless explicitely disabled
if (checkFeature(X, Hexagon::ExtensionHVXV68) &&
- ArchFS.find("-hvx-qfloat", 0) == std::string::npos) {
+ !ArchFS.contains("-hvx-qfloat")) {
llvm::FeatureBitset Features = X->getFeatureBits();
X->setFeatureBits(Features.set(Hexagon::ExtensionHVXQFloat));
}
diff --git a/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp b/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
index 14bcef7c7d26..6d8ef1bf96cb 100644
--- a/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
@@ -177,6 +177,34 @@ bool LoongArchAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
}
}
+static inline std::pair<MCFixupKind, MCFixupKind>
+getRelocPairForSize(unsigned Size) {
+ switch (Size) {
+ default:
+ llvm_unreachable("unsupported fixup size");
+ case 6:
+ return std::make_pair(
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_ADD6),
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_SUB6));
+ case 8:
+ return std::make_pair(
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_ADD8),
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_SUB8));
+ case 16:
+ return std::make_pair(
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_ADD16),
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_SUB16));
+ case 32:
+ return std::make_pair(
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_ADD32),
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_SUB32));
+ case 64:
+ return std::make_pair(
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_ADD64),
+ MCFixupKind(FirstLiteralRelocationKind + ELF::R_LARCH_SUB64));
+ }
+}
+
bool LoongArchAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const {
// We mostly follow binutils' convention here: align to 4-byte boundary with a
@@ -191,6 +219,56 @@ bool LoongArchAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
return true;
}
+bool LoongArchAsmBackend::handleAddSubRelocations(const MCAsmLayout &Layout,
+ const MCFragment &F,
+ const MCFixup &Fixup,
+ const MCValue &Target,
+ uint64_t &FixedValue) const {
+ std::pair<MCFixupKind, MCFixupKind> FK;
+ uint64_t FixedValueA, FixedValueB;
+ const MCSection &SecA = Target.getSymA()->getSymbol().getSection();
+ const MCSection &SecB = Target.getSymB()->getSymbol().getSection();
+
+ // We need record relocation if SecA != SecB. Usually SecB is same as the
+ // section of Fixup, which will be record the relocation as PCRel. If SecB
+ // is not same as the section of Fixup, it will report error. Just return
+ // false and then this work can be finished by handleFixup.
+ if (&SecA != &SecB)
+ return false;
+
+ // In SecA == SecB case. If the linker relaxation is enabled, we need record
+ // the ADD, SUB relocations. Otherwise the FixedValue has already been
+ // calculated out in evaluateFixup, return true and avoid record relocations.
+ if (!STI.hasFeature(LoongArch::FeatureRelax))
+ return true;
+
+ switch (Fixup.getKind()) {
+ case llvm::FK_Data_1:
+ FK = getRelocPairForSize(8);
+ break;
+ case llvm::FK_Data_2:
+ FK = getRelocPairForSize(16);
+ break;
+ case llvm::FK_Data_4:
+ FK = getRelocPairForSize(32);
+ break;
+ case llvm::FK_Data_8:
+ FK = getRelocPairForSize(64);
+ break;
+ default:
+ llvm_unreachable("unsupported fixup size");
+ }
+ MCValue A = MCValue::get(Target.getSymA(), nullptr, Target.getConstant());
+ MCValue B = MCValue::get(Target.getSymB());
+ auto FA = MCFixup::create(Fixup.getOffset(), nullptr, std::get<0>(FK));
+ auto FB = MCFixup::create(Fixup.getOffset(), nullptr, std::get<1>(FK));
+ auto &Asm = Layout.getAssembler();
+ Asm.getWriter().recordRelocation(Asm, Layout, &F, FA, A, FixedValueA);
+ Asm.getWriter().recordRelocation(Asm, Layout, &F, FB, B, FixedValueB);
+ FixedValue = FixedValueA - FixedValueB;
+ return true;
+}
+
std::unique_ptr<MCObjectTargetWriter>
LoongArchAsmBackend::createObjectTargetWriter() const {
return createLoongArchELFObjectWriter(
diff --git a/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h b/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
index d1fbf788e8a8..fef0e84600a7 100644
--- a/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
+++ b/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
@@ -31,10 +31,15 @@ class LoongArchAsmBackend : public MCAsmBackend {
public:
LoongArchAsmBackend(const MCSubtargetInfo &STI, uint8_t OSABI, bool Is64Bit,
const MCTargetOptions &Options)
- : MCAsmBackend(llvm::endianness::little), STI(STI), OSABI(OSABI),
- Is64Bit(Is64Bit), TargetOptions(Options) {}
+ : MCAsmBackend(llvm::endianness::little,
+ LoongArch::fixup_loongarch_relax),
+ STI(STI), OSABI(OSABI), Is64Bit(Is64Bit), TargetOptions(Options) {}
~LoongArchAsmBackend() override {}
+ bool handleAddSubRelocations(const MCAsmLayout &Layout, const MCFragment &F,
+ const MCFixup &Fixup, const MCValue &Target,
+ uint64_t &FixedValue) const override;
+
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, MutableArrayRef<char> Data,
uint64_t Value, bool IsResolved,
diff --git a/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h b/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h
index ba2d6718cdf9..178fa6e5262b 100644
--- a/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h
+++ b/contrib/llvm-project/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h
@@ -106,7 +106,9 @@ enum Fixups {
// 20-bit fixup corresponding to %gd_pc_hi20(foo) for instruction pcalau12i.
fixup_loongarch_tls_gd_pc_hi20,
// 20-bit fixup corresponding to %gd_hi20(foo) for instruction lu12i.w.
- fixup_loongarch_tls_gd_hi20
+ fixup_loongarch_tls_gd_hi20,
+ // Generate an R_LARCH_RELAX which indicates the linker may relax here.
+ fixup_loongarch_relax = FirstLiteralRelocationKind + ELF::R_LARCH_RELAX
};
} // end namespace LoongArch
} // end namespace llvm
diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 22c662a79d87..385b3b74c34d 100644
--- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -10986,7 +10986,6 @@ SDValue PPCTargetLowering::LowerINTRINSIC_VOID(SDValue Op,
switch (cast<ConstantSDNode>(Op.getOperand(ArgStart))->getZExtValue()) {
case Intrinsic::ppc_cfence: {
assert(ArgStart == 1 && "llvm.ppc.cfence must carry a chain argument.");
- assert(Subtarget.isPPC64() && "Only 64-bit is supported for now.");
SDValue Val = Op.getOperand(ArgStart + 1);
EVT Ty = Val.getValueType();
if (Ty == MVT::i128) {
@@ -10994,9 +10993,11 @@ SDValue PPCTargetLowering::LowerINTRINSIC_VOID(SDValue Op,
// ordering?
Val = DAG.getNode(ISD::TRUNCATE, DL, MVT::i64, Val);
}
+ unsigned Opcode = Subtarget.isPPC64() ? PPC::CFENCE8 : PPC::CFENCE;
+ EVT FTy = Subtarget.isPPC64() ? MVT::i64 : MVT::i32;
return SDValue(
- DAG.getMachineNode(PPC::CFENCE8, DL, MVT::Other,
- DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Val),
+ DAG.getMachineNode(Opcode, DL, MVT::Other,
+ DAG.getNode(ISD::ANY_EXTEND, DL, FTy, Val),
Op.getOperand(0)),
0);
}
@@ -11827,7 +11828,7 @@ Instruction *PPCTargetLowering::emitTrailingFence(IRBuilderBase &Builder,
// See http://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html and
// http://www.rdrop.com/users/paulmck/scalability/paper/N2745r.2011.03.04a.html
// and http://www.cl.cam.ac.uk/~pes20/cppppc/ for justification.
- if (isa<LoadInst>(Inst) && Subtarget.isPPC64())
+ if (isa<LoadInst>(Inst))
return Builder.CreateCall(
Intrinsic::getDeclaration(
Builder.GetInsertBlock()->getParent()->getParent(),
diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index d0a6cced1b19..aaced58defe6 100644
--- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -1067,9 +1067,7 @@ bool PPCInstrInfo::isReallyTriviallyReMaterializable(
const MachineInstr &MI) const {
switch (MI.getOpcode()) {
default:
- // This function should only be called for opcodes with the ReMaterializable
- // flag set.
- llvm_unreachable("Unknown rematerializable operation!");
+ // Let base implementaion decide.
break;
case PPC::LI:
case PPC::LI8:
@@ -3179,9 +3177,11 @@ bool PPCInstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
}
// FIXME: Maybe we can expand it in 'PowerPC Expand Atomic' pass.
+ case PPC::CFENCE:
case PPC::CFENCE8: {
auto Val = MI.getOperand(0).getReg();
- BuildMI(MBB, MI, DL, get(PPC::CMPD), PPC::CR7).addReg(Val).addReg(Val);
+ unsigned CmpOp = Subtarget.isPPC64() ? PPC::CMPD : PPC::CMPW;
+ BuildMI(MBB, MI, DL, get(CmpOp), PPC::CR7).addReg(Val).addReg(Val);
BuildMI(MBB, MI, DL, get(PPC::CTRL_DEP))
.addImm(PPC::PRED_NE_MINUS)
.addReg(PPC::CR7)
diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index 6199785206b2..b1601739fd45 100644
--- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -5260,6 +5260,9 @@ def HASHCHKP : XForm_XD6_RA5_RB5<31, 690, (outs),
"hashchkp $RB, $addr", IIC_IntGeneral, []>;
}
+let Defs = [CR7], Itinerary = IIC_LdStSync in
+def CFENCE : PPCPostRAExpPseudo<(outs), (ins gprc:$cr), "#CFENCE", []>;
+
// Now both high word and low word are reversed, next
// swap the high word and low word.
def : Pat<(i64 (bitreverse i64:$A)),
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index 8f03a7ac41d3..28ec999157c6 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -85,13 +85,12 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
// Merge/Unmerge
for (unsigned Op : {G_MERGE_VALUES, G_UNMERGE_VALUES}) {
+ auto &MergeUnmergeActions = getActionDefinitionsBuilder(Op);
unsigned BigTyIdx = Op == G_MERGE_VALUES ? 0 : 1;
unsigned LitTyIdx = Op == G_MERGE_VALUES ? 1 : 0;
- auto &MergeUnmergeActions = getActionDefinitionsBuilder(Op);
if (XLen == 32 && ST.hasStdExtD()) {
- LLT IdxZeroTy = G_MERGE_VALUES ? s64 : s32;
- LLT IdxOneTy = G_MERGE_VALUES ? s32 : s64;
- MergeUnmergeActions.legalFor({IdxZeroTy, IdxOneTy});
+ MergeUnmergeActions.legalIf(
+ all(typeIs(BigTyIdx, s64), typeIs(LitTyIdx, s32)));
}
MergeUnmergeActions.widenScalarToNextPow2(LitTyIdx, XLen)
.widenScalarToNextPow2(BigTyIdx, XLen)
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
index 00b4751905f6..30ed36525e29 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -113,6 +113,15 @@ enum {
UsesVXRMShift = HasRoundModeOpShift + 1,
UsesVXRMMask = 1 << UsesVXRMShift,
+
+ // Indicates whether these instructions can partially overlap between source
+ // registers and destination registers according to the vector spec.
+ // 0 -> not a vector pseudo
+ // 1 -> default value for vector pseudos. not widening or narrowing.
+ // 2 -> narrowing case
+ // 3 -> widening case
+ TargetOverlapConstraintTypeShift = UsesVXRMShift + 1,
+ TargetOverlapConstraintTypeMask = 3ULL << TargetOverlapConstraintTypeShift,
};
enum VLMUL : uint8_t {
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFeatures.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFeatures.td
index 294927aecb94..a66dd135ae5f 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFeatures.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFeatures.td
@@ -107,15 +107,15 @@ def HasStdExtZfhmin : Predicate<"Subtarget->hasStdExtZfhmin()">,
def FeatureStdExtZfh
: SubtargetFeature<"zfh", "HasStdExtZfh", "true",
"'Zfh' (Half-Precision Floating-Point)",
- [FeatureStdExtF]>;
+ [FeatureStdExtZfhmin]>;
def HasStdExtZfh : Predicate<"Subtarget->hasStdExtZfh()">,
AssemblerPredicate<(all_of FeatureStdExtZfh),
"'Zfh' (Half-Precision Floating-Point)">;
def NoStdExtZfh : Predicate<"!Subtarget->hasStdExtZfh()">;
def HasStdExtZfhOrZfhmin
- : Predicate<"Subtarget->hasStdExtZfhOrZfhmin()">,
- AssemblerPredicate<(any_of FeatureStdExtZfh, FeatureStdExtZfhmin),
+ : Predicate<"Subtarget->hasStdExtZfhmin()">,
+ AssemblerPredicate<(all_of FeatureStdExtZfhmin),
"'Zfh' (Half-Precision Floating-Point) or "
"'Zfhmin' (Half-Precision Floating-Point Minimal)">;
@@ -146,15 +146,15 @@ def HasStdExtZhinxmin : Predicate<"Subtarget->hasStdExtZhinxmin()">,
def FeatureStdExtZhinx
: SubtargetFeature<"zhinx", "HasStdExtZhinx", "true",
"'Zhinx' (Half Float in Integer)",
- [FeatureStdExtZfinx]>;
+ [FeatureStdExtZhinxmin]>;
def HasStdExtZhinx : Predicate<"Subtarget->hasStdExtZhinx()">,
AssemblerPredicate<(all_of FeatureStdExtZhinx),
"'Zhinx' (Half Float in Integer)">;
def NoStdExtZhinx : Predicate<"!Subtarget->hasStdExtZhinx()">;
def HasStdExtZhinxOrZhinxmin
- : Predicate<"Subtarget->hasStdExtZhinx() || Subtarget->hasStdExtZhinxmin()">,
- AssemblerPredicate<(any_of FeatureStdExtZhinx, FeatureStdExtZhinxmin),
+ : Predicate<"Subtarget->hasStdExtZhinxmin()">,
+ AssemblerPredicate<(all_of FeatureStdExtZhinxmin),
"'Zhinx' (Half Float in Integer) or "
"'Zhinxmin' (Half Float in Integer Minimal)">;
@@ -472,7 +472,7 @@ def HasStdExtZfbfmin : Predicate<"Subtarget->hasStdExtZfbfmin()">,
def FeatureStdExtZvfbfmin
: SubtargetFeature<"experimental-zvfbfmin", "HasStdExtZvfbfmin", "true",
"'Zvbfmin' (Vector BF16 Converts)",
- [FeatureStdExtZve32f, FeatureStdExtZfbfmin]>;
+ [FeatureStdExtZve32f]>;
def HasStdExtZvfbfmin : Predicate<"Subtarget->hasStdExtZvfbfmin()">,
AssemblerPredicate<(all_of FeatureStdExtZvfbfmin),
"'Zvfbfmin' (Vector BF16 Converts)">;
@@ -480,23 +480,23 @@ def HasStdExtZvfbfmin : Predicate<"Subtarget->hasStdExtZvfbfmin()">,
def FeatureStdExtZvfbfwma
: SubtargetFeature<"experimental-zvfbfwma", "HasStdExtZvfbfwma", "true",
"'Zvfbfwma' (Vector BF16 widening mul-add)",
- [FeatureStdExtZvfbfmin]>;
+ [FeatureStdExtZvfbfmin, FeatureStdExtZfbfmin]>;
def HasStdExtZvfbfwma : Predicate<"Subtarget->hasStdExtZvfbfwma()">,
AssemblerPredicate<(all_of FeatureStdExtZvfbfwma),
"'Zvfbfwma' (Vector BF16 widening mul-add)">;
def HasVInstructionsBF16 : Predicate<"Subtarget->hasVInstructionsBF16()">;
-def FeatureStdExtZvfh
- : SubtargetFeature<"zvfh", "HasStdExtZvfh", "true",
- "'Zvfh' (Vector Half-Precision Floating-Point)",
- [FeatureStdExtZve32f, FeatureStdExtZfhmin]>;
-
def FeatureStdExtZvfhmin
: SubtargetFeature<"zvfhmin", "HasStdExtZvfhmin", "true",
"'Zvfhmin' (Vector Half-Precision Floating-Point Minimal)",
[FeatureStdExtZve32f]>;
+def FeatureStdExtZvfh
+ : SubtargetFeature<"zvfh", "HasStdExtZvfh", "true",
+ "'Zvfh' (Vector Half-Precision Floating-Point)",
+ [FeatureStdExtZvfhmin, FeatureStdExtZfhmin]>;
+
def HasVInstructionsF16 : Predicate<"Subtarget->hasVInstructionsF16()">;
def HasVInstructionsF16Minimal : Predicate<"Subtarget->hasVInstructionsF16Minimal()">,
@@ -561,14 +561,14 @@ def HasStdExtZawrs : Predicate<"Subtarget->hasStdExtZawrs()">,
"'Zawrs' (Wait on Reservation Set)">;
def FeatureStdExtZvkb
- : SubtargetFeature<"experimental-zvkb", "HasStdExtZvkb", "true",
+ : SubtargetFeature<"zvkb", "HasStdExtZvkb", "true",
"'Zvkb' (Vector Bit-manipulation used in Cryptography)">;
def HasStdExtZvkb : Predicate<"Subtarget->hasStdExtZvkb()">,
AssemblerPredicate<(all_of FeatureStdExtZvkb),
"'Zvkb' (Vector Bit-manipulation used in Cryptography)">;
def FeatureStdExtZvbb
- : SubtargetFeature<"experimental-zvbb", "HasStdExtZvbb", "true",
+ : SubtargetFeature<"zvbb", "HasStdExtZvbb", "true",
"'Zvbb' (Vector basic bit-manipulation instructions.)",
[FeatureStdExtZvkb]>;
def HasStdExtZvbb : Predicate<"Subtarget->hasStdExtZvbb()">,
@@ -576,35 +576,35 @@ def HasStdExtZvbb : Predicate<"Subtarget->hasStdExtZvbb()">,
"'Zvbb' (Vector basic bit-manipulation instructions.)">;
def FeatureStdExtZvbc
- : SubtargetFeature<"experimental-zvbc", "HasStdExtZvbc", "true",
+ : SubtargetFeature<"zvbc", "HasStdExtZvbc", "true",
"'Zvbc' (Vector Carryless Multiplication)">;
def HasStdExtZvbc : Predicate<"Subtarget->hasStdExtZvbc()">,
AssemblerPredicate<(all_of FeatureStdExtZvbc),
"'Zvbc' (Vector Carryless Multiplication)">;
def FeatureStdExtZvkg
- : SubtargetFeature<"experimental-zvkg", "HasStdExtZvkg", "true",
+ : SubtargetFeature<"zvkg", "HasStdExtZvkg", "true",
"'Zvkg' (Vector GCM instructions for Cryptography)">;
def HasStdExtZvkg : Predicate<"Subtarget->hasStdExtZvkg()">,
AssemblerPredicate<(all_of FeatureStdExtZvkg),
"'Zvkg' (Vector GCM instructions for Cryptography)">;
def FeatureStdExtZvkned
- : SubtargetFeature<"experimental-zvkned", "HasStdExtZvkned", "true",
+ : SubtargetFeature<"zvkned", "HasStdExtZvkned", "true",
"'Zvkned' (Vector AES Encryption & Decryption (Single Round))">;
def HasStdExtZvkned : Predicate<"Subtarget->hasStdExtZvkned()">,
AssemblerPredicate<(all_of FeatureStdExtZvkned),
"'Zvkned' (Vector AES Encryption & Decryption (Single Round))">;
def FeatureStdExtZvknha
- : SubtargetFeature<"experimental-zvknha", "HasStdExtZvknha", "true",
+ : SubtargetFeature<"zvknha", "HasStdExtZvknha", "true",
"'Zvknha' (Vector SHA-2 (SHA-256 only))">;
def HasStdExtZvknha : Predicate<"Subtarget->hasStdExtZvknha()">,
AssemblerPredicate<(all_of FeatureStdExtZvknha),
"'Zvknha' (Vector SHA-2 (SHA-256 only))">;
def FeatureStdExtZvknhb
- : SubtargetFeature<"experimental-zvknhb", "HasStdExtZvknhb", "true",
+ : SubtargetFeature<"zvknhb", "HasStdExtZvknhb", "true",
"'Zvknhb' (Vector SHA-2 (SHA-256 and SHA-512))",
[FeatureStdExtZve64x]>;
def HasStdExtZvknhb : Predicate<"Subtarget->hasStdExtZvknhb()">,
@@ -616,59 +616,59 @@ def HasStdExtZvknhaOrZvknhb : Predicate<"Subtarget->hasStdExtZvknha() || Subtarg
"'Zvknha' or 'Zvknhb' (Vector SHA-2)">;
def FeatureStdExtZvksed
- : SubtargetFeature<"experimental-zvksed", "HasStdExtZvksed", "true",
+ : SubtargetFeature<"zvksed", "HasStdExtZvksed", "true",
"'Zvksed' (SM4 Block Cipher Instructions)">;
def HasStdExtZvksed : Predicate<"Subtarget->hasStdExtZvksed()">,
AssemblerPredicate<(all_of FeatureStdExtZvksed),
"'Zvksed' (SM4 Block Cipher Instructions)">;
def FeatureStdExtZvksh
- : SubtargetFeature<"experimental-zvksh", "HasStdExtZvksh", "true",
+ : SubtargetFeature<"zvksh", "HasStdExtZvksh", "true",
"'Zvksh' (SM3 Hash Function Instructions)">;
def HasStdExtZvksh : Predicate<"Subtarget->hasStdExtZvksh()">,
AssemblerPredicate<(all_of FeatureStdExtZvksh),
"'Zvksh' (SM3 Hash Function Instructions)">;
def FeatureStdExtZvkt
- : SubtargetFeature<"experimental-zvkt", "HasStdExtZvkt", "true",
+ : SubtargetFeature<"zvkt", "HasStdExtZvkt", "true",
"'Zvkt' (Vector Data-Independent Execution Latency)">;
// Zvk short-hand extensions
def FeatureStdExtZvkn
- : SubtargetFeature<"experimental-zvkn", "HasStdExtZvkn", "true",
+ : SubtargetFeature<"zvkn", "HasStdExtZvkn", "true",
"This extension is shorthand for the following set of "
"other extensions: Zvkned, Zvknhb, Zvkb and Zvkt.",
[FeatureStdExtZvkned, FeatureStdExtZvknhb,
FeatureStdExtZvkb, FeatureStdExtZvkt]>;
def FeatureStdExtZvknc
- : SubtargetFeature<"experimental-zvknc", "HasStdExtZvknc", "true",
+ : SubtargetFeature<"zvknc", "HasStdExtZvknc", "true",
"This extension is shorthand for the following set of "
"other extensions: Zvkn and Zvbc.",
[FeatureStdExtZvkn, FeatureStdExtZvbc]>;
def FeatureStdExtZvkng
- : SubtargetFeature<"experimental-zvkng", "HasStdExtZvkng", "true",
+ : SubtargetFeature<"zvkng", "HasStdExtZvkng", "true",
"This extension is shorthand for the following set of "
"other extensions: Zvkn and Zvkg.",
[FeatureStdExtZvkn, FeatureStdExtZvkg]>;
def FeatureStdExtZvks
- : SubtargetFeature<"experimental-zvks", "HasStdExtZvks", "true",
+ : SubtargetFeature<"zvks", "HasStdExtZvks", "true",
"This extension is shorthand for the following set of "
"other extensions: Zvksed, Zvksh, Zvkb and Zvkt.",
[FeatureStdExtZvksed, FeatureStdExtZvksh,
FeatureStdExtZvkb, FeatureStdExtZvkt]>;
def FeatureStdExtZvksc
- : SubtargetFeature<"experimental-zvksc", "HasStdExtZvksc", "true",
+ : SubtargetFeature<"zvksc", "HasStdExtZvksc", "true",
"This extension is shorthand for the following set of "
"other extensions: Zvks and Zvbc.",
[FeatureStdExtZvks, FeatureStdExtZvbc]>;
def FeatureStdExtZvksg
- : SubtargetFeature<"experimental-zvksg", "HasStdExtZvksg", "true",
+ : SubtargetFeature<"zvksg", "HasStdExtZvksg", "true",
"This extension is shorthand for the following set of "
"other extensions: Zvks and Zvkg.",
[FeatureStdExtZvks, FeatureStdExtZvkg]>;
@@ -959,6 +959,10 @@ def TuneNoOptimizedZeroStrideLoad
"false", "Hasn't optimized (perform fewer memory operations)"
"zero-stride vector load">;
+def Experimental
+ : SubtargetFeature<"experimental", "HasExperimental",
+ "true", "Experimental intrinsics">;
+
// Some vector hardware implementations do not process all VLEN bits in parallel
// and instead split over multiple cycles. DLEN refers to the datapath width
// that can be done in parallel.
@@ -973,9 +977,19 @@ def TuneLUIADDIFusion
def TuneAUIPCADDIFusion
: SubtargetFeature<"auipc-addi-fusion", "HasAUIPCADDIFusion",
"true", "Enable AUIPC+ADDI macrofusion">;
-def TuneShiftedZExtFusion
- : SubtargetFeature<"shifted-zext-fusion", "HasShiftedZExtFusion",
- "true", "Enable SLLI+SRLI to be fused when computing (shifted) zero extension">;
+
+def TuneZExtHFusion
+ : SubtargetFeature<"zexth-fusion", "HasZExtHFusion",
+ "true", "Enable SLLI+SRLI to be fused to zero extension of halfword">;
+
+def TuneZExtWFusion
+ : SubtargetFeature<"zextw-fusion", "HasZExtWFusion",
+ "true", "Enable SLLI+SRLI to be fused to zero extension of word">;
+
+def TuneShiftedZExtWFusion
+ : SubtargetFeature<"shifted-zextw-fusion", "HasShiftedZExtWFusion",
+ "true", "Enable SLLI+SRLI to be fused when computing (shifted) zero extension of word">;
+
def TuneLDADDFusion
: SubtargetFeature<"ld-add-fusion", "HasLDADDFusion",
"true", "Enable LD+ADD macrofusion.">;
@@ -997,12 +1011,8 @@ def TuneSiFive7 : SubtargetFeature<"sifive7", "RISCVProcFamily", "SiFive7",
[TuneNoDefaultUnroll,
TuneShortForwardBranchOpt]>;
-def TuneVeyronFusions : SubtargetFeature<"ventana-veyron", "RISCVProcFamily", "VentanaVeyron",
- "Ventana Veyron-Series processors",
- [TuneLUIADDIFusion,
- TuneAUIPCADDIFusion,
- TuneShiftedZExtFusion,
- TuneLDADDFusion]>;
+def TuneVentanaVeyron : SubtargetFeature<"ventana-veyron", "RISCVProcFamily", "VentanaVeyron",
+ "Ventana Veyron-Series processors">;
// Assume that lock-free native-width atomics are available, even if the target
// and operating system combination would not usually provide them. The user
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index 09b3ab96974c..098a320c9153 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -915,8 +915,7 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
Opc = RISCV::FMV_H_X;
break;
case MVT::f16:
- Opc =
- Subtarget->hasStdExtZhinxOrZhinxmin() ? RISCV::COPY : RISCV::FMV_H_X;
+ Opc = Subtarget->hasStdExtZhinxmin() ? RISCV::COPY : RISCV::FMV_H_X;
break;
case MVT::f32:
Opc = Subtarget->hasStdExtZfinx() ? RISCV::COPY : RISCV::FMV_W_X;
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 03e994586d0c..c2508a158837 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -122,7 +122,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
if (Subtarget.is64Bit() && RV64LegalI32)
addRegisterClass(MVT::i32, &RISCV::GPRRegClass);
- if (Subtarget.hasStdExtZfhOrZfhmin())
+ if (Subtarget.hasStdExtZfhmin())
addRegisterClass(MVT::f16, &RISCV::FPR16RegClass);
if (Subtarget.hasStdExtZfbfmin())
addRegisterClass(MVT::bf16, &RISCV::FPR16RegClass);
@@ -130,7 +130,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
addRegisterClass(MVT::f32, &RISCV::FPR32RegClass);
if (Subtarget.hasStdExtD())
addRegisterClass(MVT::f64, &RISCV::FPR64RegClass);
- if (Subtarget.hasStdExtZhinxOrZhinxmin())
+ if (Subtarget.hasStdExtZhinxmin())
addRegisterClass(MVT::f16, &RISCV::GPRF16RegClass);
if (Subtarget.hasStdExtZfinx())
addRegisterClass(MVT::f32, &RISCV::GPRF32RegClass);
@@ -439,7 +439,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
ISD::FCEIL, ISD::FFLOOR, ISD::FTRUNC, ISD::FRINT, ISD::FROUND,
ISD::FROUNDEVEN};
- if (Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin())
+ if (Subtarget.hasStdExtZfhminOrZhinxmin())
setOperationAction(ISD::BITCAST, MVT::i16, Custom);
static const unsigned ZfhminZfbfminPromoteOps[] = {
@@ -469,7 +469,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::FCOPYSIGN, MVT::bf16, Expand);
}
- if (Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin()) {
+ if (Subtarget.hasStdExtZfhminOrZhinxmin()) {
if (Subtarget.hasStdExtZfhOrZhinx()) {
setOperationAction(FPLegalNodeTypes, MVT::f16, Legal);
setOperationAction(FPRndMode, MVT::f16,
@@ -675,7 +675,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
ISD::VP_FP_TO_UINT, ISD::VP_SETCC, ISD::VP_SIGN_EXTEND,
ISD::VP_ZERO_EXTEND, ISD::VP_TRUNCATE, ISD::VP_SMIN,
ISD::VP_SMAX, ISD::VP_UMIN, ISD::VP_UMAX,
- ISD::VP_ABS, ISD::EXPERIMENTAL_VP_REVERSE};
+ ISD::VP_ABS, ISD::EXPERIMENTAL_VP_REVERSE, ISD::EXPERIMENTAL_VP_SPLICE};
static const unsigned FloatingPointVPOps[] = {
ISD::VP_FADD, ISD::VP_FSUB, ISD::VP_FMUL,
@@ -688,7 +688,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
ISD::VP_FCEIL, ISD::VP_FFLOOR, ISD::VP_FROUND,
ISD::VP_FROUNDEVEN, ISD::VP_FCOPYSIGN, ISD::VP_FROUNDTOZERO,
ISD::VP_FRINT, ISD::VP_FNEARBYINT, ISD::VP_IS_FPCLASS,
- ISD::EXPERIMENTAL_VP_REVERSE};
+ ISD::EXPERIMENTAL_VP_REVERSE, ISD::EXPERIMENTAL_VP_SPLICE};
static const unsigned IntegerVecReduceOps[] = {
ISD::VECREDUCE_ADD, ISD::VECREDUCE_AND, ISD::VECREDUCE_OR,
@@ -773,6 +773,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::VECTOR_REVERSE, VT, Custom);
+ setOperationAction(ISD::EXPERIMENTAL_VP_SPLICE, VT, Custom);
setOperationAction(ISD::EXPERIMENTAL_VP_REVERSE, VT, Custom);
setOperationPromotedToType(
@@ -1147,6 +1148,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
ISD::VP_SETCC, ISD::VP_TRUNCATE},
VT, Custom);
+ setOperationAction(ISD::EXPERIMENTAL_VP_SPLICE, VT, Custom);
setOperationAction(ISD::EXPERIMENTAL_VP_REVERSE, VT, Custom);
continue;
}
@@ -1322,7 +1324,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
// Custom-legalize bitcasts from fixed-length vectors to scalar types.
setOperationAction(ISD::BITCAST, {MVT::i8, MVT::i16, MVT::i32, MVT::i64},
Custom);
- if (Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin())
+ if (Subtarget.hasStdExtZfhminOrZhinxmin())
setOperationAction(ISD::BITCAST, MVT::f16, Custom);
if (Subtarget.hasStdExtFOrZfinx())
setOperationAction(ISD::BITCAST, MVT::f32, Custom);
@@ -1388,7 +1390,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
if (Subtarget.hasStdExtZbkb())
setTargetDAGCombine(ISD::BITREVERSE);
- if (Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin())
+ if (Subtarget.hasStdExtZfhminOrZhinxmin())
setTargetDAGCombine(ISD::SIGN_EXTEND_INREG);
if (Subtarget.hasStdExtFOrZfinx())
setTargetDAGCombine({ISD::ZERO_EXTEND, ISD::FP_TO_SINT, ISD::FP_TO_UINT,
@@ -2099,7 +2101,7 @@ bool RISCVTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
bool ForCodeSize) const {
bool IsLegalVT = false;
if (VT == MVT::f16)
- IsLegalVT = Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin();
+ IsLegalVT = Subtarget.hasStdExtZfhminOrZhinxmin();
else if (VT == MVT::f32)
IsLegalVT = Subtarget.hasStdExtFOrZfinx();
else if (VT == MVT::f64)
@@ -2171,7 +2173,7 @@ MVT RISCVTargetLowering::getRegisterTypeForCallingConv(LLVMContext &Context,
// Use f32 to pass f16 if it is legal and Zfh/Zfhmin is not enabled.
// We might still end up using a GPR but that will be decided based on ABI.
if (VT == MVT::f16 && Subtarget.hasStdExtFOrZfinx() &&
- !Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin())
+ !Subtarget.hasStdExtZfhminOrZhinxmin())
return MVT::f32;
MVT PartVT = TargetLowering::getRegisterTypeForCallingConv(Context, CC, VT);
@@ -2188,7 +2190,7 @@ unsigned RISCVTargetLowering::getNumRegistersForCallingConv(LLVMContext &Context
// Use f32 to pass f16 if it is legal and Zfh/Zfhmin is not enabled.
// We might still end up using a GPR but that will be decided based on ABI.
if (VT == MVT::f16 && Subtarget.hasStdExtFOrZfinx() &&
- !Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin())
+ !Subtarget.hasStdExtZfhminOrZhinxmin())
return 1;
return TargetLowering::getNumRegistersForCallingConv(Context, CC, VT);
@@ -5528,7 +5530,7 @@ static unsigned getRISCVVLOp(SDValue Op) {
case ISD::VP_SELECT:
return RISCVISD::VSELECT_VL;
case ISD::VP_MERGE:
- return RISCVISD::VP_MERGE_VL;
+ return RISCVISD::VMERGE_VL;
case ISD::VP_ASHR:
return RISCVISD::SRA_VL;
case ISD::VP_LSHR:
@@ -5576,6 +5578,8 @@ static bool hasMergeOp(unsigned Opcode) {
return true;
if (Opcode >= RISCVISD::STRICT_FADD_VL && Opcode <= RISCVISD::STRICT_FDIV_VL)
return true;
+ if (Opcode == RISCVISD::VMERGE_VL)
+ return true;
return false;
}
@@ -5761,7 +5765,7 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
EVT Op0VT = Op0.getValueType();
MVT XLenVT = Subtarget.getXLenVT();
if (VT == MVT::f16 && Op0VT == MVT::i16 &&
- Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin()) {
+ Subtarget.hasStdExtZfhminOrZhinxmin()) {
SDValue NewOp0 = DAG.getNode(ISD::ANY_EXTEND, DL, XLenVT, Op0);
SDValue FPConv = DAG.getNode(RISCVISD::FMV_H_X, DL, MVT::f16, NewOp0);
return FPConv;
@@ -6637,6 +6641,8 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
!Subtarget.hasVInstructionsF16()))
return SplitVPOp(Op, DAG);
return lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND(Op, DAG, Subtarget);
+ case ISD::EXPERIMENTAL_VP_SPLICE:
+ return lowerVPSpliceExperimental(Op, DAG);
case ISD::EXPERIMENTAL_VP_REVERSE:
return lowerVPReverseExperimental(Op, DAG);
}
@@ -8238,8 +8244,8 @@ static SDValue lowerVectorIntrinsicScalars(SDValue Op, SelectionDAG &DAG,
AVL);
// TUMA or TUMU: Currently we always emit tumu policy regardless of tuma.
// It's fine because vmerge does not care mask policy.
- return DAG.getNode(RISCVISD::VP_MERGE_VL, DL, VT, Mask, Vec, MaskedOff,
- AVL);
+ return DAG.getNode(RISCVISD::VMERGE_VL, DL, VT, Mask, Vec, MaskedOff,
+ MaskedOff, AVL);
}
}
@@ -10312,9 +10318,20 @@ SDValue RISCVTargetLowering::lowerVPOp(SDValue Op, SelectionDAG &DAG) const {
for (const auto &OpIdx : enumerate(Op->ops())) {
SDValue V = OpIdx.value();
assert(!isa<VTSDNode>(V) && "Unexpected VTSDNode node!");
- // Add dummy merge value before the mask.
- if (HasMergeOp && *ISD::getVPMaskIdx(Op.getOpcode()) == OpIdx.index())
- Ops.push_back(DAG.getUNDEF(ContainerVT));
+ // Add dummy merge value before the mask. Or if there isn't a mask, before
+ // EVL.
+ if (HasMergeOp) {
+ auto MaskIdx = ISD::getVPMaskIdx(Op.getOpcode());
+ if (MaskIdx) {
+ if (*MaskIdx == OpIdx.index())
+ Ops.push_back(DAG.getUNDEF(ContainerVT));
+ } else if (ISD::getVPExplicitVectorLengthIdx(Op.getOpcode()) ==
+ OpIdx.index()) {
+ // For VP_MERGE, copy the false operand instead of an undef value.
+ assert(Op.getOpcode() == ISD::VP_MERGE);
+ Ops.push_back(Ops.back());
+ }
+ }
// Pass through operands which aren't fixed-length vectors.
if (!V.getValueType().isFixedLengthVector()) {
Ops.push_back(V);
@@ -10583,6 +10600,87 @@ SDValue RISCVTargetLowering::lowerVPFPIntConvOp(SDValue Op,
}
SDValue
+RISCVTargetLowering::lowerVPSpliceExperimental(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+
+ SDValue Op1 = Op.getOperand(0);
+ SDValue Op2 = Op.getOperand(1);
+ SDValue Offset = Op.getOperand(2);
+ SDValue Mask = Op.getOperand(3);
+ SDValue EVL1 = Op.getOperand(4);
+ SDValue EVL2 = Op.getOperand(5);
+
+ const MVT XLenVT = Subtarget.getXLenVT();
+ MVT VT = Op.getSimpleValueType();
+ MVT ContainerVT = VT;
+ if (VT.isFixedLengthVector()) {
+ ContainerVT = getContainerForFixedLengthVector(VT);
+ Op1 = convertToScalableVector(ContainerVT, Op1, DAG, Subtarget);
+ Op2 = convertToScalableVector(ContainerVT, Op2, DAG, Subtarget);
+ MVT MaskVT = getMaskTypeFor(ContainerVT);
+ Mask = convertToScalableVector(MaskVT, Mask, DAG, Subtarget);
+ }
+
+ bool IsMaskVector = VT.getVectorElementType() == MVT::i1;
+ if (IsMaskVector) {
+ ContainerVT = ContainerVT.changeVectorElementType(MVT::i8);
+
+ // Expand input operands
+ SDValue SplatOneOp1 = DAG.getNode(RISCVISD::VMV_V_X_VL, DL, ContainerVT,
+ DAG.getUNDEF(ContainerVT),
+ DAG.getConstant(1, DL, XLenVT), EVL1);
+ SDValue SplatZeroOp1 = DAG.getNode(RISCVISD::VMV_V_X_VL, DL, ContainerVT,
+ DAG.getUNDEF(ContainerVT),
+ DAG.getConstant(0, DL, XLenVT), EVL1);
+ Op1 = DAG.getNode(RISCVISD::VSELECT_VL, DL, ContainerVT, Op1, SplatOneOp1,
+ SplatZeroOp1, EVL1);
+
+ SDValue SplatOneOp2 = DAG.getNode(RISCVISD::VMV_V_X_VL, DL, ContainerVT,
+ DAG.getUNDEF(ContainerVT),
+ DAG.getConstant(1, DL, XLenVT), EVL2);
+ SDValue SplatZeroOp2 = DAG.getNode(RISCVISD::VMV_V_X_VL, DL, ContainerVT,
+ DAG.getUNDEF(ContainerVT),
+ DAG.getConstant(0, DL, XLenVT), EVL2);
+ Op2 = DAG.getNode(RISCVISD::VSELECT_VL, DL, ContainerVT, Op2, SplatOneOp2,
+ SplatZeroOp2, EVL2);
+ }
+
+ int64_t ImmValue = cast<ConstantSDNode>(Offset)->getSExtValue();
+ SDValue DownOffset, UpOffset;
+ if (ImmValue >= 0) {
+ // The operand is a TargetConstant, we need to rebuild it as a regular
+ // constant.
+ DownOffset = DAG.getConstant(ImmValue, DL, XLenVT);
+ UpOffset = DAG.getNode(ISD::SUB, DL, XLenVT, EVL1, DownOffset);
+ } else {
+ // The operand is a TargetConstant, we need to rebuild it as a regular
+ // constant rather than negating the original operand.
+ UpOffset = DAG.getConstant(-ImmValue, DL, XLenVT);
+ DownOffset = DAG.getNode(ISD::SUB, DL, XLenVT, EVL1, UpOffset);
+ }
+
+ SDValue SlideDown =
+ getVSlidedown(DAG, Subtarget, DL, ContainerVT, DAG.getUNDEF(ContainerVT),
+ Op1, DownOffset, Mask, UpOffset);
+ SDValue Result = getVSlideup(DAG, Subtarget, DL, ContainerVT, SlideDown, Op2,
+ UpOffset, Mask, EVL2, RISCVII::TAIL_AGNOSTIC);
+
+ if (IsMaskVector) {
+ // Truncate Result back to a mask vector (Result has same EVL as Op2)
+ Result = DAG.getNode(
+ RISCVISD::SETCC_VL, DL, ContainerVT.changeVectorElementType(MVT::i1),
+ {Result, DAG.getConstant(0, DL, ContainerVT),
+ DAG.getCondCode(ISD::SETNE), DAG.getUNDEF(getMaskTypeFor(ContainerVT)),
+ Mask, EVL2});
+ }
+
+ if (!VT.isFixedLengthVector())
+ return Result;
+ return convertFromScalableVector(VT, Result, DAG, Subtarget);
+}
+
+SDValue
RISCVTargetLowering::lowerVPReverseExperimental(SDValue Op,
SelectionDAG &DAG) const {
SDLoc DL(Op);
@@ -11527,11 +11625,11 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
EVT Op0VT = Op0.getValueType();
MVT XLenVT = Subtarget.getXLenVT();
if (VT == MVT::i16 && Op0VT == MVT::f16 &&
- Subtarget.hasStdExtZfhOrZfhminOrZhinxOrZhinxmin()) {
+ Subtarget.hasStdExtZfhminOrZhinxmin()) {
SDValue FPConv = DAG.getNode(RISCVISD::FMV_X_ANYEXTH, DL, XLenVT, Op0);
Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, MVT::i16, FPConv));
} else if (VT == MVT::i16 && Op0VT == MVT::bf16 &&
- Subtarget.hasStdExtZfbfmin()) {
+ Subtarget.hasStdExtZfbfmin()) {
SDValue FPConv = DAG.getNode(RISCVISD::FMV_X_ANYEXTH, DL, XLenVT, Op0);
Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, MVT::i16, FPConv));
} else if (VT == MVT::i32 && Op0VT == MVT::f32 && Subtarget.is64Bit() &&
@@ -13493,6 +13591,7 @@ static SDValue performMemPairCombine(SDNode *N,
// (fp_to_int (ffloor X)) -> fcvt X, rdn
// (fp_to_int (fceil X)) -> fcvt X, rup
// (fp_to_int (fround X)) -> fcvt X, rmm
+// (fp_to_int (frint X)) -> fcvt X
static SDValue performFP_TO_INTCombine(SDNode *N,
TargetLowering::DAGCombinerInfo &DCI,
const RISCVSubtarget &Subtarget) {
@@ -13516,10 +13615,7 @@ static SDValue performFP_TO_INTCombine(SDNode *N,
RISCVFPRndMode::RoundingMode FRM = matchRoundingOp(Src.getOpcode());
// If the result is invalid, we didn't find a foldable instruction.
- // If the result is dynamic, then we found an frint which we don't yet
- // support. It will cause 7 to be written to the FRM CSR for vector.
- // FIXME: We could support this by using VFCVT_X_F_VL/VFCVT_XU_F_VL below.
- if (FRM == RISCVFPRndMode::Invalid || FRM == RISCVFPRndMode::DYN)
+ if (FRM == RISCVFPRndMode::Invalid)
return SDValue();
SDLoc DL(N);
@@ -13558,6 +13654,10 @@ static SDValue performFP_TO_INTCombine(SDNode *N,
unsigned Opc =
IsSigned ? RISCVISD::VFCVT_RTZ_X_F_VL : RISCVISD::VFCVT_RTZ_XU_F_VL;
FpToInt = DAG.getNode(Opc, DL, ContainerVT, XVal, Mask, VL);
+ } else if (FRM == RISCVFPRndMode::DYN) {
+ unsigned Opc =
+ IsSigned ? RISCVISD::VFCVT_X_F_VL : RISCVISD::VFCVT_XU_F_VL;
+ FpToInt = DAG.getNode(Opc, DL, ContainerVT, XVal, Mask, VL);
} else {
unsigned Opc =
IsSigned ? RISCVISD::VFCVT_RM_X_F_VL : RISCVISD::VFCVT_RM_XU_F_VL;
@@ -13594,6 +13694,7 @@ static SDValue performFP_TO_INTCombine(SDNode *N,
// (fp_to_int_sat (ffloor X)) -> (select X == nan, 0, (fcvt X, rdn))
// (fp_to_int_sat (fceil X)) -> (select X == nan, 0, (fcvt X, rup))
// (fp_to_int_sat (fround X)) -> (select X == nan, 0, (fcvt X, rmm))
+// (fp_to_int_sat (frint X)) -> (select X == nan, 0, (fcvt X, dyn))
static SDValue performFP_TO_INT_SATCombine(SDNode *N,
TargetLowering::DAGCombinerInfo &DCI,
const RISCVSubtarget &Subtarget) {
@@ -15998,13 +16099,26 @@ void RISCVTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
// We can't do anything for most intrinsics.
break;
case Intrinsic::riscv_vsetvli:
- case Intrinsic::riscv_vsetvlimax:
- // Assume that VL output is <= 65536.
- // TODO: Take SEW and LMUL into account.
- if (BitWidth > 17)
- Known.Zero.setBitsFrom(17);
+ case Intrinsic::riscv_vsetvlimax: {
+ bool HasAVL = IntNo == Intrinsic::riscv_vsetvli;
+ unsigned VSEW = Op.getConstantOperandVal(HasAVL + 1);
+ RISCVII::VLMUL VLMUL =
+ static_cast<RISCVII::VLMUL>(Op.getConstantOperandVal(HasAVL + 2));
+ unsigned SEW = RISCVVType::decodeVSEW(VSEW);
+ auto [LMul, Fractional] = RISCVVType::decodeVLMUL(VLMUL);
+ uint64_t MaxVL = Subtarget.getRealMaxVLen() / SEW;
+ MaxVL = (Fractional) ? MaxVL / LMul : MaxVL * LMul;
+
+ // Result of vsetvli must be not larger than AVL.
+ if (HasAVL && isa<ConstantSDNode>(Op.getOperand(1)))
+ MaxVL = std::min(MaxVL, Op.getConstantOperandVal(1));
+
+ unsigned KnownZeroFirstBit = Log2_32(MaxVL) + 1;
+ if (BitWidth > KnownZeroFirstBit)
+ Known.Zero.setBitsFrom(KnownZeroFirstBit);
break;
}
+ }
break;
}
}
@@ -18570,7 +18684,7 @@ const char *RISCVTargetLowering::getTargetNodeName(unsigned Opcode) const {
NODE_NAME_CASE(VNSRL_VL)
NODE_NAME_CASE(SETCC_VL)
NODE_NAME_CASE(VSELECT_VL)
- NODE_NAME_CASE(VP_MERGE_VL)
+ NODE_NAME_CASE(VMERGE_VL)
NODE_NAME_CASE(VMAND_VL)
NODE_NAME_CASE(VMOR_VL)
NODE_NAME_CASE(VMXOR_VL)
@@ -18632,7 +18746,7 @@ RISCVTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
// TODO: Support fixed vectors up to XLen for P extension?
if (VT.isVector())
break;
- if (VT == MVT::f16 && Subtarget.hasStdExtZhinxOrZhinxmin())
+ if (VT == MVT::f16 && Subtarget.hasStdExtZhinxmin())
return std::make_pair(0U, &RISCV::GPRF16RegClass);
if (VT == MVT::f32 && Subtarget.hasStdExtZfinx())
return std::make_pair(0U, &RISCV::GPRF32RegClass);
@@ -18640,7 +18754,7 @@ RISCVTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
return std::make_pair(0U, &RISCV::GPRPF64RegClass);
return std::make_pair(0U, &RISCV::GPRNoX0RegClass);
case 'f':
- if (Subtarget.hasStdExtZfhOrZfhmin() && VT == MVT::f16)
+ if (Subtarget.hasStdExtZfhmin() && VT == MVT::f16)
return std::make_pair(0U, &RISCV::FPR16RegClass);
if (Subtarget.hasStdExtF() && VT == MVT::f32)
return std::make_pair(0U, &RISCV::FPR32RegClass);
@@ -18753,7 +18867,7 @@ RISCVTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
}
if (VT == MVT::f32 || VT == MVT::Other)
return std::make_pair(FReg, &RISCV::FPR32RegClass);
- if (Subtarget.hasStdExtZfhOrZfhmin() && VT == MVT::f16) {
+ if (Subtarget.hasStdExtZfhmin() && VT == MVT::f16) {
unsigned RegNo = FReg - RISCV::F0_F;
unsigned HReg = RISCV::F0_H + RegNo;
return std::make_pair(HReg, &RISCV::FPR16RegClass);
@@ -19100,7 +19214,7 @@ bool RISCVTargetLowering::shouldConvertFpToSat(unsigned Op, EVT FPVT,
switch (FPVT.getSimpleVT().SimpleTy) {
case MVT::f16:
- return Subtarget.hasStdExtZfhOrZfhmin();
+ return Subtarget.hasStdExtZfhmin();
case MVT::f32:
return Subtarget.hasStdExtF();
case MVT::f64:
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.h b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.h
index 41a2dc5771c8..58ed611efc83 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.h
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.h
@@ -332,10 +332,8 @@ enum NodeType : unsigned {
// Vector select with an additional VL operand. This operation is unmasked.
VSELECT_VL,
- // Vector select with operand #2 (the value when the condition is false) tied
- // to the destination and an additional VL operand. This operation is
- // unmasked.
- VP_MERGE_VL,
+ // General vmerge node with mask, true, false, passthru, and vl operands.
+ VMERGE_VL,
// Mask binary operators.
VMAND_VL,
@@ -910,6 +908,7 @@ private:
SDValue lowerLogicVPOp(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerVPExtMaskOp(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerVPSetCCMaskOp(SDValue Op, SelectionDAG &DAG) const;
+ SDValue lowerVPSpliceExperimental(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerVPReverseExperimental(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerVPFPIntConvOp(SDValue Op, SelectionDAG &DAG) const;
SDValue lowerVPStridedLoad(SDValue Op, SelectionDAG &DAG) const;
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrFormats.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrFormats.td
index e80ba26800a1..f56f49ae2457 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrFormats.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrFormats.td
@@ -212,6 +212,15 @@ class RVInstCommon<dag outs, dag ins, string opcodestr, string argstr,
// to the correct CSR.
bit UsesVXRM = 0;
let TSFlags{20} = UsesVXRM;
+
+ // Indicates whther these instructions can partially overlap between source
+ // registers and destination registers according to the vector spec.
+ // 0 -> not a vector pseudo
+ // 1 -> default value for vector pseudos. not widening or narrowing.
+ // 2 -> narrowing case
+ // 3 -> widening case
+ bits<2> TargetOverlapConstraintType = 0;
+ let TSFlags{22-21} = TargetOverlapConstraintType;
}
class RVInst<dag outs, dag ins, string opcodestr, string argstr,
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index 5e06422cf9ad..488ffa73f4e4 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -529,14 +529,6 @@ class RISCVVPseudo {
// SEW = 0 is used to denote that the Pseudo is not SEW specific (or unknown).
bits<8> SEW = 0;
bit NeedBeInPseudoTable = 1;
- // TargetOverlapConstraintType indicates that these instructions can
- // overlap between source operands and destination operands.
- // 1 -> default value, remain current constraint
- // 2 -> narrow case
- // 3 -> widen case
- // TODO: Add TargetOverlapConstraintType into PseudosTable for further
- // query.
- bits<2> TargetOverlapConstraintType = 1;
}
// The actual table.
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
index dc6b57fad321..33bdc3366aa3 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
@@ -344,7 +344,14 @@ def SDT_RISCVSelect_VL : SDTypeProfile<1, 4, [
]>;
def riscv_vselect_vl : SDNode<"RISCVISD::VSELECT_VL", SDT_RISCVSelect_VL>;
-def riscv_vp_merge_vl : SDNode<"RISCVISD::VP_MERGE_VL", SDT_RISCVSelect_VL>;
+
+def SDT_RISCVVMERGE_VL : SDTypeProfile<1, 5, [
+ SDTCisVec<0>, SDTCisVec<1>, SDTCisSameNumEltsAs<0, 1>, SDTCVecEltisVT<1, i1>,
+ SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>, SDTCisSameAs<0, 4>,
+ SDTCisVT<5, XLenVT>
+]>;
+
+def riscv_vmerge_vl : SDNode<"RISCVISD::VMERGE_VL", SDT_RISCVVMERGE_VL>;
def SDT_RISCVVMSETCLR_VL : SDTypeProfile<1, 1, [SDTCVecEltisVT<0, i1>,
SDTCisVT<1, XLenVT>]>;
@@ -675,14 +682,14 @@ multiclass VPatTiedBinaryNoMaskVL_V<SDNode vop,
op2_reg_class:$rs2,
GPR:$vl, sew, TAIL_AGNOSTIC)>;
// Tail undisturbed
- def : Pat<(riscv_vp_merge_vl true_mask,
+ def : Pat<(riscv_vmerge_vl true_mask,
(result_type (vop
result_reg_class:$rs1,
(op2_type op2_reg_class:$rs2),
srcvalue,
true_mask,
VLOpFrag)),
- result_reg_class:$rs1, VLOpFrag),
+ result_reg_class:$rs1, result_reg_class:$rs1, VLOpFrag),
(!cast<Instruction>(instruction_name#"_"#suffix#"_"# vlmul.MX#"_TIED")
result_reg_class:$rs1,
op2_reg_class:$rs2,
@@ -712,14 +719,14 @@ multiclass VPatTiedBinaryNoMaskVL_V_RM<SDNode vop,
FRM_DYN,
GPR:$vl, sew, TAIL_AGNOSTIC)>;
// Tail undisturbed
- def : Pat<(riscv_vp_merge_vl true_mask,
+ def : Pat<(riscv_vmerge_vl true_mask,
(result_type (vop
result_reg_class:$rs1,
(op2_type op2_reg_class:$rs2),
srcvalue,
true_mask,
VLOpFrag)),
- result_reg_class:$rs1, VLOpFrag),
+ result_reg_class:$rs1, result_reg_class:$rs1, VLOpFrag),
(!cast<Instruction>(instruction_name#"_"#suffix#"_"# vlmul.MX#"_TIED")
result_reg_class:$rs1,
op2_reg_class:$rs2,
@@ -1697,21 +1704,21 @@ multiclass VPatMultiplyAccVL_VV_VX<PatFrag op, string instruction_name> {
foreach vti = AllIntegerVectors in {
defvar suffix = vti.LMul.MX;
let Predicates = GetVTypePredicates<vti>.Predicates in {
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
(vti.Vector (op vti.RegClass:$rd,
(riscv_mul_vl_oneuse vti.RegClass:$rs1, vti.RegClass:$rs2,
srcvalue, (vti.Mask true_mask), VLOpFrag),
srcvalue, (vti.Mask true_mask), VLOpFrag)),
- vti.RegClass:$rd, VLOpFrag),
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
(!cast<Instruction>(instruction_name#"_VV_"# suffix #"_MASK")
vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2,
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
(vti.Vector (op vti.RegClass:$rd,
(riscv_mul_vl_oneuse (SplatPat XLenVT:$rs1), vti.RegClass:$rs2,
srcvalue, (vti.Mask true_mask), VLOpFrag),
srcvalue, (vti.Mask true_mask), VLOpFrag)),
- vti.RegClass:$rd, VLOpFrag),
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
(!cast<Instruction>(instruction_name#"_VX_"# suffix #"_MASK")
vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2,
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
@@ -1840,17 +1847,17 @@ multiclass VPatFPMulAccVL_VV_VF<PatFrag vop, string instruction_name> {
foreach vti = AllFloatVectors in {
defvar suffix = vti.LMul.MX;
let Predicates = GetVTypePredicates<vti>.Predicates in {
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
(vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2,
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
- vti.RegClass:$rd, VLOpFrag),
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
(!cast<Instruction>(instruction_name#"_VV_"# suffix #"_MASK")
vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2,
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
(vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2,
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
- vti.RegClass:$rd, VLOpFrag),
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
(!cast<Instruction>(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK")
vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2,
(vti.Mask V0), GPR:$vl, vti.Log2SEW, TU_MU)>;
@@ -1876,10 +1883,10 @@ multiclass VPatFPMulAccVL_VV_VF_RM<PatFrag vop, string instruction_name> {
foreach vti = AllFloatVectors in {
defvar suffix = vti.LMul.MX;
let Predicates = GetVTypePredicates<vti>.Predicates in {
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
(vti.Vector (vop vti.RegClass:$rs1, vti.RegClass:$rs2,
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
- vti.RegClass:$rd, VLOpFrag),
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
(!cast<Instruction>(instruction_name#"_VV_"# suffix #"_MASK")
vti.RegClass:$rd, vti.RegClass:$rs1, vti.RegClass:$rs2,
(vti.Mask V0),
@@ -1887,10 +1894,10 @@ multiclass VPatFPMulAccVL_VV_VF_RM<PatFrag vop, string instruction_name> {
// RISCVInsertReadWriteCSR
FRM_DYN,
GPR:$vl, vti.Log2SEW, TU_MU)>;
- def : Pat<(riscv_vp_merge_vl (vti.Mask V0),
+ def : Pat<(riscv_vmerge_vl (vti.Mask V0),
(vti.Vector (vop (SplatFPOp vti.ScalarRegClass:$rs1), vti.RegClass:$rs2,
vti.RegClass:$rd, (vti.Mask true_mask), VLOpFrag)),
- vti.RegClass:$rd, VLOpFrag),
+ vti.RegClass:$rd, vti.RegClass:$rd, VLOpFrag),
(!cast<Instruction>(instruction_name#"_V" # vti.ScalarSuffix # "_" # suffix # "_MASK")
vti.RegClass:$rd, vti.ScalarRegClass:$rs1, vti.RegClass:$rs2,
(vti.Mask V0),
@@ -2273,29 +2280,32 @@ foreach vti = AllIntegerVectors in {
(vti.Vector (IMPLICIT_DEF)),
vti.RegClass:$rs2, simm5:$rs1, (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
- def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0),
- vti.RegClass:$rs1,
- vti.RegClass:$rs2,
- VLOpFrag)),
+ def : Pat<(vti.Vector (riscv_vmerge_vl (vti.Mask V0),
+ vti.RegClass:$rs1,
+ vti.RegClass:$rs2,
+ vti.RegClass:$merge,
+ VLOpFrag)),
(!cast<Instruction>("PseudoVMERGE_VVM_"#vti.LMul.MX)
- vti.RegClass:$rs2, vti.RegClass:$rs2, vti.RegClass:$rs1,
- (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
+ vti.RegClass:$merge, vti.RegClass:$rs2, vti.RegClass:$rs1,
+ (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
- def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0),
- (SplatPat XLenVT:$rs1),
- vti.RegClass:$rs2,
- VLOpFrag)),
+ def : Pat<(vti.Vector (riscv_vmerge_vl (vti.Mask V0),
+ (SplatPat XLenVT:$rs1),
+ vti.RegClass:$rs2,
+ vti.RegClass:$merge,
+ VLOpFrag)),
(!cast<Instruction>("PseudoVMERGE_VXM_"#vti.LMul.MX)
- vti.RegClass:$rs2, vti.RegClass:$rs2, GPR:$rs1,
- (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
-
- def : Pat<(vti.Vector (riscv_vp_merge_vl (vti.Mask V0),
- (SplatPat_simm5 simm5:$rs1),
- vti.RegClass:$rs2,
- VLOpFrag)),
+ vti.RegClass:$merge, vti.RegClass:$rs2, GPR:$rs1,
+ (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
+
+ def : Pat<(vti.Vector (riscv_vmerge_vl (vti.Mask V0),
+ (SplatPat_simm5 simm5:$rs1),
+ vti.RegClass:$rs2,
+ vti.RegClass:$merge,
+ VLOpFrag)),
(!cast<Instruction>("PseudoVMERGE_VIM_"#vti.LMul.MX)
- vti.RegClass:$rs2, vti.RegClass:$rs2, simm5:$rs1,
- (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
+ vti.RegClass:$merge, vti.RegClass:$rs2, simm5:$rs1,
+ (vti.Mask V0), GPR:$vl, vti.Log2SEW)>;
}
}
@@ -2493,21 +2503,23 @@ foreach fvti = AllFloatVectors in {
(fvti.Vector (IMPLICIT_DEF)),
fvti.RegClass:$rs2, 0, (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>;
- def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0),
- fvti.RegClass:$rs1,
- fvti.RegClass:$rs2,
- VLOpFrag)),
- (!cast<Instruction>("PseudoVMERGE_VVM_"#fvti.LMul.MX)
- fvti.RegClass:$rs2, fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0),
- GPR:$vl, fvti.Log2SEW)>;
-
- def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0),
- (SplatFPOp (fvti.Scalar fpimm0)),
- fvti.RegClass:$rs2,
- VLOpFrag)),
- (!cast<Instruction>("PseudoVMERGE_VIM_"#fvti.LMul.MX)
- fvti.RegClass:$rs2, fvti.RegClass:$rs2, 0, (fvti.Mask V0),
- GPR:$vl, fvti.Log2SEW)>;
+ def : Pat<(fvti.Vector (riscv_vmerge_vl (fvti.Mask V0),
+ fvti.RegClass:$rs1,
+ fvti.RegClass:$rs2,
+ fvti.RegClass:$merge,
+ VLOpFrag)),
+ (!cast<Instruction>("PseudoVMERGE_VVM_"#fvti.LMul.MX)
+ fvti.RegClass:$merge, fvti.RegClass:$rs2, fvti.RegClass:$rs1, (fvti.Mask V0),
+ GPR:$vl, fvti.Log2SEW)>;
+
+ def : Pat<(fvti.Vector (riscv_vmerge_vl (fvti.Mask V0),
+ (SplatFPOp (fvti.Scalar fpimm0)),
+ fvti.RegClass:$rs2,
+ fvti.RegClass:$merge,
+ VLOpFrag)),
+ (!cast<Instruction>("PseudoVMERGE_VIM_"#fvti.LMul.MX)
+ fvti.RegClass:$merge, fvti.RegClass:$rs2, 0, (fvti.Mask V0),
+ GPR:$vl, fvti.Log2SEW)>;
}
let Predicates = GetVTypePredicates<fvti>.Predicates in {
@@ -2521,12 +2533,13 @@ foreach fvti = AllFloatVectors in {
(fvti.Scalar fvti.ScalarRegClass:$rs1),
(fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>;
- def : Pat<(fvti.Vector (riscv_vp_merge_vl (fvti.Mask V0),
- (SplatFPOp fvti.ScalarRegClass:$rs1),
- fvti.RegClass:$rs2,
- VLOpFrag)),
+ def : Pat<(fvti.Vector (riscv_vmerge_vl (fvti.Mask V0),
+ (SplatFPOp fvti.ScalarRegClass:$rs1),
+ fvti.RegClass:$rs2,
+ fvti.RegClass:$merge,
+ VLOpFrag)),
(!cast<Instruction>("PseudoVFMERGE_V"#fvti.ScalarSuffix#"M_"#fvti.LMul.MX)
- fvti.RegClass:$rs2, fvti.RegClass:$rs2,
+ fvti.RegClass:$merge, fvti.RegClass:$rs2,
(fvti.Scalar fvti.ScalarRegClass:$rs1),
(fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>;
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
index fa618b437ce7..0b1d5b664df9 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
@@ -351,20 +351,22 @@ multiclass VPseudoSiFiveVMACC<string mx, VReg vd_type, VReg vs2_type,
multiclass VPseudoSiFiveVQMACC<string Constraint = ""> {
foreach m = MxListVF8 in
+ let VLMul = m.value in
defm NAME : VPseudoSiFiveVMACC<m.MX, m.vrclass, m.vrclass, Constraint>;
}
multiclass VPseudoSiFiveVFWMACC<string Constraint = ""> {
foreach m = MxListFW in
+ let VLMul = m.value in
defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass, Constraint>;
}
multiclass VPseudoSiFiveVFNRCLIP<string Constraint = "@earlyclobber $rd"> {
- foreach m = MxListVF4 in
+ foreach i = [0, 1, 2, 3, 4] in
let hasSideEffects = 0 in
- defm "Pseudo" # NAME : VPseudoBinaryRoundingMode<!if(!eq(m.vrclass, VRM8),
- VRM2, VR),
- m.vrclass, FPR32, m,
+ defm "Pseudo" # NAME : VPseudoBinaryRoundingMode<MxListW[i].vrclass,
+ MxListVF4[i].vrclass,
+ FPR32, MxListW[i],
Constraint, /*sew*/0,
UsesVXRM=0>;
}
@@ -592,7 +594,7 @@ multiclass VPatVFNRCLIP<string intrinsic, string instruction> {
defvar Vti = pair.Vti;
defvar Wti = pair.Wti;
defm : VPatBinaryRoundingMode<"int_riscv_sf_" # intrinsic,
- "Pseudo" # instruction # "_" # Wti.LMul.MX,
+ "Pseudo" # instruction # "_" # Vti.LMul.MX,
Vti.Vector, Wti.Vector, Wti.Scalar, Vti.Mask,
Vti.Log2SEW, Vti.RegClass,
Wti.RegClass, Wti.ScalarRegClass>;
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td
index 1ffa78a28d09..7c21fb4bcc1e 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
//
// This file describes the RISC-V instructions from the standard 'Zvk',
-// Vector Cryptography Instructions extension, version 1.0.0-rc1.
+// Vector Cryptography Instructions extension, version Release 1.0.0.
//
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVMacroFusion.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVMacroFusion.cpp
index 02ea5270823d..f948f05b22f7 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVMacroFusion.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVMacroFusion.cpp
@@ -58,18 +58,66 @@ static bool isLDADD(const MachineInstr *FirstMI, const MachineInstr &SecondMI) {
return checkRegisters(FirstMI->getOperand(0).getReg(), SecondMI);
}
-// Fuse these patterns:
-//
-// slli rd, rs1, 32
-// srli rd, rd, x
-// where 0 <= x <= 32
-//
-// and
-//
+// Fuse zero extension of halfword:
// slli rd, rs1, 48
+// srli rd, rd, 48
+static bool isZExtH(const MachineInstr *FirstMI, const MachineInstr &SecondMI) {
+ if (SecondMI.getOpcode() != RISCV::SRLI)
+ return false;
+
+ if (!SecondMI.getOperand(2).isImm())
+ return false;
+
+ if (SecondMI.getOperand(2).getImm() != 48)
+ return false;
+
+ // Given SecondMI, when FirstMI is unspecified, we must return
+ // if SecondMI may be part of a fused pair at all.
+ if (!FirstMI)
+ return true;
+
+ if (FirstMI->getOpcode() != RISCV::SLLI)
+ return false;
+
+ if (FirstMI->getOperand(2).getImm() != 48)
+ return false;
+
+ return checkRegisters(FirstMI->getOperand(0).getReg(), SecondMI);
+}
+
+// Fuse zero extension of word:
+// slli rd, rs1, 32
+// srli rd, rd, 32
+static bool isZExtW(const MachineInstr *FirstMI, const MachineInstr &SecondMI) {
+ if (SecondMI.getOpcode() != RISCV::SRLI)
+ return false;
+
+ if (!SecondMI.getOperand(2).isImm())
+ return false;
+
+ if (SecondMI.getOperand(2).getImm() != 32)
+ return false;
+
+ // Given SecondMI, when FirstMI is unspecified, we must return
+ // if SecondMI may be part of a fused pair at all.
+ if (!FirstMI)
+ return true;
+
+ if (FirstMI->getOpcode() != RISCV::SLLI)
+ return false;
+
+ if (FirstMI->getOperand(2).getImm() != 32)
+ return false;
+
+ return checkRegisters(FirstMI->getOperand(0).getReg(), SecondMI);
+}
+
+// Fuse shifted zero extension of word:
+// slli rd, rs1, 32
// srli rd, rd, x
-static bool isShiftedZExt(const MachineInstr *FirstMI,
- const MachineInstr &SecondMI) {
+// where 0 <= x < 32
+static bool isShiftedZExtW(const MachineInstr *FirstMI,
+ const MachineInstr &SecondMI) {
if (SecondMI.getOpcode() != RISCV::SRLI)
return false;
@@ -77,8 +125,7 @@ static bool isShiftedZExt(const MachineInstr *FirstMI,
return false;
unsigned SRLIImm = SecondMI.getOperand(2).getImm();
- bool IsShiftBy48 = SRLIImm == 48;
- if (SRLIImm > 32 && !IsShiftBy48)
+ if (SRLIImm >= 32)
return false;
// Given SecondMI, when FirstMI is unspecified, we must return
@@ -89,8 +136,7 @@ static bool isShiftedZExt(const MachineInstr *FirstMI,
if (FirstMI->getOpcode() != RISCV::SLLI)
return false;
- unsigned SLLIImm = FirstMI->getOperand(2).getImm();
- if (IsShiftBy48 ? (SLLIImm != 48) : (SLLIImm != 32))
+ if (FirstMI->getOperand(2).getImm() != 32)
return false;
return checkRegisters(FirstMI->getOperand(0).getReg(), SecondMI);
@@ -144,7 +190,13 @@ static bool shouldScheduleAdjacent(const TargetInstrInfo &TII,
if (ST.hasAUIPCADDIFusion() && isAUIPCADDI(FirstMI, SecondMI))
return true;
- if (ST.hasShiftedZExtFusion() && isShiftedZExt(FirstMI, SecondMI))
+ if (ST.hasZExtHFusion() && isZExtH(FirstMI, SecondMI))
+ return true;
+
+ if (ST.hasZExtWFusion() && isZExtW(FirstMI, SecondMI))
+ return true;
+
+ if (ST.hasShiftedZExtWFusion() && isShiftedZExtW(FirstMI, SecondMI))
return true;
if (ST.hasLDADDFusion() && isLDADD(FirstMI, SecondMI))
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVProcessors.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVProcessors.td
index 58989fd716fa..6362a3bef6f2 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVProcessors.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVProcessors.td
@@ -216,6 +216,25 @@ def SIFIVE_X280 : RISCVProcessorModel<"sifive-x280", SiFive7Model,
[TuneSiFive7,
TuneDLenFactor2]>;
+def SIFIVE_P450 : RISCVProcessorModel<"sifive-p450", NoSchedModel,
+ [Feature64Bit,
+ FeatureStdExtZifencei,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtD,
+ FeatureStdExtC,
+ FeatureStdExtZicbop,
+ FeatureStdExtZicbom,
+ FeatureStdExtZicboz,
+ FeatureStdExtZihintntl,
+ FeatureStdExtZihintpause,
+ FeatureStdExtZihpm,
+ FeatureStdExtZba,
+ FeatureStdExtZbb,
+ FeatureStdExtZbs,
+ FeatureStdExtZfhmin]>;
+
def SYNTACORE_SCR1_BASE : RISCVProcessorModel<"syntacore-scr1-base",
SyntacoreSCR1Model,
[Feature32Bit,
@@ -254,7 +273,13 @@ def VENTANA_VEYRON_V1 : RISCVProcessorModel<"veyron-v1",
FeatureStdExtZicbop,
FeatureStdExtZicboz,
FeatureVendorXVentanaCondOps],
- [TuneVeyronFusions]>;
+ [TuneVentanaVeyron,
+ TuneLUIADDIFusion,
+ TuneAUIPCADDIFusion,
+ TuneZExtHFusion,
+ TuneZExtWFusion,
+ TuneShiftedZExtWFusion,
+ TuneLDADDFusion]>;
def XIANGSHAN_NANHU : RISCVProcessorModel<"xiangshan-nanhu",
NoSchedModel,
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
index 45783d482f3b..f531ab2fac8f 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
@@ -198,6 +198,7 @@ def SiFive7Model : SchedMachineModel {
let LoadLatency = 3;
let MispredictPenalty = 3;
let CompleteModel = 0;
+ let EnableIntervals = true;
let UnsupportedFeatures = [HasStdExtZbkb, HasStdExtZbkc, HasStdExtZbkx,
HasStdExtZcmt, HasStdExtZknd, HasStdExtZkne,
HasStdExtZknh, HasStdExtZksed, HasStdExtZksh,
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.h b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.h
index 23d56cfa6e4e..26320b05d9be 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -143,16 +143,12 @@ public:
bool hasStdExtZvl() const { return ZvlLen != 0; }
bool hasStdExtFOrZfinx() const { return HasStdExtF || HasStdExtZfinx; }
bool hasStdExtDOrZdinx() const { return HasStdExtD || HasStdExtZdinx; }
- bool hasStdExtZfhOrZfhmin() const { return HasStdExtZfh || HasStdExtZfhmin; }
bool hasStdExtZfhOrZhinx() const { return HasStdExtZfh || HasStdExtZhinx; }
- bool hasStdExtZhinxOrZhinxmin() const {
- return HasStdExtZhinx || HasStdExtZhinxmin;
- }
- bool hasStdExtZfhOrZfhminOrZhinxOrZhinxmin() const {
- return hasStdExtZfhOrZfhmin() || hasStdExtZhinxOrZhinxmin();
+ bool hasStdExtZfhminOrZhinxmin() const {
+ return HasStdExtZfhmin || HasStdExtZhinxmin;
}
bool hasHalfFPLoadStoreMove() const {
- return hasStdExtZfhOrZfhmin() || HasStdExtZfbfmin;
+ return HasStdExtZfhmin || HasStdExtZfbfmin;
}
bool is64Bit() const { return IsRV64; }
MVT getXLenVT() const {
@@ -194,16 +190,14 @@ public:
}
bool hasMacroFusion() const {
- return hasLUIADDIFusion() || hasAUIPCADDIFusion() ||
- hasShiftedZExtFusion() || hasLDADDFusion();
+ return hasLUIADDIFusion() || hasAUIPCADDIFusion() || hasZExtHFusion() ||
+ hasZExtWFusion() || hasShiftedZExtWFusion() || hasLDADDFusion();
}
// Vector codegen related methods.
bool hasVInstructions() const { return HasStdExtZve32x; }
bool hasVInstructionsI64() const { return HasStdExtZve64x; }
- bool hasVInstructionsF16Minimal() const {
- return HasStdExtZvfhmin || HasStdExtZvfh;
- }
+ bool hasVInstructionsF16Minimal() const { return HasStdExtZvfhmin; }
bool hasVInstructionsF16() const { return HasStdExtZvfh; }
bool hasVInstructionsBF16() const { return HasStdExtZvfbfmin; }
bool hasVInstructionsF32() const { return HasStdExtZve32f; }
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index efc8350064a6..96ecc771863e 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -334,7 +334,7 @@ public:
return RISCVRegisterClass::GPRRC;
Type *ScalarTy = Ty->getScalarType();
- if ((ScalarTy->isHalfTy() && ST->hasStdExtZfhOrZfhmin()) ||
+ if ((ScalarTy->isHalfTy() && ST->hasStdExtZfhmin()) ||
(ScalarTy->isFloatTy() && ST->hasStdExtF()) ||
(ScalarTy->isDoubleTy() && ST->hasStdExtD())) {
return RISCVRegisterClass::FPRRC;
diff --git a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index 5ac45079bd00..c85bd27d256b 100644
--- a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -1617,7 +1617,7 @@ static bool buildEnqueueKernel(const SPIRV::IncomingCall *Call,
SPIRVGlobalRegistry *GR) {
MachineRegisterInfo *MRI = MIRBuilder.getMRI();
const DataLayout &DL = MIRBuilder.getDataLayout();
- bool HasEvents = Call->Builtin->Name.find("events") != StringRef::npos;
+ bool HasEvents = Call->Builtin->Name.contains("events");
const SPIRVType *Int32Ty = GR->getOrCreateSPIRVIntegerType(32, MIRBuilder);
// Make vararg instructions before OpEnqueueKernel.
@@ -2098,7 +2098,7 @@ parseBuiltinTypeNameToTargetExtType(std::string TypeName,
// Parameterized SPIR-V builtins names follow this format:
// e.g. %spirv.Image._void_1_0_0_0_0_0_0, %spirv.Pipe._0
- if (NameWithParameters.find('_') == std::string::npos)
+ if (!NameWithParameters.contains('_'))
return TargetExtType::get(MIRBuilder.getContext(), NameWithParameters);
SmallVector<StringRef> Parameters;
diff --git a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
index ec62a819b00e..660c574daf38 100644
--- a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
@@ -410,10 +410,10 @@ void SPIRVEmitIntrinsics::insertAssignPtrTypeIntrs(Instruction *I) {
Constant *EltTyConst;
unsigned AddressSpace = 0;
if (auto *AI = dyn_cast<AllocaInst>(I)) {
- EltTyConst = Constant::getNullValue(AI->getAllocatedType());
+ EltTyConst = UndefValue::get(AI->getAllocatedType());
AddressSpace = AI->getAddressSpace();
} else if (auto *GEP = dyn_cast<GetElementPtrInst>(I)) {
- EltTyConst = Constant::getNullValue(GEP->getResultElementType());
+ EltTyConst = UndefValue::get(GEP->getResultElementType());
AddressSpace = GEP->getPointerAddressSpace();
} else {
llvm_unreachable("Unexpected instruction!");
@@ -436,7 +436,7 @@ void SPIRVEmitIntrinsics::insertAssignTypeIntrs(Instruction *I) {
TypeToAssign = t->second->getType();
}
}
- Constant *Const = Constant::getNullValue(TypeToAssign);
+ Constant *Const = UndefValue::get(TypeToAssign);
buildIntrWithMD(Intrinsic::spv_assign_type, {Ty}, Const, I, {});
}
for (const auto &Op : I->operands()) {
diff --git a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
index b8a6784ff3c6..3a34a0bfae46 100644
--- a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
@@ -645,7 +645,7 @@ SPIRVType *SPIRVGlobalRegistry::findSPIRVType(
Register Reg = DT.find(Ty, &MIRBuilder.getMF());
if (Reg.isValid())
return getSPIRVTypeForVReg(Reg);
- if (ForwardPointerTypes.find(Ty) != ForwardPointerTypes.end())
+ if (ForwardPointerTypes.contains(Ty))
return ForwardPointerTypes[Ty];
return restOfCreateSPIRVType(Ty, MIRBuilder, AccQual, EmitIR);
}
@@ -712,14 +712,14 @@ SPIRVType *SPIRVGlobalRegistry::createSPIRVType(
// Null pointer means we have a loop in type definitions, make and
// return corresponding OpTypeForwardPointer.
if (SpvElementType == nullptr) {
- if (ForwardPointerTypes.find(Ty) == ForwardPointerTypes.end())
+ if (!ForwardPointerTypes.contains(Ty))
ForwardPointerTypes[PType] = getOpTypeForwardPointer(SC, MIRBuilder);
return ForwardPointerTypes[PType];
}
Register Reg(0);
// If we have forward pointer associated with this type, use its register
// operand to create OpTypePointer.
- if (ForwardPointerTypes.find(PType) != ForwardPointerTypes.end())
+ if (ForwardPointerTypes.contains(PType))
Reg = getSPIRVTypeID(ForwardPointerTypes[PType]);
return getOpTypePointer(SC, SpvElementType, MIRBuilder, Reg);
diff --git a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
index 779036016560..2a830535a2aa 100644
--- a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
@@ -391,7 +391,7 @@ void SPIRVModuleAnalysis::numberRegistersGlobally(const Module &M) {
if (MI.getOpcode() != SPIRV::OpExtInst)
continue;
auto Set = MI.getOperand(2).getImm();
- if (MAI.ExtInstSetMap.find(Set) == MAI.ExtInstSetMap.end())
+ if (!MAI.ExtInstSetMap.contains(Set))
MAI.ExtInstSetMap[Set] = Register::index2VirtReg(MAI.getNextID());
}
}
diff --git a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
index 5124181b49e2..d0b8027edd42 100644
--- a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
+++ b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
@@ -189,7 +189,7 @@ struct ModuleAnalysisInfo {
}
unsigned getNextID() { return MaxID++; }
bool hasMBBRegister(const MachineBasicBlock &MBB) {
- return BBNumToRegMap.find(MBB.getNumber()) != BBNumToRegMap.end();
+ return BBNumToRegMap.contains(MBB.getNumber());
}
// Convert MBB's number to corresponding ID register.
Register getOrCreateMBBRegister(const MachineBasicBlock &MBB) {
diff --git a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
index f4076be2a7b7..1bfce70fedc0 100644
--- a/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
@@ -83,7 +83,7 @@ static void addConstantsToTrack(MachineFunction &MF, SPIRVGlobalRegistry *GR) {
}
for (MachineInstr *MI : ToErase) {
Register Reg = MI->getOperand(2).getReg();
- if (RegsAlreadyAddedToDT.find(MI) != RegsAlreadyAddedToDT.end())
+ if (RegsAlreadyAddedToDT.contains(MI))
Reg = RegsAlreadyAddedToDT[MI];
auto *RC = MRI.getRegClassOrNull(MI->getOperand(0).getReg());
if (!MRI.getRegClassOrNull(Reg) && RC)
diff --git a/contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp b/contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
index e61b07e973e9..66555fa06b06 100644
--- a/contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
@@ -38,6 +38,7 @@ SystemZMCAsmInfoGOFF::SystemZMCAsmInfoGOFF(const Triple &TT) {
DotIsPC = false;
EmitGNUAsmStartIndentationMarker = false;
EmitLabelsInUpperCase = true;
+ ExceptionsType = ExceptionHandling::ZOS;
IsLittleEndian = false;
MaxInstLength = 6;
RestrictCommentStringToStartOfStatement = true;
diff --git a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index 3186002c57d9..243461c0316e 100644
--- a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -1115,7 +1115,7 @@ void SystemZAsmPrinter::emitFunctionBodyEnd() {
static void emitPPA1Flags(std::unique_ptr<MCStreamer> &OutStreamer, bool VarArg,
bool StackProtector, bool FPRMask, bool VRMask,
- bool HasName) {
+ bool EHBlock, bool HasName) {
enum class PPA1Flag1 : uint8_t {
DSA64Bit = (0x80 >> 0),
VarArg = (0x80 >> 7),
@@ -1133,6 +1133,7 @@ static void emitPPA1Flags(std::unique_ptr<MCStreamer> &OutStreamer, bool VarArg,
enum class PPA1Flag4 : uint8_t {
EPMOffsetPresent = (0x80 >> 0),
VRMask = (0x80 >> 2),
+ EHBlock = (0x80 >> 3),
ProcedureNamePresent = (0x80 >> 7),
LLVM_MARK_AS_BITMASK_ENUM(EPMOffsetPresent)
};
@@ -1158,6 +1159,9 @@ static void emitPPA1Flags(std::unique_ptr<MCStreamer> &OutStreamer, bool VarArg,
if (VRMask)
Flags4 |= PPA1Flag4::VRMask; // Add emit VR mask flag.
+ if (EHBlock)
+ Flags4 |= PPA1Flag4::EHBlock; // Add optional EH block.
+
if (HasName)
Flags4 |= PPA1Flag4::ProcedureNamePresent; // Add optional name block.
@@ -1188,6 +1192,8 @@ static void emitPPA1Flags(std::unique_ptr<MCStreamer> &OutStreamer, bool VarArg,
OutStreamer->AddComment("PPA1 Flags 4");
if ((Flags4 & PPA1Flag4::VRMask) == PPA1Flag4::VRMask)
OutStreamer->AddComment(" Bit 2: 1 = Vector Reg Mask is in optional area");
+ if ((Flags4 & PPA1Flag4::EHBlock) == PPA1Flag4::EHBlock)
+ OutStreamer->AddComment(" Bit 3: 1 = C++ EH block");
if ((Flags4 & PPA1Flag4::ProcedureNamePresent) ==
PPA1Flag4::ProcedureNamePresent)
OutStreamer->AddComment(" Bit 7: 1 = Name Length and Name");
@@ -1314,12 +1320,14 @@ void SystemZAsmPrinter::emitPPA1(MCSymbol *FnEndSym) {
OutStreamer->AddComment("Offset to PPA2");
OutStreamer->emitAbsoluteSymbolDiff(PPA2Sym, CurrentFnPPA1Sym, 4);
+ bool NeedEmitEHBlock = !MF->getLandingPads().empty();
+
bool HasName =
MF->getFunction().hasName() && MF->getFunction().getName().size() > 0;
emitPPA1Flags(OutStreamer, MF->getFunction().isVarArg(),
MFFrame.hasStackProtectorIndex(), SavedFPRMask != 0,
- TargetHasVector && SavedVRMask != 0, HasName);
+ TargetHasVector && SavedVRMask != 0, NeedEmitEHBlock, HasName);
OutStreamer->AddComment("Length/4 of Parms");
OutStreamer->emitInt16(
@@ -1361,6 +1369,29 @@ void SystemZAsmPrinter::emitPPA1(MCSymbol *FnEndSym) {
OutStreamer->emitInt32(FrameAndVROffset);
}
+ // Emit C++ EH information block
+ const Function *Per = nullptr;
+ if (NeedEmitEHBlock) {
+ Per = dyn_cast<Function>(
+ MF->getFunction().getPersonalityFn()->stripPointerCasts());
+ MCSymbol *PersonalityRoutine =
+ Per ? MF->getTarget().getSymbol(Per) : nullptr;
+ assert(PersonalityRoutine && "Missing personality routine");
+
+ OutStreamer->AddComment("Version");
+ OutStreamer->emitInt32(1);
+ OutStreamer->AddComment("Flags");
+ OutStreamer->emitInt32(0); // LSDA field is a WAS offset
+ OutStreamer->AddComment("Personality routine");
+ OutStreamer->emitInt64(ADATable.insert(
+ PersonalityRoutine, SystemZII::MO_ADA_INDIRECT_FUNC_DESC));
+ OutStreamer->AddComment("LSDA location");
+ MCSymbol *GCCEH = MF->getContext().getOrCreateSymbol(
+ Twine("GCC_except_table") + Twine(MF->getFunctionNumber()));
+ OutStreamer->emitInt64(
+ ADATable.insert(GCCEH, SystemZII::MO_ADA_DATA_SYMBOL_ADDR));
+ }
+
// Emit name length and name optional section (0x01 of flags 4)
if (HasName)
emitPPA1Name(OutStreamer, MF->getFunction().getName());
diff --git a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
index 7522998fd06d..db19c8881c68 100644
--- a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
@@ -17,6 +17,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
#include "llvm/IR/Function.h"
#include "llvm/Target/TargetMachine.h"
@@ -994,6 +995,11 @@ bool SystemZXPLINKFrameLowering::assignCalleeSavedSpillSlots(
if (hasFP(MF) || Subtarget.hasBackChain())
CSI.push_back(CalleeSavedInfo(Regs.getStackPointerRegister()));
+ // If this function has an associated personality function then the
+ // environment register R5 must be saved in the DSA.
+ if (!MF.getLandingPads().empty())
+ CSI.push_back(CalleeSavedInfo(Regs.getADARegister()));
+
// Scan the call-saved GPRs and find the bounds of the register spill area.
Register LowRestoreGPR = 0;
int LowRestoreOffset = INT32_MAX;
diff --git a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
index e5e1e91916f3..c7d8591c5bdf 100644
--- a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
@@ -465,7 +465,8 @@ bool SystemZDAGToDAGISel::expandAddress(SystemZAddressingMode &AM,
bool IsBase) const {
SDValue N = IsBase ? AM.Base : AM.Index;
unsigned Opcode = N.getOpcode();
- if (Opcode == ISD::TRUNCATE) {
+ // Look through no-op truncations.
+ if (Opcode == ISD::TRUNCATE && N.getOperand(0).getValueSizeInBits() <= 64) {
N = N.getOperand(0);
Opcode = N.getOpcode();
}
diff --git a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index a1803cf9a042..559f2ca476d7 100644
--- a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -1362,6 +1362,16 @@ SystemZTargetLowering::getRegisterByName(const char *RegName, LLT VT,
report_fatal_error("Invalid register name global variable");
}
+Register SystemZTargetLowering::getExceptionPointerRegister(
+ const Constant *PersonalityFn) const {
+ return Subtarget.isTargetXPLINK64() ? SystemZ::R1D : SystemZ::R6D;
+}
+
+Register SystemZTargetLowering::getExceptionSelectorRegister(
+ const Constant *PersonalityFn) const {
+ return Subtarget.isTargetXPLINK64() ? SystemZ::R2D : SystemZ::R7D;
+}
+
void SystemZTargetLowering::LowerAsmOperandForConstraint(
SDValue Op, StringRef Constraint, std::vector<SDValue> &Ops,
SelectionDAG &DAG) const {
diff --git a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.h b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.h
index 6b3ce3f8c1d2..baf4ba416548 100644
--- a/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.h
+++ b/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.h
@@ -555,16 +555,12 @@ public:
/// If a physical register, this returns the register that receives the
/// exception address on entry to an EH pad.
Register
- getExceptionPointerRegister(const Constant *PersonalityFn) const override {
- return SystemZ::R6D;
- }
+ getExceptionPointerRegister(const Constant *PersonalityFn) const override;
/// If a physical register, this returns the register that receives the
/// exception typeid on entry to a landing pad.
Register
- getExceptionSelectorRegister(const Constant *PersonalityFn) const override {
- return SystemZ::R7D;
- }
+ getExceptionSelectorRegister(const Constant *PersonalityFn) const override;
/// Override to support customized stack guard loading.
bool useLoadStackGuardNode() const override {
diff --git a/contrib/llvm-project/llvm/lib/Target/TargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/TargetMachine.cpp
index 3f96bd37755e..2a4383314e46 100644
--- a/contrib/llvm-project/llvm/lib/Target/TargetMachine.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/TargetMachine.cpp
@@ -61,8 +61,6 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) const {
// We should properly mark well-known section name prefixes as small/large,
// because otherwise the output section may have the wrong section flags and
// the linker will lay it out in an unexpected way.
- // TODO: bring back lbss/ldata/lrodata checks after fixing accesses to large
- // globals in the small code model.
StringRef Name = GV->getSection();
if (!Name.empty()) {
auto IsPrefix = [&](StringRef Prefix) {
@@ -71,6 +69,8 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) const {
};
if (IsPrefix(".bss") || IsPrefix(".data") || IsPrefix(".rodata"))
return false;
+ if (IsPrefix(".lbss") || IsPrefix(".ldata") || IsPrefix(".lrodata"))
+ return true;
}
// For x86-64, we treat an explicit GlobalVariable small code model to mean
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/contrib/llvm-project/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index e78d16056460..bc5f562d9589 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -263,8 +263,7 @@ private:
return 0;
SmallVector<ICToken, 16> OperandStack;
- for (unsigned i = 0, e = PostfixStack.size(); i != e; ++i) {
- ICToken Op = PostfixStack[i];
+ for (const ICToken &Op : PostfixStack) {
if (Op.first == IC_IMM || Op.first == IC_REGISTER) {
OperandStack.push_back(Op);
} else if (isUnaryOperator(Op.first)) {
@@ -1731,8 +1730,8 @@ bool X86AsmParser::VerifyAndAdjustOperands(OperandVector &OrigOperands,
OrigOperands.pop_back();
}
// OrigOperands.append(FinalOperands.begin(), FinalOperands.end());
- for (unsigned int i = 0; i < FinalOperands.size(); ++i)
- OrigOperands.push_back(std::move(FinalOperands[i]));
+ for (auto &Op : FinalOperands)
+ OrigOperands.push_back(std::move(Op));
return false;
}
@@ -3062,6 +3061,35 @@ bool X86AsmParser::ParseMemOperand(unsigned SegReg, const MCExpr *Disp,
ErrMsg))
return Error(BaseLoc, ErrMsg);
+ // If the displacement is a constant, check overflows. For 64-bit addressing,
+ // gas requires isInt<32> and otherwise reports an error. For others, gas
+ // reports a warning and allows a wider range. E.g. gas allows
+ // [-0xffffffff,0xffffffff] for 32-bit addressing (e.g. Linux kernel uses
+ // `leal -__PAGE_OFFSET(%ecx),%esp` where __PAGE_OFFSET is 0xc0000000).
+ if (BaseReg || IndexReg) {
+ if (auto CE = dyn_cast<MCConstantExpr>(Disp)) {
+ auto Imm = CE->getValue();
+ bool Is64 = X86MCRegisterClasses[X86::GR64RegClassID].contains(BaseReg) ||
+ X86MCRegisterClasses[X86::GR64RegClassID].contains(IndexReg);
+ bool Is16 = X86MCRegisterClasses[X86::GR16RegClassID].contains(BaseReg);
+ if (Is64) {
+ if (!isInt<32>(Imm))
+ return Error(BaseLoc, "displacement " + Twine(Imm) +
+ " is not within [-2147483648, 2147483647]");
+ } else if (!Is16) {
+ if (!isUInt<32>(Imm < 0 ? -uint64_t(Imm) : uint64_t(Imm))) {
+ Warning(BaseLoc, "displacement " + Twine(Imm) +
+ " shortened to 32-bit signed " +
+ Twine(static_cast<int32_t>(Imm)));
+ }
+ } else if (!isUInt<16>(Imm < 0 ? -uint64_t(Imm) : uint64_t(Imm))) {
+ Warning(BaseLoc, "displacement " + Twine(Imm) +
+ " shortened to 16-bit signed " +
+ Twine(static_cast<int16_t>(Imm)));
+ }
+ }
+ }
+
if (SegReg || BaseReg || IndexReg)
Operands.push_back(X86Operand::CreateMem(getPointerWidth(), SegReg, Disp,
BaseReg, IndexReg, Scale, StartLoc,
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/contrib/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
index b6ebbcf56aef..9e1f1eb97e70 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
@@ -1060,7 +1060,7 @@ X86MCCodeEmitter::emitVEXOpcodePrefix(int MemOperand, const MCInst &MI,
Prefix.setBB2(MI, MemOperand + X86::AddrBaseReg);
Prefix.setXX2(MI, MemOperand + X86::AddrIndexReg);
CurOp += X86::AddrNumOperands;
- Prefix.set4V(MI, CurOp++);
+ Prefix.set4VV2(MI, CurOp++);
break;
}
case X86II::MRM_C0:
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86FastISel.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86FastISel.cpp
index 7f134fe1c72b..0ba31e173a1a 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86FastISel.cpp
@@ -1306,8 +1306,8 @@ bool X86FastISel::X86SelectRet(const Instruction *I) {
MIB = BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD,
TII.get(Subtarget->is64Bit() ? X86::RET64 : X86::RET32));
}
- for (unsigned i = 0, e = RetRegs.size(); i != e; ++i)
- MIB.addReg(RetRegs[i], RegState::Implicit);
+ for (unsigned Reg : RetRegs)
+ MIB.addReg(Reg, RegState::Implicit);
return true;
}
@@ -3346,8 +3346,7 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) {
// Walk the register/memloc assignments, inserting copies/loads.
const X86RegisterInfo *RegInfo = Subtarget->getRegisterInfo();
- for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
- CCValAssign const &VA = ArgLocs[i];
+ for (const CCValAssign &VA : ArgLocs) {
const Value *ArgVal = OutVals[VA.getValNo()];
MVT ArgVT = OutVTs[VA.getValNo()];
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp
index aab2535aa86d..ca4d03913d09 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp
@@ -462,8 +462,7 @@ bool FPS::processBasicBlock(MachineFunction &MF, MachineBasicBlock &BB) {
// Check to see if any of the values defined by this instruction are dead
// after definition. If so, pop them.
- for (unsigned i = 0, e = DeadRegs.size(); i != e; ++i) {
- unsigned Reg = DeadRegs[i];
+ for (unsigned Reg : DeadRegs) {
// Check if Reg is live on the stack. An inline-asm register operand that
// is in the clobber list and marked dead might not be live on the stack.
static_assert(X86::FP7 - X86::FP0 == 7, "sequential FP regnumbers");
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 7ec59c74f5f5..77a997588c4f 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -1828,9 +1828,7 @@ bool X86DAGToDAGISel::matchWrapper(SDValue N, X86ISelAddressMode &AM) {
// That signifies access to globals that are known to be "near",
// such as the GOT itself.
CodeModel::Model M = TM.getCodeModel();
- if (Subtarget->is64Bit() &&
- ((M == CodeModel::Large && !IsRIPRelTLS) ||
- (M == CodeModel::Medium && !IsRIPRel)))
+ if (Subtarget->is64Bit() && M == CodeModel::Large && !IsRIPRelTLS)
return true;
// Base and index reg must be 0 in order to use %rip as base.
@@ -1866,6 +1864,13 @@ bool X86DAGToDAGISel::matchWrapper(SDValue N, X86ISelAddressMode &AM) {
} else
llvm_unreachable("Unhandled symbol reference node.");
+ // Can't use an addressing mode with large globals.
+ if (Subtarget->is64Bit() && !IsRIPRel && AM.GV &&
+ TM.isLargeGlobalValue(AM.GV)) {
+ AM = Backup;
+ return true;
+ }
+
if (foldOffsetIntoAddress(Offset, AM)) {
AM = Backup;
return true;
@@ -1910,20 +1915,12 @@ bool X86DAGToDAGISel::matchAddress(SDValue N, X86ISelAddressMode &AM) {
// Post-processing: Convert foo to foo(%rip), even in non-PIC mode,
// because it has a smaller encoding.
- // TODO: Which other code models can use this?
- switch (TM.getCodeModel()) {
- default: break;
- case CodeModel::Small:
- case CodeModel::Kernel:
- if (Subtarget->is64Bit() &&
- AM.Scale == 1 &&
- AM.BaseType == X86ISelAddressMode::RegBase &&
- AM.Base_Reg.getNode() == nullptr &&
- AM.IndexReg.getNode() == nullptr &&
- AM.SymbolFlags == X86II::MO_NO_FLAG &&
- AM.hasSymbolicDisplacement())
- AM.Base_Reg = CurDAG->getRegister(X86::RIP, MVT::i64);
- break;
+ if (TM.getCodeModel() != CodeModel::Large &&
+ (!AM.GV || !TM.isLargeGlobalValue(AM.GV)) && Subtarget->is64Bit() &&
+ AM.Scale == 1 && AM.BaseType == X86ISelAddressMode::RegBase &&
+ AM.Base_Reg.getNode() == nullptr && AM.IndexReg.getNode() == nullptr &&
+ AM.SymbolFlags == X86II::MO_NO_FLAG && AM.hasSymbolicDisplacement()) {
+ AM.Base_Reg = CurDAG->getRegister(X86::RIP, MVT::i64);
}
return false;
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
index b80c766c7ffa..63bdf24d6b4f 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -2674,34 +2674,33 @@ SDValue X86TargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) const {
return DAG.getFrameIndex(ReturnAddrIndex, getPointerTy(DAG.getDataLayout()));
}
-bool X86::isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M,
- bool hasSymbolicDisplacement) {
+bool X86::isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model CM,
+ bool HasSymbolicDisplacement) {
// Offset should fit into 32 bit immediate field.
if (!isInt<32>(Offset))
return false;
// If we don't have a symbolic displacement - we don't have any extra
// restrictions.
- if (!hasSymbolicDisplacement)
+ if (!HasSymbolicDisplacement)
return true;
- // FIXME: Some tweaks might be needed for medium code model.
- if (M != CodeModel::Small && M != CodeModel::Kernel)
- return false;
-
- // For small code model we assume that latest object is 16MB before end of 31
- // bits boundary. We may also accept pretty large negative constants knowing
- // that all objects are in the positive half of address space.
- if (M == CodeModel::Small && Offset < 16*1024*1024)
+ // We can fold large offsets in the large code model because we always use
+ // 64-bit offsets.
+ if (CM == CodeModel::Large)
return true;
// For kernel code model we know that all object resist in the negative half
// of 32bits address space. We may not accept negative offsets, since they may
// be just off and we may accept pretty large positive ones.
- if (M == CodeModel::Kernel && Offset >= 0)
- return true;
+ if (CM == CodeModel::Kernel)
+ return Offset >= 0;
- return false;
+ // For other non-large code models we assume that latest small object is 16MB
+ // before end of 31 bits boundary. We may also accept pretty large negative
+ // constants knowing that all objects are in the positive half of address
+ // space.
+ return Offset < 16 * 1024 * 1024;
}
/// Return true if the condition is an signed comparison operation.
@@ -4554,7 +4553,7 @@ static SDValue getShuffleVectorZeroOrUndef(SDValue V2, int Idx,
return DAG.getVectorShuffle(VT, SDLoc(V2), V1, V2, MaskVec);
}
-static const ConstantPoolSDNode *getTargetConstantPoolFromBasePtr(SDValue Ptr) {
+static ConstantPoolSDNode *getTargetConstantPoolFromBasePtr(SDValue Ptr) {
if (Ptr.getOpcode() == X86ISD::Wrapper ||
Ptr.getOpcode() == X86ISD::WrapperRIP)
Ptr = Ptr.getOperand(0);
@@ -4562,7 +4561,7 @@ static const ConstantPoolSDNode *getTargetConstantPoolFromBasePtr(SDValue Ptr) {
}
static const Constant *getTargetConstantFromBasePtr(SDValue Ptr) {
- const ConstantPoolSDNode *CNode = getTargetConstantPoolFromBasePtr(Ptr);
+ ConstantPoolSDNode *CNode = getTargetConstantPoolFromBasePtr(Ptr);
if (!CNode || CNode->isMachineConstantPoolEntry() || CNode->getOffset() != 0)
return nullptr;
return CNode->getConstVal();
@@ -7563,8 +7562,7 @@ static SDValue LowerBUILD_VECTORvXi1(SDValue Op, SelectionDAG &DAG,
} else
DstVec = DAG.getUNDEF(VT);
- for (unsigned i = 0, e = NonConstIdx.size(); i != e; ++i) {
- unsigned InsertIdx = NonConstIdx[i];
+ for (unsigned InsertIdx : NonConstIdx) {
DstVec = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, VT, DstVec,
Op.getOperand(InsertIdx),
DAG.getIntPtrConstant(InsertIdx, dl));
@@ -40857,7 +40855,7 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetShuffle(
SDValue BC = peekThroughOneUseBitcasts(Mask);
EVT BCVT = BC.getValueType();
auto *Load = dyn_cast<LoadSDNode>(BC);
- if (!Load)
+ if (!Load || !Load->getBasePtr().hasOneUse())
return false;
const Constant *C = getTargetConstantFromNode(Load);
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InsertPrefetch.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86InsertPrefetch.cpp
index 3e11ab2d98a4..6c23928228d2 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InsertPrefetch.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InsertPrefetch.cpp
@@ -69,8 +69,8 @@ using PrefetchHints = SampleRecord::CallTargetMap;
// Return any prefetching hints for the specified MachineInstruction. The hints
// are returned as pairs (name, delta).
-ErrorOr<PrefetchHints> getPrefetchHints(const FunctionSamples *TopSamples,
- const MachineInstr &MI) {
+ErrorOr<const PrefetchHints &>
+getPrefetchHints(const FunctionSamples *TopSamples, const MachineInstr &MI) {
if (const auto &Loc = MI.getDebugLoc())
if (const auto *Samples = TopSamples->findFunctionSamples(Loc))
return Samples->findCallTargetMapAt(FunctionSamples::getOffset(Loc),
@@ -123,7 +123,7 @@ bool X86InsertPrefetch::findPrefetchInfo(const FunctionSamples *TopSamples,
};
static const char *SerializedPrefetchPrefix = "__prefetch";
- const ErrorOr<PrefetchHints> T = getPrefetchHints(TopSamples, MI);
+ auto T = getPrefetchHints(TopSamples, MI);
if (!T)
return false;
int16_t max_index = -1;
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAMX.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAMX.td
index 2dbb3e5ee316..7f3e193d9a1b 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAMX.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAMX.td
@@ -20,32 +20,32 @@ let Predicates = [HasAMXTILE, In64BitMode] in {
Defs = [TMM0,TMM1,TMM2,TMM3,TMM4,TMM5,TMM6,TMM7] in
def LDTILECFG : I <0x49, MRM0m, (outs), (ins opaquemem:$src),
"ldtilecfg\t$src",
- [(int_x86_ldtilecfg addr:$src)]>, VEX, T8PS;
+ [(int_x86_ldtilecfg addr:$src)]>, VEX, T8;
let hasSideEffects = 1 in
def STTILECFG : I <0x49, MRM0m, (outs), (ins opaquemem:$src),
"sttilecfg\t$src",
- [(int_x86_sttilecfg addr:$src)]>, VEX, T8PD;
+ [(int_x86_sttilecfg addr:$src)]>, VEX, T8, PD;
let mayLoad = 1 in
def TILELOADD : I<0x4b, MRMSrcMemFSIB, (outs TILE:$dst),
(ins sibmem:$src),
"tileloadd\t{$src, $dst|$dst, $src}", []>,
- VEX, T8XD;
+ VEX, T8, XD;
let mayLoad = 1 in
def TILELOADDT1 : I<0x4b, MRMSrcMemFSIB, (outs TILE:$dst),
(ins sibmem:$src),
"tileloaddt1\t{$src, $dst|$dst, $src}", []>,
- VEX, T8PD;
+ VEX, T8, PD;
let Defs = [TMM0,TMM1,TMM2,TMM3,TMM4,TMM5,TMM6,TMM7] in
def TILERELEASE : I<0x49, MRM_C0, (outs), (ins),
- "tilerelease", [(int_x86_tilerelease)]>, VEX, T8PS;
+ "tilerelease", [(int_x86_tilerelease)]>, VEX, T8;
let mayStore = 1 in
def TILESTORED : I<0x4b, MRMDestMemFSIB, (outs),
(ins sibmem:$dst, TILE:$src),
"tilestored\t{$src, $dst|$dst, $src}", []>,
- VEX, T8XS;
+ VEX, T8, XS;
def TILEZERO : I<0x49, MRMr0, (outs TILE:$dst), (ins),
"tilezero\t$dst", []>,
- VEX, T8XD;
+ VEX, T8, XD;
// Pseduo instruction for RA.
let isPseudo = true, mayLoad = 1, hasSideEffects = 1,
@@ -91,19 +91,19 @@ let Predicates = [HasAMXINT8, In64BitMode] in {
def TDPBSSD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tdpbssd\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
- VEX_4V, T8XD;
+ VEX, VVVV, T8, XD;
def TDPBSUD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tdpbsud\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
- VEX_4V, T8XS;
+ VEX, VVVV, T8, XS;
def TDPBUSD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tdpbusd\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
- VEX_4V, T8PD;
+ VEX, VVVV, T8, PD;
def TDPBUUD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tdpbuud\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
- VEX_4V, T8PS;
+ VEX, VVVV, T8;
}
// Pseduo instruction for RA.
@@ -163,7 +163,7 @@ let Predicates = [HasAMXBF16, In64BitMode] in {
def TDPBF16PS : I<0x5c, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tdpbf16ps\t{$src3, $src2, $dst|$dst, $src2, $src3}",
- []>, VEX_4V, T8XS;
+ []>, VEX, VVVV, T8, XS;
// Pseduo instruction for RA.
let isPseudo = true, Constraints = "$src4 = $dst" in
@@ -193,7 +193,7 @@ let Predicates = [HasAMXFP16, In64BitMode] in {
def TDPFP16PS : I<0x5c, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tdpfp16ps\t{$src3, $src2, $src1|$src1, $src2, $src3}",
- []>, VEX_4V, T8XD;
+ []>, VEX, VVVV, T8, XD;
}
// Pseduo instruction for RA.
@@ -222,11 +222,11 @@ let Predicates = [HasAMXCOMPLEX, In64BitMode] in {
def TCMMIMFP16PS : I<0x6c, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tcmmimfp16ps\t{$src3, $src2, $src1|$src1, $src2, $src3}",
- []>, T8PD, VEX_4V;
+ []>, T8, PD, VEX, VVVV;
def TCMMRLFP16PS : I<0x6c, MRMSrcReg4VOp3, (outs TILE:$dst),
(ins TILE:$src1, TILE:$src2, TILE:$src3),
"tcmmrlfp16ps\t{$src3, $src2, $src1|$src1, $src2, $src3}",
- []>, VEX_4V, WIG, T8PS;
+ []>, VEX, VVVV, WIG, T8;
} // Constraints = "$src1 = $dst"
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAVX512.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAVX512.td
index e1fe2b680b96..7c3c1d5fe42b 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAVX512.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAVX512.td
@@ -378,7 +378,7 @@ multiclass vinsert_for_size_split<int Opcode, X86VectorVTInfo From,
(vinsert_for_mask:$src3 (To.VT To.RC:$src1),
(From.VT From.RC:$src2),
(iPTR imm))>,
- AVX512AIi8Base, EVEX_4V, Sched<[sched]>;
+ AVX512AIi8Base, EVEX, VVVV, Sched<[sched]>;
let mayLoad = 1 in
defm rm : AVX512_maskable_split<Opcode, MRMSrcMem, To, (outs To.RC:$dst),
(ins To.RC:$src1, From.MemOp:$src2, u8imm:$src3),
@@ -389,7 +389,7 @@ multiclass vinsert_for_size_split<int Opcode, X86VectorVTInfo From,
(iPTR imm)),
(vinsert_for_mask:$src3 (To.VT To.RC:$src1),
(From.VT (From.LdFrag addr:$src2)),
- (iPTR imm))>, AVX512AIi8Base, EVEX_4V,
+ (iPTR imm))>, AVX512AIi8Base, EVEX, VVVV,
EVEX_CD8<From.EltSize, From.CD8TupleForm>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -647,14 +647,14 @@ def VINSERTPSZrr : AVX512AIi8<0x21, MRMSrcReg, (outs VR128X:$dst),
(ins VR128X:$src1, VR128X:$src2, u8imm:$src3),
"vinsertps\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
[(set VR128X:$dst, (X86insertps VR128X:$src1, VR128X:$src2, timm:$src3))]>,
- EVEX_4V, Sched<[SchedWriteFShuffle.XMM]>;
+ EVEX, VVVV, Sched<[SchedWriteFShuffle.XMM]>;
def VINSERTPSZrm: AVX512AIi8<0x21, MRMSrcMem, (outs VR128X:$dst),
(ins VR128X:$src1, f32mem:$src2, u8imm:$src3),
"vinsertps\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
[(set VR128X:$dst, (X86insertps VR128X:$src1,
(v4f32 (scalar_to_vector (loadf32 addr:$src2))),
timm:$src3))]>,
- EVEX_4V, EVEX_CD8<32, CD8VT1>,
+ EVEX, VVVV, EVEX_CD8<32, CD8VT1>,
Sched<[SchedWriteFShuffle.XMM.Folded, SchedWriteFShuffle.XMM.ReadAfterFold]>;
}
@@ -1039,7 +1039,7 @@ multiclass avx512_broadcast_rm_split<bits<8> opc, string OpcodeStr,
(bitconvert
(DestInfo.VT
(UnmaskedOp (SrcInfo.VT SrcInfo.RC:$src))))))],
- DestInfo.ExeDomain>, T8PD, EVEX, Sched<[SchedRR]>;
+ DestInfo.ExeDomain>, T8, PD, EVEX, Sched<[SchedRR]>;
def rrkz : AVX512PI<opc, MRMSrcReg, (outs MaskInfo.RC:$dst),
(ins MaskInfo.KRCWM:$mask, SrcInfo.RC:$src),
!strconcat(OpcodeStr, "\t{$src, ${dst} {${mask}} {z}|",
@@ -1051,7 +1051,7 @@ multiclass avx512_broadcast_rm_split<bits<8> opc, string OpcodeStr,
(DestInfo.VT
(X86VBroadcast (SrcInfo.VT SrcInfo.RC:$src))))),
MaskInfo.ImmAllZerosV))],
- DestInfo.ExeDomain>, T8PD, EVEX, EVEX_KZ, Sched<[SchedRR]>;
+ DestInfo.ExeDomain>, T8, PD, EVEX, EVEX_KZ, Sched<[SchedRR]>;
let Constraints = "$src0 = $dst" in
def rrk : AVX512PI<opc, MRMSrcReg, (outs MaskInfo.RC:$dst),
(ins MaskInfo.RC:$src0, MaskInfo.KRCWM:$mask,
@@ -1065,7 +1065,7 @@ multiclass avx512_broadcast_rm_split<bits<8> opc, string OpcodeStr,
(DestInfo.VT
(X86VBroadcast (SrcInfo.VT SrcInfo.RC:$src))))),
MaskInfo.RC:$src0))],
- DestInfo.ExeDomain>, T8PD, EVEX, EVEX_K, Sched<[SchedRR]>;
+ DestInfo.ExeDomain>, T8, PD, EVEX, EVEX_K, Sched<[SchedRR]>;
let hasSideEffects = 0, mayLoad = 1 in
def rm : AVX512PI<opc, MRMSrcMem, (outs MaskInfo.RC:$dst),
@@ -1076,7 +1076,7 @@ multiclass avx512_broadcast_rm_split<bits<8> opc, string OpcodeStr,
(bitconvert
(DestInfo.VT
(UnmaskedBcastOp addr:$src)))))],
- DestInfo.ExeDomain>, T8PD, EVEX,
+ DestInfo.ExeDomain>, T8, PD, EVEX,
EVEX_CD8<SrcInfo.EltSize, CD8VT1>, Sched<[SchedRM]>;
def rmkz : AVX512PI<opc, MRMSrcMem, (outs MaskInfo.RC:$dst),
@@ -1090,7 +1090,7 @@ multiclass avx512_broadcast_rm_split<bits<8> opc, string OpcodeStr,
(DestInfo.VT
(SrcInfo.BroadcastLdFrag addr:$src)))),
MaskInfo.ImmAllZerosV))],
- DestInfo.ExeDomain>, T8PD, EVEX, EVEX_KZ,
+ DestInfo.ExeDomain>, T8, PD, EVEX, EVEX_KZ,
EVEX_CD8<SrcInfo.EltSize, CD8VT1>, Sched<[SchedRM]>;
let Constraints = "$src0 = $dst",
@@ -1107,7 +1107,7 @@ multiclass avx512_broadcast_rm_split<bits<8> opc, string OpcodeStr,
(DestInfo.VT
(SrcInfo.BroadcastLdFrag addr:$src)))),
MaskInfo.RC:$src0))],
- DestInfo.ExeDomain>, T8PD, EVEX, EVEX_K,
+ DestInfo.ExeDomain>, T8, PD, EVEX, EVEX_K,
EVEX_CD8<SrcInfo.EltSize, CD8VT1>, Sched<[SchedRM]>;
}
@@ -1173,7 +1173,7 @@ multiclass avx512_int_broadcast_reg<bits<8> opc, SchedWrite SchedRR,
"vpbroadcast"#_.Suffix, "$src", "$src",
(_.VT (OpNode SrcRC:$src)), /*IsCommutable*/0,
/*IsKCommutable*/0, /*IsKZCommutable*/0, vselect>,
- T8PD, EVEX, Sched<[SchedRR]>;
+ T8, PD, EVEX, Sched<[SchedRR]>;
}
multiclass avx512_int_broadcastbw_reg<bits<8> opc, string Name, SchedWrite SchedRR,
@@ -1185,7 +1185,7 @@ multiclass avx512_int_broadcastbw_reg<bits<8> opc, string Name, SchedWrite Sched
!con((ins _.RC:$src0, _.KRCWM:$mask), (ins GR32:$src)),
!con((ins _.KRCWM:$mask), (ins GR32:$src)),
"vpbroadcast"#_.Suffix, "$src", "$src", [], [], [],
- "$src0 = $dst">, T8PD, EVEX, Sched<[SchedRR]>;
+ "$src0 = $dst">, T8, PD, EVEX, Sched<[SchedRR]>;
def : Pat <(_.VT (OpNode SrcRC:$src)),
(!cast<Instruction>(Name#rr)
@@ -1593,7 +1593,7 @@ let Constraints = "$src1 = $dst", ExeDomain = _.ExeDomain,
(ins _.RC:$src2, _.RC:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (X86VPermt2 _.RC:$src2, IdxVT.RC:$src1, _.RC:$src3)), 1>,
- EVEX_4V, AVX5128IBase, Sched<[sched]>;
+ EVEX, VVVV, AVX5128IBase, Sched<[sched]>;
let mayLoad = 1 in
defm rm: AVX512_maskable_3src_cast<opc, MRMSrcMem, _, IdxVT, (outs _.RC:$dst),
@@ -1601,7 +1601,7 @@ let Constraints = "$src1 = $dst", ExeDomain = _.ExeDomain,
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (X86VPermt2 _.RC:$src2, IdxVT.RC:$src1,
(_.VT (_.LdFrag addr:$src3)))), 1>,
- EVEX_4V, AVX5128IBase, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, AVX5128IBase, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -1616,7 +1616,7 @@ multiclass avx512_perm_i_mb<bits<8> opc, string OpcodeStr,
!strconcat("$src2, ${src3}", _.BroadcastStr ),
(_.VT (X86VPermt2 _.RC:$src2,
IdxVT.RC:$src1,(_.VT (_.BroadcastLdFrag addr:$src3)))), 1>,
- AVX5128IBase, EVEX_4V, EVEX_B,
+ AVX5128IBase, EVEX, VVVV, EVEX_B,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -1715,14 +1715,14 @@ let Constraints = "$src1 = $dst", ExeDomain = _.ExeDomain in {
(ins IdxVT.RC:$src2, _.RC:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (X86VPermt2 _.RC:$src1, IdxVT.RC:$src2, _.RC:$src3)), 1>,
- EVEX_4V, AVX5128IBase, Sched<[sched]>;
+ EVEX, VVVV, AVX5128IBase, Sched<[sched]>;
defm rm: AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins IdxVT.RC:$src2, _.MemOp:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (X86VPermt2 _.RC:$src1, IdxVT.RC:$src2,
(_.LdFrag addr:$src3))), 1>,
- EVEX_4V, AVX5128IBase, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, AVX5128IBase, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
multiclass avx512_perm_t_mb<bits<8> opc, string OpcodeStr,
@@ -1735,7 +1735,7 @@ multiclass avx512_perm_t_mb<bits<8> opc, string OpcodeStr,
!strconcat("$src2, ${src3}", _.BroadcastStr ),
(_.VT (X86VPermt2 _.RC:$src1,
IdxVT.RC:$src2,(_.VT (_.BroadcastLdFrag addr:$src3)))), 1>,
- AVX5128IBase, EVEX_4V, EVEX_B,
+ AVX5128IBase, EVEX, VVVV, EVEX_B,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -1800,35 +1800,35 @@ multiclass WriteFVarBlendask<bits<8> opc, string OpcodeStr,
(ins _.RC:$src1, _.RC:$src2),
!strconcat(OpcodeStr,
"\t{$src2, $src1, ${dst}|${dst}, $src1, $src2}"), []>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
def rrk : AVX5128I<opc, MRMSrcReg, (outs _.RC:$dst),
(ins _.KRCWM:$mask, _.RC:$src1, _.RC:$src2),
!strconcat(OpcodeStr,
"\t{$src2, $src1, ${dst} {${mask}}|${dst} {${mask}}, $src1, $src2}"),
- []>, EVEX_4V, EVEX_K, Sched<[sched]>;
+ []>, EVEX, VVVV, EVEX_K, Sched<[sched]>;
def rrkz : AVX5128I<opc, MRMSrcReg, (outs _.RC:$dst),
(ins _.KRCWM:$mask, _.RC:$src1, _.RC:$src2),
!strconcat(OpcodeStr,
"\t{$src2, $src1, ${dst} {${mask}} {z}|${dst} {${mask}} {z}, $src1, $src2}"),
- []>, EVEX_4V, EVEX_KZ, Sched<[sched]>;
+ []>, EVEX, VVVV, EVEX_KZ, Sched<[sched]>;
let mayLoad = 1 in {
def rm : AVX5128I<opc, MRMSrcMem, (outs _.RC:$dst),
(ins _.RC:$src1, _.MemOp:$src2),
!strconcat(OpcodeStr,
"\t{$src2, $src1, ${dst}|${dst}, $src1, $src2}"),
- []>, EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ []>, EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
def rmk : AVX5128I<opc, MRMSrcMem, (outs _.RC:$dst),
(ins _.KRCWM:$mask, _.RC:$src1, _.MemOp:$src2),
!strconcat(OpcodeStr,
"\t{$src2, $src1, ${dst} {${mask}}|${dst} {${mask}}, $src1, $src2}"),
- []>, EVEX_4V, EVEX_K, EVEX_CD8<_.EltSize, CD8VF>,
+ []>, EVEX, VVVV, EVEX_K, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
def rmkz : AVX5128I<opc, MRMSrcMem, (outs _.RC:$dst),
(ins _.KRCWM:$mask, _.RC:$src1, _.MemOp:$src2),
!strconcat(OpcodeStr,
"\t{$src2, $src1, ${dst} {${mask}} {z}|${dst} {${mask}} {z}, $src1, $src2}"),
- []>, EVEX_4V, EVEX_KZ, EVEX_CD8<_.EltSize, CD8VF>,
+ []>, EVEX, VVVV, EVEX_KZ, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -1841,7 +1841,7 @@ multiclass WriteFVarBlendask_rmb<bits<8> opc, string OpcodeStr,
!strconcat(OpcodeStr,
"\t{${src2}", _.BroadcastStr, ", $src1, $dst {${mask}}|",
"$dst {${mask}}, $src1, ${src2}", _.BroadcastStr, "}"), []>,
- EVEX_4V, EVEX_K, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
+ EVEX, VVVV, EVEX_K, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
def rmbkz : AVX5128I<opc, MRMSrcMem, (outs _.RC:$dst),
@@ -1849,7 +1849,7 @@ multiclass WriteFVarBlendask_rmb<bits<8> opc, string OpcodeStr,
!strconcat(OpcodeStr,
"\t{${src2}", _.BroadcastStr, ", $src1, $dst {${mask}} {z}|",
"$dst {${mask}} {z}, $src1, ${src2}", _.BroadcastStr, "}"), []>,
- EVEX_4V, EVEX_KZ, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
+ EVEX, VVVV, EVEX_KZ, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
def rmb : AVX5128I<opc, MRMSrcMem, (outs _.RC:$dst),
@@ -1857,7 +1857,7 @@ multiclass WriteFVarBlendask_rmb<bits<8> opc, string OpcodeStr,
!strconcat(OpcodeStr,
"\t{${src2}", _.BroadcastStr, ", $src1, $dst|",
"$dst, $src1, ${src2}", _.BroadcastStr, "}"), []>,
- EVEX_4V, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
+ EVEX, VVVV, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -1921,7 +1921,7 @@ multiclass avx512_cmp_scalar<X86VectorVTInfo _, SDNode OpNode, SDNode OpNodeSAE,
"$cc, $src2, $src1", "$src1, $src2, $cc",
(OpNode (_.VT _.RC:$src1), (_.VT _.RC:$src2), timm:$cc),
(OpNode_su (_.VT _.RC:$src1), (_.VT _.RC:$src2),
- timm:$cc)>, EVEX_4V, VEX_LIG, Sched<[sched]>, SIMD_EXC;
+ timm:$cc)>, EVEX, VVVV, VEX_LIG, Sched<[sched]>, SIMD_EXC;
let mayLoad = 1 in
defm rm_Int : AVX512_maskable_cmp<0xC2, MRMSrcMem, _,
(outs _.KRC:$dst),
@@ -1931,7 +1931,7 @@ multiclass avx512_cmp_scalar<X86VectorVTInfo _, SDNode OpNode, SDNode OpNodeSAE,
(OpNode (_.VT _.RC:$src1), (_.ScalarIntMemFrags addr:$src2),
timm:$cc),
(OpNode_su (_.VT _.RC:$src1), (_.ScalarIntMemFrags addr:$src2),
- timm:$cc)>, EVEX_4V, VEX_LIG, EVEX_CD8<_.EltSize, CD8VT1>,
+ timm:$cc)>, EVEX, VVVV, VEX_LIG, EVEX_CD8<_.EltSize, CD8VT1>,
Sched<[sched.Folded, sched.ReadAfterFold]>, SIMD_EXC;
let Uses = [MXCSR] in
@@ -1944,7 +1944,7 @@ multiclass avx512_cmp_scalar<X86VectorVTInfo _, SDNode OpNode, SDNode OpNodeSAE,
timm:$cc),
(OpNodeSAE_su (_.VT _.RC:$src1), (_.VT _.RC:$src2),
timm:$cc)>,
- EVEX_4V, VEX_LIG, EVEX_B, Sched<[sched]>;
+ EVEX, VVVV, VEX_LIG, EVEX_B, Sched<[sched]>;
let isCodeGenOnly = 1 in {
let isCommutable = 1 in
@@ -1955,7 +1955,7 @@ multiclass avx512_cmp_scalar<X86VectorVTInfo _, SDNode OpNode, SDNode OpNodeSAE,
[(set _.KRC:$dst, (OpNode _.FRC:$src1,
_.FRC:$src2,
timm:$cc))]>,
- EVEX_4V, VEX_LIG, Sched<[sched]>, SIMD_EXC;
+ EVEX, VVVV, VEX_LIG, Sched<[sched]>, SIMD_EXC;
def rm : AVX512Ii8<0xC2, MRMSrcMem,
(outs _.KRC:$dst),
(ins _.FRC:$src1, _.ScalarMemOp:$src2, u8imm:$cc),
@@ -1964,7 +1964,7 @@ multiclass avx512_cmp_scalar<X86VectorVTInfo _, SDNode OpNode, SDNode OpNodeSAE,
[(set _.KRC:$dst, (OpNode _.FRC:$src1,
(_.ScalarLdFrag addr:$src2),
timm:$cc))]>,
- EVEX_4V, VEX_LIG, EVEX_CD8<_.EltSize, CD8VT1>,
+ EVEX, VVVV, VEX_LIG, EVEX_CD8<_.EltSize, CD8VT1>,
Sched<[sched.Folded, sched.ReadAfterFold]>, SIMD_EXC;
}
}
@@ -1991,24 +1991,24 @@ multiclass avx512_icmp_packed<bits<8> opc, string OpcodeStr,
def rr : AVX512BI<opc, MRMSrcReg,
(outs _.KRC:$dst), (ins _.RC:$src1, _.RC:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
- []>, EVEX_4V, Sched<[sched]>;
+ []>, EVEX, VVVV, Sched<[sched]>;
let mayLoad = 1, hasSideEffects = 0 in
def rm : AVX512BI<opc, MRMSrcMem,
(outs _.KRC:$dst), (ins _.RC:$src1, _.MemOp:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
- []>, EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ []>, EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
let isCommutable = IsCommutable, hasSideEffects = 0 in
def rrk : AVX512BI<opc, MRMSrcReg,
(outs _.KRC:$dst), (ins _.KRCWM:$mask, _.RC:$src1, _.RC:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst {${mask}}|",
"$dst {${mask}}, $src1, $src2}"),
- []>, EVEX_4V, EVEX_K, Sched<[sched]>;
+ []>, EVEX, VVVV, EVEX_K, Sched<[sched]>;
let mayLoad = 1, hasSideEffects = 0 in
def rmk : AVX512BI<opc, MRMSrcMem,
(outs _.KRC:$dst), (ins _.KRCWM:$mask, _.RC:$src1, _.MemOp:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst {${mask}}|",
"$dst {${mask}}, $src1, $src2}"),
- []>, EVEX_4V, EVEX_K, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ []>, EVEX, VVVV, EVEX_K, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
multiclass avx512_icmp_packed_rmb<bits<8> opc, string OpcodeStr,
@@ -2020,14 +2020,14 @@ multiclass avx512_icmp_packed_rmb<bits<8> opc, string OpcodeStr,
(outs _.KRC:$dst), (ins _.RC:$src1, _.ScalarMemOp:$src2),
!strconcat(OpcodeStr, "\t{${src2}", _.BroadcastStr, ", $src1, $dst",
"|$dst, $src1, ${src2}", _.BroadcastStr, "}"),
- []>, EVEX_4V, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ []>, EVEX, VVVV, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
def rmbk : AVX512BI<opc, MRMSrcMem,
(outs _.KRC:$dst), (ins _.KRCWM:$mask, _.RC:$src1,
_.ScalarMemOp:$src2),
!strconcat(OpcodeStr,
"\t{${src2}", _.BroadcastStr, ", $src1, $dst {${mask}}|",
"$dst {${mask}}, $src1, ${src2}", _.BroadcastStr, "}"),
- []>, EVEX_4V, EVEX_K, EVEX_B,
+ []>, EVEX, VVVV, EVEX_K, EVEX_B,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -2082,7 +2082,7 @@ defm VPCMPEQD : avx512_icmp_packed_rmb_vl<0x76, "vpcmpeqd",
defm VPCMPEQQ : avx512_icmp_packed_rmb_vl<0x29, "vpcmpeqq",
SchedWriteVecALU, avx512vl_i64_info, HasAVX512, 1>,
- T8PD, REX_W, EVEX_CD8<64, CD8VF>;
+ T8, REX_W, EVEX_CD8<64, CD8VF>;
defm VPCMPGTB : avx512_icmp_packed_vl<0x64, "vpcmpgtb",
SchedWriteVecALU, avx512vl_i8_info, HasBWI>,
@@ -2098,7 +2098,7 @@ defm VPCMPGTD : avx512_icmp_packed_rmb_vl<0x66, "vpcmpgtd",
defm VPCMPGTQ : avx512_icmp_packed_rmb_vl<0x37, "vpcmpgtq",
SchedWriteVecALU, avx512vl_i64_info, HasAVX512>,
- T8PD, REX_W, EVEX_CD8<64, CD8VF>;
+ T8, REX_W, EVEX_CD8<64, CD8VF>;
}
multiclass avx512_icmp_cc<bits<8> opc, string Suffix, PatFrag Frag,
@@ -2113,7 +2113,7 @@ multiclass avx512_icmp_cc<bits<8> opc, string Suffix, PatFrag Frag,
[(set _.KRC:$dst, (_.KVT (Frag:$cc (_.VT _.RC:$src1),
(_.VT _.RC:$src2),
cond)))]>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
def rmi : AVX512AIi8<opc, MRMSrcMem,
(outs _.KRC:$dst), (ins _.RC:$src1, _.MemOp:$src2, u8imm:$cc),
!strconcat("vpcmp", Suffix,
@@ -2123,7 +2123,7 @@ multiclass avx512_icmp_cc<bits<8> opc, string Suffix, PatFrag Frag,
(_.VT _.RC:$src1),
(_.VT (_.LdFrag addr:$src2)),
cond)))]>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
let isCommutable = 1 in
def rrik : AVX512AIi8<opc, MRMSrcReg,
(outs _.KRC:$dst), (ins _.KRCWM:$mask, _.RC:$src1, _.RC:$src2,
@@ -2135,7 +2135,7 @@ multiclass avx512_icmp_cc<bits<8> opc, string Suffix, PatFrag Frag,
(_.KVT (Frag_su:$cc (_.VT _.RC:$src1),
(_.VT _.RC:$src2),
cond))))]>,
- EVEX_4V, EVEX_K, Sched<[sched]>;
+ EVEX, VVVV, EVEX_K, Sched<[sched]>;
def rmik : AVX512AIi8<opc, MRMSrcMem,
(outs _.KRC:$dst), (ins _.KRCWM:$mask, _.RC:$src1, _.MemOp:$src2,
u8imm:$cc),
@@ -2148,7 +2148,7 @@ multiclass avx512_icmp_cc<bits<8> opc, string Suffix, PatFrag Frag,
(_.VT _.RC:$src1),
(_.VT (_.LdFrag addr:$src2)),
cond))))]>,
- EVEX_4V, EVEX_K, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, EVEX_K, Sched<[sched.Folded, sched.ReadAfterFold]>;
def : Pat<(_.KVT (Frag:$cc (_.LdFrag addr:$src2),
(_.VT _.RC:$src1), cond)),
@@ -2177,7 +2177,7 @@ multiclass avx512_icmp_cc_rmb<bits<8> opc, string Suffix, PatFrag Frag,
(_.VT _.RC:$src1),
(_.BroadcastLdFrag addr:$src2),
cond)))]>,
- EVEX_4V, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
def rmibk : AVX512AIi8<opc, MRMSrcMem,
(outs _.KRC:$dst), (ins _.KRCWM:$mask, _.RC:$src1,
_.ScalarMemOp:$src2, u8imm:$cc),
@@ -2189,7 +2189,7 @@ multiclass avx512_icmp_cc_rmb<bits<8> opc, string Suffix, PatFrag Frag,
(_.VT _.RC:$src1),
(_.BroadcastLdFrag addr:$src2),
cond))))]>,
- EVEX_4V, EVEX_K, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, EVEX_K, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
def : Pat<(_.KVT (Frag:$cc (_.BroadcastLdFrag addr:$src2),
(_.VT _.RC:$src1), cond)),
@@ -2405,11 +2405,11 @@ multiclass avx512_vcmp<X86SchedWriteWidths sched, AVX512VLVectorVTInfo _,
}
defm VCMPPD : avx512_vcmp<SchedWriteFCmp, avx512vl_f64_info>,
- AVX512PDIi8Base, EVEX_4V, EVEX_CD8<64, CD8VF>, REX_W;
+ AVX512PDIi8Base, EVEX, VVVV, EVEX_CD8<64, CD8VF>, REX_W;
defm VCMPPS : avx512_vcmp<SchedWriteFCmp, avx512vl_f32_info>,
- AVX512PSIi8Base, EVEX_4V, EVEX_CD8<32, CD8VF>;
+ AVX512PSIi8Base, EVEX, VVVV, EVEX_CD8<32, CD8VF>;
defm VCMPPH : avx512_vcmp<SchedWriteFCmp, avx512vl_f16_info, HasFP16>,
- AVX512PSIi8Base, EVEX_4V, EVEX_CD8<16, CD8VF>, TA;
+ AVX512PSIi8Base, EVEX, VVVV, EVEX_CD8<16, CD8VF>, TA;
// Patterns to select fp compares with load as first operand.
let Predicates = [HasAVX512] in {
@@ -2625,40 +2625,40 @@ multiclass avx512_mask_mov_gpr<bits<8> opc_kr, bits<8> opc_rk,
let Predicates = [HasDQI, NoEGPR] in
defm KMOVB : avx512_mask_mov<0x90, 0x90, 0x91, "kmovb", VK8, v8i1, i8mem>,
avx512_mask_mov_gpr<0x92, 0x93, "kmovb", VK8, GR32>,
- VEX, PD;
+ VEX, TB, PD;
let Predicates = [HasDQI, HasEGPR, In64BitMode] in
defm KMOVB : avx512_mask_mov<0x90, 0x90, 0x91, "kmovb", VK8, v8i1, i8mem, "_EVEX">,
avx512_mask_mov_gpr<0x92, 0x93, "kmovb", VK8, GR32, "_EVEX">,
- EVEX, PD;
+ EVEX, TB, PD;
let Predicates = [HasAVX512, NoEGPR] in
defm KMOVW : avx512_mask_mov<0x90, 0x90, 0x91, "kmovw", VK16, v16i1, i16mem>,
avx512_mask_mov_gpr<0x92, 0x93, "kmovw", VK16, GR32>,
- VEX, PS;
+ VEX, TB;
let Predicates = [HasAVX512, HasEGPR, In64BitMode] in
defm KMOVW : avx512_mask_mov<0x90, 0x90, 0x91, "kmovw", VK16, v16i1, i16mem, "_EVEX">,
avx512_mask_mov_gpr<0x92, 0x93, "kmovw", VK16, GR32, "_EVEX">,
- EVEX, PS;
+ EVEX, TB;
let Predicates = [HasBWI, NoEGPR] in {
defm KMOVD : avx512_mask_mov<0x90, 0x90, 0x91, "kmovd", VK32, v32i1,i32mem>,
- VEX, PD, REX_W;
+ VEX, TB, PD, REX_W;
defm KMOVD : avx512_mask_mov_gpr<0x92, 0x93, "kmovd", VK32, GR32>,
- VEX, XD;
+ VEX, TB, XD;
defm KMOVQ : avx512_mask_mov<0x90, 0x90, 0x91, "kmovq", VK64, v64i1, i64mem>,
- VEX, PS, REX_W;
+ VEX, TB, REX_W;
defm KMOVQ : avx512_mask_mov_gpr<0x92, 0x93, "kmovq", VK64, GR64>,
- VEX, XD, REX_W;
+ VEX, TB, XD, REX_W;
}
let Predicates = [HasBWI, HasEGPR, In64BitMode] in {
defm KMOVD : avx512_mask_mov<0x90, 0x90, 0x91, "kmovd", VK32, v32i1,i32mem, "_EVEX">,
- EVEX, PD, REX_W;
+ EVEX, TB, PD, REX_W;
defm KMOVD : avx512_mask_mov_gpr<0x92, 0x93, "kmovd", VK32, GR32, "_EVEX">,
- EVEX, XD;
+ EVEX, TB, XD;
defm KMOVQ : avx512_mask_mov<0x90, 0x90, 0x91, "kmovq", VK64, v64i1, i64mem, "_EVEX">,
- EVEX, PS, REX_W;
+ EVEX, TB, REX_W;
defm KMOVQ : avx512_mask_mov_gpr<0x92, 0x93, "kmovq", VK64, GR64, "_EVEX">,
- EVEX, XD, REX_W;
+ EVEX, TB, XD, REX_W;
}
// GR from/to mask register
@@ -2769,13 +2769,13 @@ multiclass avx512_mask_unop_all<bits<8> opc, string OpcodeStr,
SDPatternOperator OpNode,
X86FoldableSchedWrite sched> {
defm B : avx512_mask_unop<opc, !strconcat(OpcodeStr, "b"), VK8, OpNode,
- sched, HasDQI>, VEX, PD;
+ sched, HasDQI>, VEX, TB, PD;
defm W : avx512_mask_unop<opc, !strconcat(OpcodeStr, "w"), VK16, OpNode,
- sched, HasAVX512>, VEX, PS;
+ sched, HasAVX512>, VEX, TB;
defm D : avx512_mask_unop<opc, !strconcat(OpcodeStr, "d"), VK32, OpNode,
- sched, HasBWI>, VEX, PD, REX_W;
+ sched, HasBWI>, VEX, TB, PD, REX_W;
defm Q : avx512_mask_unop<opc, !strconcat(OpcodeStr, "q"), VK64, OpNode,
- sched, HasBWI>, VEX, PS, REX_W;
+ sched, HasBWI>, VEX, TB, REX_W;
}
// TODO - do we need a X86SchedWriteWidths::KMASK type?
@@ -2812,13 +2812,13 @@ multiclass avx512_mask_binop_all<bits<8> opc, string OpcodeStr,
X86FoldableSchedWrite sched, bit IsCommutable,
Predicate prdW = HasAVX512> {
defm B : avx512_mask_binop<opc, !strconcat(OpcodeStr, "b"), VK8, OpNode,
- sched, HasDQI, IsCommutable>, VEX_4V, VEX_L, PD;
+ sched, HasDQI, IsCommutable>, VEX, VVVV, VEX_L, TB, PD;
defm W : avx512_mask_binop<opc, !strconcat(OpcodeStr, "w"), VK16, OpNode,
- sched, prdW, IsCommutable>, VEX_4V, VEX_L, PS;
+ sched, prdW, IsCommutable>, VEX, VVVV, VEX_L, TB;
defm D : avx512_mask_binop<opc, !strconcat(OpcodeStr, "d"), VK32, OpNode,
- sched, HasBWI, IsCommutable>, VEX_4V, VEX_L, REX_W, PD;
+ sched, HasBWI, IsCommutable>, VEX, VVVV, VEX_L, REX_W, TB, PD;
defm Q : avx512_mask_binop<opc, !strconcat(OpcodeStr, "q"), VK64, OpNode,
- sched, HasBWI, IsCommutable>, VEX_4V, VEX_L, REX_W, PS;
+ sched, HasBWI, IsCommutable>, VEX, VVVV, VEX_L, REX_W, TB;
}
// TODO - do we need a X86SchedWriteWidths::KMASK type?
@@ -2869,16 +2869,16 @@ multiclass avx512_mask_unpck<string Suffix, X86KVectorVTInfo Dst,
def rr : I<0x4b, MRMSrcReg, (outs Dst.KRC:$dst),
(ins Src.KRC:$src1, Src.KRC:$src2),
"kunpck"#Suffix#"\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- VEX_4V, VEX_L, Sched<[sched]>;
+ VEX, VVVV, VEX_L, Sched<[sched]>;
def : Pat<(Dst.KVT (concat_vectors Src.KRC:$src1, Src.KRC:$src2)),
(!cast<Instruction>(NAME#rr) Src.KRC:$src2, Src.KRC:$src1)>;
}
}
-defm KUNPCKBW : avx512_mask_unpck<"bw", v16i1_info, v8i1_info, WriteShuffle, HasAVX512>, PD;
-defm KUNPCKWD : avx512_mask_unpck<"wd", v32i1_info, v16i1_info, WriteShuffle, HasBWI>, PS;
-defm KUNPCKDQ : avx512_mask_unpck<"dq", v64i1_info, v32i1_info, WriteShuffle, HasBWI>, PS, REX_W;
+defm KUNPCKBW : avx512_mask_unpck<"bw", v16i1_info, v8i1_info, WriteShuffle, HasAVX512>, TB, PD;
+defm KUNPCKWD : avx512_mask_unpck<"wd", v32i1_info, v16i1_info, WriteShuffle, HasBWI>, TB;
+defm KUNPCKDQ : avx512_mask_unpck<"dq", v64i1_info, v32i1_info, WriteShuffle, HasBWI>, TB, REX_W;
// Mask bit testing
multiclass avx512_mask_testop<bits<8> opc, string OpcodeStr, RegisterClass KRC,
@@ -2895,13 +2895,13 @@ multiclass avx512_mask_testop_w<bits<8> opc, string OpcodeStr, SDNode OpNode,
X86FoldableSchedWrite sched,
Predicate prdW = HasAVX512> {
defm B : avx512_mask_testop<opc, OpcodeStr#"b", VK8, OpNode, sched, HasDQI>,
- VEX, PD;
+ VEX, TB, PD;
defm W : avx512_mask_testop<opc, OpcodeStr#"w", VK16, OpNode, sched, prdW>,
- VEX, PS;
+ VEX, TB;
defm Q : avx512_mask_testop<opc, OpcodeStr#"q", VK64, OpNode, sched, HasBWI>,
- VEX, PS, REX_W;
+ VEX, TB, REX_W;
defm D : avx512_mask_testop<opc, OpcodeStr#"d", VK32, OpNode, sched, HasBWI>,
- VEX, PD, REX_W;
+ VEX, TB, PD, REX_W;
}
// TODO - do we need a X86SchedWriteWidths::KMASK type?
@@ -2922,15 +2922,15 @@ multiclass avx512_mask_shiftop<bits<8> opc, string OpcodeStr, RegisterClass KRC,
multiclass avx512_mask_shiftop_w<bits<8> opc1, bits<8> opc2, string OpcodeStr,
SDNode OpNode, X86FoldableSchedWrite sched> {
defm W : avx512_mask_shiftop<opc1, !strconcat(OpcodeStr, "w"), VK16, OpNode,
- sched>, VEX, TAPD, REX_W;
+ sched>, VEX, TA, PD, REX_W;
let Predicates = [HasDQI] in
defm B : avx512_mask_shiftop<opc1, !strconcat(OpcodeStr, "b"), VK8, OpNode,
- sched>, VEX, TAPD;
+ sched>, VEX, TA, PD;
let Predicates = [HasBWI] in {
defm Q : avx512_mask_shiftop<opc2, !strconcat(OpcodeStr, "q"), VK64, OpNode,
- sched>, VEX, TAPD, REX_W;
+ sched>, VEX, TA, PD, REX_W;
defm D : avx512_mask_shiftop<opc2, !strconcat(OpcodeStr, "d"), VK32, OpNode,
- sched>, VEX, TAPD;
+ sched>, VEX, TA, PD;
}
}
@@ -3371,25 +3371,25 @@ defm VMOVAPS : avx512_alignedload_vl<0x28, "vmovaps", avx512vl_f32_info,
HasAVX512, SchedWriteFMoveLS, "VMOVAPS">,
avx512_alignedstore_vl<0x29, "vmovaps", avx512vl_f32_info,
HasAVX512, SchedWriteFMoveLS, "VMOVAPS">,
- PS, EVEX_CD8<32, CD8VF>;
+ TB, EVEX_CD8<32, CD8VF>;
defm VMOVAPD : avx512_alignedload_vl<0x28, "vmovapd", avx512vl_f64_info,
HasAVX512, SchedWriteFMoveLS, "VMOVAPD">,
avx512_alignedstore_vl<0x29, "vmovapd", avx512vl_f64_info,
HasAVX512, SchedWriteFMoveLS, "VMOVAPD">,
- PD, REX_W, EVEX_CD8<64, CD8VF>;
+ TB, PD, REX_W, EVEX_CD8<64, CD8VF>;
defm VMOVUPS : avx512_load_vl<0x10, "vmovups", avx512vl_f32_info, HasAVX512,
SchedWriteFMoveLS, "VMOVUPS", 0, null_frag>,
avx512_store_vl<0x11, "vmovups", avx512vl_f32_info, HasAVX512,
SchedWriteFMoveLS, "VMOVUPS">,
- PS, EVEX_CD8<32, CD8VF>;
+ TB, EVEX_CD8<32, CD8VF>;
defm VMOVUPD : avx512_load_vl<0x10, "vmovupd", avx512vl_f64_info, HasAVX512,
SchedWriteFMoveLS, "VMOVUPD", 0, null_frag>,
avx512_store_vl<0x11, "vmovupd", avx512vl_f64_info, HasAVX512,
SchedWriteFMoveLS, "VMOVUPD">,
- PD, REX_W, EVEX_CD8<64, CD8VF>;
+ TB, PD, REX_W, EVEX_CD8<64, CD8VF>;
defm VMOVDQA32 : avx512_alignedload_vl<0x6F, "vmovdqa32", avx512vl_i32_info,
HasAVX512, SchedWriteVecMoveLS,
@@ -3397,7 +3397,7 @@ defm VMOVDQA32 : avx512_alignedload_vl<0x6F, "vmovdqa32", avx512vl_i32_info,
avx512_alignedstore_vl<0x7F, "vmovdqa32", avx512vl_i32_info,
HasAVX512, SchedWriteVecMoveLS,
"VMOVDQA", 1>,
- PD, EVEX_CD8<32, CD8VF>;
+ TB, PD, EVEX_CD8<32, CD8VF>;
defm VMOVDQA64 : avx512_alignedload_vl<0x6F, "vmovdqa64", avx512vl_i64_info,
HasAVX512, SchedWriteVecMoveLS,
@@ -3405,31 +3405,31 @@ defm VMOVDQA64 : avx512_alignedload_vl<0x6F, "vmovdqa64", avx512vl_i64_info,
avx512_alignedstore_vl<0x7F, "vmovdqa64", avx512vl_i64_info,
HasAVX512, SchedWriteVecMoveLS,
"VMOVDQA">,
- PD, REX_W, EVEX_CD8<64, CD8VF>;
+ TB, PD, REX_W, EVEX_CD8<64, CD8VF>;
defm VMOVDQU8 : avx512_load_vl<0x6F, "vmovdqu8", avx512vl_i8_info, HasBWI,
SchedWriteVecMoveLS, "VMOVDQU", 1>,
avx512_store_vl<0x7F, "vmovdqu8", avx512vl_i8_info, HasBWI,
SchedWriteVecMoveLS, "VMOVDQU", 1>,
- XD, EVEX_CD8<8, CD8VF>;
+ TB, XD, EVEX_CD8<8, CD8VF>;
defm VMOVDQU16 : avx512_load_vl<0x6F, "vmovdqu16", avx512vl_i16_info, HasBWI,
SchedWriteVecMoveLS, "VMOVDQU", 1>,
avx512_store_vl<0x7F, "vmovdqu16", avx512vl_i16_info, HasBWI,
SchedWriteVecMoveLS, "VMOVDQU", 1>,
- XD, REX_W, EVEX_CD8<16, CD8VF>;
+ TB, XD, REX_W, EVEX_CD8<16, CD8VF>;
defm VMOVDQU32 : avx512_load_vl<0x6F, "vmovdqu32", avx512vl_i32_info, HasAVX512,
SchedWriteVecMoveLS, "VMOVDQU", 1, null_frag>,
avx512_store_vl<0x7F, "vmovdqu32", avx512vl_i32_info, HasAVX512,
SchedWriteVecMoveLS, "VMOVDQU", 1>,
- XS, EVEX_CD8<32, CD8VF>;
+ TB, XS, EVEX_CD8<32, CD8VF>;
defm VMOVDQU64 : avx512_load_vl<0x6F, "vmovdqu64", avx512vl_i64_info, HasAVX512,
SchedWriteVecMoveLS, "VMOVDQU", 0, null_frag>,
avx512_store_vl<0x7F, "vmovdqu64", avx512vl_i64_info, HasAVX512,
SchedWriteVecMoveLS, "VMOVDQU">,
- XS, REX_W, EVEX_CD8<64, CD8VF>;
+ TB, XS, REX_W, EVEX_CD8<64, CD8VF>;
// Special instructions to help with spilling when we don't have VLX. We need
// to load or store from a ZMM register instead. These are converted in
@@ -3816,12 +3816,12 @@ def VMOVPQIto64Zrr : I<0x7E, MRMDestReg, (outs GR64:$dst), (ins VR128X:$src),
"vmovq\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (extractelt (v2i64 VR128X:$src),
(iPTR 0)))]>,
- PD, EVEX, REX_W, Sched<[WriteVecMoveToGpr]>,
+ TB, PD, EVEX, REX_W, Sched<[WriteVecMoveToGpr]>,
Requires<[HasAVX512]>;
let isCodeGenOnly = 1, ForceDisassemble = 1, hasSideEffects = 0, mayStore = 1 in
def VMOVPQIto64Zmr : I<0x7E, MRMDestMem, (outs), (ins i64mem:$dst, VR128X:$src),
- "vmovq\t{$src, $dst|$dst, $src}", []>, PD,
+ "vmovq\t{$src, $dst|$dst, $src}", []>, TB, PD,
EVEX, REX_W, EVEX_CD8<64, CD8VT1>, Sched<[WriteVecStore]>,
Requires<[HasAVX512, In64BitMode]>;
@@ -3830,7 +3830,7 @@ def VMOVPQI2QIZmr : I<0xD6, MRMDestMem, (outs),
"vmovq\t{$src, $dst|$dst, $src}",
[(store (extractelt (v2i64 VR128X:$src), (iPTR 0)),
addr:$dst)]>,
- EVEX, PD, REX_W, EVEX_CD8<64, CD8VT1>,
+ EVEX, TB, PD, REX_W, EVEX_CD8<64, CD8VT1>,
Sched<[WriteVecStore]>, Requires<[HasAVX512]>;
let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in
@@ -3897,7 +3897,7 @@ multiclass avx512_move_scalar<string asm, SDNode OpNode, PatFrag vzload_frag,
(ins _.RC:$src1, _.RC:$src2),
!strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set _.RC:$dst, (_.VT (OpNode _.RC:$src1, _.RC:$src2)))],
- _.ExeDomain>, EVEX_4V, Sched<[SchedWriteFShuffle.XMM]>;
+ _.ExeDomain>, EVEX, VVVV, Sched<[SchedWriteFShuffle.XMM]>;
let Predicates = [prd] in {
def rrkz : AVX512PI<0x10, MRMSrcReg, (outs _.RC:$dst),
(ins _.KRCWM:$mask, _.RC:$src1, _.RC:$src2),
@@ -3906,7 +3906,7 @@ multiclass avx512_move_scalar<string asm, SDNode OpNode, PatFrag vzload_frag,
[(set _.RC:$dst, (_.VT (X86selects _.KRCWM:$mask,
(_.VT (OpNode _.RC:$src1, _.RC:$src2)),
_.ImmAllZerosV)))],
- _.ExeDomain>, EVEX_4V, EVEX_KZ, Sched<[SchedWriteFShuffle.XMM]>;
+ _.ExeDomain>, EVEX, VVVV, EVEX_KZ, Sched<[SchedWriteFShuffle.XMM]>;
let Constraints = "$src0 = $dst" in
def rrk : AVX512PI<0x10, MRMSrcReg, (outs _.RC:$dst),
(ins _.RC:$src0, _.KRCWM:$mask, _.RC:$src1, _.RC:$src2),
@@ -3915,7 +3915,7 @@ multiclass avx512_move_scalar<string asm, SDNode OpNode, PatFrag vzload_frag,
[(set _.RC:$dst, (_.VT (X86selects _.KRCWM:$mask,
(_.VT (OpNode _.RC:$src1, _.RC:$src2)),
(_.VT _.RC:$src0))))],
- _.ExeDomain>, EVEX_4V, EVEX_K, Sched<[SchedWriteFShuffle.XMM]>;
+ _.ExeDomain>, EVEX, VVVV, EVEX_K, Sched<[SchedWriteFShuffle.XMM]>;
let canFoldAsLoad = 1, isReMaterializable = 1 in {
def rm : AVX512PI<0x10, MRMSrcMem, (outs _.RC:$dst), (ins _.ScalarMemOp:$src),
!strconcat(asm, "\t{$src, $dst|$dst, $src}"),
@@ -3954,14 +3954,14 @@ multiclass avx512_move_scalar<string asm, SDNode OpNode, PatFrag vzload_frag,
}
defm VMOVSSZ : avx512_move_scalar<"vmovss", X86Movss, X86vzload32, f32x_info>,
- VEX_LIG, XS, EVEX_CD8<32, CD8VT1>;
+ VEX_LIG, TB, XS, EVEX_CD8<32, CD8VT1>;
defm VMOVSDZ : avx512_move_scalar<"vmovsd", X86Movsd, X86vzload64, f64x_info>,
- VEX_LIG, XD, REX_W, EVEX_CD8<64, CD8VT1>;
+ VEX_LIG, TB, XD, REX_W, EVEX_CD8<64, CD8VT1>;
defm VMOVSHZ : avx512_move_scalar<"vmovsh", X86Movsh, X86vzload16, f16x_info,
HasFP16>,
- VEX_LIG, T_MAP5XS, EVEX_CD8<16, CD8VT1>;
+ VEX_LIG, T_MAP5, XS, EVEX_CD8<16, CD8VT1>;
multiclass avx512_move_scalar_lowering<string InstrStr, SDNode OpNode,
PatLeaf ZeroFP, X86VectorVTInfo _> {
@@ -4286,7 +4286,7 @@ let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in {
def VMOVSHZrr_REV: AVX512<0x11, MRMDestReg, (outs VR128X:$dst),
(ins VR128X:$src1, VR128X:$src2),
"vmovsh\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- []>, T_MAP5XS, EVEX_4V, VEX_LIG,
+ []>, T_MAP5, XS, EVEX, VVVV, VEX_LIG,
Sched<[SchedWriteFShuffle.XMM]>;
let Constraints = "$src0 = $dst" in
@@ -4295,20 +4295,20 @@ let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in {
VR128X:$src1, VR128X:$src2),
"vmovsh\t{$src2, $src1, $dst {${mask}}|"#
"$dst {${mask}}, $src1, $src2}",
- []>, T_MAP5XS, EVEX_K, EVEX_4V, VEX_LIG,
+ []>, T_MAP5, XS, EVEX_K, EVEX, VVVV, VEX_LIG,
Sched<[SchedWriteFShuffle.XMM]>;
def VMOVSHZrrkz_REV: AVX512<0x11, MRMDestReg, (outs VR128X:$dst),
(ins f16x_info.KRCWM:$mask, VR128X:$src1, VR128X:$src2),
"vmovsh\t{$src2, $src1, $dst {${mask}} {z}|"#
"$dst {${mask}} {z}, $src1, $src2}",
- []>, EVEX_KZ, T_MAP5XS, EVEX_4V, VEX_LIG,
+ []>, EVEX_KZ, T_MAP5, XS, EVEX, VVVV, VEX_LIG,
Sched<[SchedWriteFShuffle.XMM]>;
}
def VMOVSSZrr_REV: AVX512<0x11, MRMDestReg, (outs VR128X:$dst),
(ins VR128X:$src1, VR128X:$src2),
"vmovss\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- []>, XS, EVEX_4V, VEX_LIG,
+ []>, TB, XS, EVEX, VVVV, VEX_LIG,
Sched<[SchedWriteFShuffle.XMM]>;
let Constraints = "$src0 = $dst" in
@@ -4317,20 +4317,20 @@ let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in {
VR128X:$src1, VR128X:$src2),
"vmovss\t{$src2, $src1, $dst {${mask}}|"#
"$dst {${mask}}, $src1, $src2}",
- []>, EVEX_K, XS, EVEX_4V, VEX_LIG,
+ []>, EVEX_K, TB, XS, EVEX, VVVV, VEX_LIG,
Sched<[SchedWriteFShuffle.XMM]>;
def VMOVSSZrrkz_REV: AVX512<0x11, MRMDestReg, (outs VR128X:$dst),
(ins f32x_info.KRCWM:$mask, VR128X:$src1, VR128X:$src2),
"vmovss\t{$src2, $src1, $dst {${mask}} {z}|"#
"$dst {${mask}} {z}, $src1, $src2}",
- []>, EVEX_KZ, XS, EVEX_4V, VEX_LIG,
+ []>, EVEX_KZ, TB, XS, EVEX, VVVV, VEX_LIG,
Sched<[SchedWriteFShuffle.XMM]>;
def VMOVSDZrr_REV: AVX512<0x11, MRMDestReg, (outs VR128X:$dst),
(ins VR128X:$src1, VR128X:$src2),
"vmovsd\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- []>, XD, EVEX_4V, VEX_LIG, REX_W,
+ []>, TB, XD, EVEX, VVVV, VEX_LIG, REX_W,
Sched<[SchedWriteFShuffle.XMM]>;
let Constraints = "$src0 = $dst" in
@@ -4339,7 +4339,7 @@ let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in {
VR128X:$src1, VR128X:$src2),
"vmovsd\t{$src2, $src1, $dst {${mask}}|"#
"$dst {${mask}}, $src1, $src2}",
- []>, EVEX_K, XD, EVEX_4V, VEX_LIG,
+ []>, EVEX_K, TB, XD, EVEX, VVVV, VEX_LIG,
REX_W, Sched<[SchedWriteFShuffle.XMM]>;
def VMOVSDZrrkz_REV: AVX512<0x11, MRMDestReg, (outs VR128X:$dst),
@@ -4347,7 +4347,7 @@ let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in {
VR128X:$src2),
"vmovsd\t{$src2, $src1, $dst {${mask}} {z}|"#
"$dst {${mask}} {z}, $src1, $src2}",
- []>, EVEX_KZ, XD, EVEX_4V, VEX_LIG,
+ []>, EVEX_KZ, TB, XD, EVEX, VVVV, VEX_LIG,
REX_W, Sched<[SchedWriteFShuffle.XMM]>;
}
@@ -4546,20 +4546,20 @@ let Predicates = [HasAVX512] in {
def VMOVNTDQAZrm : AVX512PI<0x2A, MRMSrcMem, (outs VR512:$dst),
(ins i512mem:$src), "vmovntdqa\t{$src, $dst|$dst, $src}",
[], SSEPackedInt>, Sched<[SchedWriteVecMoveLS.ZMM.RM]>,
- EVEX, T8PD, EVEX_V512, EVEX_CD8<64, CD8VF>;
+ EVEX, T8, PD, EVEX_V512, EVEX_CD8<64, CD8VF>;
let Predicates = [HasVLX] in {
def VMOVNTDQAZ256rm : AVX512PI<0x2A, MRMSrcMem, (outs VR256X:$dst),
(ins i256mem:$src),
"vmovntdqa\t{$src, $dst|$dst, $src}",
[], SSEPackedInt>, Sched<[SchedWriteVecMoveLS.YMM.RM]>,
- EVEX, T8PD, EVEX_V256, EVEX_CD8<64, CD8VF>;
+ EVEX, T8, PD, EVEX_V256, EVEX_CD8<64, CD8VF>;
def VMOVNTDQAZ128rm : AVX512PI<0x2A, MRMSrcMem, (outs VR128X:$dst),
(ins i128mem:$src),
"vmovntdqa\t{$src, $dst|$dst, $src}",
[], SSEPackedInt>, Sched<[SchedWriteVecMoveLS.XMM.RM]>,
- EVEX, T8PD, EVEX_V128, EVEX_CD8<64, CD8VF>;
+ EVEX, T8, PD, EVEX_V128, EVEX_CD8<64, CD8VF>;
}
multiclass avx512_movnt<bits<8> opc, string OpcodeStr, X86VectorVTInfo _,
@@ -4585,11 +4585,11 @@ multiclass avx512_movnt_vl<bits<8> opc, string OpcodeStr,
}
defm VMOVNTDQ : avx512_movnt_vl<0xE7, "vmovntdq", avx512vl_i64_info,
- SchedWriteVecMoveLSNT>, PD;
+ SchedWriteVecMoveLSNT>, TB, PD;
defm VMOVNTPD : avx512_movnt_vl<0x2B, "vmovntpd", avx512vl_f64_info,
- SchedWriteFMoveLSNT>, PD, REX_W;
+ SchedWriteFMoveLSNT>, TB, PD, REX_W;
defm VMOVNTPS : avx512_movnt_vl<0x2B, "vmovntps", avx512vl_f32_info,
- SchedWriteFMoveLSNT>, PS;
+ SchedWriteFMoveLSNT>, TB;
let Predicates = [HasAVX512], AddedComplexity = 400 in {
def : Pat<(alignednontemporalstore (v16i32 VR512:$src), addr:$dst),
@@ -4665,14 +4665,14 @@ multiclass avx512_binop_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src1, _.RC:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1, _.RC:$src2)),
- IsCommutable, IsCommutable>, AVX512BIBase, EVEX_4V,
+ IsCommutable, IsCommutable>, AVX512BIBase, EVEX, VVVV,
Sched<[sched]>;
defm rm : AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.MemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1, (_.LdFrag addr:$src2)))>,
- AVX512BIBase, EVEX_4V,
+ AVX512BIBase, EVEX, VVVV,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -4686,7 +4686,7 @@ multiclass avx512_binop_rmb<bits<8> opc, string OpcodeStr, SDNode OpNode,
"$src1, ${src2}"#_.BroadcastStr,
(_.VT (OpNode _.RC:$src1,
(_.BroadcastLdFrag addr:$src2)))>,
- AVX512BIBase, EVEX_4V, EVEX_B,
+ AVX512BIBase, EVEX, VVVV, EVEX_B,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -4796,13 +4796,13 @@ multiclass avx512_binop_rm2<bits<8> opc, string OpcodeStr,
(_Src.VT _Src.RC:$src1),
(_Src.VT _Src.RC:$src2))),
IsCommutable>,
- AVX512BIBase, EVEX_4V, Sched<[sched]>;
+ AVX512BIBase, EVEX, VVVV, Sched<[sched]>;
defm rm : AVX512_maskable<opc, MRMSrcMem, _Dst, (outs _Dst.RC:$dst),
(ins _Src.RC:$src1, _Src.MemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_Dst.VT (OpNode (_Src.VT _Src.RC:$src1),
(_Src.LdFrag addr:$src2)))>,
- AVX512BIBase, EVEX_4V,
+ AVX512BIBase, EVEX, VVVV,
Sched<[sched.Folded, sched.ReadAfterFold]>;
defm rmb : AVX512_maskable<opc, MRMSrcMem, _Dst, (outs _Dst.RC:$dst),
@@ -4812,7 +4812,7 @@ multiclass avx512_binop_rm2<bits<8> opc, string OpcodeStr,
"$src1, ${src2}"#_Brdct.BroadcastStr,
(_Dst.VT (OpNode (_Src.VT _Src.RC:$src1), (bitconvert
(_Brdct.VT (_Brdct.BroadcastLdFrag addr:$src2)))))>,
- AVX512BIBase, EVEX_4V, EVEX_B,
+ AVX512BIBase, EVEX, VVVV, EVEX_B,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -4829,22 +4829,22 @@ defm VPADDUS : avx512_binop_rm_vl_bw<0xDC, 0xDD, "vpaddus", uaddsat,
defm VPSUBUS : avx512_binop_rm_vl_bw<0xD8, 0xD9, "vpsubus", usubsat,
SchedWriteVecALU, HasBWI, 0>;
defm VPMULLD : avx512_binop_rm_vl_d<0x40, "vpmulld", mul,
- SchedWritePMULLD, HasAVX512, 1>, T8PD;
+ SchedWritePMULLD, HasAVX512, 1>, T8;
defm VPMULLW : avx512_binop_rm_vl_w<0xD5, "vpmullw", mul,
SchedWriteVecIMul, HasBWI, 1>;
defm VPMULLQ : avx512_binop_rm_vl_q<0x40, "vpmullq", mul,
- SchedWriteVecIMul, HasDQI, 1>, T8PD,
+ SchedWriteVecIMul, HasDQI, 1>, T8,
NotEVEX2VEXConvertible;
defm VPMULHW : avx512_binop_rm_vl_w<0xE5, "vpmulhw", mulhs, SchedWriteVecIMul,
HasBWI, 1>;
defm VPMULHUW : avx512_binop_rm_vl_w<0xE4, "vpmulhuw", mulhu, SchedWriteVecIMul,
HasBWI, 1>;
defm VPMULHRSW : avx512_binop_rm_vl_w<0x0B, "vpmulhrsw", X86mulhrs,
- SchedWriteVecIMul, HasBWI, 1>, T8PD;
+ SchedWriteVecIMul, HasBWI, 1>, T8;
defm VPAVG : avx512_binop_rm_vl_bw<0xE0, 0xE3, "vpavg", avgceilu,
SchedWriteVecALU, HasBWI, 1>;
defm VPMULDQ : avx512_binop_rm_vl_q<0x28, "vpmuldq", X86pmuldq,
- SchedWriteVecIMul, HasAVX512, 1>, T8PD;
+ SchedWriteVecIMul, HasAVX512, 1>, T8;
defm VPMULUDQ : avx512_binop_rm_vl_q<0xF4, "vpmuludq", X86pmuludq,
SchedWriteVecIMul, HasAVX512, 1>;
@@ -4872,7 +4872,7 @@ multiclass avx512_binop_all<bits<8> opc, string OpcodeStr,
defm VPMULTISHIFTQB : avx512_binop_all<0x83, "vpmultishiftqb", SchedWriteVecALU,
avx512vl_i8_info, avx512vl_i8_info,
- X86multishift, HasVBMI, 0>, T8PD;
+ X86multishift, HasVBMI, 0>, T8;
multiclass avx512_packs_rmb<bits<8> opc, string OpcodeStr, SDNode OpNode,
X86VectorVTInfo _Src, X86VectorVTInfo _Dst,
@@ -4884,7 +4884,7 @@ multiclass avx512_packs_rmb<bits<8> opc, string OpcodeStr, SDNode OpNode,
"$src1, ${src2}"#_Src.BroadcastStr,
(_Dst.VT (OpNode (_Src.VT _Src.RC:$src1), (bitconvert
(_Src.VT (_Src.BroadcastLdFrag addr:$src2)))))>,
- EVEX_4V, EVEX_B, EVEX_CD8<_Src.EltSize, CD8VF>,
+ EVEX, VVVV, EVEX_B, EVEX_CD8<_Src.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -4899,13 +4899,13 @@ multiclass avx512_packs_rm<bits<8> opc, string OpcodeStr,
(_Src.VT _Src.RC:$src1),
(_Src.VT _Src.RC:$src2))),
IsCommutable, IsCommutable>,
- EVEX_CD8<_Src.EltSize, CD8VF>, EVEX_4V, Sched<[sched]>;
+ EVEX_CD8<_Src.EltSize, CD8VF>, EVEX, VVVV, Sched<[sched]>;
defm rm : AVX512_maskable<opc, MRMSrcMem, _Dst, (outs _Dst.RC:$dst),
(ins _Src.RC:$src1, _Src.MemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_Dst.VT (OpNode (_Src.VT _Src.RC:$src1),
(_Src.LdFrag addr:$src2)))>,
- EVEX_4V, EVEX_CD8<_Src.EltSize, CD8VF>,
+ EVEX, VVVV, EVEX_CD8<_Src.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -4967,48 +4967,48 @@ defm VPACKSSWB : avx512_packs_all_i16_i8 <0x63, "vpacksswb", X86Packss>, AVX512B
defm VPACKUSWB : avx512_packs_all_i16_i8 <0x67, "vpackuswb", X86Packus>, AVX512BIBase;
defm VPMADDUBSW : avx512_vpmadd<0x04, "vpmaddubsw", X86vpmaddubsw,
- avx512vl_i8_info, avx512vl_i16_info>, AVX512BIBase, T8PD, WIG;
+ avx512vl_i8_info, avx512vl_i16_info>, AVX512BIBase, T8, WIG;
defm VPMADDWD : avx512_vpmadd<0xF5, "vpmaddwd", X86vpmaddwd,
avx512vl_i16_info, avx512vl_i32_info, 1>, AVX512BIBase, WIG;
defm VPMAXSB : avx512_binop_rm_vl_b<0x3C, "vpmaxsb", smax,
- SchedWriteVecALU, HasBWI, 1>, T8PD;
+ SchedWriteVecALU, HasBWI, 1>, T8;
defm VPMAXSW : avx512_binop_rm_vl_w<0xEE, "vpmaxsw", smax,
SchedWriteVecALU, HasBWI, 1>;
defm VPMAXSD : avx512_binop_rm_vl_d<0x3D, "vpmaxsd", smax,
- SchedWriteVecALU, HasAVX512, 1>, T8PD;
+ SchedWriteVecALU, HasAVX512, 1>, T8;
defm VPMAXSQ : avx512_binop_rm_vl_q<0x3D, "vpmaxsq", smax,
- SchedWriteVecALU, HasAVX512, 1>, T8PD,
+ SchedWriteVecALU, HasAVX512, 1>, T8,
NotEVEX2VEXConvertible;
defm VPMAXUB : avx512_binop_rm_vl_b<0xDE, "vpmaxub", umax,
SchedWriteVecALU, HasBWI, 1>;
defm VPMAXUW : avx512_binop_rm_vl_w<0x3E, "vpmaxuw", umax,
- SchedWriteVecALU, HasBWI, 1>, T8PD;
+ SchedWriteVecALU, HasBWI, 1>, T8;
defm VPMAXUD : avx512_binop_rm_vl_d<0x3F, "vpmaxud", umax,
- SchedWriteVecALU, HasAVX512, 1>, T8PD;
+ SchedWriteVecALU, HasAVX512, 1>, T8;
defm VPMAXUQ : avx512_binop_rm_vl_q<0x3F, "vpmaxuq", umax,
- SchedWriteVecALU, HasAVX512, 1>, T8PD,
+ SchedWriteVecALU, HasAVX512, 1>, T8,
NotEVEX2VEXConvertible;
defm VPMINSB : avx512_binop_rm_vl_b<0x38, "vpminsb", smin,
- SchedWriteVecALU, HasBWI, 1>, T8PD;
+ SchedWriteVecALU, HasBWI, 1>, T8;
defm VPMINSW : avx512_binop_rm_vl_w<0xEA, "vpminsw", smin,
SchedWriteVecALU, HasBWI, 1>;
defm VPMINSD : avx512_binop_rm_vl_d<0x39, "vpminsd", smin,
- SchedWriteVecALU, HasAVX512, 1>, T8PD;
+ SchedWriteVecALU, HasAVX512, 1>, T8;
defm VPMINSQ : avx512_binop_rm_vl_q<0x39, "vpminsq", smin,
- SchedWriteVecALU, HasAVX512, 1>, T8PD,
+ SchedWriteVecALU, HasAVX512, 1>, T8,
NotEVEX2VEXConvertible;
defm VPMINUB : avx512_binop_rm_vl_b<0xDA, "vpminub", umin,
SchedWriteVecALU, HasBWI, 1>;
defm VPMINUW : avx512_binop_rm_vl_w<0x3A, "vpminuw", umin,
- SchedWriteVecALU, HasBWI, 1>, T8PD;
+ SchedWriteVecALU, HasBWI, 1>, T8;
defm VPMINUD : avx512_binop_rm_vl_d<0x3B, "vpminud", umin,
- SchedWriteVecALU, HasAVX512, 1>, T8PD;
+ SchedWriteVecALU, HasAVX512, 1>, T8;
defm VPMINUQ : avx512_binop_rm_vl_q<0x3B, "vpminuq", umin,
- SchedWriteVecALU, HasAVX512, 1>, T8PD,
+ SchedWriteVecALU, HasAVX512, 1>, T8,
NotEVEX2VEXConvertible;
// PMULLQ: Use 512bit version to implement 128/256 bit in case NoVLX.
@@ -5445,18 +5445,18 @@ multiclass avx512_binop_s_round<bits<8> opc, string OpcodeStr, SDPatternOperator
sched.PS.Scl, IsCommutable>,
avx512_fp_scalar_round<opc, OpcodeStr#"ss", f32x_info, RndNode,
sched.PS.Scl>,
- XS, EVEX_4V, VEX_LIG, EVEX_CD8<32, CD8VT1>;
+ TB, XS, EVEX, VVVV, VEX_LIG, EVEX_CD8<32, CD8VT1>;
defm SDZ : avx512_fp_scalar<opc, OpcodeStr#"sd", f64x_info, OpNode, VecNode,
sched.PD.Scl, IsCommutable>,
avx512_fp_scalar_round<opc, OpcodeStr#"sd", f64x_info, RndNode,
sched.PD.Scl>,
- XD, REX_W, EVEX_4V, VEX_LIG, EVEX_CD8<64, CD8VT1>;
+ TB, XD, REX_W, EVEX, VVVV, VEX_LIG, EVEX_CD8<64, CD8VT1>;
let Predicates = [HasFP16] in
defm SHZ : avx512_fp_scalar<opc, OpcodeStr#"sh", f16x_info, OpNode,
VecNode, sched.PH.Scl, IsCommutable>,
avx512_fp_scalar_round<opc, OpcodeStr#"sh", f16x_info, RndNode,
sched.PH.Scl>,
- T_MAP5XS, EVEX_4V, VEX_LIG, EVEX_CD8<16, CD8VT1>;
+ T_MAP5, XS, EVEX, VVVV, VEX_LIG, EVEX_CD8<16, CD8VT1>;
}
multiclass avx512_binop_s_sae<bits<8> opc, string OpcodeStr, SDNode OpNode,
@@ -5465,16 +5465,16 @@ multiclass avx512_binop_s_sae<bits<8> opc, string OpcodeStr, SDNode OpNode,
defm SSZ : avx512_fp_scalar_sae<opc, OpcodeStr#"ss", f32x_info, OpNode,
VecNode, SaeNode, sched.PS.Scl, IsCommutable,
NAME#"SS">,
- XS, EVEX_4V, VEX_LIG, EVEX_CD8<32, CD8VT1>;
+ TB, XS, EVEX, VVVV, VEX_LIG, EVEX_CD8<32, CD8VT1>;
defm SDZ : avx512_fp_scalar_sae<opc, OpcodeStr#"sd", f64x_info, OpNode,
VecNode, SaeNode, sched.PD.Scl, IsCommutable,
NAME#"SD">,
- XD, REX_W, EVEX_4V, VEX_LIG, EVEX_CD8<64, CD8VT1>;
+ TB, XD, REX_W, EVEX, VVVV, VEX_LIG, EVEX_CD8<64, CD8VT1>;
let Predicates = [HasFP16] in {
defm SHZ : avx512_fp_scalar_sae<opc, OpcodeStr#"sh", f16x_info, OpNode,
VecNode, SaeNode, sched.PH.Scl, IsCommutable,
NAME#"SH">,
- T_MAP5XS, EVEX_4V, VEX_LIG, EVEX_CD8<16, CD8VT1>,
+ T_MAP5, XS, EVEX, VVVV, VEX_LIG, EVEX_CD8<16, CD8VT1>,
NotEVEX2VEXConvertible;
}
}
@@ -5515,30 +5515,30 @@ multiclass avx512_comutable_binop_s<bits<8> opc, string OpcodeStr,
}
}
defm VMINCSSZ : avx512_comutable_binop_s<0x5D, "vminss", f32x_info, X86fminc,
- SchedWriteFCmp.Scl, "VMINCSS">, XS,
- EVEX_4V, VEX_LIG, EVEX_CD8<32, CD8VT1>, SIMD_EXC;
+ SchedWriteFCmp.Scl, "VMINCSS">, TB, XS,
+ EVEX, VVVV, VEX_LIG, EVEX_CD8<32, CD8VT1>, SIMD_EXC;
defm VMINCSDZ : avx512_comutable_binop_s<0x5D, "vminsd", f64x_info, X86fminc,
- SchedWriteFCmp.Scl, "VMINCSD">, XD,
- REX_W, EVEX_4V, VEX_LIG,
+ SchedWriteFCmp.Scl, "VMINCSD">, TB, XD,
+ REX_W, EVEX, VVVV, VEX_LIG,
EVEX_CD8<64, CD8VT1>, SIMD_EXC;
defm VMAXCSSZ : avx512_comutable_binop_s<0x5F, "vmaxss", f32x_info, X86fmaxc,
- SchedWriteFCmp.Scl, "VMAXCSS">, XS,
- EVEX_4V, VEX_LIG, EVEX_CD8<32, CD8VT1>, SIMD_EXC;
+ SchedWriteFCmp.Scl, "VMAXCSS">, TB, XS,
+ EVEX, VVVV, VEX_LIG, EVEX_CD8<32, CD8VT1>, SIMD_EXC;
defm VMAXCSDZ : avx512_comutable_binop_s<0x5F, "vmaxsd", f64x_info, X86fmaxc,
- SchedWriteFCmp.Scl, "VMAXCSD">, XD,
- REX_W, EVEX_4V, VEX_LIG,
+ SchedWriteFCmp.Scl, "VMAXCSD">, TB, XD,
+ REX_W, EVEX, VVVV, VEX_LIG,
EVEX_CD8<64, CD8VT1>, SIMD_EXC;
defm VMINCSHZ : avx512_comutable_binop_s<0x5D, "vminsh", f16x_info, X86fminc,
- SchedWriteFCmp.Scl, "VMINCSH">, T_MAP5XS,
- EVEX_4V, VEX_LIG, EVEX_CD8<16, CD8VT1>, SIMD_EXC,
+ SchedWriteFCmp.Scl, "VMINCSH">, T_MAP5, XS,
+ EVEX, VVVV, VEX_LIG, EVEX_CD8<16, CD8VT1>, SIMD_EXC,
NotEVEX2VEXConvertible;
defm VMAXCSHZ : avx512_comutable_binop_s<0x5F, "vmaxsh", f16x_info, X86fmaxc,
- SchedWriteFCmp.Scl, "VMAXCSH">, T_MAP5XS,
- EVEX_4V, VEX_LIG, EVEX_CD8<16, CD8VT1>, SIMD_EXC,
+ SchedWriteFCmp.Scl, "VMAXCSH">, T_MAP5, XS,
+ EVEX, VVVV, VEX_LIG, EVEX_CD8<16, CD8VT1>, SIMD_EXC,
NotEVEX2VEXConvertible;
multiclass avx512_fp_packed<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
@@ -5556,21 +5556,21 @@ multiclass avx512_fp_packed<bits<8> opc, string OpcodeStr, SDPatternOperator OpN
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1, _.RC:$src2)),
(_.VT (MaskOpNode _.RC:$src1, _.RC:$src2)), ClobberConstraint,
- IsCommutable, IsKCommutable, IsKCommutable>, EVEX_4V, Sched<[sched]>;
+ IsCommutable, IsKCommutable, IsKCommutable>, EVEX, VVVV, Sched<[sched]>;
let mayLoad = 1 in {
defm rm: AVX512_maskable_split<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.MemOp:$src2), OpcodeStr#suffix,
"$src2, $src1", "$src1, $src2",
(OpNode _.RC:$src1, (_.LdFrag addr:$src2)),
(MaskOpNode _.RC:$src1, (_.LdFrag addr:$src2)),
- ClobberConstraint>, EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ ClobberConstraint>, EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
defm rmb: AVX512_maskable_split<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.ScalarMemOp:$src2), OpcodeStr#suffix,
"${src2}"#_.BroadcastStr#", $src1",
"$src1, ${src2}"#_.BroadcastStr,
(OpNode _.RC:$src1, (_.VT (_.BroadcastLdFrag addr:$src2))),
(MaskOpNode _.RC:$src1, (_.VT (_.BroadcastLdFrag addr:$src2))),
- ClobberConstraint>, EVEX_4V, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ ClobberConstraint>, EVEX, VVVV, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
}
@@ -5586,7 +5586,7 @@ multiclass avx512_fp_round_packed<bits<8> opc, string OpcodeStr,
"$rc, $src2, $src1", "$src1, $src2, $rc",
(_.VT (OpNodeRnd _.RC:$src1, _.RC:$src2, (i32 timm:$rc))),
0, 0, 0, vselect_mask, ClobberConstraint>,
- EVEX_4V, EVEX_B, EVEX_RC, Sched<[sched]>;
+ EVEX, VVVV, EVEX_B, EVEX_RC, Sched<[sched]>;
}
multiclass avx512_fp_sae_packed<bits<8> opc, string OpcodeStr,
@@ -5597,7 +5597,7 @@ multiclass avx512_fp_sae_packed<bits<8> opc, string OpcodeStr,
(ins _.RC:$src1, _.RC:$src2), OpcodeStr#_.Suffix,
"{sae}, $src2, $src1", "$src1, $src2, {sae}",
(_.VT (OpNodeSAE _.RC:$src1, _.RC:$src2))>,
- EVEX_4V, EVEX_B, Sched<[sched]>;
+ EVEX, VVVV, EVEX_B, Sched<[sched]>;
}
multiclass avx512_fp_binop_p<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
@@ -5607,27 +5607,27 @@ multiclass avx512_fp_binop_p<bits<8> opc, string OpcodeStr, SDPatternOperator Op
bit IsPD128Commutable = IsCommutable> {
let Predicates = [prd] in {
defm PSZ : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v16f32_info,
- sched.PS.ZMM, IsCommutable>, EVEX_V512, PS,
+ sched.PS.ZMM, IsCommutable>, EVEX_V512, TB,
EVEX_CD8<32, CD8VF>;
defm PDZ : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v8f64_info,
- sched.PD.ZMM, IsCommutable>, EVEX_V512, PD, REX_W,
+ sched.PD.ZMM, IsCommutable>, EVEX_V512, TB, PD, REX_W,
EVEX_CD8<64, CD8VF>;
}
// Define only if AVX512VL feature is present.
let Predicates = [prd, HasVLX] in {
defm PSZ128 : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v4f32x_info,
- sched.PS.XMM, IsCommutable>, EVEX_V128, PS,
+ sched.PS.XMM, IsCommutable>, EVEX_V128, TB,
EVEX_CD8<32, CD8VF>;
defm PSZ256 : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v8f32x_info,
- sched.PS.YMM, IsCommutable>, EVEX_V256, PS,
+ sched.PS.YMM, IsCommutable>, EVEX_V256, TB,
EVEX_CD8<32, CD8VF>;
defm PDZ128 : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v2f64x_info,
sched.PD.XMM, IsPD128Commutable,
- IsCommutable>, EVEX_V128, PD, REX_W,
+ IsCommutable>, EVEX_V128, TB, PD, REX_W,
EVEX_CD8<64, CD8VF>;
defm PDZ256 : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v4f64x_info,
- sched.PD.YMM, IsCommutable>, EVEX_V256, PD, REX_W,
+ sched.PD.YMM, IsCommutable>, EVEX_V256, TB, PD, REX_W,
EVEX_CD8<64, CD8VF>;
}
}
@@ -5637,15 +5637,15 @@ multiclass avx512_fp_binop_ph<bits<8> opc, string OpcodeStr, SDPatternOperator O
X86SchedWriteSizes sched, bit IsCommutable = 0> {
let Predicates = [HasFP16] in {
defm PHZ : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v32f16_info,
- sched.PH.ZMM, IsCommutable>, EVEX_V512, T_MAP5PS,
+ sched.PH.ZMM, IsCommutable>, EVEX_V512, T_MAP5,
EVEX_CD8<16, CD8VF>;
}
let Predicates = [HasVLX, HasFP16] in {
defm PHZ128 : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v8f16x_info,
- sched.PH.XMM, IsCommutable>, EVEX_V128, T_MAP5PS,
+ sched.PH.XMM, IsCommutable>, EVEX_V128, T_MAP5,
EVEX_CD8<16, CD8VF>;
defm PHZ256 : avx512_fp_packed<opc, OpcodeStr, OpNode, MaskOpNode, v16f16x_info,
- sched.PH.YMM, IsCommutable>, EVEX_V256, T_MAP5PS,
+ sched.PH.YMM, IsCommutable>, EVEX_V256, T_MAP5,
EVEX_CD8<16, CD8VF>;
}
}
@@ -5656,14 +5656,14 @@ multiclass avx512_fp_binop_p_round<bits<8> opc, string OpcodeStr, SDNode OpNodeR
let Predicates = [HasFP16] in {
defm PHZ : avx512_fp_round_packed<opc, OpcodeStr, OpNodeRnd, sched.PH.ZMM,
v32f16_info>,
- EVEX_V512, T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ EVEX_V512, T_MAP5, EVEX_CD8<16, CD8VF>;
}
defm PSZ : avx512_fp_round_packed<opc, OpcodeStr, OpNodeRnd, sched.PS.ZMM,
v16f32_info>,
- EVEX_V512, PS, EVEX_CD8<32, CD8VF>;
+ EVEX_V512, TB, EVEX_CD8<32, CD8VF>;
defm PDZ : avx512_fp_round_packed<opc, OpcodeStr, OpNodeRnd, sched.PD.ZMM,
v8f64_info>,
- EVEX_V512, PD, REX_W,EVEX_CD8<64, CD8VF>;
+ EVEX_V512, TB, PD, REX_W,EVEX_CD8<64, CD8VF>;
}
let Uses = [MXCSR] in
@@ -5672,14 +5672,14 @@ multiclass avx512_fp_binop_p_sae<bits<8> opc, string OpcodeStr, SDNode OpNodeRnd
let Predicates = [HasFP16] in {
defm PHZ : avx512_fp_sae_packed<opc, OpcodeStr, OpNodeRnd, sched.PH.ZMM,
v32f16_info>,
- EVEX_V512, T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ EVEX_V512, T_MAP5, EVEX_CD8<16, CD8VF>;
}
defm PSZ : avx512_fp_sae_packed<opc, OpcodeStr, OpNodeRnd, sched.PS.ZMM,
v16f32_info>,
- EVEX_V512, PS, EVEX_CD8<32, CD8VF>;
+ EVEX_V512, TB, EVEX_CD8<32, CD8VF>;
defm PDZ : avx512_fp_sae_packed<opc, OpcodeStr, OpNodeRnd, sched.PD.ZMM,
v8f64_info>,
- EVEX_V512, PD, REX_W,EVEX_CD8<64, CD8VF>;
+ EVEX_V512, TB, PD, REX_W,EVEX_CD8<64, CD8VF>;
}
defm VADD : avx512_fp_binop_p<0x58, "vadd", any_fadd, fadd, HasAVX512,
@@ -5734,18 +5734,18 @@ multiclass avx512_fp_scalef_p<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src1, _.RC:$src2), OpcodeStr#_.Suffix,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1, _.RC:$src2))>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
defm rm: AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.MemOp:$src2), OpcodeStr#_.Suffix,
"$src2, $src1", "$src1, $src2",
(OpNode _.RC:$src1, (_.LdFrag addr:$src2))>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
defm rmb: AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.ScalarMemOp:$src2), OpcodeStr#_.Suffix,
"${src2}"#_.BroadcastStr#", $src1",
"$src1, ${src2}"#_.BroadcastStr,
(OpNode _.RC:$src1, (_.VT (_.BroadcastLdFrag addr:$src2)))>,
- EVEX_4V, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -5770,43 +5770,43 @@ multiclass avx512_fp_scalef_all<bits<8> opc, bits<8> opcScaler, string OpcodeStr
let Predicates = [HasFP16] in {
defm PHZ : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.ZMM, v32f16_info>,
avx512_fp_round_packed<opc, OpcodeStr, X86scalefRnd, sched.ZMM, v32f16_info>,
- EVEX_V512, T_MAP6PD, EVEX_CD8<16, CD8VF>;
+ EVEX_V512, T_MAP6, PD, EVEX_CD8<16, CD8VF>;
defm SHZ : avx512_fp_scalef_scalar<opcScaler, OpcodeStr, X86scalefs, sched.Scl, f16x_info>,
avx512_fp_scalar_round<opcScaler, OpcodeStr#"sh", f16x_info, X86scalefsRnd, sched.Scl>,
- EVEX_4V, T_MAP6PD, EVEX_CD8<16, CD8VT1>;
+ EVEX, VVVV, T_MAP6, PD, EVEX_CD8<16, CD8VT1>;
}
defm PSZ : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.ZMM, v16f32_info>,
avx512_fp_round_packed<opc, OpcodeStr, X86scalefRnd, sched.ZMM, v16f32_info>,
- EVEX_V512, EVEX_CD8<32, CD8VF>, T8PD;
+ EVEX_V512, EVEX_CD8<32, CD8VF>, T8, PD;
defm PDZ : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.ZMM, v8f64_info>,
avx512_fp_round_packed<opc, OpcodeStr, X86scalefRnd, sched.ZMM, v8f64_info>,
- EVEX_V512, REX_W, EVEX_CD8<64, CD8VF>, T8PD;
+ EVEX_V512, REX_W, EVEX_CD8<64, CD8VF>, T8, PD;
defm SSZ : avx512_fp_scalef_scalar<opcScaler, OpcodeStr, X86scalefs, sched.Scl, f32x_info>,
avx512_fp_scalar_round<opcScaler, OpcodeStr#"ss", f32x_info,
X86scalefsRnd, sched.Scl>,
- EVEX_4V, VEX_LIG, EVEX_CD8<32, CD8VT1>, T8PD;
+ EVEX, VVVV, VEX_LIG, EVEX_CD8<32, CD8VT1>, T8, PD;
defm SDZ : avx512_fp_scalef_scalar<opcScaler, OpcodeStr, X86scalefs, sched.Scl, f64x_info>,
avx512_fp_scalar_round<opcScaler, OpcodeStr#"sd", f64x_info,
X86scalefsRnd, sched.Scl>,
- EVEX_4V, VEX_LIG, EVEX_CD8<64, CD8VT1>, REX_W, T8PD;
+ EVEX, VVVV, VEX_LIG, EVEX_CD8<64, CD8VT1>, REX_W, T8, PD;
// Define only if AVX512VL feature is present.
let Predicates = [HasVLX] in {
defm PSZ128 : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.XMM, v4f32x_info>,
- EVEX_V128, EVEX_CD8<32, CD8VF>, T8PD;
+ EVEX_V128, EVEX_CD8<32, CD8VF>, T8, PD;
defm PSZ256 : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.YMM, v8f32x_info>,
- EVEX_V256, EVEX_CD8<32, CD8VF>, T8PD;
+ EVEX_V256, EVEX_CD8<32, CD8VF>, T8, PD;
defm PDZ128 : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.XMM, v2f64x_info>,
- EVEX_V128, REX_W, EVEX_CD8<64, CD8VF>, T8PD;
+ EVEX_V128, REX_W, EVEX_CD8<64, CD8VF>, T8, PD;
defm PDZ256 : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.YMM, v4f64x_info>,
- EVEX_V256, REX_W, EVEX_CD8<64, CD8VF>, T8PD;
+ EVEX_V256, REX_W, EVEX_CD8<64, CD8VF>, T8, PD;
}
let Predicates = [HasFP16, HasVLX] in {
defm PHZ128 : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.XMM, v8f16x_info>,
- EVEX_V128, EVEX_CD8<16, CD8VF>, T_MAP6PD;
+ EVEX_V128, EVEX_CD8<16, CD8VF>, T_MAP6, PD;
defm PHZ256 : avx512_fp_scalef_p<opc, OpcodeStr, X86scalef, sched.YMM, v16f16x_info>,
- EVEX_V256, EVEX_CD8<16, CD8VF>, T_MAP6PD;
+ EVEX_V256, EVEX_CD8<16, CD8VF>, T_MAP6, PD;
}
}
defm VSCALEF : avx512_fp_scalef_all<0x2C, 0x2D, "vscalef",
@@ -5825,13 +5825,13 @@ multiclass avx512_vptest<bits<8> opc, string OpcodeStr,
(ins _.RC:$src1, _.RC:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(null_frag), (null_frag), 1>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
let mayLoad = 1 in
defm rm : AVX512_maskable_cmp<opc, MRMSrcMem, _, (outs _.KRC:$dst),
(ins _.RC:$src1, _.MemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(null_frag), (null_frag)>,
- EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -5844,7 +5844,7 @@ multiclass avx512_vptest_mb<bits<8> opc, string OpcodeStr,
"${src2}"#_.BroadcastStr#", $src1",
"$src1, ${src2}"#_.BroadcastStr,
(null_frag), (null_frag)>,
- EVEX_B, EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ EVEX_B, EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -5898,9 +5898,9 @@ multiclass avx512_vptest_all_forms<bits<8> opc_wb, bits<8> opc_dq, string Opcode
avx512_vptest_dq<opc_dq, OpcodeStr, sched>;
defm VPTESTM : avx512_vptest_all_forms<0x26, 0x27, "vptestm",
- SchedWriteVecLogic>, T8PD;
+ SchedWriteVecLogic>, T8, PD;
defm VPTESTNM : avx512_vptest_all_forms<0x26, 0x27, "vptestnm",
- SchedWriteVecLogic>, T8XS;
+ SchedWriteVecLogic>, T8, XS;
//===----------------------------------------------------------------------===//
// AVX-512 Shift instructions
@@ -5944,13 +5944,13 @@ multiclass avx512_shift_rrm<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src1, VR128X:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1, (SrcVT VR128X:$src2)))>,
- AVX512BIBase, EVEX_4V, Sched<[sched]>;
+ AVX512BIBase, EVEX, VVVV, Sched<[sched]>;
defm rm : AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, i128mem:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1, (SrcVT (load addr:$src2))))>,
AVX512BIBase,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -6035,22 +6035,22 @@ multiclass avx512_shift_rmi_dq<bits<8> opcd, bits<8> opcq,
defm VPSRL : avx512_shift_rmi_dq<0x72, 0x73, MRM2r, MRM2m, "vpsrl", X86vsrli,
SchedWriteVecShiftImm>,
avx512_shift_rmi_w<0x71, MRM2r, MRM2m, "vpsrlw", X86vsrli,
- SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX_4V;
+ SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX, VVVV;
defm VPSLL : avx512_shift_rmi_dq<0x72, 0x73, MRM6r, MRM6m, "vpsll", X86vshli,
SchedWriteVecShiftImm>,
avx512_shift_rmi_w<0x71, MRM6r, MRM6m, "vpsllw", X86vshli,
- SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX_4V;
+ SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX, VVVV;
defm VPSRA : avx512_shift_rmi_dq<0x72, 0x72, MRM4r, MRM4m, "vpsra", X86vsrai,
SchedWriteVecShiftImm, 1>,
avx512_shift_rmi_w<0x71, MRM4r, MRM4m, "vpsraw", X86vsrai,
- SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX_4V;
+ SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX, VVVV;
defm VPROR : avx512_shift_rmi_dq<0x72, 0x72, MRM0r, MRM0m, "vpror", X86vrotri,
- SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX_4V;
+ SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX, VVVV;
defm VPROL : avx512_shift_rmi_dq<0x72, 0x72, MRM1r, MRM1m, "vprol", X86vrotli,
- SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX_4V;
+ SchedWriteVecShiftImm>, AVX512BIi8Base, EVEX, VVVV;
defm VPSLL : avx512_shift_types<0xF2, 0xF3, 0xF1, "vpsll", X86vshl,
SchedWriteVecShift>;
@@ -6097,13 +6097,13 @@ multiclass avx512_var_shift<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src1, _.RC:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1, (_.VT _.RC:$src2)))>,
- AVX5128IBase, EVEX_4V, Sched<[sched]>;
+ AVX5128IBase, EVEX, VVVV, Sched<[sched]>;
defm rm : AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.MemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1,
(_.VT (_.LdFrag addr:$src2))))>,
- AVX5128IBase, EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ AVX5128IBase, EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -6116,7 +6116,7 @@ multiclass avx512_var_shift_mb<bits<8> opc, string OpcodeStr, SDNode OpNode,
"${src2}"#_.BroadcastStr#", $src1",
"$src1, ${src2}"#_.BroadcastStr,
(_.VT (OpNode _.RC:$src1, (_.VT (_.BroadcastLdFrag addr:$src2))))>,
- AVX5128IBase, EVEX_B, EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ AVX5128IBase, EVEX_B, EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -6374,14 +6374,14 @@ multiclass avx512_permil_vec<bits<8> OpcVar, string OpcodeStr, SDNode OpNode,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode _.RC:$src1,
(Ctrl.VT Ctrl.RC:$src2)))>,
- T8PD, EVEX_4V, Sched<[sched]>;
+ T8, PD, EVEX, VVVV, Sched<[sched]>;
defm rm: AVX512_maskable<OpcVar, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, Ctrl.MemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode
_.RC:$src1,
(Ctrl.VT (Ctrl.LdFrag addr:$src2))))>,
- T8PD, EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ T8, PD, EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
defm rmb: AVX512_maskable<OpcVar, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.ScalarMemOp:$src2), OpcodeStr,
@@ -6390,7 +6390,7 @@ multiclass avx512_permil_vec<bits<8> OpcVar, string OpcodeStr, SDNode OpNode,
(_.VT (OpNode
_.RC:$src1,
(Ctrl.VT (Ctrl.BroadcastLdFrag addr:$src2))))>,
- T8PD, EVEX_4V, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
+ T8, PD, EVEX, VVVV, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -6469,13 +6469,13 @@ def VMOVLHPSZrr : AVX512PSI<0x16, MRMSrcReg, (outs VR128X:$dst),
(ins VR128X:$src1, VR128X:$src2),
"vmovlhps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set VR128X:$dst, (v4f32 (X86Movlhps VR128X:$src1, VR128X:$src2)))]>,
- Sched<[SchedWriteFShuffle.XMM]>, EVEX_4V;
+ Sched<[SchedWriteFShuffle.XMM]>, EVEX, VVVV;
let isCommutable = 1 in
def VMOVHLPSZrr : AVX512PSI<0x12, MRMSrcReg, (outs VR128X:$dst),
(ins VR128X:$src1, VR128X:$src2),
"vmovhlps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set VR128X:$dst, (v4f32 (X86Movhlps VR128X:$src1, VR128X:$src2)))]>,
- Sched<[SchedWriteFShuffle.XMM]>, EVEX_4V;
+ Sched<[SchedWriteFShuffle.XMM]>, EVEX, VVVV;
//===----------------------------------------------------------------------===//
// VMOVHPS/PD VMOVLPS Instructions
@@ -6494,19 +6494,19 @@ multiclass avx512_mov_hilo_packed<bits<8> opc, string OpcodeStr,
(OpNode _.RC:$src1,
(_.VT (bitconvert
(v2f64 (scalar_to_vector (loadf64 addr:$src2)))))))]>,
- Sched<[SchedWriteFShuffle.XMM.Folded, SchedWriteFShuffle.XMM.ReadAfterFold]>, EVEX_4V;
+ Sched<[SchedWriteFShuffle.XMM.Folded, SchedWriteFShuffle.XMM.ReadAfterFold]>, EVEX, VVVV;
}
// No patterns for MOVLPS/MOVHPS as the Movlhps node should only be created in
// SSE1. And MOVLPS pattern is even more complex.
defm VMOVHPSZ128 : avx512_mov_hilo_packed<0x16, "vmovhps", null_frag,
- v4f32x_info>, EVEX_CD8<32, CD8VT2>, PS;
+ v4f32x_info>, EVEX_CD8<32, CD8VT2>, TB;
defm VMOVHPDZ128 : avx512_mov_hilo_packed<0x16, "vmovhpd", X86Unpckl,
- v2f64x_info>, EVEX_CD8<64, CD8VT1>, PD, REX_W;
+ v2f64x_info>, EVEX_CD8<64, CD8VT1>, TB, PD, REX_W;
defm VMOVLPSZ128 : avx512_mov_hilo_packed<0x12, "vmovlps", null_frag,
- v4f32x_info>, EVEX_CD8<32, CD8VT2>, PS;
+ v4f32x_info>, EVEX_CD8<32, CD8VT2>, TB;
defm VMOVLPDZ128 : avx512_mov_hilo_packed<0x12, "vmovlpd", X86Movsd,
- v2f64x_info>, EVEX_CD8<64, CD8VT1>, PD, REX_W;
+ v2f64x_info>, EVEX_CD8<64, CD8VT1>, TB, PD, REX_W;
let Predicates = [HasAVX512] in {
// VMOVHPD patterns
@@ -6565,14 +6565,14 @@ multiclass avx512_fma3p_213_rm<bits<8> opc, string OpcodeStr, SDPatternOperator
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode _.RC:$src2, _.RC:$src1, _.RC:$src3)),
(_.VT (MaskOpNode _.RC:$src2, _.RC:$src1, _.RC:$src3)), 1, 1>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
defm m: AVX512_maskable_fma<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.MemOp:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode _.RC:$src2, _.RC:$src1, (_.LdFrag addr:$src3))),
(_.VT (MaskOpNode _.RC:$src2, _.RC:$src1, (_.LdFrag addr:$src3))), 1, 0>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold,
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
defm mb: AVX512_maskable_fma<opc, MRMSrcMem, _, (outs _.RC:$dst),
@@ -6583,7 +6583,7 @@ multiclass avx512_fma3p_213_rm<bits<8> opc, string OpcodeStr, SDPatternOperator
_.RC:$src1,(_.VT (_.BroadcastLdFrag addr:$src3))),
(MaskOpNode _.RC:$src2,
_.RC:$src1,(_.VT (_.BroadcastLdFrag addr:$src3))), 1, 0>,
- EVEX_4V, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold,
+ EVEX, VVVV, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
}
}
@@ -6598,7 +6598,7 @@ multiclass avx512_fma3_213_round<bits<8> opc, string OpcodeStr, SDNode OpNode,
OpcodeStr, "$rc, $src3, $src2", "$src2, $src3, $rc",
(_.VT ( OpNode _.RC:$src2, _.RC:$src1, _.RC:$src3, (i32 timm:$rc))),
(_.VT ( OpNode _.RC:$src2, _.RC:$src1, _.RC:$src3, (i32 timm:$rc))), 1, 1>,
- EVEX_4V, EVEX_B, EVEX_RC, Sched<[sched]>;
+ EVEX, VVVV, EVEX_B, EVEX_RC, Sched<[sched]>;
}
multiclass avx512_fma3p_213_common<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
@@ -6627,13 +6627,13 @@ multiclass avx512_fma3p_213_f<bits<8> opc, string OpcodeStr, SDPatternOperator O
SDNode MaskOpNode, SDNode OpNodeRnd> {
defm PH : avx512_fma3p_213_common<opc, OpcodeStr#"ph", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f16_info, HasFP16>, T_MAP6PD;
+ avx512vl_f16_info, HasFP16>, T_MAP6, PD;
defm PS : avx512_fma3p_213_common<opc, OpcodeStr#"ps", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f32_info>, T8PD;
+ avx512vl_f32_info>, T8, PD;
defm PD : avx512_fma3p_213_common<opc, OpcodeStr#"pd", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f64_info>, T8PD, REX_W;
+ avx512vl_f64_info>, T8, PD, REX_W;
}
defm VFMADD213 : avx512_fma3p_213_f<0xA8, "vfmadd213", any_fma,
@@ -6660,14 +6660,14 @@ multiclass avx512_fma3p_231_rm<bits<8> opc, string OpcodeStr, SDPatternOperator
OpcodeStr, "$src3, $src2", "$src2, $src3",
(null_frag),
(_.VT (MaskOpNode _.RC:$src2, _.RC:$src3, _.RC:$src1)), 1, 1>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
defm m: AVX512_maskable_fma<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.MemOp:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode _.RC:$src2, (_.LdFrag addr:$src3), _.RC:$src1)),
(_.VT (MaskOpNode _.RC:$src2, (_.LdFrag addr:$src3), _.RC:$src1)), 1, 0>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold,
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
defm mb: AVX512_maskable_fma<opc, MRMSrcMem, _, (outs _.RC:$dst),
@@ -6679,7 +6679,7 @@ multiclass avx512_fma3p_231_rm<bits<8> opc, string OpcodeStr, SDPatternOperator
_.RC:$src1)),
(_.VT (MaskOpNode _.RC:$src2,
(_.VT (_.BroadcastLdFrag addr:$src3)),
- _.RC:$src1)), 1, 0>, EVEX_4V, EVEX_B,
+ _.RC:$src1)), 1, 0>, EVEX, VVVV, EVEX_B,
Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
}
@@ -6695,7 +6695,7 @@ multiclass avx512_fma3_231_round<bits<8> opc, string OpcodeStr, SDNode OpNode,
OpcodeStr, "$rc, $src3, $src2", "$src2, $src3, $rc",
(null_frag),
(_.VT (OpNode _.RC:$src2, _.RC:$src3, _.RC:$src1, (i32 timm:$rc))),
- 1, 1>, EVEX_4V, EVEX_B, EVEX_RC, Sched<[sched]>;
+ 1, 1>, EVEX, VVVV, EVEX_B, EVEX_RC, Sched<[sched]>;
}
multiclass avx512_fma3p_231_common<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
@@ -6724,13 +6724,13 @@ multiclass avx512_fma3p_231_f<bits<8> opc, string OpcodeStr, SDPatternOperator O
SDNode MaskOpNode, SDNode OpNodeRnd > {
defm PH : avx512_fma3p_231_common<opc, OpcodeStr#"ph", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f16_info, HasFP16>, T_MAP6PD;
+ avx512vl_f16_info, HasFP16>, T_MAP6, PD;
defm PS : avx512_fma3p_231_common<opc, OpcodeStr#"ps", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f32_info>, T8PD;
+ avx512vl_f32_info>, T8, PD;
defm PD : avx512_fma3p_231_common<opc, OpcodeStr#"pd", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f64_info>, T8PD, REX_W;
+ avx512vl_f64_info>, T8, PD, REX_W;
}
defm VFMADD231 : avx512_fma3p_231_f<0xB8, "vfmadd231", any_fma,
@@ -6756,7 +6756,7 @@ multiclass avx512_fma3p_132_rm<bits<8> opc, string OpcodeStr, SDPatternOperator
OpcodeStr, "$src3, $src2", "$src2, $src3",
(null_frag),
(_.VT (MaskOpNode _.RC:$src1, _.RC:$src3, _.RC:$src2)), 1, 1>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
// Pattern is 312 order so that the load is in a different place from the
// 213 and 231 patterns this helps tablegen's duplicate pattern detection.
@@ -6765,7 +6765,7 @@ multiclass avx512_fma3p_132_rm<bits<8> opc, string OpcodeStr, SDPatternOperator
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode (_.LdFrag addr:$src3), _.RC:$src1, _.RC:$src2)),
(_.VT (MaskOpNode (_.LdFrag addr:$src3), _.RC:$src1, _.RC:$src2)), 1, 0>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold,
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
// Pattern is 312 order so that the load is in a different place from the
@@ -6778,7 +6778,7 @@ multiclass avx512_fma3p_132_rm<bits<8> opc, string OpcodeStr, SDPatternOperator
_.RC:$src1, _.RC:$src2)),
(_.VT (MaskOpNode (_.VT (_.BroadcastLdFrag addr:$src3)),
_.RC:$src1, _.RC:$src2)), 1, 0>,
- EVEX_4V, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold,
+ EVEX, VVVV, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
}
}
@@ -6793,7 +6793,7 @@ multiclass avx512_fma3_132_round<bits<8> opc, string OpcodeStr, SDNode OpNode,
OpcodeStr, "$rc, $src3, $src2", "$src2, $src3, $rc",
(null_frag),
(_.VT (OpNode _.RC:$src1, _.RC:$src3, _.RC:$src2, (i32 timm:$rc))),
- 1, 1>, EVEX_4V, EVEX_B, EVEX_RC, Sched<[sched]>;
+ 1, 1>, EVEX, VVVV, EVEX_B, EVEX_RC, Sched<[sched]>;
}
multiclass avx512_fma3p_132_common<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
@@ -6822,13 +6822,13 @@ multiclass avx512_fma3p_132_f<bits<8> opc, string OpcodeStr, SDPatternOperator O
SDNode MaskOpNode, SDNode OpNodeRnd > {
defm PH : avx512_fma3p_132_common<opc, OpcodeStr#"ph", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f16_info, HasFP16>, T_MAP6PD;
+ avx512vl_f16_info, HasFP16>, T_MAP6, PD;
defm PS : avx512_fma3p_132_common<opc, OpcodeStr#"ps", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f32_info>, T8PD;
+ avx512vl_f32_info>, T8, PD;
defm PD : avx512_fma3p_132_common<opc, OpcodeStr#"pd", OpNode, MaskOpNode,
OpNodeRnd, SchedWriteFMA,
- avx512vl_f64_info>, T8PD, REX_W;
+ avx512vl_f64_info>, T8, PD, REX_W;
}
defm VFMADD132 : avx512_fma3p_132_f<0x98, "vfmadd132", any_fma,
@@ -6851,33 +6851,33 @@ let Constraints = "$src1 = $dst", hasSideEffects = 0 in {
defm r_Int: AVX512_maskable_3src_scalar<opc, MRMSrcReg, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.RC:$src3), OpcodeStr,
"$src3, $src2", "$src2, $src3", (null_frag), 1, 1>,
- EVEX_4V, Sched<[SchedWriteFMA.Scl]>, SIMD_EXC;
+ EVEX, VVVV, Sched<[SchedWriteFMA.Scl]>, SIMD_EXC;
let mayLoad = 1 in
defm m_Int: AVX512_maskable_3src_scalar<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.IntScalarMemOp:$src3), OpcodeStr,
"$src3, $src2", "$src2, $src3", (null_frag), 1, 1>,
- EVEX_4V, Sched<[SchedWriteFMA.Scl.Folded, SchedWriteFMA.Scl.ReadAfterFold,
+ EVEX, VVVV, Sched<[SchedWriteFMA.Scl.Folded, SchedWriteFMA.Scl.ReadAfterFold,
SchedWriteFMA.Scl.ReadAfterFold]>, SIMD_EXC;
let Uses = [MXCSR] in
defm rb_Int: AVX512_maskable_3src_scalar<opc, MRMSrcReg, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.RC:$src3, AVX512RC:$rc),
OpcodeStr, "$rc, $src3, $src2", "$src2, $src3, $rc", (null_frag), 1, 1>,
- EVEX_4V, EVEX_B, EVEX_RC, Sched<[SchedWriteFMA.Scl]>;
+ EVEX, VVVV, EVEX_B, EVEX_RC, Sched<[SchedWriteFMA.Scl]>;
let isCodeGenOnly = 1, isCommutable = 1 in {
def r : AVX512<opc, MRMSrcReg, (outs _.FRC:$dst),
(ins _.FRC:$src1, _.FRC:$src2, _.FRC:$src3),
!strconcat(OpcodeStr,
"\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
- !if(MaskOnlyReg, [], [RHS_r])>, Sched<[SchedWriteFMA.Scl]>, EVEX_4V, SIMD_EXC;
+ !if(MaskOnlyReg, [], [RHS_r])>, Sched<[SchedWriteFMA.Scl]>, EVEX, VVVV, SIMD_EXC;
def m : AVX512<opc, MRMSrcMem, (outs _.FRC:$dst),
(ins _.FRC:$src1, _.FRC:$src2, _.ScalarMemOp:$src3),
!strconcat(OpcodeStr,
"\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[RHS_m]>, Sched<[SchedWriteFMA.Scl.Folded, SchedWriteFMA.Scl.ReadAfterFold,
- SchedWriteFMA.Scl.ReadAfterFold]>, EVEX_4V, SIMD_EXC;
+ SchedWriteFMA.Scl.ReadAfterFold]>, EVEX, VVVV, SIMD_EXC;
let Uses = [MXCSR] in
def rb : AVX512<opc, MRMSrcReg, (outs _.FRC:$dst),
@@ -6885,7 +6885,7 @@ let Constraints = "$src1 = $dst", hasSideEffects = 0 in {
!strconcat(OpcodeStr,
"\t{$rc, $src3, $src2, $dst|$dst, $src2, $src3, $rc}"),
!if(MaskOnlyReg, [], [RHS_b])>, EVEX_B, EVEX_RC,
- Sched<[SchedWriteFMA.Scl]>, EVEX_4V;
+ Sched<[SchedWriteFMA.Scl]>, EVEX, VVVV;
}// isCodeGenOnly = 1
}// Constraints = "$src1 = $dst"
}
@@ -6929,15 +6929,15 @@ multiclass avx512_fma3s<bits<8> opc213, bits<8> opc231, bits<8> opc132,
let Predicates = [HasAVX512] in {
defm NAME : avx512_fma3s_all<opc213, opc231, opc132, OpcodeStr, OpNode,
OpNodeRnd, f32x_info, "SS">,
- EVEX_CD8<32, CD8VT1>, VEX_LIG, T8PD;
+ EVEX_CD8<32, CD8VT1>, VEX_LIG, T8, PD;
defm NAME : avx512_fma3s_all<opc213, opc231, opc132, OpcodeStr, OpNode,
OpNodeRnd, f64x_info, "SD">,
- EVEX_CD8<64, CD8VT1>, VEX_LIG, REX_W, T8PD;
+ EVEX_CD8<64, CD8VT1>, VEX_LIG, REX_W, T8, PD;
}
let Predicates = [HasFP16] in {
defm NAME : avx512_fma3s_all<opc213, opc231, opc132, OpcodeStr, OpNode,
OpNodeRnd, f16x_info, "SH">,
- EVEX_CD8<16, CD8VT1>, VEX_LIG, T_MAP6PD;
+ EVEX_CD8<16, CD8VT1>, VEX_LIG, T_MAP6, PD;
}
}
@@ -7189,13 +7189,13 @@ multiclass avx512_pmadd52_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src2, _.RC:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode _.RC:$src2, _.RC:$src3, _.RC:$src1)), 1, 1>,
- T8PD, EVEX_4V, Sched<[sched]>;
+ T8, PD, EVEX, VVVV, Sched<[sched]>;
defm m: AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.MemOp:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode _.RC:$src2, (_.LdFrag addr:$src3), _.RC:$src1))>,
- T8PD, EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold,
+ T8, PD, EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
defm mb: AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
@@ -7205,7 +7205,7 @@ multiclass avx512_pmadd52_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
(OpNode _.RC:$src2,
(_.VT (_.BroadcastLdFrag addr:$src3)),
_.RC:$src1)>,
- T8PD, EVEX_4V, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold,
+ T8, PD, EVEX, VVVV, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
}
}
@@ -7247,19 +7247,19 @@ let ExeDomain = DstVT.ExeDomain, Uses = _Uses,
def rr : SI<opc, MRMSrcReg, (outs DstVT.FRC:$dst),
(ins DstVT.FRC:$src1, SrcRC:$src),
!strconcat(asm,"\t{$src, $src1, $dst|$dst, $src1, $src}"), []>,
- EVEX_4V, Sched<[sched, ReadDefault, ReadInt2Fpu]>;
+ EVEX, VVVV, Sched<[sched, ReadDefault, ReadInt2Fpu]>;
let mayLoad = 1 in
def rm : SI<opc, MRMSrcMem, (outs DstVT.FRC:$dst),
(ins DstVT.FRC:$src1, x86memop:$src),
asm#"{"#mem#"}\t{$src, $src1, $dst|$dst, $src1, $src}", []>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
} // hasSideEffects = 0
def rr_Int : SI<opc, MRMSrcReg, (outs DstVT.RC:$dst),
(ins DstVT.RC:$src1, SrcRC:$src2),
!strconcat(asm,"\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set DstVT.RC:$dst,
(OpNode (DstVT.VT DstVT.RC:$src1), SrcRC:$src2))]>,
- EVEX_4V, Sched<[sched, ReadDefault, ReadInt2Fpu]>;
+ EVEX, VVVV, Sched<[sched, ReadDefault, ReadInt2Fpu]>;
def rm_Int : SI<opc, MRMSrcMem, (outs DstVT.RC:$dst),
(ins DstVT.RC:$src1, x86memop:$src2),
@@ -7267,7 +7267,7 @@ let ExeDomain = DstVT.ExeDomain, Uses = _Uses,
[(set DstVT.RC:$dst,
(OpNode (DstVT.VT DstVT.RC:$src1),
(ld_frag addr:$src2)))]>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
def : InstAlias<"v"#asm#mem#"\t{$src2, $src1, $dst|$dst, $src1, $src2}",
(!cast<Instruction>(NAME#"rr_Int") DstVT.RC:$dst,
@@ -7287,7 +7287,7 @@ multiclass avx512_vcvtsi_round<bits<8> opc, SDNode OpNode,
(OpNode (DstVT.VT DstVT.RC:$src1),
SrcRC:$src2,
(i32 timm:$rc)))]>,
- EVEX_4V, EVEX_B, EVEX_RC, Sched<[sched, ReadDefault, ReadInt2Fpu]>;
+ EVEX, VVVV, EVEX_B, EVEX_RC, Sched<[sched, ReadDefault, ReadInt2Fpu]>;
def : InstAlias<"v"#asm#mem#"\t{$src2, $rc, $src1, $dst|$dst, $src1, $rc, $src2}",
(!cast<Instruction>(NAME#"rrb_Int") DstVT.RC:$dst,
DstVT.RC:$src1, SrcRC:$src2, AVX512RC:$rc), 0, "att">;
@@ -7307,18 +7307,18 @@ let Predicates = [HasAVX512] in {
defm VCVTSI2SSZ : avx512_vcvtsi_common<0x2A, X86SintToFp, X86SintToFpRnd,
WriteCvtI2SS, GR32,
v4f32x_info, i32mem, loadi32, "cvtsi2ss", "l">,
- XS, EVEX_CD8<32, CD8VT1>;
+ TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTSI642SSZ: avx512_vcvtsi_common<0x2A, X86SintToFp, X86SintToFpRnd,
WriteCvtI2SS, GR64,
v4f32x_info, i64mem, loadi64, "cvtsi2ss", "q">,
- XS, REX_W, EVEX_CD8<64, CD8VT1>;
+ TB, XS, REX_W, EVEX_CD8<64, CD8VT1>;
defm VCVTSI2SDZ : avx512_vcvtsi<0x2A, null_frag, WriteCvtI2SD, GR32,
v2f64x_info, i32mem, loadi32, "cvtsi2sd", "l", [], 0>,
- XD, VEX_LIG, EVEX_CD8<32, CD8VT1>;
+ TB, XD, VEX_LIG, EVEX_CD8<32, CD8VT1>;
defm VCVTSI642SDZ: avx512_vcvtsi_common<0x2A, X86SintToFp, X86SintToFpRnd,
WriteCvtI2SD, GR64,
v2f64x_info, i64mem, loadi64, "cvtsi2sd", "q">,
- XD, REX_W, EVEX_CD8<64, CD8VT1>;
+ TB, XD, REX_W, EVEX_CD8<64, CD8VT1>;
def : InstAlias<"vcvtsi2ss\t{$src, $src1, $dst|$dst, $src1, $src}",
(VCVTSI2SSZrm_Int VR128X:$dst, VR128X:$src1, i32mem:$src), 0, "att">;
@@ -7346,18 +7346,18 @@ def : Pat<(f64 (any_sint_to_fp GR64:$src)),
defm VCVTUSI2SSZ : avx512_vcvtsi_common<0x7B, X86UintToFp, X86UintToFpRnd,
WriteCvtI2SS, GR32,
v4f32x_info, i32mem, loadi32,
- "cvtusi2ss", "l">, XS, EVEX_CD8<32, CD8VT1>;
+ "cvtusi2ss", "l">, TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTUSI642SSZ : avx512_vcvtsi_common<0x7B, X86UintToFp, X86UintToFpRnd,
WriteCvtI2SS, GR64,
v4f32x_info, i64mem, loadi64, "cvtusi2ss", "q">,
- XS, REX_W, EVEX_CD8<64, CD8VT1>;
+ TB, XS, REX_W, EVEX_CD8<64, CD8VT1>;
defm VCVTUSI2SDZ : avx512_vcvtsi<0x7B, null_frag, WriteCvtI2SD, GR32, v2f64x_info,
i32mem, loadi32, "cvtusi2sd", "l", [], 0>,
- XD, VEX_LIG, EVEX_CD8<32, CD8VT1>;
+ TB, XD, VEX_LIG, EVEX_CD8<32, CD8VT1>;
defm VCVTUSI642SDZ : avx512_vcvtsi_common<0x7B, X86UintToFp, X86UintToFpRnd,
WriteCvtI2SD, GR64,
v2f64x_info, i64mem, loadi64, "cvtusi2sd", "q">,
- XD, REX_W, EVEX_CD8<64, CD8VT1>;
+ TB, XD, REX_W, EVEX_CD8<64, CD8VT1>;
def : InstAlias<"vcvtusi2ss\t{$src, $src1, $dst|$dst, $src1, $src}",
(VCVTUSI2SSZrm_Int VR128X:$dst, VR128X:$src1, i32mem:$src), 0, "att">;
@@ -7422,28 +7422,28 @@ multiclass avx512_cvt_s_int_round<bits<8> opc, X86VectorVTInfo SrcVT,
// Convert float/double to signed/unsigned int 32/64
defm VCVTSS2SIZ: avx512_cvt_s_int_round<0x2D, f32x_info, i32x_info,X86cvts2si,
X86cvts2siRnd, WriteCvtSS2I, "cvtss2si", "{l}">,
- XS, EVEX_CD8<32, CD8VT1>;
+ TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTSS2SI64Z: avx512_cvt_s_int_round<0x2D, f32x_info, i64x_info, X86cvts2si,
X86cvts2siRnd, WriteCvtSS2I, "cvtss2si", "{q}">,
- XS, REX_W, EVEX_CD8<32, CD8VT1>;
+ TB, XS, REX_W, EVEX_CD8<32, CD8VT1>;
defm VCVTSS2USIZ: avx512_cvt_s_int_round<0x79, f32x_info, i32x_info, X86cvts2usi,
X86cvts2usiRnd, WriteCvtSS2I, "cvtss2usi", "{l}">,
- XS, EVEX_CD8<32, CD8VT1>;
+ TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTSS2USI64Z: avx512_cvt_s_int_round<0x79, f32x_info, i64x_info, X86cvts2usi,
X86cvts2usiRnd, WriteCvtSS2I, "cvtss2usi", "{q}">,
- XS, REX_W, EVEX_CD8<32, CD8VT1>;
+ TB, XS, REX_W, EVEX_CD8<32, CD8VT1>;
defm VCVTSD2SIZ: avx512_cvt_s_int_round<0x2D, f64x_info, i32x_info, X86cvts2si,
X86cvts2siRnd, WriteCvtSD2I, "cvtsd2si", "{l}">,
- XD, EVEX_CD8<64, CD8VT1>;
+ TB, XD, EVEX_CD8<64, CD8VT1>;
defm VCVTSD2SI64Z: avx512_cvt_s_int_round<0x2D, f64x_info, i64x_info, X86cvts2si,
X86cvts2siRnd, WriteCvtSD2I, "cvtsd2si", "{q}">,
- XD, REX_W, EVEX_CD8<64, CD8VT1>;
+ TB, XD, REX_W, EVEX_CD8<64, CD8VT1>;
defm VCVTSD2USIZ: avx512_cvt_s_int_round<0x79, f64x_info, i32x_info, X86cvts2usi,
X86cvts2usiRnd, WriteCvtSD2I, "cvtsd2usi", "{l}">,
- XD, EVEX_CD8<64, CD8VT1>;
+ TB, XD, EVEX_CD8<64, CD8VT1>;
defm VCVTSD2USI64Z: avx512_cvt_s_int_round<0x79, f64x_info, i64x_info, X86cvts2usi,
X86cvts2usiRnd, WriteCvtSD2I, "cvtsd2usi", "{q}">,
- XD, REX_W, EVEX_CD8<64, CD8VT1>;
+ TB, XD, REX_W, EVEX_CD8<64, CD8VT1>;
multiclass avx512_cvt_s<bits<8> opc, string asm, X86VectorVTInfo SrcVT,
X86VectorVTInfo DstVT, SDNode OpNode,
@@ -7463,13 +7463,13 @@ multiclass avx512_cvt_s<bits<8> opc, string asm, X86VectorVTInfo SrcVT,
}
defm VCVTSS2SIZ: avx512_cvt_s<0x2D, "vcvtss2si", f32x_info, i32x_info,
- lrint, WriteCvtSS2I>, XS, EVEX_CD8<32, CD8VT1>;
+ lrint, WriteCvtSS2I>, TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTSS2SI64Z: avx512_cvt_s<0x2D, "vcvtss2si", f32x_info, i64x_info,
- llrint, WriteCvtSS2I>, REX_W, XS, EVEX_CD8<32, CD8VT1>;
+ llrint, WriteCvtSS2I>, REX_W, TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTSD2SIZ: avx512_cvt_s<0x2D, "vcvtsd2si", f64x_info, i32x_info,
- lrint, WriteCvtSD2I>, XD, EVEX_CD8<64, CD8VT1>;
+ lrint, WriteCvtSD2I>, TB, XD, EVEX_CD8<64, CD8VT1>;
defm VCVTSD2SI64Z: avx512_cvt_s<0x2D, "vcvtsd2si", f64x_info, i64x_info,
- llrint, WriteCvtSD2I>, REX_W, XD, EVEX_CD8<64, CD8VT1>;
+ llrint, WriteCvtSD2I>, REX_W, TB, XD, EVEX_CD8<64, CD8VT1>;
let Predicates = [HasAVX512] in {
def : Pat<(i64 (lrint FR32:$src)), (VCVTSS2SI64Zrr FR32:$src)>;
@@ -7609,29 +7609,29 @@ let Predicates = [prd], ExeDomain = _SrcRC.ExeDomain in {
defm VCVTTSS2SIZ: avx512_cvt_s_all<0x2C, "vcvttss2si", f32x_info, i32x_info,
any_fp_to_sint, X86cvtts2Int, X86cvtts2IntSAE, WriteCvtSS2I,
- "{l}">, XS, EVEX_CD8<32, CD8VT1>;
+ "{l}">, TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTTSS2SI64Z: avx512_cvt_s_all<0x2C, "vcvttss2si", f32x_info, i64x_info,
any_fp_to_sint, X86cvtts2Int, X86cvtts2IntSAE, WriteCvtSS2I,
- "{q}">, REX_W, XS, EVEX_CD8<32, CD8VT1>;
+ "{q}">, REX_W, TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTTSD2SIZ: avx512_cvt_s_all<0x2C, "vcvttsd2si", f64x_info, i32x_info,
any_fp_to_sint, X86cvtts2Int, X86cvtts2IntSAE, WriteCvtSD2I,
- "{l}">, XD, EVEX_CD8<64, CD8VT1>;
+ "{l}">, TB, XD, EVEX_CD8<64, CD8VT1>;
defm VCVTTSD2SI64Z: avx512_cvt_s_all<0x2C, "vcvttsd2si", f64x_info, i64x_info,
any_fp_to_sint, X86cvtts2Int, X86cvtts2IntSAE, WriteCvtSD2I,
- "{q}">, REX_W, XD, EVEX_CD8<64, CD8VT1>;
+ "{q}">, REX_W, TB, XD, EVEX_CD8<64, CD8VT1>;
defm VCVTTSS2USIZ: avx512_cvt_s_all<0x78, "vcvttss2usi", f32x_info, i32x_info,
any_fp_to_uint, X86cvtts2UInt, X86cvtts2UIntSAE, WriteCvtSS2I,
- "{l}">, XS, EVEX_CD8<32, CD8VT1>;
+ "{l}">, TB, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTTSS2USI64Z: avx512_cvt_s_all<0x78, "vcvttss2usi", f32x_info, i64x_info,
any_fp_to_uint, X86cvtts2UInt, X86cvtts2UIntSAE, WriteCvtSS2I,
- "{q}">, XS,REX_W, EVEX_CD8<32, CD8VT1>;
+ "{q}">, TB, XS,REX_W, EVEX_CD8<32, CD8VT1>;
defm VCVTTSD2USIZ: avx512_cvt_s_all<0x78, "vcvttsd2usi", f64x_info, i32x_info,
any_fp_to_uint, X86cvtts2UInt, X86cvtts2UIntSAE, WriteCvtSD2I,
- "{l}">, XD, EVEX_CD8<64, CD8VT1>;
+ "{l}">, TB, XD, EVEX_CD8<64, CD8VT1>;
defm VCVTTSD2USI64Z: avx512_cvt_s_all<0x78, "vcvttsd2usi", f64x_info, i64x_info,
any_fp_to_uint, X86cvtts2UInt, X86cvtts2UIntSAE, WriteCvtSD2I,
- "{q}">, XD, REX_W, EVEX_CD8<64, CD8VT1>;
+ "{q}">, TB, XD, REX_W, EVEX_CD8<64, CD8VT1>;
//===----------------------------------------------------------------------===//
// AVX-512 Convert form float to double and back
@@ -7646,25 +7646,25 @@ multiclass avx512_cvt_fp_scalar<bits<8> opc, string OpcodeStr, X86VectorVTInfo _
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode (_.VT _.RC:$src1),
(_Src.VT _Src.RC:$src2)))>,
- EVEX_4V, VEX_LIG, Sched<[sched]>;
+ EVEX, VVVV, VEX_LIG, Sched<[sched]>;
defm rm_Int : AVX512_maskable_scalar<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _Src.IntScalarMemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(_.VT (OpNode (_.VT _.RC:$src1),
(_Src.ScalarIntMemFrags addr:$src2)))>,
- EVEX_4V, VEX_LIG,
+ EVEX, VVVV, VEX_LIG,
Sched<[sched.Folded, sched.ReadAfterFold]>;
let isCodeGenOnly = 1, hasSideEffects = 0 in {
def rr : I<opc, MRMSrcReg, (outs _.FRC:$dst),
(ins _.FRC:$src1, _Src.FRC:$src2),
OpcodeStr#"\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- EVEX_4V, VEX_LIG, Sched<[sched]>;
+ EVEX, VVVV, VEX_LIG, Sched<[sched]>;
let mayLoad = 1 in
def rm : I<opc, MRMSrcMem, (outs _.FRC:$dst),
(ins _.FRC:$src1, _Src.ScalarMemOp:$src2),
OpcodeStr#"\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- EVEX_4V, VEX_LIG, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, VEX_LIG, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -7678,7 +7678,7 @@ multiclass avx512_cvt_fp_sae_scalar<bits<8> opc, string OpcodeStr, X86VectorVTIn
"{sae}, $src2, $src1", "$src1, $src2, {sae}",
(_.VT (OpNodeSAE (_.VT _.RC:$src1),
(_Src.VT _Src.RC:$src2)))>,
- EVEX_4V, VEX_LIG, EVEX_B, Sched<[sched]>;
+ EVEX, VVVV, VEX_LIG, EVEX_B, Sched<[sched]>;
}
// Scalar Conversion with rounding control (RC)
@@ -7691,7 +7691,7 @@ multiclass avx512_cvt_fp_rc_scalar<bits<8> opc, string OpcodeStr, X86VectorVTInf
"$rc, $src2, $src1", "$src1, $src2, $rc",
(_.VT (OpNodeRnd (_.VT _.RC:$src1),
(_Src.VT _Src.RC:$src2), (i32 timm:$rc)))>,
- EVEX_4V, VEX_LIG, Sched<[sched]>,
+ EVEX, VVVV, VEX_LIG, Sched<[sched]>,
EVEX_B, EVEX_RC;
}
multiclass avx512_cvt_fp_scalar_trunc<bits<8> opc, string OpcodeStr,
@@ -7719,22 +7719,22 @@ multiclass avx512_cvt_fp_scalar_extend<bits<8> opc, string OpcodeStr,
}
defm VCVTSD2SS : avx512_cvt_fp_scalar_trunc<0x5A, "vcvtsd2ss", X86frounds,
X86froundsRnd, WriteCvtSD2SS, f64x_info,
- f32x_info>, XD, REX_W;
+ f32x_info>, TB, XD, REX_W;
defm VCVTSS2SD : avx512_cvt_fp_scalar_extend<0x5A, "vcvtss2sd", X86fpexts,
X86fpextsSAE, WriteCvtSS2SD, f32x_info,
- f64x_info>, XS;
+ f64x_info>, TB, XS;
defm VCVTSD2SH : avx512_cvt_fp_scalar_trunc<0x5A, "vcvtsd2sh", X86frounds,
X86froundsRnd, WriteCvtSD2SS, f64x_info,
- f16x_info, HasFP16>, T_MAP5XD, REX_W;
+ f16x_info, HasFP16>, T_MAP5, XD, REX_W;
defm VCVTSH2SD : avx512_cvt_fp_scalar_extend<0x5A, "vcvtsh2sd", X86fpexts,
X86fpextsSAE, WriteCvtSS2SD, f16x_info,
- f64x_info, HasFP16>, T_MAP5XS;
+ f64x_info, HasFP16>, T_MAP5, XS;
defm VCVTSS2SH : avx512_cvt_fp_scalar_trunc<0x1D, "vcvtss2sh", X86frounds,
X86froundsRnd, WriteCvtSD2SS, f32x_info,
- f16x_info, HasFP16>, T_MAP5PS;
+ f16x_info, HasFP16>, T_MAP5;
defm VCVTSH2SS : avx512_cvt_fp_scalar_extend<0x13, "vcvtsh2ss", X86fpexts,
X86fpextsSAE, WriteCvtSS2SD, f16x_info,
- f32x_info, HasFP16>, T_MAP6PS;
+ f32x_info, HasFP16>, T_MAP6;
def : Pat<(f64 (any_fpextend FR32X:$src)),
(VCVTSS2SDZrr (f64 (IMPLICIT_DEF)), FR32X:$src)>,
@@ -7996,10 +7996,10 @@ multiclass avx512_cvt_trunc<bits<8> opc, string OpcodeStr,
defm VCVTPD2PS : avx512_cvt_trunc<0x5A, "vcvtpd2ps",
avx512vl_f32_info, avx512vl_f64_info, SchedWriteCvtPD2PS>,
- REX_W, PD, EVEX_CD8<64, CD8VF>;
+ REX_W, TB, PD, EVEX_CD8<64, CD8VF>;
defm VCVTPS2PD : avx512_cvt_extend<0x5A, "vcvtps2pd",
avx512vl_f64_info, avx512vl_f32_info, SchedWriteCvtPS2PD>,
- PS, EVEX_CD8<32, CD8VH>;
+ TB, EVEX_CD8<32, CD8VH>;
// Extend Half to Double
multiclass avx512_cvtph2pd<bits<8> opc, string OpcodeStr,
@@ -8108,14 +8108,14 @@ multiclass avx512_cvtpd2ph<bits<8> opc, string OpcodeStr, X86SchedWriteWidths sc
defm VCVTPS2PHX : avx512_cvt_trunc<0x1D, "vcvtps2phx", avx512vl_f16_info,
avx512vl_f32_info, SchedWriteCvtPD2PS,
- HasFP16>, T_MAP5PD, EVEX_CD8<32, CD8VF>;
+ HasFP16>, T_MAP5, PD, EVEX_CD8<32, CD8VF>;
defm VCVTPH2PSX : avx512_cvt_extend<0x13, "vcvtph2psx", avx512vl_f32_info,
avx512vl_f16_info, SchedWriteCvtPS2PD,
- HasFP16>, T_MAP6PD, EVEX_CD8<16, CD8VH>;
+ HasFP16>, T_MAP6, PD, EVEX_CD8<16, CD8VH>;
defm VCVTPD2PH : avx512_cvtpd2ph<0x5A, "vcvtpd2ph", SchedWriteCvtPD2PS>,
- REX_W, T_MAP5PD, EVEX_CD8<64, CD8VF>;
+ REX_W, T_MAP5, PD, EVEX_CD8<64, CD8VF>;
defm VCVTPH2PD : avx512_cvtph2pd<0x5A, "vcvtph2pd", SchedWriteCvtPS2PD>,
- T_MAP5PS, EVEX_CD8<16, CD8VQ>;
+ T_MAP5, EVEX_CD8<16, CD8VQ>;
let Predicates = [HasFP16, HasVLX] in {
// Special patterns to allow use of X86vmfpround for masking. Instruction
@@ -8596,120 +8596,120 @@ multiclass avx512_cvtqq2ps_dq2ph<bits<8> opc, string OpcodeStr, SDPatternOperato
defm VCVTDQ2PD : avx512_cvtdq2pd<0xE6, "vcvtdq2pd", any_sint_to_fp, sint_to_fp,
X86any_VSintToFP, X86VSintToFP,
- SchedWriteCvtDQ2PD>, XS, EVEX_CD8<32, CD8VH>;
+ SchedWriteCvtDQ2PD>, TB, XS, EVEX_CD8<32, CD8VH>;
defm VCVTDQ2PS : avx512_cvtdq2ps<0x5B, "vcvtdq2ps", any_sint_to_fp, sint_to_fp,
X86VSintToFpRnd, SchedWriteCvtDQ2PS>,
- PS, EVEX_CD8<32, CD8VF>;
+ TB, EVEX_CD8<32, CD8VF>;
defm VCVTTPS2DQ : avx512_cvttps2dq<0x5B, "vcvttps2dq", X86any_cvttp2si,
X86cvttp2si, X86cvttp2siSAE,
- SchedWriteCvtPS2DQ>, XS, EVEX_CD8<32, CD8VF>;
+ SchedWriteCvtPS2DQ>, TB, XS, EVEX_CD8<32, CD8VF>;
defm VCVTTPD2DQ : avx512_cvttpd2dq<0xE6, "vcvttpd2dq", X86any_cvttp2si,
X86cvttp2si, X86cvttp2siSAE,
SchedWriteCvtPD2DQ>,
- PD, REX_W, EVEX_CD8<64, CD8VF>;
+ TB, PD, REX_W, EVEX_CD8<64, CD8VF>;
defm VCVTTPS2UDQ : avx512_cvttps2dq<0x78, "vcvttps2udq", X86any_cvttp2ui,
X86cvttp2ui, X86cvttp2uiSAE,
- SchedWriteCvtPS2DQ>, PS, EVEX_CD8<32, CD8VF>;
+ SchedWriteCvtPS2DQ>, TB, EVEX_CD8<32, CD8VF>;
defm VCVTTPD2UDQ : avx512_cvttpd2dq<0x78, "vcvttpd2udq", X86any_cvttp2ui,
X86cvttp2ui, X86cvttp2uiSAE,
SchedWriteCvtPD2DQ>,
- PS, REX_W, EVEX_CD8<64, CD8VF>;
+ TB, REX_W, EVEX_CD8<64, CD8VF>;
defm VCVTUDQ2PD : avx512_cvtdq2pd<0x7A, "vcvtudq2pd", any_uint_to_fp,
uint_to_fp, X86any_VUintToFP, X86VUintToFP,
- SchedWriteCvtDQ2PD>, XS, EVEX_CD8<32, CD8VH>;
+ SchedWriteCvtDQ2PD>, TB, XS, EVEX_CD8<32, CD8VH>;
defm VCVTUDQ2PS : avx512_cvtdq2ps<0x7A, "vcvtudq2ps", any_uint_to_fp,
uint_to_fp, X86VUintToFpRnd,
- SchedWriteCvtDQ2PS>, XD, EVEX_CD8<32, CD8VF>;
+ SchedWriteCvtDQ2PS>, TB, XD, EVEX_CD8<32, CD8VF>;
defm VCVTPS2DQ : avx512_cvtps2dq<0x5B, "vcvtps2dq", X86cvtp2Int, X86cvtp2Int,
- X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, PD,
+ X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, TB, PD,
EVEX_CD8<32, CD8VF>;
defm VCVTPD2DQ : avx512_cvtpd2dq<0xE6, "vcvtpd2dq", X86cvtp2Int, X86cvtp2Int,
- X86cvtp2IntRnd, SchedWriteCvtPD2DQ>, XD,
+ X86cvtp2IntRnd, SchedWriteCvtPD2DQ>, TB, XD,
REX_W, EVEX_CD8<64, CD8VF>;
defm VCVTPS2UDQ : avx512_cvtps2dq<0x79, "vcvtps2udq", X86cvtp2UInt, X86cvtp2UInt,
X86cvtp2UIntRnd, SchedWriteCvtPS2DQ>,
- PS, EVEX_CD8<32, CD8VF>;
+ TB, EVEX_CD8<32, CD8VF>;
defm VCVTPD2UDQ : avx512_cvtpd2dq<0x79, "vcvtpd2udq", X86cvtp2UInt, X86cvtp2UInt,
X86cvtp2UIntRnd, SchedWriteCvtPD2DQ>, REX_W,
- PS, EVEX_CD8<64, CD8VF>;
+ TB, EVEX_CD8<64, CD8VF>;
defm VCVTPD2QQ : avx512_cvtpd2qq<0x7B, "vcvtpd2qq", X86cvtp2Int, X86cvtp2Int,
X86cvtp2IntRnd, SchedWriteCvtPD2DQ>, REX_W,
- PD, EVEX_CD8<64, CD8VF>;
+ TB, PD, EVEX_CD8<64, CD8VF>;
defm VCVTPS2QQ : avx512_cvtps2qq<0x7B, "vcvtps2qq", X86cvtp2Int, X86cvtp2Int,
- X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, PD,
+ X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, TB, PD,
EVEX_CD8<32, CD8VH>;
defm VCVTPD2UQQ : avx512_cvtpd2qq<0x79, "vcvtpd2uqq", X86cvtp2UInt, X86cvtp2UInt,
X86cvtp2UIntRnd, SchedWriteCvtPD2DQ>, REX_W,
- PD, EVEX_CD8<64, CD8VF>;
+ TB, PD, EVEX_CD8<64, CD8VF>;
defm VCVTPS2UQQ : avx512_cvtps2qq<0x79, "vcvtps2uqq", X86cvtp2UInt, X86cvtp2UInt,
- X86cvtp2UIntRnd, SchedWriteCvtPS2DQ>, PD,
+ X86cvtp2UIntRnd, SchedWriteCvtPS2DQ>, TB, PD,
EVEX_CD8<32, CD8VH>;
defm VCVTTPD2QQ : avx512_cvttpd2qq<0x7A, "vcvttpd2qq", X86any_cvttp2si,
X86cvttp2si, X86cvttp2siSAE,
SchedWriteCvtPD2DQ>, REX_W,
- PD, EVEX_CD8<64, CD8VF>;
+ TB, PD, EVEX_CD8<64, CD8VF>;
defm VCVTTPS2QQ : avx512_cvttps2qq<0x7A, "vcvttps2qq", X86any_cvttp2si,
X86cvttp2si, X86cvttp2siSAE,
- SchedWriteCvtPS2DQ>, PD,
+ SchedWriteCvtPS2DQ>, TB, PD,
EVEX_CD8<32, CD8VH>;
defm VCVTTPD2UQQ : avx512_cvttpd2qq<0x78, "vcvttpd2uqq", X86any_cvttp2ui,
X86cvttp2ui, X86cvttp2uiSAE,
SchedWriteCvtPD2DQ>, REX_W,
- PD, EVEX_CD8<64, CD8VF>;
+ TB, PD, EVEX_CD8<64, CD8VF>;
defm VCVTTPS2UQQ : avx512_cvttps2qq<0x78, "vcvttps2uqq", X86any_cvttp2ui,
X86cvttp2ui, X86cvttp2uiSAE,
- SchedWriteCvtPS2DQ>, PD,
+ SchedWriteCvtPS2DQ>, TB, PD,
EVEX_CD8<32, CD8VH>;
defm VCVTQQ2PD : avx512_cvtqq2pd<0xE6, "vcvtqq2pd", any_sint_to_fp,
sint_to_fp, X86VSintToFpRnd,
- SchedWriteCvtDQ2PD>, REX_W, XS, EVEX_CD8<64, CD8VF>;
+ SchedWriteCvtDQ2PD>, REX_W, TB, XS, EVEX_CD8<64, CD8VF>;
defm VCVTUQQ2PD : avx512_cvtqq2pd<0x7A, "vcvtuqq2pd", any_uint_to_fp,
uint_to_fp, X86VUintToFpRnd, SchedWriteCvtDQ2PD>,
- REX_W, XS, EVEX_CD8<64, CD8VF>;
+ REX_W, TB, XS, EVEX_CD8<64, CD8VF>;
defm VCVTDQ2PH : avx512_cvtqq2ps_dq2ph<0x5B, "vcvtdq2ph", any_sint_to_fp, sint_to_fp,
X86any_VSintToFP, X86VMSintToFP,
X86VSintToFpRnd, avx512vl_f16_info, avx512vl_i32_info,
SchedWriteCvtDQ2PS, HasFP16>,
- T_MAP5PS, EVEX_CD8<32, CD8VF>;
+ T_MAP5, EVEX_CD8<32, CD8VF>;
defm VCVTUDQ2PH : avx512_cvtqq2ps_dq2ph<0x7A, "vcvtudq2ph", any_uint_to_fp, uint_to_fp,
X86any_VUintToFP, X86VMUintToFP,
X86VUintToFpRnd, avx512vl_f16_info, avx512vl_i32_info,
- SchedWriteCvtDQ2PS, HasFP16>, T_MAP5XD,
+ SchedWriteCvtDQ2PS, HasFP16>, T_MAP5, XD,
EVEX_CD8<32, CD8VF>;
defm VCVTQQ2PS : avx512_cvtqq2ps_dq2ph<0x5B, "vcvtqq2ps", any_sint_to_fp, sint_to_fp,
X86any_VSintToFP, X86VMSintToFP,
X86VSintToFpRnd, avx512vl_f32_info, avx512vl_i64_info,
- SchedWriteCvtDQ2PS>, REX_W, PS,
+ SchedWriteCvtDQ2PS>, REX_W, TB,
EVEX_CD8<64, CD8VF>;
defm VCVTUQQ2PS : avx512_cvtqq2ps_dq2ph<0x7A, "vcvtuqq2ps", any_uint_to_fp, uint_to_fp,
X86any_VUintToFP, X86VMUintToFP,
X86VUintToFpRnd, avx512vl_f32_info, avx512vl_i64_info,
- SchedWriteCvtDQ2PS>, REX_W, XD,
+ SchedWriteCvtDQ2PS>, REX_W, TB, XD,
EVEX_CD8<64, CD8VF>;
let Predicates = [HasVLX] in {
@@ -8912,12 +8912,12 @@ multiclass avx512_cvtph2ps<X86VectorVTInfo _dest, X86VectorVTInfo _src,
(ins _src.RC:$src), "vcvtph2ps", "$src", "$src",
(X86any_cvtph2ps (_src.VT _src.RC:$src)),
(X86cvtph2ps (_src.VT _src.RC:$src))>,
- T8PD, Sched<[sched]>;
+ T8, PD, Sched<[sched]>;
defm rm : AVX512_maskable_split<0x13, MRMSrcMem, _dest, (outs _dest.RC:$dst),
(ins x86memop:$src), "vcvtph2ps", "$src", "$src",
(X86any_cvtph2ps (_src.VT ld_dag)),
(X86cvtph2ps (_src.VT ld_dag))>,
- T8PD, Sched<[sched.Folded]>;
+ T8, PD, Sched<[sched.Folded]>;
}
multiclass avx512_cvtph2ps_sae<X86VectorVTInfo _dest, X86VectorVTInfo _src,
@@ -8927,7 +8927,7 @@ multiclass avx512_cvtph2ps_sae<X86VectorVTInfo _dest, X86VectorVTInfo _src,
(ins _src.RC:$src), "vcvtph2ps",
"{sae}, $src", "$src, {sae}",
(X86cvtph2psSAE (_src.VT _src.RC:$src))>,
- T8PD, EVEX_B, Sched<[sched]>;
+ T8, PD, EVEX_B, Sched<[sched]>;
}
let Predicates = [HasAVX512] in
@@ -9068,55 +9068,55 @@ let Defs = [EFLAGS], Predicates = [HasAVX512] in {
let Defs = [EFLAGS], Predicates = [HasAVX512] in {
defm VUCOMISSZ : sse12_ord_cmp<0x2E, FR32X, X86any_fcmp, f32, f32mem, loadf32,
- "ucomiss", SSEPackedSingle>, PS, EVEX, VEX_LIG,
+ "ucomiss", SSEPackedSingle>, TB, EVEX, VEX_LIG,
EVEX_CD8<32, CD8VT1>;
defm VUCOMISDZ : sse12_ord_cmp<0x2E, FR64X, X86any_fcmp, f64, f64mem, loadf64,
- "ucomisd", SSEPackedDouble>, PD, EVEX,
+ "ucomisd", SSEPackedDouble>, TB, PD, EVEX,
VEX_LIG, REX_W, EVEX_CD8<64, CD8VT1>;
defm VCOMISSZ : sse12_ord_cmp<0x2F, FR32X, X86strict_fcmps, f32, f32mem, loadf32,
- "comiss", SSEPackedSingle>, PS, EVEX, VEX_LIG,
+ "comiss", SSEPackedSingle>, TB, EVEX, VEX_LIG,
EVEX_CD8<32, CD8VT1>;
defm VCOMISDZ : sse12_ord_cmp<0x2F, FR64X, X86strict_fcmps, f64, f64mem, loadf64,
- "comisd", SSEPackedDouble>, PD, EVEX,
+ "comisd", SSEPackedDouble>, TB, PD, EVEX,
VEX_LIG, REX_W, EVEX_CD8<64, CD8VT1>;
let isCodeGenOnly = 1 in {
defm VUCOMISSZ : sse12_ord_cmp_int<0x2E, VR128X, X86ucomi, v4f32, ssmem,
- sse_load_f32, "ucomiss", SSEPackedSingle>, PS, EVEX, VEX_LIG,
+ sse_load_f32, "ucomiss", SSEPackedSingle>, TB, EVEX, VEX_LIG,
EVEX_CD8<32, CD8VT1>;
defm VUCOMISDZ : sse12_ord_cmp_int<0x2E, VR128X, X86ucomi, v2f64, sdmem,
- sse_load_f64, "ucomisd", SSEPackedDouble>, PD, EVEX,
+ sse_load_f64, "ucomisd", SSEPackedDouble>, TB, PD, EVEX,
VEX_LIG, REX_W, EVEX_CD8<64, CD8VT1>;
defm VCOMISSZ : sse12_ord_cmp_int<0x2F, VR128X, X86comi, v4f32, ssmem,
- sse_load_f32, "comiss", SSEPackedSingle>, PS, EVEX, VEX_LIG,
+ sse_load_f32, "comiss", SSEPackedSingle>, TB, EVEX, VEX_LIG,
EVEX_CD8<32, CD8VT1>;
defm VCOMISDZ : sse12_ord_cmp_int<0x2F, VR128X, X86comi, v2f64, sdmem,
- sse_load_f64, "comisd", SSEPackedDouble>, PD, EVEX,
+ sse_load_f64, "comisd", SSEPackedDouble>, TB, PD, EVEX,
VEX_LIG, REX_W, EVEX_CD8<64, CD8VT1>;
}
}
let Defs = [EFLAGS], Predicates = [HasFP16] in {
defm VUCOMISHZ : avx512_ord_cmp_sae<0x2E, v8f16x_info, "vucomish",
- SSEPackedSingle>, AVX512PSIi8Base, T_MAP5PS,
+ SSEPackedSingle>, AVX512PSIi8Base, T_MAP5,
EVEX_CD8<16, CD8VT1>;
defm VCOMISHZ : avx512_ord_cmp_sae<0x2F, v8f16x_info, "vcomish",
- SSEPackedSingle>, AVX512PSIi8Base, T_MAP5PS,
+ SSEPackedSingle>, AVX512PSIi8Base, T_MAP5,
EVEX_CD8<16, CD8VT1>;
defm VUCOMISHZ : sse12_ord_cmp<0x2E, FR16X, X86any_fcmp, f16, f16mem, loadf16,
- "ucomish", SSEPackedSingle>, T_MAP5PS, EVEX,
+ "ucomish", SSEPackedSingle>, T_MAP5, EVEX,
VEX_LIG, EVEX_CD8<16, CD8VT1>;
defm VCOMISHZ : sse12_ord_cmp<0x2F, FR16X, X86strict_fcmps, f16, f16mem, loadf16,
- "comish", SSEPackedSingle>, T_MAP5PS, EVEX,
+ "comish", SSEPackedSingle>, T_MAP5, EVEX,
VEX_LIG, EVEX_CD8<16, CD8VT1>;
let isCodeGenOnly = 1 in {
defm VUCOMISHZ : sse12_ord_cmp_int<0x2E, VR128X, X86ucomi, v8f16, shmem,
sse_load_f16, "ucomish", SSEPackedSingle>,
- T_MAP5PS, EVEX, VEX_LIG, EVEX_CD8<16, CD8VT1>;
+ T_MAP5, EVEX, VEX_LIG, EVEX_CD8<16, CD8VT1>;
defm VCOMISHZ : sse12_ord_cmp_int<0x2F, VR128X, X86comi, v8f16, shmem,
sse_load_f16, "comish", SSEPackedSingle>,
- T_MAP5PS, EVEX, VEX_LIG, EVEX_CD8<16, CD8VT1>;
+ T_MAP5, EVEX, VEX_LIG, EVEX_CD8<16, CD8VT1>;
}
}
@@ -9129,35 +9129,35 @@ multiclass avx512_fp14_s<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src1, _.RC:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(OpNode (_.VT _.RC:$src1), (_.VT _.RC:$src2))>,
- EVEX_4V, VEX_LIG, Sched<[sched]>;
+ EVEX, VVVV, VEX_LIG, Sched<[sched]>;
defm rm : AVX512_maskable_scalar<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.IntScalarMemOp:$src2), OpcodeStr,
"$src2, $src1", "$src1, $src2",
(OpNode (_.VT _.RC:$src1),
- (_.ScalarIntMemFrags addr:$src2))>, EVEX_4V, VEX_LIG,
+ (_.ScalarIntMemFrags addr:$src2))>, EVEX, VVVV, VEX_LIG,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
defm VRCPSHZ : avx512_fp14_s<0x4D, "vrcpsh", X86rcp14s, SchedWriteFRcp.Scl,
f16x_info, HasFP16>, EVEX_CD8<16, CD8VT1>,
- T_MAP6PD;
+ T_MAP6, PD;
defm VRSQRTSHZ : avx512_fp14_s<0x4F, "vrsqrtsh", X86rsqrt14s,
SchedWriteFRsqrt.Scl, f16x_info, HasFP16>,
- EVEX_CD8<16, CD8VT1>, T_MAP6PD;
+ EVEX_CD8<16, CD8VT1>, T_MAP6, PD;
let Uses = [MXCSR] in {
defm VRCP14SSZ : avx512_fp14_s<0x4D, "vrcp14ss", X86rcp14s, SchedWriteFRcp.Scl,
f32x_info>, EVEX_CD8<32, CD8VT1>,
- T8PD;
+ T8, PD;
defm VRCP14SDZ : avx512_fp14_s<0x4D, "vrcp14sd", X86rcp14s, SchedWriteFRcp.Scl,
f64x_info>, REX_W, EVEX_CD8<64, CD8VT1>,
- T8PD;
+ T8, PD;
defm VRSQRT14SSZ : avx512_fp14_s<0x4F, "vrsqrt14ss", X86rsqrt14s,
SchedWriteFRsqrt.Scl, f32x_info>,
- EVEX_CD8<32, CD8VT1>, T8PD;
+ EVEX_CD8<32, CD8VT1>, T8, PD;
defm VRSQRT14SDZ : avx512_fp14_s<0x4F, "vrsqrt14sd", X86rsqrt14s,
SchedWriteFRsqrt.Scl, f64x_info>, REX_W,
- EVEX_CD8<64, CD8VT1>, T8PD;
+ EVEX_CD8<64, CD8VT1>, T8, PD;
}
/// avx512_fp14_p rcp14ps, rcp14pd, rsqrt14ps, rsqrt14pd
@@ -9166,19 +9166,19 @@ multiclass avx512_fp14_p<bits<8> opc, string OpcodeStr, SDNode OpNode,
let ExeDomain = _.ExeDomain in {
defm r: AVX512_maskable<opc, MRMSrcReg, _, (outs _.RC:$dst),
(ins _.RC:$src), OpcodeStr, "$src", "$src",
- (_.VT (OpNode _.RC:$src))>, EVEX, T8PD,
+ (_.VT (OpNode _.RC:$src))>, EVEX, T8, PD,
Sched<[sched]>;
defm m: AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.MemOp:$src), OpcodeStr, "$src", "$src",
(OpNode (_.VT
- (bitconvert (_.LdFrag addr:$src))))>, EVEX, T8PD,
+ (bitconvert (_.LdFrag addr:$src))))>, EVEX, T8, PD,
Sched<[sched.Folded, sched.ReadAfterFold]>;
defm mb: AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.ScalarMemOp:$src), OpcodeStr,
"${src}"#_.BroadcastStr, "${src}"#_.BroadcastStr,
(OpNode (_.VT
(_.BroadcastLdFrag addr:$src)))>,
- EVEX, T8PD, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, T8, PD, EVEX_B, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -9192,7 +9192,7 @@ multiclass avx512_fp14_p_vl_all<bits<8> opc, string OpcodeStr, SDNode OpNode,
}
let Predicates = [HasFP16] in
defm PHZ : avx512_fp14_p<opc, !strconcat(OpcodeStr, "ph"), OpNode, sched.ZMM,
- v32f16_info>, EVEX_V512, T_MAP6PD, EVEX_CD8<16, CD8VF>;
+ v32f16_info>, EVEX_V512, T_MAP6, EVEX_CD8<16, CD8VF>;
// Define only if AVX512VL feature is present.
let Predicates = [HasVLX], Uses = [MXCSR] in {
@@ -9212,10 +9212,10 @@ multiclass avx512_fp14_p_vl_all<bits<8> opc, string OpcodeStr, SDNode OpNode,
let Predicates = [HasFP16, HasVLX] in {
defm PHZ128 : avx512_fp14_p<opc, !strconcat(OpcodeStr, "ph"),
OpNode, sched.XMM, v8f16x_info>,
- EVEX_V128, T_MAP6PD, EVEX_CD8<16, CD8VF>;
+ EVEX_V128, T_MAP6, EVEX_CD8<16, CD8VF>;
defm PHZ256 : avx512_fp14_p<opc, !strconcat(OpcodeStr, "ph"),
OpNode, sched.YMM, v16f16x_info>,
- EVEX_V256, T_MAP6PD, EVEX_CD8<16, CD8VF>;
+ EVEX_V256, T_MAP6, EVEX_CD8<16, CD8VF>;
}
}
@@ -9250,16 +9250,16 @@ multiclass avx512_fp28_s<bits<8> opc, string OpcodeStr,X86VectorVTInfo _,
multiclass avx512_eri_s<bits<8> opc, string OpcodeStr, SDNode OpNode,
SDNode OpNodeSAE, X86FoldableSchedWrite sched> {
defm SSZ : avx512_fp28_s<opc, OpcodeStr#"ss", f32x_info, OpNode, OpNodeSAE,
- sched>, EVEX_CD8<32, CD8VT1>, VEX_LIG, T8PD, EVEX_4V;
+ sched>, EVEX_CD8<32, CD8VT1>, VEX_LIG, T8, PD, EVEX, VVVV;
defm SDZ : avx512_fp28_s<opc, OpcodeStr#"sd", f64x_info, OpNode, OpNodeSAE,
- sched>, EVEX_CD8<64, CD8VT1>, VEX_LIG, REX_W, T8PD, EVEX_4V;
+ sched>, EVEX_CD8<64, CD8VT1>, VEX_LIG, REX_W, T8, PD, EVEX, VVVV;
}
multiclass avx512_vgetexpsh<bits<8> opc, string OpcodeStr, SDNode OpNode,
SDNode OpNodeSAE, X86FoldableSchedWrite sched> {
let Predicates = [HasFP16] in
defm SHZ : avx512_fp28_s<opc, OpcodeStr#"sh", f16x_info, OpNode, OpNodeSAE, sched>,
- EVEX_CD8<16, CD8VT1>, T_MAP6PD, EVEX_4V;
+ EVEX_CD8<16, CD8VT1>, T_MAP6, PD, EVEX, VVVV;
}
let Predicates = [HasERI] in {
@@ -9311,10 +9311,10 @@ multiclass avx512_eri<bits<8> opc, string OpcodeStr, SDNode OpNode,
SDNode OpNodeSAE, X86SchedWriteWidths sched> {
defm PSZ : avx512_fp28_p<opc, OpcodeStr#"ps", v16f32_info, OpNode, sched.ZMM>,
avx512_fp28_p_sae<opc, OpcodeStr#"ps", v16f32_info, OpNodeSAE, sched.ZMM>,
- T8PD, EVEX_V512, EVEX_CD8<32, CD8VF>;
+ T8, PD, EVEX_V512, EVEX_CD8<32, CD8VF>;
defm PDZ : avx512_fp28_p<opc, OpcodeStr#"pd", v8f64_info, OpNode, sched.ZMM>,
avx512_fp28_p_sae<opc, OpcodeStr#"pd", v8f64_info, OpNodeSAE, sched.ZMM>,
- T8PD, EVEX_V512, REX_W, EVEX_CD8<64, CD8VF>;
+ T8, PD, EVEX_V512, REX_W, EVEX_CD8<64, CD8VF>;
}
multiclass avx512_fp_unaryop_packed<bits<8> opc, string OpcodeStr,
@@ -9323,16 +9323,16 @@ multiclass avx512_fp_unaryop_packed<bits<8> opc, string OpcodeStr,
let Predicates = [HasVLX] in {
defm PSZ128 : avx512_fp28_p<opc, OpcodeStr#"ps", v4f32x_info, OpNode,
sched.XMM>,
- EVEX_V128, T8PD, EVEX_CD8<32, CD8VF>;
+ EVEX_V128, T8, PD, EVEX_CD8<32, CD8VF>;
defm PSZ256 : avx512_fp28_p<opc, OpcodeStr#"ps", v8f32x_info, OpNode,
sched.YMM>,
- EVEX_V256, T8PD, EVEX_CD8<32, CD8VF>;
+ EVEX_V256, T8, PD, EVEX_CD8<32, CD8VF>;
defm PDZ128 : avx512_fp28_p<opc, OpcodeStr#"pd", v2f64x_info, OpNode,
sched.XMM>,
- EVEX_V128, REX_W, T8PD, EVEX_CD8<64, CD8VF>;
+ EVEX_V128, REX_W, T8, PD, EVEX_CD8<64, CD8VF>;
defm PDZ256 : avx512_fp28_p<opc, OpcodeStr#"pd", v4f64x_info, OpNode,
sched.YMM>,
- EVEX_V256, REX_W, T8PD, EVEX_CD8<64, CD8VF>;
+ EVEX_V256, REX_W, T8, PD, EVEX_CD8<64, CD8VF>;
}
}
@@ -9341,12 +9341,12 @@ multiclass avx512_vgetexp_fp16<bits<8> opc, string OpcodeStr, SDNode OpNode,
let Predicates = [HasFP16] in
defm PHZ : avx512_fp28_p<opc, OpcodeStr#"ph", v32f16_info, OpNode, sched.ZMM>,
avx512_fp28_p_sae<opc, OpcodeStr#"ph", v32f16_info, OpNodeSAE, sched.ZMM>,
- T_MAP6PD, EVEX_V512, EVEX_CD8<16, CD8VF>;
+ T_MAP6, PD, EVEX_V512, EVEX_CD8<16, CD8VF>;
let Predicates = [HasFP16, HasVLX] in {
defm PHZ128 : avx512_fp28_p<opc, OpcodeStr#"ph", v8f16x_info, OpNode, sched.XMM>,
- EVEX_V128, T_MAP6PD, EVEX_CD8<16, CD8VF>;
+ EVEX_V128, T_MAP6, PD, EVEX_CD8<16, CD8VF>;
defm PHZ256 : avx512_fp28_p<opc, OpcodeStr#"ph", v16f16x_info, OpNode, sched.YMM>,
- EVEX_V256, T_MAP6PD, EVEX_CD8<16, CD8VF>;
+ EVEX_V256, T_MAP6, PD, EVEX_CD8<16, CD8VF>;
}
}
let Predicates = [HasERI] in {
@@ -9401,35 +9401,35 @@ multiclass avx512_sqrt_packed_all<bits<8> opc, string OpcodeStr,
let Predicates = [HasFP16] in
defm PHZ : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "ph"),
sched.PH.ZMM, v32f16_info>,
- EVEX_V512, T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ EVEX_V512, T_MAP5, EVEX_CD8<16, CD8VF>;
let Predicates = [HasFP16, HasVLX] in {
defm PHZ128 : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "ph"),
sched.PH.XMM, v8f16x_info>,
- EVEX_V128, T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ EVEX_V128, T_MAP5, EVEX_CD8<16, CD8VF>;
defm PHZ256 : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "ph"),
sched.PH.YMM, v16f16x_info>,
- EVEX_V256, T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ EVEX_V256, T_MAP5, EVEX_CD8<16, CD8VF>;
}
defm PSZ : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "ps"),
sched.PS.ZMM, v16f32_info>,
- EVEX_V512, PS, EVEX_CD8<32, CD8VF>;
+ EVEX_V512, TB, EVEX_CD8<32, CD8VF>;
defm PDZ : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "pd"),
sched.PD.ZMM, v8f64_info>,
- EVEX_V512, REX_W, PD, EVEX_CD8<64, CD8VF>;
+ EVEX_V512, REX_W, TB, PD, EVEX_CD8<64, CD8VF>;
// Define only if AVX512VL feature is present.
let Predicates = [HasVLX] in {
defm PSZ128 : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "ps"),
sched.PS.XMM, v4f32x_info>,
- EVEX_V128, PS, EVEX_CD8<32, CD8VF>;
+ EVEX_V128, TB, EVEX_CD8<32, CD8VF>;
defm PSZ256 : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "ps"),
sched.PS.YMM, v8f32x_info>,
- EVEX_V256, PS, EVEX_CD8<32, CD8VF>;
+ EVEX_V256, TB, EVEX_CD8<32, CD8VF>;
defm PDZ128 : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "pd"),
sched.PD.XMM, v2f64x_info>,
- EVEX_V128, REX_W, PD, EVEX_CD8<64, CD8VF>;
+ EVEX_V128, REX_W, TB, PD, EVEX_CD8<64, CD8VF>;
defm PDZ256 : avx512_sqrt_packed<opc, !strconcat(OpcodeStr, "pd"),
sched.PD.YMM, v4f64x_info>,
- EVEX_V256, REX_W, PD, EVEX_CD8<64, CD8VF>;
+ EVEX_V256, REX_W, TB, PD, EVEX_CD8<64, CD8VF>;
}
}
@@ -9439,13 +9439,13 @@ multiclass avx512_sqrt_packed_all_round<bits<8> opc, string OpcodeStr,
let Predicates = [HasFP16] in
defm PHZ : avx512_sqrt_packed_round<opc, !strconcat(OpcodeStr, "ph"),
sched.PH.ZMM, v32f16_info>,
- EVEX_V512, T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ EVEX_V512, T_MAP5, EVEX_CD8<16, CD8VF>;
defm PSZ : avx512_sqrt_packed_round<opc, !strconcat(OpcodeStr, "ps"),
sched.PS.ZMM, v16f32_info>,
- EVEX_V512, PS, EVEX_CD8<32, CD8VF>;
+ EVEX_V512, TB, EVEX_CD8<32, CD8VF>;
defm PDZ : avx512_sqrt_packed_round<opc, !strconcat(OpcodeStr, "pd"),
sched.PD.ZMM, v8f64_info>,
- EVEX_V512, REX_W, PD, EVEX_CD8<64, CD8VF>;
+ EVEX_V512, REX_W, TB, PD, EVEX_CD8<64, CD8VF>;
}
multiclass avx512_sqrt_scalar<bits<8> opc, string OpcodeStr, X86FoldableSchedWrite sched,
@@ -9501,11 +9501,11 @@ multiclass avx512_sqrt_scalar<bits<8> opc, string OpcodeStr, X86FoldableSchedWri
multiclass avx512_sqrt_scalar_all<bits<8> opc, string OpcodeStr,
X86SchedWriteSizes sched> {
defm SHZ : avx512_sqrt_scalar<opc, OpcodeStr#"sh", sched.PH.Scl, f16x_info, NAME#"SH", HasFP16>,
- EVEX_CD8<16, CD8VT1>, EVEX_4V, T_MAP5XS;
+ EVEX_CD8<16, CD8VT1>, EVEX, VVVV, T_MAP5, XS;
defm SSZ : avx512_sqrt_scalar<opc, OpcodeStr#"ss", sched.PS.Scl, f32x_info, NAME#"SS">,
- EVEX_CD8<32, CD8VT1>, EVEX_4V, XS;
+ EVEX_CD8<32, CD8VT1>, EVEX, VVVV, TB, XS;
defm SDZ : avx512_sqrt_scalar<opc, OpcodeStr#"sd", sched.PD.Scl, f64x_info, NAME#"SD">,
- EVEX_CD8<64, CD8VT1>, EVEX_4V, XD, REX_W;
+ EVEX_CD8<64, CD8VT1>, EVEX, VVVV, TB, XD, REX_W;
}
defm VSQRT : avx512_sqrt_packed_all<0x51, "vsqrt", SchedWriteFSqrtSizes>,
@@ -9569,17 +9569,17 @@ multiclass avx512_rndscale_scalar<bits<8> opc, string OpcodeStr,
let Predicates = [HasFP16] in
defm VRNDSCALESHZ : avx512_rndscale_scalar<0x0A, "vrndscalesh",
SchedWriteFRnd.Scl, f16x_info>,
- AVX512PSIi8Base, TA, EVEX_4V,
+ AVX512PSIi8Base, TA, EVEX, VVVV,
EVEX_CD8<16, CD8VT1>;
defm VRNDSCALESSZ : avx512_rndscale_scalar<0x0A, "vrndscaless",
SchedWriteFRnd.Scl, f32x_info>,
- AVX512AIi8Base, EVEX_4V, VEX_LIG,
+ AVX512AIi8Base, EVEX, VVVV, VEX_LIG,
EVEX_CD8<32, CD8VT1>;
defm VRNDSCALESDZ : avx512_rndscale_scalar<0x0B, "vrndscalesd",
SchedWriteFRnd.Scl, f64x_info>,
- REX_W, AVX512AIi8Base, EVEX_4V, VEX_LIG,
+ REX_W, AVX512AIi8Base, EVEX, VVVV, VEX_LIG,
EVEX_CD8<64, CD8VT1>;
multiclass avx512_masked_scalar<SDNode OpNode, string OpcPrefix, SDNode Move,
@@ -9923,16 +9923,16 @@ multiclass avx512_pmovx_bw<bits<8> opc, string OpcodeStr,
let Predicates = [HasVLX, HasBWI] in {
defm Z128: avx512_pmovx_common<opc, OpcodeStr, sched.XMM, v8i16x_info,
v16i8x_info, i64mem, LdFrag, InVecNode>,
- EVEX_CD8<8, CD8VH>, T8PD, EVEX_V128, WIG;
+ EVEX_CD8<8, CD8VH>, T8, PD, EVEX_V128, WIG;
defm Z256: avx512_pmovx_common<opc, OpcodeStr, sched.YMM, v16i16x_info,
v16i8x_info, i128mem, LdFrag, OpNode>,
- EVEX_CD8<8, CD8VH>, T8PD, EVEX_V256, WIG;
+ EVEX_CD8<8, CD8VH>, T8, PD, EVEX_V256, WIG;
}
let Predicates = [HasBWI] in {
defm Z : avx512_pmovx_common<opc, OpcodeStr, sched.ZMM, v32i16_info,
v32i8x_info, i256mem, LdFrag, OpNode>,
- EVEX_CD8<8, CD8VH>, T8PD, EVEX_V512, WIG;
+ EVEX_CD8<8, CD8VH>, T8, PD, EVEX_V512, WIG;
}
}
@@ -9943,16 +9943,16 @@ multiclass avx512_pmovx_bd<bits<8> opc, string OpcodeStr,
let Predicates = [HasVLX, HasAVX512] in {
defm Z128: avx512_pmovx_common<opc, OpcodeStr, sched.XMM, v4i32x_info,
v16i8x_info, i32mem, LdFrag, InVecNode>,
- EVEX_CD8<8, CD8VQ>, T8PD, EVEX_V128, WIG;
+ EVEX_CD8<8, CD8VQ>, T8, PD, EVEX_V128, WIG;
defm Z256: avx512_pmovx_common<opc, OpcodeStr, sched.YMM, v8i32x_info,
v16i8x_info, i64mem, LdFrag, InVecNode>,
- EVEX_CD8<8, CD8VQ>, T8PD, EVEX_V256, WIG;
+ EVEX_CD8<8, CD8VQ>, T8, PD, EVEX_V256, WIG;
}
let Predicates = [HasAVX512] in {
defm Z : avx512_pmovx_common<opc, OpcodeStr, sched.ZMM, v16i32_info,
v16i8x_info, i128mem, LdFrag, OpNode>,
- EVEX_CD8<8, CD8VQ>, T8PD, EVEX_V512, WIG;
+ EVEX_CD8<8, CD8VQ>, T8, PD, EVEX_V512, WIG;
}
}
@@ -9963,16 +9963,16 @@ multiclass avx512_pmovx_bq<bits<8> opc, string OpcodeStr,
let Predicates = [HasVLX, HasAVX512] in {
defm Z128: avx512_pmovx_common<opc, OpcodeStr, sched.XMM, v2i64x_info,
v16i8x_info, i16mem, LdFrag, InVecNode>,
- EVEX_CD8<8, CD8VO>, T8PD, EVEX_V128, WIG;
+ EVEX_CD8<8, CD8VO>, T8, PD, EVEX_V128, WIG;
defm Z256: avx512_pmovx_common<opc, OpcodeStr, sched.YMM, v4i64x_info,
v16i8x_info, i32mem, LdFrag, InVecNode>,
- EVEX_CD8<8, CD8VO>, T8PD, EVEX_V256, WIG;
+ EVEX_CD8<8, CD8VO>, T8, PD, EVEX_V256, WIG;
}
let Predicates = [HasAVX512] in {
defm Z : avx512_pmovx_common<opc, OpcodeStr, sched.ZMM, v8i64_info,
v16i8x_info, i64mem, LdFrag, InVecNode>,
- EVEX_CD8<8, CD8VO>, T8PD, EVEX_V512, WIG;
+ EVEX_CD8<8, CD8VO>, T8, PD, EVEX_V512, WIG;
}
}
@@ -9983,16 +9983,16 @@ multiclass avx512_pmovx_wd<bits<8> opc, string OpcodeStr,
let Predicates = [HasVLX, HasAVX512] in {
defm Z128: avx512_pmovx_common<opc, OpcodeStr, sched.XMM, v4i32x_info,
v8i16x_info, i64mem, LdFrag, InVecNode>,
- EVEX_CD8<16, CD8VH>, T8PD, EVEX_V128, WIG;
+ EVEX_CD8<16, CD8VH>, T8, PD, EVEX_V128, WIG;
defm Z256: avx512_pmovx_common<opc, OpcodeStr, sched.YMM, v8i32x_info,
v8i16x_info, i128mem, LdFrag, OpNode>,
- EVEX_CD8<16, CD8VH>, T8PD, EVEX_V256, WIG;
+ EVEX_CD8<16, CD8VH>, T8, PD, EVEX_V256, WIG;
}
let Predicates = [HasAVX512] in {
defm Z : avx512_pmovx_common<opc, OpcodeStr, sched.ZMM, v16i32_info,
v16i16x_info, i256mem, LdFrag, OpNode>,
- EVEX_CD8<16, CD8VH>, T8PD, EVEX_V512, WIG;
+ EVEX_CD8<16, CD8VH>, T8, PD, EVEX_V512, WIG;
}
}
@@ -10003,16 +10003,16 @@ multiclass avx512_pmovx_wq<bits<8> opc, string OpcodeStr,
let Predicates = [HasVLX, HasAVX512] in {
defm Z128: avx512_pmovx_common<opc, OpcodeStr, sched.XMM, v2i64x_info,
v8i16x_info, i32mem, LdFrag, InVecNode>,
- EVEX_CD8<16, CD8VQ>, T8PD, EVEX_V128, WIG;
+ EVEX_CD8<16, CD8VQ>, T8, PD, EVEX_V128, WIG;
defm Z256: avx512_pmovx_common<opc, OpcodeStr, sched.YMM, v4i64x_info,
v8i16x_info, i64mem, LdFrag, InVecNode>,
- EVEX_CD8<16, CD8VQ>, T8PD, EVEX_V256, WIG;
+ EVEX_CD8<16, CD8VQ>, T8, PD, EVEX_V256, WIG;
}
let Predicates = [HasAVX512] in {
defm Z : avx512_pmovx_common<opc, OpcodeStr, sched.ZMM, v8i64_info,
v8i16x_info, i128mem, LdFrag, OpNode>,
- EVEX_CD8<16, CD8VQ>, T8PD, EVEX_V512, WIG;
+ EVEX_CD8<16, CD8VQ>, T8, PD, EVEX_V512, WIG;
}
}
@@ -10024,16 +10024,16 @@ multiclass avx512_pmovx_dq<bits<8> opc, string OpcodeStr,
let Predicates = [HasVLX, HasAVX512] in {
defm Z128: avx512_pmovx_common<opc, OpcodeStr, sched.XMM, v2i64x_info,
v4i32x_info, i64mem, LdFrag, InVecNode>,
- EVEX_CD8<32, CD8VH>, T8PD, EVEX_V128;
+ EVEX_CD8<32, CD8VH>, T8, PD, EVEX_V128;
defm Z256: avx512_pmovx_common<opc, OpcodeStr, sched.YMM, v4i64x_info,
v4i32x_info, i128mem, LdFrag, OpNode>,
- EVEX_CD8<32, CD8VH>, T8PD, EVEX_V256;
+ EVEX_CD8<32, CD8VH>, T8, PD, EVEX_V256;
}
let Predicates = [HasAVX512] in {
defm Z : avx512_pmovx_common<opc, OpcodeStr, sched.ZMM, v8i64_info,
v8i32x_info, i256mem, LdFrag, OpNode>,
- EVEX_CD8<32, CD8VH>, T8PD, EVEX_V512;
+ EVEX_CD8<32, CD8VH>, T8, PD, EVEX_V512;
}
}
@@ -10663,7 +10663,7 @@ multiclass avx512_fp_packed_imm<bits<8> opc, string OpcodeStr, SDNode OpNode,
multiclass avx512_3Op_rm_imm8<bits<8> opc, string OpcodeStr, SDNode OpNode,
X86FoldableSchedWrite sched, X86VectorVTInfo DestInfo,
X86VectorVTInfo SrcInfo>{
- let ExeDomain = DestInfo.ExeDomain in {
+ let ExeDomain = DestInfo.ExeDomain, ImmT = Imm8 in {
defm rri : AVX512_maskable<opc, MRMSrcReg, DestInfo, (outs DestInfo.RC:$dst),
(ins SrcInfo.RC:$src1, SrcInfo.RC:$src2, u8imm:$src3),
OpcodeStr, "$src3, $src2, $src1", "$src1, $src2, $src3",
@@ -10689,7 +10689,7 @@ multiclass avx512_3Op_imm8<bits<8> opc, string OpcodeStr, SDNode OpNode,
X86FoldableSchedWrite sched, X86VectorVTInfo _>:
avx512_3Op_rm_imm8<opc, OpcodeStr, OpNode, sched, _, _>{
- let ExeDomain = _.ExeDomain in
+ let ExeDomain = _.ExeDomain, ImmT = Imm8 in
defm rmbi : AVX512_maskable<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src1, _.ScalarMemOp:$src2, u8imm:$src3),
OpcodeStr, "$src3, ${src2}"#_.BroadcastStr#", $src1",
@@ -10773,13 +10773,13 @@ multiclass avx512_common_3Op_rm_imm8<bits<8> opc, SDNode OpNode, string OpStr,
AVX512VLVectorVTInfo SrcInfo, Predicate Pred = HasBWI> {
let Predicates = [Pred] in {
defm Z : avx512_3Op_rm_imm8<opc, OpStr, OpNode, sched.ZMM, DestInfo.info512,
- SrcInfo.info512>, EVEX_V512, AVX512AIi8Base, EVEX_4V;
+ SrcInfo.info512>, EVEX_V512, AVX512AIi8Base, EVEX, VVVV;
}
let Predicates = [Pred, HasVLX] in {
defm Z128 : avx512_3Op_rm_imm8<opc, OpStr, OpNode, sched.XMM, DestInfo.info128,
- SrcInfo.info128>, EVEX_V128, AVX512AIi8Base, EVEX_4V;
+ SrcInfo.info128>, EVEX_V128, AVX512AIi8Base, EVEX, VVVV;
defm Z256 : avx512_3Op_rm_imm8<opc, OpStr, OpNode, sched.YMM, DestInfo.info256,
- SrcInfo.info256>, EVEX_V256, AVX512AIi8Base, EVEX_4V;
+ SrcInfo.info256>, EVEX_V256, AVX512AIi8Base, EVEX, VVVV;
}
}
@@ -10835,38 +10835,38 @@ defm VGETMANT : avx512_common_unary_fp_sae_packed_imm_all<"vgetmant", 0x26, 0x26
defm VRANGEPD : avx512_common_fp_sae_packed_imm<"vrangepd", avx512vl_f64_info,
0x50, X86VRange, X86VRangeSAE,
SchedWriteFAdd, HasDQI>,
- AVX512AIi8Base, EVEX_4V, EVEX_CD8<64, CD8VF>, REX_W;
+ AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<64, CD8VF>, REX_W;
defm VRANGEPS : avx512_common_fp_sae_packed_imm<"vrangeps", avx512vl_f32_info,
0x50, X86VRange, X86VRangeSAE,
SchedWriteFAdd, HasDQI>,
- AVX512AIi8Base, EVEX_4V, EVEX_CD8<32, CD8VF>;
+ AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<32, CD8VF>;
defm VRANGESD: avx512_common_fp_sae_scalar_imm<"vrangesd",
f64x_info, 0x51, X86Ranges, X86RangesSAE, SchedWriteFAdd, HasDQI>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<64, CD8VT1>, REX_W;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<64, CD8VT1>, REX_W;
defm VRANGESS: avx512_common_fp_sae_scalar_imm<"vrangess", f32x_info,
0x51, X86Ranges, X86RangesSAE, SchedWriteFAdd, HasDQI>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<32, CD8VT1>;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<32, CD8VT1>;
defm VREDUCESD: avx512_common_fp_sae_scalar_imm<"vreducesd", f64x_info,
0x57, X86Reduces, X86ReducesSAE, SchedWriteFRnd, HasDQI>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<64, CD8VT1>, REX_W;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<64, CD8VT1>, REX_W;
defm VREDUCESS: avx512_common_fp_sae_scalar_imm<"vreducess", f32x_info,
0x57, X86Reduces, X86ReducesSAE, SchedWriteFRnd, HasDQI>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<32, CD8VT1>;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<32, CD8VT1>;
defm VREDUCESH: avx512_common_fp_sae_scalar_imm<"vreducesh", f16x_info,
0x57, X86Reduces, X86ReducesSAE, SchedWriteFRnd, HasFP16>,
- AVX512PSIi8Base, TA, VEX_LIG, EVEX_4V, EVEX_CD8<16, CD8VT1>;
+ AVX512PSIi8Base, TA, VEX_LIG, EVEX, VVVV, EVEX_CD8<16, CD8VT1>;
defm VGETMANTSD: avx512_common_fp_sae_scalar_imm<"vgetmantsd", f64x_info,
0x27, X86GetMants, X86GetMantsSAE, SchedWriteFRnd, HasAVX512>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<64, CD8VT1>, REX_W;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<64, CD8VT1>, REX_W;
defm VGETMANTSS: avx512_common_fp_sae_scalar_imm<"vgetmantss", f32x_info,
0x27, X86GetMants, X86GetMantsSAE, SchedWriteFRnd, HasAVX512>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<32, CD8VT1>;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<32, CD8VT1>;
defm VGETMANTSH: avx512_common_fp_sae_scalar_imm<"vgetmantsh", f16x_info,
0x27, X86GetMants, X86GetMantsSAE, SchedWriteFRnd, HasFP16>,
- AVX512PSIi8Base, TA, VEX_LIG, EVEX_4V, EVEX_CD8<16, CD8VT1>;
+ AVX512PSIi8Base, TA, VEX_LIG, EVEX, VVVV, EVEX_CD8<16, CD8VT1>;
multiclass avx512_shuff_packed_128_common<bits<8> opc, string OpcodeStr,
X86FoldableSchedWrite sched,
@@ -10920,13 +10920,13 @@ multiclass avx512_shuff_packed_128<string OpcodeStr, X86FoldableSchedWrite sched
}
defm VSHUFF32X4 : avx512_shuff_packed_128<"vshuff32x4", WriteFShuffle256,
- avx512vl_f32_info, avx512vl_f64_info, 0x23, "VPERM2F128">, AVX512AIi8Base, EVEX_4V, EVEX_CD8<32, CD8VF>;
+ avx512vl_f32_info, avx512vl_f64_info, 0x23, "VPERM2F128">, AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<32, CD8VF>;
defm VSHUFF64X2 : avx512_shuff_packed_128<"vshuff64x2", WriteFShuffle256,
- avx512vl_f64_info, avx512vl_f64_info, 0x23, "VPERM2F128">, AVX512AIi8Base, EVEX_4V, EVEX_CD8<64, CD8VF>, REX_W;
+ avx512vl_f64_info, avx512vl_f64_info, 0x23, "VPERM2F128">, AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<64, CD8VF>, REX_W;
defm VSHUFI32X4 : avx512_shuff_packed_128<"vshufi32x4", WriteFShuffle256,
- avx512vl_i32_info, avx512vl_i64_info, 0x43, "VPERM2I128">, AVX512AIi8Base, EVEX_4V, EVEX_CD8<32, CD8VF>;
+ avx512vl_i32_info, avx512vl_i64_info, 0x43, "VPERM2I128">, AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<32, CD8VF>;
defm VSHUFI64X2 : avx512_shuff_packed_128<"vshufi64x2", WriteFShuffle256,
- avx512vl_i64_info, avx512vl_i64_info, 0x43, "VPERM2I128">, AVX512AIi8Base, EVEX_4V, EVEX_CD8<64, CD8VF>, REX_W;
+ avx512vl_i64_info, avx512vl_i64_info, 0x43, "VPERM2I128">, AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<64, CD8VF>, REX_W;
multiclass avx512_valign<bits<8> opc, string OpcodeStr,
X86FoldableSchedWrite sched, X86VectorVTInfo _>{
@@ -10962,15 +10962,15 @@ multiclass avx512_valign_common<string OpcodeStr, X86SchedWriteWidths sched,
AVX512VLVectorVTInfo _> {
let Predicates = [HasAVX512] in {
defm Z : avx512_valign<0x03, OpcodeStr, sched.ZMM, _.info512>,
- AVX512AIi8Base, EVEX_4V, EVEX_V512;
+ AVX512AIi8Base, EVEX, VVVV, EVEX_V512;
}
let Predicates = [HasAVX512, HasVLX] in {
defm Z128 : avx512_valign<0x03, OpcodeStr, sched.XMM, _.info128>,
- AVX512AIi8Base, EVEX_4V, EVEX_V128;
+ AVX512AIi8Base, EVEX, VVVV, EVEX_V128;
// We can't really override the 256-bit version so change it back to unset.
let EVEX2VEXOverride = ? in
defm Z256 : avx512_valign<0x03, OpcodeStr, sched.YMM, _.info256>,
- AVX512AIi8Base, EVEX_4V, EVEX_V256;
+ AVX512AIi8Base, EVEX, VVVV, EVEX_V256;
}
}
@@ -11258,7 +11258,7 @@ defm : avx512_unary_lowering<"VPOPCNTD", ctpop, avx512vl_i32_info, HasVPOPCNTDQ>
multiclass avx512_replicate<bits<8> opc, string OpcodeStr, SDNode OpNode,
X86SchedWriteWidths sched> {
defm NAME: avx512_unary_rm_vl<opc, OpcodeStr, OpNode, sched,
- avx512vl_f32_info, HasAVX512>, XS;
+ avx512vl_f32_info, HasAVX512>, TB, XS;
}
defm VMOVSHDUP : avx512_replicate<0x16, "vmovshdup", X86Movshdup,
@@ -11301,7 +11301,7 @@ multiclass avx512_movddup_common<bits<8> opc, string OpcodeStr,
multiclass avx512_movddup<bits<8> opc, string OpcodeStr,
X86SchedWriteWidths sched> {
defm NAME: avx512_movddup_common<opc, OpcodeStr, sched,
- avx512vl_f64_info>, XD, REX_W;
+ avx512vl_f64_info>, TB, XD, REX_W;
}
defm VMOVDDUP : avx512_movddup<0x12, "vmovddup", SchedWriteFShuffle>;
@@ -11369,9 +11369,9 @@ multiclass avx512_extract_elt_b<string OpcodeStr, X86VectorVTInfo _> {
OpcodeStr#"\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set GR32orGR64:$dst,
(X86pextrb (_.VT _.RC:$src1), timm:$src2))]>,
- EVEX, TAPD, Sched<[WriteVecExtract]>;
+ EVEX, TA, PD, Sched<[WriteVecExtract]>;
- defm NAME : avx512_extract_elt_bw_m<0x14, OpcodeStr, X86pextrb, _>, TAPD;
+ defm NAME : avx512_extract_elt_bw_m<0x14, OpcodeStr, X86pextrb, _>, TA, PD;
}
}
@@ -11382,15 +11382,15 @@ multiclass avx512_extract_elt_w<string OpcodeStr, X86VectorVTInfo _> {
OpcodeStr#"\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set GR32orGR64:$dst,
(X86pextrw (_.VT _.RC:$src1), timm:$src2))]>,
- EVEX, PD, Sched<[WriteVecExtract]>;
+ EVEX, TB, PD, Sched<[WriteVecExtract]>;
let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in
def rr_REV : AVX512Ii8<0x15, MRMDestReg, (outs GR32orGR64:$dst),
(ins _.RC:$src1, u8imm:$src2),
OpcodeStr#"\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- EVEX, TAPD, Sched<[WriteVecExtract]>;
+ EVEX, TA, PD, Sched<[WriteVecExtract]>;
- defm NAME : avx512_extract_elt_bw_m<0x15, OpcodeStr, X86pextrw, _>, TAPD;
+ defm NAME : avx512_extract_elt_bw_m<0x15, OpcodeStr, X86pextrw, _>, TA, PD;
}
}
@@ -11402,14 +11402,14 @@ multiclass avx512_extract_elt_dq<string OpcodeStr, X86VectorVTInfo _,
OpcodeStr#"\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set GRC:$dst,
(extractelt (_.VT _.RC:$src1), imm:$src2))]>,
- EVEX, TAPD, Sched<[WriteVecExtract]>;
+ EVEX, TA, PD, Sched<[WriteVecExtract]>;
def mr : AVX512Ii8<0x16, MRMDestMem, (outs),
(ins _.ScalarMemOp:$dst, _.RC:$src1, u8imm:$src2),
OpcodeStr#"\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(store (extractelt (_.VT _.RC:$src1),
imm:$src2),addr:$dst)]>,
- EVEX, EVEX_CD8<_.EltSize, CD8VT1>, TAPD,
+ EVEX, EVEX_CD8<_.EltSize, CD8VT1>, TA, PD,
Sched<[WriteVecExtractSt]>;
}
}
@@ -11427,7 +11427,7 @@ multiclass avx512_insert_elt_m<bits<8> opc, string OpcodeStr, SDNode OpNode,
OpcodeStr#"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
[(set _.RC:$dst,
(_.VT (OpNode _.RC:$src1, (LdFrag addr:$src2), immoperator:$src3)))]>,
- EVEX_4V, EVEX_CD8<_.EltSize, CD8VT1>, Sched<[WriteVecInsert.Folded, WriteVecInsert.ReadAfterFold]>;
+ EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VT1>, Sched<[WriteVecInsert.Folded, WriteVecInsert.ReadAfterFold]>;
}
multiclass avx512_insert_elt_bw<bits<8> opc, string OpcodeStr, SDNode OpNode,
@@ -11437,7 +11437,7 @@ multiclass avx512_insert_elt_bw<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src1, GR32orGR64:$src2, u8imm:$src3),
OpcodeStr#"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
[(set _.RC:$dst,
- (OpNode _.RC:$src1, GR32orGR64:$src2, timm:$src3))]>, EVEX_4V,
+ (OpNode _.RC:$src1, GR32orGR64:$src2, timm:$src3))]>, EVEX, VVVV,
Sched<[WriteVecInsert]>;
defm NAME : avx512_insert_elt_m<opc, OpcodeStr, OpNode, _, LdFrag, timm>;
@@ -11452,17 +11452,17 @@ multiclass avx512_insert_elt_dq<bits<8> opc, string OpcodeStr,
OpcodeStr#"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
[(set _.RC:$dst,
(_.VT (insertelt _.RC:$src1, GRC:$src2, imm:$src3)))]>,
- EVEX_4V, TAPD, Sched<[WriteVecInsert]>;
+ EVEX, VVVV, TA, PD, Sched<[WriteVecInsert]>;
defm NAME : avx512_insert_elt_m<opc, OpcodeStr, insertelt, _,
- _.ScalarLdFrag, imm>, TAPD;
+ _.ScalarLdFrag, imm>, TA, PD;
}
}
defm VPINSRBZ : avx512_insert_elt_bw<0x20, "vpinsrb", X86pinsrb, v16i8x_info,
- extloadi8>, TAPD, WIG;
+ extloadi8>, TA, PD, WIG;
defm VPINSRWZ : avx512_insert_elt_bw<0xC4, "vpinsrw", X86pinsrw, v8i16x_info,
- extloadi16>, PD, WIG;
+ extloadi16>, TB, PD, WIG;
defm VPINSRDZ : avx512_insert_elt_dq<0x22, "vpinsrd", v4i32x_info, GR32>;
defm VPINSRQZ : avx512_insert_elt_dq<0x22, "vpinsrq", v2i64x_info, GR64>, REX_W;
@@ -11501,11 +11501,11 @@ multiclass avx512_shufp<string OpcodeStr, AVX512VLVectorVTInfo VTInfo_FP>{
defm NAME: avx512_common_3Op_imm8<OpcodeStr, VTInfo_FP, 0xC6, X86Shufp,
SchedWriteFShuffle>,
EVEX_CD8<VTInfo_FP.info512.EltSize, CD8VF>,
- AVX512AIi8Base, EVEX_4V;
+ TA, EVEX, VVVV;
}
-defm VSHUFPS: avx512_shufp<"vshufps", avx512vl_f32_info>, PS;
-defm VSHUFPD: avx512_shufp<"vshufpd", avx512vl_f64_info>, PD, REX_W;
+defm VSHUFPS: avx512_shufp<"vshufps", avx512vl_f32_info>, TB;
+defm VSHUFPD: avx512_shufp<"vshufpd", avx512vl_f64_info>, TB, PD, REX_W;
//===----------------------------------------------------------------------===//
// AVX-512 - Byte shift Left/Right
@@ -11543,10 +11543,10 @@ multiclass avx512_shift_packed_all<bits<8> opc, SDNode OpNode, Format MRMr,
}
defm VPSLLDQ : avx512_shift_packed_all<0x73, X86vshldq, MRM7r, MRM7m, "vpslldq",
SchedWriteShuffle, HasBWI>,
- AVX512PDIi8Base, EVEX_4V, WIG;
+ AVX512PDIi8Base, EVEX, VVVV, WIG;
defm VPSRLDQ : avx512_shift_packed_all<0x73, X86vshrdq, MRM3r, MRM3m, "vpsrldq",
SchedWriteShuffle, HasBWI>,
- AVX512PDIi8Base, EVEX_4V, WIG;
+ AVX512PDIi8Base, EVEX, VVVV, WIG;
multiclass avx512_psadbw_packed<bits<8> opc, SDNode OpNode,
string OpcodeStr, X86FoldableSchedWrite sched,
@@ -11584,7 +11584,7 @@ multiclass avx512_psadbw_packed_all<bits<8> opc, SDNode OpNode,
}
defm VPSADBW : avx512_psadbw_packed_all<0xf6, X86psadbw, "vpsadbw",
- SchedWritePSADBW, HasBWI>, EVEX_4V, WIG;
+ SchedWritePSADBW, HasBWI>, EVEX, VVVV, WIG;
// Transforms to swizzle an immediate to enable better matching when
// memory operand isn't in the right place.
@@ -11659,7 +11659,7 @@ multiclass avx512_ternlog<bits<8> opc, string OpcodeStr, SDNode OpNode,
(_.VT _.RC:$src2),
(_.VT _.RC:$src3),
(i8 timm:$src4)), 1, 1>,
- AVX512AIi8Base, EVEX_4V, Sched<[sched]>;
+ AVX512AIi8Base, EVEX, VVVV, Sched<[sched]>;
defm rmi : AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.MemOp:$src3, u8imm:$src4),
OpcodeStr, "$src4, $src3, $src2", "$src2, $src3, $src4",
@@ -11667,7 +11667,7 @@ multiclass avx512_ternlog<bits<8> opc, string OpcodeStr, SDNode OpNode,
(_.VT _.RC:$src2),
(_.VT (bitconvert (_.LdFrag addr:$src3))),
(i8 timm:$src4)), 1, 0>,
- AVX512AIi8Base, EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
defm rmbi : AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.ScalarMemOp:$src3, u8imm:$src4),
@@ -11677,7 +11677,7 @@ multiclass avx512_ternlog<bits<8> opc, string OpcodeStr, SDNode OpNode,
(_.VT _.RC:$src2),
(_.VT (_.BroadcastLdFrag addr:$src3)),
(i8 timm:$src4)), 1, 0>, EVEX_B,
- AVX512AIi8Base, EVEX_4V, EVEX_CD8<_.EltSize, CD8VF>,
+ AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}// Constraints = "$src1 = $dst"
@@ -12002,23 +12002,23 @@ multiclass avx512_fixupimm_packed_all<X86SchedWriteWidths sched,
let Predicates = [HasAVX512] in
defm Z : avx512_fixupimm_packed_sae<0x54, "vfixupimm", sched.ZMM,
_Vec.info512, _Tbl.info512>, AVX512AIi8Base,
- EVEX_4V, EVEX_V512;
+ EVEX, VVVV, EVEX_V512;
let Predicates = [HasAVX512, HasVLX] in {
defm Z128 : avx512_fixupimm_packed<0x54, "vfixupimm", sched.XMM,
_Vec.info128, _Tbl.info128>, AVX512AIi8Base,
- EVEX_4V, EVEX_V128;
+ EVEX, VVVV, EVEX_V128;
defm Z256 : avx512_fixupimm_packed<0x54, "vfixupimm", sched.YMM,
_Vec.info256, _Tbl.info256>, AVX512AIi8Base,
- EVEX_4V, EVEX_V256;
+ EVEX, VVVV, EVEX_V256;
}
}
defm VFIXUPIMMSSZ : avx512_fixupimm_scalar<0x55, "vfixupimm",
SchedWriteFAdd.Scl, f32x_info, v4i32x_info>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<32, CD8VT1>;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<32, CD8VT1>;
defm VFIXUPIMMSDZ : avx512_fixupimm_scalar<0x55, "vfixupimm",
SchedWriteFAdd.Scl, f64x_info, v2i64x_info>,
- AVX512AIi8Base, VEX_LIG, EVEX_4V, EVEX_CD8<64, CD8VT1>, REX_W;
+ AVX512AIi8Base, VEX_LIG, EVEX, VVVV, EVEX_CD8<64, CD8VT1>, REX_W;
defm VFIXUPIMMPS : avx512_fixupimm_packed_all<SchedWriteFAdd, avx512vl_f32_info,
avx512vl_i32_info>, EVEX_CD8<32, CD8VF>;
defm VFIXUPIMMPD : avx512_fixupimm_packed_all<SchedWriteFAdd, avx512vl_f64_info,
@@ -12165,17 +12165,17 @@ multiclass avx512_vaes<bits<8> Op, string OpStr, string IntPrefix> {
defm Z128 : AESI_binop_rm_int<Op, OpStr,
!cast<Intrinsic>(IntPrefix),
loadv2i64, 0, VR128X, i128mem>,
- EVEX_4V, EVEX_CD8<64, CD8VF>, EVEX_V128, WIG;
+ EVEX, VVVV, EVEX_CD8<64, CD8VF>, EVEX_V128, WIG;
defm Z256 : AESI_binop_rm_int<Op, OpStr,
!cast<Intrinsic>(IntPrefix#"_256"),
loadv4i64, 0, VR256X, i256mem>,
- EVEX_4V, EVEX_CD8<64, CD8VF>, EVEX_V256, WIG;
+ EVEX, VVVV, EVEX_CD8<64, CD8VF>, EVEX_V256, WIG;
}
let Predicates = [HasAVX512, HasVAES] in
defm Z : AESI_binop_rm_int<Op, OpStr,
!cast<Intrinsic>(IntPrefix#"_512"),
loadv8i64, 0, VR512, i512mem>,
- EVEX_4V, EVEX_CD8<64, CD8VF>, EVEX_V512, WIG;
+ EVEX, VVVV, EVEX_CD8<64, CD8VF>, EVEX_V512, WIG;
}
defm VAESENC : avx512_vaes<0xDC, "vaesenc", "int_x86_aesni_aesenc">;
@@ -12189,14 +12189,14 @@ defm VAESDECLAST : avx512_vaes<0xDF, "vaesdeclast", "int_x86_aesni_aesdeclast">
let Predicates = [HasAVX512, HasVPCLMULQDQ] in
defm VPCLMULQDQZ : vpclmulqdq<VR512, i512mem, loadv8i64, int_x86_pclmulqdq_512>,
- EVEX_4V, EVEX_V512, EVEX_CD8<64, CD8VF>, WIG;
+ EVEX, VVVV, EVEX_V512, EVEX_CD8<64, CD8VF>, WIG;
let Predicates = [HasVLX, HasVPCLMULQDQ] in {
defm VPCLMULQDQZ128 : vpclmulqdq<VR128X, i128mem, loadv2i64, int_x86_pclmulqdq>,
- EVEX_4V, EVEX_V128, EVEX_CD8<64, CD8VF>, WIG;
+ EVEX, VVVV, EVEX_V128, EVEX_CD8<64, CD8VF>, WIG;
defm VPCLMULQDQZ256: vpclmulqdq<VR256X, i256mem, loadv4i64,
- int_x86_pclmulqdq_256>, EVEX_4V, EVEX_V256,
+ int_x86_pclmulqdq_256>, EVEX, VVVV, EVEX_V256,
EVEX_CD8<64, CD8VF>, WIG;
}
@@ -12217,13 +12217,13 @@ multiclass VBMI2_shift_var_rm<bits<8> Op, string OpStr, SDNode OpNode,
(ins VTI.RC:$src2, VTI.RC:$src3), OpStr,
"$src3, $src2", "$src2, $src3",
(VTI.VT (OpNode VTI.RC:$src1, VTI.RC:$src2, VTI.RC:$src3))>,
- T8PD, EVEX_4V, Sched<[sched]>;
+ T8, PD, EVEX, VVVV, Sched<[sched]>;
defm m: AVX512_maskable_3src<Op, MRMSrcMem, VTI, (outs VTI.RC:$dst),
(ins VTI.RC:$src2, VTI.MemOp:$src3), OpStr,
"$src3, $src2", "$src2, $src3",
(VTI.VT (OpNode VTI.RC:$src1, VTI.RC:$src2,
(VTI.VT (VTI.LdFrag addr:$src3))))>,
- T8PD, EVEX_4V,
+ T8, PD, EVEX, VVVV,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
@@ -12239,7 +12239,7 @@ multiclass VBMI2_shift_var_rmb<bits<8> Op, string OpStr, SDNode OpNode,
"$src2, ${src3}"#VTI.BroadcastStr,
(OpNode VTI.RC:$src1, VTI.RC:$src2,
(VTI.VT (VTI.BroadcastLdFrag addr:$src3)))>,
- T8PD, EVEX_4V, EVEX_B,
+ T8, PD, EVEX, VVVV, EVEX_B,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -12284,9 +12284,9 @@ multiclass VBMI2_shift_imm<bits<8> wOp, bits<8> dqOp, string Prefix,
avx512vl_i16_info, avx512vl_i16_info, HasVBMI2>,
REX_W, EVEX_CD8<16, CD8VF>;
defm D : avx512_common_3Op_imm8<Prefix#"d", avx512vl_i32_info, dqOp,
- OpNode, sched, HasVBMI2>, AVX512AIi8Base, EVEX_4V, EVEX_CD8<32, CD8VF>;
+ OpNode, sched, HasVBMI2>, AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<32, CD8VF>;
defm Q : avx512_common_3Op_imm8<Prefix#"q", avx512vl_i64_info, dqOp, OpNode,
- sched, HasVBMI2>, AVX512AIi8Base, EVEX_4V, EVEX_CD8<64, CD8VF>, REX_W;
+ sched, HasVBMI2>, AVX512AIi8Base, EVEX, VVVV, EVEX_CD8<64, CD8VF>, REX_W;
}
// Concat & Shift
@@ -12321,13 +12321,13 @@ multiclass VNNI_rmb<bits<8> Op, string OpStr, SDNode OpNode,
(VTI.VT (OpNode VTI.RC:$src1,
VTI.RC:$src2, VTI.RC:$src3)),
IsCommutable, IsCommutable>,
- EVEX_4V, T8PD, Sched<[sched]>;
+ EVEX, VVVV, T8, PD, Sched<[sched]>;
defm m : AVX512_maskable_3src<Op, MRMSrcMem, VTI, (outs VTI.RC:$dst),
(ins VTI.RC:$src2, VTI.MemOp:$src3), OpStr,
"$src3, $src2", "$src2, $src3",
(VTI.VT (OpNode VTI.RC:$src1, VTI.RC:$src2,
(VTI.VT (VTI.LdFrag addr:$src3))))>,
- EVEX_4V, EVEX_CD8<32, CD8VF>, T8PD,
+ EVEX, VVVV, EVEX_CD8<32, CD8VF>, T8, PD,
Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
defm mb : AVX512_maskable_3src<Op, MRMSrcMem, VTI, (outs VTI.RC:$dst),
@@ -12336,8 +12336,8 @@ multiclass VNNI_rmb<bits<8> Op, string OpStr, SDNode OpNode,
"$src2, ${src3}"#VTI.BroadcastStr,
(OpNode VTI.RC:$src1, VTI.RC:$src2,
(VTI.VT (VTI.BroadcastLdFrag addr:$src3)))>,
- EVEX_4V, EVEX_CD8<32, CD8VF>, EVEX_B,
- T8PD, Sched<[sched.Folded, sched.ReadAfterFold,
+ EVEX, VVVV, EVEX_CD8<32, CD8VF>, EVEX_B,
+ T8, PD, Sched<[sched.Folded, sched.ReadAfterFold,
sched.ReadAfterFold]>;
}
}
@@ -12406,7 +12406,7 @@ multiclass VPSHUFBITQMB_rm<X86FoldableSchedWrite sched, X86VectorVTInfo VTI> {
(X86Vpshufbitqmb (VTI.VT VTI.RC:$src1),
(VTI.VT VTI.RC:$src2)),
(X86Vpshufbitqmb_su (VTI.VT VTI.RC:$src1),
- (VTI.VT VTI.RC:$src2))>, EVEX_4V, T8PD,
+ (VTI.VT VTI.RC:$src2))>, EVEX, VVVV, T8, PD,
Sched<[sched]>;
defm rm : AVX512_maskable_cmp<0x8F, MRMSrcMem, VTI, (outs VTI.KRC:$dst),
(ins VTI.RC:$src1, VTI.MemOp:$src2),
@@ -12416,7 +12416,7 @@ multiclass VPSHUFBITQMB_rm<X86FoldableSchedWrite sched, X86VectorVTInfo VTI> {
(VTI.VT (VTI.LdFrag addr:$src2))),
(X86Vpshufbitqmb_su (VTI.VT VTI.RC:$src1),
(VTI.VT (VTI.LdFrag addr:$src2)))>,
- EVEX_4V, EVEX_CD8<8, CD8VF>, T8PD,
+ EVEX, VVVV, EVEX_CD8<8, CD8VF>, T8, PD,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -12451,7 +12451,7 @@ multiclass GF2P8MULB_avx512_common<bits<8> Op, string OpStr, SDNode OpNode,
defm VGF2P8MULB : GF2P8MULB_avx512_common<0xCF, "vgf2p8mulb", X86GF2P8mulb,
SchedWriteVecALU>,
- EVEX_CD8<8, CD8VF>, T8PD;
+ EVEX_CD8<8, CD8VF>, T8;
multiclass GF2P8AFFINE_avx512_rmb_imm<bits<8> Op, string OpStr, SDNode OpNode,
X86FoldableSchedWrite sched, X86VectorVTInfo VTI,
@@ -12483,10 +12483,10 @@ multiclass GF2P8AFFINE_avx512_common<bits<8> Op, string OpStr, SDNode OpNode,
defm VGF2P8AFFINEINVQB : GF2P8AFFINE_avx512_common<0xCF, "vgf2p8affineinvqb",
X86GF2P8affineinvqb, SchedWriteVecIMul>,
- EVEX_4V, EVEX_CD8<8, CD8VF>, REX_W, AVX512AIi8Base;
+ EVEX, VVVV, EVEX_CD8<8, CD8VF>, REX_W, AVX512AIi8Base;
defm VGF2P8AFFINEQB : GF2P8AFFINE_avx512_common<0xCE, "vgf2p8affineqb",
X86GF2P8affineqb, SchedWriteVecIMul>,
- EVEX_4V, EVEX_CD8<8, CD8VF>, REX_W, AVX512AIi8Base;
+ EVEX, VVVV, EVEX_CD8<8, CD8VF>, REX_W, AVX512AIi8Base;
//===----------------------------------------------------------------------===//
@@ -12498,25 +12498,25 @@ let hasSideEffects = 0, mayLoad = 1, ExeDomain = SSEPackedSingle,
defm V4FMADDPSrm : AVX512_maskable_3src_in_asm<0x9A, MRMSrcMem, v16f32_info,
(outs VR512:$dst), (ins VR512:$src2, f128mem:$src3),
"v4fmaddps", "$src3, $src2", "$src2, $src3",
- []>, EVEX_V512, EVEX_4V, T8XD, EVEX_CD8<32, CD8VQ>,
+ []>, EVEX_V512, EVEX, VVVV, T8, XD, EVEX_CD8<32, CD8VQ>,
Sched<[SchedWriteFMA.ZMM.Folded]>;
defm V4FNMADDPSrm : AVX512_maskable_3src_in_asm<0xAA, MRMSrcMem, v16f32_info,
(outs VR512:$dst), (ins VR512:$src2, f128mem:$src3),
"v4fnmaddps", "$src3, $src2", "$src2, $src3",
- []>, EVEX_V512, EVEX_4V, T8XD, EVEX_CD8<32, CD8VQ>,
+ []>, EVEX_V512, EVEX, VVVV, T8, XD, EVEX_CD8<32, CD8VQ>,
Sched<[SchedWriteFMA.ZMM.Folded]>;
defm V4FMADDSSrm : AVX512_maskable_3src_in_asm<0x9B, MRMSrcMem, f32x_info,
(outs VR128X:$dst), (ins VR128X:$src2, f128mem:$src3),
"v4fmaddss", "$src3, $src2", "$src2, $src3",
- []>, VEX_LIG, EVEX_4V, T8XD, EVEX_CD8<32, CD8VF>,
+ []>, VEX_LIG, EVEX, VVVV, T8, XD, EVEX_CD8<32, CD8VF>,
Sched<[SchedWriteFMA.Scl.Folded]>;
defm V4FNMADDSSrm : AVX512_maskable_3src_in_asm<0xAB, MRMSrcMem, f32x_info,
(outs VR128X:$dst), (ins VR128X:$src2, f128mem:$src3),
"v4fnmaddss", "$src3, $src2", "$src2, $src3",
- []>, VEX_LIG, EVEX_4V, T8XD, EVEX_CD8<32, CD8VF>,
+ []>, VEX_LIG, EVEX, VVVV, T8, XD, EVEX_CD8<32, CD8VF>,
Sched<[SchedWriteFMA.Scl.Folded]>;
}
@@ -12529,13 +12529,13 @@ let hasSideEffects = 0, mayLoad = 1, ExeDomain = SSEPackedInt,
defm VP4DPWSSDrm : AVX512_maskable_3src_in_asm<0x52, MRMSrcMem, v16i32_info,
(outs VR512:$dst), (ins VR512:$src2, f128mem:$src3),
"vp4dpwssd", "$src3, $src2", "$src2, $src3",
- []>, EVEX_V512, EVEX_4V, T8XD, EVEX_CD8<32, CD8VQ>,
+ []>, EVEX_V512, EVEX, VVVV, T8, XD, EVEX_CD8<32, CD8VQ>,
Sched<[SchedWriteFMA.ZMM.Folded]>;
defm VP4DPWSSDSrm : AVX512_maskable_3src_in_asm<0x53, MRMSrcMem, v16i32_info,
(outs VR512:$dst), (ins VR512:$src2, f128mem:$src3),
"vp4dpwssds", "$src3, $src2", "$src2, $src3",
- []>, EVEX_V512, EVEX_4V, T8XD, EVEX_CD8<32, CD8VQ>,
+ []>, EVEX_V512, EVEX, VVVV, T8, XD, EVEX_CD8<32, CD8VQ>,
Sched<[SchedWriteFMA.ZMM.Folded]>;
}
@@ -12558,7 +12558,7 @@ multiclass avx512_vp2intersect_modes<X86FoldableSchedWrite sched, X86VectorVTInf
"\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set _.KRPC:$dst, (X86vp2intersect
_.RC:$src1, (_.VT _.RC:$src2)))]>,
- EVEX_4V, T8XD, Sched<[sched]>;
+ EVEX, VVVV, T8, XD, Sched<[sched]>;
def rm : I<0x68, MRMSrcMem,
(outs _.KRPC:$dst),
@@ -12567,7 +12567,7 @@ multiclass avx512_vp2intersect_modes<X86FoldableSchedWrite sched, X86VectorVTInf
"\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set _.KRPC:$dst, (X86vp2intersect
_.RC:$src1, (_.VT (bitconvert (_.LdFrag addr:$src2)))))]>,
- EVEX_4V, T8XD, EVEX_CD8<_.EltSize, CD8VF>,
+ EVEX, VVVV, T8, XD, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
def rmb : I<0x68, MRMSrcMem,
@@ -12577,7 +12577,7 @@ multiclass avx512_vp2intersect_modes<X86FoldableSchedWrite sched, X86VectorVTInf
", $src1, $dst|$dst, $src1, ${src2}", _.BroadcastStr ,"}"),
[(set _.KRPC:$dst, (X86vp2intersect
_.RC:$src1, (_.VT (_.BroadcastLdFrag addr:$src2))))]>,
- EVEX_4V, T8XD, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
+ EVEX, VVVV, T8, XD, EVEX_B, EVEX_CD8<_.EltSize, CD8VF>,
Sched<[sched.Folded, sched.ReadAfterFold]>;
}
@@ -12623,7 +12623,7 @@ let ExeDomain = SSEPackedSingle in
defm VCVTNE2PS2BF16 : avx512_binop_all2<0x72, "vcvtne2ps2bf16",
SchedWriteCvtPD2PS, //FIXME: Should be SchedWriteCvtPS2BF
avx512vl_f32_info, avx512vl_bf16_info,
- X86cvtne2ps2bf16, HasBF16, 0>, T8XD;
+ X86cvtne2ps2bf16, HasBF16, 0>, T8, XD;
// Truncate Float to BFloat16
multiclass avx512_cvtps2bf16<bits<8> opc, string OpcodeStr,
@@ -12660,7 +12660,7 @@ multiclass avx512_cvtps2bf16<bits<8> opc, string OpcodeStr,
}
defm VCVTNEPS2BF16 : avx512_cvtps2bf16<0x72, "vcvtneps2bf16",
- SchedWriteCvtPD2PS>, T8XS,
+ SchedWriteCvtPD2PS>, T8, XS,
EVEX_CD8<32, CD8VF>;
let Predicates = [HasBF16, HasVLX] in {
@@ -12744,13 +12744,13 @@ multiclass avx512_dpbf16ps_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins src_v.RC:$src2, src_v.RC:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode _.RC:$src1, src_v.RC:$src2, src_v.RC:$src3))>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
defm m: AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins src_v.RC:$src2, src_v.MemOp:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
(_.VT (OpNode _.RC:$src1, src_v.RC:$src2,
- (src_v.LdFrag addr:$src3)))>, EVEX_4V,
+ (src_v.LdFrag addr:$src3)))>, EVEX, VVVV,
Sched<[sched.Folded, sched.ReadAfterFold]>;
defm mb: AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
@@ -12760,7 +12760,7 @@ multiclass avx512_dpbf16ps_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
!strconcat("$src2, ${src3}", _.BroadcastStr),
(_.VT (OpNode _.RC:$src1, src_v.RC:$src2,
(src_v.VT (src_v.BroadcastLdFrag addr:$src3))))>,
- EVEX_B, EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX_B, EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
} // Constraints = "$src1 = $dst"
@@ -12783,7 +12783,7 @@ multiclass avx512_dpbf16ps_sizes<bits<8> opc, string OpcodeStr, SDNode OpNode,
let ExeDomain = SSEPackedSingle in
defm VDPBF16PS : avx512_dpbf16ps_sizes<0x52, "vdpbf16ps", X86dpbf16ps, SchedWriteFMA,
avx512vl_f32_info, avx512vl_bf16_info,
- HasBF16>, T8XS, EVEX_CD8<32, CD8VF>;
+ HasBF16>, T8, XS, EVEX_CD8<32, CD8VF>;
//===----------------------------------------------------------------------===//
// AVX512FP16
@@ -12792,12 +12792,12 @@ defm VDPBF16PS : avx512_dpbf16ps_sizes<0x52, "vdpbf16ps", X86dpbf16ps, SchedWrit
let Predicates = [HasFP16] in {
// Move word ( r/m16) to Packed word
def VMOVW2SHrr : AVX512<0x6E, MRMSrcReg, (outs VR128X:$dst), (ins GR32:$src),
- "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5PD, EVEX, Sched<[WriteVecMoveFromGpr]>;
+ "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5, PD, EVEX, Sched<[WriteVecMoveFromGpr]>;
def VMOVWrm : AVX512<0x6E, MRMSrcMem, (outs VR128X:$dst), (ins i16mem:$src),
"vmovw\t{$src, $dst|$dst, $src}",
[(set VR128X:$dst,
(v8i16 (scalar_to_vector (loadi16 addr:$src))))]>,
- T_MAP5PD, EVEX, EVEX_CD8<16, CD8VT1>, Sched<[WriteFLoad]>;
+ T_MAP5, PD, EVEX, EVEX_CD8<16, CD8VT1>, Sched<[WriteFLoad]>;
def : Pat<(f16 (bitconvert GR16:$src)),
(f16 (COPY_TO_REGCLASS
@@ -12854,13 +12854,13 @@ def : Pat<(v16i32 (X86vzmovl
// Move word from xmm register to r/m16
def VMOVSH2Wrr : AVX512<0x7E, MRMDestReg, (outs GR32:$dst), (ins VR128X:$src),
- "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5PD, EVEX, Sched<[WriteVecMoveToGpr]>;
+ "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5, PD, EVEX, Sched<[WriteVecMoveToGpr]>;
def VMOVWmr : AVX512<0x7E, MRMDestMem, (outs),
(ins i16mem:$dst, VR128X:$src),
"vmovw\t{$src, $dst|$dst, $src}",
[(store (i16 (extractelt (v8i16 VR128X:$src),
(iPTR 0))), addr:$dst)]>,
- T_MAP5PD, EVEX, EVEX_CD8<16, CD8VT1>, Sched<[WriteFStore]>;
+ T_MAP5, PD, EVEX, EVEX_CD8<16, CD8VT1>, Sched<[WriteFStore]>;
def : Pat<(i16 (bitconvert FR16X:$src)),
(i16 (EXTRACT_SUBREG
@@ -12872,9 +12872,9 @@ def : Pat<(i16 (extractelt (v8i16 VR128X:$src), (iPTR 0))),
// Allow "vmovw" to use GR64
let hasSideEffects = 0 in {
def VMOVW64toSHrr : AVX512<0x6E, MRMSrcReg, (outs VR128X:$dst), (ins GR64:$src),
- "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5PD, EVEX, REX_W, Sched<[WriteVecMoveFromGpr]>;
+ "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5, PD, EVEX, REX_W, Sched<[WriteVecMoveFromGpr]>;
def VMOVSHtoW64rr : AVX512<0x7E, MRMDestReg, (outs GR64:$dst), (ins VR128X:$src),
- "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5PD, EVEX, REX_W, Sched<[WriteVecMoveToGpr]>;
+ "vmovw\t{$src, $dst|$dst, $src}", []>, T_MAP5, PD, EVEX, REX_W, Sched<[WriteVecMoveToGpr]>;
}
}
@@ -12920,27 +12920,27 @@ multiclass avx512_cvttph2w<bits<8> opc, string OpcodeStr, SDPatternOperator OpNo
defm VCVTPH2UW : avx512_cvtph2w<0x7D, "vcvtph2uw", X86cvtp2UInt, X86cvtp2UInt,
X86cvtp2UIntRnd, avx512vl_i16_info,
avx512vl_f16_info, SchedWriteCvtPD2DQ>,
- T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ T_MAP5, EVEX_CD8<16, CD8VF>;
defm VCVTUW2PH : avx512_cvtph2w<0x7D, "vcvtuw2ph", any_uint_to_fp, uint_to_fp,
X86VUintToFpRnd, avx512vl_f16_info,
avx512vl_i16_info, SchedWriteCvtPD2DQ>,
- T_MAP5XD, EVEX_CD8<16, CD8VF>;
+ T_MAP5, XD, EVEX_CD8<16, CD8VF>;
defm VCVTTPH2W : avx512_cvttph2w<0x7C, "vcvttph2w", X86any_cvttp2si,
X86cvttp2si, X86cvttp2siSAE,
avx512vl_i16_info, avx512vl_f16_info,
- SchedWriteCvtPD2DQ>, T_MAP5PD, EVEX_CD8<16, CD8VF>;
+ SchedWriteCvtPD2DQ>, T_MAP5, PD, EVEX_CD8<16, CD8VF>;
defm VCVTTPH2UW : avx512_cvttph2w<0x7C, "vcvttph2uw", X86any_cvttp2ui,
X86cvttp2ui, X86cvttp2uiSAE,
avx512vl_i16_info, avx512vl_f16_info,
- SchedWriteCvtPD2DQ>, T_MAP5PS, EVEX_CD8<16, CD8VF>;
+ SchedWriteCvtPD2DQ>, T_MAP5, EVEX_CD8<16, CD8VF>;
defm VCVTPH2W : avx512_cvtph2w<0x7D, "vcvtph2w", X86cvtp2Int, X86cvtp2Int,
X86cvtp2IntRnd, avx512vl_i16_info,
avx512vl_f16_info, SchedWriteCvtPD2DQ>,
- T_MAP5PD, EVEX_CD8<16, CD8VF>;
+ T_MAP5, PD, EVEX_CD8<16, CD8VF>;
defm VCVTW2PH : avx512_cvtph2w<0x7D, "vcvtw2ph", any_sint_to_fp, sint_to_fp,
X86VSintToFpRnd, avx512vl_f16_info,
avx512vl_i16_info, SchedWriteCvtPD2DQ>,
- T_MAP5XS, EVEX_CD8<16, CD8VF>;
+ T_MAP5, XS, EVEX_CD8<16, CD8VF>;
// Convert Half to Signed/Unsigned Doubleword
multiclass avx512_cvtph2dq<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
@@ -12980,20 +12980,20 @@ multiclass avx512_cvttph2dq<bits<8> opc, string OpcodeStr, SDPatternOperator OpN
defm VCVTPH2DQ : avx512_cvtph2dq<0x5B, "vcvtph2dq", X86cvtp2Int, X86cvtp2Int,
- X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, T_MAP5PD,
+ X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, T_MAP5, PD,
EVEX_CD8<16, CD8VH>;
defm VCVTPH2UDQ : avx512_cvtph2dq<0x79, "vcvtph2udq", X86cvtp2UInt, X86cvtp2UInt,
- X86cvtp2UIntRnd, SchedWriteCvtPS2DQ>, T_MAP5PS,
+ X86cvtp2UIntRnd, SchedWriteCvtPS2DQ>, T_MAP5,
EVEX_CD8<16, CD8VH>;
defm VCVTTPH2DQ : avx512_cvttph2dq<0x5B, "vcvttph2dq", X86any_cvttp2si,
X86cvttp2si, X86cvttp2siSAE,
- SchedWriteCvtPS2DQ>, T_MAP5XS,
+ SchedWriteCvtPS2DQ>, T_MAP5, XS,
EVEX_CD8<16, CD8VH>;
defm VCVTTPH2UDQ : avx512_cvttph2dq<0x78, "vcvttph2udq", X86any_cvttp2ui,
X86cvttp2ui, X86cvttp2uiSAE,
- SchedWriteCvtPS2DQ>, T_MAP5PS,
+ SchedWriteCvtPS2DQ>, T_MAP5,
EVEX_CD8<16, CD8VH>;
// Convert Half to Signed/Unsigned Quardword
@@ -13043,21 +13043,21 @@ multiclass avx512_cvttph2qq<bits<8> opc, string OpcodeStr, SDPatternOperator OpN
}
defm VCVTPH2QQ : avx512_cvtph2qq<0x7B, "vcvtph2qq", X86cvtp2Int, X86cvtp2Int,
- X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, T_MAP5PD,
+ X86cvtp2IntRnd, SchedWriteCvtPS2DQ>, T_MAP5, PD,
EVEX_CD8<16, CD8VQ>;
defm VCVTPH2UQQ : avx512_cvtph2qq<0x79, "vcvtph2uqq", X86cvtp2UInt, X86cvtp2UInt,
- X86cvtp2UIntRnd, SchedWriteCvtPS2DQ>, T_MAP5PD,
+ X86cvtp2UIntRnd, SchedWriteCvtPS2DQ>, T_MAP5, PD,
EVEX_CD8<16, CD8VQ>;
defm VCVTTPH2QQ : avx512_cvttph2qq<0x7A, "vcvttph2qq", X86any_cvttp2si,
X86cvttp2si, X86cvttp2siSAE,
- SchedWriteCvtPS2DQ>, T_MAP5PD,
+ SchedWriteCvtPS2DQ>, T_MAP5, PD,
EVEX_CD8<16, CD8VQ>;
defm VCVTTPH2UQQ : avx512_cvttph2qq<0x78, "vcvttph2uqq", X86any_cvttp2ui,
X86cvttp2ui, X86cvttp2uiSAE,
- SchedWriteCvtPS2DQ>, T_MAP5PD,
+ SchedWriteCvtPS2DQ>, T_MAP5, PD,
EVEX_CD8<16, CD8VQ>;
// Convert Signed/Unsigned Quardword to Half
@@ -13154,53 +13154,53 @@ multiclass avx512_cvtqq2ph<bits<8> opc, string OpcodeStr, SDPatternOperator OpNo
}
defm VCVTQQ2PH : avx512_cvtqq2ph<0x5B, "vcvtqq2ph", any_sint_to_fp, sint_to_fp,
- X86VSintToFpRnd, SchedWriteCvtDQ2PS>, REX_W, T_MAP5PS,
+ X86VSintToFpRnd, SchedWriteCvtDQ2PS>, REX_W, T_MAP5,
EVEX_CD8<64, CD8VF>;
defm VCVTUQQ2PH : avx512_cvtqq2ph<0x7A, "vcvtuqq2ph", any_uint_to_fp, uint_to_fp,
- X86VUintToFpRnd, SchedWriteCvtDQ2PS>, REX_W, T_MAP5XD,
+ X86VUintToFpRnd, SchedWriteCvtDQ2PS>, REX_W, T_MAP5, XD,
EVEX_CD8<64, CD8VF>;
// Convert half to signed/unsigned int 32/64
defm VCVTSH2SIZ: avx512_cvt_s_int_round<0x2D, f16x_info, i32x_info, X86cvts2si,
X86cvts2siRnd, WriteCvtSS2I, "cvtsh2si", "{l}", HasFP16>,
- T_MAP5XS, EVEX_CD8<16, CD8VT1>;
+ T_MAP5, XS, EVEX_CD8<16, CD8VT1>;
defm VCVTSH2SI64Z: avx512_cvt_s_int_round<0x2D, f16x_info, i64x_info, X86cvts2si,
X86cvts2siRnd, WriteCvtSS2I, "cvtsh2si", "{q}", HasFP16>,
- T_MAP5XS, REX_W, EVEX_CD8<16, CD8VT1>;
+ T_MAP5, XS, REX_W, EVEX_CD8<16, CD8VT1>;
defm VCVTSH2USIZ: avx512_cvt_s_int_round<0x79, f16x_info, i32x_info, X86cvts2usi,
X86cvts2usiRnd, WriteCvtSS2I, "cvtsh2usi", "{l}", HasFP16>,
- T_MAP5XS, EVEX_CD8<16, CD8VT1>;
+ T_MAP5, XS, EVEX_CD8<16, CD8VT1>;
defm VCVTSH2USI64Z: avx512_cvt_s_int_round<0x79, f16x_info, i64x_info, X86cvts2usi,
X86cvts2usiRnd, WriteCvtSS2I, "cvtsh2usi", "{q}", HasFP16>,
- T_MAP5XS, REX_W, EVEX_CD8<16, CD8VT1>;
+ T_MAP5, XS, REX_W, EVEX_CD8<16, CD8VT1>;
defm VCVTTSH2SIZ: avx512_cvt_s_all<0x2C, "vcvttsh2si", f16x_info, i32x_info,
any_fp_to_sint, X86cvtts2Int, X86cvtts2IntSAE, WriteCvtSS2I,
- "{l}", HasFP16>, T_MAP5XS, EVEX_CD8<16, CD8VT1>;
+ "{l}", HasFP16>, T_MAP5, XS, EVEX_CD8<16, CD8VT1>;
defm VCVTTSH2SI64Z: avx512_cvt_s_all<0x2C, "vcvttsh2si", f16x_info, i64x_info,
any_fp_to_sint, X86cvtts2Int, X86cvtts2IntSAE, WriteCvtSS2I,
- "{q}", HasFP16>, REX_W, T_MAP5XS, EVEX_CD8<16, CD8VT1>;
+ "{q}", HasFP16>, REX_W, T_MAP5, XS, EVEX_CD8<16, CD8VT1>;
defm VCVTTSH2USIZ: avx512_cvt_s_all<0x78, "vcvttsh2usi", f16x_info, i32x_info,
any_fp_to_uint, X86cvtts2UInt, X86cvtts2UIntSAE, WriteCvtSS2I,
- "{l}", HasFP16>, T_MAP5XS, EVEX_CD8<16, CD8VT1>;
+ "{l}", HasFP16>, T_MAP5, XS, EVEX_CD8<16, CD8VT1>;
defm VCVTTSH2USI64Z: avx512_cvt_s_all<0x78, "vcvttsh2usi", f16x_info, i64x_info,
any_fp_to_uint, X86cvtts2UInt, X86cvtts2UIntSAE, WriteCvtSS2I,
- "{q}", HasFP16>, T_MAP5XS, REX_W, EVEX_CD8<16, CD8VT1>;
+ "{q}", HasFP16>, T_MAP5, XS, REX_W, EVEX_CD8<16, CD8VT1>;
let Predicates = [HasFP16] in {
defm VCVTSI2SHZ : avx512_vcvtsi_common<0x2A, X86SintToFp, X86SintToFpRnd, WriteCvtI2SS, GR32,
v8f16x_info, i32mem, loadi32, "cvtsi2sh", "l">,
- T_MAP5XS, EVEX_CD8<32, CD8VT1>;
+ T_MAP5, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTSI642SHZ: avx512_vcvtsi_common<0x2A, X86SintToFp, X86SintToFpRnd, WriteCvtI2SS, GR64,
v8f16x_info, i64mem, loadi64, "cvtsi2sh","q">,
- T_MAP5XS, REX_W, EVEX_CD8<64, CD8VT1>;
+ T_MAP5, XS, REX_W, EVEX_CD8<64, CD8VT1>;
defm VCVTUSI2SHZ : avx512_vcvtsi_common<0x7B, X86UintToFp, X86UintToFpRnd, WriteCvtI2SS, GR32,
v8f16x_info, i32mem, loadi32,
- "cvtusi2sh","l">, T_MAP5XS, EVEX_CD8<32, CD8VT1>;
+ "cvtusi2sh","l">, T_MAP5, XS, EVEX_CD8<32, CD8VT1>;
defm VCVTUSI642SHZ : avx512_vcvtsi_common<0x7B, X86UintToFp, X86UintToFpRnd, WriteCvtI2SS, GR64,
v8f16x_info, i64mem, loadi64, "cvtusi2sh", "q">,
- T_MAP5XS, REX_W, EVEX_CD8<64, CD8VT1>;
+ T_MAP5, XS, REX_W, EVEX_CD8<64, CD8VT1>;
def : InstAlias<"vcvtsi2sh\t{$src, $src1, $dst|$dst, $src1, $src}",
(VCVTSI2SHZrm_Int VR128X:$dst, VR128X:$src1, i32mem:$src), 0, "att">;
@@ -13390,17 +13390,17 @@ let Constraints = "@earlyclobber $dst, $src1 = $dst" in {
defm r: AVX512_maskable_3src<opc, MRMSrcReg, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.RC:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
- (_.VT (OpNode _.RC:$src2, _.RC:$src3, _.RC:$src1)), IsCommutable>, EVEX_4V;
+ (_.VT (OpNode _.RC:$src2, _.RC:$src3, _.RC:$src1)), IsCommutable>, EVEX, VVVV;
defm m: AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.MemOp:$src3),
OpcodeStr, "$src3, $src2", "$src2, $src3",
- (_.VT (OpNode _.RC:$src2, (_.LdFrag addr:$src3), _.RC:$src1))>, EVEX_4V;
+ (_.VT (OpNode _.RC:$src2, (_.LdFrag addr:$src3), _.RC:$src1))>, EVEX, VVVV;
defm mb: AVX512_maskable_3src<opc, MRMSrcMem, _, (outs _.RC:$dst),
(ins _.RC:$src2, _.ScalarMemOp:$src3),
OpcodeStr, !strconcat("${src3}", _.BroadcastStr,", $src2"), !strconcat("$src2, ${src3}", _.BroadcastStr),
- (_.VT (OpNode _.RC:$src2, (_.VT (_.BroadcastLdFrag addr:$src3)), _.RC:$src1))>, EVEX_B, EVEX_4V;
+ (_.VT (OpNode _.RC:$src2, (_.VT (_.BroadcastLdFrag addr:$src3)), _.RC:$src1))>, EVEX_B, EVEX, VVVV;
}
} // Constraints = "@earlyclobber $dst, $src1 = $dst"
@@ -13411,7 +13411,7 @@ multiclass avx512_cfmaop_round<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins _.RC:$src2, _.RC:$src3, AVX512RC:$rc),
OpcodeStr, "$rc, $src3, $src2", "$src2, $src3, $rc",
(_.VT (OpNode _.RC:$src2, _.RC:$src3, _.RC:$src1, (i32 timm:$rc)))>,
- EVEX_4V, EVEX_B, EVEX_RC;
+ EVEX, VVVV, EVEX_B, EVEX_RC;
}
@@ -13446,14 +13446,14 @@ multiclass avx512_cfmulop_common<bits<8> opc, string OpcodeStr, SDNode OpNode,
let Uses = [MXCSR] in {
defm VFMADDCPH : avx512_cfmaop_common<0x56, "vfmaddcph", x86vfmaddc, x86vfmaddcRnd, 1>,
- T_MAP6XS, EVEX_CD8<32, CD8VF>;
+ T_MAP6, XS, EVEX_CD8<32, CD8VF>;
defm VFCMADDCPH : avx512_cfmaop_common<0x56, "vfcmaddcph", x86vfcmaddc, x86vfcmaddcRnd, 0>,
- T_MAP6XD, EVEX_CD8<32, CD8VF>;
+ T_MAP6, XD, EVEX_CD8<32, CD8VF>;
defm VFMULCPH : avx512_cfmulop_common<0xD6, "vfmulcph", x86vfmulc, x86vfmulc,
- x86vfmulcRnd, 1>, T_MAP6XS, EVEX_CD8<32, CD8VF>;
+ x86vfmulcRnd, 1>, T_MAP6, XS, EVEX_CD8<32, CD8VF>;
defm VFCMULCPH : avx512_cfmulop_common<0xD6, "vfcmulcph", x86vfcmulc,
- x86vfcmulc, x86vfcmulcRnd, 0>, T_MAP6XD, EVEX_CD8<32, CD8VF>;
+ x86vfcmulc, x86vfcmulcRnd, 0>, T_MAP6, XD, EVEX_CD8<32, CD8VF>;
}
@@ -13504,12 +13504,12 @@ multiclass avx512_cfmbinop_sh_common<bits<8> opc, string OpcodeStr, SDNode OpNod
let Uses = [MXCSR] in {
defm VFMADDCSHZ : avx512_cfmaop_sh_common<0x57, "vfmaddcsh", x86vfmaddcSh, x86vfmaddcShRnd, 1>,
- T_MAP6XS, EVEX_CD8<32, CD8VT1>, EVEX_V128, EVEX_4V;
+ T_MAP6, XS, EVEX_CD8<32, CD8VT1>, EVEX_V128, EVEX, VVVV;
defm VFCMADDCSHZ : avx512_cfmaop_sh_common<0x57, "vfcmaddcsh", x86vfcmaddcSh, x86vfcmaddcShRnd, 0>,
- T_MAP6XD, EVEX_CD8<32, CD8VT1>, EVEX_V128, EVEX_4V;
+ T_MAP6, XD, EVEX_CD8<32, CD8VT1>, EVEX_V128, EVEX, VVVV;
defm VFMULCSHZ : avx512_cfmbinop_sh_common<0xD7, "vfmulcsh", x86vfmulcSh, x86vfmulcShRnd, 1>,
- T_MAP6XS, EVEX_CD8<32, CD8VT1>, EVEX_V128, VEX_LIG, EVEX_4V;
+ T_MAP6, XS, EVEX_CD8<32, CD8VT1>, EVEX_V128, VEX_LIG, EVEX, VVVV;
defm VFCMULCSHZ : avx512_cfmbinop_sh_common<0xD7, "vfcmulcsh", x86vfcmulcSh, x86vfcmulcShRnd, 0>,
- T_MAP6XD, EVEX_CD8<32, CD8VT1>, EVEX_V128, VEX_LIG, EVEX_4V;
+ T_MAP6, XD, EVEX_CD8<32, CD8VT1>, EVEX_V128, VEX_LIG, EVEX, VVVV;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrArithmetic.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrArithmetic.td
index 8c355e84a065..936db48bb9df 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrArithmetic.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrArithmetic.td
@@ -44,511 +44,396 @@ def PLEA32r : PseudoI<(outs GR32:$dst), (ins anymem:$src), []>;
def PLEA64r : PseudoI<(outs GR64:$dst), (ins anymem:$src), []>;
}
-//===----------------------------------------------------------------------===//
-// Fixed-Register Multiplication and Division Instructions.
-//
-
-// BinOpRR - Binary instructions with inputs "reg, reg".
-class BinOpRR<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- dag outlist, X86FoldableSchedWrite sched, list<dag> pattern>
- : ITy<opcode, MRMDestReg, typeinfo, outlist,
- (ins typeinfo.RegClass:$src1, typeinfo.RegClass:$src2),
- mnemonic, "{$src2, $src1|$src1, $src2}", pattern>,
- Sched<[sched]>;
-
-// BinOpRR_F - Binary instructions with inputs "reg, reg", where the pattern
-// has just a EFLAGS as a result.
-class BinOpRR_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDPatternOperator opnode>
- : BinOpRR<opcode, mnemonic, typeinfo, (outs), WriteALU,
- [(set EFLAGS,
- (opnode typeinfo.RegClass:$src1, typeinfo.RegClass:$src2))]>;
-
-// BinOpRR_RF - Binary instructions with inputs "reg, reg", where the pattern
-// has both a regclass and EFLAGS as a result.
-class BinOpRR_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode>
- : BinOpRR<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), WriteALU,
- [(set typeinfo.RegClass:$dst, EFLAGS,
- (opnode typeinfo.RegClass:$src1, typeinfo.RegClass:$src2))]>;
-
-// BinOpRR_RFF - Binary instructions with inputs "reg, reg", where the pattern
-// has both a regclass and EFLAGS as a result, and has EFLAGS as input.
-class BinOpRR_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode>
- : BinOpRR<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), WriteADC,
- [(set typeinfo.RegClass:$dst, EFLAGS,
- (opnode typeinfo.RegClass:$src1, typeinfo.RegClass:$src2,
- EFLAGS))]>;
-
-// BinOpRR_Rev - Binary instructions with inputs "reg, reg"(reversed encoding).
-class BinOpRR_Rev<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- X86FoldableSchedWrite sched = WriteALU>
- : ITy<opcode, MRMSrcReg, typeinfo,
- (outs typeinfo.RegClass:$dst),
- (ins typeinfo.RegClass:$src1, typeinfo.RegClass:$src2),
- mnemonic, "{$src2, $dst|$dst, $src2}", []>,
- Sched<[sched]> {
- // The disassembler should know about this, but not the asmparser.
- let isCodeGenOnly = 1;
- let ForceDisassemble = 1;
- let hasSideEffects = 0;
+// BinOpRR - Instructions that read "reg, reg".
+class BinOpRR<bits<8> o, string m, X86TypeInfo t, dag out, list<dag> p>
+ : ITy<o, MRMDestReg, t, out, (ins t.RegClass:$src1, t.RegClass:$src2), m,
+ binop_args, p>, Sched<[WriteALU]>;
+// BinOpRR_F - Instructions that read "reg, reg" and write EFLAGS only.
+class BinOpRR_F<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
+ : BinOpRR<o, m, t, (outs),
+ [(set EFLAGS, (node t.RegClass:$src1, t.RegClass:$src2))]>,
+ DefEFLAGS;
+// BinOpRR_F_Rev - Reversed encoding of BinOpRR_F
+class BinOpRR_F_Rev<bits<8> o, string m, X86TypeInfo t>
+ : BinOpRR_F<o, m, t, null_frag>, DisassembleOnly {
+ let Form = MRMSrcReg;
}
-
-// BinOpRR_RFF_Rev - Binary instructions with inputs "reg, reg"(reversed
-// encoding), with sched = WriteADC.
-class BinOpRR_RFF_Rev<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo>
- : BinOpRR_Rev<opcode, mnemonic, typeinfo, WriteADC>;
-
-// BinOpRR_F_Rev - Binary instructions with inputs "reg, reg"(reversed
-// encoding), without outlist dag.
-class BinOpRR_F_Rev<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo>
- : ITy<opcode, MRMSrcReg, typeinfo, (outs),
- (ins typeinfo.RegClass:$src1, typeinfo.RegClass:$src2),
- mnemonic, "{$src2, $src1|$src1, $src2}", []>,
- Sched<[WriteALU]> {
- // The disassembler should know about this, but not the asmparser.
- let isCodeGenOnly = 1;
- let ForceDisassemble = 1;
- let hasSideEffects = 0;
+// BinOpRR_RF - Instructions that read "reg, reg", and write "reg", EFLAGS.
+class BinOpRR_RF<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
+ : BinOpRR<o, m, t, (outs t.RegClass:$dst),
+ [(set t.RegClass:$dst, EFLAGS,
+ (node t.RegClass:$src1, t.RegClass:$src2))]>, DefEFLAGS;
+// BinOpRR_RF_Rev - Reversed encoding of BinOpRR_RF.
+class BinOpRR_RF_Rev<bits<8> o, string m, X86TypeInfo t>
+ : BinOpRR_RF<o, m, t, null_frag>, DisassembleOnly {
+ let Form = MRMSrcReg;
+}
+// BinOpRRF_RF - Instructions that read "reg, reg", write "reg" and read/write
+// EFLAGS.
+class BinOpRRF_RF<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
+ : BinOpRR<o, m, t, (outs t.RegClass:$dst),
+ [(set t.RegClass:$dst, EFLAGS,
+ (node t.RegClass:$src1, t.RegClass:$src2,
+ EFLAGS))]>, DefEFLAGS, UseEFLAGS {
+ let SchedRW = [WriteADC];
+}
+// BinOpRRF_RF_Rev - Reversed encoding of BinOpRRF_RF
+class BinOpRRF_RF_Rev<bits<8> o, string m, X86TypeInfo t>
+ : BinOpRRF_RF<o, m, t, null_frag>, DisassembleOnly {
+ let Form = MRMSrcReg;
}
-// BinOpRM - Binary instructions with inputs "reg, [mem]".
-class BinOpRM<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- dag outlist, X86FoldableSchedWrite sched, list<dag> pattern>
- : ITy<opcode, MRMSrcMem, typeinfo, outlist,
- (ins typeinfo.RegClass:$src1, typeinfo.MemOperand:$src2),
- mnemonic, "{$src2, $src1|$src1, $src2}", pattern>,
- Sched<[sched.Folded, sched.ReadAfterFold]>;
-
-// BinOpRM_ImplicitUse - Binary instructions with inputs "reg, [mem]".
-// There is an implicit register read at the end of the operand sequence.
-class BinOpRM_ImplicitUse<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- dag outlist, X86FoldableSchedWrite sched, list<dag> pattern>
- : ITy<opcode, MRMSrcMem, typeinfo, outlist,
- (ins typeinfo.RegClass:$src1, typeinfo.MemOperand:$src2),
- mnemonic, "{$src2, $src1|$src1, $src2}", pattern>,
- Sched<[sched.Folded, sched.ReadAfterFold,
- // base, scale, index, offset, segment.
- ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault,
- // implicit register read.
- sched.ReadAfterFold]>;
-
-// BinOpRM_F - Binary instructions with inputs "reg, [mem]", where the pattern
-// has just a EFLAGS as a result.
-class BinOpRM_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode>
- : BinOpRM<opcode, mnemonic, typeinfo, (outs), WriteALU,
- [(set EFLAGS,
- (opnode typeinfo.RegClass:$src1, (typeinfo.LoadNode addr:$src2)))]>;
-
-// BinOpRM_RF - Binary instructions with inputs "reg, [mem]", where the pattern
-// has both a regclass and EFLAGS as a result.
-class BinOpRM_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode>
- : BinOpRM<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), WriteALU,
- [(set typeinfo.RegClass:$dst, EFLAGS,
- (opnode typeinfo.RegClass:$src1, (typeinfo.LoadNode addr:$src2)))]>;
-
-// BinOpRM_RFF - Binary instructions with inputs "reg, [mem]", where the pattern
-// has both a regclass and EFLAGS as a result, and has EFLAGS as input.
-class BinOpRM_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode>
- : BinOpRM_ImplicitUse<opcode, mnemonic, typeinfo,
- (outs typeinfo.RegClass:$dst), WriteADC,
- [(set typeinfo.RegClass:$dst, EFLAGS,
- (opnode typeinfo.RegClass:$src1,
- (typeinfo.LoadNode addr:$src2), EFLAGS))]>;
-
-// BinOpRI - Binary instructions with inputs "reg, imm".
-class BinOpRI<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- Format f, dag outlist, X86FoldableSchedWrite sched, list<dag> pattern>
- : ITy<opcode, f, typeinfo, outlist,
- (ins typeinfo.RegClass:$src1, typeinfo.ImmOperand:$src2),
- mnemonic, "{$src2, $src1|$src1, $src2}", pattern>,
- Sched<[sched]> {
- let ImmT = typeinfo.ImmEncoding;
+// BinOpRM - Instructions that read "reg, [mem]".
+class BinOpRM<bits<8> o, string m, X86TypeInfo t, dag out, list<dag> p>
+ : ITy<o, MRMSrcMem, t, out, (ins t.RegClass:$src1, t.MemOperand:$src2), m,
+ binop_args, p>,
+ Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]> {
+ let mayLoad = 1;
+}
+// BinOpRM_F - Instructions that read "reg, [mem]" and write EFLAGS only.
+class BinOpRM_F<bits<8> o, string m, X86TypeInfo t, SDNode node>
+ : BinOpRM<o, m, t, (outs),
+ [(set EFLAGS, (node t.RegClass:$src1,
+ (t.LoadNode addr:$src2)))]>, DefEFLAGS;
+// BinOpRM_RF - Instructions that read "reg, reg", and write "reg", EFLAGS.
+class BinOpRM_RF<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
+ : BinOpRM<o, m, t, (outs t.RegClass:$dst),
+ [(set t.RegClass:$dst, EFLAGS, (node t.RegClass:$src1,
+ (t.LoadNode addr:$src2)))]>, DefEFLAGS;
+// BinOpRMF_RF - Instructions that read "reg, [mem]", write "reg" and read/write
+// EFLAGS.
+class BinOpRMF_RF<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
+ : BinOpRM<o, m, t, (outs t.RegClass:$dst),
+ [(set t.RegClass:$dst, EFLAGS,
+ (node t.RegClass:$src1, (t.LoadNode addr:$src2), EFLAGS))]>,
+ DefEFLAGS, UseEFLAGS {
+ let SchedRW = [WriteADC.Folded, WriteADC.ReadAfterFold,
+ // base, scale, index, offset, segment.
+ ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault,
+ // implicit register read.
+ WriteADC.ReadAfterFold];
}
-// BinOpRI_F - Binary instructions with inputs "reg, imm", where the pattern
-// has EFLAGS as a result.
-class BinOpRI_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDPatternOperator opnode, Format f>
- : BinOpRI<opcode, mnemonic, typeinfo, f, (outs), WriteALU,
- [(set EFLAGS,
- (opnode typeinfo.RegClass:$src1, typeinfo.ImmOperator:$src2))]>;
-
-// BinOpRI_RF - Binary instructions with inputs "reg, imm", where the pattern
-// has both a regclass and EFLAGS as a result.
-class BinOpRI_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode, Format f>
- : BinOpRI<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), WriteALU,
- [(set typeinfo.RegClass:$dst, EFLAGS,
- (opnode typeinfo.RegClass:$src1, typeinfo.ImmOperator:$src2))]>;
-
-// BinOpRI_RFF - Binary instructions with inputs "reg, imm", where the pattern
-// has both a regclass and EFLAGS as a result, and has EFLAGS as input.
-class BinOpRI_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode, Format f>
- : BinOpRI<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), WriteADC,
- [(set typeinfo.RegClass:$dst, EFLAGS,
- (opnode typeinfo.RegClass:$src1, typeinfo.ImmOperator:$src2,
- EFLAGS))]>;
-
-// BinOpRI8 - Binary instructions with inputs "reg, imm8".
-class BinOpRI8<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- Format f, dag outlist, X86FoldableSchedWrite sched, list<dag> pattern>
- : ITy<opcode, f, typeinfo, outlist,
- (ins typeinfo.RegClass:$src1, typeinfo.Imm8Operand:$src2),
- mnemonic, "{$src2, $src1|$src1, $src2}", pattern>,
- Sched<[sched]> {
- let ImmT = Imm8; // Always 8-bit immediate.
+// BinOpRI - Instructions that read "reg, imm".
+class BinOpRI<bits<8> o, string m, X86TypeInfo t, Format f, dag out, list<dag> p>
+ : ITy<o, f, t, out, (ins t.RegClass:$src1, t.ImmOperand:$src2), m,
+ binop_args, p>, Sched<[WriteALU]> {
+ let ImmT = t.ImmEncoding;
+}
+// BinOpRI_F - Instructions that read "reg, imm" and write EFLAGS only.
+class BinOpRI_F<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node,
+ Format f>
+ : BinOpRI<o, m, t, f, (outs),
+ [(set EFLAGS, (node t.RegClass:$src1,
+ t.ImmOperator:$src2))]>, DefEFLAGS;
+// BinOpRI_RF - Instructions that read "reg, imm" and write "reg", EFLAGS.
+class BinOpRI_RF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
+ : BinOpRI<o, m, t, f, (outs t.RegClass:$dst),
+ [(set t.RegClass:$dst, EFLAGS,
+ (node t.RegClass:$src1, t.ImmOperator:$src2))]>, DefEFLAGS;
+// BinOpRIF_RF - Instructions that read "reg, imm", write "reg" and read/write
+// EFLAGS.
+class BinOpRIF_RF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
+ : BinOpRI<o, m, t, f, (outs t.RegClass:$dst),
+ [(set t.RegClass:$dst, EFLAGS,
+ (node t.RegClass:$src1, t.ImmOperator:$src2,
+ EFLAGS))]>, DefEFLAGS, UseEFLAGS {
+ let SchedRW = [WriteADC];
+}
+// BinOpRI8 - Instructions that read "reg, imm8".
+class BinOpRI8<bits<8> o, string m, X86TypeInfo t, Format f, dag out>
+ : ITy<o, f, t, out, (ins t.RegClass:$src1, t.Imm8Operand:$src2), m,
+ binop_args, []>, Sched<[WriteALU]> {
+ let ImmT = Imm8;
+}
+// BinOpRI8_F - Instructions that read "reg, imm8" and write EFLAGS only.
+class BinOpRI8_F<bits<8> o, string m, X86TypeInfo t, Format f>
+ : BinOpRI8<o, m, t, f, (outs)>, DefEFLAGS;
+// BinOpRI8_RF - Instructions that read "reg, imm8" and write "reg", EFLAGS.
+class BinOpRI8_RF<bits<8> o, string m, X86TypeInfo t, Format f>
+ : BinOpRI8<o, m, t, f, (outs t.RegClass:$dst)>, DefEFLAGS;
+// BinOpRI8F_RF - Instructions that read "reg, imm", write "reg" and read/write
+// EFLAGS.
+class BinOpRI8F_RF<bits<8> o, string m, X86TypeInfo t, Format f>
+ : BinOpRI8<o, m, t, f, (outs t.RegClass:$dst)>, DefEFLAGS, UseEFLAGS {
+ let SchedRW = [WriteADC];
}
-// BinOpRI8_F - Binary instructions with inputs "reg, imm8".
-class BinOpRI8_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, Format f>
- : BinOpRI8<opcode, mnemonic, typeinfo, f, (outs), WriteALU, []>;
-
-// BinOpRI8_RF - Binary instructions with inputs "reg, imm8".
-class BinOpRI8_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, Format f>
- : BinOpRI8<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), WriteALU, []>;
-
-// BinOpRI8_RFF - Binary instructions with inputs "reg, imm8".
-class BinOpRI8_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, Format f>
- : BinOpRI8<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), WriteADC, []>;
-
-// BinOpMR - Binary instructions with inputs "[mem], reg".
-class BinOpMR<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- list<dag> pattern>
- : ITy<opcode, MRMDestMem, typeinfo,
- (outs), (ins typeinfo.MemOperand:$dst, typeinfo.RegClass:$src),
- mnemonic, "{$src, $dst|$dst, $src}", pattern>;
-
-// BinOpMR_RMW - Binary instructions with inputs "[mem], reg", where the pattern
-// implicitly use EFLAGS.
-class BinOpMR_RMW<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode>
- : BinOpMR<opcode, mnemonic, typeinfo,
- [(store (opnode (load addr:$dst), typeinfo.RegClass:$src), addr:$dst),
+// BinOpMR - Instructions that read "[mem], reg".
+class BinOpMR<bits<8> o, string m, X86TypeInfo t, list<dag> p>
+ : ITy<o, MRMDestMem, t, (outs), (ins t.MemOperand:$src1, t.RegClass:$src2), m,
+ binop_args, p> {
+ let mayLoad = 1;
+}
+// BinOpMR_F - Instructions that read "[mem], imm8" and write EFLAGS only.
+class BinOpMR_F<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
+ : BinOpMR<o, m, t,
+ [(set EFLAGS, (node (t.LoadNode addr:$src1), t.RegClass:$src2))]>,
+ Sched<[WriteALU.Folded, ReadDefault, ReadDefault, ReadDefault,
+ ReadDefault, ReadDefault, WriteALU.ReadAfterFold]>, DefEFLAGS;
+// BinOpMR_MF - Instructions that read "[mem], reg" and write "[mem]", EFLAGS.
+class BinOpMR_MF<bits<8> o, string m, X86TypeInfo t, SDNode node>
+ : BinOpMR<o, m, t,
+ [(store (node (load addr:$src1), t.RegClass:$src2), addr:$src1),
(implicit EFLAGS)]>,
Sched<[WriteALURMW,
// base, scale, index, offset, segment
- ReadDefault, ReadDefault, ReadDefault,
- ReadDefault, ReadDefault,
- WriteALU.ReadAfterFold]>; // reg
-
-// BinOpMR_RMW_FF - Binary instructions with inputs "[mem], reg", where the
-// pattern sets EFLAGS and implicitly uses EFLAGS.
-class BinOpMR_RMW_FF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode>
- : BinOpMR<opcode, mnemonic, typeinfo,
- [(store (opnode (load addr:$dst), typeinfo.RegClass:$src, EFLAGS),
- addr:$dst),
- (implicit EFLAGS)]>,
+ ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault,
+ WriteALU.ReadAfterFold]>, // reg
+ DefEFLAGS {
+ let mayStore = 1;
+}
+// BinOpMRF_MF - Instructions that read "[mem], reg", write "[mem]" and
+// read/write EFLAGS.
+class BinOpMRF_MF<bits<8> o, string m, X86TypeInfo t, SDNode node>
+ : BinOpMR<o, m, t,
+ [(store (node (load addr:$src1), t.RegClass:$src2, EFLAGS),
+ addr:$src1), (implicit EFLAGS)]>,
Sched<[WriteADCRMW,
// base, scale, index, offset, segment
ReadDefault, ReadDefault, ReadDefault,
ReadDefault, ReadDefault,
WriteALU.ReadAfterFold, // reg
- WriteALU.ReadAfterFold]>; // EFLAGS
-
-// BinOpMR_F - Binary instructions with inputs "[mem], reg", where the pattern
-// has EFLAGS as a result.
-class BinOpMR_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDPatternOperator opnode>
- : BinOpMR<opcode, mnemonic, typeinfo,
- [(set EFLAGS, (opnode (typeinfo.LoadNode addr:$dst),
- typeinfo.RegClass:$src))]>,
- Sched<[WriteALU.Folded, ReadDefault, ReadDefault, ReadDefault,
- ReadDefault, ReadDefault, WriteALU.ReadAfterFold]>;
-
-// BinOpMI - Binary instructions with inputs "[mem], imm".
-class BinOpMI<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- Format f, list<dag> pattern>
- : ITy<opcode, f, typeinfo,
- (outs), (ins typeinfo.MemOperand:$dst, typeinfo.ImmOperand:$src),
- mnemonic, "{$src, $dst|$dst, $src}", pattern> {
- let ImmT = typeinfo.ImmEncoding;
+ WriteALU.ReadAfterFold]>, // EFLAGS
+ DefEFLAGS, UseEFLAGS {
+ let mayStore = 1;
}
-// BinOpMI_RMW - Binary instructions with inputs "[mem], imm", where the
-// pattern implicitly use EFLAGS.
-class BinOpMI_RMW<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode, Format f>
- : BinOpMI<opcode, mnemonic, typeinfo, f,
- [(store (opnode (typeinfo.VT (load addr:$dst)),
- typeinfo.ImmOperator:$src), addr:$dst),
- (implicit EFLAGS)]>,
- Sched<[WriteALURMW]>;
-
-// BinOpMI_RMW_FF - Binary instructions with inputs "[mem], imm", where the
-// pattern sets EFLAGS and implicitly uses EFLAGS.
-class BinOpMI_RMW_FF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDNode opnode, Format f>
- : BinOpMI<opcode, mnemonic, typeinfo, f,
- [(store (opnode (typeinfo.VT (load addr:$dst)),
- typeinfo.ImmOperator:$src, EFLAGS), addr:$dst),
- (implicit EFLAGS)]>,
- Sched<[WriteADCRMW]>;
-
-// BinOpMI_F - Binary instructions with inputs "[mem], imm", where the pattern
-// has EFLAGS as a result.
-class BinOpMI_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- SDPatternOperator opnode, Format f>
- : BinOpMI<opcode, mnemonic, typeinfo, f,
- [(set EFLAGS, (opnode (typeinfo.LoadNode addr:$dst),
- typeinfo.ImmOperator:$src))]>,
- Sched<[WriteALU.Folded]>;
-
-// BinOpMI8 - Binary instructions with inputs "[mem], imm8".
-class BinOpMI8<string mnemonic, X86TypeInfo typeinfo,
- Format f, list<dag> pattern>
- : ITy<0x82, f, typeinfo,
- (outs), (ins typeinfo.MemOperand:$dst, typeinfo.Imm8Operand:$src),
- mnemonic, "{$src, $dst|$dst, $src}", pattern> {
- let ImmT = Imm8; // Always 8-bit immediate.
+// BinOpMI - Instructions that read "[mem], imm".
+class BinOpMI<bits<8> o, string m, X86TypeInfo t, Format f, list<dag> p>
+ : ITy<o, f, t, (outs), (ins t.MemOperand:$src1, t.ImmOperand:$src2), m,
+ binop_args, p> {
+ let ImmT = t.ImmEncoding;
+ let mayLoad = 1;
+}
+// BinOpMI_F - Instructions that read "[mem], imm" and write EFLAGS only.
+class BinOpMI_F<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node,
+ Format f>
+ : BinOpMI<o, m, t, f,
+ [(set EFLAGS, (node (t.LoadNode addr:$src1), t.ImmOperator:$src2))]>,
+ Sched<[WriteALU.Folded]>, DefEFLAGS;
+// BinOpMI_MF - Instructions that read "[mem], imm" and write "[mem]", EFLAGS.
+class BinOpMI_MF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
+ : BinOpMI<o, m, t, f,
+ [(store (node (t.VT (load addr:$src1)),
+ t.ImmOperator:$src2), addr:$src1), (implicit EFLAGS)]>,
+ Sched<[WriteALURMW]>, DefEFLAGS {
+ let mayStore = 1;
+}
+// BinOpMIF_MF - Instructions that read "[mem], imm", write "[mem]" and
+// read/write EFLAGS.
+class BinOpMIF_MF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
+ : BinOpMI<o, m, t, f,
+ [(store (node (t.VT (load addr:$src1)),
+ t.ImmOperator:$src2, EFLAGS), addr:$src1), (implicit EFLAGS)]>,
+ Sched<[WriteADCRMW]>, DefEFLAGS, UseEFLAGS {
+ let mayStore = 1;
}
-// BinOpMI8_RMW - Binary instructions with inputs "[mem], imm8".
-class BinOpMI8_RMW<string mnemonic, X86TypeInfo typeinfo, Format f>
- : BinOpMI8<mnemonic, typeinfo, f, []>, Sched<[WriteALURMW]>;
-
-// BinOpMI8_RMW_FF - Binary instructions with inputs "[mem], imm8".
-class BinOpMI8_RMW_FF<string mnemonic, X86TypeInfo typeinfo, Format f>
- : BinOpMI8<mnemonic, typeinfo, f, []>, Sched<[WriteADCRMW]>;
-
-// BinOpMI8_F - Binary instructions with inputs "[mem], imm8"
-class BinOpMI8_F<string mnemonic, X86TypeInfo typeinfo, Format f>
- : BinOpMI8<mnemonic, typeinfo, f, []>, Sched<[WriteALU.Folded]>;
-
-// BinOpAI - Binary instructions with input imm, that implicitly use A reg and
-// implicitly define Areg and EFLAGS.
-class BinOpAI<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- Register areg, string operands, X86FoldableSchedWrite sched = WriteALU>
- : ITy<opcode, RawFrm, typeinfo,
- (outs), (ins typeinfo.ImmOperand:$src),
- mnemonic, operands, []>,
- Sched<[sched]> {
- let ImmT = typeinfo.ImmEncoding;
+// BinOpMI8 - Instructions that read "[mem], imm8".
+class BinOpMI8<string m, X86TypeInfo t, Format f>
+ : ITy<0x83, f, t, (outs), (ins t.MemOperand:$src1, t.Imm8Operand:$src2), m,
+ binop_args, []> {
+ let ImmT = Imm8;
+ let mayLoad = 1;
+}
+// BinOpMI8_F - Instructions that read "[mem], imm8" and write EFLAGS only.
+class BinOpMI8_F<string m, X86TypeInfo t, Format f>
+ : BinOpMI8<m, t, f>, Sched<[WriteALU.Folded]>, DefEFLAGS;
+// BinOpMI8_MF - Instructions that read "[mem], imm8" and write "[mem]", EFLAGS.
+class BinOpMI8_MF<string m, X86TypeInfo t, Format f>
+ : BinOpMI8<m, t, f>, Sched<[WriteALURMW]>, DefEFLAGS {
+ let mayStore = 1;
+}
+// BinOpMI8F_MF - Instructions that read "[mem], imm8", write "[mem]" and
+// read/write EFLAGS.
+class BinOpMI8F_MF<string m, X86TypeInfo t, Format f>
+ : BinOpMI8<m, t, f>, Sched<[WriteADCRMW]>, DefEFLAGS, UseEFLAGS {
+ let mayStore = 1;
+}
+
+// BinOpAI - Instructions that read "a-reg imm" (Accumulator register).
+class BinOpAI<bits<8> o, string m, X86TypeInfo t, Register areg, string args>
+ : ITy<o, RawFrm, t, (outs), (ins t.ImmOperand:$src), m, args, []>,
+ Sched<[WriteALU]> {
+ let ImmT = t.ImmEncoding;
let Uses = [areg];
- let Defs = [areg, EFLAGS];
- let hasSideEffects = 0;
}
+// BinOpAI_F - Instructions that read "a-reg imm" and write EFLAGS only.
+class BinOpAI_F<bits<8> o, string m, X86TypeInfo t, Register areg, string args>
+ : BinOpAI<o, m, t, areg, args>, DefEFLAGS;
-// BinOpAI_RFF - Binary instructions with input imm, that implicitly use and
-// define Areg and EFLAGS.
-class BinOpAI_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- Register areg, string operands>
- : BinOpAI<opcode, mnemonic, typeinfo, areg, operands, WriteADC> {
+// BinOpAI_AF - Instructions that read "a-reg imm" and write a-reg/EFLAGS.
+class BinOpAI_AF<bits<8> o, string m, X86TypeInfo t, Register areg,
+ string args> : BinOpAI<o, m, t, areg, args> {
+ let Defs = [areg, EFLAGS];
+}
+// BinOpAIF_AF - Instructions that read "a-reg imm", write a-reg and read/write
+// EFLAGS.
+class BinOpAIF_AF<bits<8> o, string m, X86TypeInfo t, Register areg,
+ string args> : BinOpAI<o, m, t, areg, args> {
let Uses = [areg, EFLAGS];
+ let Defs = [areg, EFLAGS];
+ let SchedRW = [WriteADC];
}
-// BinOpAI_F - Binary instructions with input imm, that implicitly use A reg and
-// implicitly define EFLAGS.
-class BinOpAI_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo,
- Register areg, string operands>
- : BinOpAI<opcode, mnemonic, typeinfo, areg, operands> {
- let Defs = [EFLAGS];
+// UnaryOpR - Instructions that read "reg" and write "reg".
+class UnaryOpR<bits<8> o, Format f, string m, X86TypeInfo t, list<dag> p>
+ : ITy<o, f, t, (outs t.RegClass:$dst),
+ (ins t.RegClass:$src1), m, "$dst", p>, Sched<[WriteALU]>;
+
+// UnaryOpM - Instructions that read "[mem]" and writes "[mem]".
+class UnaryOpM<bits<8> o, Format f, string m, X86TypeInfo t, list<dag> p>
+ : ITy<o, f, t, (outs), (ins t.MemOperand:$dst), m, "$dst", p>,
+ Sched<[WriteALURMW]> {
+ let mayLoad = 1;
+ let mayStore = 1;
}
-// UnaryOpM - Unary instructions with a memory operand.
-class UnaryOpM<bits<8> opcode, Format f, string mnemonic, X86TypeInfo info,
- list<dag> pattern>
- : ITy<opcode, f, info, (outs), (ins info.MemOperand:$dst), mnemonic,
- "$dst", pattern>;
-
-// UnaryOpR - Unary instructions with a register.
-class UnaryOpR<bits<8> opcode, Format f, string mnemonic, X86TypeInfo info,
- list<dag> pattern>
- : ITy<opcode, f, info, (outs info.RegClass:$dst),
- (ins info.RegClass:$src1), mnemonic, "$dst", pattern>;
-
-// INCDECR - Instructions like "inc reg".
-class INCDECR<Format f, string mnemonic, X86TypeInfo info,
- SDPatternOperator node>
- : UnaryOpR<0xFE, f, mnemonic, info,
- [(set info.RegClass:$dst, EFLAGS,
- (node info.RegClass:$src1, 1))]>;
-
-// INCDECM - Instructions like "inc [mem]".
-class INCDECM<Format f, string mnemonic, X86TypeInfo info, int num>
- : UnaryOpM<0xFE, f, mnemonic, info,
- [(store (add (info.LoadNode addr:$dst), num), addr:$dst),
- (implicit EFLAGS)]>;
-
-// INCDECR_ALT - Instructions like "inc reg" short forms.
-class INCDECR_ALT<bits<8> opcode, string mnemonic, X86TypeInfo info>
- : UnaryOpR<opcode, AddRegFrm, mnemonic, info, []>{
+// INCDECR - Instructions like "inc reg".
+class INCDECR<Format f, string m, X86TypeInfo t, SDPatternOperator node>
+ : UnaryOpR<0xFF, f, m, t,
+ [(set t.RegClass:$dst, EFLAGS, (node t.RegClass:$src1, 1))]>,
+ DefEFLAGS {
+ let isConvertibleToThreeAddress = 1; // Can xform into LEA.
+}
+
+// INCDECM - Instructions like "inc [mem]".
+class INCDECM<Format f, string m, X86TypeInfo t, int num>
+ : UnaryOpM<0xFF, f, m, t,
+ [(store (add (t.LoadNode addr:$dst), num), addr:$dst),
+ (implicit EFLAGS)]>, DefEFLAGS;
+
+// INCDECR_ALT - Instructions like "inc reg" short forms.
+class INCDECR_ALT<bits<8> o, string m, X86TypeInfo t>
+ : UnaryOpR<o, AddRegFrm, m, t, []>, DefEFLAGS {
+ // Short forms only valid in 32-bit mode. Selected during MCInst lowering.
let Predicates = [Not64BitMode];
- let Opcode = opcode;
}
-// MulOpR - Instructions like "mul reg".
-class MulOpR<bits<8> opcode, Format f, string mnemonic, X86TypeInfo info,
- X86FoldableSchedWrite sched, list<dag> pattern>
- : ITy<opcode, f, info, (outs), (ins info.RegClass:$src), mnemonic,
- "$src", pattern>,
- Sched<[sched]>;
-
-// MulOpM - Instructions like "mul [mem]".
-class MulOpM<bits<8> opcode, Format f, string mnemonic, X86TypeInfo info,
- X86FoldableSchedWrite sched, list<dag> pattern>
- : ITy<opcode, f, info, (outs), (ins info.MemOperand:$src), mnemonic,
- "$src", pattern>, SchedLoadReg<sched>;
-
-// NegOpR - Instructions like "neg reg", with implicit EFLAGS.
-class NegOpR<bits<8> opcode, string mnemonic, X86TypeInfo info>
- : UnaryOpR<opcode, MRM3r, mnemonic, info,
- [(set info.RegClass:$dst, (ineg info.RegClass:$src1)),
- (implicit EFLAGS)]>;
-
-// NotOpR - Instructions like "not reg".
-class NotOpR<bits<8> opcode, string mnemonic, X86TypeInfo info>
- : UnaryOpR<opcode, MRM2r, mnemonic, info,
- [(set info.RegClass:$dst,
- (not info.RegClass:$src1))]>;
-
-// NegOpM - Instructions like "neg [mem]", with implicit EFLAGS.
-class NegOpM<bits<8> opcode, string mnemonic, X86TypeInfo info>
- : UnaryOpM<opcode, MRM3m, mnemonic, info,
- [(store (ineg (info.LoadNode addr:$dst)), addr:$dst),
- (implicit EFLAGS)]>;
-
-// NotOpM - Instructions like "neg [mem]".
-class NotOpM<bits<8> opcode, string mnemonic, X86TypeInfo info>
- : UnaryOpM<opcode, MRM2m, mnemonic, info,
- [(store (not (info.LoadNode addr:$dst)), addr:$dst)]>;
-
-// BinOpRR_C - Binary instructions with inputs "reg, reg", which used mainly
-// with Constraints = "$src1 = $dst".
-class BinOpRR_C<bits<8> opcode, Format f, string mnemonic, X86TypeInfo info,
- list<dag> pattern>
- : ITy<opcode, f, info, (outs info.RegClass:$dst),
- (ins info.RegClass:$src1, info.RegClass:$src2),
- mnemonic, "{$src2, $dst|$dst, $src2}", pattern>;
-
-// BinOpRM_C - Binary instructions with inputs "reg, [mem]", which used mainly
-// with Constraints = "$src1 = $dst".
-class BinOpRM_C<bits<8> opcode, Format f, string mnemonic, X86TypeInfo info,
- list<dag> pattern>
- : ITy<opcode, f, info, (outs info.RegClass:$dst),
- (ins info.RegClass:$src1, info.MemOperand:$src2),
- mnemonic, "{$src2, $dst|$dst, $src2}", pattern>;
+// MulOpR - Instructions like "mul reg".
+class MulOpR<bits<8> o, Format f, string m, X86TypeInfo t,
+ X86FoldableSchedWrite sched, list<dag> p>
+ : ITy<o, f, t, (outs), (ins t.RegClass:$src), m, "$src", p>, Sched<[sched]>;
+
+// MulOpM - Instructions like "mul [mem]".
+class MulOpM<bits<8> o, Format f, string m, X86TypeInfo t,
+ X86FoldableSchedWrite sched, list<dag> p>
+ : ITy<o, f, t, (outs), (ins t.MemOperand:$src), m,
+ "$src", p>, SchedLoadReg<sched> {
+ let mayLoad = 1;
+}
+
+// NegOpR - Instructions like "neg reg".
+class NegOpR<bits<8> o, string m, X86TypeInfo t>
+ : UnaryOpR<o, MRM3r, m, t,
+ [(set t.RegClass:$dst, (ineg t.RegClass:$src1)),
+ (implicit EFLAGS)]>, DefEFLAGS;
+
+// NegOpM - Instructions like "neg [mem]".
+class NegOpM<bits<8> o, string m, X86TypeInfo t>
+ : UnaryOpM<o, MRM3m, m, t,
+ [(store (ineg (t.LoadNode addr:$dst)), addr:$dst),
+ (implicit EFLAGS)]>, DefEFLAGS;
+
+// NOTE: NOT does not set EFLAGS!
+// NotOpR - Instructions like "not reg".
+class NotOpR<bits<8> o, string m, X86TypeInfo t>
+ : UnaryOpR<o, MRM2r, m, t, [(set t.RegClass:$dst, (not t.RegClass:$src1))]>;
+
+// NotOpM - Instructions like "neg [mem]".
+class NotOpM<bits<8> o, string m, X86TypeInfo t>
+ : UnaryOpM<o, MRM2m, m, t,
+ [(store (not (t.LoadNode addr:$dst)), addr:$dst)]>;
// IMulOpRR - Instructions like "imul reg, reg, i8".
-class IMulOpRR<bits<8> opcode, string mnemonic, X86TypeInfo info,
- X86FoldableSchedWrite sched>
- : BinOpRR_C<opcode, MRMSrcReg, mnemonic, info,
- [(set info.RegClass:$dst, EFLAGS,
- (X86smul_flag info.RegClass:$src1,
- info.RegClass:$src2))]>,
- Sched<[sched]>, TB;
+class IMulOpRR<bits<8> o, string m, X86TypeInfo t, X86FoldableSchedWrite sched>
+ : BinOpRR_RF<o, m, t, X86smul_flag>, TB {
+ let Form = MRMSrcReg;
+ let SchedRW = [sched];
+ // X = IMUL Y, Z --> X = IMUL Z, Y
+ let isCommutable = 1;
+}
// IMulOpRM - Instructions like "imul reg, reg, [mem]".
-class IMulOpRM<bits<8> opcode, string mnemonic, X86TypeInfo info,
- X86FoldableSchedWrite sched>
- : BinOpRM_C<opcode, MRMSrcMem, mnemonic, info,
- [(set info.RegClass:$dst, EFLAGS,
- (X86smul_flag info.RegClass:$src1, (info.LoadNode addr:$src2)))]>,
- Sched<[sched.Folded, sched.ReadAfterFold]>, TB;
+class IMulOpRM<bits<8> o, string m, X86TypeInfo t, X86FoldableSchedWrite sched>
+ : BinOpRM_RF<o, m, t, X86smul_flag>, TB {
+let Form = MRMSrcMem;
+let SchedRW = [sched.Folded, sched.ReadAfterFold];
+}
// IMulOpRRI8 - Instructions like "imul reg, reg, i8".
-class IMulOpRRI8<bits<8> opcode, string mnemonic, X86TypeInfo info,
+class IMulOpRRI8<bits<8> o, string m, X86TypeInfo t,
X86FoldableSchedWrite sched>
- : ITy<opcode, MRMSrcReg, info, (outs info.RegClass:$dst),
- (ins info.RegClass:$src1, info.Imm8Operand:$src2), mnemonic,
- "{$src2, $src1, $dst|$dst, $src1, $src2}", []>, Sched<[sched]> {
+ : ITy<o, MRMSrcReg, t, (outs t.RegClass:$dst),
+ (ins t.RegClass:$src1, t.Imm8Operand:$src2), m,
+ "{$src2, $src1, $dst|$dst, $src1, $src2}", []>, Sched<[sched]>, DefEFLAGS {
let ImmT = Imm8;
}
// IMulOpRRI - Instructions like "imul reg, reg, i16/i32/i64".
-class IMulOpRRI<bits<8> opcode, string mnemonic, X86TypeInfo info,
+class IMulOpRRI<bits<8> o, string m, X86TypeInfo t,
X86FoldableSchedWrite sched>
- : ITy<opcode, MRMSrcReg, info, (outs info.RegClass:$dst),
- (ins info.RegClass:$src1, info.ImmOperand:$src2), mnemonic,
+ : ITy<o, MRMSrcReg, t, (outs t.RegClass:$dst),
+ (ins t.RegClass:$src1, t.ImmOperand:$src2), m,
"{$src2, $src1, $dst|$dst, $src1, $src2}",
- [(set info.RegClass:$dst, EFLAGS,
- (X86smul_flag info.RegClass:$src1,
- info.ImmNoSuOperator:$src2))]>,
- Sched<[sched]>{
- let ImmT = info.ImmEncoding;
+ [(set t.RegClass:$dst, EFLAGS, (X86smul_flag t.RegClass:$src1,
+ t.ImmNoSuOperator:$src2))]>,
+ Sched<[sched]>, DefEFLAGS {
+ let ImmT = t.ImmEncoding;
}
// IMulOpRMI8 - Instructions like "imul reg, [mem], i8".
-class IMulOpRMI8<bits<8> opcode, string mnemonic, X86TypeInfo info,
+class IMulOpRMI8<bits<8> o, string m, X86TypeInfo t,
X86FoldableSchedWrite sched>
- : ITy<opcode, MRMSrcMem, info, (outs info.RegClass:$dst),
- (ins info.MemOperand:$src1, info.Imm8Operand:$src2), mnemonic,
- "{$src2, $src1, $dst|$dst, $src1, $src2}", []>, Sched<[sched.Folded]> {
+ : ITy<o, MRMSrcMem, t, (outs t.RegClass:$dst),
+ (ins t.MemOperand:$src1, t.Imm8Operand:$src2), m,
+ "{$src2, $src1, $dst|$dst, $src1, $src2}", []>, Sched<[sched.Folded]>,
+ DefEFLAGS {
let ImmT = Imm8;
+ let mayLoad = 1;
}
// IMulOpRMI - Instructions like "imul reg, [mem], i16/i32/i64".
-class IMulOpRMI<bits<8> opcode, string mnemonic, X86TypeInfo info,
+class IMulOpRMI<bits<8> o, string m, X86TypeInfo t,
X86FoldableSchedWrite sched>
- : ITy<opcode, MRMSrcMem, info, (outs info.RegClass:$dst),
- (ins info.MemOperand:$src1, info.ImmOperand:$src2), mnemonic,
+ : ITy<o, MRMSrcMem, t, (outs t.RegClass:$dst),
+ (ins t.MemOperand:$src1, t.ImmOperand:$src2), m,
"{$src2, $src1, $dst|$dst, $src1, $src2}",
- [(set info.RegClass:$dst, EFLAGS,
- (X86smul_flag (info.LoadNode addr:$src1),
- info.ImmNoSuOperator:$src2))]>,
- Sched<[sched.Folded]>{
- let ImmT = info.ImmEncoding;
+ [(set t.RegClass:$dst, EFLAGS,
+ (X86smul_flag (t.LoadNode addr:$src1), t.ImmNoSuOperator:$src2))]>,
+ Sched<[sched.Folded]>, DefEFLAGS {
+ let ImmT = t.ImmEncoding;
}
-let Defs = [EFLAGS] in {
-let Constraints = "$src1 = $dst", SchedRW = [WriteALU] in {
-// Short forms only valid in 32-bit mode. Selected during MCInst lowering.
-let hasSideEffects = 0 in {
-def INC16r_alt : INCDECR_ALT<0x40, "inc", Xi16>;
-def INC32r_alt : INCDECR_ALT<0x40, "inc", Xi32>;
-} // hasSideEffects = 0
-
-let isConvertibleToThreeAddress = 1 in { // Can xform into LEA.
+let Constraints = "$src1 = $dst" in {
+def INC16r_alt : INCDECR_ALT<0x40, "inc", Xi16>, OpSize16;
+def INC32r_alt : INCDECR_ALT<0x40, "inc", Xi32>, OpSize32;
def INC8r : INCDECR<MRM0r, "inc", Xi8, X86add_flag_nocf>;
-def INC16r : INCDECR<MRM0r, "inc", Xi16, X86add_flag_nocf>;
-def INC32r : INCDECR<MRM0r, "inc", Xi32, X86add_flag_nocf>;
+def INC16r : INCDECR<MRM0r, "inc", Xi16, X86add_flag_nocf>, OpSize16;
+def INC32r : INCDECR<MRM0r, "inc", Xi32, X86add_flag_nocf>, OpSize32;
def INC64r : INCDECR<MRM0r, "inc", Xi64, X86add_flag_nocf>;
-} // isConvertibleToThreeAddress = 1
-} // Constraints = "$src1 = $dst", SchedRW
-let SchedRW = [WriteALURMW] in {
-let Predicates = [UseIncDec] in {
- def INC8m : INCDECM<MRM0m, "inc", Xi8, 1>;
- def INC16m : INCDECM<MRM0m, "inc", Xi16, 1>;
- def INC32m : INCDECM<MRM0m, "inc", Xi32, 1>;
-} // Predicates
-let Predicates = [UseIncDec, In64BitMode] in {
- def INC64m : INCDECM<MRM0m, "inc", Xi64, 1>;
-} // Predicates
-} // SchedRW
-
-let Constraints = "$src1 = $dst", SchedRW = [WriteALU] in {
-// Short forms only valid in 32-bit mode. Selected during MCInst lowering.
-let hasSideEffects = 0 in {
-def DEC16r_alt : INCDECR_ALT<0x48, "dec", Xi16>;
-def DEC32r_alt : INCDECR_ALT<0x48, "dec", Xi32>;
-} // hasSideEffects = 0
-
-let isConvertibleToThreeAddress = 1 in { // Can xform into LEA.
+def DEC16r_alt : INCDECR_ALT<0x48, "dec", Xi16>, OpSize16;
+def DEC32r_alt : INCDECR_ALT<0x48, "dec", Xi32>, OpSize32;
def DEC8r : INCDECR<MRM1r, "dec", Xi8, X86sub_flag_nocf>;
-def DEC16r : INCDECR<MRM1r, "dec", Xi16, X86sub_flag_nocf>;
-def DEC32r : INCDECR<MRM1r, "dec", Xi32, X86sub_flag_nocf>;
+def DEC16r : INCDECR<MRM1r, "dec", Xi16, X86sub_flag_nocf>, OpSize16;
+def DEC32r : INCDECR<MRM1r, "dec", Xi32, X86sub_flag_nocf>, OpSize32;
def DEC64r : INCDECR<MRM1r, "dec", Xi64, X86sub_flag_nocf>;
-} // isConvertibleToThreeAddress = 1
-} // Constraints = "$src1 = $dst", SchedRW
+}
-let SchedRW = [WriteALURMW] in {
let Predicates = [UseIncDec] in {
- def DEC8m : INCDECM<MRM1m, "dec", Xi8, -1>;
- def DEC16m : INCDECM<MRM1m, "dec", Xi16, -1>;
- def DEC32m : INCDECM<MRM1m, "dec", Xi32, -1>;
-} // Predicates
+def INC8m : INCDECM<MRM0m, "inc", Xi8, 1>;
+def INC16m : INCDECM<MRM0m, "inc", Xi16, 1>, OpSize16;
+def INC32m : INCDECM<MRM0m, "inc", Xi32, 1>, OpSize32;
+def DEC8m : INCDECM<MRM1m, "dec", Xi8, -1>;
+def DEC16m : INCDECM<MRM1m, "dec", Xi16, -1>, OpSize16;
+def DEC32m : INCDECM<MRM1m, "dec", Xi32, -1>, OpSize32;
+}
let Predicates = [UseIncDec, In64BitMode] in {
- def DEC64m : INCDECM<MRM1m, "dec", Xi64, -1>;
-} // Predicates
-} // SchedRW
-} // Defs = [EFLAGS]
+def INC64m : INCDECM<MRM0m, "inc", Xi64, 1>;
+def DEC64m : INCDECM<MRM1m, "dec", Xi64, -1>;
+}
// Extra precision multiplication
@@ -562,14 +447,14 @@ def MUL8r : MulOpR<0xF6, MRM4r, "mul", Xi8, WriteIMul8,
// syntax can be accepted.
[(set AL, (mul AL, GR8:$src)), (implicit EFLAGS)]>;
// AX,DX = AX*GR16
-let Defs = [AX,DX,EFLAGS], Uses = [AX], hasSideEffects = 0 in
-def MUL16r : MulOpR<0xF7, MRM4r, "mul", Xi16, WriteIMul16, []>;
+let Defs = [AX,DX,EFLAGS], Uses = [AX] in
+def MUL16r : MulOpR<0xF7, MRM4r, "mul", Xi16, WriteIMul16, []>, OpSize16;
// EAX,EDX = EAX*GR32
-let Defs = [EAX,EDX,EFLAGS], Uses = [EAX], hasSideEffects = 0 in
+let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
def MUL32r : MulOpR<0xF7, MRM4r, "mul", Xi32, WriteIMul32,
- [/*(set EAX, EDX, EFLAGS, (X86umul_flag EAX, GR32:$src))*/]>;
+ [/*(set EAX, EDX, EFLAGS, (X86umul_flag EAX, GR32:$src))*/]>, OpSize32;
// RAX,RDX = RAX*GR64
-let Defs = [RAX,RDX,EFLAGS], Uses = [RAX], hasSideEffects = 0 in
+let Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in
def MUL64r : MulOpR<0xF7, MRM4r, "mul", Xi64, WriteIMul64,
[/*(set RAX, RDX, EFLAGS, (X86umul_flag RAX, GR64:$src))*/]>;
// AL,AH = AL*[mem8]
@@ -581,79 +466,68 @@ def MUL8m : MulOpM<0xF6, MRM4m, "mul", Xi8, WriteIMul8,
[(set AL, (mul AL, (loadi8 addr:$src))),
(implicit EFLAGS)]>;
// AX,DX = AX*[mem16]
-let mayLoad = 1, hasSideEffects = 0 in {
let Defs = [AX,DX,EFLAGS], Uses = [AX] in
-def MUL16m : MulOpM<0xF7, MRM4m, "mul", Xi16, WriteIMul16, []>;
+def MUL16m : MulOpM<0xF7, MRM4m, "mul", Xi16, WriteIMul16, []>, OpSize16;
// EAX,EDX = EAX*[mem32]
let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
-def MUL32m : MulOpM<0xF7, MRM4m, "mul", Xi32, WriteIMul32, []>;
+def MUL32m : MulOpM<0xF7, MRM4m, "mul", Xi32, WriteIMul32, []>, OpSize32;
// RAX,RDX = RAX*[mem64]
let Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in
def MUL64m : MulOpM<0xF7, MRM4m, "mul", Xi64, WriteIMul64, []>,
- Requires<[In64BitMode]>;
-}
+ Requires<[In64BitMode]>;
-let hasSideEffects = 0 in {
// AL,AH = AL*GR8
let Defs = [AL,EFLAGS,AX], Uses = [AL] in
def IMUL8r : MulOpR<0xF6, MRM5r, "imul", Xi8, WriteIMul8, []>;
// AX,DX = AX*GR16
let Defs = [AX,DX,EFLAGS], Uses = [AX] in
-def IMUL16r : MulOpR<0xF7, MRM5r, "imul", Xi16, WriteIMul16, []>;
+def IMUL16r : MulOpR<0xF7, MRM5r, "imul", Xi16, WriteIMul16, []>, OpSize16;
// EAX,EDX = EAX*GR32
let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
-def IMUL32r : MulOpR<0xF7, MRM5r, "imul", Xi32, WriteIMul32, []>;
+def IMUL32r : MulOpR<0xF7, MRM5r, "imul", Xi32, WriteIMul32, []>, OpSize32;
// RAX,RDX = RAX*GR64
let Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in
def IMUL64r : MulOpR<0xF7, MRM5r, "imul", Xi64, WriteIMul64, []>;
-let mayLoad = 1 in {
// AL,AH = AL*[mem8]
let Defs = [AL,EFLAGS,AX], Uses = [AL] in
def IMUL8m : MulOpM<0xF6, MRM5m, "imul", Xi8, WriteIMul8, []>;
// AX,DX = AX*[mem16]
let Defs = [AX,DX,EFLAGS], Uses = [AX] in
-def IMUL16m : MulOpM<0xF7, MRM5m, "imul", Xi16, WriteIMul16, []>;
+def IMUL16m : MulOpM<0xF7, MRM5m, "imul", Xi16, WriteIMul16, []>, OpSize16;
// EAX,EDX = EAX*[mem32]
let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
-def IMUL32m : MulOpM<0xF7, MRM5m, "imul", Xi32, WriteIMul32, []>;
+def IMUL32m : MulOpM<0xF7, MRM5m, "imul", Xi32, WriteIMul32, []>, OpSize32;
// RAX,RDX = RAX*[mem64]
let Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in
def IMUL64m : MulOpM<0xF7, MRM5m, "imul", Xi64, WriteIMul64, []>,
- Requires<[In64BitMode]>;
-}
+ Requires<[In64BitMode]>;
-let Defs = [EFLAGS] in {
let Constraints = "$src1 = $dst" in {
-let isCommutable = 1 in {
-// X = IMUL Y, Z --> X = IMUL Z, Y
// Register-Register Signed Integer Multiply
-def IMUL16rr : IMulOpRR<0xAF, "imul", Xi16, WriteIMul16Reg>;
-def IMUL32rr : IMulOpRR<0xAF, "imul", Xi32, WriteIMul32Reg>;
+def IMUL16rr : IMulOpRR<0xAF, "imul", Xi16, WriteIMul16Reg>, OpSize16;
+def IMUL32rr : IMulOpRR<0xAF, "imul", Xi32, WriteIMul32Reg>, OpSize32;
def IMUL64rr : IMulOpRR<0xAF, "imul", Xi64, WriteIMul64Reg>;
-} // isCommutable
// Register-Memory Signed Integer Multiply
-def IMUL16rm : IMulOpRM<0xAF, "imul", Xi16, WriteIMul16Reg>;
-def IMUL32rm : IMulOpRM<0xAF, "imul", Xi32, WriteIMul32Reg>;
+def IMUL16rm : IMulOpRM<0xAF, "imul", Xi16, WriteIMul16Reg>, OpSize16;
+def IMUL32rm : IMulOpRM<0xAF, "imul", Xi32, WriteIMul32Reg>, OpSize32;
def IMUL64rm : IMulOpRM<0xAF, "imul", Xi64, WriteIMul64Reg>;
-} // Constraints = "$src1 = $dst"
-} // Defs = [EFLAGS]
+}
// Surprisingly enough, these are not two address instructions!
-let Defs = [EFLAGS] in {
// NOTE: These are order specific, we want the ri8 forms to be listed
// first so that they are slightly preferred to the ri forms.
// Register-Integer Signed Integer Multiply
// GR16 = GR16*I8
-def IMUL16rri8 : IMulOpRRI8<0x6B, "imul", Xi16, WriteIMul16Imm>;
+def IMUL16rri8 : IMulOpRRI8<0x6B, "imul", Xi16, WriteIMul16Imm>, OpSize16;
// GR16 = GR16*I16
-def IMUL16rri : IMulOpRRI<0x69, "imul", Xi16, WriteIMul16Imm>;
+def IMUL16rri : IMulOpRRI<0x69, "imul", Xi16, WriteIMul16Imm>, OpSize16;
// GR32 = GR32*I8
-def IMUL32rri8 : IMulOpRRI8<0x6B, "imul", Xi32, WriteIMul32Imm>;
+def IMUL32rri8 : IMulOpRRI8<0x6B, "imul", Xi32, WriteIMul32Imm>, OpSize32;
// GR32 = GR32*I32
-def IMUL32rri : IMulOpRRI<0x69, "imul", Xi32, WriteIMul32Imm>;
+def IMUL32rri : IMulOpRRI<0x69, "imul", Xi32, WriteIMul32Imm>, OpSize32;
// GR64 = GR64*I8
def IMUL64rri8 : IMulOpRRI8<0x6B, "imul", Xi64, WriteIMul64Imm>;
// GR64 = GR64*I32
@@ -661,21 +535,17 @@ def IMUL64rri32 : IMulOpRRI<0x69, "imul", Xi64, WriteIMul64Imm>;
// Memory-Integer Signed Integer Multiply
// GR16 = [mem16]*I8
-let mayLoad = 1 in {
-def IMUL16rmi8 : IMulOpRMI8<0x6B, "imul", Xi16, WriteIMul16Imm>;
+def IMUL16rmi8 : IMulOpRMI8<0x6B, "imul", Xi16, WriteIMul16Imm>, OpSize16;
// GR16 = [mem16]*I16
-def IMUL16rmi : IMulOpRMI<0x69, "imul", Xi16, WriteIMul16Imm>;
+def IMUL16rmi : IMulOpRMI<0x69, "imul", Xi16, WriteIMul16Imm>, OpSize16;
// GR32 = [mem32]*I8
-def IMUL32rmi8 : IMulOpRMI8<0x6B, "imul", Xi32, WriteIMul32Imm>;
+def IMUL32rmi8 : IMulOpRMI8<0x6B, "imul", Xi32, WriteIMul32Imm>, OpSize32;
// GR32 = [mem32]*I32
-def IMUL32rmi : IMulOpRMI<0x69, "imul", Xi32, WriteIMul32Imm>;
+def IMUL32rmi : IMulOpRMI<0x69, "imul", Xi32, WriteIMul32Imm>, OpSize32;
// GR64 = [mem64]*I8
def IMUL64rmi8 : IMulOpRMI8<0x6B, "imul", Xi64, WriteIMul64Imm>;
// GR64 = [mem64]*I32
def IMUL64rmi32 : IMulOpRMI<0x69, "imul", Xi64, WriteIMul64Imm>;
-} // mayLoad
-} // Defs = [EFLAGS]
-} // hasSideEffects
// unsigned division/remainder
let hasSideEffects = 1 in { // so that we don't speculatively execute
@@ -684,10 +554,10 @@ let Defs = [AL,AH,EFLAGS], Uses = [AX] in
def DIV8r : MulOpR<0xF6, MRM6r, "div", Xi8, WriteDiv8, []>;
let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
// DX:AX/r16 = AX,DX
-def DIV16r : MulOpR<0xF7, MRM6r, "div", Xi16, WriteDiv16, []>;
+def DIV16r : MulOpR<0xF7, MRM6r, "div", Xi16, WriteDiv16, []>, OpSize16;
let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
// EDX:EAX/r32 = EAX,EDX
-def DIV32r : MulOpR<0xF7, MRM6r, "div", Xi32, WriteDiv32, []>;
+def DIV32r : MulOpR<0xF7, MRM6r, "div", Xi32, WriteDiv32, []>, OpSize32;
// RDX:RAX/r64 = RAX,RDX
let Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in
def DIV64r : MulOpR<0xF7, MRM6r, "div", Xi64, WriteDiv64, []>;
@@ -698,9 +568,9 @@ let Defs = [AL,AH,EFLAGS], Uses = [AX] in
def DIV8m : MulOpM<0xF6, MRM6m, "div", Xi8, WriteDiv8, []>;
let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
// DX:AX/[mem16] = AX,DX
-def DIV16m : MulOpM<0xF7, MRM6m, "div", Xi16, WriteDiv16, []>;
+def DIV16m : MulOpM<0xF7, MRM6m, "div", Xi16, WriteDiv16, []>, OpSize16;
let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in // EDX:EAX/[mem32] = EAX,EDX
-def DIV32m : MulOpM<0xF7, MRM6m, "div", Xi32, WriteDiv32, []>;
+def DIV32m : MulOpM<0xF7, MRM6m, "div", Xi32, WriteDiv32, []>, OpSize32;
// RDX:RAX/[mem64] = RAX,RDX
let Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in
def DIV64m : MulOpM<0xF7, MRM6m, "div", Xi64, WriteDiv64, []>,
@@ -713,69 +583,52 @@ let Defs = [AL,AH,EFLAGS], Uses = [AX] in
def IDIV8r : MulOpR<0xF6, MRM7r, "idiv", Xi8, WriteIDiv8, []>;
let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
// DX:AX/r16 = AX,DX
-def IDIV16r: MulOpR<0xF7, MRM7r, "idiv", Xi16, WriteIDiv16, []>;
+def IDIV16r: MulOpR<0xF7, MRM7r, "idiv", Xi16, WriteIDiv16, []>, OpSize16;
let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
// EDX:EAX/r32 = EAX,EDX
-def IDIV32r: MulOpR<0xF7, MRM7r, "idiv", Xi32, WriteIDiv32, []>;
+def IDIV32r: MulOpR<0xF7, MRM7r, "idiv", Xi32, WriteIDiv32, []>, OpSize32;
// RDX:RAX/r64 = RAX,RDX
let Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in
def IDIV64r: MulOpR<0xF7, MRM7r, "idiv", Xi64, WriteIDiv64, []>;
-let mayLoad = 1 in {
let Defs = [AL,AH,EFLAGS], Uses = [AX] in
// AX/[mem8] = AL,AH
def IDIV8m : MulOpM<0xF6, MRM7m, "idiv", Xi8, WriteIDiv8, []>;
let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
// DX:AX/[mem16] = AX,DX
-def IDIV16m: MulOpM<0xF7, MRM7m, "idiv", Xi16, WriteIDiv16, []>;
+def IDIV16m: MulOpM<0xF7, MRM7m, "idiv", Xi16, WriteIDiv16, []>, OpSize16;
let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
// EDX:EAX/[mem32] = EAX,EDX
-def IDIV32m: MulOpM<0xF7, MRM7m, "idiv", Xi32, WriteIDiv32, []>;
+def IDIV32m: MulOpM<0xF7, MRM7m, "idiv", Xi32, WriteIDiv32, []>, OpSize32;
let Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in // RDX:RAX/[mem64] = RAX,RDX
// RDX:RAX/[mem64] = RAX,RDX
def IDIV64m: MulOpM<0xF7, MRM7m, "idiv", Xi64, WriteIDiv64, []>,
Requires<[In64BitMode]>;
-}
} // hasSideEffects = 1
-//===----------------------------------------------------------------------===//
-// Two address Instructions.
-//
-
-// unary instructions
-let Defs = [EFLAGS] in {
-let Constraints = "$src1 = $dst", SchedRW = [WriteALU] in {
+let Constraints = "$src1 = $dst" in {
def NEG8r : NegOpR<0xF6, "neg", Xi8>;
-def NEG16r : NegOpR<0xF7, "neg", Xi16>;
-def NEG32r : NegOpR<0xF7, "neg", Xi32>;
+def NEG16r : NegOpR<0xF7, "neg", Xi16>, OpSize16;
+def NEG32r : NegOpR<0xF7, "neg", Xi32>, OpSize32;
def NEG64r : NegOpR<0xF7, "neg", Xi64>;
-} // Constraints = "$src1 = $dst", SchedRW
+}
-// Read-modify-write negate.
-let SchedRW = [WriteALURMW] in {
def NEG8m : NegOpM<0xF6, "neg", Xi8>;
-def NEG16m : NegOpM<0xF7, "neg", Xi16>;
-def NEG32m : NegOpM<0xF7, "neg", Xi32>;
+def NEG16m : NegOpM<0xF7, "neg", Xi16>, OpSize16;
+def NEG32m : NegOpM<0xF7, "neg", Xi32>, OpSize32;
def NEG64m : NegOpM<0xF7, "neg", Xi64>, Requires<[In64BitMode]>;
-} // SchedRW
-} // Defs = [EFLAGS]
-
-// Note: NOT does not set EFLAGS!
-
-let Constraints = "$src1 = $dst", SchedRW = [WriteALU] in {
+let Constraints = "$src1 = $dst" in {
def NOT8r : NotOpR<0xF6, "not", Xi8>;
-def NOT16r : NotOpR<0xF7, "not", Xi16>;
-def NOT32r : NotOpR<0xF7, "not", Xi32>;
+def NOT16r : NotOpR<0xF7, "not", Xi16>, OpSize16;
+def NOT32r : NotOpR<0xF7, "not", Xi32>, OpSize32;
def NOT64r : NotOpR<0xF7, "not", Xi64>;
-} // Constraints = "$src1 = $dst", SchedRW
+}
-let SchedRW = [WriteALURMW] in {
def NOT8m : NotOpM<0xF6, "not", Xi8>;
-def NOT16m : NotOpM<0xF7, "not", Xi16>;
-def NOT32m : NotOpM<0xF7, "not", Xi32>;
+def NOT16m : NotOpM<0xF7, "not", Xi16>, OpSize16;
+def NOT32m : NotOpM<0xF7, "not", Xi32>, OpSize32;
def NOT64m : NotOpM<0xF7, "not", Xi64>, Requires<[In64BitMode]>;
-} // SchedRW
/// ArithBinOp_RF - This is an arithmetic binary operator where the pattern is
/// defined with "(set GPR:$dst, EFLAGS, (...".
@@ -787,81 +640,73 @@ multiclass ArithBinOp_RF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
SDNode opnodeflag, SDNode opnode,
bit CommutableRR, bit ConvertibleToThreeAddress,
bit ConvertibleToThreeAddressRR> {
- let Defs = [EFLAGS] in {
- let Constraints = "$src1 = $dst" in {
- let isCommutable = CommutableRR in {
- let isConvertibleToThreeAddress = ConvertibleToThreeAddressRR in {
- def NAME#8rr : BinOpRR_RF<BaseOpc, mnemonic, Xi8 , opnodeflag>;
- def NAME#16rr : BinOpRR_RF<BaseOpc, mnemonic, Xi16, opnodeflag>;
- def NAME#32rr : BinOpRR_RF<BaseOpc, mnemonic, Xi32, opnodeflag>;
- def NAME#64rr : BinOpRR_RF<BaseOpc, mnemonic, Xi64, opnodeflag>;
- } // isConvertibleToThreeAddress
- } // isCommutable
-
- def NAME#8rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi8>;
- def NAME#16rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi16>;
- def NAME#32rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi32>;
- def NAME#64rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi64>;
-
- def NAME#8rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi8 , opnodeflag>;
- def NAME#16rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi16, opnodeflag>;
- def NAME#32rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi32, opnodeflag>;
- def NAME#64rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi64, opnodeflag>;
-
- let isConvertibleToThreeAddress = ConvertibleToThreeAddress, hasSideEffects= 0 in {
- def NAME#8ri : BinOpRI_RF<0x80, mnemonic, Xi8 , opnodeflag, RegMRM>;
-
- // NOTE: These are order specific, we want the ri8 forms to be listed
- // first so that they are slightly preferred to the ri forms.
- def NAME#16ri8 : BinOpRI8_RF<0x82, mnemonic, Xi16, RegMRM>;
- def NAME#32ri8 : BinOpRI8_RF<0x82, mnemonic, Xi32, RegMRM>;
- def NAME#64ri8 : BinOpRI8_RF<0x82, mnemonic, Xi64, RegMRM>;
-
- def NAME#16ri : BinOpRI_RF<0x80, mnemonic, Xi16, opnodeflag, RegMRM>;
- def NAME#32ri : BinOpRI_RF<0x80, mnemonic, Xi32, opnodeflag, RegMRM>;
- def NAME#64ri32: BinOpRI_RF<0x80, mnemonic, Xi64, opnodeflag, RegMRM>;
- }
- } // Constraints = "$src1 = $dst"
-
- let mayLoad = 1, mayStore = 1, hasSideEffects = 0 in {
- def NAME#8mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi8 , opnode>;
- def NAME#16mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi16, opnode>;
- def NAME#32mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi32, opnode>;
- def NAME#64mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi64, opnode>;
-
- // NOTE: These are order specific, we want the mi8 forms to be listed
- // first so that they are slightly preferred to the mi forms.
- def NAME#16mi8 : BinOpMI8_RMW<mnemonic, Xi16, MemMRM>;
- def NAME#32mi8 : BinOpMI8_RMW<mnemonic, Xi32, MemMRM>;
- let Predicates = [In64BitMode] in
- def NAME#64mi8 : BinOpMI8_RMW<mnemonic, Xi64, MemMRM>;
-
- def NAME#8mi : BinOpMI_RMW<0x80, mnemonic, Xi8 , opnode, MemMRM>;
- def NAME#16mi : BinOpMI_RMW<0x80, mnemonic, Xi16, opnode, MemMRM>;
- def NAME#32mi : BinOpMI_RMW<0x80, mnemonic, Xi32, opnode, MemMRM>;
- let Predicates = [In64BitMode] in
- def NAME#64mi32 : BinOpMI_RMW<0x80, mnemonic, Xi64, opnode, MemMRM>;
+ let Constraints = "$src1 = $dst" in {
+ let isCommutable = CommutableRR,
+ isConvertibleToThreeAddress = ConvertibleToThreeAddressRR in {
+ def NAME#8rr : BinOpRR_RF<BaseOpc, mnemonic, Xi8 , opnodeflag>;
+ def NAME#16rr : BinOpRR_RF<BaseOpc, mnemonic, Xi16, opnodeflag>, OpSize16;
+ def NAME#32rr : BinOpRR_RF<BaseOpc, mnemonic, Xi32, opnodeflag>, OpSize32;
+ def NAME#64rr : BinOpRR_RF<BaseOpc, mnemonic, Xi64, opnodeflag>;
}
- // These are for the disassembler since 0x82 opcode behaves like 0x80, but
- // not in 64-bit mode.
- let Predicates = [Not64BitMode], isCodeGenOnly = 1, ForceDisassemble = 1,
- hasSideEffects = 0 in {
- let Constraints = "$src1 = $dst" in
- def NAME#8ri8 : BinOpRI8_RF<0x82, mnemonic, Xi8, RegMRM>;
- let mayLoad = 1, mayStore = 1 in
- def NAME#8mi8 : BinOpMI8_RMW<mnemonic, Xi8, MemMRM>;
+ def NAME#8rr_REV : BinOpRR_RF_Rev<BaseOpc2, mnemonic, Xi8>;
+ def NAME#16rr_REV : BinOpRR_RF_Rev<BaseOpc2, mnemonic, Xi16>, OpSize16;
+ def NAME#32rr_REV : BinOpRR_RF_Rev<BaseOpc2, mnemonic, Xi32>, OpSize32;
+ def NAME#64rr_REV : BinOpRR_RF_Rev<BaseOpc2, mnemonic, Xi64>;
+
+ def NAME#8rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi8 , opnodeflag>;
+ def NAME#16rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi16, opnodeflag>, OpSize16;
+ def NAME#32rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi32, opnodeflag>, OpSize32;
+ def NAME#64rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi64, opnodeflag>;
+
+ let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
+ def NAME#8ri : BinOpRI_RF<0x80, mnemonic, Xi8 , opnodeflag, RegMRM>;
+ // NOTE: These are order specific, we want the ri8 forms to be listed
+ // first so that they are slightly preferred to the ri forms.
+ def NAME#16ri8 : BinOpRI8_RF<0x83, mnemonic, Xi16, RegMRM>, OpSize16;
+ def NAME#32ri8 : BinOpRI8_RF<0x83, mnemonic, Xi32, RegMRM>, OpSize32;
+ def NAME#64ri8 : BinOpRI8_RF<0x83, mnemonic, Xi64, RegMRM>;
+
+ def NAME#16ri : BinOpRI_RF<0x81, mnemonic, Xi16, opnodeflag, RegMRM>, OpSize16;
+ def NAME#32ri : BinOpRI_RF<0x81, mnemonic, Xi32, opnodeflag, RegMRM>, OpSize32;
+ def NAME#64ri32: BinOpRI_RF<0x81, mnemonic, Xi64, opnodeflag, RegMRM>;
}
- } // Defs = [EFLAGS]
-
- def NAME#8i8 : BinOpAI<BaseOpc4, mnemonic, Xi8 , AL,
- "{$src, %al|al, $src}">;
- def NAME#16i16 : BinOpAI<BaseOpc4, mnemonic, Xi16, AX,
- "{$src, %ax|ax, $src}">;
- def NAME#32i32 : BinOpAI<BaseOpc4, mnemonic, Xi32, EAX,
- "{$src, %eax|eax, $src}">;
- def NAME#64i32 : BinOpAI<BaseOpc4, mnemonic, Xi64, RAX,
- "{$src, %rax|rax, $src}">;
+ } // Constraints = "$src1 = $dst"
+
+ def NAME#8mr : BinOpMR_MF<BaseOpc, mnemonic, Xi8 , opnode>;
+ def NAME#16mr : BinOpMR_MF<BaseOpc, mnemonic, Xi16, opnode>, OpSize16;
+ def NAME#32mr : BinOpMR_MF<BaseOpc, mnemonic, Xi32, opnode>, OpSize32;
+ def NAME#64mr : BinOpMR_MF<BaseOpc, mnemonic, Xi64, opnode>;
+
+ // NOTE: These are order specific, we want the mi8 forms to be listed
+ // first so that they are slightly preferred to the mi forms.
+ def NAME#16mi8 : BinOpMI8_MF<mnemonic, Xi16, MemMRM>, OpSize16;
+ def NAME#32mi8 : BinOpMI8_MF<mnemonic, Xi32, MemMRM>, OpSize32;
+ let Predicates = [In64BitMode] in
+ def NAME#64mi8 : BinOpMI8_MF<mnemonic, Xi64, MemMRM>;
+
+ def NAME#8mi : BinOpMI_MF<0x80, mnemonic, Xi8 , opnode, MemMRM>;
+ def NAME#16mi : BinOpMI_MF<0x81, mnemonic, Xi16, opnode, MemMRM>, OpSize16;
+ def NAME#32mi : BinOpMI_MF<0x81, mnemonic, Xi32, opnode, MemMRM>, OpSize32;
+ let Predicates = [In64BitMode] in
+ def NAME#64mi32 : BinOpMI_MF<0x81, mnemonic, Xi64, opnode, MemMRM>;
+
+ // These are for the disassembler since 0x82 opcode behaves like 0x80, but
+ // not in 64-bit mode.
+ let Predicates = [Not64BitMode] in {
+ let Constraints = "$src1 = $dst" in
+ def NAME#8ri8 : BinOpRI8_RF<0x82, mnemonic, Xi8, RegMRM>, DisassembleOnly;
+ def NAME#8mi8 : BinOpMI8_MF<mnemonic, Xi8, MemMRM>, DisassembleOnly;
+ }
+
+ def NAME#8i8 : BinOpAI_AF<BaseOpc4, mnemonic, Xi8 , AL,
+ "{$src, %al|al, $src}">;
+ def NAME#16i16 : BinOpAI_AF<BaseOpc4, mnemonic, Xi16, AX,
+ "{$src, %ax|ax, $src}">, OpSize16;
+ def NAME#32i32 : BinOpAI_AF<BaseOpc4, mnemonic, Xi32, EAX,
+ "{$src, %eax|eax, $src}">, OpSize32;
+ def NAME#64i32 : BinOpAI_AF<BaseOpc4, mnemonic, Xi64, RAX,
+ "{$src, %rax|rax, $src}">;
}
/// ArithBinOp_RFF - This is an arithmetic binary operator where the pattern is
@@ -874,80 +719,73 @@ multiclass ArithBinOp_RFF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
string mnemonic, Format RegMRM, Format MemMRM,
SDNode opnode, bit CommutableRR,
bit ConvertibleToThreeAddress> {
- let Uses = [EFLAGS], Defs = [EFLAGS] in {
- let Constraints = "$src1 = $dst" in {
- let isCommutable = CommutableRR in {
- def NAME#8rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi8 , opnode>;
- let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
- def NAME#16rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi16, opnode>;
- def NAME#32rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi32, opnode>;
- def NAME#64rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi64, opnode>;
- } // isConvertibleToThreeAddress
- } // isCommutable
-
- def NAME#8rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi8>;
- def NAME#16rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi16>;
- def NAME#32rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi32>;
- def NAME#64rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi64>;
-
- def NAME#8rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi8 , opnode>;
- def NAME#16rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi16, opnode>;
- def NAME#32rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi32, opnode>;
- def NAME#64rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi64, opnode>;
-
- def NAME#8ri : BinOpRI_RFF<0x80, mnemonic, Xi8 , opnode, RegMRM>;
-
- let isConvertibleToThreeAddress = ConvertibleToThreeAddress, hasSideEffects = 0 in {
- // NOTE: These are order specific, we want the ri8 forms to be listed
- // first so that they are slightly preferred to the ri forms.
- def NAME#16ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi16, RegMRM>;
- def NAME#32ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi32, RegMRM>;
- def NAME#64ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi64, RegMRM>;
-
- def NAME#16ri : BinOpRI_RFF<0x80, mnemonic, Xi16, opnode, RegMRM>;
- def NAME#32ri : BinOpRI_RFF<0x80, mnemonic, Xi32, opnode, RegMRM>;
- def NAME#64ri32: BinOpRI_RFF<0x80, mnemonic, Xi64, opnode, RegMRM>;
- }
- } // Constraints = "$src1 = $dst"
-
- def NAME#8mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi8 , opnode>;
- def NAME#16mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi16, opnode>;
- def NAME#32mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi32, opnode>;
- def NAME#64mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi64, opnode>;
-
- // NOTE: These are order specific, we want the mi8 forms to be listed
- // first so that they are slightly preferred to the mi forms.
- let mayLoad = 1, mayStore = 1, hasSideEffects = 0 in {
- def NAME#16mi8 : BinOpMI8_RMW_FF<mnemonic, Xi16, MemMRM>;
- def NAME#32mi8 : BinOpMI8_RMW_FF<mnemonic, Xi32, MemMRM>;
- let Predicates = [In64BitMode] in
- def NAME#64mi8 : BinOpMI8_RMW_FF<mnemonic, Xi64, MemMRM>;
-
- def NAME#8mi : BinOpMI_RMW_FF<0x80, mnemonic, Xi8 , opnode, MemMRM>;
- def NAME#16mi : BinOpMI_RMW_FF<0x80, mnemonic, Xi16, opnode, MemMRM>;
- def NAME#32mi : BinOpMI_RMW_FF<0x80, mnemonic, Xi32, opnode, MemMRM>;
- let Predicates = [In64BitMode] in
- def NAME#64mi32 : BinOpMI_RMW_FF<0x80, mnemonic, Xi64, opnode, MemMRM>;
- }
-
- // These are for the disassembler since 0x82 opcode behaves like 0x80, but
- // not in 64-bit mode.
- let Predicates = [Not64BitMode], isCodeGenOnly = 1, ForceDisassemble = 1,
- hasSideEffects = 0 in {
- let Constraints = "$src1 = $dst" in
- def NAME#8ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi8, RegMRM>;
- let mayLoad = 1, mayStore = 1 in
- def NAME#8mi8 : BinOpMI8_RMW_FF<mnemonic, Xi8, MemMRM>;
+ let Constraints = "$src1 = $dst" in {
+ let isCommutable = CommutableRR in {
+ def NAME#8rr : BinOpRRF_RF<BaseOpc, mnemonic, Xi8 , opnode>;
+ let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
+ def NAME#16rr : BinOpRRF_RF<BaseOpc, mnemonic, Xi16, opnode>, OpSize16;
+ def NAME#32rr : BinOpRRF_RF<BaseOpc, mnemonic, Xi32, opnode>, OpSize32;
+ def NAME#64rr : BinOpRRF_RF<BaseOpc, mnemonic, Xi64, opnode>;
+ } // isConvertibleToThreeAddress
+ } // isCommutable
+
+ def NAME#8rr_REV : BinOpRRF_RF_Rev<BaseOpc2, mnemonic, Xi8>;
+ def NAME#16rr_REV : BinOpRRF_RF_Rev<BaseOpc2, mnemonic, Xi16>, OpSize16;
+ def NAME#32rr_REV : BinOpRRF_RF_Rev<BaseOpc2, mnemonic, Xi32>, OpSize32;
+ def NAME#64rr_REV : BinOpRRF_RF_Rev<BaseOpc2, mnemonic, Xi64>;
+
+ def NAME#8rm : BinOpRMF_RF<BaseOpc2, mnemonic, Xi8 , opnode>;
+ def NAME#16rm : BinOpRMF_RF<BaseOpc2, mnemonic, Xi16, opnode>, OpSize16;
+ def NAME#32rm : BinOpRMF_RF<BaseOpc2, mnemonic, Xi32, opnode>, OpSize32;
+ def NAME#64rm : BinOpRMF_RF<BaseOpc2, mnemonic, Xi64, opnode>;
+
+ def NAME#8ri : BinOpRIF_RF<0x80, mnemonic, Xi8 , opnode, RegMRM>;
+ let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
+ // NOTE: These are order specific, we want the ri8 forms to be listed
+ // first so that they are slightly preferred to the ri forms.
+ def NAME#16ri8 : BinOpRI8F_RF<0x83, mnemonic, Xi16, RegMRM>, OpSize16;
+ def NAME#32ri8 : BinOpRI8F_RF<0x83, mnemonic, Xi32, RegMRM>, OpSize32;
+ def NAME#64ri8 : BinOpRI8F_RF<0x83, mnemonic, Xi64, RegMRM>;
+
+ def NAME#16ri : BinOpRIF_RF<0x81, mnemonic, Xi16, opnode, RegMRM>, OpSize16;
+ def NAME#32ri : BinOpRIF_RF<0x81, mnemonic, Xi32, opnode, RegMRM>, OpSize32;
+ def NAME#64ri32: BinOpRIF_RF<0x81, mnemonic, Xi64, opnode, RegMRM>;
}
- } // Uses = [EFLAGS], Defs = [EFLAGS]
-
- def NAME#8i8 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi8 , AL,
- "{$src, %al|al, $src}">;
- def NAME#16i16 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi16, AX,
- "{$src, %ax|ax, $src}">;
- def NAME#32i32 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi32, EAX,
- "{$src, %eax|eax, $src}">;
- def NAME#64i32 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi64, RAX,
+ } // Constraints = "$src1 = $dst"
+
+ def NAME#8mr : BinOpMRF_MF<BaseOpc, mnemonic, Xi8 , opnode>;
+ def NAME#16mr : BinOpMRF_MF<BaseOpc, mnemonic, Xi16, opnode>, OpSize16;
+ def NAME#32mr : BinOpMRF_MF<BaseOpc, mnemonic, Xi32, opnode>, OpSize32;
+ def NAME#64mr : BinOpMRF_MF<BaseOpc, mnemonic, Xi64, opnode>;
+
+ // NOTE: These are order specific, we want the mi8 forms to be listed
+ // first so that they are slightly preferred to the mi forms.
+ def NAME#16mi8 : BinOpMI8F_MF<mnemonic, Xi16, MemMRM>, OpSize16;
+ def NAME#32mi8 : BinOpMI8F_MF<mnemonic, Xi32, MemMRM>, OpSize32;
+ let Predicates = [In64BitMode] in
+ def NAME#64mi8 : BinOpMI8F_MF<mnemonic, Xi64, MemMRM>;
+
+ def NAME#8mi : BinOpMIF_MF<0x80, mnemonic, Xi8 , opnode, MemMRM>;
+ def NAME#16mi : BinOpMIF_MF<0x81, mnemonic, Xi16, opnode, MemMRM>, OpSize16;
+ def NAME#32mi : BinOpMIF_MF<0x81, mnemonic, Xi32, opnode, MemMRM>, OpSize32;
+ let Predicates = [In64BitMode] in
+ def NAME#64mi32 : BinOpMIF_MF<0x81, mnemonic, Xi64, opnode, MemMRM>;
+
+ // These are for the disassembler since 0x82 opcode behaves like 0x80, but
+ // not in 64-bit mode.
+ let Predicates = [Not64BitMode] in {
+ let Constraints = "$src1 = $dst" in
+ def NAME#8ri8 : BinOpRI8F_RF<0x82, mnemonic, Xi8, RegMRM>, DisassembleOnly;
+ def NAME#8mi8 : BinOpMI8F_MF<mnemonic, Xi8, MemMRM>, DisassembleOnly;
+ }
+
+ def NAME#8i8 : BinOpAIF_AF<BaseOpc4, mnemonic, Xi8 , AL,
+ "{$src, %al|al, $src}">;
+ def NAME#16i16 : BinOpAIF_AF<BaseOpc4, mnemonic, Xi16, AX,
+ "{$src, %ax|ax, $src}">, OpSize16;
+ def NAME#32i32 : BinOpAIF_AF<BaseOpc4, mnemonic, Xi32, EAX,
+ "{$src, %eax|eax, $src}">, OpSize32;
+ def NAME#64i32 : BinOpAIF_AF<BaseOpc4, mnemonic, Xi64, RAX,
"{$src, %rax|rax, $src}">;
}
@@ -957,93 +795,88 @@ multiclass ArithBinOp_RFF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
///
multiclass ArithBinOp_F<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
string mnemonic, Format RegMRM, Format MemMRM,
- SDNode opnode,
- bit CommutableRR, bit ConvertibleToThreeAddress> {
- let Defs = [EFLAGS] in {
- let isCommutable = CommutableRR in {
- def NAME#8rr : BinOpRR_F<BaseOpc, mnemonic, Xi8 , opnode>;
- let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
- def NAME#16rr : BinOpRR_F<BaseOpc, mnemonic, Xi16, opnode>;
- def NAME#32rr : BinOpRR_F<BaseOpc, mnemonic, Xi32, opnode>;
- def NAME#64rr : BinOpRR_F<BaseOpc, mnemonic, Xi64, opnode>;
- }
- } // isCommutable
-
- def NAME#8rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi8>;
- def NAME#16rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi16>;
- def NAME#32rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi32>;
- def NAME#64rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi64>;
-
- def NAME#8rm : BinOpRM_F<BaseOpc2, mnemonic, Xi8 , opnode>;
- def NAME#16rm : BinOpRM_F<BaseOpc2, mnemonic, Xi16, opnode>;
- def NAME#32rm : BinOpRM_F<BaseOpc2, mnemonic, Xi32, opnode>;
- def NAME#64rm : BinOpRM_F<BaseOpc2, mnemonic, Xi64, opnode>;
-
- def NAME#8ri : BinOpRI_F<0x80, mnemonic, Xi8 , opnode, RegMRM>;
-
- let isConvertibleToThreeAddress = ConvertibleToThreeAddress, hasSideEffects = 0 in {
- // NOTE: These are order specific, we want the ri8 forms to be listed
- // first so that they are slightly preferred to the ri forms.
- def NAME#16ri8 : BinOpRI8_F<0x82, mnemonic, Xi16, RegMRM>;
- def NAME#32ri8 : BinOpRI8_F<0x82, mnemonic, Xi32, RegMRM>;
- def NAME#64ri8 : BinOpRI8_F<0x82, mnemonic, Xi64, RegMRM>;
-
- def NAME#16ri : BinOpRI_F<0x80, mnemonic, Xi16, opnode, RegMRM>;
- def NAME#32ri : BinOpRI_F<0x80, mnemonic, Xi32, opnode, RegMRM>;
- def NAME#64ri32: BinOpRI_F<0x80, mnemonic, Xi64, opnode, RegMRM>;
- }
-
- def NAME#8mr : BinOpMR_F<BaseOpc, mnemonic, Xi8 , opnode>;
- def NAME#16mr : BinOpMR_F<BaseOpc, mnemonic, Xi16, opnode>;
- def NAME#32mr : BinOpMR_F<BaseOpc, mnemonic, Xi32, opnode>;
- def NAME#64mr : BinOpMR_F<BaseOpc, mnemonic, Xi64, opnode>;
-
- // NOTE: These are order specific, we want the mi8 forms to be listed
- // first so that they are slightly preferred to the mi forms.
- let mayLoad = 1, hasSideEffects = 0 in {
- def NAME#16mi8 : BinOpMI8_F<mnemonic, Xi16, MemMRM>;
- def NAME#32mi8 : BinOpMI8_F<mnemonic, Xi32, MemMRM>;
- let Predicates = [In64BitMode] in
- def NAME#64mi8 : BinOpMI8_F<mnemonic, Xi64, MemMRM>;
-
- def NAME#8mi : BinOpMI_F<0x80, mnemonic, Xi8 , opnode, MemMRM>;
- def NAME#16mi : BinOpMI_F<0x80, mnemonic, Xi16, opnode, MemMRM>;
- def NAME#32mi : BinOpMI_F<0x80, mnemonic, Xi32, opnode, MemMRM>;
- let Predicates = [In64BitMode] in
- def NAME#64mi32 : BinOpMI_F<0x80, mnemonic, Xi64, opnode, MemMRM>;
- }
-
- // These are for the disassembler since 0x82 opcode behaves like 0x80, but
- // not in 64-bit mode.
- let Predicates = [Not64BitMode], isCodeGenOnly = 1, ForceDisassemble = 1,
- hasSideEffects = 0 in {
- def NAME#8ri8 : BinOpRI8_F<0x82, mnemonic, Xi8, RegMRM>;
- let mayLoad = 1 in
- def NAME#8mi8 : BinOpMI8_F<mnemonic, Xi8, MemMRM>;
- }
- } // Defs = [EFLAGS]
-
- def NAME#8i8 : BinOpAI_F<BaseOpc4, mnemonic, Xi8 , AL,
- "{$src, %al|al, $src}">;
+ SDNode opnode, bit CommutableRR,
+ bit ConvertibleToThreeAddress> {
+ let isCommutable = CommutableRR in {
+ def NAME#8rr : BinOpRR_F<BaseOpc, mnemonic, Xi8 , opnode>;
+ let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
+ def NAME#16rr : BinOpRR_F<BaseOpc, mnemonic, Xi16, opnode>, OpSize16;
+ def NAME#32rr : BinOpRR_F<BaseOpc, mnemonic, Xi32, opnode>, OpSize32;
+ def NAME#64rr : BinOpRR_F<BaseOpc, mnemonic, Xi64, opnode>;
+ } // isConvertibleToThreeAddress
+ } // isCommutable
+
+ def NAME#8rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi8>;
+ def NAME#16rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi16>, OpSize16;
+ def NAME#32rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi32>, OpSize32;
+ def NAME#64rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi64>;
+
+ def NAME#8rm : BinOpRM_F<BaseOpc2, mnemonic, Xi8 , opnode>;
+ def NAME#16rm : BinOpRM_F<BaseOpc2, mnemonic, Xi16, opnode>, OpSize16;
+ def NAME#32rm : BinOpRM_F<BaseOpc2, mnemonic, Xi32, opnode>, OpSize32;
+ def NAME#64rm : BinOpRM_F<BaseOpc2, mnemonic, Xi64, opnode>;
+
+ def NAME#8ri : BinOpRI_F<0x80, mnemonic, Xi8 , opnode, RegMRM>;
+
+ let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
+ // NOTE: These are order specific, we want the ri8 forms to be listed
+ // first so that they are slightly preferred to the ri forms.
+ def NAME#16ri8 : BinOpRI8_F<0x83, mnemonic, Xi16, RegMRM>, OpSize16;
+ def NAME#32ri8 : BinOpRI8_F<0x83, mnemonic, Xi32, RegMRM>, OpSize32;
+ def NAME#64ri8 : BinOpRI8_F<0x83, mnemonic, Xi64, RegMRM>;
+
+ def NAME#16ri : BinOpRI_F<0x81, mnemonic, Xi16, opnode, RegMRM>, OpSize16;
+ def NAME#32ri : BinOpRI_F<0x81, mnemonic, Xi32, opnode, RegMRM>, OpSize32;
+ def NAME#64ri32: BinOpRI_F<0x81, mnemonic, Xi64, opnode, RegMRM>;
+ }
+
+ def NAME#8mr : BinOpMR_F<BaseOpc, mnemonic, Xi8 , opnode>;
+ def NAME#16mr : BinOpMR_F<BaseOpc, mnemonic, Xi16, opnode>, OpSize16;
+ def NAME#32mr : BinOpMR_F<BaseOpc, mnemonic, Xi32, opnode>, OpSize32;
+ def NAME#64mr : BinOpMR_F<BaseOpc, mnemonic, Xi64, opnode>;
+
+ // NOTE: These are order specific, we want the mi8 forms to be listed
+ // first so that they are slightly preferred to the mi forms.
+ def NAME#16mi8 : BinOpMI8_F<mnemonic, Xi16, MemMRM>, OpSize16;
+ def NAME#32mi8 : BinOpMI8_F<mnemonic, Xi32, MemMRM>, OpSize32;
+ let Predicates = [In64BitMode] in
+ def NAME#64mi8 : BinOpMI8_F<mnemonic, Xi64, MemMRM>;
+
+ def NAME#8mi : BinOpMI_F<0x80, mnemonic, Xi8 , opnode, MemMRM>;
+ def NAME#16mi : BinOpMI_F<0x81, mnemonic, Xi16, opnode, MemMRM>, OpSize16;
+ def NAME#32mi : BinOpMI_F<0x81, mnemonic, Xi32, opnode, MemMRM>, OpSize32;
+ let Predicates = [In64BitMode] in
+ def NAME#64mi32 : BinOpMI_F<0x81, mnemonic, Xi64, opnode, MemMRM>;
+
+ // These are for the disassembler since 0x82 opcode behaves like 0x80, but
+ // not in 64-bit mode.
+ let Predicates = [Not64BitMode] in {
+ def NAME#8ri8 : BinOpRI8_F<0x82, mnemonic, Xi8, RegMRM>, DisassembleOnly;
+ let mayLoad = 1 in
+ def NAME#8mi8 : BinOpMI8_F<mnemonic, Xi8, MemMRM>;
+ }
+
+ def NAME#8i8 : BinOpAI_F<BaseOpc4, mnemonic, Xi8 , AL,
+ "{$src, %al|al, $src}">;
def NAME#16i16 : BinOpAI_F<BaseOpc4, mnemonic, Xi16, AX,
- "{$src, %ax|ax, $src}">;
+ "{$src, %ax|ax, $src}">, OpSize16;
def NAME#32i32 : BinOpAI_F<BaseOpc4, mnemonic, Xi32, EAX,
- "{$src, %eax|eax, $src}">;
+ "{$src, %eax|eax, $src}">, OpSize32;
def NAME#64i32 : BinOpAI_F<BaseOpc4, mnemonic, Xi64, RAX,
- "{$src, %rax|rax, $src}">;
+ "{$src, %rax|rax, $src}">;
}
-defm AND : ArithBinOp_RF<0x20, 0x22, 0x24, "and", MRM4r, MRM4m,
+defm AND : ArithBinOp_RF<0x21, 0x23, 0x25, "and", MRM4r, MRM4m,
X86and_flag, and, 1, 0, 0>;
-defm OR : ArithBinOp_RF<0x08, 0x0A, 0x0C, "or", MRM1r, MRM1m,
+defm OR : ArithBinOp_RF<0x09, 0x0B, 0x0D, "or", MRM1r, MRM1m,
X86or_flag, or, 1, 0, 0>;
-defm XOR : ArithBinOp_RF<0x30, 0x32, 0x34, "xor", MRM6r, MRM6m,
+defm XOR : ArithBinOp_RF<0x31, 0x33, 0x35, "xor", MRM6r, MRM6m,
X86xor_flag, xor, 1, 0, 0>;
-defm ADD : ArithBinOp_RF<0x00, 0x02, 0x04, "add", MRM0r, MRM0m,
+defm ADD : ArithBinOp_RF<0x01, 0x03, 0x05, "add", MRM0r, MRM0m,
X86add_flag, add, 1, 1, 1>;
let isCompare = 1 in {
-defm SUB : ArithBinOp_RF<0x28, 0x2A, 0x2C, "sub", MRM5r, MRM5m,
+defm SUB : ArithBinOp_RF<0x29, 0x2B, 0x2D, "sub", MRM5r, MRM5m,
X86sub_flag, sub, 0, 1, 0>;
}
@@ -1057,13 +890,13 @@ def XOR8rr_NOREX : I<0x30, MRMDestReg, (outs GR8_NOREX:$dst),
Sched<[WriteALU]>;
// Arithmetic.
-defm ADC : ArithBinOp_RFF<0x10, 0x12, 0x14, "adc", MRM2r, MRM2m, X86adc_flag,
+defm ADC : ArithBinOp_RFF<0x11, 0x13, 0x15, "adc", MRM2r, MRM2m, X86adc_flag,
1, 0>;
-defm SBB : ArithBinOp_RFF<0x18, 0x1A, 0x1C, "sbb", MRM3r, MRM3m, X86sbb_flag,
+defm SBB : ArithBinOp_RFF<0x19, 0x1B, 0x1D, "sbb", MRM3r, MRM3m, X86sbb_flag,
0, 0>;
let isCompare = 1 in {
-defm CMP : ArithBinOp_F<0x38, 0x3A, 0x3C, "cmp", MRM7r, MRM7m, X86cmp, 0, 0>;
+defm CMP : ArithBinOp_F<0x39, 0x3B, 0x3D, "cmp", MRM7r, MRM7m, X86cmp, 0, 0>;
}
// Patterns to recognize loads on the LHS of an ADC. We can't make X86adc_flag
@@ -1201,44 +1034,37 @@ def : Pat<(store (X86adc_flag i64relocImmSExt32_su:$src, (load addr:$dst), EFLAG
// they don't have all the usual imm8 and REV forms, and are encoded into a
// different space.
let isCompare = 1 in {
- let Defs = [EFLAGS] in {
- let isCommutable = 1 in {
- // Avoid selecting these and instead use a test+and. Post processing will
- // combine them. This gives bunch of other patterns that start with
- // and a chance to match.
- def TEST8rr : BinOpRR_F<0x84, "test", Xi8 , null_frag>;
- def TEST16rr : BinOpRR_F<0x84, "test", Xi16, null_frag>;
- def TEST32rr : BinOpRR_F<0x84, "test", Xi32, null_frag>;
- def TEST64rr : BinOpRR_F<0x84, "test", Xi64, null_frag>;
- } // isCommutable
-
- let hasSideEffects = 0, mayLoad = 1 in {
- def TEST8mr : BinOpMR_F<0x84, "test", Xi8 , null_frag>;
- def TEST16mr : BinOpMR_F<0x84, "test", Xi16, null_frag>;
- def TEST32mr : BinOpMR_F<0x84, "test", Xi32, null_frag>;
- def TEST64mr : BinOpMR_F<0x84, "test", Xi64, null_frag>;
- }
-
- def TEST8ri : BinOpRI_F<0xF6, "test", Xi8 , X86testpat, MRM0r>;
- def TEST16ri : BinOpRI_F<0xF6, "test", Xi16, X86testpat, MRM0r>;
- def TEST32ri : BinOpRI_F<0xF6, "test", Xi32, X86testpat, MRM0r>;
- def TEST64ri32 : BinOpRI_F<0xF6, "test", Xi64, X86testpat, MRM0r>;
-
- def TEST8mi : BinOpMI_F<0xF6, "test", Xi8 , X86testpat, MRM0m>;
- def TEST16mi : BinOpMI_F<0xF6, "test", Xi16, X86testpat, MRM0m>;
- def TEST32mi : BinOpMI_F<0xF6, "test", Xi32, X86testpat, MRM0m>;
- let Predicates = [In64BitMode] in
- def TEST64mi32 : BinOpMI_F<0xF6, "test", Xi64, X86testpat, MRM0m>;
- } // Defs = [EFLAGS]
-
- def TEST8i8 : BinOpAI_F<0xA8, "test", Xi8 , AL,
- "{$src, %al|al, $src}">;
- def TEST16i16 : BinOpAI_F<0xA8, "test", Xi16, AX,
- "{$src, %ax|ax, $src}">;
- def TEST32i32 : BinOpAI_F<0xA8, "test", Xi32, EAX,
- "{$src, %eax|eax, $src}">;
- def TEST64i32 : BinOpAI_F<0xA8, "test", Xi64, RAX,
- "{$src, %rax|rax, $src}">;
+ let isCommutable = 1 in {
+ // Avoid selecting these and instead use a test+and. Post processing will
+ // combine them. This gives bunch of other patterns that start with
+ // and a chance to match.
+ def TEST8rr : BinOpRR_F<0x84, "test", Xi8 , null_frag>;
+ def TEST16rr : BinOpRR_F<0x85, "test", Xi16, null_frag>, OpSize16;
+ def TEST32rr : BinOpRR_F<0x85, "test", Xi32, null_frag>, OpSize32;
+ def TEST64rr : BinOpRR_F<0x85, "test", Xi64, null_frag>;
+ } // isCommutable
+
+def TEST8mr : BinOpMR_F<0x84, "test", Xi8 , null_frag>;
+def TEST16mr : BinOpMR_F<0x85, "test", Xi16, null_frag>, OpSize16;
+def TEST32mr : BinOpMR_F<0x85, "test", Xi32, null_frag>, OpSize32;
+def TEST64mr : BinOpMR_F<0x85, "test", Xi64, null_frag>;
+
+def TEST8ri : BinOpRI_F<0xF6, "test", Xi8 , X86testpat, MRM0r>;
+def TEST16ri : BinOpRI_F<0xF7, "test", Xi16, X86testpat, MRM0r>, OpSize16;
+def TEST32ri : BinOpRI_F<0xF7, "test", Xi32, X86testpat, MRM0r>, OpSize32;
+def TEST64ri32 : BinOpRI_F<0xF7, "test", Xi64, X86testpat, MRM0r>;
+
+def TEST8mi : BinOpMI_F<0xF6, "test", Xi8 , X86testpat, MRM0m>;
+def TEST16mi : BinOpMI_F<0xF7, "test", Xi16, X86testpat, MRM0m>, OpSize16;
+def TEST32mi : BinOpMI_F<0xF7, "test", Xi32, X86testpat, MRM0m>, OpSize32;
+
+ let Predicates = [In64BitMode] in
+ def TEST64mi32 : BinOpMI_F<0xF7, "test", Xi64, X86testpat, MRM0m>;
+
+def TEST8i8 : BinOpAI_F<0xA8, "test", Xi8 , AL, "{$src, %al|al, $src}">;
+def TEST16i16 : BinOpAI_F<0xA9, "test", Xi16, AX, "{$src, %ax|ax, $src}">, OpSize16;
+def TEST32i32 : BinOpAI_F<0xA9, "test", Xi32, EAX, "{$src, %eax|eax, $src}">, OpSize32;
+def TEST64i32 : BinOpAI_F<0xA9, "test", Xi64, RAX, "{$src, %rax|rax, $src}">;
} // isCompare
// Patterns to match a relocImm into the immediate field.
@@ -1269,30 +1095,30 @@ let Predicates = [HasBMI, NoEGPR] in {
def rr : I<0xF2, MRMSrcReg, (outs RC:$dst), (ins RC:$src1, RC:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, EFLAGS, (X86and_flag (not RC:$src1), RC:$src2))]>,
- VEX_4V, Sched<[sched]>;
+ VEX, VVVV, Sched<[sched]>;
def rm : I<0xF2, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, EFLAGS,
(X86and_flag (not RC:$src1), (ld_frag addr:$src2)))]>,
- VEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ VEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
let Predicates = [HasBMI, HasEGPR, In64BitMode] in {
def rr_EVEX : I<0xF2, MRMSrcReg, (outs RC:$dst), (ins RC:$src1, RC:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, EFLAGS, (X86and_flag (not RC:$src1), RC:$src2))]>,
- EVEX_4V, Sched<[sched]>;
+ EVEX, VVVV, Sched<[sched]>;
def rm_EVEX : I<0xF2, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, EFLAGS,
(X86and_flag (not RC:$src1), (ld_frag addr:$src2)))]>,
- EVEX_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ EVEX, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
}
// Complexity is reduced to give and with immediate a chance to match first.
let Defs = [EFLAGS], AddedComplexity = -6 in {
- defm ANDN32 : bmi_andn<"andn{l}", GR32, i32mem, loadi32, WriteALU>, T8PS;
- defm ANDN64 : bmi_andn<"andn{q}", GR64, i64mem, loadi64, WriteALU>, T8PS, REX_W;
+ defm ANDN32 : bmi_andn<"andn{l}", GR32, i32mem, loadi32, WriteALU>, T8;
+ defm ANDN64 : bmi_andn<"andn{q}", GR64, i64mem, loadi64, WriteALU>, T8, REX_W;
}
let Predicates = [HasBMI], AddedComplexity = -6 in {
@@ -1315,12 +1141,12 @@ let hasSideEffects = 0 in {
let Predicates = [HasBMI2, NoEGPR] in {
def rr : I<0xF6, MRMSrcReg, (outs RC:$dst1, RC:$dst2), (ins RC:$src),
!strconcat(mnemonic, "\t{$src, $dst2, $dst1|$dst1, $dst2, $src}"),
- []>, T8XD, VEX_4V, Sched<[WriteIMulH, sched]>;
+ []>, T8, XD, VEX, VVVV, Sched<[WriteIMulH, sched]>;
let mayLoad = 1 in
def rm : I<0xF6, MRMSrcMem, (outs RC:$dst1, RC:$dst2), (ins x86memop:$src),
!strconcat(mnemonic, "\t{$src, $dst2, $dst1|$dst1, $dst2, $src}"),
- []>, T8XD, VEX_4V,
+ []>, T8, XD, VEX, VVVV,
Sched<[WriteIMulHLd, sched.Folded,
// Memory operand.
ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault,
@@ -1339,11 +1165,11 @@ let Predicates = [HasBMI2, NoEGPR] in {
let Predicates = [HasBMI2, HasEGPR, In64BitMode] in
def rr#_EVEX : I<0xF6, MRMSrcReg, (outs RC:$dst1, RC:$dst2), (ins RC:$src),
!strconcat(mnemonic, "\t{$src, $dst2, $dst1|$dst1, $dst2, $src}"),
- []>, T8XD, EVEX_4V, Sched<[WriteIMulH, sched]>;
+ []>, T8, XD, EVEX, VVVV, Sched<[WriteIMulH, sched]>;
let Predicates = [HasBMI2, HasEGPR, In64BitMode], mayLoad = 1 in
def rm#_EVEX : I<0xF6, MRMSrcMem, (outs RC:$dst1, RC:$dst2), (ins x86memop:$src),
!strconcat(mnemonic, "\t{$src, $dst2, $dst1|$dst1, $dst2, $src}"),
- []>, T8XD, EVEX_4V,
+ []>, T8, XD, EVEX, VVVV,
Sched<[WriteIMulHLd, sched.Folded,
// Memory operand.
ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault,
@@ -1362,38 +1188,25 @@ let Uses = [RDX] in
//
// We don't have patterns for these as there is no advantage over ADC for
// most code.
-class ADCOXOpRR <bits<8> opcode, string mnemonic, X86TypeInfo info>
- : BinOpRR_C<opcode, MRMSrcReg, mnemonic, info, []>{
- let Opcode = opcode;
- let OpSize = OpSizeFixed;
+class ADCOXOpRR <string m, X86TypeInfo t>
+ : BinOpRRF_RF<0xF6, m, t, null_frag> {
+ let Form = MRMSrcReg;
+ let isCommutable = 1;
}
-class ADCOXOpRM <bits<8> opcode, string mnemonic, X86TypeInfo info>
- : BinOpRM_C<opcode, MRMSrcMem, mnemonic, info, []>{
- let Opcode = opcode;
- let OpSize = OpSizeFixed;
+class ADCOXOpRM <string m, X86TypeInfo t>
+ : BinOpRMF_RF<0xF6, m, t, null_frag> {
+ let Form = MRMSrcMem;
}
-let Predicates = [HasADX], Defs = [EFLAGS], Uses = [EFLAGS],
- Constraints = "$src1 = $dst", hasSideEffects = 0 in {
- let SchedRW = [WriteADC], isCommutable = 1 in {
- def ADCX32rr : ADCOXOpRR<0xF6, "adcx", Xi32>, T8PD;
- def ADCX64rr : ADCOXOpRR<0xF6, "adcx", Xi64>, T8PD;
-
- def ADOX32rr : ADCOXOpRR<0xF6, "adox", Xi32>, T8XS;
- def ADOX64rr : ADCOXOpRR<0xF6, "adox", Xi64>, T8XS;
- } // SchedRW
-
- let mayLoad = 1,
- SchedRW = [WriteADC.Folded, WriteADC.ReadAfterFold,
- // Memory operand.
- ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault,
- // Implicit read of EFLAGS
- WriteADC.ReadAfterFold] in {
- def ADCX32rm : ADCOXOpRM<0xF6, "adcx", Xi32>, T8PD;
- def ADCX64rm : ADCOXOpRM<0xF6, "adcx", Xi64>, T8PD;
-
- def ADOX32rm : ADCOXOpRM<0xF6, "adox", Xi32>, T8XS;
- def ADOX64rm : ADCOXOpRM<0xF6, "adox", Xi64>, T8XS;
- } // mayLoad, SchedRW
+let OpSize = OpSizeFixed, Constraints = "$src1 = $dst",
+ Predicates = [HasADX] in {
+def ADCX32rr : ADCOXOpRR<"adcx", Xi32>, T8, PD;
+def ADCX64rr : ADCOXOpRR<"adcx", Xi64>, T8, PD;
+def ADOX32rr : ADCOXOpRR<"adox", Xi32>, T8, XS;
+def ADOX64rr : ADCOXOpRR<"adox", Xi64>, T8, XS;
+def ADCX32rm : ADCOXOpRM<"adcx", Xi32>, T8, PD;
+def ADCX64rm : ADCOXOpRM<"adcx", Xi64>, T8, PD;
+def ADOX32rm : ADCOXOpRM<"adox", Xi32>, T8, XS;
+def ADOX64rm : ADCOXOpRM<"adox", Xi64>, T8, XS;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAsmAlias.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAsmAlias.td
index 9d0735c9cbba..2590be8651d5 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAsmAlias.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAsmAlias.td
@@ -55,6 +55,11 @@ multiclass CMPCCXADD_Aliases<string Cond, int CC> {
(CMPCCXADDmr32 GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
(CMPCCXADDmr64 GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
+
+ def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ (CMPCCXADDmr32_EVEX GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
+ def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ (CMPCCXADDmr64_EVEX GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
}
//===----------------------------------------------------------------------===//
@@ -686,3 +691,11 @@ def : InstAlias<"vmsave\t{%rax|rax}", (VMSAVE64), 0>, Requires<[In64BitMode]>;
def : InstAlias<"invlpga\t{%eax, %ecx|eax, ecx}", (INVLPGA32), 0>, Requires<[Not64BitMode]>;
def : InstAlias<"invlpga\t{%rax, %ecx|rax, ecx}", (INVLPGA64), 0>, Requires<[In64BitMode]>;
+// Aliases with explicit %xmm0
+def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
+ (SHA256RNDS2rr VR128:$dst, VR128:$src2), 0>;
+def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
+ (SHA256RNDS2rm VR128:$dst, i128mem:$src2), 0>;
+
+def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
+ (SHA256RNDS2rm_EVEX VR128:$dst, i128mem:$src2), 0>;
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrCompiler.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrCompiler.td
index 457833f8cc33..c77c77ee4a3e 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrCompiler.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrCompiler.td
@@ -1515,6 +1515,23 @@ def : Pat<(X86add_flag_nocf GR32:$src1, 128),
def : Pat<(X86add_flag_nocf GR64:$src1, 128),
(SUB64ri32 GR64:$src1, -128)>;
+// Depositing value to 8/16 bit subreg:
+def : Pat<(or (and GR64:$dst, -256),
+ (i64 (zextloadi8 addr:$src))),
+ (INSERT_SUBREG (i64 (COPY $dst)), (MOV8rm i8mem:$src), sub_8bit)>;
+
+def : Pat<(or (and GR32:$dst, -256),
+ (i32 (zextloadi8 addr:$src))),
+ (INSERT_SUBREG (i32 (COPY $dst)), (MOV8rm i8mem:$src), sub_8bit)>;
+
+def : Pat<(or (and GR64:$dst, -65536),
+ (i64 (zextloadi16 addr:$src))),
+ (INSERT_SUBREG (i64 (COPY $dst)), (MOV16rm i16mem:$src), sub_16bit)>;
+
+def : Pat<(or (and GR32:$dst, -65536),
+ (i32 (zextloadi16 addr:$src))),
+ (INSERT_SUBREG (i32 (COPY $dst)), (MOV16rm i16mem:$src), sub_16bit)>;
+
// The same trick applies for 32-bit immediate fields in 64-bit
// instructions.
def : Pat<(add GR64:$src1, 0x0000000080000000),
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFPStack.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFPStack.td
index 09655d939121..6a9a74ce15f2 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFPStack.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFPStack.td
@@ -666,20 +666,20 @@ def FCOMPP : I<0xDE, MRM_D9, (outs), (ins), "fcompp", []>;
let Uses = [FPSW, FPCW] in {
def FXSAVE : I<0xAE, MRM0m, (outs), (ins opaquemem:$dst),
- "fxsave\t$dst", [(int_x86_fxsave addr:$dst)]>, PS,
+ "fxsave\t$dst", [(int_x86_fxsave addr:$dst)]>, TB,
Requires<[HasFXSR]>;
def FXSAVE64 : RI<0xAE, MRM0m, (outs), (ins opaquemem:$dst),
"fxsave64\t$dst", [(int_x86_fxsave64 addr:$dst)]>,
- PS, Requires<[HasFXSR, In64BitMode]>;
+ TB, Requires<[HasFXSR, In64BitMode]>;
} // Uses = [FPSW, FPCW]
let Defs = [FPSW, FPCW] in {
def FXRSTOR : I<0xAE, MRM1m, (outs), (ins opaquemem:$src),
"fxrstor\t$src", [(int_x86_fxrstor addr:$src)]>,
- PS, Requires<[HasFXSR]>;
+ TB, Requires<[HasFXSR]>;
def FXRSTOR64 : RI<0xAE, MRM1m, (outs), (ins opaquemem:$src),
"fxrstor64\t$src", [(int_x86_fxrstor64 addr:$src)]>,
- PS, Requires<[HasFXSR, In64BitMode]>;
+ TB, Requires<[HasFXSR, In64BitMode]>;
} // Defs = [FPSW, FPCW]
} // SchedRW
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFormats.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFormats.td
index df05a5788a50..07e5576960d6 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFormats.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFormats.td
@@ -180,7 +180,7 @@ class OperandSize<bits<2> val> {
bits<2> Value = val;
}
def OpSizeFixed : OperandSize<0>; // Never needs a 0x66 prefix.
-def OpSize16 : OperandSize<1>; // Needs 0x66 prefix in 32-bit mode.
+def OpSize16 : OperandSize<1>; // Needs 0x66 prefix in 32/64-bit mode.
def OpSize32 : OperandSize<2>; // Needs 0x66 prefix in 16-bit mode.
// Address size for encodings that change based on mode.
@@ -234,7 +234,9 @@ class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
// based on address size of the mode?
bits<2> AdSizeBits = AdSize.Value;
- Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have?
+ Encoding OpEnc = EncNormal; // Encoding used by this instruction
+ // Which prefix byte does this inst have?
+ Prefix OpPrefix = !if(!eq(OpEnc, EncNormal), NoPrfx, PS);
bits<3> OpPrefixBits = OpPrefix.Value;
Map OpMap = OB; // Which opcode map does this inst have?
bits<4> OpMapBits = OpMap.Value;
@@ -243,7 +245,6 @@ class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix?
Domain ExeDomain = d;
bit hasREPPrefix = 0; // Does this inst have a REP prefix?
- Encoding OpEnc = EncNormal; // Encoding used by this instruction
bits<2> OpEncBits = OpEnc.Value;
bit IgnoresW = 0; // Does this inst ignore REX_W field?
bit EVEX_W1_VEX_W0 = 0; // This EVEX inst with VEX.W==1 can become a VEX
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp
index bc2d5ed1e17d..bddda6891356 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -8263,8 +8263,8 @@ bool X86InstrInfo::unfoldMemoryOperand(
DebugLoc DL;
MachineInstrBuilder MIB = BuildMI(MF, DL, get(Opc), Reg);
- for (unsigned i = 0, e = AddrOps.size(); i != e; ++i)
- MIB.add(AddrOps[i]);
+ for (const MachineOperand &AddrOp : AddrOps)
+ MIB.add(AddrOp);
MIB.setMemRefs(MMOs);
NewMIs.push_back(MIB);
@@ -8341,8 +8341,8 @@ bool X86InstrInfo::unfoldMemoryOperand(
unsigned Opc = getStoreRegOpcode(Reg, DstRC, isAligned, Subtarget);
DebugLoc DL;
MachineInstrBuilder MIB = BuildMI(MF, DL, get(Opc));
- for (unsigned i = 0, e = AddrOps.size(); i != e; ++i)
- MIB.add(AddrOps[i]);
+ for (const MachineOperand &AddrOp : AddrOps)
+ MIB.add(AddrOp);
MIB.addReg(Reg, RegState::Kill);
MIB.setMemRefs(MMOs);
NewMIs.push_back(MIB);
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrKL.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrKL.td
index a3392b691c0a..4586fc541627 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrKL.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrKL.td
@@ -19,17 +19,17 @@ let SchedRW = [WriteSystem], Predicates = [HasKL] in {
let Uses = [XMM0, EAX], Defs = [EFLAGS] in {
def LOADIWKEY : I<0xDC, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2),
"loadiwkey\t{$src2, $src1|$src1, $src2}",
- [(int_x86_loadiwkey XMM0, VR128:$src1, VR128:$src2, EAX)]>, T8XS;
+ [(int_x86_loadiwkey XMM0, VR128:$src1, VR128:$src2, EAX)]>, T8, XS;
}
let Uses = [XMM0], Defs = [XMM0, XMM1, XMM2, XMM4, XMM5, XMM6, EFLAGS] in {
def ENCODEKEY128 : I<0xFA, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
- "encodekey128\t{$src, $dst|$dst, $src}", []>, T8XS;
+ "encodekey128\t{$src, $dst|$dst, $src}", []>, T8, XS;
}
let Uses = [XMM0, XMM1], Defs = [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, EFLAGS] in {
def ENCODEKEY256 : I<0xFB, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
- "encodekey256\t{$src, $dst|$dst, $src}", []>, T8XS;
+ "encodekey256\t{$src, $dst|$dst, $src}", []>, T8, XS;
}
let Constraints = "$src1 = $dst",
@@ -37,22 +37,22 @@ let SchedRW = [WriteSystem], Predicates = [HasKL] in {
def AESENC128KL : I<0xDC, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, opaquemem:$src2),
"aesenc128kl\t{$src2, $src1|$src1, $src2}",
[(set VR128:$dst, EFLAGS,
- (X86aesenc128kl VR128:$src1, addr:$src2))]>, T8XS;
+ (X86aesenc128kl VR128:$src1, addr:$src2))]>, T8, XS;
def AESDEC128KL : I<0xDD, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, opaquemem:$src2),
"aesdec128kl\t{$src2, $src1|$src1, $src2}",
[(set VR128:$dst, EFLAGS,
- (X86aesdec128kl VR128:$src1, addr:$src2))]>, T8XS;
+ (X86aesdec128kl VR128:$src1, addr:$src2))]>, T8, XS;
def AESENC256KL : I<0xDE, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, opaquemem:$src2),
"aesenc256kl\t{$src2, $src1|$src1, $src2}",
[(set VR128:$dst, EFLAGS,
- (X86aesenc256kl VR128:$src1, addr:$src2))]>, T8XS;
+ (X86aesenc256kl VR128:$src1, addr:$src2))]>, T8, XS;
def AESDEC256KL : I<0xDF, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, opaquemem:$src2),
"aesdec256kl\t{$src2, $src1|$src1, $src2}",
[(set VR128:$dst, EFLAGS,
- (X86aesdec256kl VR128:$src1, addr:$src2))]>, T8XS;
+ (X86aesdec256kl VR128:$src1, addr:$src2))]>, T8, XS;
}
} // SchedRW, Predicates
@@ -62,13 +62,13 @@ let SchedRW = [WriteSystem], Predicates = [HasWIDEKL] in {
Defs = [EFLAGS, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7],
mayLoad = 1 in {
def AESENCWIDE128KL : I<0xD8, MRM0m, (outs), (ins opaquemem:$src),
- "aesencwide128kl\t$src", []>, T8XS;
+ "aesencwide128kl\t$src", []>, T8, XS;
def AESDECWIDE128KL : I<0xD8, MRM1m, (outs), (ins opaquemem:$src),
- "aesdecwide128kl\t$src", []>, T8XS;
+ "aesdecwide128kl\t$src", []>, T8, XS;
def AESENCWIDE256KL : I<0xD8, MRM2m, (outs), (ins opaquemem:$src),
- "aesencwide256kl\t$src", []>, T8XS;
+ "aesencwide256kl\t$src", []>, T8, XS;
def AESDECWIDE256KL : I<0xD8, MRM3m, (outs), (ins opaquemem:$src),
- "aesdecwide256kl\t$src", []>, T8XS;
+ "aesdecwide256kl\t$src", []>, T8, XS;
}
} // SchedRW, Predicates
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMMX.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMMX.td
index acf7605b3f53..8d6bc8d0ee2c 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMMX.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMMX.td
@@ -487,24 +487,24 @@ def MMX_PSHUFWmi : MMXIi8<0x70, MRMSrcMem,
// -- Conversion Instructions
defm MMX_CVTPS2PI : sse12_cvt_pint<0x2D, VR128, VR64, int_x86_sse_cvtps2pi,
f64mem, load, "cvtps2pi\t{$src, $dst|$dst, $src}",
- WriteCvtPS2I, SSEPackedSingle>, PS, SIMD_EXC;
+ WriteCvtPS2I, SSEPackedSingle>, TB, SIMD_EXC;
defm MMX_CVTPD2PI : sse12_cvt_pint<0x2D, VR128, VR64, int_x86_sse_cvtpd2pi,
f128mem, memop, "cvtpd2pi\t{$src, $dst|$dst, $src}",
- WriteCvtPD2I, SSEPackedDouble>, PD, SIMD_EXC;
+ WriteCvtPD2I, SSEPackedDouble>, TB, PD, SIMD_EXC;
defm MMX_CVTTPS2PI : sse12_cvt_pint<0x2C, VR128, VR64, int_x86_sse_cvttps2pi,
f64mem, load, "cvttps2pi\t{$src, $dst|$dst, $src}",
- WriteCvtPS2I, SSEPackedSingle>, PS, SIMD_EXC;
+ WriteCvtPS2I, SSEPackedSingle>, TB, SIMD_EXC;
defm MMX_CVTTPD2PI : sse12_cvt_pint<0x2C, VR128, VR64, int_x86_sse_cvttpd2pi,
f128mem, memop, "cvttpd2pi\t{$src, $dst|$dst, $src}",
- WriteCvtPD2I, SSEPackedDouble>, PD, SIMD_EXC;
+ WriteCvtPD2I, SSEPackedDouble>, TB, PD, SIMD_EXC;
defm MMX_CVTPI2PD : sse12_cvt_pint<0x2A, VR64, VR128, int_x86_sse_cvtpi2pd,
i64mem, load, "cvtpi2pd\t{$src, $dst|$dst, $src}",
- WriteCvtI2PD, SSEPackedDouble>, PD;
+ WriteCvtI2PD, SSEPackedDouble>, TB, PD;
let Constraints = "$src1 = $dst" in {
defm MMX_CVTPI2PS : sse12_cvt_pint_3addr<0x2A, VR64, VR128,
int_x86_sse_cvtpi2ps,
i64mem, load, "cvtpi2ps\t{$src2, $dst|$dst, $src2}",
- SSEPackedSingle>, PS, SIMD_EXC;
+ SSEPackedSingle>, TB, SIMD_EXC;
}
// Extract / Insert
@@ -548,13 +548,13 @@ def MMX_PMOVMSKBrr : MMXI<0xD7, MRMSrcReg, (outs GR32orGR64:$dst),
// Misc.
let SchedRW = [SchedWriteShuffle.MMX] in {
let Uses = [EDI], Predicates = [HasMMX, HasSSE1,Not64BitMode] in
-def MMX_MASKMOVQ : MMXI32<0xF7, MRMSrcReg, (outs), (ins VR64:$src, VR64:$mask),
- "maskmovq\t{$mask, $src|$src, $mask}",
- [(int_x86_mmx_maskmovq VR64:$src, VR64:$mask, EDI)]>;
+def MMX_MASKMOVQ : MMXI<0xF7, MRMSrcReg, (outs), (ins VR64:$src, VR64:$mask),
+ "maskmovq\t{$mask, $src|$src, $mask}",
+ [(int_x86_mmx_maskmovq VR64:$src, VR64:$mask, EDI)]>;
let Uses = [RDI], Predicates = [HasMMX, HasSSE1,In64BitMode] in
-def MMX_MASKMOVQ64: MMXI64<0xF7, MRMSrcReg, (outs), (ins VR64:$src, VR64:$mask),
- "maskmovq\t{$mask, $src|$src, $mask}",
- [(int_x86_mmx_maskmovq VR64:$src, VR64:$mask, RDI)]>;
+def MMX_MASKMOVQ64: MMXI<0xF7, MRMSrcReg, (outs), (ins VR64:$src, VR64:$mask),
+ "maskmovq\t{$mask, $src|$src, $mask}",
+ [(int_x86_mmx_maskmovq VR64:$src, VR64:$mask, RDI)]>;
}
// 64-bit bit convert.
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMisc.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMisc.td
index 2ea10e317e12..305bd74f7bd7 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMisc.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrMisc.td
@@ -165,10 +165,10 @@ def POPP64r : I<0x58, AddRegFrm, (outs GR64:$reg), (ins), "popp\t$reg", []>,
REX_W, ExplicitREX2Prefix, Requires<[In64BitMode]>;
def POP2: I<0x8F, MRM0r, (outs GR64:$reg1, GR64:$reg2), (ins),
"pop2\t{$reg2, $reg1|$reg1, $reg2}",
- []>, EVEX_4V, EVEX_B, T_MAP4PS;
+ []>, EVEX, VVVV, EVEX_B, T_MAP4;
def POP2P: I<0x8F, MRM0r, (outs GR64:$reg1, GR64:$reg2), (ins),
"pop2p\t{$reg2, $reg1|$reg1, $reg2}",
- []>, EVEX_4V, EVEX_B, T_MAP4PS, REX_W;
+ []>, EVEX, VVVV, EVEX_B, T_MAP4, REX_W;
} // mayLoad, SchedRW
let mayLoad = 1, mayStore = 1, SchedRW = [WriteCopy] in
@@ -186,10 +186,10 @@ def PUSHP64r : I<0x50, AddRegFrm, (outs), (ins GR64:$reg), "pushp\t$reg", []>,
REX_W, ExplicitREX2Prefix, Requires<[In64BitMode]>;
def PUSH2: I<0xFF, MRM6r, (outs), (ins GR64:$reg1, GR64:$reg2),
"push2\t{$reg2, $reg1|$reg1, $reg2}",
- []>, EVEX_4V, EVEX_B, T_MAP4PS;
+ []>, EVEX, VVVV, EVEX_B, T_MAP4;
def PUSH2P: I<0xFF, MRM6r, (outs), (ins GR64:$reg1, GR64:$reg2),
"push2p\t{$reg2, $reg1|$reg1, $reg2}",
- []>, EVEX_4V, EVEX_B, T_MAP4PS, REX_W;
+ []>, EVEX, VVVV, EVEX_B, T_MAP4, REX_W;
} // mayStore, SchedRW
let mayLoad = 1, mayStore = 1, SchedRW = [WriteCopy] in {
def PUSH64rmm: I<0xFF, MRM6m, (outs), (ins i64mem:$src), "push{q}\t$src", []>,
@@ -251,52 +251,52 @@ let Defs = [EFLAGS] in {
def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
"bsf{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, EFLAGS, (X86bsf GR16:$src))]>,
- PS, OpSize16, Sched<[WriteBSF]>;
+ TB, OpSize16, Sched<[WriteBSF]>;
def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
"bsf{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, EFLAGS, (X86bsf (loadi16 addr:$src)))]>,
- PS, OpSize16, Sched<[WriteBSFLd]>;
+ TB, OpSize16, Sched<[WriteBSFLd]>;
def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
"bsf{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, EFLAGS, (X86bsf GR32:$src))]>,
- PS, OpSize32, Sched<[WriteBSF]>;
+ TB, OpSize32, Sched<[WriteBSF]>;
def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
"bsf{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, EFLAGS, (X86bsf (loadi32 addr:$src)))]>,
- PS, OpSize32, Sched<[WriteBSFLd]>;
+ TB, OpSize32, Sched<[WriteBSFLd]>;
def BSF64rr : RI<0xBC, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
"bsf{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, EFLAGS, (X86bsf GR64:$src))]>,
- PS, Sched<[WriteBSF]>;
+ TB, Sched<[WriteBSF]>;
def BSF64rm : RI<0xBC, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
"bsf{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, EFLAGS, (X86bsf (loadi64 addr:$src)))]>,
- PS, Sched<[WriteBSFLd]>;
+ TB, Sched<[WriteBSFLd]>;
def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
"bsr{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, EFLAGS, (X86bsr GR16:$src))]>,
- PS, OpSize16, Sched<[WriteBSR]>;
+ TB, OpSize16, Sched<[WriteBSR]>;
def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
"bsr{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, EFLAGS, (X86bsr (loadi16 addr:$src)))]>,
- PS, OpSize16, Sched<[WriteBSRLd]>;
+ TB, OpSize16, Sched<[WriteBSRLd]>;
def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
"bsr{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, EFLAGS, (X86bsr GR32:$src))]>,
- PS, OpSize32, Sched<[WriteBSR]>;
+ TB, OpSize32, Sched<[WriteBSR]>;
def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
"bsr{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, EFLAGS, (X86bsr (loadi32 addr:$src)))]>,
- PS, OpSize32, Sched<[WriteBSRLd]>;
+ TB, OpSize32, Sched<[WriteBSRLd]>;
def BSR64rr : RI<0xBD, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
"bsr{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, EFLAGS, (X86bsr GR64:$src))]>,
- PS, Sched<[WriteBSR]>;
+ TB, Sched<[WriteBSR]>;
def BSR64rm : RI<0xBD, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
"bsr{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, EFLAGS, (X86bsr (loadi64 addr:$src)))]>,
- PS, Sched<[WriteBSRLd]>;
+ TB, Sched<[WriteBSRLd]>;
} // Defs = [EFLAGS]
let SchedRW = [WriteMicrocoded] in {
@@ -1095,29 +1095,29 @@ let Predicates = [HasMOVBE] in {
def MOVBE16rm : I<0xF0, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
"movbe{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, (bswap (loadi16 addr:$src)))]>,
- OpSize16, T8PS;
+ OpSize16, T8;
def MOVBE32rm : I<0xF0, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
"movbe{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (bswap (loadi32 addr:$src)))]>,
- OpSize32, T8PS;
+ OpSize32, T8;
def MOVBE64rm : RI<0xF0, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
"movbe{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (bswap (loadi64 addr:$src)))]>,
- T8PS;
+ T8;
}
let SchedRW = [WriteStore] in {
def MOVBE16mr : I<0xF1, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
"movbe{w}\t{$src, $dst|$dst, $src}",
[(store (bswap GR16:$src), addr:$dst)]>,
- OpSize16, T8PS;
+ OpSize16, T8;
def MOVBE32mr : I<0xF1, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
"movbe{l}\t{$src, $dst|$dst, $src}",
[(store (bswap GR32:$src), addr:$dst)]>,
- OpSize32, T8PS;
+ OpSize32, T8;
def MOVBE64mr : RI<0xF1, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
"movbe{q}\t{$src, $dst|$dst, $src}",
[(store (bswap GR64:$src), addr:$dst)]>,
- T8PS;
+ T8;
}
}
@@ -1127,13 +1127,13 @@ let Predicates = [HasMOVBE] in {
let Predicates = [HasRDRAND], Defs = [EFLAGS], SchedRW = [WriteSystem] in {
def RDRAND16r : I<0xC7, MRM6r, (outs GR16:$dst), (ins),
"rdrand{w}\t$dst", [(set GR16:$dst, EFLAGS, (X86rdrand))]>,
- OpSize16, PS;
+ OpSize16, TB;
def RDRAND32r : I<0xC7, MRM6r, (outs GR32:$dst), (ins),
"rdrand{l}\t$dst", [(set GR32:$dst, EFLAGS, (X86rdrand))]>,
- OpSize32, PS;
+ OpSize32, TB;
def RDRAND64r : RI<0xC7, MRM6r, (outs GR64:$dst), (ins),
"rdrand{q}\t$dst", [(set GR64:$dst, EFLAGS, (X86rdrand))]>,
- PS;
+ TB;
}
//===----------------------------------------------------------------------===//
@@ -1141,11 +1141,11 @@ let Predicates = [HasRDRAND], Defs = [EFLAGS], SchedRW = [WriteSystem] in {
//
let Predicates = [HasRDSEED], Defs = [EFLAGS], SchedRW = [WriteSystem] in {
def RDSEED16r : I<0xC7, MRM7r, (outs GR16:$dst), (ins), "rdseed{w}\t$dst",
- [(set GR16:$dst, EFLAGS, (X86rdseed))]>, OpSize16, PS;
+ [(set GR16:$dst, EFLAGS, (X86rdseed))]>, OpSize16, TB;
def RDSEED32r : I<0xC7, MRM7r, (outs GR32:$dst), (ins), "rdseed{l}\t$dst",
- [(set GR32:$dst, EFLAGS, (X86rdseed))]>, OpSize32, PS;
+ [(set GR32:$dst, EFLAGS, (X86rdseed))]>, OpSize32, TB;
def RDSEED64r : RI<0xC7, MRM7r, (outs GR64:$dst), (ins), "rdseed{q}\t$dst",
- [(set GR64:$dst, EFLAGS, (X86rdseed))]>, PS;
+ [(set GR64:$dst, EFLAGS, (X86rdseed))]>, TB;
}
//===----------------------------------------------------------------------===//
@@ -1155,29 +1155,29 @@ let Predicates = [HasLZCNT], Defs = [EFLAGS] in {
def LZCNT16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
"lzcnt{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, (ctlz GR16:$src)), (implicit EFLAGS)]>,
- XS, OpSize16, Sched<[WriteLZCNT]>;
+ TB, XS, OpSize16, Sched<[WriteLZCNT]>;
def LZCNT16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
"lzcnt{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, (ctlz (loadi16 addr:$src))),
- (implicit EFLAGS)]>, XS, OpSize16, Sched<[WriteLZCNTLd]>;
+ (implicit EFLAGS)]>, TB, XS, OpSize16, Sched<[WriteLZCNTLd]>;
def LZCNT32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
"lzcnt{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (ctlz GR32:$src)), (implicit EFLAGS)]>,
- XS, OpSize32, Sched<[WriteLZCNT]>;
+ TB, XS, OpSize32, Sched<[WriteLZCNT]>;
def LZCNT32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
"lzcnt{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (ctlz (loadi32 addr:$src))),
- (implicit EFLAGS)]>, XS, OpSize32, Sched<[WriteLZCNTLd]>;
+ (implicit EFLAGS)]>, TB, XS, OpSize32, Sched<[WriteLZCNTLd]>;
def LZCNT64rr : RI<0xBD, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
"lzcnt{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (ctlz GR64:$src)), (implicit EFLAGS)]>,
- XS, Sched<[WriteLZCNT]>;
+ TB, XS, Sched<[WriteLZCNT]>;
def LZCNT64rm : RI<0xBD, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
"lzcnt{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (ctlz (loadi64 addr:$src))),
- (implicit EFLAGS)]>, XS, Sched<[WriteLZCNTLd]>;
+ (implicit EFLAGS)]>, TB, XS, Sched<[WriteLZCNTLd]>;
}
//===----------------------------------------------------------------------===//
@@ -1187,29 +1187,29 @@ let Predicates = [HasBMI], Defs = [EFLAGS] in {
def TZCNT16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
"tzcnt{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, (cttz GR16:$src)), (implicit EFLAGS)]>,
- XS, OpSize16, Sched<[WriteTZCNT]>;
+ TB, XS, OpSize16, Sched<[WriteTZCNT]>;
def TZCNT16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
"tzcnt{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, (cttz (loadi16 addr:$src))),
- (implicit EFLAGS)]>, XS, OpSize16, Sched<[WriteTZCNTLd]>;
+ (implicit EFLAGS)]>, TB, XS, OpSize16, Sched<[WriteTZCNTLd]>;
def TZCNT32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
"tzcnt{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (cttz GR32:$src)), (implicit EFLAGS)]>,
- XS, OpSize32, Sched<[WriteTZCNT]>;
+ TB, XS, OpSize32, Sched<[WriteTZCNT]>;
def TZCNT32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
"tzcnt{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (cttz (loadi32 addr:$src))),
- (implicit EFLAGS)]>, XS, OpSize32, Sched<[WriteTZCNTLd]>;
+ (implicit EFLAGS)]>, TB, XS, OpSize32, Sched<[WriteTZCNTLd]>;
def TZCNT64rr : RI<0xBC, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
"tzcnt{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (cttz GR64:$src)), (implicit EFLAGS)]>,
- XS, Sched<[WriteTZCNT]>;
+ TB, XS, Sched<[WriteTZCNT]>;
def TZCNT64rm : RI<0xBC, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
"tzcnt{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (cttz (loadi64 addr:$src))),
- (implicit EFLAGS)]>, XS, Sched<[WriteTZCNTLd]>;
+ (implicit EFLAGS)]>, TB, XS, Sched<[WriteTZCNTLd]>;
}
multiclass bmi_bls<string mnemonic, Format RegMRM, Format MemMRM,
@@ -1218,11 +1218,11 @@ multiclass bmi_bls<string mnemonic, Format RegMRM, Format MemMRM,
let hasSideEffects = 0 in {
def rr#Suffix : I<0xF3, RegMRM, (outs RC:$dst), (ins RC:$src),
!strconcat(mnemonic, "\t{$src, $dst|$dst, $src}"), []>,
- T8PS, VEX_4V, Sched<[sched]>;
+ T8, VEX, VVVV, Sched<[sched]>;
let mayLoad = 1 in
def rm#Suffix : I<0xF3, MemMRM, (outs RC:$dst), (ins x86memop:$src),
!strconcat(mnemonic, "\t{$src, $dst|$dst, $src}"), []>,
- T8PS, VEX_4V, Sched<[sched.Folded]>;
+ T8, VEX, VVVV, Sched<[sched.Folded]>;
}
}
@@ -1288,12 +1288,12 @@ multiclass bmi4VOp3_base<bits<8> opc, string mnemonic, RegisterClass RC,
def rr#Suffix : I<opc, MRMSrcReg4VOp3, (outs RC:$dst), (ins RC:$src1, RC:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, (OpNode RC:$src1, RC:$src2)), (implicit EFLAGS)]>,
- T8PS, VEX, Sched<[Sched]>;
+ T8, VEX, Sched<[Sched]>;
let mayLoad = 1 in
def rm#Suffix : I<opc, MRMSrcMem4VOp3, (outs RC:$dst), (ins x86memop:$src1, RC:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, (OpNode (ld_frag addr:$src1), RC:$src2)),
- (implicit EFLAGS)]>, T8PS, VEX,
+ (implicit EFLAGS)]>, T8, VEX,
Sched<[Sched.Folded,
// x86memop:$src1
ReadDefault, ReadDefault, ReadDefault, ReadDefault,
@@ -1371,33 +1371,33 @@ multiclass bmi_pdep_pext<string mnemonic, RegisterClass RC,
def rr#Suffix : I<0xF5, MRMSrcReg, (outs RC:$dst), (ins RC:$src1, RC:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, (OpNode RC:$src1, RC:$src2))]>,
- VEX_4V, Sched<[WriteALU]>;
+ VEX, VVVV, Sched<[WriteALU]>;
def rm#Suffix : I<0xF5, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2),
!strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, (OpNode RC:$src1, (ld_frag addr:$src2)))]>,
- VEX_4V, Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]>;
+ VEX, VVVV, Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]>;
}
let Predicates = [HasBMI2, NoEGPR] in {
defm PDEP32 : bmi_pdep_pext<"pdep{l}", GR32, i32mem,
- X86pdep, loadi32>, T8XD;
+ X86pdep, loadi32>, T8, XD;
defm PDEP64 : bmi_pdep_pext<"pdep{q}", GR64, i64mem,
- X86pdep, loadi64>, T8XD, REX_W;
+ X86pdep, loadi64>, T8, XD, REX_W;
defm PEXT32 : bmi_pdep_pext<"pext{l}", GR32, i32mem,
- X86pext, loadi32>, T8XS;
+ X86pext, loadi32>, T8, XS;
defm PEXT64 : bmi_pdep_pext<"pext{q}", GR64, i64mem,
- X86pext, loadi64>, T8XS, REX_W;
+ X86pext, loadi64>, T8, XS, REX_W;
}
let Predicates = [HasBMI2, HasEGPR] in {
defm PDEP32 : bmi_pdep_pext<"pdep{l}", GR32, i32mem,
- X86pdep, loadi32, "_EVEX">, T8XD, EVEX;
+ X86pdep, loadi32, "_EVEX">, T8, XD, EVEX;
defm PDEP64 : bmi_pdep_pext<"pdep{q}", GR64, i64mem,
- X86pdep, loadi64, "_EVEX">, T8XD, REX_W, EVEX;
+ X86pdep, loadi64, "_EVEX">, T8, XD, REX_W, EVEX;
defm PEXT32 : bmi_pdep_pext<"pext{l}", GR32, i32mem,
- X86pext, loadi32, "_EVEX">, T8XS, EVEX;
+ X86pext, loadi32, "_EVEX">, T8, XS, EVEX;
defm PEXT64 : bmi_pdep_pext<"pext{q}", GR64, i64mem,
- X86pext, loadi64, "_EVEX">, T8XS, REX_W, EVEX;
+ X86pext, loadi64, "_EVEX">, T8, XS, REX_W, EVEX;
}
//===----------------------------------------------------------------------===//
@@ -1419,12 +1419,12 @@ multiclass lwpins_intr<RegisterClass RC> {
def rri : Ii32<0x12, MRM0r, (outs), (ins RC:$src0, GR32:$src1, i32imm:$cntl),
"lwpins\t{$cntl, $src1, $src0|$src0, $src1, $cntl}",
[(set EFLAGS, (X86lwpins RC:$src0, GR32:$src1, timm:$cntl))]>,
- XOP_4V, XOPA;
+ XOP, VVVV, XOPA;
let mayLoad = 1 in
def rmi : Ii32<0x12, MRM0m, (outs), (ins RC:$src0, i32mem:$src1, i32imm:$cntl),
"lwpins\t{$cntl, $src1, $src0|$src0, $src1, $cntl}",
[(set EFLAGS, (X86lwpins RC:$src0, (loadi32 addr:$src1), timm:$cntl))]>,
- XOP_4V, XOPA;
+ XOP, VVVV, XOPA;
}
let Defs = [EFLAGS] in {
@@ -1435,12 +1435,12 @@ let Defs = [EFLAGS] in {
multiclass lwpval_intr<RegisterClass RC, Intrinsic Int> {
def rri : Ii32<0x12, MRM1r, (outs), (ins RC:$src0, GR32:$src1, i32imm:$cntl),
"lwpval\t{$cntl, $src1, $src0|$src0, $src1, $cntl}",
- [(Int RC:$src0, GR32:$src1, timm:$cntl)]>, XOP_4V, XOPA;
+ [(Int RC:$src0, GR32:$src1, timm:$cntl)]>, XOP, VVVV, XOPA;
let mayLoad = 1 in
def rmi : Ii32<0x12, MRM1m, (outs), (ins RC:$src0, i32mem:$src1, i32imm:$cntl),
"lwpval\t{$cntl, $src1, $src0|$src0, $src1, $cntl}",
[(Int RC:$src0, (loadi32 addr:$src1), timm:$cntl)]>,
- XOP_4V, XOPA;
+ XOP, VVVV, XOPA;
}
defm LWPVAL32 : lwpval_intr<GR32, int_x86_lwpval32>;
@@ -1471,22 +1471,22 @@ let SchedRW = [ WriteSystem ] in {
let SchedRW = [WriteSystem] in {
def UMONITOR16 : I<0xAE, MRM6r, (outs), (ins GR16:$src),
"umonitor\t$src", [(int_x86_umonitor GR16:$src)]>,
- XS, AdSize16, Requires<[HasWAITPKG, Not64BitMode]>;
+ TB, XS, AdSize16, Requires<[HasWAITPKG, Not64BitMode]>;
def UMONITOR32 : I<0xAE, MRM6r, (outs), (ins GR32:$src),
"umonitor\t$src", [(int_x86_umonitor GR32:$src)]>,
- XS, AdSize32, Requires<[HasWAITPKG]>;
+ TB, XS, AdSize32, Requires<[HasWAITPKG]>;
def UMONITOR64 : I<0xAE, MRM6r, (outs), (ins GR64:$src),
"umonitor\t$src", [(int_x86_umonitor GR64:$src)]>,
- XS, AdSize64, Requires<[HasWAITPKG, In64BitMode]>;
+ TB, XS, AdSize64, Requires<[HasWAITPKG, In64BitMode]>;
let Uses = [EAX, EDX], Defs = [EFLAGS] in {
def UMWAIT : I<0xAE, MRM6r,
(outs), (ins GR32orGR64:$src), "umwait\t$src",
[(set EFLAGS, (X86umwait GR32orGR64:$src, EDX, EAX))]>,
- XD, Requires<[HasWAITPKG]>;
+ TB, XD, Requires<[HasWAITPKG]>;
def TPAUSE : I<0xAE, MRM6r,
(outs), (ins GR32orGR64:$src), "tpause\t$src",
[(set EFLAGS, (X86tpause GR32orGR64:$src, EDX, EAX))]>,
- PD, Requires<[HasWAITPKG]>;
+ TB, PD, Requires<[HasWAITPKG]>;
}
} // SchedRW
@@ -1497,19 +1497,19 @@ let SchedRW = [WriteStore] in {
def MOVDIRI32 : I<0xF9, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
"movdiri\t{$src, $dst|$dst, $src}",
[(int_x86_directstore32 addr:$dst, GR32:$src)]>,
- T8PS, Requires<[HasMOVDIRI, NoEGPR]>;
+ T8, Requires<[HasMOVDIRI, NoEGPR]>;
def MOVDIRI64 : RI<0xF9, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
"movdiri\t{$src, $dst|$dst, $src}",
[(int_x86_directstore64 addr:$dst, GR64:$src)]>,
- T8PS, Requires<[In64BitMode, HasMOVDIRI, NoEGPR]>;
+ T8, Requires<[In64BitMode, HasMOVDIRI, NoEGPR]>;
def MOVDIRI32_EVEX : I<0xF9, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
"movdiri\t{$src, $dst|$dst, $src}",
[(int_x86_directstore32 addr:$dst, GR32:$src)]>,
- EVEX_NoCD8, T_MAP4PS, Requires<[In64BitMode, HasMOVDIRI, HasEGPR]>;
+ EVEX, NoCD8, T_MAP4, Requires<[In64BitMode, HasMOVDIRI, HasEGPR]>;
def MOVDIRI64_EVEX : RI<0xF9, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
"movdiri\t{$src, $dst|$dst, $src}",
[(int_x86_directstore64 addr:$dst, GR64:$src)]>,
- EVEX_NoCD8, T_MAP4PS, Requires<[In64BitMode, HasMOVDIRI, HasEGPR]>;
+ EVEX, NoCD8, T_MAP4, Requires<[In64BitMode, HasMOVDIRI, HasEGPR]>;
} // SchedRW
//===----------------------------------------------------------------------===//
@@ -1518,23 +1518,23 @@ def MOVDIRI64_EVEX : RI<0xF9, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
let SchedRW = [WriteStore] in {
def MOVDIR64B16 : I<0xF8, MRMSrcMem, (outs), (ins GR16:$dst, i512mem_GR16:$src),
"movdir64b\t{$src, $dst|$dst, $src}", []>,
- T8PD, AdSize16, Requires<[HasMOVDIR64B, Not64BitMode]>;
+ T8, PD, AdSize16, Requires<[HasMOVDIR64B, Not64BitMode]>;
def MOVDIR64B32 : I<0xF8, MRMSrcMem, (outs), (ins GR32:$dst, i512mem_GR32:$src),
"movdir64b\t{$src, $dst|$dst, $src}",
[(int_x86_movdir64b GR32:$dst, addr:$src)]>,
- T8PD, AdSize32, Requires<[HasMOVDIR64B, NoEGPR]>;
+ T8, PD, AdSize32, Requires<[HasMOVDIR64B, NoEGPR]>;
def MOVDIR64B64 : I<0xF8, MRMSrcMem, (outs), (ins GR64:$dst, i512mem_GR64:$src),
"movdir64b\t{$src, $dst|$dst, $src}",
[(int_x86_movdir64b GR64:$dst, addr:$src)]>,
- T8PD, AdSize64, Requires<[HasMOVDIR64B, NoEGPR, In64BitMode]>;
+ T8, PD, AdSize64, Requires<[HasMOVDIR64B, NoEGPR, In64BitMode]>;
def MOVDIR64B32_EVEX : I<0xF8, MRMSrcMem, (outs), (ins GR32:$dst, i512mem_GR32:$src),
"movdir64b\t{$src, $dst|$dst, $src}",
[(int_x86_movdir64b GR32:$dst, addr:$src)]>,
- EVEX_NoCD8, T_MAP4PD, AdSize32, Requires<[HasMOVDIR64B, HasEGPR, In64BitMode]>;
+ EVEX, NoCD8, T_MAP4, PD, AdSize32, Requires<[HasMOVDIR64B, HasEGPR, In64BitMode]>;
def MOVDIR64B64_EVEX : I<0xF8, MRMSrcMem, (outs), (ins GR64:$dst, i512mem_GR64:$src),
"movdir64b\t{$src, $dst|$dst, $src}",
[(int_x86_movdir64b GR64:$dst, addr:$src)]>,
- EVEX_NoCD8, T_MAP4PD, AdSize64, Requires<[HasMOVDIR64B, HasEGPR, In64BitMode]>;
+ EVEX, NoCD8, T_MAP4, PD, AdSize64, Requires<[HasMOVDIR64B, HasEGPR, In64BitMode]>;
} // SchedRW
//===----------------------------------------------------------------------===//
@@ -1544,28 +1544,28 @@ let SchedRW = [WriteStore], Defs = [EFLAGS] in {
def ENQCMD16 : I<0xF8, MRMSrcMem, (outs), (ins GR16:$dst, i512mem:$src),
"enqcmd\t{$src, $dst|$dst, $src}",
[(set EFLAGS, (X86enqcmd GR16:$dst, addr:$src))]>,
- T8XD, AdSize16, Requires<[HasENQCMD, Not64BitMode]>;
+ T8, XD, AdSize16, Requires<[HasENQCMD, Not64BitMode]>;
def ENQCMD32 : I<0xF8, MRMSrcMem, (outs), (ins GR32:$dst, i512mem:$src),
"enqcmd\t{$src, $dst|$dst, $src}",
[(set EFLAGS, (X86enqcmd GR32:$dst, addr:$src))]>,
- T8XD, AdSize32, Requires<[HasENQCMD]>;
+ T8, XD, AdSize32, Requires<[HasENQCMD]>;
def ENQCMD64 : I<0xF8, MRMSrcMem, (outs), (ins GR64:$dst, i512mem:$src),
"enqcmd\t{$src, $dst|$dst, $src}",
[(set EFLAGS, (X86enqcmd GR64:$dst, addr:$src))]>,
- T8XD, AdSize64, Requires<[HasENQCMD, In64BitMode]>;
+ T8, XD, AdSize64, Requires<[HasENQCMD, In64BitMode]>;
def ENQCMDS16 : I<0xF8, MRMSrcMem, (outs), (ins GR16:$dst, i512mem:$src),
"enqcmds\t{$src, $dst|$dst, $src}",
[(set EFLAGS, (X86enqcmds GR16:$dst, addr:$src))]>,
- T8XS, AdSize16, Requires<[HasENQCMD, Not64BitMode]>;
+ T8, XS, AdSize16, Requires<[HasENQCMD, Not64BitMode]>;
def ENQCMDS32 : I<0xF8, MRMSrcMem, (outs), (ins GR32:$dst, i512mem:$src),
"enqcmds\t{$src, $dst|$dst, $src}",
[(set EFLAGS, (X86enqcmds GR32:$dst, addr:$src))]>,
- T8XS, AdSize32, Requires<[HasENQCMD]>;
+ T8, XS, AdSize32, Requires<[HasENQCMD]>;
def ENQCMDS64 : I<0xF8, MRMSrcMem, (outs), (ins GR64:$dst, i512mem:$src),
"enqcmds\t{$src, $dst|$dst, $src}",
[(set EFLAGS, (X86enqcmds GR64:$dst, addr:$src))]>,
- T8XS, AdSize64, Requires<[HasENQCMD, In64BitMode]>;
+ T8, XS, AdSize64, Requires<[HasENQCMD, In64BitMode]>;
}
//===----------------------------------------------------------------------===//
@@ -1588,11 +1588,11 @@ let SchedRW = [WriteSystem] in {
let Uses = [EAX, EDX] in
def INVLPGB32 : I<0x01, MRM_FE, (outs), (ins),
"invlpgb", []>,
- PS, Requires<[Not64BitMode]>;
+ TB, Requires<[Not64BitMode]>;
let Uses = [RAX, EDX] in
def INVLPGB64 : I<0x01, MRM_FE, (outs), (ins),
"invlpgb", []>,
- PS, Requires<[In64BitMode]>;
+ TB, Requires<[In64BitMode]>;
} // SchedRW
//===----------------------------------------------------------------------===//
@@ -1602,7 +1602,7 @@ let SchedRW = [WriteSystem] in {
let SchedRW = [WriteSystem] in {
def TLBSYNC : I<0x01, MRM_FF, (outs), (ins),
"tlbsync", []>,
- PS, Requires<[]>;
+ TB, Requires<[]>;
} // SchedRW
//===----------------------------------------------------------------------===//
@@ -1610,14 +1610,14 @@ let SchedRW = [WriteSystem] in {
//
let Uses = [EAX], SchedRW = [WriteSystem] in
def HRESET : Ii8<0xF0, MRM_C0, (outs), (ins i32u8imm:$imm), "hreset\t$imm", []>,
- Requires<[HasHRESET]>, TAXS;
+ Requires<[HasHRESET]>, TA, XS;
//===----------------------------------------------------------------------===//
// SERIALIZE Instruction
//
let SchedRW = [WriteSystem] in
def SERIALIZE : I<0x01, MRM_E8, (outs), (ins), "serialize",
- [(int_x86_serialize)]>, PS,
+ [(int_x86_serialize)]>, TB,
Requires<[HasSERIALIZE]>;
//===----------------------------------------------------------------------===//
@@ -1625,9 +1625,9 @@ let SchedRW = [WriteSystem] in
//
let Predicates = [HasTSXLDTRK], SchedRW = [WriteSystem] in {
def XSUSLDTRK : I<0x01, MRM_E8, (outs), (ins), "xsusldtrk",
- [(int_x86_xsusldtrk)]>, XD;
+ [(int_x86_xsusldtrk)]>, TB, XD;
def XRESLDTRK : I<0x01, MRM_E9, (outs), (ins), "xresldtrk",
- [(int_x86_xresldtrk)]>, XD;
+ [(int_x86_xresldtrk)]>, TB, XD;
}
//===----------------------------------------------------------------------===//
@@ -1635,18 +1635,18 @@ let Predicates = [HasTSXLDTRK], SchedRW = [WriteSystem] in {
//
let Predicates = [HasUINTR, In64BitMode], SchedRW = [WriteSystem] in {
def UIRET : I<0x01, MRM_EC, (outs), (ins), "uiret",
- []>, XS;
+ []>, TB, XS;
def CLUI : I<0x01, MRM_EE, (outs), (ins), "clui",
- [(int_x86_clui)]>, XS;
+ [(int_x86_clui)]>, TB, XS;
def STUI : I<0x01, MRM_EF, (outs), (ins), "stui",
- [(int_x86_stui)]>, XS;
+ [(int_x86_stui)]>, TB, XS;
def SENDUIPI : I<0xC7, MRM6r, (outs), (ins GR64:$arg), "senduipi\t$arg",
- [(int_x86_senduipi GR64:$arg)]>, XS;
+ [(int_x86_senduipi GR64:$arg)]>, TB, XS;
let Defs = [EFLAGS] in
def TESTUI : I<0x01, MRM_ED, (outs), (ins), "testui",
- [(set EFLAGS, (X86testui))]>, XS;
+ [(set EFLAGS, (X86testui))]>, TB, XS;
}
//===----------------------------------------------------------------------===//
@@ -1663,21 +1663,38 @@ let Predicates = [HasPREFETCHI, In64BitMode], SchedRW = [WriteLoad] in {
// CMPCCXADD Instructions
//
let isCodeGenOnly = 1, ForceDisassemble = 1, mayLoad = 1, mayStore = 1,
- Predicates = [HasCMPCCXADD, In64BitMode], Defs = [EFLAGS],
- Constraints = "$dstsrc1 = $dst" in {
+ Defs = [EFLAGS], Constraints = "$dstsrc1 = $dst" in {
+let Predicates = [HasCMPCCXADD, NoEGPR, In64BitMode] in {
def CMPCCXADDmr32 : I<0xe0, MRMDestMem4VOp3CC, (outs GR32:$dst),
(ins GR32:$dstsrc1, i32mem:$dstsrc2, GR32:$src3, ccode:$cond),
"cmp${cond}xadd\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
[(set GR32:$dst, (X86cmpccxadd addr:$dstsrc2,
GR32:$dstsrc1, GR32:$src3, timm:$cond))]>,
- VEX_4V, T8PD, Sched<[WriteXCHG]>;
+ VEX, VVVV, T8, PD, Sched<[WriteXCHG]>;
def CMPCCXADDmr64 : I<0xe0, MRMDestMem4VOp3CC, (outs GR64:$dst),
(ins GR64:$dstsrc1, i64mem:$dstsrc2, GR64:$src3, ccode:$cond),
"cmp${cond}xadd\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
[(set GR64:$dst, (X86cmpccxadd addr:$dstsrc2,
GR64:$dstsrc1, GR64:$src3, timm:$cond))]>,
- VEX_4V, REX_W, T8PD, Sched<[WriteXCHG]>;
+ VEX, VVVV, REX_W, T8, PD, Sched<[WriteXCHG]>;
+}
+
+let Predicates = [HasCMPCCXADD, HasEGPR, In64BitMode] in {
+def CMPCCXADDmr32_EVEX : I<0xe0, MRMDestMem4VOp3CC, (outs GR32:$dst),
+ (ins GR32:$dstsrc1, i32mem:$dstsrc2, GR32:$src3, ccode:$cond),
+ "cmp${cond}xadd\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ [(set GR32:$dst, (X86cmpccxadd addr:$dstsrc2,
+ GR32:$dstsrc1, GR32:$src3, timm:$cond))]>,
+ EVEX, VVVV, NoCD8, T8, PD, Sched<[WriteXCHG]>;
+
+def CMPCCXADDmr64_EVEX : I<0xe0, MRMDestMem4VOp3CC, (outs GR64:$dst),
+ (ins GR64:$dstsrc1, i64mem:$dstsrc2, GR64:$src3, ccode:$cond),
+ "cmp${cond}xadd\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
+ [(set GR64:$dst, (X86cmpccxadd addr:$dstsrc2,
+ GR64:$dstsrc1, GR64:$src3, timm:$cond))]>,
+ EVEX, VVVV, NoCD8, REX_W, T8, PD, Sched<[WriteXCHG]>;
+}
}
//===----------------------------------------------------------------------===//
@@ -1686,12 +1703,12 @@ def CMPCCXADDmr64 : I<0xe0, MRMDestMem4VOp3CC, (outs GR64:$dst),
let Predicates = [HasCLFLUSHOPT], SchedRW = [WriteLoad] in
def CLFLUSHOPT : I<0xAE, MRM7m, (outs), (ins i8mem:$src),
- "clflushopt\t$src", [(int_x86_clflushopt addr:$src)]>, PD;
+ "clflushopt\t$src", [(int_x86_clflushopt addr:$src)]>, TB, PD;
let Predicates = [HasCLWB], SchedRW = [WriteLoad] in
def CLWB : I<0xAE, MRM6m, (outs), (ins i8mem:$src), "clwb\t$src",
- [(int_x86_clwb addr:$src)]>, PD;
+ [(int_x86_clwb addr:$src)]>, TB, PD;
let Predicates = [HasCLDEMOTE], SchedRW = [WriteLoad] in
def CLDEMOTE : I<0x1C, MRM0m, (outs), (ins i8mem:$src), "cldemote\t$src",
- [(int_x86_cldemote addr:$src)]>, PS;
+ [(int_x86_cldemote addr:$src)]>, TB;
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrRAOINT.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrRAOINT.td
index dc0e267a83e3..bc17b00f3573 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrRAOINT.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrRAOINT.td
@@ -39,7 +39,7 @@ multiclass RAOINT_BASE<string OpcodeStr> {
Sched<[WriteALURMW]>, REX_W;
}
-defm AADD : RAOINT_BASE<"add">, T8PS;
-defm AAND : RAOINT_BASE<"and">, T8PD;
-defm AOR : RAOINT_BASE<"or" >, T8XD;
-defm AXOR : RAOINT_BASE<"xor">, T8XS;
+defm AADD : RAOINT_BASE<"add">, T8;
+defm AAND : RAOINT_BASE<"and">, T8, PD;
+defm AOR : RAOINT_BASE<"or" >, T8, XD;
+defm AXOR : RAOINT_BASE<"xor">, T8, XS;
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSGX.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSGX.td
index 6439f717accb..747f5aa86653 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSGX.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSGX.td
@@ -17,13 +17,13 @@
let SchedRW = [WriteSystem], Predicates = [HasSGX] in {
// ENCLS - Execute an Enclave System Function of Specified Leaf Number
def ENCLS : I<0x01, MRM_CF, (outs), (ins),
- "encls", []>, PS;
+ "encls", []>, TB;
// ENCLU - Execute an Enclave User Function of Specified Leaf Number
def ENCLU : I<0x01, MRM_D7, (outs), (ins),
- "enclu", []>, PS;
+ "enclu", []>, TB;
// ENCLV - Execute an Enclave VMM Function of Specified Leaf Number
def ENCLV : I<0x01, MRM_C0, (outs), (ins),
- "enclv", []>, PS;
+ "enclv", []>, TB;
} // SchedRW
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSNP.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSNP.td
index ab13fa43c92d..05ed6585db6d 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSNP.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSNP.td
@@ -17,31 +17,31 @@
let SchedRW = [WriteSystem] in {
// F3 0F 01 FF
let Uses = [RAX], Defs = [EAX, EFLAGS] in
-def PSMASH: I<0x01, MRM_FF, (outs), (ins), "psmash", []>, XS,
+def PSMASH: I<0x01, MRM_FF, (outs), (ins), "psmash", []>, TB, XS,
Requires<[In64BitMode]>;
// F2 0F 01 FF
let Uses = [RAX, RCX, RDX], Defs = [EAX, EFLAGS] in
def PVALIDATE64: I<0x01, MRM_FF, (outs), (ins), "pvalidate",[]>,
- XD, Requires<[In64BitMode]>;
+ TB, XD, Requires<[In64BitMode]>;
let Uses = [EAX, ECX, EDX], Defs = [EAX, EFLAGS] in
def PVALIDATE32: I<0x01, MRM_FF, (outs), (ins), "pvalidate",[]>,
- XD, Requires<[Not64BitMode]>;
+ TB, XD, Requires<[Not64BitMode]>;
// F2 0F 01 FE
let Uses = [RAX, RCX], Defs = [EAX, EFLAGS] in
-def RMPUPDATE: I<0x01, MRM_FE, (outs), (ins), "rmpupdate", []>, XD,
+def RMPUPDATE: I<0x01, MRM_FE, (outs), (ins), "rmpupdate", []>, TB, XD,
Requires<[In64BitMode]>;
// F3 0F 01 FE
let Uses = [RAX, RCX, RDX], Defs = [EAX, EFLAGS] in
-def RMPADJUST: I<0x01, MRM_FE, (outs), (ins), "rmpadjust", []>, XS,
+def RMPADJUST: I<0x01, MRM_FE, (outs), (ins), "rmpadjust", []>, TB, XS,
Requires<[In64BitMode]>;
// F3 0F 01 FD
let Uses = [RAX, RDX], Defs = [RAX, RCX, RDX, EFLAGS] in
-def RMPQUERY: I<0x01, MRM_FD, (outs), (ins), "rmpquery", []>, XS,
+def RMPQUERY: I<0x01, MRM_FD, (outs), (ins), "rmpquery", []>, TB, XS,
Requires<[In64BitMode]>;
} // SchedRW
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSSE.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSSE.td
index cf57fe562ed5..df1f0b5b4ca7 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSSE.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSSE.td
@@ -215,7 +215,7 @@ multiclass sse12_move<RegisterClass RC, SDNode OpNode, ValueType vt,
let Predicates = [UseAVX, OptForSize] in
defm V#NAME : sse12_move_rr<OpNode, vt, OpcodeStr,
"\t{$src2, $src1, $dst|$dst, $src1, $src2}", d>,
- VEX_4V, VEX_LIG, WIG;
+ VEX, VVVV, VEX_LIG, WIG;
def V#NAME#mr : SI<0x11, MRMDestMem, (outs), (ins x86memop:$dst, RC:$src),
!strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
@@ -268,15 +268,15 @@ multiclass sse12_move_rm<RegisterClass RC, ValueType vt, X86MemOperand x86memop,
}
defm MOVSS : sse12_move<FR32, X86Movss, v4f32, f32mem, "movss",
- SSEPackedSingle, UseSSE1>, XS;
+ SSEPackedSingle, UseSSE1>, TB, XS;
defm MOVSD : sse12_move<FR64, X86Movsd, v2f64, f64mem, "movsd",
- SSEPackedDouble, UseSSE2>, XD;
+ SSEPackedDouble, UseSSE2>, TB, XD;
let canFoldAsLoad = 1, isReMaterializable = 1 in {
defm MOVSS : sse12_move_rm<FR32, v4f32, f32mem, loadf32, X86vzload32, "movss",
- SSEPackedSingle>, XS;
+ SSEPackedSingle>, TB, XS;
defm MOVSD : sse12_move_rm<FR64, v2f64, f64mem, loadf64, X86vzload64, "movsd",
- SSEPackedDouble>, XD;
+ SSEPackedDouble>, TB, XD;
}
// Patterns
@@ -352,46 +352,46 @@ let canFoldAsLoad = 1, isReMaterializable = 1 in
let Predicates = [HasAVX, NoVLX] in {
defm VMOVAPS : sse12_mov_packed<0x28, VR128, f128mem, alignedloadv4f32, "movaps",
SSEPackedSingle, SchedWriteFMoveLS.XMM>,
- PS, VEX, WIG;
+ TB, VEX, WIG;
defm VMOVAPD : sse12_mov_packed<0x28, VR128, f128mem, alignedloadv2f64, "movapd",
SSEPackedDouble, SchedWriteFMoveLS.XMM>,
- PD, VEX, WIG;
+ TB, PD, VEX, WIG;
defm VMOVUPS : sse12_mov_packed<0x10, VR128, f128mem, loadv4f32, "movups",
SSEPackedSingle, SchedWriteFMoveLS.XMM>,
- PS, VEX, WIG;
+ TB, VEX, WIG;
defm VMOVUPD : sse12_mov_packed<0x10, VR128, f128mem, loadv2f64, "movupd",
SSEPackedDouble, SchedWriteFMoveLS.XMM>,
- PD, VEX, WIG;
+ TB, PD, VEX, WIG;
defm VMOVAPSY : sse12_mov_packed<0x28, VR256, f256mem, alignedloadv8f32, "movaps",
SSEPackedSingle, SchedWriteFMoveLS.YMM>,
- PS, VEX, VEX_L, WIG;
+ TB, VEX, VEX_L, WIG;
defm VMOVAPDY : sse12_mov_packed<0x28, VR256, f256mem, alignedloadv4f64, "movapd",
SSEPackedDouble, SchedWriteFMoveLS.YMM>,
- PD, VEX, VEX_L, WIG;
+ TB, PD, VEX, VEX_L, WIG;
defm VMOVUPSY : sse12_mov_packed<0x10, VR256, f256mem, loadv8f32, "movups",
SSEPackedSingle, SchedWriteFMoveLS.YMM>,
- PS, VEX, VEX_L, WIG;
+ TB, VEX, VEX_L, WIG;
defm VMOVUPDY : sse12_mov_packed<0x10, VR256, f256mem, loadv4f64, "movupd",
SSEPackedDouble, SchedWriteFMoveLS.YMM>,
- PD, VEX, VEX_L, WIG;
+ TB, PD, VEX, VEX_L, WIG;
}
let Predicates = [UseSSE1] in {
defm MOVAPS : sse12_mov_packed<0x28, VR128, f128mem, alignedloadv4f32, "movaps",
SSEPackedSingle, SchedWriteFMoveLS.XMM>,
- PS;
+ TB;
defm MOVUPS : sse12_mov_packed<0x10, VR128, f128mem, loadv4f32, "movups",
SSEPackedSingle, SchedWriteFMoveLS.XMM>,
- PS;
+ TB;
}
let Predicates = [UseSSE2] in {
defm MOVAPD : sse12_mov_packed<0x28, VR128, f128mem, alignedloadv2f64, "movapd",
SSEPackedDouble, SchedWriteFMoveLS.XMM>,
- PD;
+ TB, PD;
defm MOVUPD : sse12_mov_packed<0x10, VR128, f128mem, loadv2f64, "movupd",
SSEPackedDouble, SchedWriteFMoveLS.XMM>,
- PD;
+ TB, PD;
}
let Predicates = [HasAVX, NoVLX] in {
@@ -666,7 +666,7 @@ multiclass sse12_mov_hilo_packed_base<bits<8>opc, SDPatternOperator pdnode,
def PSrm : PI<opc, MRMSrcMem,
(outs VR128:$dst), (ins VR128:$src1, f64mem:$src2),
!strconcat(base_opc, "s", asm_opr),
- [], SSEPackedSingle>, PS,
+ [], SSEPackedSingle>, TB,
Sched<[SchedWriteFShuffle.XMM.Folded, SchedWriteFShuffle.XMM.ReadAfterFold]>;
def PDrm : PI<opc, MRMSrcMem,
@@ -674,7 +674,7 @@ multiclass sse12_mov_hilo_packed_base<bits<8>opc, SDPatternOperator pdnode,
!strconcat(base_opc, "d", asm_opr),
[(set VR128:$dst, (v2f64 (pdnode VR128:$src1,
(scalar_to_vector (loadf64 addr:$src2)))))],
- SSEPackedDouble>, PD,
+ SSEPackedDouble>, TB, PD,
Sched<[SchedWriteFShuffle.XMM.Folded, SchedWriteFShuffle.XMM.ReadAfterFold]>;
}
@@ -683,7 +683,7 @@ multiclass sse12_mov_hilo_packed<bits<8>opc, SDPatternOperator pdnode,
let Predicates = [UseAVX] in
defm V#NAME : sse12_mov_hilo_packed_base<opc, pdnode, base_opc,
"\t{$src2, $src1, $dst|$dst, $src1, $src2}">,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
let Constraints = "$src1 = $dst" in
defm NAME : sse12_mov_hilo_packed_base<opc, pdnode, base_opc,
@@ -823,14 +823,14 @@ let Predicates = [UseAVX] in {
"movlhps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set VR128:$dst,
(v4f32 (X86Movlhps VR128:$src1, VR128:$src2)))]>,
- VEX_4V, Sched<[SchedWriteFShuffle.XMM]>, WIG;
+ VEX, VVVV, Sched<[SchedWriteFShuffle.XMM]>, WIG;
let isCommutable = 1 in
def VMOVHLPSrr : VPSI<0x12, MRMSrcReg, (outs VR128:$dst),
(ins VR128:$src1, VR128:$src2),
"movhlps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set VR128:$dst,
(v4f32 (X86Movhlps VR128:$src1, VR128:$src2)))]>,
- VEX_4V, Sched<[SchedWriteFShuffle.XMM]>, WIG;
+ VEX, VVVV, Sched<[SchedWriteFShuffle.XMM]>, WIG;
}
let Constraints = "$src1 = $dst" in {
def MOVLHPSrr : PSI<0x16, MRMSrcReg, (outs VR128:$dst),
@@ -903,36 +903,36 @@ let isCodeGenOnly = 1, Predicates = [UseAVX], Uses = [MXCSR], mayRaiseFPExceptio
defm VCVTTSS2SI : sse12_cvt_s<0x2C, FR32, GR32, any_fp_to_sint, f32mem, loadf32,
"cvttss2si", "cvttss2si",
WriteCvtSS2I, SSEPackedSingle>,
- XS, VEX, VEX_LIG;
+ TB, XS, VEX, VEX_LIG;
defm VCVTTSS2SI64 : sse12_cvt_s<0x2C, FR32, GR64, any_fp_to_sint, f32mem, loadf32,
"cvttss2si", "cvttss2si",
WriteCvtSS2I, SSEPackedSingle>,
- XS, VEX, REX_W, VEX_LIG;
+ TB, XS, VEX, REX_W, VEX_LIG;
defm VCVTTSD2SI : sse12_cvt_s<0x2C, FR64, GR32, any_fp_to_sint, f64mem, loadf64,
"cvttsd2si", "cvttsd2si",
WriteCvtSD2I, SSEPackedDouble>,
- XD, VEX, VEX_LIG;
+ TB, XD, VEX, VEX_LIG;
defm VCVTTSD2SI64 : sse12_cvt_s<0x2C, FR64, GR64, any_fp_to_sint, f64mem, loadf64,
"cvttsd2si", "cvttsd2si",
WriteCvtSD2I, SSEPackedDouble>,
- XD, VEX, REX_W, VEX_LIG;
+ TB, XD, VEX, REX_W, VEX_LIG;
defm VCVTSS2SI : sse12_cvt_s<0x2D, FR32, GR32, lrint, f32mem, loadf32,
"cvtss2si", "cvtss2si",
WriteCvtSS2I, SSEPackedSingle>,
- XS, VEX, VEX_LIG;
+ TB, XS, VEX, VEX_LIG;
defm VCVTSS2SI64 : sse12_cvt_s<0x2D, FR32, GR64, llrint, f32mem, loadf32,
"cvtss2si", "cvtss2si",
WriteCvtSS2I, SSEPackedSingle>,
- XS, VEX, REX_W, VEX_LIG;
+ TB, XS, VEX, REX_W, VEX_LIG;
defm VCVTSD2SI : sse12_cvt_s<0x2D, FR64, GR32, lrint, f64mem, loadf64,
"cvtsd2si", "cvtsd2si",
WriteCvtSD2I, SSEPackedDouble>,
- XD, VEX, VEX_LIG;
+ TB, XD, VEX, VEX_LIG;
defm VCVTSD2SI64 : sse12_cvt_s<0x2D, FR64, GR64, llrint, f64mem, loadf64,
"cvtsd2si", "cvtsd2si",
WriteCvtSD2I, SSEPackedDouble>,
- XD, VEX, REX_W, VEX_LIG;
+ TB, XD, VEX, REX_W, VEX_LIG;
}
// The assembler can recognize rr 64-bit instructions by seeing a rxx
@@ -941,16 +941,16 @@ defm VCVTSD2SI64 : sse12_cvt_s<0x2D, FR64, GR64, llrint, f64mem, loadf64,
// where appropriate to do so.
let isCodeGenOnly = 1 in {
defm VCVTSI2SS : sse12_vcvt_avx<0x2A, GR32, FR32, i32mem, "cvtsi2ss", "l",
- WriteCvtI2SS, SSEPackedSingle>, XS, VEX_4V,
+ WriteCvtI2SS, SSEPackedSingle>, TB, XS, VEX, VVVV,
VEX_LIG, SIMD_EXC;
defm VCVTSI642SS : sse12_vcvt_avx<0x2A, GR64, FR32, i64mem, "cvtsi2ss", "q",
- WriteCvtI2SS, SSEPackedSingle>, XS, VEX_4V,
+ WriteCvtI2SS, SSEPackedSingle>, TB, XS, VEX, VVVV,
REX_W, VEX_LIG, SIMD_EXC;
defm VCVTSI2SD : sse12_vcvt_avx<0x2A, GR32, FR64, i32mem, "cvtsi2sd", "l",
- WriteCvtI2SD, SSEPackedDouble>, XD, VEX_4V,
+ WriteCvtI2SD, SSEPackedDouble>, TB, XD, VEX, VVVV,
VEX_LIG;
defm VCVTSI642SD : sse12_vcvt_avx<0x2A, GR64, FR64, i64mem, "cvtsi2sd", "q",
- WriteCvtI2SD, SSEPackedDouble>, XD, VEX_4V,
+ WriteCvtI2SD, SSEPackedDouble>, TB, XD, VEX, VVVV,
REX_W, VEX_LIG, SIMD_EXC;
} // isCodeGenOnly = 1
@@ -983,42 +983,42 @@ let Predicates = [UseAVX] in {
let isCodeGenOnly = 1 in {
defm CVTTSS2SI : sse12_cvt_s<0x2C, FR32, GR32, any_fp_to_sint, f32mem, loadf32,
"cvttss2si", "cvttss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, SIMD_EXC;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, SIMD_EXC;
defm CVTTSS2SI64 : sse12_cvt_s<0x2C, FR32, GR64, any_fp_to_sint, f32mem, loadf32,
"cvttss2si", "cvttss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, REX_W, SIMD_EXC;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, REX_W, SIMD_EXC;
defm CVTTSD2SI : sse12_cvt_s<0x2C, FR64, GR32, any_fp_to_sint, f64mem, loadf64,
"cvttsd2si", "cvttsd2si",
- WriteCvtSD2I, SSEPackedDouble>, XD, SIMD_EXC;
+ WriteCvtSD2I, SSEPackedDouble>, TB, XD, SIMD_EXC;
defm CVTTSD2SI64 : sse12_cvt_s<0x2C, FR64, GR64, any_fp_to_sint, f64mem, loadf64,
"cvttsd2si", "cvttsd2si",
- WriteCvtSD2I, SSEPackedDouble>, XD, REX_W, SIMD_EXC;
+ WriteCvtSD2I, SSEPackedDouble>, TB, XD, REX_W, SIMD_EXC;
defm CVTSS2SI : sse12_cvt_s<0x2D, FR32, GR32, lrint, f32mem, loadf32,
"cvtss2si", "cvtss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, SIMD_EXC;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, SIMD_EXC;
defm CVTSS2SI64 : sse12_cvt_s<0x2D, FR32, GR64, llrint, f32mem, loadf32,
"cvtss2si", "cvtss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, REX_W, SIMD_EXC;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, REX_W, SIMD_EXC;
defm CVTSD2SI : sse12_cvt_s<0x2D, FR64, GR32, lrint, f64mem, loadf64,
"cvtsd2si", "cvtsd2si",
- WriteCvtSD2I, SSEPackedDouble>, XD, SIMD_EXC;
+ WriteCvtSD2I, SSEPackedDouble>, TB, XD, SIMD_EXC;
defm CVTSD2SI64 : sse12_cvt_s<0x2D, FR64, GR64, llrint, f64mem, loadf64,
"cvtsd2si", "cvtsd2si",
- WriteCvtSD2I, SSEPackedDouble>, XD, REX_W, SIMD_EXC;
+ WriteCvtSD2I, SSEPackedDouble>, TB, XD, REX_W, SIMD_EXC;
defm CVTSI2SS : sse12_cvt_s<0x2A, GR32, FR32, any_sint_to_fp, i32mem, loadi32,
"cvtsi2ss", "cvtsi2ss{l}",
- WriteCvtI2SS, SSEPackedSingle, ReadInt2Fpu>, XS, SIMD_EXC;
+ WriteCvtI2SS, SSEPackedSingle, ReadInt2Fpu>, TB, XS, SIMD_EXC;
defm CVTSI642SS : sse12_cvt_s<0x2A, GR64, FR32, any_sint_to_fp, i64mem, loadi64,
"cvtsi2ss", "cvtsi2ss{q}",
- WriteCvtI2SS, SSEPackedSingle, ReadInt2Fpu>, XS, REX_W, SIMD_EXC;
+ WriteCvtI2SS, SSEPackedSingle, ReadInt2Fpu>, TB, XS, REX_W, SIMD_EXC;
defm CVTSI2SD : sse12_cvt_s<0x2A, GR32, FR64, any_sint_to_fp, i32mem, loadi32,
"cvtsi2sd", "cvtsi2sd{l}",
- WriteCvtI2SD, SSEPackedDouble, ReadInt2Fpu>, XD;
+ WriteCvtI2SD, SSEPackedDouble, ReadInt2Fpu>, TB, XD;
defm CVTSI642SD : sse12_cvt_s<0x2A, GR64, FR64, any_sint_to_fp, i64mem, loadi64,
"cvtsi2sd", "cvtsi2sd{q}",
- WriteCvtI2SD, SSEPackedDouble, ReadInt2Fpu>, XD, REX_W, SIMD_EXC;
+ WriteCvtI2SD, SSEPackedDouble, ReadInt2Fpu>, TB, XD, REX_W, SIMD_EXC;
} // isCodeGenOnly = 1
let Predicates = [UseSSE1] in {
@@ -1074,46 +1074,46 @@ let Uses = [MXCSR], mayRaiseFPException = 1 in {
let Predicates = [UseAVX] in {
defm VCVTSD2SI : sse12_cvt_sint<0x2D, VR128, GR32, i32, v2f64,
X86cvts2si, sdmem, sse_load_f64, "cvtsd2si",
- WriteCvtSD2I, SSEPackedDouble>, XD, VEX, VEX_LIG;
+ WriteCvtSD2I, SSEPackedDouble>, TB, XD, VEX, VEX_LIG;
defm VCVTSD2SI64 : sse12_cvt_sint<0x2D, VR128, GR64, i64, v2f64,
X86cvts2si, sdmem, sse_load_f64, "cvtsd2si",
- WriteCvtSD2I, SSEPackedDouble>, XD, VEX, REX_W, VEX_LIG;
+ WriteCvtSD2I, SSEPackedDouble>, TB, XD, VEX, REX_W, VEX_LIG;
}
defm CVTSD2SI : sse12_cvt_sint<0x2D, VR128, GR32, i32, v2f64, X86cvts2si,
sdmem, sse_load_f64, "cvtsd2si", WriteCvtSD2I,
- SSEPackedDouble>, XD;
+ SSEPackedDouble>, TB, XD;
defm CVTSD2SI64 : sse12_cvt_sint<0x2D, VR128, GR64, i64, v2f64, X86cvts2si,
sdmem, sse_load_f64, "cvtsd2si", WriteCvtSD2I,
- SSEPackedDouble>, XD, REX_W;
+ SSEPackedDouble>, TB, XD, REX_W;
}
let Predicates = [UseAVX] in {
defm VCVTSI2SS : sse12_cvt_sint_3addr<0x2A, GR32, VR128,
i32mem, "cvtsi2ss", "l", WriteCvtI2SS, SSEPackedSingle, 0>,
- XS, VEX_4V, VEX_LIG, SIMD_EXC;
+ TB, XS, VEX, VVVV, VEX_LIG, SIMD_EXC;
defm VCVTSI642SS : sse12_cvt_sint_3addr<0x2A, GR64, VR128,
i64mem, "cvtsi2ss", "q", WriteCvtI2SS, SSEPackedSingle, 0>,
- XS, VEX_4V, VEX_LIG, REX_W, SIMD_EXC;
+ TB, XS, VEX, VVVV, VEX_LIG, REX_W, SIMD_EXC;
defm VCVTSI2SD : sse12_cvt_sint_3addr<0x2A, GR32, VR128,
i32mem, "cvtsi2sd", "l", WriteCvtI2SD, SSEPackedDouble, 0>,
- XD, VEX_4V, VEX_LIG;
+ TB, XD, VEX, VVVV, VEX_LIG;
defm VCVTSI642SD : sse12_cvt_sint_3addr<0x2A, GR64, VR128,
i64mem, "cvtsi2sd", "q", WriteCvtI2SD, SSEPackedDouble, 0>,
- XD, VEX_4V, VEX_LIG, REX_W, SIMD_EXC;
+ TB, XD, VEX, VVVV, VEX_LIG, REX_W, SIMD_EXC;
}
let Constraints = "$src1 = $dst" in {
defm CVTSI2SS : sse12_cvt_sint_3addr<0x2A, GR32, VR128,
i32mem, "cvtsi2ss", "l", WriteCvtI2SS, SSEPackedSingle>,
- XS, SIMD_EXC;
+ TB, XS, SIMD_EXC;
defm CVTSI642SS : sse12_cvt_sint_3addr<0x2A, GR64, VR128,
i64mem, "cvtsi2ss", "q", WriteCvtI2SS, SSEPackedSingle>,
- XS, REX_W, SIMD_EXC;
+ TB, XS, REX_W, SIMD_EXC;
defm CVTSI2SD : sse12_cvt_sint_3addr<0x2A, GR32, VR128,
i32mem, "cvtsi2sd", "l", WriteCvtI2SD, SSEPackedDouble>,
- XD;
+ TB, XD;
defm CVTSI642SD : sse12_cvt_sint_3addr<0x2A, GR64, VR128,
i64mem, "cvtsi2sd", "q", WriteCvtI2SD, SSEPackedDouble>,
- XD, REX_W, SIMD_EXC;
+ TB, XD, REX_W, SIMD_EXC;
}
def : InstAlias<"vcvtsi2ss{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
@@ -1150,34 +1150,34 @@ def : InstAlias<"cvtsi2sd\t{$src, $dst|$dst, $src}",
let Predicates = [UseAVX], Uses = [MXCSR], mayRaiseFPException = 1 in {
defm VCVTTSS2SI : sse12_cvt_sint<0x2C, VR128, GR32, i32, v4f32, X86cvtts2Int,
ssmem, sse_load_f32, "cvttss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, VEX, VEX_LIG;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, VEX, VEX_LIG;
defm VCVTTSS2SI64 : sse12_cvt_sint<0x2C, VR128, GR64, i64, v4f32,
X86cvtts2Int, ssmem, sse_load_f32,
"cvttss2si", WriteCvtSS2I, SSEPackedSingle>,
- XS, VEX, VEX_LIG, REX_W;
+ TB, XS, VEX, VEX_LIG, REX_W;
defm VCVTTSD2SI : sse12_cvt_sint<0x2C, VR128, GR32, i32, v2f64, X86cvtts2Int,
sdmem, sse_load_f64, "cvttsd2si",
- WriteCvtSS2I, SSEPackedDouble>, XD, VEX, VEX_LIG;
+ WriteCvtSS2I, SSEPackedDouble>, TB, XD, VEX, VEX_LIG;
defm VCVTTSD2SI64 : sse12_cvt_sint<0x2C, VR128, GR64, i64, v2f64,
X86cvtts2Int, sdmem, sse_load_f64,
"cvttsd2si", WriteCvtSS2I, SSEPackedDouble>,
- XD, VEX, VEX_LIG, REX_W;
+ TB, XD, VEX, VEX_LIG, REX_W;
}
let Uses = [MXCSR], mayRaiseFPException = 1 in {
defm CVTTSS2SI : sse12_cvt_sint<0x2C, VR128, GR32, i32, v4f32, X86cvtts2Int,
ssmem, sse_load_f32, "cvttss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS;
defm CVTTSS2SI64 : sse12_cvt_sint<0x2C, VR128, GR64, i64, v4f32,
X86cvtts2Int, ssmem, sse_load_f32,
"cvttss2si", WriteCvtSS2I, SSEPackedSingle>,
- XS, REX_W;
+ TB, XS, REX_W;
defm CVTTSD2SI : sse12_cvt_sint<0x2C, VR128, GR32, i32, v2f64, X86cvtts2Int,
sdmem, sse_load_f64, "cvttsd2si",
- WriteCvtSD2I, SSEPackedDouble>, XD;
+ WriteCvtSD2I, SSEPackedDouble>, TB, XD;
defm CVTTSD2SI64 : sse12_cvt_sint<0x2C, VR128, GR64, i64, v2f64,
X86cvtts2Int, sdmem, sse_load_f64,
"cvttsd2si", WriteCvtSD2I, SSEPackedDouble>,
- XD, REX_W;
+ TB, XD, REX_W;
}
def : InstAlias<"vcvttss2si{l}\t{$src, $dst|$dst, $src}",
@@ -1217,32 +1217,32 @@ def : InstAlias<"cvttsd2si{q}\t{$src, $dst|$dst, $src}",
let Predicates = [UseAVX], Uses = [MXCSR], mayRaiseFPException = 1 in {
defm VCVTSS2SI : sse12_cvt_sint<0x2D, VR128, GR32, i32, v4f32, X86cvts2si,
ssmem, sse_load_f32, "cvtss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, VEX, VEX_LIG;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, VEX, VEX_LIG;
defm VCVTSS2SI64 : sse12_cvt_sint<0x2D, VR128, GR64, i64, v4f32, X86cvts2si,
ssmem, sse_load_f32, "cvtss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, VEX, REX_W, VEX_LIG;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, VEX, REX_W, VEX_LIG;
}
let Uses = [MXCSR], mayRaiseFPException = 1 in {
defm CVTSS2SI : sse12_cvt_sint<0x2D, VR128, GR32, i32, v4f32, X86cvts2si,
ssmem, sse_load_f32, "cvtss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS;
defm CVTSS2SI64 : sse12_cvt_sint<0x2D, VR128, GR64, i64, v4f32, X86cvts2si,
ssmem, sse_load_f32, "cvtss2si",
- WriteCvtSS2I, SSEPackedSingle>, XS, REX_W;
+ WriteCvtSS2I, SSEPackedSingle>, TB, XS, REX_W;
defm VCVTDQ2PS : sse12_cvt_p<0x5B, VR128, i128mem, v4f32, v4i32, load,
"vcvtdq2ps\t{$src, $dst|$dst, $src}",
SSEPackedSingle, WriteCvtI2PS>,
- PS, VEX, Requires<[HasAVX, NoVLX]>, WIG;
+ TB, VEX, Requires<[HasAVX, NoVLX]>, WIG;
defm VCVTDQ2PSY : sse12_cvt_p<0x5B, VR256, i256mem, v8f32, v8i32, load,
"vcvtdq2ps\t{$src, $dst|$dst, $src}",
SSEPackedSingle, WriteCvtI2PSY>,
- PS, VEX, VEX_L, Requires<[HasAVX, NoVLX]>, WIG;
+ TB, VEX, VEX_L, Requires<[HasAVX, NoVLX]>, WIG;
defm CVTDQ2PS : sse12_cvt_p<0x5B, VR128, i128mem, v4f32, v4i32, memop,
"cvtdq2ps\t{$src, $dst|$dst, $src}",
SSEPackedSingle, WriteCvtI2PS>,
- PS, Requires<[UseSSE2]>;
+ TB, Requires<[UseSSE2]>;
}
// AVX aliases
@@ -1289,13 +1289,13 @@ let isCodeGenOnly = 1, hasSideEffects = 0, Predicates = [UseAVX],
def VCVTSD2SSrr : VSDI<0x5A, MRMSrcReg, (outs FR32:$dst),
(ins FR32:$src1, FR64:$src2),
"cvtsd2ss\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- VEX_4V, VEX_LIG, WIG,
+ VEX, VVVV, VEX_LIG, WIG,
Sched<[WriteCvtSD2SS]>, SIMD_EXC;
let mayLoad = 1 in
def VCVTSD2SSrm : I<0x5A, MRMSrcMem, (outs FR32:$dst),
(ins FR32:$src1, f64mem:$src2),
"vcvtsd2ss\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- XD, VEX_4V, VEX_LIG, WIG,
+ TB, XD, VEX, VVVV, VEX_LIG, WIG,
Sched<[WriteCvtSD2SS.Folded, WriteCvtSD2SS.ReadAfterFold]>, SIMD_EXC;
}
@@ -1311,7 +1311,7 @@ def CVTSD2SSrr : SDI<0x5A, MRMSrcReg, (outs FR32:$dst), (ins FR64:$src),
def CVTSD2SSrm : I<0x5A, MRMSrcMem, (outs FR32:$dst), (ins f64mem:$src),
"cvtsd2ss\t{$src, $dst|$dst, $src}",
[(set FR32:$dst, (any_fpround (loadf64 addr:$src)))]>,
- XD, Requires<[UseSSE2, OptForSize]>,
+ TB, XD, Requires<[UseSSE2, OptForSize]>,
Sched<[WriteCvtSD2SS.Folded, WriteCvtSD2SS.ReadAfterFold]>, SIMD_EXC;
}
@@ -1321,14 +1321,14 @@ def VCVTSD2SSrr_Int: I<0x5A, MRMSrcReg,
"vcvtsd2ss\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set VR128:$dst,
(v4f32 (X86frounds VR128:$src1, (v2f64 VR128:$src2))))]>,
- XD, VEX_4V, VEX_LIG, WIG, Requires<[UseAVX]>,
+ TB, XD, VEX, VVVV, VEX_LIG, WIG, Requires<[UseAVX]>,
Sched<[WriteCvtSD2SS]>;
def VCVTSD2SSrm_Int: I<0x5A, MRMSrcMem,
(outs VR128:$dst), (ins VR128:$src1, sdmem:$src2),
"vcvtsd2ss\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set VR128:$dst,
(v4f32 (X86frounds VR128:$src1, (sse_load_f64 addr:$src2))))]>,
- XD, VEX_4V, VEX_LIG, WIG, Requires<[UseAVX]>,
+ TB, XD, VEX, VVVV, VEX_LIG, WIG, Requires<[UseAVX]>,
Sched<[WriteCvtSD2SS.Folded, WriteCvtSD2SS.ReadAfterFold]>;
let Constraints = "$src1 = $dst" in {
def CVTSD2SSrr_Int: I<0x5A, MRMSrcReg,
@@ -1336,13 +1336,13 @@ def CVTSD2SSrr_Int: I<0x5A, MRMSrcReg,
"cvtsd2ss\t{$src2, $dst|$dst, $src2}",
[(set VR128:$dst,
(v4f32 (X86frounds VR128:$src1, (v2f64 VR128:$src2))))]>,
- XD, Requires<[UseSSE2]>, Sched<[WriteCvtSD2SS]>;
+ TB, XD, Requires<[UseSSE2]>, Sched<[WriteCvtSD2SS]>;
def CVTSD2SSrm_Int: I<0x5A, MRMSrcMem,
(outs VR128:$dst), (ins VR128:$src1, sdmem:$src2),
"cvtsd2ss\t{$src2, $dst|$dst, $src2}",
[(set VR128:$dst,
(v4f32 (X86frounds VR128:$src1, (sse_load_f64 addr:$src2))))]>,
- XD, Requires<[UseSSE2]>,
+ TB, XD, Requires<[UseSSE2]>,
Sched<[WriteCvtSD2SS.Folded, WriteCvtSD2SS.ReadAfterFold]>;
}
}
@@ -1353,13 +1353,13 @@ let isCodeGenOnly = 1, hasSideEffects = 0, ExeDomain = SSEPackedSingle in {
def VCVTSS2SDrr : I<0x5A, MRMSrcReg, (outs FR64:$dst),
(ins FR64:$src1, FR32:$src2),
"vcvtss2sd\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- XS, VEX_4V, VEX_LIG, WIG,
+ TB, XS, VEX, VVVV, VEX_LIG, WIG,
Sched<[WriteCvtSS2SD]>, Requires<[UseAVX]>, SIMD_EXC;
let mayLoad = 1 in
def VCVTSS2SDrm : I<0x5A, MRMSrcMem, (outs FR64:$dst),
(ins FR64:$src1, f32mem:$src2),
"vcvtss2sd\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- XS, VEX_4V, VEX_LIG, WIG,
+ TB, XS, VEX, VVVV, VEX_LIG, WIG,
Sched<[WriteCvtSS2SD.Folded, WriteCvtSS2SD.ReadAfterFold]>,
Requires<[UseAVX, OptForSize]>, SIMD_EXC;
} // isCodeGenOnly = 1, hasSideEffects = 0
@@ -1373,11 +1373,11 @@ let isCodeGenOnly = 1, ExeDomain = SSEPackedSingle in {
def CVTSS2SDrr : I<0x5A, MRMSrcReg, (outs FR64:$dst), (ins FR32:$src),
"cvtss2sd\t{$src, $dst|$dst, $src}",
[(set FR64:$dst, (any_fpextend FR32:$src))]>,
- XS, Requires<[UseSSE2]>, Sched<[WriteCvtSS2SD]>, SIMD_EXC;
+ TB, XS, Requires<[UseSSE2]>, Sched<[WriteCvtSS2SD]>, SIMD_EXC;
def CVTSS2SDrm : I<0x5A, MRMSrcMem, (outs FR64:$dst), (ins f32mem:$src),
"cvtss2sd\t{$src, $dst|$dst, $src}",
[(set FR64:$dst, (any_fpextend (loadf32 addr:$src)))]>,
- XS, Requires<[UseSSE2, OptForSize]>,
+ TB, XS, Requires<[UseSSE2, OptForSize]>,
Sched<[WriteCvtSS2SD.Folded, WriteCvtSS2SD.ReadAfterFold]>, SIMD_EXC;
} // isCodeGenOnly = 1
@@ -1386,25 +1386,25 @@ let hasSideEffects = 0, Uses = [MXCSR], mayRaiseFPException = 1,
def VCVTSS2SDrr_Int: I<0x5A, MRMSrcReg,
(outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
"vcvtss2sd\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- []>, XS, VEX_4V, VEX_LIG, WIG,
+ []>, TB, XS, VEX, VVVV, VEX_LIG, WIG,
Requires<[HasAVX]>, Sched<[WriteCvtSS2SD]>;
let mayLoad = 1 in
def VCVTSS2SDrm_Int: I<0x5A, MRMSrcMem,
(outs VR128:$dst), (ins VR128:$src1, ssmem:$src2),
"vcvtss2sd\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- []>, XS, VEX_4V, VEX_LIG, WIG, Requires<[HasAVX]>,
+ []>, TB, XS, VEX, VVVV, VEX_LIG, WIG, Requires<[HasAVX]>,
Sched<[WriteCvtSS2SD.Folded, WriteCvtSS2SD.ReadAfterFold]>;
let Constraints = "$src1 = $dst" in { // SSE2 instructions with XS prefix
def CVTSS2SDrr_Int: I<0x5A, MRMSrcReg,
(outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
"cvtss2sd\t{$src2, $dst|$dst, $src2}",
- []>, XS, Requires<[UseSSE2]>,
+ []>, TB, XS, Requires<[UseSSE2]>,
Sched<[WriteCvtSS2SD]>;
let mayLoad = 1 in
def CVTSS2SDrm_Int: I<0x5A, MRMSrcMem,
(outs VR128:$dst), (ins VR128:$src1, ssmem:$src2),
"cvtss2sd\t{$src2, $dst|$dst, $src2}",
- []>, XS, Requires<[UseSSE2]>,
+ []>, TB, XS, Requires<[UseSSE2]>,
Sched<[WriteCvtSS2SD.Folded, WriteCvtSS2SD.ReadAfterFold]>;
}
} // hasSideEffects = 0
@@ -1699,30 +1699,30 @@ let Predicates = [HasAVX, NoVLX], Uses = [MXCSR], mayRaiseFPException = 1 in {
def VCVTPS2PDrr : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
"vcvtps2pd\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (v2f64 (X86any_vfpext (v4f32 VR128:$src))))]>,
- PS, VEX, Sched<[WriteCvtPS2PD]>, WIG;
+ TB, VEX, Sched<[WriteCvtPS2PD]>, WIG;
def VCVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src),
"vcvtps2pd\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (v2f64 (extloadv2f32 addr:$src)))]>,
- PS, VEX, Sched<[WriteCvtPS2PD.Folded]>, WIG;
+ TB, VEX, Sched<[WriteCvtPS2PD.Folded]>, WIG;
def VCVTPS2PDYrr : I<0x5A, MRMSrcReg, (outs VR256:$dst), (ins VR128:$src),
"vcvtps2pd\t{$src, $dst|$dst, $src}",
[(set VR256:$dst, (v4f64 (any_fpextend (v4f32 VR128:$src))))]>,
- PS, VEX, VEX_L, Sched<[WriteCvtPS2PDY]>, WIG;
+ TB, VEX, VEX_L, Sched<[WriteCvtPS2PDY]>, WIG;
def VCVTPS2PDYrm : I<0x5A, MRMSrcMem, (outs VR256:$dst), (ins f128mem:$src),
"vcvtps2pd\t{$src, $dst|$dst, $src}",
[(set VR256:$dst, (v4f64 (extloadv4f32 addr:$src)))]>,
- PS, VEX, VEX_L, Sched<[WriteCvtPS2PDY.Folded]>, WIG;
+ TB, VEX, VEX_L, Sched<[WriteCvtPS2PDY.Folded]>, WIG;
}
let Predicates = [UseSSE2], Uses = [MXCSR], mayRaiseFPException = 1 in {
def CVTPS2PDrr : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
"cvtps2pd\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (v2f64 (X86any_vfpext (v4f32 VR128:$src))))]>,
- PS, Sched<[WriteCvtPS2PD]>;
+ TB, Sched<[WriteCvtPS2PD]>;
def CVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src),
"cvtps2pd\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (v2f64 (extloadv2f32 addr:$src)))]>,
- PS, Sched<[WriteCvtPS2PD.Folded]>;
+ TB, Sched<[WriteCvtPS2PD.Folded]>;
}
// Convert Packed DW Integers to Packed Double FP
@@ -1860,22 +1860,22 @@ let ExeDomain = SSEPackedSingle in
defm VCMPSS : sse12_cmp_scalar<FR32, f32mem, ssmem, X86cmps, v4f32, loadf32,
"cmpss\t{$cc, $src2, $src1, $dst|$dst, $src1, $src2, $cc}",
SchedWriteFCmpSizes.PS.Scl, sse_load_f32>,
- XS, VEX_4V, VEX_LIG, WIG;
+ TB, XS, VEX, VVVV, VEX_LIG, WIG;
let ExeDomain = SSEPackedDouble in
defm VCMPSD : sse12_cmp_scalar<FR64, f64mem, sdmem, X86cmps, v2f64, loadf64,
"cmpsd\t{$cc, $src2, $src1, $dst|$dst, $src1, $src2, $cc}",
SchedWriteFCmpSizes.PD.Scl, sse_load_f64>,
- XD, VEX_4V, VEX_LIG, WIG;
+ TB, XD, VEX, VVVV, VEX_LIG, WIG;
let Constraints = "$src1 = $dst" in {
let ExeDomain = SSEPackedSingle in
defm CMPSS : sse12_cmp_scalar<FR32, f32mem, ssmem, X86cmps, v4f32, loadf32,
"cmpss\t{$cc, $src2, $dst|$dst, $src2, $cc}",
- SchedWriteFCmpSizes.PS.Scl, sse_load_f32>, XS;
+ SchedWriteFCmpSizes.PS.Scl, sse_load_f32>, TB, XS;
let ExeDomain = SSEPackedDouble in
defm CMPSD : sse12_cmp_scalar<FR64, f64mem, sdmem, X86cmps, v2f64, loadf64,
"cmpsd\t{$cc, $src2, $dst|$dst, $src2, $cc}",
- SchedWriteFCmpSizes.PD.Scl, sse_load_f64>, XD;
+ SchedWriteFCmpSizes.PD.Scl, sse_load_f64>, TB, XD;
}
// sse12_ord_cmp - Unordered/Ordered scalar fp compare and set EFLAGS
@@ -1919,44 +1919,44 @@ let mayLoad = 1 in
let Defs = [EFLAGS] in {
defm VUCOMISS : sse12_ord_cmp<0x2E, FR32, X86any_fcmp, f32, f32mem, loadf32,
- "ucomiss", SSEPackedSingle>, PS, VEX, VEX_LIG, WIG;
+ "ucomiss", SSEPackedSingle>, TB, VEX, VEX_LIG, WIG;
defm VUCOMISD : sse12_ord_cmp<0x2E, FR64, X86any_fcmp, f64, f64mem, loadf64,
- "ucomisd", SSEPackedDouble>, PD, VEX, VEX_LIG, WIG;
+ "ucomisd", SSEPackedDouble>, TB, PD, VEX, VEX_LIG, WIG;
defm VCOMISS : sse12_ord_cmp<0x2F, FR32, X86strict_fcmps, f32, f32mem, loadf32,
- "comiss", SSEPackedSingle>, PS, VEX, VEX_LIG, WIG;
+ "comiss", SSEPackedSingle>, TB, VEX, VEX_LIG, WIG;
defm VCOMISD : sse12_ord_cmp<0x2F, FR64, X86strict_fcmps, f64, f64mem, loadf64,
- "comisd", SSEPackedDouble>, PD, VEX, VEX_LIG, WIG;
+ "comisd", SSEPackedDouble>, TB, PD, VEX, VEX_LIG, WIG;
let isCodeGenOnly = 1 in {
defm VUCOMISS : sse12_ord_cmp_int<0x2E, VR128, X86ucomi, v4f32, ssmem,
- sse_load_f32, "ucomiss", SSEPackedSingle>, PS, VEX, VEX_LIG, WIG;
+ sse_load_f32, "ucomiss", SSEPackedSingle>, TB, VEX, VEX_LIG, WIG;
defm VUCOMISD : sse12_ord_cmp_int<0x2E, VR128, X86ucomi, v2f64, sdmem,
- sse_load_f64, "ucomisd", SSEPackedDouble>, PD, VEX, VEX_LIG, WIG;
+ sse_load_f64, "ucomisd", SSEPackedDouble>, TB, PD, VEX, VEX_LIG, WIG;
defm VCOMISS : sse12_ord_cmp_int<0x2F, VR128, X86comi, v4f32, ssmem,
- sse_load_f32, "comiss", SSEPackedSingle>, PS, VEX, VEX_LIG, WIG;
+ sse_load_f32, "comiss", SSEPackedSingle>, TB, VEX, VEX_LIG, WIG;
defm VCOMISD : sse12_ord_cmp_int<0x2F, VR128, X86comi, v2f64, sdmem,
- sse_load_f64, "comisd", SSEPackedDouble>, PD, VEX, VEX_LIG, WIG;
+ sse_load_f64, "comisd", SSEPackedDouble>, TB, PD, VEX, VEX_LIG, WIG;
}
defm UCOMISS : sse12_ord_cmp<0x2E, FR32, X86any_fcmp, f32, f32mem, loadf32,
- "ucomiss", SSEPackedSingle>, PS;
+ "ucomiss", SSEPackedSingle>, TB;
defm UCOMISD : sse12_ord_cmp<0x2E, FR64, X86any_fcmp, f64, f64mem, loadf64,
- "ucomisd", SSEPackedDouble>, PD;
+ "ucomisd", SSEPackedDouble>, TB, PD;
defm COMISS : sse12_ord_cmp<0x2F, FR32, X86strict_fcmps, f32, f32mem, loadf32,
- "comiss", SSEPackedSingle>, PS;
+ "comiss", SSEPackedSingle>, TB;
defm COMISD : sse12_ord_cmp<0x2F, FR64, X86strict_fcmps, f64, f64mem, loadf64,
- "comisd", SSEPackedDouble>, PD;
+ "comisd", SSEPackedDouble>, TB, PD;
let isCodeGenOnly = 1 in {
defm UCOMISS : sse12_ord_cmp_int<0x2E, VR128, X86ucomi, v4f32, ssmem,
- sse_load_f32, "ucomiss", SSEPackedSingle>, PS;
+ sse_load_f32, "ucomiss", SSEPackedSingle>, TB;
defm UCOMISD : sse12_ord_cmp_int<0x2E, VR128, X86ucomi, v2f64, sdmem,
- sse_load_f64, "ucomisd", SSEPackedDouble>, PD;
+ sse_load_f64, "ucomisd", SSEPackedDouble>, TB, PD;
defm COMISS : sse12_ord_cmp_int<0x2F, VR128, X86comi, v4f32, ssmem,
- sse_load_f32, "comiss", SSEPackedSingle>, PS;
+ sse_load_f32, "comiss", SSEPackedSingle>, TB;
defm COMISD : sse12_ord_cmp_int<0x2F, VR128, X86comi, v2f64, sdmem,
- sse_load_f64, "comisd", SSEPackedDouble>, PD;
+ sse_load_f64, "comisd", SSEPackedDouble>, TB, PD;
}
} // Defs = [EFLAGS]
@@ -1979,23 +1979,23 @@ multiclass sse12_cmp_packed<RegisterClass RC, X86MemOperand x86memop,
defm VCMPPS : sse12_cmp_packed<VR128, f128mem, v4f32,
"cmpps\t{$cc, $src2, $src1, $dst|$dst, $src1, $src2, $cc}",
- SchedWriteFCmpSizes.PS.XMM, SSEPackedSingle, loadv4f32>, PS, VEX_4V, WIG;
+ SchedWriteFCmpSizes.PS.XMM, SSEPackedSingle, loadv4f32>, TB, VEX, VVVV, WIG;
defm VCMPPD : sse12_cmp_packed<VR128, f128mem, v2f64,
"cmppd\t{$cc, $src2, $src1, $dst|$dst, $src1, $src2, $cc}",
- SchedWriteFCmpSizes.PD.XMM, SSEPackedDouble, loadv2f64>, PD, VEX_4V, WIG;
+ SchedWriteFCmpSizes.PD.XMM, SSEPackedDouble, loadv2f64>, TB, PD, VEX, VVVV, WIG;
defm VCMPPSY : sse12_cmp_packed<VR256, f256mem, v8f32,
"cmpps\t{$cc, $src2, $src1, $dst|$dst, $src1, $src2, $cc}",
- SchedWriteFCmpSizes.PS.YMM, SSEPackedSingle, loadv8f32>, PS, VEX_4V, VEX_L, WIG;
+ SchedWriteFCmpSizes.PS.YMM, SSEPackedSingle, loadv8f32>, TB, VEX, VVVV, VEX_L, WIG;
defm VCMPPDY : sse12_cmp_packed<VR256, f256mem, v4f64,
"cmppd\t{$cc, $src2, $src1, $dst|$dst, $src1, $src2, $cc}",
- SchedWriteFCmpSizes.PD.YMM, SSEPackedDouble, loadv4f64>, PD, VEX_4V, VEX_L, WIG;
+ SchedWriteFCmpSizes.PD.YMM, SSEPackedDouble, loadv4f64>, TB, PD, VEX, VVVV, VEX_L, WIG;
let Constraints = "$src1 = $dst" in {
defm CMPPS : sse12_cmp_packed<VR128, f128mem, v4f32,
"cmpps\t{$cc, $src2, $dst|$dst, $src2, $cc}",
- SchedWriteFCmpSizes.PS.XMM, SSEPackedSingle, memopv4f32>, PS;
+ SchedWriteFCmpSizes.PS.XMM, SSEPackedSingle, memopv4f32>, TB;
defm CMPPD : sse12_cmp_packed<VR128, f128mem, v2f64,
"cmppd\t{$cc, $src2, $dst|$dst, $src2, $cc}",
- SchedWriteFCmpSizes.PD.XMM, SSEPackedDouble, memopv2f64>, PD;
+ SchedWriteFCmpSizes.PD.XMM, SSEPackedDouble, memopv2f64>, TB, PD;
}
def CommutableCMPCC : PatLeaf<(timm), [{
@@ -2076,27 +2076,27 @@ let Predicates = [HasAVX, NoVLX] in {
defm VSHUFPS : sse12_shuffle<VR128, f128mem, v4f32,
"shufps\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
loadv4f32, SchedWriteFShuffle.XMM, SSEPackedSingle>,
- PS, VEX_4V, WIG;
+ TB, VEX, VVVV, WIG;
defm VSHUFPSY : sse12_shuffle<VR256, f256mem, v8f32,
"shufps\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
loadv8f32, SchedWriteFShuffle.YMM, SSEPackedSingle>,
- PS, VEX_4V, VEX_L, WIG;
+ TB, VEX, VVVV, VEX_L, WIG;
defm VSHUFPD : sse12_shuffle<VR128, f128mem, v2f64,
"shufpd\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
loadv2f64, SchedWriteFShuffle.XMM, SSEPackedDouble>,
- PD, VEX_4V, WIG;
+ TB, PD, VEX, VVVV, WIG;
defm VSHUFPDY : sse12_shuffle<VR256, f256mem, v4f64,
"shufpd\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
loadv4f64, SchedWriteFShuffle.YMM, SSEPackedDouble>,
- PD, VEX_4V, VEX_L, WIG;
+ TB, PD, VEX, VVVV, VEX_L, WIG;
}
let Constraints = "$src1 = $dst" in {
defm SHUFPS : sse12_shuffle<VR128, f128mem, v4f32,
"shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}",
- memopv4f32, SchedWriteFShuffle.XMM, SSEPackedSingle>, PS;
+ memopv4f32, SchedWriteFShuffle.XMM, SSEPackedSingle>, TB;
defm SHUFPD : sse12_shuffle<VR128, f128mem, v2f64,
"shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}",
- memopv2f64, SchedWriteFShuffle.XMM, SSEPackedDouble, 1>, PD;
+ memopv2f64, SchedWriteFShuffle.XMM, SSEPackedDouble, 1>, TB, PD;
}
//===----------------------------------------------------------------------===//
@@ -2126,44 +2126,44 @@ multiclass sse12_unpack_interleave<bits<8> opc, SDNode OpNode, ValueType vt,
let Predicates = [HasAVX, NoVLX] in {
defm VUNPCKHPS: sse12_unpack_interleave<0x15, X86Unpckh, v4f32, load,
VR128, f128mem, "unpckhps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedSingle>, PS, VEX_4V, WIG;
+ SchedWriteFShuffle.XMM, SSEPackedSingle>, TB, VEX, VVVV, WIG;
defm VUNPCKHPD: sse12_unpack_interleave<0x15, X86Unpckh, v2f64, load,
VR128, f128mem, "unpckhpd\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedDouble, 1>, PD, VEX_4V, WIG;
+ SchedWriteFShuffle.XMM, SSEPackedDouble, 1>, TB, PD, VEX, VVVV, WIG;
defm VUNPCKLPS: sse12_unpack_interleave<0x14, X86Unpckl, v4f32, load,
VR128, f128mem, "unpcklps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedSingle>, PS, VEX_4V, WIG;
+ SchedWriteFShuffle.XMM, SSEPackedSingle>, TB, VEX, VVVV, WIG;
defm VUNPCKLPD: sse12_unpack_interleave<0x14, X86Unpckl, v2f64, load,
VR128, f128mem, "unpcklpd\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedDouble>, PD, VEX_4V, WIG;
+ SchedWriteFShuffle.XMM, SSEPackedDouble>, TB, PD, VEX, VVVV, WIG;
defm VUNPCKHPSY: sse12_unpack_interleave<0x15, X86Unpckh, v8f32, load,
VR256, f256mem, "unpckhps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.YMM, SSEPackedSingle>, PS, VEX_4V, VEX_L, WIG;
+ SchedWriteFShuffle.YMM, SSEPackedSingle>, TB, VEX, VVVV, VEX_L, WIG;
defm VUNPCKHPDY: sse12_unpack_interleave<0x15, X86Unpckh, v4f64, load,
VR256, f256mem, "unpckhpd\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.YMM, SSEPackedDouble>, PD, VEX_4V, VEX_L, WIG;
+ SchedWriteFShuffle.YMM, SSEPackedDouble>, TB, PD, VEX, VVVV, VEX_L, WIG;
defm VUNPCKLPSY: sse12_unpack_interleave<0x14, X86Unpckl, v8f32, load,
VR256, f256mem, "unpcklps\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.YMM, SSEPackedSingle>, PS, VEX_4V, VEX_L, WIG;
+ SchedWriteFShuffle.YMM, SSEPackedSingle>, TB, VEX, VVVV, VEX_L, WIG;
defm VUNPCKLPDY: sse12_unpack_interleave<0x14, X86Unpckl, v4f64, load,
VR256, f256mem, "unpcklpd\t{$src2, $src1, $dst|$dst, $src1, $src2}",
- SchedWriteFShuffle.YMM, SSEPackedDouble>, PD, VEX_4V, VEX_L, WIG;
+ SchedWriteFShuffle.YMM, SSEPackedDouble>, TB, PD, VEX, VVVV, VEX_L, WIG;
}// Predicates = [HasAVX, NoVLX]
let Constraints = "$src1 = $dst" in {
defm UNPCKHPS: sse12_unpack_interleave<0x15, X86Unpckh, v4f32, memop,
VR128, f128mem, "unpckhps\t{$src2, $dst|$dst, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedSingle>, PS;
+ SchedWriteFShuffle.XMM, SSEPackedSingle>, TB;
defm UNPCKHPD: sse12_unpack_interleave<0x15, X86Unpckh, v2f64, memop,
VR128, f128mem, "unpckhpd\t{$src2, $dst|$dst, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedDouble, 1>, PD;
+ SchedWriteFShuffle.XMM, SSEPackedDouble, 1>, TB, PD;
defm UNPCKLPS: sse12_unpack_interleave<0x14, X86Unpckl, v4f32, memop,
VR128, f128mem, "unpcklps\t{$src2, $dst|$dst, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedSingle>, PS;
+ SchedWriteFShuffle.XMM, SSEPackedSingle>, TB;
defm UNPCKLPD: sse12_unpack_interleave<0x14, X86Unpckl, v2f64, memop,
VR128, f128mem, "unpcklpd\t{$src2, $dst|$dst, $src2}",
- SchedWriteFShuffle.XMM, SSEPackedDouble>, PD;
+ SchedWriteFShuffle.XMM, SSEPackedDouble>, TB, PD;
} // Constraints = "$src1 = $dst"
let Predicates = [HasAVX1Only] in {
@@ -2208,13 +2208,13 @@ multiclass sse12_extr_sign_mask<RegisterClass RC, ValueType vt,
let Predicates = [HasAVX] in {
defm VMOVMSKPS : sse12_extr_sign_mask<VR128, v4f32, "movmskps",
- SSEPackedSingle>, PS, VEX, WIG;
+ SSEPackedSingle>, TB, VEX, WIG;
defm VMOVMSKPD : sse12_extr_sign_mask<VR128, v2f64, "movmskpd",
- SSEPackedDouble>, PD, VEX, WIG;
+ SSEPackedDouble>, TB, PD, VEX, WIG;
defm VMOVMSKPSY : sse12_extr_sign_mask<VR256, v8f32, "movmskps",
- SSEPackedSingle>, PS, VEX, VEX_L, WIG;
+ SSEPackedSingle>, TB, VEX, VEX_L, WIG;
defm VMOVMSKPDY : sse12_extr_sign_mask<VR256, v4f64, "movmskpd",
- SSEPackedDouble>, PD, VEX, VEX_L, WIG;
+ SSEPackedDouble>, TB, PD, VEX, VEX_L, WIG;
// Also support integer VTs to avoid a int->fp bitcast in the DAG.
def : Pat<(X86movmsk (v4i32 VR128:$src)),
@@ -2228,9 +2228,9 @@ let Predicates = [HasAVX] in {
}
defm MOVMSKPS : sse12_extr_sign_mask<VR128, v4f32, "movmskps",
- SSEPackedSingle>, PS;
+ SSEPackedSingle>, TB;
defm MOVMSKPD : sse12_extr_sign_mask<VR128, v2f64, "movmskpd",
- SSEPackedDouble>, PD;
+ SSEPackedDouble>, TB, PD;
let Predicates = [UseSSE2] in {
// Also support integer VTs to avoid a int->fp bitcast in the DAG.
@@ -2276,7 +2276,7 @@ multiclass PDI_binop_all<bits<8> opc, string OpcodeStr, SDNode Opcode,
let Predicates = [HasAVX, prd] in
defm V#NAME : PDI_binop_rm<opc, !strconcat("v", OpcodeStr), Opcode, OpVT128,
VR128, load, i128mem, sched.XMM,
- IsCommutable, 0>, VEX_4V, WIG;
+ IsCommutable, 0>, VEX, VVVV, WIG;
let Constraints = "$src1 = $dst" in
defm NAME : PDI_binop_rm<opc, OpcodeStr, Opcode, OpVT128, VR128,
@@ -2285,7 +2285,7 @@ let Constraints = "$src1 = $dst" in
let Predicates = [HasAVX2, prd] in
defm V#NAME#Y : PDI_binop_rm<opc, !strconcat("v", OpcodeStr), Opcode,
OpVT256, VR256, load, i256mem, sched.YMM,
- IsCommutable, 0>, VEX_4V, VEX_L, WIG;
+ IsCommutable, 0>, VEX, VVVV, VEX_L, WIG;
}
// These are ordered here for pattern ordering requirements with the fp versions
@@ -2312,29 +2312,29 @@ multiclass sse12_fp_packed_logical<bits<8> opc, string OpcodeStr,
let Predicates = [HasAVX, NoVLX] in {
defm V#NAME#PSY : sse12_fp_packed_logical_rm<opc, VR256, SSEPackedSingle,
!strconcat(OpcodeStr, "ps"), f256mem, sched.YMM,
- [], [], 0>, PS, VEX_4V, VEX_L, WIG;
+ [], [], 0>, TB, VEX, VVVV, VEX_L, WIG;
defm V#NAME#PDY : sse12_fp_packed_logical_rm<opc, VR256, SSEPackedDouble,
!strconcat(OpcodeStr, "pd"), f256mem, sched.YMM,
- [], [], 0>, PD, VEX_4V, VEX_L, WIG;
+ [], [], 0>, TB, PD, VEX, VVVV, VEX_L, WIG;
defm V#NAME#PS : sse12_fp_packed_logical_rm<opc, VR128, SSEPackedSingle,
!strconcat(OpcodeStr, "ps"), f128mem, sched.XMM,
- [], [], 0>, PS, VEX_4V, WIG;
+ [], [], 0>, TB, VEX, VVVV, WIG;
defm V#NAME#PD : sse12_fp_packed_logical_rm<opc, VR128, SSEPackedDouble,
!strconcat(OpcodeStr, "pd"), f128mem, sched.XMM,
- [], [], 0>, PD, VEX_4V, WIG;
+ [], [], 0>, TB, PD, VEX, VVVV, WIG;
}
let Constraints = "$src1 = $dst" in {
defm PS : sse12_fp_packed_logical_rm<opc, VR128, SSEPackedSingle,
!strconcat(OpcodeStr, "ps"), f128mem, sched.XMM,
- [], []>, PS;
+ [], []>, TB;
defm PD : sse12_fp_packed_logical_rm<opc, VR128, SSEPackedDouble,
!strconcat(OpcodeStr, "pd"), f128mem, sched.XMM,
- [], []>, PD;
+ [], []>, TB, PD;
}
}
@@ -2636,26 +2636,26 @@ let Uses = [MXCSR], mayRaiseFPException = 1 in {
let Predicates = [HasAVX, NoVLX] in {
defm V#NAME#PS : sse12_fp_packed<opc, !strconcat(OpcodeStr, "ps"), OpNode,
VR128, v4f32, f128mem, loadv4f32,
- SSEPackedSingle, sched.PS.XMM, 0>, PS, VEX_4V, WIG;
+ SSEPackedSingle, sched.PS.XMM, 0>, TB, VEX, VVVV, WIG;
defm V#NAME#PD : sse12_fp_packed<opc, !strconcat(OpcodeStr, "pd"), OpNode,
VR128, v2f64, f128mem, loadv2f64,
- SSEPackedDouble, sched.PD.XMM, 0>, PD, VEX_4V, WIG;
+ SSEPackedDouble, sched.PD.XMM, 0>, TB, PD, VEX, VVVV, WIG;
defm V#NAME#PSY : sse12_fp_packed<opc, !strconcat(OpcodeStr, "ps"),
OpNode, VR256, v8f32, f256mem, loadv8f32,
- SSEPackedSingle, sched.PS.YMM, 0>, PS, VEX_4V, VEX_L, WIG;
+ SSEPackedSingle, sched.PS.YMM, 0>, TB, VEX, VVVV, VEX_L, WIG;
defm V#NAME#PDY : sse12_fp_packed<opc, !strconcat(OpcodeStr, "pd"),
OpNode, VR256, v4f64, f256mem, loadv4f64,
- SSEPackedDouble, sched.PD.YMM, 0>, PD, VEX_4V, VEX_L, WIG;
+ SSEPackedDouble, sched.PD.YMM, 0>, TB, PD, VEX, VVVV, VEX_L, WIG;
}
let Constraints = "$src1 = $dst" in {
defm PS : sse12_fp_packed<opc, !strconcat(OpcodeStr, "ps"), OpNode, VR128,
v4f32, f128mem, memopv4f32, SSEPackedSingle,
- sched.PS.XMM>, PS;
+ sched.PS.XMM>, TB;
defm PD : sse12_fp_packed<opc, !strconcat(OpcodeStr, "pd"), OpNode, VR128,
v2f64, f128mem, memopv2f64, SSEPackedDouble,
- sched.PD.XMM>, PD;
+ sched.PD.XMM>, TB, PD;
}
}
}
@@ -2665,18 +2665,18 @@ multiclass basic_sse12_fp_binop_s<bits<8> opc, string OpcodeStr, SDPatternOperat
let Uses = [MXCSR], mayRaiseFPException = 1 in {
defm V#NAME#SS : sse12_fp_scalar<opc, !strconcat(OpcodeStr, "ss"),
OpNode, FR32, f32mem, SSEPackedSingle, sched.PS.Scl, 0>,
- XS, VEX_4V, VEX_LIG, WIG;
+ TB, XS, VEX, VVVV, VEX_LIG, WIG;
defm V#NAME#SD : sse12_fp_scalar<opc, !strconcat(OpcodeStr, "sd"),
OpNode, FR64, f64mem, SSEPackedDouble, sched.PD.Scl, 0>,
- XD, VEX_4V, VEX_LIG, WIG;
+ TB, XD, VEX, VVVV, VEX_LIG, WIG;
let Constraints = "$src1 = $dst" in {
defm SS : sse12_fp_scalar<opc, !strconcat(OpcodeStr, "ss"),
OpNode, FR32, f32mem, SSEPackedSingle,
- sched.PS.Scl>, XS;
+ sched.PS.Scl>, TB, XS;
defm SD : sse12_fp_scalar<opc, !strconcat(OpcodeStr, "sd"),
OpNode, FR64, f64mem, SSEPackedDouble,
- sched.PD.Scl>, XD;
+ sched.PD.Scl>, TB, XD;
}
}
}
@@ -2687,18 +2687,18 @@ multiclass basic_sse12_fp_binop_s_int<bits<8> opc, string OpcodeStr,
let Uses = [MXCSR], mayRaiseFPException = 1 in {
defm V#NAME#SS : sse12_fp_scalar_int<opc, OpNode, VR128, v4f32,
!strconcat(OpcodeStr, "ss"), ssmem, sse_load_f32,
- SSEPackedSingle, sched.PS.Scl, 0>, XS, VEX_4V, VEX_LIG, WIG;
+ SSEPackedSingle, sched.PS.Scl, 0>, TB, XS, VEX, VVVV, VEX_LIG, WIG;
defm V#NAME#SD : sse12_fp_scalar_int<opc, OpNode, VR128, v2f64,
!strconcat(OpcodeStr, "sd"), sdmem, sse_load_f64,
- SSEPackedDouble, sched.PD.Scl, 0>, XD, VEX_4V, VEX_LIG, WIG;
+ SSEPackedDouble, sched.PD.Scl, 0>, TB, XD, VEX, VVVV, VEX_LIG, WIG;
let Constraints = "$src1 = $dst" in {
defm SS : sse12_fp_scalar_int<opc, OpNode, VR128, v4f32,
!strconcat(OpcodeStr, "ss"), ssmem, sse_load_f32,
- SSEPackedSingle, sched.PS.Scl>, XS;
+ SSEPackedSingle, sched.PS.Scl>, TB, XS;
defm SD : sse12_fp_scalar_int<opc, OpNode, VR128, v2f64,
!strconcat(OpcodeStr, "sd"), sdmem, sse_load_f64,
- SSEPackedDouble, sched.PD.Scl>, XD;
+ SSEPackedDouble, sched.PD.Scl>, TB, XD;
}
}
}
@@ -3016,29 +3016,29 @@ let Predicates = [HasAVX, NoVLX] in {
multiclass sse1_fp_unop_s_intr<string OpcodeStr, Predicate AVXTarget> {
defm SS : sse_fp_unop_s_intr<v4f32, sse_load_f32,
!cast<Intrinsic>("int_x86_sse_"#OpcodeStr#_ss),
- UseSSE1>, XS;
+ UseSSE1>, TB, XS;
defm V#NAME#SS : avx_fp_unop_s_intr<v4f32, sse_load_f32,
!cast<Intrinsic>("int_x86_sse_"#OpcodeStr#_ss),
AVXTarget>,
- XS, VEX_4V, VEX_LIG, WIG;
+ TB, XS, VEX, VVVV, VEX_LIG, WIG;
}
multiclass sse1_fp_unop_s<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
X86SchedWriteWidths sched, Predicate AVXTarget> {
defm SS : sse_fp_unop_s<opc, OpcodeStr#ss, FR32, f32mem,
- ssmem, OpNode, SSEPackedSingle, sched.Scl, UseSSE1>, XS;
+ ssmem, OpNode, SSEPackedSingle, sched.Scl, UseSSE1>, TB, XS;
defm V#NAME#SS : avx_fp_unop_s<opc, "v"#OpcodeStr#ss, FR32, f32,
f32mem, ssmem, OpNode, SSEPackedSingle, sched.Scl, AVXTarget>,
- XS, VEX_4V, VEX_LIG, WIG;
+ TB, XS, VEX, VVVV, VEX_LIG, WIG;
}
multiclass sse2_fp_unop_s<bits<8> opc, string OpcodeStr, SDPatternOperator OpNode,
X86SchedWriteWidths sched, Predicate AVXTarget> {
defm SD : sse_fp_unop_s<opc, OpcodeStr#sd, FR64, f64mem,
- sdmem, OpNode, SSEPackedDouble, sched.Scl, UseSSE2>, XD;
+ sdmem, OpNode, SSEPackedDouble, sched.Scl, UseSSE2>, TB, XD;
defm V#NAME#SD : avx_fp_unop_s<opc, "v"#OpcodeStr#sd, FR64, f64,
f64mem, sdmem, OpNode, SSEPackedDouble, sched.Scl, AVXTarget>,
- XD, VEX_4V, VEX_LIG, WIG;
+ TB, XD, VEX, VVVV, VEX_LIG, WIG;
}
// Square root.
@@ -3165,11 +3165,11 @@ let SchedRW = [WriteStoreNT] in {
def MOVNTImr : I<0xC3, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
"movnti{l}\t{$src, $dst|$dst, $src}",
[(nontemporalstore (i32 GR32:$src), addr:$dst)]>,
- PS, Requires<[HasSSE2]>;
+ TB, Requires<[HasSSE2]>;
def MOVNTI_64mr : RI<0xC3, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
"movnti{q}\t{$src, $dst|$dst, $src}",
[(nontemporalstore (i64 GR64:$src), addr:$dst)]>,
- PS, Requires<[HasSSE2]>;
+ TB, Requires<[HasSSE2]>;
} // SchedRW = [WriteStoreNT]
let Predicates = [HasAVX, NoVLX] in {
@@ -3226,14 +3226,14 @@ let SchedRW = [WriteLoad] in {
// Flush cache
def CLFLUSH : I<0xAE, MRM7m, (outs), (ins i8mem:$src),
"clflush\t$src", [(int_x86_sse2_clflush addr:$src)]>,
- PS, Requires<[HasCLFLUSH]>;
+ TB, Requires<[HasCLFLUSH]>;
}
let SchedRW = [WriteNop] in {
// Pause. This "instruction" is encoded as "rep; nop", so even though it
// was introduced with SSE2, it's backward compatible.
def PAUSE : I<0x90, RawFrm, (outs), (ins),
- "pause", [(int_x86_sse2_pause)]>, OBXS;
+ "pause", [(int_x86_sse2_pause)]>, XS;
}
let SchedRW = [WriteFence] in {
@@ -3241,11 +3241,11 @@ let SchedRW = [WriteFence] in {
// TODO: As with mfence, we may want to ease the availability of sfence/lfence
// to include any 64-bit target.
def SFENCE : I<0xAE, MRM7X, (outs), (ins), "sfence", [(int_x86_sse_sfence)]>,
- PS, Requires<[HasSSE1]>;
+ TB, Requires<[HasSSE1]>;
def LFENCE : I<0xAE, MRM5X, (outs), (ins), "lfence", [(int_x86_sse2_lfence)]>,
- PS, Requires<[HasSSE2]>;
+ TB, Requires<[HasSSE2]>;
def MFENCE : I<0xAE, MRM6X, (outs), (ins), "mfence", [(int_x86_sse2_mfence)]>,
- PS, Requires<[HasMFence]>;
+ TB, Requires<[HasMFence]>;
} // SchedRW
def : Pat<(X86MFence), (MFENCE)>;
@@ -3266,11 +3266,11 @@ def VSTMXCSR : VPSI<0xAE, MRM3m, (outs), (ins i32mem:$dst),
let mayLoad=1, hasSideEffects=1, Defs=[MXCSR] in
def LDMXCSR : I<0xAE, MRM2m, (outs), (ins i32mem:$src),
"ldmxcsr\t$src", [(int_x86_sse_ldmxcsr addr:$src)]>,
- PS, Sched<[WriteLDMXCSR]>;
+ TB, Sched<[WriteLDMXCSR]>;
let mayStore=1, hasSideEffects=1, Uses=[MXCSR] in
def STMXCSR : I<0xAE, MRM3m, (outs), (ins i32mem:$dst),
"stmxcsr\t$dst", [(int_x86_sse_stmxcsr addr:$dst)]>,
- PS, Sched<[WriteSTMXCSR]>;
+ TB, Sched<[WriteSTMXCSR]>;
//===---------------------------------------------------------------------===//
// SSE2 - Move Aligned/Unaligned Packed Integer Instructions
@@ -3327,11 +3327,11 @@ def VMOVDQUrm : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src),
"vmovdqu\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (loadv2i64 addr:$src))]>,
Sched<[SchedWriteVecMoveLS.XMM.RM]>,
- XS, VEX, WIG;
+ TB, XS, VEX, WIG;
def VMOVDQUYrm : I<0x6F, MRMSrcMem, (outs VR256:$dst), (ins i256mem:$src),
"vmovdqu\t{$src, $dst|$dst, $src}", []>,
Sched<[SchedWriteVecMoveLS.YMM.RM]>,
- XS, VEX, VEX_L, WIG;
+ TB, XS, VEX, VEX_L, WIG;
}
let mayStore = 1, hasSideEffects = 0, Predicates = [HasAVX,NoVLX] in {
@@ -3347,10 +3347,10 @@ def VMOVDQAYmr : VPDI<0x7F, MRMDestMem, (outs),
def VMOVDQUmr : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src),
"vmovdqu\t{$src, $dst|$dst, $src}",
[(store (v2i64 VR128:$src), addr:$dst)]>,
- Sched<[SchedWriteVecMoveLS.XMM.MR]>, XS, VEX, WIG;
+ Sched<[SchedWriteVecMoveLS.XMM.MR]>, TB, XS, VEX, WIG;
def VMOVDQUYmr : I<0x7F, MRMDestMem, (outs), (ins i256mem:$dst, VR256:$src),
"vmovdqu\t{$src, $dst|$dst, $src}",[]>,
- Sched<[SchedWriteVecMoveLS.YMM.MR]>, XS, VEX, VEX_L, WIG;
+ Sched<[SchedWriteVecMoveLS.YMM.MR]>, TB, XS, VEX, VEX_L, WIG;
}
let SchedRW = [SchedWriteVecMoveLS.XMM.RR] in {
@@ -3360,7 +3360,7 @@ def MOVDQArr : PDI<0x6F, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
def MOVDQUrr : I<0x6F, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
"movdqu\t{$src, $dst|$dst, $src}", []>,
- XS, Requires<[UseSSE2]>;
+ TB, XS, Requires<[UseSSE2]>;
}
// For Disassembler
@@ -3370,7 +3370,7 @@ def MOVDQArr_REV : PDI<0x7F, MRMDestReg, (outs VR128:$dst), (ins VR128:$src),
def MOVDQUrr_REV : I<0x7F, MRMDestReg, (outs VR128:$dst), (ins VR128:$src),
"movdqu\t{$src, $dst|$dst, $src}", []>,
- XS, Requires<[UseSSE2]>;
+ TB, XS, Requires<[UseSSE2]>;
}
} // SchedRW
@@ -3382,7 +3382,7 @@ def MOVDQArm : PDI<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src),
def MOVDQUrm : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src),
"movdqu\t{$src, $dst|$dst, $src}",
[/*(set VR128:$dst, (loadv2i64 addr:$src))*/]>,
- XS, Requires<[UseSSE2]>;
+ TB, XS, Requires<[UseSSE2]>;
}
let mayStore = 1, hasSideEffects = 0,
@@ -3393,7 +3393,7 @@ def MOVDQAmr : PDI<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src),
def MOVDQUmr : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src),
"movdqu\t{$src, $dst|$dst, $src}",
[/*(store (v2i64 VR128:$src), addr:$dst)*/]>,
- XS, Requires<[UseSSE2]>;
+ TB, XS, Requires<[UseSSE2]>;
}
} // ExeDomain = SSEPackedInt
@@ -3537,12 +3537,12 @@ defm PMULUDQ : PDI_binop_all<0xF4, "pmuludq", X86pmuludq, v2i64, v4i64,
let Predicates = [HasAVX, NoVLX_Or_NoBWI] in
defm VPMADDWD : PDI_binop_rm2<0xF5, "vpmaddwd", X86vpmaddwd, v4i32, v8i16, VR128,
load, i128mem, SchedWriteVecIMul.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in
defm VPMADDWDY : PDI_binop_rm2<0xF5, "vpmaddwd", X86vpmaddwd, v8i32, v16i16,
VR256, load, i256mem, SchedWriteVecIMul.YMM,
- 0>, VEX_4V, VEX_L, WIG;
+ 0>, VEX, VVVV, VEX_L, WIG;
let Constraints = "$src1 = $dst" in
defm PMADDWD : PDI_binop_rm2<0xF5, "pmaddwd", X86vpmaddwd, v4i32, v8i16, VR128,
memop, i128mem, SchedWriteVecIMul.XMM>;
@@ -3550,11 +3550,11 @@ defm PMADDWD : PDI_binop_rm2<0xF5, "pmaddwd", X86vpmaddwd, v4i32, v8i16, VR128,
let Predicates = [HasAVX, NoVLX_Or_NoBWI] in
defm VPSADBW : PDI_binop_rm2<0xF6, "vpsadbw", X86psadbw, v2i64, v16i8, VR128,
load, i128mem, SchedWritePSADBW.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in
defm VPSADBWY : PDI_binop_rm2<0xF6, "vpsadbw", X86psadbw, v4i64, v32i8, VR256,
load, i256mem, SchedWritePSADBW.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
let Constraints = "$src1 = $dst" in
defm PSADBW : PDI_binop_rm2<0xF6, "psadbw", X86psadbw, v2i64, v16i8, VR128,
memop, i128mem, SchedWritePSADBW.XMM>;
@@ -3604,11 +3604,11 @@ multiclass PDI_binop_rmi_all<bits<8> opc, bits<8> opc2, Format ImmForm,
let Predicates = [HasAVX, prd] in
defm V#NAME : PDI_binop_rmi<opc, opc2, ImmForm, !strconcat("v", OpcodeStr),
OpNode, OpNode2, VR128, sched.XMM, schedImm.XMM,
- DstVT128, SrcVT, load, 0>, VEX_4V, WIG;
+ DstVT128, SrcVT, load, 0>, VEX, VVVV, WIG;
let Predicates = [HasAVX2, prd] in
defm V#NAME#Y : PDI_binop_rmi<opc, opc2, ImmForm, !strconcat("v", OpcodeStr),
OpNode, OpNode2, VR256, sched.YMM, schedImm.YMM,
- DstVT256, SrcVT, load, 0>, VEX_4V, VEX_L,
+ DstVT256, SrcVT, load, 0>, VEX, VVVV, VEX_L,
WIG;
let Constraints = "$src1 = $dst" in
defm NAME : PDI_binop_rmi<opc, opc2, ImmForm, OpcodeStr, OpNode, OpNode2,
@@ -3631,11 +3631,11 @@ multiclass PDI_binop_ri_all<bits<8> opc, Format ImmForm, string OpcodeStr,
SDNode OpNode, X86SchedWriteWidths sched> {
let Predicates = [HasAVX, NoVLX_Or_NoBWI] in
defm V#NAME : PDI_binop_ri<opc, ImmForm, !strconcat("v", OpcodeStr), OpNode,
- VR128, v16i8, sched.XMM, 0>, VEX_4V, WIG;
+ VR128, v16i8, sched.XMM, 0>, VEX, VVVV, WIG;
let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in
defm V#NAME#Y : PDI_binop_ri<opc, ImmForm, !strconcat("v", OpcodeStr), OpNode,
VR256, v32i8, sched.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
let Constraints = "$src1 = $dst" in
defm NAME : PDI_binop_ri<opc, ImmForm, OpcodeStr, OpNode, VR128, v16i8,
sched.XMM>;
@@ -3757,11 +3757,11 @@ let Predicates = [UseSSE2] in {
} // ExeDomain = SSEPackedInt
defm PSHUFD : sse2_pshuffle<"pshufd", v4i32, v8i32, X86PShufd,
- SchedWriteShuffle, NoVLX>, PD;
+ SchedWriteShuffle, NoVLX>, TB, PD;
defm PSHUFHW : sse2_pshuffle<"pshufhw", v8i16, v16i16, X86PShufhw,
- SchedWriteShuffle, NoVLX_Or_NoBWI>, XS;
+ SchedWriteShuffle, NoVLX_Or_NoBWI>, TB, XS;
defm PSHUFLW : sse2_pshuffle<"pshuflw", v8i16, v16i16, X86PShuflw,
- SchedWriteShuffle, NoVLX_Or_NoBWI>, XD;
+ SchedWriteShuffle, NoVLX_Or_NoBWI>, TB, XD;
//===---------------------------------------------------------------------===//
// Packed Integer Pack Instructions (SSE & AVX)
@@ -3821,33 +3821,33 @@ multiclass sse4_pack<bits<8> opc, string OpcodeStr, ValueType OutVT,
let Predicates = [HasAVX, NoVLX_Or_NoBWI] in {
defm VPACKSSWB : sse2_pack<0x63, "vpacksswb", v16i8, v8i16, X86Packss, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPACKSSDW : sse2_pack<0x6B, "vpackssdw", v8i16, v4i32, X86Packss, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPACKUSWB : sse2_pack<0x67, "vpackuswb", v16i8, v8i16, X86Packus, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPACKUSDW : sse4_pack<0x2B, "vpackusdw", v8i16, v4i32, X86Packus, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
}
let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in {
defm VPACKSSWBY : sse2_pack<0x63, "vpacksswb", v32i8, v16i16, X86Packss, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPACKSSDWY : sse2_pack<0x6B, "vpackssdw", v16i16, v8i32, X86Packss, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPACKUSWBY : sse2_pack<0x67, "vpackuswb", v32i8, v16i16, X86Packus, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPACKUSDWY : sse4_pack<0x2B, "vpackusdw", v16i16, v8i32, X86Packus, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
}
let Constraints = "$src1 = $dst" in {
@@ -3892,61 +3892,61 @@ multiclass sse2_unpack<bits<8> opc, string OpcodeStr, ValueType vt,
let Predicates = [HasAVX, NoVLX_Or_NoBWI] in {
defm VPUNPCKLBW : sse2_unpack<0x60, "vpunpcklbw", v16i8, X86Unpckl, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPUNPCKLWD : sse2_unpack<0x61, "vpunpcklwd", v8i16, X86Unpckl, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPUNPCKHBW : sse2_unpack<0x68, "vpunpckhbw", v16i8, X86Unpckh, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPUNPCKHWD : sse2_unpack<0x69, "vpunpckhwd", v8i16, X86Unpckh, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
}
let Predicates = [HasAVX, NoVLX] in {
defm VPUNPCKLDQ : sse2_unpack<0x62, "vpunpckldq", v4i32, X86Unpckl, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPUNPCKLQDQ : sse2_unpack<0x6C, "vpunpcklqdq", v2i64, X86Unpckl, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPUNPCKHDQ : sse2_unpack<0x6A, "vpunpckhdq", v4i32, X86Unpckh, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPUNPCKHQDQ : sse2_unpack<0x6D, "vpunpckhqdq", v2i64, X86Unpckh, VR128,
i128mem, SchedWriteShuffle.XMM, load, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
}
let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in {
defm VPUNPCKLBWY : sse2_unpack<0x60, "vpunpcklbw", v32i8, X86Unpckl, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPUNPCKLWDY : sse2_unpack<0x61, "vpunpcklwd", v16i16, X86Unpckl, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPUNPCKHBWY : sse2_unpack<0x68, "vpunpckhbw", v32i8, X86Unpckh, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPUNPCKHWDY : sse2_unpack<0x69, "vpunpckhwd", v16i16, X86Unpckh, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
}
let Predicates = [HasAVX2, NoVLX] in {
defm VPUNPCKLDQY : sse2_unpack<0x62, "vpunpckldq", v8i32, X86Unpckl, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPUNPCKLQDQY : sse2_unpack<0x6C, "vpunpcklqdq", v4i64, X86Unpckl, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPUNPCKHDQY : sse2_unpack<0x6A, "vpunpckhdq", v8i32, X86Unpckh, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPUNPCKHQDQY : sse2_unpack<0x6D, "vpunpckhqdq", v4i64, X86Unpckh, VR256,
i256mem, SchedWriteShuffle.YMM, load, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
}
let Constraints = "$src1 = $dst" in {
@@ -4004,7 +4004,7 @@ def VPEXTRWrr : Ii8<0xC5, MRMSrcReg,
"vpextrw\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set GR32orGR64:$dst, (X86pextrw (v8i16 VR128:$src1),
timm:$src2))]>,
- PD, VEX, WIG, Sched<[WriteVecExtract]>;
+ TB, PD, VEX, WIG, Sched<[WriteVecExtract]>;
def PEXTRWrr : PDIi8<0xC5, MRMSrcReg,
(outs GR32orGR64:$dst), (ins VR128:$src1, u8imm:$src2),
"pextrw\t{$src2, $src1, $dst|$dst, $src1, $src2}",
@@ -4014,10 +4014,10 @@ def PEXTRWrr : PDIi8<0xC5, MRMSrcReg,
// Insert
let Predicates = [HasAVX, NoBWI] in
-defm VPINSRW : sse2_pinsrw<0>, PD, VEX_4V, WIG;
+defm VPINSRW : sse2_pinsrw<0>, TB, PD, VEX, VVVV, WIG;
let Predicates = [UseSSE2], Constraints = "$src1 = $dst" in
-defm PINSRW : sse2_pinsrw, PD;
+defm PINSRW : sse2_pinsrw, TB, PD;
} // ExeDomain = SSEPackedInt
@@ -4306,13 +4306,13 @@ let ExeDomain = SSEPackedInt, SchedRW = [WriteVecLoad] in {
def VMOVQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src),
"vmovq\t{$src, $dst|$dst, $src}",
[(set VR128:$dst,
- (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>, XS,
+ (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>, TB, XS,
VEX, Requires<[UseAVX]>, WIG;
def MOVQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src),
"movq\t{$src, $dst|$dst, $src}",
[(set VR128:$dst,
(v2i64 (scalar_to_vector (loadi64 addr:$src))))]>,
- XS, Requires<[UseSSE2]>; // SSE2 instruction with XS Prefix
+ TB, XS, Requires<[UseSSE2]>; // SSE2 instruction with XS Prefix
} // ExeDomain, SchedRW
//===---------------------------------------------------------------------===//
@@ -4369,11 +4369,11 @@ let ExeDomain = SSEPackedInt, SchedRW = [SchedWriteVecLogic.XMM] in {
def VMOVZPQILo2PQIrr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
"vmovq\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (v2i64 (X86vzmovl (v2i64 VR128:$src))))]>,
- XS, VEX, Requires<[UseAVX]>, WIG;
+ TB, XS, VEX, Requires<[UseAVX]>, WIG;
def MOVZPQILo2PQIrr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
"movq\t{$src, $dst|$dst, $src}",
[(set VR128:$dst, (v2i64 (X86vzmovl (v2i64 VR128:$src))))]>,
- XS, Requires<[UseSSE2]>;
+ TB, XS, Requires<[UseSSE2]>;
} // ExeDomain, SchedRW
let Predicates = [UseAVX] in {
@@ -4563,27 +4563,27 @@ let Predicates = [HasAVX] in {
let ExeDomain = SSEPackedSingle in {
defm VADDSUBPS : sse3_addsub<"vaddsubps", v4f32, VR128, f128mem,
SchedWriteFAddSizes.PS.XMM, loadv4f32, 0>,
- XD, VEX_4V, WIG;
+ TB, XD, VEX, VVVV, WIG;
defm VADDSUBPSY : sse3_addsub<"vaddsubps", v8f32, VR256, f256mem,
SchedWriteFAddSizes.PS.YMM, loadv8f32, 0>,
- XD, VEX_4V, VEX_L, WIG;
+ TB, XD, VEX, VVVV, VEX_L, WIG;
}
let ExeDomain = SSEPackedDouble in {
defm VADDSUBPD : sse3_addsub<"vaddsubpd", v2f64, VR128, f128mem,
SchedWriteFAddSizes.PD.XMM, loadv2f64, 0>,
- PD, VEX_4V, WIG;
+ TB, PD, VEX, VVVV, WIG;
defm VADDSUBPDY : sse3_addsub<"vaddsubpd", v4f64, VR256, f256mem,
SchedWriteFAddSizes.PD.YMM, loadv4f64, 0>,
- PD, VEX_4V, VEX_L, WIG;
+ TB, PD, VEX, VVVV, VEX_L, WIG;
}
}
let Constraints = "$src1 = $dst", Predicates = [UseSSE3] in {
let ExeDomain = SSEPackedSingle in
defm ADDSUBPS : sse3_addsub<"addsubps", v4f32, VR128, f128mem,
- SchedWriteFAddSizes.PS.XMM, memopv4f32>, XD;
+ SchedWriteFAddSizes.PS.XMM, memopv4f32>, TB, XD;
let ExeDomain = SSEPackedDouble in
defm ADDSUBPD : sse3_addsub<"addsubpd", v2f64, VR128, f128mem,
- SchedWriteFAddSizes.PD.XMM, memopv2f64>, PD;
+ SchedWriteFAddSizes.PD.XMM, memopv2f64>, TB, PD;
}
//===---------------------------------------------------------------------===//
@@ -4635,23 +4635,23 @@ let Uses = [MXCSR], mayRaiseFPException = 1 in {
let Predicates = [HasAVX] in {
let ExeDomain = SSEPackedSingle in {
defm VHADDPS : S3D_Int<0x7C, "vhaddps", v4f32, VR128, f128mem,
- X86fhadd, WriteFHAdd, loadv4f32, 0>, VEX_4V, WIG;
+ X86fhadd, WriteFHAdd, loadv4f32, 0>, VEX, VVVV, WIG;
defm VHSUBPS : S3D_Int<0x7D, "vhsubps", v4f32, VR128, f128mem,
- X86fhsub, WriteFHAdd, loadv4f32, 0>, VEX_4V, WIG;
+ X86fhsub, WriteFHAdd, loadv4f32, 0>, VEX, VVVV, WIG;
defm VHADDPSY : S3D_Int<0x7C, "vhaddps", v8f32, VR256, f256mem,
- X86fhadd, WriteFHAddY, loadv8f32, 0>, VEX_4V, VEX_L, WIG;
+ X86fhadd, WriteFHAddY, loadv8f32, 0>, VEX, VVVV, VEX_L, WIG;
defm VHSUBPSY : S3D_Int<0x7D, "vhsubps", v8f32, VR256, f256mem,
- X86fhsub, WriteFHAddY, loadv8f32, 0>, VEX_4V, VEX_L, WIG;
+ X86fhsub, WriteFHAddY, loadv8f32, 0>, VEX, VVVV, VEX_L, WIG;
}
let ExeDomain = SSEPackedDouble in {
defm VHADDPD : S3_Int<0x7C, "vhaddpd", v2f64, VR128, f128mem,
- X86fhadd, WriteFHAdd, loadv2f64, 0>, VEX_4V, WIG;
+ X86fhadd, WriteFHAdd, loadv2f64, 0>, VEX, VVVV, WIG;
defm VHSUBPD : S3_Int<0x7D, "vhsubpd", v2f64, VR128, f128mem,
- X86fhsub, WriteFHAdd, loadv2f64, 0>, VEX_4V, WIG;
+ X86fhsub, WriteFHAdd, loadv2f64, 0>, VEX, VVVV, WIG;
defm VHADDPDY : S3_Int<0x7C, "vhaddpd", v4f64, VR256, f256mem,
- X86fhadd, WriteFHAddY, loadv4f64, 0>, VEX_4V, VEX_L, WIG;
+ X86fhadd, WriteFHAddY, loadv4f64, 0>, VEX, VVVV, VEX_L, WIG;
defm VHSUBPDY : S3_Int<0x7D, "vhsubpd", v4f64, VR256, f256mem,
- X86fhsub, WriteFHAddY, loadv4f64, 0>, VEX_4V, VEX_L, WIG;
+ X86fhsub, WriteFHAddY, loadv4f64, 0>, VEX, VVVV, VEX_L, WIG;
}
}
@@ -4806,45 +4806,45 @@ let ImmT = NoImm, Predicates = [HasAVX, NoVLX_Or_NoBWI] in {
let isCommutable = 0 in {
defm VPSHUFB : SS3I_binop_rm<0x00, "vpshufb", X86pshufb, v16i8, v16i8,
VR128, load, i128mem,
- SchedWriteVarShuffle.XMM, 0>, VEX_4V, WIG;
+ SchedWriteVarShuffle.XMM, 0>, VEX, VVVV, WIG;
defm VPMADDUBSW : SS3I_binop_rm<0x04, "vpmaddubsw", X86vpmaddubsw, v8i16,
v16i8, VR128, load, i128mem,
- SchedWriteVecIMul.XMM, 0>, VEX_4V, WIG;
+ SchedWriteVecIMul.XMM, 0>, VEX, VVVV, WIG;
}
defm VPMULHRSW : SS3I_binop_rm<0x0B, "vpmulhrsw", X86mulhrs, v8i16, v8i16,
VR128, load, i128mem,
- SchedWriteVecIMul.XMM, 0>, VEX_4V, WIG;
+ SchedWriteVecIMul.XMM, 0>, VEX, VVVV, WIG;
}
let ImmT = NoImm, Predicates = [HasAVX] in {
let isCommutable = 0 in {
defm VPHADDW : SS3I_binop_rm<0x01, "vphaddw", X86hadd, v8i16, v8i16, VR128,
load, i128mem,
- SchedWritePHAdd.XMM, 0>, VEX_4V, WIG;
+ SchedWritePHAdd.XMM, 0>, VEX, VVVV, WIG;
defm VPHADDD : SS3I_binop_rm<0x02, "vphaddd", X86hadd, v4i32, v4i32, VR128,
load, i128mem,
- SchedWritePHAdd.XMM, 0>, VEX_4V, WIG;
+ SchedWritePHAdd.XMM, 0>, VEX, VVVV, WIG;
defm VPHSUBW : SS3I_binop_rm<0x05, "vphsubw", X86hsub, v8i16, v8i16, VR128,
load, i128mem,
- SchedWritePHAdd.XMM, 0>, VEX_4V, WIG;
+ SchedWritePHAdd.XMM, 0>, VEX, VVVV, WIG;
defm VPHSUBD : SS3I_binop_rm<0x06, "vphsubd", X86hsub, v4i32, v4i32, VR128,
load, i128mem,
- SchedWritePHAdd.XMM, 0>, VEX_4V, WIG;
+ SchedWritePHAdd.XMM, 0>, VEX, VVVV, WIG;
defm VPSIGNB : SS3I_binop_rm_int<0x08, "vpsignb",
int_x86_ssse3_psign_b_128,
- SchedWriteVecALU.XMM, load, 0>, VEX_4V, WIG;
+ SchedWriteVecALU.XMM, load, 0>, VEX, VVVV, WIG;
defm VPSIGNW : SS3I_binop_rm_int<0x09, "vpsignw",
int_x86_ssse3_psign_w_128,
- SchedWriteVecALU.XMM, load, 0>, VEX_4V, WIG;
+ SchedWriteVecALU.XMM, load, 0>, VEX, VVVV, WIG;
defm VPSIGND : SS3I_binop_rm_int<0x0A, "vpsignd",
int_x86_ssse3_psign_d_128,
- SchedWriteVecALU.XMM, load, 0>, VEX_4V, WIG;
+ SchedWriteVecALU.XMM, load, 0>, VEX, VVVV, WIG;
defm VPHADDSW : SS3I_binop_rm_int<0x03, "vphaddsw",
int_x86_ssse3_phadd_sw_128,
- SchedWritePHAdd.XMM, load, 0>, VEX_4V, WIG;
+ SchedWritePHAdd.XMM, load, 0>, VEX, VVVV, WIG;
defm VPHSUBSW : SS3I_binop_rm_int<0x07, "vphsubsw",
int_x86_ssse3_phsub_sw_128,
- SchedWritePHAdd.XMM, load, 0>, VEX_4V, WIG;
+ SchedWritePHAdd.XMM, load, 0>, VEX, VVVV, WIG;
}
}
@@ -4852,42 +4852,42 @@ let ImmT = NoImm, Predicates = [HasAVX2, NoVLX_Or_NoBWI] in {
let isCommutable = 0 in {
defm VPSHUFBY : SS3I_binop_rm<0x00, "vpshufb", X86pshufb, v32i8, v32i8,
VR256, load, i256mem,
- SchedWriteVarShuffle.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWriteVarShuffle.YMM, 0>, VEX, VVVV, VEX_L, WIG;
defm VPMADDUBSWY : SS3I_binop_rm<0x04, "vpmaddubsw", X86vpmaddubsw, v16i16,
v32i8, VR256, load, i256mem,
- SchedWriteVecIMul.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWriteVecIMul.YMM, 0>, VEX, VVVV, VEX_L, WIG;
}
defm VPMULHRSWY : SS3I_binop_rm<0x0B, "vpmulhrsw", X86mulhrs, v16i16, v16i16,
VR256, load, i256mem,
- SchedWriteVecIMul.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWriteVecIMul.YMM, 0>, VEX, VVVV, VEX_L, WIG;
}
let ImmT = NoImm, Predicates = [HasAVX2] in {
let isCommutable = 0 in {
defm VPHADDWY : SS3I_binop_rm<0x01, "vphaddw", X86hadd, v16i16, v16i16,
VR256, load, i256mem,
- SchedWritePHAdd.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWritePHAdd.YMM, 0>, VEX, VVVV, VEX_L, WIG;
defm VPHADDDY : SS3I_binop_rm<0x02, "vphaddd", X86hadd, v8i32, v8i32, VR256,
load, i256mem,
- SchedWritePHAdd.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWritePHAdd.YMM, 0>, VEX, VVVV, VEX_L, WIG;
defm VPHSUBWY : SS3I_binop_rm<0x05, "vphsubw", X86hsub, v16i16, v16i16,
VR256, load, i256mem,
- SchedWritePHAdd.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWritePHAdd.YMM, 0>, VEX, VVVV, VEX_L, WIG;
defm VPHSUBDY : SS3I_binop_rm<0x06, "vphsubd", X86hsub, v8i32, v8i32, VR256,
load, i256mem,
- SchedWritePHAdd.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWritePHAdd.YMM, 0>, VEX, VVVV, VEX_L, WIG;
defm VPSIGNB : SS3I_binop_rm_int_y<0x08, "vpsignb", int_x86_avx2_psign_b,
- SchedWriteVecALU.YMM>, VEX_4V, VEX_L, WIG;
+ SchedWriteVecALU.YMM>, VEX, VVVV, VEX_L, WIG;
defm VPSIGNW : SS3I_binop_rm_int_y<0x09, "vpsignw", int_x86_avx2_psign_w,
- SchedWriteVecALU.YMM>, VEX_4V, VEX_L, WIG;
+ SchedWriteVecALU.YMM>, VEX, VVVV, VEX_L, WIG;
defm VPSIGND : SS3I_binop_rm_int_y<0x0A, "vpsignd", int_x86_avx2_psign_d,
- SchedWriteVecALU.YMM>, VEX_4V, VEX_L, WIG;
+ SchedWriteVecALU.YMM>, VEX, VVVV, VEX_L, WIG;
defm VPHADDSW : SS3I_binop_rm_int_y<0x03, "vphaddsw",
int_x86_avx2_phadd_sw,
- SchedWritePHAdd.YMM>, VEX_4V, VEX_L, WIG;
+ SchedWritePHAdd.YMM>, VEX, VVVV, VEX_L, WIG;
defm VPHSUBSW : SS3I_binop_rm_int_y<0x07, "vphsubsw",
int_x86_avx2_phsub_sw,
- SchedWritePHAdd.YMM>, VEX_4V, VEX_L, WIG;
+ SchedWritePHAdd.YMM>, VEX, VVVV, VEX_L, WIG;
}
}
@@ -4956,10 +4956,10 @@ multiclass ssse3_palignr<string asm, ValueType VT, RegisterClass RC,
let Predicates = [HasAVX, NoVLX_Or_NoBWI] in
defm VPALIGNR : ssse3_palignr<"vpalignr", v16i8, VR128, load, i128mem,
- SchedWriteShuffle.XMM, 0>, VEX_4V, WIG;
+ SchedWriteShuffle.XMM, 0>, VEX, VVVV, WIG;
let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in
defm VPALIGNRY : ssse3_palignr<"vpalignr", v32i8, VR256, load, i256mem,
- SchedWriteShuffle.YMM, 0>, VEX_4V, VEX_L, WIG;
+ SchedWriteShuffle.YMM, 0>, VEX, VVVV, VEX_L, WIG;
let Constraints = "$src1 = $dst", Predicates = [UseSSSE3] in
defm PALIGNR : ssse3_palignr<"palignr", v16i8, VR128, memop, i128mem,
SchedWriteShuffle.XMM>;
@@ -5367,7 +5367,7 @@ multiclass SS41I_insert8<bits<8> opc, string asm, bit Is2Addr = 1> {
}
let Predicates = [HasAVX, NoBWI] in {
- defm VPINSRB : SS41I_insert8<0x20, "vpinsrb", 0>, VEX_4V, WIG;
+ defm VPINSRB : SS41I_insert8<0x20, "vpinsrb", 0>, VEX, VVVV, WIG;
def : Pat<(X86pinsrb VR128:$src1, (i32 (anyext (i8 GR8:$src2))), timm:$src3),
(VPINSRBrr VR128:$src1, (INSERT_SUBREG (i32 (IMPLICIT_DEF)),
GR8:$src2, sub_8bit), timm:$src3)>;
@@ -5398,7 +5398,7 @@ multiclass SS41I_insert32<bits<8> opc, string asm, bit Is2Addr = 1> {
}
let Predicates = [HasAVX, NoDQI] in
- defm VPINSRD : SS41I_insert32<0x22, "vpinsrd", 0>, VEX_4V;
+ defm VPINSRD : SS41I_insert32<0x22, "vpinsrd", 0>, VEX, VVVV;
let Constraints = "$src1 = $dst" in
defm PINSRD : SS41I_insert32<0x22, "pinsrd">;
@@ -5424,7 +5424,7 @@ multiclass SS41I_insert64<bits<8> opc, string asm, bit Is2Addr = 1> {
}
let Predicates = [HasAVX, NoDQI] in
- defm VPINSRQ : SS41I_insert64<0x22, "vpinsrq", 0>, VEX_4V, REX_W;
+ defm VPINSRQ : SS41I_insert64<0x22, "vpinsrq", 0>, VEX, VVVV, REX_W;
let Constraints = "$src1 = $dst" in
defm PINSRQ : SS41I_insert64<0x22, "pinsrq">, REX_W;
@@ -5459,7 +5459,7 @@ multiclass SS41I_insertf32<bits<8> opc, string asm, bit Is2Addr = 1> {
let ExeDomain = SSEPackedSingle in {
let Predicates = [UseAVX] in
defm VINSERTPS : SS41I_insertf32<0x21, "vinsertps", 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
let Constraints = "$src1 = $dst" in
defm INSERTPS : SS41I_insertf32<0x21, "insertps", 1>;
}
@@ -5638,9 +5638,9 @@ let Predicates = [HasAVX, NoVLX] in {
let Predicates = [UseAVX] in {
defm VROUND : sse41_fp_binop_s<0x0A, 0x0B, "vround", SchedWriteFRnd.Scl,
v4f32, v2f64, X86RndScales, 0>,
- VEX_4V, VEX_LIG, WIG, SIMD_EXC;
+ VEX, VVVV, VEX_LIG, WIG, SIMD_EXC;
defm VROUND : avx_fp_unop_rm<0x0A, 0x0B, "vround", SchedWriteFRnd.Scl>,
- VEX_4V, VEX_LIG, WIG, SIMD_EXC;
+ VEX, VVVV, VEX_LIG, WIG, SIMD_EXC;
}
let Predicates = [UseAVX] in {
@@ -5760,33 +5760,33 @@ let Defs = [EFLAGS], Predicates = [HasPOPCNT] in {
def POPCNT16rr : I<0xB8, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
"popcnt{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, (ctpop GR16:$src)), (implicit EFLAGS)]>,
- Sched<[WritePOPCNT]>, OpSize16, XS;
+ Sched<[WritePOPCNT]>, OpSize16, TB, XS;
def POPCNT16rm : I<0xB8, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
"popcnt{w}\t{$src, $dst|$dst, $src}",
[(set GR16:$dst, (ctpop (loadi16 addr:$src))),
(implicit EFLAGS)]>,
- Sched<[WritePOPCNT.Folded]>, OpSize16, XS;
+ Sched<[WritePOPCNT.Folded]>, OpSize16, TB, XS;
def POPCNT32rr : I<0xB8, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
"popcnt{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (ctpop GR32:$src)), (implicit EFLAGS)]>,
- Sched<[WritePOPCNT]>, OpSize32, XS;
+ Sched<[WritePOPCNT]>, OpSize32, TB, XS;
def POPCNT32rm : I<0xB8, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
"popcnt{l}\t{$src, $dst|$dst, $src}",
[(set GR32:$dst, (ctpop (loadi32 addr:$src))),
(implicit EFLAGS)]>,
- Sched<[WritePOPCNT.Folded]>, OpSize32, XS;
+ Sched<[WritePOPCNT.Folded]>, OpSize32, TB, XS;
def POPCNT64rr : RI<0xB8, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
"popcnt{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (ctpop GR64:$src)), (implicit EFLAGS)]>,
- Sched<[WritePOPCNT]>, XS;
+ Sched<[WritePOPCNT]>, TB, XS;
def POPCNT64rm : RI<0xB8, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
"popcnt{q}\t{$src, $dst|$dst, $src}",
[(set GR64:$dst, (ctpop (loadi64 addr:$src))),
(implicit EFLAGS)]>,
- Sched<[WritePOPCNT.Folded]>, XS;
+ Sched<[WritePOPCNT.Folded]>, TB, XS;
}
// SS41I_unop_rm_int_v16 - SSE 4.1 unary operator whose type is v8i16.
@@ -5842,65 +5842,65 @@ multiclass SS48I_binop_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
let Predicates = [HasAVX, NoVLX] in {
defm VPMINSD : SS48I_binop_rm<0x39, "vpminsd", smin, v4i32, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPMINUD : SS48I_binop_rm<0x3B, "vpminud", umin, v4i32, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPMAXSD : SS48I_binop_rm<0x3D, "vpmaxsd", smax, v4i32, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPMAXUD : SS48I_binop_rm<0x3F, "vpmaxud", umax, v4i32, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPMULDQ : SS48I_binop_rm<0x28, "vpmuldq", X86pmuldq, v2i64, VR128,
load, i128mem, SchedWriteVecIMul.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
}
let Predicates = [HasAVX, NoVLX_Or_NoBWI] in {
defm VPMINSB : SS48I_binop_rm<0x38, "vpminsb", smin, v16i8, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPMINUW : SS48I_binop_rm<0x3A, "vpminuw", umin, v8i16, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPMAXSB : SS48I_binop_rm<0x3C, "vpmaxsb", smax, v16i8, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VPMAXUW : SS48I_binop_rm<0x3E, "vpmaxuw", umax, v8i16, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
}
let Predicates = [HasAVX2, NoVLX] in {
defm VPMINSDY : SS48I_binop_rm<0x39, "vpminsd", smin, v8i32, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPMINUDY : SS48I_binop_rm<0x3B, "vpminud", umin, v8i32, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPMAXSDY : SS48I_binop_rm<0x3D, "vpmaxsd", smax, v8i32, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPMAXUDY : SS48I_binop_rm<0x3F, "vpmaxud", umax, v8i32, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPMULDQY : SS48I_binop_rm<0x28, "vpmuldq", X86pmuldq, v4i64, VR256,
load, i256mem, SchedWriteVecIMul.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
}
let Predicates = [HasAVX2, NoVLX_Or_NoBWI] in {
defm VPMINSBY : SS48I_binop_rm<0x38, "vpminsb", smin, v32i8, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPMINUWY : SS48I_binop_rm<0x3A, "vpminuw", umin, v16i16, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPMAXSBY : SS48I_binop_rm<0x3C, "vpmaxsb", smax, v32i8, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPMAXUWY : SS48I_binop_rm<0x3E, "vpmaxuw", umax, v16i16, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
}
let Constraints = "$src1 = $dst" in {
@@ -5927,20 +5927,20 @@ let Constraints = "$src1 = $dst" in {
let Predicates = [HasAVX, NoVLX] in
defm VPMULLD : SS48I_binop_rm<0x40, "vpmulld", mul, v4i32, VR128,
load, i128mem, SchedWritePMULLD.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
let Predicates = [HasAVX] in
defm VPCMPEQQ : SS48I_binop_rm<0x29, "vpcmpeqq", X86pcmpeq, v2i64, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
let Predicates = [HasAVX2, NoVLX] in
defm VPMULLDY : SS48I_binop_rm<0x40, "vpmulld", mul, v8i32, VR256,
load, i256mem, SchedWritePMULLD.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
let Predicates = [HasAVX2] in
defm VPCMPEQQY : SS48I_binop_rm<0x29, "vpcmpeqq", X86pcmpeq, v4i64, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
let Constraints = "$src1 = $dst" in {
defm PMULLD : SS48I_binop_rm<0x40, "pmulld", mul, v4i32, VR128,
@@ -6088,22 +6088,22 @@ let Predicates = [HasAVX] in {
let isCommutable = 0 in {
defm VMPSADBW : SS41I_binop_rmi_int<0x42, "vmpsadbw", int_x86_sse41_mpsadbw,
VR128, load, i128mem, 0,
- SchedWriteMPSAD.XMM>, VEX_4V, WIG;
+ SchedWriteMPSAD.XMM>, VEX, VVVV, WIG;
}
let Uses = [MXCSR], mayRaiseFPException = 1 in {
let ExeDomain = SSEPackedSingle in
defm VDPPS : SS41I_binop_rmi_int<0x40, "vdpps", int_x86_sse41_dpps,
VR128, load, f128mem, 0,
- SchedWriteDPPS.XMM>, VEX_4V, WIG;
+ SchedWriteDPPS.XMM>, VEX, VVVV, WIG;
let ExeDomain = SSEPackedDouble in
defm VDPPD : SS41I_binop_rmi_int<0x41, "vdppd", int_x86_sse41_dppd,
VR128, load, f128mem, 0,
- SchedWriteDPPD.XMM>, VEX_4V, WIG;
+ SchedWriteDPPD.XMM>, VEX, VVVV, WIG;
let ExeDomain = SSEPackedSingle in
defm VDPPSY : SS41I_binop_rmi_int<0x40, "vdpps", int_x86_avx_dp_ps_256,
VR256, load, i256mem, 0,
- SchedWriteDPPS.YMM>, VEX_4V, VEX_L, WIG;
+ SchedWriteDPPS.YMM>, VEX, VVVV, VEX_L, WIG;
}
}
@@ -6111,7 +6111,7 @@ let Predicates = [HasAVX2] in {
let isCommutable = 0 in {
defm VMPSADBWY : SS41I_binop_rmi_int<0x42, "vmpsadbw", int_x86_avx2_mpsadbw,
VR256, load, i256mem, 0,
- SchedWriteMPSAD.YMM>, VEX_4V, VEX_L, WIG;
+ SchedWriteMPSAD.YMM>, VEX, VVVV, VEX_L, WIG;
}
}
@@ -6170,30 +6170,30 @@ let Predicates = [HasAVX] in {
defm VBLENDPS : SS41I_blend_rmi<0x0C, "vblendps", X86Blendi, v4f32,
VR128, load, f128mem, 0, SSEPackedSingle,
SchedWriteFBlend.XMM, BlendCommuteImm4>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VBLENDPSY : SS41I_blend_rmi<0x0C, "vblendps", X86Blendi, v8f32,
VR256, load, f256mem, 0, SSEPackedSingle,
SchedWriteFBlend.YMM, BlendCommuteImm8>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VBLENDPD : SS41I_blend_rmi<0x0D, "vblendpd", X86Blendi, v2f64,
VR128, load, f128mem, 0, SSEPackedDouble,
SchedWriteFBlend.XMM, BlendCommuteImm2>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
defm VBLENDPDY : SS41I_blend_rmi<0x0D, "vblendpd", X86Blendi, v4f64,
VR256, load, f256mem, 0, SSEPackedDouble,
SchedWriteFBlend.YMM, BlendCommuteImm4>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
defm VPBLENDW : SS41I_blend_rmi<0x0E, "vpblendw", X86Blendi, v8i16,
VR128, load, i128mem, 0, SSEPackedInt,
SchedWriteBlend.XMM, BlendCommuteImm8>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
}
let Predicates = [HasAVX2] in {
defm VPBLENDWY : SS41I_blend_rmi<0x0E, "vpblendw", X86Blendi, v16i16,
VR256, load, i256mem, 0, SSEPackedInt,
SchedWriteBlend.YMM, BlendCommuteImm8>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
}
// Emulate vXi32/vXi64 blends with vXf32/vXf64 or pblendw.
@@ -6290,7 +6290,7 @@ multiclass SS41I_quaternary_avx<bits<8> opc, string OpcodeStr, RegisterClass RC,
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set RC:$dst, (VT (OpNode RC:$src3, RC:$src2, RC:$src1)))],
- SSEPackedInt>, TAPD, VEX_4V,
+ SSEPackedInt>, TA, PD, VEX, VVVV,
Sched<[sched]>;
def rm : Ii8Reg<opc, MRMSrcMem, (outs RC:$dst),
@@ -6299,7 +6299,7 @@ multiclass SS41I_quaternary_avx<bits<8> opc, string OpcodeStr, RegisterClass RC,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set RC:$dst,
(OpNode RC:$src3, (mem_frag addr:$src2),
- RC:$src1))], SSEPackedInt>, TAPD, VEX_4V,
+ RC:$src1))], SSEPackedInt>, TA, PD, VEX, VVVV,
Sched<[sched.Folded, sched.ReadAfterFold,
// x86memop:$src2
ReadDefault, ReadDefault, ReadDefault, ReadDefault,
@@ -6564,12 +6564,12 @@ multiclass SS42I_binop_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
let Predicates = [HasAVX] in
defm VPCMPGTQ : SS42I_binop_rm<0x37, "vpcmpgtq", X86pcmpgt, v2i64, VR128,
load, i128mem, SchedWriteVecALU.XMM, 0>,
- VEX_4V, WIG;
+ VEX, VVVV, WIG;
let Predicates = [HasAVX2] in
defm VPCMPGTQY : SS42I_binop_rm<0x37, "vpcmpgtq", X86pcmpgt, v4i64, VR256,
load, i256mem, SchedWriteVecALU.YMM, 0>,
- VEX_4V, VEX_L, WIG;
+ VEX, VVVV, VEX_L, WIG;
let Constraints = "$src1 = $dst" in
defm PCMPGTQ : SS42I_binop_rm<0x37, "pcmpgtq", X86pcmpgt, v2i64, VR128,
@@ -6706,37 +6706,37 @@ let Constraints = "$src1 = $dst" in {
// FIXME: Is there a better scheduler class for SHA than WriteVecIMul?
multiclass SHAI_binop<bits<8> Opc, string OpcodeStr, Intrinsic IntId,
- X86FoldableSchedWrite sched, bit UsesXMM0 = 0> {
- def rr : I<Opc, MRMSrcReg, (outs VR128:$dst),
- (ins VR128:$src1, VR128:$src2),
- !if(UsesXMM0,
- !strconcat(OpcodeStr, "\t{%xmm0, $src2, $dst|$dst, $src2, xmm0}"),
- !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}")),
- [!if(UsesXMM0,
- (set VR128:$dst, (IntId VR128:$src1, VR128:$src2, XMM0)),
- (set VR128:$dst, (IntId VR128:$src1, VR128:$src2)))]>,
- T8PS, Sched<[sched]>;
-
- def rm : I<Opc, MRMSrcMem, (outs VR128:$dst),
- (ins VR128:$src1, i128mem:$src2),
- !if(UsesXMM0,
- !strconcat(OpcodeStr, "\t{%xmm0, $src2, $dst|$dst, $src2, xmm0}"),
- !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}")),
- [!if(UsesXMM0,
- (set VR128:$dst, (IntId VR128:$src1,
- (memop addr:$src2), XMM0)),
- (set VR128:$dst, (IntId VR128:$src1,
- (memop addr:$src2))))]>, T8PS,
- Sched<[sched.Folded, sched.ReadAfterFold]>;
+ X86FoldableSchedWrite sched, string Suffix = "", bit UsesXMM0 = 0> {
+ def rr#Suffix : I<Opc, MRMSrcReg, (outs VR128:$dst),
+ (ins VR128:$src1, VR128:$src2),
+ !if(UsesXMM0,
+ !strconcat(OpcodeStr, "\t{%xmm0, $src2, $dst|$dst, $src2, xmm0}"),
+ !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}")),
+ [!if(UsesXMM0,
+ (set VR128:$dst, (IntId VR128:$src1, VR128:$src2, XMM0)),
+ (set VR128:$dst, (IntId VR128:$src1, VR128:$src2)))]>,
+ T8, Sched<[sched]>;
+
+ def rm#Suffix : I<Opc, MRMSrcMem, (outs VR128:$dst),
+ (ins VR128:$src1, i128mem:$src2),
+ !if(UsesXMM0,
+ !strconcat(OpcodeStr, "\t{%xmm0, $src2, $dst|$dst, $src2, xmm0}"),
+ !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}")),
+ [!if(UsesXMM0,
+ (set VR128:$dst, (IntId VR128:$src1,
+ (memop addr:$src2), XMM0)),
+ (set VR128:$dst, (IntId VR128:$src1,
+ (memop addr:$src2))))]>, T8,
+ Sched<[sched.Folded, sched.ReadAfterFold]>;
}
-let Constraints = "$src1 = $dst", Predicates = [HasSHA] in {
+let Constraints = "$src1 = $dst", Predicates = [HasSHA, NoEGPR] in {
def SHA1RNDS4rri : Ii8<0xCC, MRMSrcReg, (outs VR128:$dst),
(ins VR128:$src1, VR128:$src2, u8imm:$src3),
"sha1rnds4\t{$src3, $src2, $dst|$dst, $src2, $src3}",
[(set VR128:$dst,
(int_x86_sha1rnds4 VR128:$src1, VR128:$src2,
- (i8 timm:$src3)))]>, TAPS,
+ (i8 timm:$src3)))]>, TA,
Sched<[SchedWriteVecIMul.XMM]>;
def SHA1RNDS4rmi : Ii8<0xCC, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, i128mem:$src2, u8imm:$src3),
@@ -6744,7 +6744,7 @@ let Constraints = "$src1 = $dst", Predicates = [HasSHA] in {
[(set VR128:$dst,
(int_x86_sha1rnds4 VR128:$src1,
(memop addr:$src2),
- (i8 timm:$src3)))]>, TAPS,
+ (i8 timm:$src3)))]>, TA,
Sched<[SchedWriteVecIMul.XMM.Folded,
SchedWriteVecIMul.XMM.ReadAfterFold]>;
@@ -6757,7 +6757,7 @@ let Constraints = "$src1 = $dst", Predicates = [HasSHA] in {
let Uses=[XMM0] in
defm SHA256RNDS2 : SHAI_binop<0xCB, "sha256rnds2", int_x86_sha256rnds2,
- SchedWriteVecIMul.XMM, 1>;
+ SchedWriteVecIMul.XMM, "", 1>;
defm SHA256MSG1 : SHAI_binop<0xCC, "sha256msg1", int_x86_sha256msg1,
SchedWriteVecIMul.XMM>;
@@ -6765,11 +6765,47 @@ let Constraints = "$src1 = $dst", Predicates = [HasSHA] in {
SchedWriteVecIMul.XMM>;
}
-// Aliases with explicit %xmm0
-def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
- (SHA256RNDS2rr VR128:$dst, VR128:$src2), 0>;
-def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
- (SHA256RNDS2rm VR128:$dst, i128mem:$src2), 0>;
+let Constraints = "$src1 = $dst", Predicates = [HasSHA, HasEGPR, In64BitMode] in {
+ def SHA1RNDS4rri_EVEX: Ii8<0xD4, MRMSrcReg, (outs VR128:$dst),
+ (ins VR128:$src1, VR128:$src2, u8imm:$src3),
+ "sha1rnds4\t{$src3, $src2, $dst|$dst, $src2, $src3}",
+ [(set VR128:$dst,
+ (int_x86_sha1rnds4 VR128:$src1, VR128:$src2,
+ (i8 timm:$src3)))]>,
+ EVEX, NoCD8, T_MAP4, Sched<[SchedWriteVecIMul.XMM]>;
+ def SHA1RNDS4rmi_EVEX: Ii8<0xD4, MRMSrcMem, (outs VR128:$dst),
+ (ins VR128:$src1, i128mem:$src2, u8imm:$src3),
+ "sha1rnds4\t{$src3, $src2, $dst|$dst, $src2, $src3}",
+ [(set VR128:$dst,
+ (int_x86_sha1rnds4 VR128:$src1,
+ (memop addr:$src2),
+ (i8 timm:$src3)))]>,
+ EVEX, NoCD8, T_MAP4,
+ Sched<[SchedWriteVecIMul.XMM.Folded,
+ SchedWriteVecIMul.XMM.ReadAfterFold]>;
+
+ defm SHA1NEXTE : SHAI_binop<0xD8, "sha1nexte", int_x86_sha1nexte,
+ SchedWriteVecIMul.XMM, "_EVEX">,
+ EVEX, NoCD8, T_MAP4;
+ defm SHA1MSG1 : SHAI_binop<0xD9, "sha1msg1", int_x86_sha1msg1,
+ SchedWriteVecIMul.XMM, "_EVEX">,
+ EVEX, NoCD8, T_MAP4;
+ defm SHA1MSG2 : SHAI_binop<0xDA, "sha1msg2", int_x86_sha1msg2,
+ SchedWriteVecIMul.XMM, "_EVEX">,
+ EVEX, NoCD8, T_MAP4;
+
+ let Uses=[XMM0] in
+ defm SHA256RNDS2 : SHAI_binop<0xDB, "sha256rnds2", int_x86_sha256rnds2,
+ SchedWriteVecIMul.XMM, "_EVEX", 1>,
+ EVEX, NoCD8, T_MAP4;
+
+ defm SHA256MSG1 : SHAI_binop<0xDC, "sha256msg1", int_x86_sha256msg1,
+ SchedWriteVecIMul.XMM, "_EVEX">,
+ EVEX, NoCD8, T_MAP4;
+ defm SHA256MSG2 : SHAI_binop<0xDD, "sha256msg2", int_x86_sha256msg2,
+ SchedWriteVecIMul.XMM, "_EVEX">,
+ EVEX, NoCD8, T_MAP4;
+}
//===----------------------------------------------------------------------===//
// AES-NI Instructions
@@ -6796,28 +6832,28 @@ multiclass AESI_binop_rm_int<bits<8> opc, string OpcodeStr,
// Perform One Round of an AES Encryption/Decryption Flow
let Predicates = [HasAVX, NoVLX_Or_NoVAES, HasAES] in {
defm VAESENC : AESI_binop_rm_int<0xDC, "vaesenc",
- int_x86_aesni_aesenc, load>, VEX_4V, WIG;
+ int_x86_aesni_aesenc, load>, VEX, VVVV, WIG;
defm VAESENCLAST : AESI_binop_rm_int<0xDD, "vaesenclast",
- int_x86_aesni_aesenclast, load>, VEX_4V, WIG;
+ int_x86_aesni_aesenclast, load>, VEX, VVVV, WIG;
defm VAESDEC : AESI_binop_rm_int<0xDE, "vaesdec",
- int_x86_aesni_aesdec, load>, VEX_4V, WIG;
+ int_x86_aesni_aesdec, load>, VEX, VVVV, WIG;
defm VAESDECLAST : AESI_binop_rm_int<0xDF, "vaesdeclast",
- int_x86_aesni_aesdeclast, load>, VEX_4V, WIG;
+ int_x86_aesni_aesdeclast, load>, VEX, VVVV, WIG;
}
let Predicates = [NoVLX, HasVAES] in {
defm VAESENCY : AESI_binop_rm_int<0xDC, "vaesenc",
int_x86_aesni_aesenc_256, load, 0, VR256,
- i256mem>, VEX_4V, VEX_L, WIG;
+ i256mem>, VEX, VVVV, VEX_L, WIG;
defm VAESENCLASTY : AESI_binop_rm_int<0xDD, "vaesenclast",
int_x86_aesni_aesenclast_256, load, 0, VR256,
- i256mem>, VEX_4V, VEX_L, WIG;
+ i256mem>, VEX, VVVV, VEX_L, WIG;
defm VAESDECY : AESI_binop_rm_int<0xDE, "vaesdec",
int_x86_aesni_aesdec_256, load, 0, VR256,
- i256mem>, VEX_4V, VEX_L, WIG;
+ i256mem>, VEX, VVVV, VEX_L, WIG;
defm VAESDECLASTY : AESI_binop_rm_int<0xDF, "vaesdeclast",
int_x86_aesni_aesdeclast_256, load, 0, VR256,
- i256mem>, VEX_4V, VEX_L, WIG;
+ i256mem>, VEX, VVVV, VEX_L, WIG;
}
let Constraints = "$src1 = $dst" in {
@@ -6958,11 +6994,11 @@ multiclass vpclmulqdq<RegisterClass RC, X86MemOperand MemOp,
let Predicates = [HasAVX, NoVLX_Or_NoVPCLMULQDQ, HasPCLMUL] in
defm VPCLMULQDQ : vpclmulqdq<VR128, i128mem, load,
- int_x86_pclmulqdq>, VEX_4V, WIG;
+ int_x86_pclmulqdq>, VEX, VVVV, WIG;
let Predicates = [NoVLX, HasVPCLMULQDQ] in
defm VPCLMULQDQY : vpclmulqdq<VR256, i256mem, load,
- int_x86_pclmulqdq_256>, VEX_4V, VEX_L, WIG;
+ int_x86_pclmulqdq_256>, VEX, VVVV, VEX_L, WIG;
multiclass vpclmulqdq_aliases_impl<string InstStr, RegisterClass RC,
X86MemOperand MemOp, string Hi, string Lo> {
@@ -6999,26 +7035,26 @@ def EXTRQI : Ii8<0x78, MRMXr, (outs VR128:$dst),
"extrq\t{$idx, $len, $src|$src, $len, $idx}",
[(set VR128:$dst, (X86extrqi VR128:$src, timm:$len,
timm:$idx))]>,
- PD, Sched<[SchedWriteVecALU.XMM]>;
+ TB, PD, Sched<[SchedWriteVecALU.XMM]>;
def EXTRQ : I<0x79, MRMSrcReg, (outs VR128:$dst),
(ins VR128:$src, VR128:$mask),
"extrq\t{$mask, $src|$src, $mask}",
[(set VR128:$dst, (int_x86_sse4a_extrq VR128:$src,
VR128:$mask))]>,
- PD, Sched<[SchedWriteVecALU.XMM]>;
+ TB, PD, Sched<[SchedWriteVecALU.XMM]>;
def INSERTQI : Ii8<0x78, MRMSrcReg, (outs VR128:$dst),
(ins VR128:$src, VR128:$src2, u8imm:$len, u8imm:$idx),
"insertq\t{$idx, $len, $src2, $src|$src, $src2, $len, $idx}",
[(set VR128:$dst, (X86insertqi VR128:$src, VR128:$src2,
timm:$len, timm:$idx))]>,
- XD, Sched<[SchedWriteVecALU.XMM]>;
+ TB, XD, Sched<[SchedWriteVecALU.XMM]>;
def INSERTQ : I<0x79, MRMSrcReg, (outs VR128:$dst),
(ins VR128:$src, VR128:$mask),
"insertq\t{$mask, $src|$src, $mask}",
[(set VR128:$dst, (int_x86_sse4a_insertq VR128:$src,
VR128:$mask))]>,
- XD, Sched<[SchedWriteVecALU.XMM]>;
+ TB, XD, Sched<[SchedWriteVecALU.XMM]>;
}
} // ExeDomain = SSEPackedInt
@@ -7026,10 +7062,10 @@ def INSERTQ : I<0x79, MRMSrcReg, (outs VR128:$dst),
let AddedComplexity = 400 in { // Prefer non-temporal versions
let hasSideEffects = 0, mayStore = 1, SchedRW = [SchedWriteFMoveLSNT.Scl.MR] in {
def MOVNTSS : I<0x2B, MRMDestMem, (outs), (ins f32mem:$dst, VR128:$src),
- "movntss\t{$src, $dst|$dst, $src}", []>, XS;
+ "movntss\t{$src, $dst|$dst, $src}", []>, TB, XS;
def MOVNTSD : I<0x2B, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src),
- "movntsd\t{$src, $dst|$dst, $src}", []>, XD;
+ "movntsd\t{$src, $dst|$dst, $src}", []>, TB, XD;
} // SchedRW
def : Pat<(nontemporalstore FR32:$src, addr:$dst),
@@ -7133,11 +7169,11 @@ let isCommutable = 1 in
def VPERM2F128rr : AVXAIi8<0x06, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2, u8imm:$src3),
"vperm2f128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}", []>,
- VEX_4V, VEX_L, Sched<[WriteFShuffle256]>;
+ VEX, VVVV, VEX_L, Sched<[WriteFShuffle256]>;
def VPERM2F128rm : AVXAIi8<0x06, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, f256mem:$src2, u8imm:$src3),
"vperm2f128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}", []>,
- VEX_4V, VEX_L, Sched<[WriteFShuffle256.Folded, WriteFShuffle256.ReadAfterFold]>;
+ VEX, VVVV, VEX_L, Sched<[WriteFShuffle256.Folded, WriteFShuffle256.ReadAfterFold]>;
}
// Immediate transform to help with commuting.
@@ -7176,12 +7212,12 @@ let hasSideEffects = 0, ExeDomain = SSEPackedSingle in {
def VINSERTF128rr : AVXAIi8<0x18, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR128:$src2, u8imm:$src3),
"vinsertf128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
- []>, Sched<[WriteFShuffle256]>, VEX_4V, VEX_L;
+ []>, Sched<[WriteFShuffle256]>, VEX, VVVV, VEX_L;
let mayLoad = 1 in
def VINSERTF128rm : AVXAIi8<0x18, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, f128mem:$src2, u8imm:$src3),
"vinsertf128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
- []>, Sched<[WriteFShuffle256.Folded, WriteFShuffle256.ReadAfterFold]>, VEX_4V, VEX_L;
+ []>, Sched<[WriteFShuffle256.Folded, WriteFShuffle256.ReadAfterFold]>, VEX, VVVV, VEX_L;
}
// To create a 256-bit all ones value, we should produce VCMPTRUEPS
@@ -7279,22 +7315,22 @@ multiclass avx_movmask_rm<bits<8> opc_rm, bits<8> opc_mr, string OpcodeStr,
(ins VR128:$src1, f128mem:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR128:$dst, (IntLd addr:$src2, VR128:$src1))]>,
- VEX_4V, Sched<[schedX.RM]>;
+ VEX, VVVV, Sched<[schedX.RM]>;
def Yrm : AVX8I<opc_rm, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, f256mem:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR256:$dst, (IntLd256 addr:$src2, VR256:$src1))]>,
- VEX_4V, VEX_L, Sched<[schedY.RM]>;
+ VEX, VVVV, VEX_L, Sched<[schedY.RM]>;
def mr : AVX8I<opc_mr, MRMDestMem, (outs),
(ins f128mem:$dst, VR128:$src1, VR128:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(IntSt addr:$dst, VR128:$src1, VR128:$src2)]>,
- VEX_4V, Sched<[schedX.MR]>;
+ VEX, VVVV, Sched<[schedX.MR]>;
def Ymr : AVX8I<opc_mr, MRMDestMem, (outs),
(ins f256mem:$dst, VR256:$src1, VR256:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(IntSt256 addr:$dst, VR256:$src1, VR256:$src2)]>,
- VEX_4V, VEX_L, Sched<[schedY.MR]>;
+ VEX, VVVV, VEX_L, Sched<[schedY.MR]>;
}
let ExeDomain = SSEPackedSingle in
@@ -7325,14 +7361,14 @@ multiclass avx_vnni_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR128:$dst, (v4i32 (OpNode VR128:$src1,
VR128:$src2, VR128:$src3)))]>,
- VEX_4V, Sched<[SchedWriteVecIMul.XMM]>;
+ VEX, VVVV, Sched<[SchedWriteVecIMul.XMM]>;
def rm : AVX8I<opc, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, VR128:$src2, i128mem:$src3),
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR128:$dst, (v4i32 (OpNode VR128:$src1, VR128:$src2,
(loadv4i32 addr:$src3))))]>,
- VEX_4V, Sched<[SchedWriteVecIMul.XMM.Folded,
+ VEX, VVVV, Sched<[SchedWriteVecIMul.XMM.Folded,
SchedWriteVecIMul.XMM.ReadAfterFold,
SchedWriteVecIMul.XMM.ReadAfterFold]>;
@@ -7342,14 +7378,14 @@ multiclass avx_vnni_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR256:$dst, (v8i32 (OpNode VR256:$src1,
VR256:$src2, VR256:$src3)))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
def Yrm : AVX8I<opc, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2, i256mem:$src3),
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR256:$dst, (v8i32 (OpNode VR256:$src1, VR256:$src2,
(loadv8i32 addr:$src3))))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVecIMul.YMM.Folded,
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVecIMul.YMM.Folded,
SchedWriteVecIMul.YMM.ReadAfterFold,
SchedWriteVecIMul.YMM.ReadAfterFold]>;
}
@@ -7388,13 +7424,13 @@ multiclass avx_permil<bits<8> opc_rm, bits<8> opc_rmi, string OpcodeStr,
def rr : AVX8I<opc_rm, MRMSrcReg, (outs RC:$dst),
(ins RC:$src1, RC:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
- [(set RC:$dst, (f_vt (X86VPermilpv RC:$src1, (i_vt RC:$src2))))]>, VEX_4V,
+ [(set RC:$dst, (f_vt (X86VPermilpv RC:$src1, (i_vt RC:$src2))))]>, VEX, VVVV,
Sched<[varsched]>;
def rm : AVX8I<opc_rm, MRMSrcMem, (outs RC:$dst),
(ins RC:$src1, x86memop_i:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set RC:$dst, (f_vt (X86VPermilpv RC:$src1,
- (i_vt (load addr:$src2)))))]>, VEX_4V,
+ (i_vt (load addr:$src2)))))]>, VEX, VVVV,
Sched<[varsched.Folded, sched.ReadAfterFold]>;
def ri : AVXAIi8<opc_rmi, MRMSrcReg, (outs RC:$dst),
@@ -7438,12 +7474,12 @@ let Defs = [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7,
YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15] in {
// Zero All YMM registers
def VZEROALL : I<0x77, RawFrm, (outs), (ins), "vzeroall",
- [(int_x86_avx_vzeroall)]>, PS, VEX, VEX_L,
+ [(int_x86_avx_vzeroall)]>, TB, VEX, VEX_L,
Requires<[HasAVX]>, WIG;
// Zero Upper bits of YMM registers
def VZEROUPPER : I<0x77, RawFrm, (outs), (ins), "vzeroupper",
- [(int_x86_avx_vzeroupper)]>, PS, VEX,
+ [(int_x86_avx_vzeroupper)]>, TB, VEX,
Requires<[HasAVX]>, WIG;
} // Defs
} // SchedRW
@@ -7457,11 +7493,11 @@ multiclass f16c_ph2ps<RegisterClass RC, X86MemOperand x86memop,
def rr : I<0x13, MRMSrcReg, (outs RC:$dst), (ins VR128:$src),
"vcvtph2ps\t{$src, $dst|$dst, $src}",
[(set RC:$dst, (X86any_cvtph2ps VR128:$src))]>,
- T8PD, VEX, Sched<[sched]>;
+ T8, PD, VEX, Sched<[sched]>;
let hasSideEffects = 0, mayLoad = 1 in
def rm : I<0x13, MRMSrcMem, (outs RC:$dst), (ins x86memop:$src),
"vcvtph2ps\t{$src, $dst|$dst, $src}",
- []>, T8PD, VEX, Sched<[sched.Folded]>;
+ []>, T8, PD, VEX, Sched<[sched.Folded]>;
}
multiclass f16c_ps2ph<RegisterClass RC, X86MemOperand x86memop,
@@ -7470,12 +7506,12 @@ multiclass f16c_ps2ph<RegisterClass RC, X86MemOperand x86memop,
(ins RC:$src1, i32u8imm:$src2),
"vcvtps2ph\t{$src2, $src1, $dst|$dst, $src1, $src2}",
[(set VR128:$dst, (X86any_cvtps2ph RC:$src1, timm:$src2))]>,
- TAPD, VEX, Sched<[RR]>;
+ TA, PD, VEX, Sched<[RR]>;
let hasSideEffects = 0, mayStore = 1 in
def mr : Ii8<0x1D, MRMDestMem, (outs),
(ins x86memop:$dst, RC:$src1, i32u8imm:$src2),
"vcvtps2ph\t{$src2, $src1, $dst|$dst, $src1, $src2}", []>,
- TAPD, VEX, Sched<[MR]>;
+ TA, PD, VEX, Sched<[MR]>;
}
let Predicates = [HasF16C, NoVLX] in {
@@ -7522,14 +7558,14 @@ multiclass AVX2_blend_rmi<bits<8> opc, string OpcodeStr, SDNode OpNode,
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set RC:$dst, (OpVT (OpNode RC:$src1, RC:$src2, timm:$src3)))]>,
- Sched<[sched]>, VEX_4V;
+ Sched<[sched]>, VEX, VVVV;
def rmi : AVX2AIi8<opc, MRMSrcMem, (outs RC:$dst),
(ins RC:$src1, x86memop:$src2, u8imm:$src3),
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set RC:$dst,
(OpVT (OpNode RC:$src1, (load addr:$src2), timm:$src3)))]>,
- Sched<[sched.Folded, sched.ReadAfterFold]>, VEX_4V;
+ Sched<[sched.Folded, sched.ReadAfterFold]>, VEX, VVVV;
// Pattern to commute if load is in first source.
def : Pat<(OpVT (OpNode (load addr:$src2), RC:$src1, timm:$src3)),
@@ -7779,7 +7815,7 @@ multiclass avx2_perm<bits<8> opc, string OpcodeStr,
"\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR256:$dst,
(OpVT (X86VPermv VR256:$src1, VR256:$src2)))]>,
- Sched<[Sched]>, VEX_4V, VEX_L;
+ Sched<[Sched]>, VEX, VVVV, VEX_L;
def Yrm : AVX28I<opc, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, memOp:$src2),
!strconcat(OpcodeStr,
@@ -7787,7 +7823,7 @@ multiclass avx2_perm<bits<8> opc, string OpcodeStr,
[(set VR256:$dst,
(OpVT (X86VPermv VR256:$src1,
(load addr:$src2))))]>,
- Sched<[Sched.Folded, Sched.ReadAfterFold]>, VEX_4V, VEX_L;
+ Sched<[Sched.Folded, Sched.ReadAfterFold]>, VEX, VVVV, VEX_L;
}
}
@@ -7830,11 +7866,11 @@ let isCommutable = 1 in
def VPERM2I128rr : AVX2AIi8<0x46, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2, u8imm:$src3),
"vperm2i128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}", []>,
- Sched<[WriteShuffle256]>, VEX_4V, VEX_L;
+ Sched<[WriteShuffle256]>, VEX, VVVV, VEX_L;
def VPERM2I128rm : AVX2AIi8<0x46, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, f256mem:$src2, u8imm:$src3),
"vperm2i128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}", []>,
- Sched<[WriteShuffle256.Folded, WriteShuffle256.ReadAfterFold]>, VEX_4V, VEX_L;
+ Sched<[WriteShuffle256.Folded, WriteShuffle256.ReadAfterFold]>, VEX, VVVV, VEX_L;
let Predicates = [HasAVX2] in {
defm : vperm2x128_lowering<"VPERM2I128", v4i64, loadv4i64>;
@@ -7852,12 +7888,12 @@ let hasSideEffects = 0 in {
def VINSERTI128rr : AVX2AIi8<0x38, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR128:$src2, u8imm:$src3),
"vinserti128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
- []>, Sched<[WriteShuffle256]>, VEX_4V, VEX_L;
+ []>, Sched<[WriteShuffle256]>, VEX, VVVV, VEX_L;
let mayLoad = 1 in
def VINSERTI128rm : AVX2AIi8<0x38, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, i128mem:$src2, u8imm:$src3),
"vinserti128\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}",
- []>, Sched<[WriteShuffle256.Folded, WriteShuffle256.ReadAfterFold]>, VEX_4V, VEX_L;
+ []>, Sched<[WriteShuffle256.Folded, WriteShuffle256.ReadAfterFold]>, VEX, VVVV, VEX_L;
}
let Predicates = [HasAVX2, NoVLX] in {
@@ -7903,22 +7939,22 @@ multiclass avx2_pmovmask<string OpcodeStr,
(ins VR128:$src1, i128mem:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR128:$dst, (IntLd128 addr:$src2, VR128:$src1))]>,
- VEX_4V, Sched<[schedX.RM]>;
+ VEX, VVVV, Sched<[schedX.RM]>;
def Yrm : AVX28I<0x8c, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, i256mem:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR256:$dst, (IntLd256 addr:$src2, VR256:$src1))]>,
- VEX_4V, VEX_L, Sched<[schedY.RM]>;
+ VEX, VVVV, VEX_L, Sched<[schedY.RM]>;
def mr : AVX28I<0x8e, MRMDestMem, (outs),
(ins i128mem:$dst, VR128:$src1, VR128:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(IntSt128 addr:$dst, VR128:$src1, VR128:$src2)]>,
- VEX_4V, Sched<[schedX.MR]>;
+ VEX, VVVV, Sched<[schedX.MR]>;
def Ymr : AVX28I<0x8e, MRMDestMem, (outs),
(ins i256mem:$dst, VR256:$src1, VR256:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(IntSt256 addr:$dst, VR256:$src1, VR256:$src2)]>,
- VEX_4V, VEX_L, Sched<[schedY.MR]>;
+ VEX, VVVV, VEX_L, Sched<[schedY.MR]>;
}
defm VPMASKMOVD : avx2_pmovmask<"vpmaskmovd",
@@ -7976,28 +8012,28 @@ multiclass avx2_var_shift<bits<8> opc, string OpcodeStr, SDNode OpNode,
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR128:$dst,
(vt128 (OpNode VR128:$src1, (vt128 VR128:$src2))))]>,
- VEX_4V, Sched<[SchedWriteVarVecShift.XMM]>;
+ VEX, VVVV, Sched<[SchedWriteVarVecShift.XMM]>;
def rm : AVX28I<opc, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, i128mem:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR128:$dst,
(vt128 (OpNode VR128:$src1,
(vt128 (load addr:$src2)))))]>,
- VEX_4V, Sched<[SchedWriteVarVecShift.XMM.Folded,
+ VEX, VVVV, Sched<[SchedWriteVarVecShift.XMM.Folded,
SchedWriteVarVecShift.XMM.ReadAfterFold]>;
def Yrr : AVX28I<opc, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR256:$dst,
(vt256 (OpNode VR256:$src1, (vt256 VR256:$src2))))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVarVecShift.YMM]>;
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVarVecShift.YMM]>;
def Yrm : AVX28I<opc, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, i256mem:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set VR256:$dst,
(vt256 (OpNode VR256:$src1,
(vt256 (load addr:$src2)))))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVarVecShift.YMM.Folded,
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVarVecShift.YMM.Folded,
SchedWriteVarVecShift.YMM.ReadAfterFold]>;
}
@@ -8073,12 +8109,12 @@ multiclass GF2P8MULB_rm<string OpcodeStr, ValueType OpVT,
let isCommutable = 1 in
def rr : PDI<0xCF, MRMSrcReg, (outs RC:$dst), (ins RC:$src1, RC:$src2), "",
[(set RC:$dst, (OpVT (X86GF2P8mulb RC:$src1, RC:$src2)))]>,
- Sched<[sched]>, T8PD;
+ Sched<[sched]>, T8;
def rm : PDI<0xCF, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, X86MemOp:$src2), "",
[(set RC:$dst, (OpVT (X86GF2P8mulb RC:$src1,
(MemOpFrag addr:$src2))))]>,
- Sched<[sched.Folded, sched.ReadAfterFold]>, T8PD;
+ Sched<[sched.Folded, sched.ReadAfterFold]>, T8;
}
}
@@ -8110,10 +8146,10 @@ multiclass GF2P8AFFINE_common<bits<8> Op, string OpStr, SDNode OpNode> {
let Predicates = [HasGFNI, HasAVX, NoVLX] in {
defm V#NAME : GF2P8AFFINE_rmi<Op, "v"#OpStr, v16i8, OpNode, VR128,
load, i128mem, SchedWriteVecIMul.XMM>,
- VEX_4V, REX_W;
+ VEX, VVVV, REX_W;
defm V#NAME#Y : GF2P8AFFINE_rmi<Op, "v"#OpStr, v32i8, OpNode, VR256,
load, i256mem, SchedWriteVecIMul.YMM>,
- VEX_4V, VEX_L, REX_W;
+ VEX, VVVV, VEX_L, REX_W;
}
}
@@ -8124,16 +8160,16 @@ defm GF2P8MULB : GF2P8MULB_rm<"gf2p8mulb", v16i8, VR128, memop,
i128mem, SchedWriteVecALU.XMM, 1>;
let Predicates = [HasGFNI, HasAVX, NoVLX] in {
defm VGF2P8MULB : GF2P8MULB_rm<"vgf2p8mulb", v16i8, VR128, load,
- i128mem, SchedWriteVecALU.XMM>, VEX_4V;
+ i128mem, SchedWriteVecALU.XMM>, VEX, VVVV;
defm VGF2P8MULBY : GF2P8MULB_rm<"vgf2p8mulb", v32i8, VR256, load,
- i256mem, SchedWriteVecALU.YMM>, VEX_4V, VEX_L;
+ i256mem, SchedWriteVecALU.YMM>, VEX, VVVV, VEX_L;
}
// GF2P8AFFINEINVQB, GF2P8AFFINEQB
let isCommutable = 0 in {
defm GF2P8AFFINEINVQB : GF2P8AFFINE_common<0xCF, "gf2p8affineinvqb",
- X86GF2P8affineinvqb>, TAPD;
+ X86GF2P8affineinvqb>, TA, PD;
defm GF2P8AFFINEQB : GF2P8AFFINE_common<0xCE, "gf2p8affineqb",
- X86GF2P8affineqb>, TAPD;
+ X86GF2P8affineqb>, TA, PD;
}
// AVX-IFMA
@@ -8147,28 +8183,28 @@ multiclass avx_ifma_rm<bits<8> opc, string OpcodeStr, SDNode OpNode> {
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR128:$dst, (v2i64 (OpNode VR128:$src2,
VR128:$src3, VR128:$src1)))]>,
- VEX_4V, Sched<[SchedWriteVecIMul.XMM]>;
+ VEX, VVVV, Sched<[SchedWriteVecIMul.XMM]>;
}
def rm : AVX8I<opc, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, VR128:$src2, i128mem:$src3),
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR128:$dst, (v2i64 (OpNode VR128:$src2,
(loadv2i64 addr:$src3), VR128:$src1)))]>,
- VEX_4V, Sched<[SchedWriteVecIMul.XMM]>;
+ VEX, VVVV, Sched<[SchedWriteVecIMul.XMM]>;
let isCommutable = 1 in {
def Yrr : AVX8I<opc, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2, VR256:$src3),
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR256:$dst, (v4i64 (OpNode VR256:$src2,
VR256:$src3, VR256:$src1)))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
}
def Yrm : AVX8I<opc, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2, i256mem:$src3),
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR256:$dst, (v4i64 (OpNode VR256:$src2,
(loadv4i64 addr:$src3), VR256:$src1)))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
}
defm VPMADD52HUQ : avx_ifma_rm<0xb5, "vpmadd52huq", x86vpmadd52h>, REX_W, ExplicitVEXPrefix;
@@ -8186,52 +8222,52 @@ multiclass avx_dotprod_rm<bits<8> Opc, string OpcodeStr, ValueType OpVT,
(ins RC:$src1, RC:$src2, RC:$src3),
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set RC:$dst, (OpVT (OpNode RC:$src1, RC:$src2, RC:$src3)))]>,
- VEX_4V, Sched<[Sched]>;
+ VEX, VVVV, Sched<[Sched]>;
def rm : I<Opc, MRMSrcMem, (outs RC:$dst),
(ins RC:$src1, RC:$src2, X86memop:$src3),
!strconcat(OpcodeStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set RC:$dst, (OpVT (OpNode RC:$src1, RC:$src2,
(MemOpFrag addr:$src3))))]>,
- VEX_4V, Sched<[Sched.Folded, Sched.ReadAfterFold]>;
+ VEX, VVVV, Sched<[Sched.Folded, Sched.ReadAfterFold]>;
}
let Predicates = [HasAVXVNNIINT8] in {
defm VPDPBSSD : avx_dotprod_rm<0x50,"vpdpbssd", v4i32, VR128, loadv4i32,
i128mem, X86vpdpbssd, SchedWriteVecIMul.XMM,
- 1>, T8XD;
+ 1>, T8, XD;
defm VPDPBSSDY : avx_dotprod_rm<0x50,"vpdpbssd", v8i32, VR256, loadv8i32,
i256mem, X86vpdpbssd, SchedWriteVecIMul.YMM,
- 1>, VEX_L, T8XD;
+ 1>, VEX_L, T8, XD;
defm VPDPBUUD : avx_dotprod_rm<0x50,"vpdpbuud", v4i32, VR128, loadv4i32,
i128mem, X86vpdpbuud, SchedWriteVecIMul.XMM,
- 1>, T8PS;
+ 1>, T8;
defm VPDPBUUDY : avx_dotprod_rm<0x50,"vpdpbuud", v8i32, VR256, loadv8i32,
i256mem, X86vpdpbuud, SchedWriteVecIMul.YMM,
- 1>, VEX_L, T8PS;
+ 1>, VEX_L, T8;
defm VPDPBSSDS : avx_dotprod_rm<0x51,"vpdpbssds", v4i32, VR128, loadv4i32,
i128mem, X86vpdpbssds, SchedWriteVecIMul.XMM,
- 1>, T8XD;
+ 1>, T8, XD;
defm VPDPBSSDSY : avx_dotprod_rm<0x51,"vpdpbssds", v8i32, VR256, loadv8i32,
i256mem, X86vpdpbssds, SchedWriteVecIMul.YMM,
- 1>, VEX_L, T8XD;
+ 1>, VEX_L, T8, XD;
defm VPDPBUUDS : avx_dotprod_rm<0x51,"vpdpbuuds", v4i32, VR128, loadv4i32,
i128mem, X86vpdpbuuds, SchedWriteVecIMul.XMM,
- 1>, T8PS;
+ 1>, T8;
defm VPDPBUUDSY : avx_dotprod_rm<0x51,"vpdpbuuds", v8i32, VR256, loadv8i32,
i256mem, X86vpdpbuuds, SchedWriteVecIMul.YMM,
- 1>, VEX_L, T8PS;
+ 1>, VEX_L, T8;
defm VPDPBSUD : avx_dotprod_rm<0x50,"vpdpbsud", v4i32, VR128, loadv4i32,
i128mem, X86vpdpbsud, SchedWriteVecIMul.XMM,
- 0>, T8XS;
+ 0>, T8, XS;
defm VPDPBSUDY : avx_dotprod_rm<0x50,"vpdpbsud", v8i32, VR256, loadv8i32,
i256mem, X86vpdpbsud, SchedWriteVecIMul.YMM,
- 0>, VEX_L, T8XS;
+ 0>, VEX_L, T8, XS;
defm VPDPBSUDS : avx_dotprod_rm<0x51,"vpdpbsuds", v4i32, VR128, loadv4i32,
i128mem, X86vpdpbsuds, SchedWriteVecIMul.XMM,
- 0>, T8XS;
+ 0>, T8, XS;
defm VPDPBSUDSY : avx_dotprod_rm<0x51,"vpdpbsuds", v8i32, VR256, loadv8i32,
i256mem, X86vpdpbsuds, SchedWriteVecIMul.YMM,
- 0>, VEX_L, T8XS;
+ 0>, VEX_L, T8, XS;
}
// AVX-NE-CONVERT
@@ -8270,18 +8306,18 @@ multiclass VCVTNEPS2BF16_BASE {
let Predicates = [HasAVXNECONVERT] in {
defm VBCSTNEBF162PS : AVX_NE_CONVERT_BASE<0xb1, "vbcstnebf162ps", f16mem,
- f16mem>, T8XS;
+ f16mem>, T8, XS;
defm VBCSTNESH2PS : AVX_NE_CONVERT_BASE<0xb1, "vbcstnesh2ps", f16mem, f16mem>,
- T8PD;
+ T8, PD;
defm VCVTNEEBF162PS : AVX_NE_CONVERT_BASE<0xb0, "vcvtneebf162ps", f128mem,
- f256mem>, T8XS;
+ f256mem>, T8, XS;
defm VCVTNEEPH2PS : AVX_NE_CONVERT_BASE<0xb0, "vcvtneeph2ps", f128mem,
- f256mem>, T8PD;
+ f256mem>, T8, PD;
defm VCVTNEOBF162PS : AVX_NE_CONVERT_BASE<0xb0, "vcvtneobf162ps", f128mem,
- f256mem>, T8XD;
+ f256mem>, T8, XD;
defm VCVTNEOPH2PS : AVX_NE_CONVERT_BASE<0xb0, "vcvtneoph2ps", f128mem,
- f256mem>, T8PS;
- defm VCVTNEPS2BF16 : VCVTNEPS2BF16_BASE, VEX, T8XS, ExplicitVEXPrefix;
+ f256mem>, T8;
+ defm VCVTNEPS2BF16 : VCVTNEPS2BF16_BASE, VEX, T8, XS, ExplicitVEXPrefix;
def : Pat<(v8bf16 (X86vfpround (v8f32 VR256:$src))),
(VCVTNEPS2BF16Yrr VR256:$src)>;
@@ -8301,19 +8337,19 @@ def VSHA512MSG1rr : I<0xcc, MRMSrcReg, (outs VR256:$dst),
"vsha512msg1\t{$src2, $dst|$dst, $src2}",
[(set VR256:$dst,
(int_x86_vsha512msg1 VR256:$src1, VR128:$src2))]>, VEX_L,
- VEX, T8XD, Sched<[WriteVecIMul]>;
+ VEX, T8, XD, Sched<[WriteVecIMul]>;
def VSHA512MSG2rr : I<0xcd, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2),
"vsha512msg2\t{$src2, $dst|$dst, $src2}",
[(set VR256:$dst,
(int_x86_vsha512msg2 VR256:$src1, VR256:$src2))]>, VEX_L,
- VEX, T8XD, Sched<[WriteVecIMul]>;
+ VEX, T8, XD, Sched<[WriteVecIMul]>;
def VSHA512RNDS2rr : I<0xcb, MRMSrcReg, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2, VR128:$src3),
"vsha512rnds2\t{$src3, $src2, $dst|$dst, $src2, $src3}",
[(set VR256:$dst,
(int_x86_vsha512rnds2 VR256:$src1, VR256:$src2, VR128:$src3))]>,
- VEX_L, VEX_4V, T8XD, Sched<[WriteVecIMul]>;
+ VEX_L, VEX, VVVV, T8, XD, Sched<[WriteVecIMul]>;
}
// FIXME: Is there a better scheduler class for SM3 than WriteVecIMul?
@@ -8325,14 +8361,14 @@ let Predicates = [HasSM3], Constraints = "$src1 = $dst" in {
[(set VR128:$dst,
(!cast<Intrinsic>("int_x86_"#OpStr) VR128:$src1,
VR128:$src2, VR128:$src3))]>,
- Sched<[WriteVecIMul]>, VEX_4V;
+ Sched<[WriteVecIMul]>, VEX, VVVV;
def rm : I<0xda, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, VR128:$src2, i128mem:$src3),
!strconcat(OpStr, "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
[(set VR128:$dst,
(!cast<Intrinsic>("int_x86_"#OpStr) VR128:$src1,
VR128:$src2, (loadv4i32 addr:$src3)))]>,
- Sched<[WriteVecIMul]>, VEX_4V;
+ Sched<[WriteVecIMul]>, VEX, VVVV;
}
multiclass VSM3RNDS2_Base {
@@ -8353,9 +8389,9 @@ let Predicates = [HasSM3], Constraints = "$src1 = $dst" in {
}
}
-defm VSM3MSG1 : SM3_Base<"vsm3msg1">, T8PS;
-defm VSM3MSG2 : SM3_Base<"vsm3msg2">, T8PD;
-defm VSM3RNDS2 : VSM3RNDS2_Base, VEX_4V, TAPD;
+defm VSM3MSG1 : SM3_Base<"vsm3msg1">, T8;
+defm VSM3MSG2 : SM3_Base<"vsm3msg2">, T8, PD;
+defm VSM3RNDS2 : VSM3RNDS2_Base, VEX, VVVV, TA, PD;
// FIXME: Is there a better scheduler class for SM4 than WriteVecIMul?
let Predicates = [HasSM4] in {
@@ -8376,10 +8412,10 @@ let Predicates = [HasSM4] in {
}
}
-defm VSM4KEY4 : SM4_Base<"vsm4key4", VR128, "128", loadv4i32, i128mem>, T8XS, VEX_4V;
-defm VSM4KEY4Y : SM4_Base<"vsm4key4", VR256, "256", loadv8i32, i256mem>, T8XS, VEX_L, VEX_4V;
-defm VSM4RNDS4 : SM4_Base<"vsm4rnds4", VR128, "128", loadv4i32, i128mem>, T8XD, VEX_4V;
-defm VSM4RNDS4Y : SM4_Base<"vsm4rnds4", VR256, "256", loadv8i32, i256mem>, T8XD, VEX_L, VEX_4V;
+defm VSM4KEY4 : SM4_Base<"vsm4key4", VR128, "128", loadv4i32, i128mem>, T8, XS, VEX, VVVV;
+defm VSM4KEY4Y : SM4_Base<"vsm4key4", VR256, "256", loadv8i32, i256mem>, T8, XS, VEX_L, VEX, VVVV;
+defm VSM4RNDS4 : SM4_Base<"vsm4rnds4", VR128, "128", loadv4i32, i128mem>, T8, XD, VEX, VVVV;
+defm VSM4RNDS4Y : SM4_Base<"vsm4rnds4", VR256, "256", loadv8i32, i256mem>, T8, XD, VEX_L, VEX, VVVV;
let Predicates = [HasAVXVNNIINT16], Constraints = "$src1 = $dst" in
multiclass avx_vnni_int16<bits<8> opc, string OpcodeStr, bit IsCommutable> {
@@ -8390,7 +8426,7 @@ multiclass avx_vnni_int16<bits<8> opc, string OpcodeStr, bit IsCommutable> {
[(set VR128:$dst,
(v4i32 (!cast<Intrinsic>("int_x86_avx2_"#OpcodeStr#"_128")
VR128:$src1, VR128:$src2, VR128:$src3)))]>,
- VEX_4V, Sched<[SchedWriteVecIMul.XMM]>;
+ VEX, VVVV, Sched<[SchedWriteVecIMul.XMM]>;
def rm : I<opc, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, VR128:$src2, i128mem:$src3),
@@ -8398,7 +8434,7 @@ multiclass avx_vnni_int16<bits<8> opc, string OpcodeStr, bit IsCommutable> {
[(set VR128:$dst,
(v4i32 (!cast<Intrinsic>("int_x86_avx2_"#OpcodeStr#"_128")
VR128:$src1, VR128:$src2, (loadv4i32 addr:$src3))))]>,
- VEX_4V, Sched<[SchedWriteVecIMul.XMM]>;
+ VEX, VVVV, Sched<[SchedWriteVecIMul.XMM]>;
let isCommutable = IsCommutable in
def Yrr : I<opc, MRMSrcReg, (outs VR256:$dst),
@@ -8407,7 +8443,7 @@ multiclass avx_vnni_int16<bits<8> opc, string OpcodeStr, bit IsCommutable> {
[(set VR256:$dst,
(v8i32 (!cast<Intrinsic>("int_x86_avx2_"#OpcodeStr#"_256")
VR256:$src1, VR256:$src2, VR256:$src3)))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
def Yrm : I<opc, MRMSrcMem, (outs VR256:$dst),
(ins VR256:$src1, VR256:$src2, i256mem:$src3),
@@ -8415,12 +8451,12 @@ multiclass avx_vnni_int16<bits<8> opc, string OpcodeStr, bit IsCommutable> {
[(set VR256:$dst,
(v8i32 (!cast<Intrinsic>("int_x86_avx2_"#OpcodeStr#"_256")
VR256:$src1, VR256:$src2, (loadv8i32 addr:$src3))))]>,
- VEX_4V, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
+ VEX, VVVV, VEX_L, Sched<[SchedWriteVecIMul.YMM]>;
}
-defm VPDPWSUD : avx_vnni_int16<0xd2, "vpdpwsud", 0>, T8XS;
-defm VPDPWSUDS : avx_vnni_int16<0xd3, "vpdpwsuds", 0>, T8XS;
-defm VPDPWUSD : avx_vnni_int16<0xd2, "vpdpwusd", 0>, T8PD;
-defm VPDPWUSDS : avx_vnni_int16<0xd3, "vpdpwusds", 0>, T8PD;
-defm VPDPWUUD : avx_vnni_int16<0xd2, "vpdpwuud", 1>, T8PS;
-defm VPDPWUUDS : avx_vnni_int16<0xd3, "vpdpwuuds", 1>, T8PS;
+defm VPDPWSUD : avx_vnni_int16<0xd2, "vpdpwsud", 0>, T8, XS;
+defm VPDPWSUDS : avx_vnni_int16<0xd3, "vpdpwsuds", 0>, T8, XS;
+defm VPDPWUSD : avx_vnni_int16<0xd2, "vpdpwusd", 0>, T8, PD;
+defm VPDPWUSDS : avx_vnni_int16<0xd3, "vpdpwusds", 0>, T8, PD;
+defm VPDPWUUD : avx_vnni_int16<0xd2, "vpdpwuud", 1>, T8;
+defm VPDPWUUDS : avx_vnni_int16<0xd3, "vpdpwuuds", 1>, T8;
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrShiftRotate.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrShiftRotate.td
index 48bf23f8cbf7..d13e3b7af69a 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrShiftRotate.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrShiftRotate.td
@@ -829,12 +829,12 @@ multiclass bmi_rotate<string asm, RegisterClass RC, X86MemOperand x86memop,
let hasSideEffects = 0 in {
def ri#Suffix : Ii8<0xF0, MRMSrcReg, (outs RC:$dst), (ins RC:$src1, u8imm:$src2),
!strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), []>,
- TAXD, VEX, Sched<[WriteShift]>;
+ TA, XD, VEX, Sched<[WriteShift]>;
let mayLoad = 1 in
def mi#Suffix : Ii8<0xF0, MRMSrcMem, (outs RC:$dst),
(ins x86memop:$src1, u8imm:$src2),
!strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), []>,
- TAXD, VEX, Sched<[WriteShiftLd]>;
+ TA, XD, VEX, Sched<[WriteShiftLd]>;
}
}
@@ -860,23 +860,23 @@ let hasSideEffects = 0 in {
let Predicates = [HasBMI2, NoEGPR] in {
defm RORX32 : bmi_rotate<"rorx{l}", GR32, i32mem>;
defm RORX64 : bmi_rotate<"rorx{q}", GR64, i64mem>, REX_W;
- defm SARX32 : bmi_shift<"sarx{l}", GR32, i32mem>, T8XS;
- defm SARX64 : bmi_shift<"sarx{q}", GR64, i64mem>, T8XS, REX_W;
- defm SHRX32 : bmi_shift<"shrx{l}", GR32, i32mem>, T8XD;
- defm SHRX64 : bmi_shift<"shrx{q}", GR64, i64mem>, T8XD, REX_W;
- defm SHLX32 : bmi_shift<"shlx{l}", GR32, i32mem>, T8PD;
- defm SHLX64 : bmi_shift<"shlx{q}", GR64, i64mem>, T8PD, REX_W;
+ defm SARX32 : bmi_shift<"sarx{l}", GR32, i32mem>, T8, XS;
+ defm SARX64 : bmi_shift<"sarx{q}", GR64, i64mem>, T8, XS, REX_W;
+ defm SHRX32 : bmi_shift<"shrx{l}", GR32, i32mem>, T8, XD;
+ defm SHRX64 : bmi_shift<"shrx{q}", GR64, i64mem>, T8, XD, REX_W;
+ defm SHLX32 : bmi_shift<"shlx{l}", GR32, i32mem>, T8, PD;
+ defm SHLX64 : bmi_shift<"shlx{q}", GR64, i64mem>, T8, PD, REX_W;
}
let Predicates = [HasBMI2, HasEGPR] in {
defm RORX32 : bmi_rotate<"rorx{l}", GR32, i32mem, "_EVEX">, EVEX;
defm RORX64 : bmi_rotate<"rorx{q}", GR64, i64mem, "_EVEX">, REX_W, EVEX;
- defm SARX32 : bmi_shift<"sarx{l}", GR32, i32mem, "_EVEX">, T8XS, EVEX;
- defm SARX64 : bmi_shift<"sarx{q}", GR64, i64mem, "_EVEX">, T8XS, REX_W, EVEX;
- defm SHRX32 : bmi_shift<"shrx{l}", GR32, i32mem, "_EVEX">, T8XD, EVEX;
- defm SHRX64 : bmi_shift<"shrx{q}", GR64, i64mem, "_EVEX">, T8XD, REX_W, EVEX;
- defm SHLX32 : bmi_shift<"shlx{l}", GR32, i32mem, "_EVEX">, T8PD, EVEX;
- defm SHLX64 : bmi_shift<"shlx{q}", GR64, i64mem, "_EVEX">, T8PD, REX_W, EVEX;
+ defm SARX32 : bmi_shift<"sarx{l}", GR32, i32mem, "_EVEX">, T8, XS, EVEX;
+ defm SARX64 : bmi_shift<"sarx{q}", GR64, i64mem, "_EVEX">, T8, XS, REX_W, EVEX;
+ defm SHRX32 : bmi_shift<"shrx{l}", GR32, i32mem, "_EVEX">, T8, XD, EVEX;
+ defm SHRX64 : bmi_shift<"shrx{q}", GR64, i64mem, "_EVEX">, T8, XD, REX_W, EVEX;
+ defm SHLX32 : bmi_shift<"shlx{l}", GR32, i32mem, "_EVEX">, T8, PD, EVEX;
+ defm SHLX64 : bmi_shift<"shlx{q}", GR64, i64mem, "_EVEX">, T8, PD, REX_W, EVEX;
}
let Predicates = [HasBMI2] in {
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td
index cbb5d4ed5bbd..efb58c6102dd 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td
@@ -426,31 +426,31 @@ let SchedRW = [WriteSystem] in {
let Uses = [EAX, ECX, EDX] in
def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", []>, TB;
let Uses = [EAX, ECX, EDX] in
-def WRMSRNS : I<0x01, MRM_C6, (outs), (ins), "wrmsrns", []>, PS;
+def WRMSRNS : I<0x01, MRM_C6, (outs), (ins), "wrmsrns", []>, TB;
let Defs = [EAX, EDX], Uses = [ECX] in
def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", []>, TB;
let Defs = [RAX, EFLAGS], Uses = [RBX, RCX], Predicates = [In64BitMode] in
-def PBNDKB : I<0x01, MRM_C7, (outs), (ins), "pbndkb", []>, PS;
+def PBNDKB : I<0x01, MRM_C7, (outs), (ins), "pbndkb", []>, TB;
let Uses = [RSI, RDI, RCX], Predicates = [In64BitMode] in {
-def WRMSRLIST : I<0x01, MRM_C6, (outs), (ins), "wrmsrlist", []>, XS;
-def RDMSRLIST : I<0x01, MRM_C6, (outs), (ins), "rdmsrlist", []>, XD;
+def WRMSRLIST : I<0x01, MRM_C6, (outs), (ins), "wrmsrlist", []>, TB, XS;
+def RDMSRLIST : I<0x01, MRM_C6, (outs), (ins), "rdmsrlist", []>, TB, XD;
}
let Predicates = [HasUSERMSR], mayLoad = 1 in {
def URDMSRrr : I<0xf8, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
"urdmsr\t{$src, $dst|$dst, $src}",
- [(set GR64:$dst, (int_x86_urdmsr GR64:$src))]>, T8XD;
+ [(set GR64:$dst, (int_x86_urdmsr GR64:$src))]>, T8, XD;
def URDMSRri : Ii32<0xf8, MRM0r, (outs GR64:$dst), (ins i64i32imm:$imm),
"urdmsr\t{$imm, $dst|$dst, $imm}",
- [(set GR64:$dst, (int_x86_urdmsr i64immSExt32_su:$imm))]>, T_MAP7XD, VEX;
+ [(set GR64:$dst, (int_x86_urdmsr i64immSExt32_su:$imm))]>, T_MAP7, XD, VEX;
}
let Predicates = [HasUSERMSR], mayStore = 1 in {
def UWRMSRrr : I<0xf8, MRMSrcReg, (outs), (ins GR64:$src1, GR64:$src2),
"uwrmsr\t{$src1, $src2|$src2, $src1}",
- [(int_x86_uwrmsr GR64:$src1, GR64:$src2)]>, T8XS;
+ [(int_x86_uwrmsr GR64:$src1, GR64:$src2)]>, T8, XS;
def UWRMSRir : Ii32<0xf8, MRM0r, (outs), (ins GR64:$src, i64i32imm:$imm),
"uwrmsr\t{$src, $imm|$imm, $src}",
- [(int_x86_uwrmsr GR64:$src, i64immSExt32_su:$imm)]>, T_MAP7XS, VEX;
+ [(int_x86_uwrmsr GR64:$src, i64immSExt32_su:$imm)]>, T_MAP7, XS, VEX;
}
let Defs = [RAX, RDX], Uses = [ECX] in
def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", []>, TB;
@@ -481,12 +481,12 @@ let Defs = [EAX, EBX, ECX, EDX], Uses = [EAX, ECX] in
// Cache instructions
let SchedRW = [WriteSystem] in {
def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB;
-def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [(int_x86_wbinvd)]>, PS;
+def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [(int_x86_wbinvd)]>, TB, PS;
// wbnoinvd is like wbinvd, except without invalidation
// encoding: like wbinvd + an 0xF3 prefix
def WBNOINVD : I<0x09, RawFrm, (outs), (ins), "wbnoinvd",
- [(int_x86_wbnoinvd)]>, XS,
+ [(int_x86_wbnoinvd)]>, TB, XS,
Requires<[HasWBNOINVD]>;
} // SchedRW
@@ -497,57 +497,74 @@ let SchedRW = [WriteSystem] in {
let Uses = [SSP] in {
let Defs = [SSP] in {
def INCSSPD : I<0xAE, MRM5r, (outs), (ins GR32:$src), "incsspd\t$src",
- [(int_x86_incsspd GR32:$src)]>, XS;
+ [(int_x86_incsspd GR32:$src)]>, TB, XS;
def INCSSPQ : RI<0xAE, MRM5r, (outs), (ins GR64:$src), "incsspq\t$src",
- [(int_x86_incsspq GR64:$src)]>, XS;
+ [(int_x86_incsspq GR64:$src)]>, TB, XS;
} // Defs SSP
let Constraints = "$src = $dst" in {
def RDSSPD : I<0x1E, MRM1r, (outs GR32:$dst), (ins GR32:$src),
"rdsspd\t$dst",
- [(set GR32:$dst, (int_x86_rdsspd GR32:$src))]>, XS;
+ [(set GR32:$dst, (int_x86_rdsspd GR32:$src))]>, TB, XS;
def RDSSPQ : RI<0x1E, MRM1r, (outs GR64:$dst), (ins GR64:$src),
"rdsspq\t$dst",
- [(set GR64:$dst, (int_x86_rdsspq GR64:$src))]>, XS;
+ [(set GR64:$dst, (int_x86_rdsspq GR64:$src))]>, TB, XS;
}
let Defs = [SSP] in {
def SAVEPREVSSP : I<0x01, MRM_EA, (outs), (ins), "saveprevssp",
- [(int_x86_saveprevssp)]>, XS;
+ [(int_x86_saveprevssp)]>, TB, XS;
def RSTORSSP : I<0x01, MRM5m, (outs), (ins i32mem:$src),
"rstorssp\t$src",
- [(int_x86_rstorssp addr:$src)]>, XS;
+ [(int_x86_rstorssp addr:$src)]>, TB, XS;
} // Defs SSP
} // Uses SSP
+let Predicates = [NoEGPR] in {
def WRSSD : I<0xF6, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
"wrssd\t{$src, $dst|$dst, $src}",
- [(int_x86_wrssd GR32:$src, addr:$dst)]>, T8PS;
+ [(int_x86_wrssd GR32:$src, addr:$dst)]>, T8;
def WRSSQ : RI<0xF6, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
"wrssq\t{$src, $dst|$dst, $src}",
- [(int_x86_wrssq GR64:$src, addr:$dst)]>, T8PS;
+ [(int_x86_wrssq GR64:$src, addr:$dst)]>, T8;
def WRUSSD : I<0xF5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
"wrussd\t{$src, $dst|$dst, $src}",
- [(int_x86_wrussd GR32:$src, addr:$dst)]>, T8PD;
+ [(int_x86_wrussd GR32:$src, addr:$dst)]>, T8, PD;
def WRUSSQ : RI<0xF5, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
"wrussq\t{$src, $dst|$dst, $src}",
- [(int_x86_wrussq GR64:$src, addr:$dst)]>, T8PD;
+ [(int_x86_wrussq GR64:$src, addr:$dst)]>, T8, PD;
+}
+
+let Predicates = [HasEGPR, In64BitMode] in {
+ def WRSSD_EVEX : I<0x66, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
+ "wrssd\t{$src, $dst|$dst, $src}",
+ [(int_x86_wrssd GR32:$src, addr:$dst)]>, EVEX, NoCD8, T_MAP4;
+ def WRSSQ_EVEX : RI<0x66, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
+ "wrssq\t{$src, $dst|$dst, $src}",
+ [(int_x86_wrssq GR64:$src, addr:$dst)]>, EVEX, NoCD8, T_MAP4;
+ def WRUSSD_EVEX : I<0x65, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
+ "wrussd\t{$src, $dst|$dst, $src}",
+ [(int_x86_wrussd GR32:$src, addr:$dst)]>, EVEX, NoCD8, T_MAP4, PD;
+ def WRUSSQ_EVEX : RI<0x65, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
+ "wrussq\t{$src, $dst|$dst, $src}",
+ [(int_x86_wrussq GR64:$src, addr:$dst)]>, EVEX, NoCD8, T_MAP4, PD;
+}
let Defs = [SSP] in {
let Uses = [SSP] in {
def SETSSBSY : I<0x01, MRM_E8, (outs), (ins), "setssbsy",
- [(int_x86_setssbsy)]>, XS;
+ [(int_x86_setssbsy)]>, TB, XS;
} // Uses SSP
def CLRSSBSY : I<0xAE, MRM6m, (outs), (ins i32mem:$src),
"clrssbsy\t$src",
- [(int_x86_clrssbsy addr:$src)]>, XS;
+ [(int_x86_clrssbsy addr:$src)]>, TB, XS;
} // Defs SSP
} // SchedRW
let SchedRW = [WriteSystem] in {
- def ENDBR64 : I<0x1E, MRM_FA, (outs), (ins), "endbr64", []>, XS;
- def ENDBR32 : I<0x1E, MRM_FB, (outs), (ins), "endbr32", []>, XS;
+ def ENDBR64 : I<0x1E, MRM_FA, (outs), (ins), "endbr64", []>, TB, XS;
+ def ENDBR32 : I<0x1E, MRM_FB, (outs), (ins), "endbr32", []>, TB, XS;
} // SchedRW
//===----------------------------------------------------------------------===//
@@ -557,51 +574,51 @@ let SchedRW = [WriteSystem] in {
// on Windows without needing to enable the xsave feature to be compatible with
// MSVC.
let Defs = [EDX, EAX], Uses = [ECX] in
-def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, PS;
+def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB;
let Uses = [EDX, EAX, ECX] in
def XSETBV : I<0x01, MRM_D1, (outs), (ins),
"xsetbv",
- [(int_x86_xsetbv ECX, EDX, EAX)]>, PS;
+ [(int_x86_xsetbv ECX, EDX, EAX)]>, TB;
let Uses = [EDX, EAX] in {
def XSAVE : I<0xAE, MRM4m, (outs), (ins opaquemem:$dst),
"xsave\t$dst",
- [(int_x86_xsave addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE]>;
+ [(int_x86_xsave addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVE]>;
def XSAVE64 : RI<0xAE, MRM4m, (outs), (ins opaquemem:$dst),
"xsave64\t$dst",
- [(int_x86_xsave64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE, In64BitMode]>;
+ [(int_x86_xsave64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVE, In64BitMode]>;
def XRSTOR : I<0xAE, MRM5m, (outs), (ins opaquemem:$dst),
"xrstor\t$dst",
- [(int_x86_xrstor addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE]>;
+ [(int_x86_xrstor addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVE]>;
def XRSTOR64 : RI<0xAE, MRM5m, (outs), (ins opaquemem:$dst),
"xrstor64\t$dst",
- [(int_x86_xrstor64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE, In64BitMode]>;
+ [(int_x86_xrstor64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVE, In64BitMode]>;
def XSAVEOPT : I<0xAE, MRM6m, (outs), (ins opaquemem:$dst),
"xsaveopt\t$dst",
- [(int_x86_xsaveopt addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVEOPT]>;
+ [(int_x86_xsaveopt addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVEOPT]>;
def XSAVEOPT64 : RI<0xAE, MRM6m, (outs), (ins opaquemem:$dst),
"xsaveopt64\t$dst",
- [(int_x86_xsaveopt64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVEOPT, In64BitMode]>;
+ [(int_x86_xsaveopt64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVEOPT, In64BitMode]>;
def XSAVEC : I<0xC7, MRM4m, (outs), (ins opaquemem:$dst),
"xsavec\t$dst",
- [(int_x86_xsavec addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVEC]>;
+ [(int_x86_xsavec addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVEC]>;
def XSAVEC64 : RI<0xC7, MRM4m, (outs), (ins opaquemem:$dst),
"xsavec64\t$dst",
- [(int_x86_xsavec64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVEC, In64BitMode]>;
+ [(int_x86_xsavec64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVEC, In64BitMode]>;
def XSAVES : I<0xC7, MRM5m, (outs), (ins opaquemem:$dst),
"xsaves\t$dst",
- [(int_x86_xsaves addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVES]>;
+ [(int_x86_xsaves addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVES]>;
def XSAVES64 : RI<0xC7, MRM5m, (outs), (ins opaquemem:$dst),
"xsaves64\t$dst",
- [(int_x86_xsaves64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE, In64BitMode]>;
+ [(int_x86_xsaves64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVE, In64BitMode]>;
def XRSTORS : I<0xC7, MRM3m, (outs), (ins opaquemem:$dst),
"xrstors\t$dst",
- [(int_x86_xrstors addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVES]>;
+ [(int_x86_xrstors addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVES]>;
def XRSTORS64 : RI<0xC7, MRM3m, (outs), (ins opaquemem:$dst),
"xrstors64\t$dst",
- [(int_x86_xrstors64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVES, In64BitMode]>;
+ [(int_x86_xrstors64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVES, In64BitMode]>;
} // Uses
} // SchedRW
@@ -634,10 +651,10 @@ let Defs = [RAX, RDX, RSI], Uses = [RAX, RSI] in
let SchedRW = [WriteSystem] in {
let Defs = [EAX, EDX], Uses = [ECX] in
def RDPKRUr : I<0x01, MRM_EE, (outs), (ins), "rdpkru",
- [(set EAX, (X86rdpkru ECX)), (implicit EDX)]>, PS;
+ [(set EAX, (X86rdpkru ECX)), (implicit EDX)]>, TB;
let Uses = [EAX, ECX, EDX] in
def WRPKRUr : I<0x01, MRM_EF, (outs), (ins), "wrpkru",
- [(X86wrpkru EAX, EDX, ECX)]>, PS;
+ [(X86wrpkru EAX, EDX, ECX)]>, TB;
} // SchedRW
//===----------------------------------------------------------------------===//
@@ -645,28 +662,28 @@ let Uses = [EAX, ECX, EDX] in
let Predicates = [HasFSGSBase, In64BitMode], SchedRW = [WriteSystem] in {
def RDFSBASE : I<0xAE, MRM0r, (outs GR32:$dst), (ins),
"rdfsbase{l}\t$dst",
- [(set GR32:$dst, (int_x86_rdfsbase_32))]>, XS;
+ [(set GR32:$dst, (int_x86_rdfsbase_32))]>, TB, XS;
def RDFSBASE64 : RI<0xAE, MRM0r, (outs GR64:$dst), (ins),
"rdfsbase{q}\t$dst",
- [(set GR64:$dst, (int_x86_rdfsbase_64))]>, XS;
+ [(set GR64:$dst, (int_x86_rdfsbase_64))]>, TB, XS;
def RDGSBASE : I<0xAE, MRM1r, (outs GR32:$dst), (ins),
"rdgsbase{l}\t$dst",
- [(set GR32:$dst, (int_x86_rdgsbase_32))]>, XS;
+ [(set GR32:$dst, (int_x86_rdgsbase_32))]>, TB, XS;
def RDGSBASE64 : RI<0xAE, MRM1r, (outs GR64:$dst), (ins),
"rdgsbase{q}\t$dst",
- [(set GR64:$dst, (int_x86_rdgsbase_64))]>, XS;
+ [(set GR64:$dst, (int_x86_rdgsbase_64))]>, TB, XS;
def WRFSBASE : I<0xAE, MRM2r, (outs), (ins GR32:$src),
"wrfsbase{l}\t$src",
- [(int_x86_wrfsbase_32 GR32:$src)]>, XS;
+ [(int_x86_wrfsbase_32 GR32:$src)]>, TB, XS;
def WRFSBASE64 : RI<0xAE, MRM2r, (outs), (ins GR64:$src),
"wrfsbase{q}\t$src",
- [(int_x86_wrfsbase_64 GR64:$src)]>, XS;
+ [(int_x86_wrfsbase_64 GR64:$src)]>, TB, XS;
def WRGSBASE : I<0xAE, MRM3r, (outs), (ins GR32:$src),
"wrgsbase{l}\t$src",
- [(int_x86_wrgsbase_32 GR32:$src)]>, XS;
+ [(int_x86_wrgsbase_32 GR32:$src)]>, TB, XS;
def WRGSBASE64 : RI<0xAE, MRM3r, (outs), (ins GR64:$src),
"wrgsbase{q}\t$src",
- [(int_x86_wrgsbase_64 GR64:$src)]>, XS;
+ [(int_x86_wrgsbase_64 GR64:$src)]>, TB, XS;
}
//===----------------------------------------------------------------------===//
@@ -674,15 +691,15 @@ let Predicates = [HasFSGSBase, In64BitMode], SchedRW = [WriteSystem] in {
let SchedRW = [WriteSystem] in {
def INVPCID32 : I<0x82, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2),
"invpcid\t{$src2, $src1|$src1, $src2}",
- [(int_x86_invpcid GR32:$src1, addr:$src2)]>, T8PD,
+ [(int_x86_invpcid GR32:$src1, addr:$src2)]>, T8, PD,
Requires<[Not64BitMode, HasINVPCID]>;
def INVPCID64 : I<0x82, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
- "invpcid\t{$src2, $src1|$src1, $src2}", []>, T8PD,
+ "invpcid\t{$src2, $src1|$src1, $src2}", []>, T8, PD,
Requires<[In64BitMode, HasINVPCID]>;
def INVPCID64_EVEX : I<0xF2, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
"invpcid\t{$src2, $src1|$src1, $src2}", []>,
- EVEX_NoCD8, T_MAP4XS, Requires<[In64BitMode, HasINVPCID]>;
+ EVEX, NoCD8, T_MAP4, XS, Requires<[In64BitMode, HasINVPCID]>;
} // SchedRW
let Predicates = [In64BitMode, HasINVPCID] in {
@@ -701,15 +718,15 @@ let Predicates = [In64BitMode, HasINVPCID] in {
//===----------------------------------------------------------------------===//
// SMAP Instruction
let Defs = [EFLAGS], SchedRW = [WriteSystem] in {
- def CLAC : I<0x01, MRM_CA, (outs), (ins), "clac", []>, PS;
- def STAC : I<0x01, MRM_CB, (outs), (ins), "stac", []>, PS;
+ def CLAC : I<0x01, MRM_CA, (outs), (ins), "clac", []>, TB;
+ def STAC : I<0x01, MRM_CB, (outs), (ins), "stac", []>, TB;
}
//===----------------------------------------------------------------------===//
// SMX Instruction
let SchedRW = [WriteSystem] in {
let Uses = [RAX, RBX, RCX, RDX], Defs = [RAX, RBX, RCX] in {
- def GETSEC : I<0x37, RawFrm, (outs), (ins), "getsec", []>, PS;
+ def GETSEC : I<0x37, RawFrm, (outs), (ins), "getsec", []>, TB;
} // Uses, Defs
} // SchedRW
@@ -730,9 +747,9 @@ def STI : I<0xFB, RawFrm, (outs), (ins), "sti", []>;
// RDPID Instruction
let SchedRW = [WriteSystem] in {
def RDPID32 : I<0xC7, MRM7r, (outs GR32:$dst), (ins),
- "rdpid\t$dst", [(set GR32:$dst, (int_x86_rdpid))]>, XS,
+ "rdpid\t$dst", [(set GR32:$dst, (int_x86_rdpid))]>, TB, XS,
Requires<[Not64BitMode, HasRDPID]>;
-def RDPID64 : I<0xC7, MRM7r, (outs GR64:$dst), (ins), "rdpid\t$dst", []>, XS,
+def RDPID64 : I<0xC7, MRM7r, (outs GR64:$dst), (ins), "rdpid\t$dst", []>, TB, XS,
Requires<[In64BitMode, HasRDPID]>;
} // SchedRW
@@ -748,17 +765,17 @@ let Predicates = [In64BitMode, HasRDPID] in {
// PTWRITE Instruction - Write Data to a Processor Trace Packet
let SchedRW = [WriteSystem] in {
def PTWRITEm: I<0xAE, MRM4m, (outs), (ins i32mem:$dst),
- "ptwrite{l}\t$dst", [(int_x86_ptwrite32 (loadi32 addr:$dst))]>, XS,
+ "ptwrite{l}\t$dst", [(int_x86_ptwrite32 (loadi32 addr:$dst))]>, TB, XS,
Requires<[HasPTWRITE]>;
def PTWRITE64m : RI<0xAE, MRM4m, (outs), (ins i64mem:$dst),
- "ptwrite{q}\t$dst", [(int_x86_ptwrite64 (loadi64 addr:$dst))]>, XS,
+ "ptwrite{q}\t$dst", [(int_x86_ptwrite64 (loadi64 addr:$dst))]>, TB, XS,
Requires<[In64BitMode, HasPTWRITE]>;
def PTWRITEr : I<0xAE, MRM4r, (outs), (ins GR32:$dst),
- "ptwrite{l}\t$dst", [(int_x86_ptwrite32 GR32:$dst)]>, XS,
+ "ptwrite{l}\t$dst", [(int_x86_ptwrite32 GR32:$dst)]>, TB, XS,
Requires<[HasPTWRITE]>;
def PTWRITE64r : RI<0xAE, MRM4r, (outs), (ins GR64:$dst),
- "ptwrite{q}\t$dst", [(int_x86_ptwrite64 GR64:$dst)]>, XS,
+ "ptwrite{q}\t$dst", [(int_x86_ptwrite64 GR64:$dst)]>, TB, XS,
Requires<[In64BitMode, HasPTWRITE]>;
} // SchedRW
@@ -767,7 +784,7 @@ def PTWRITE64r : RI<0xAE, MRM4r, (outs), (ins GR64:$dst),
let SchedRW = [WriteSystem] in {
let Uses = [ECX], Defs = [EAX, EDX] in
- def RDPRU : I<0x01, MRM_FD, (outs), (ins), "rdpru", []>, PS,
+ def RDPRU : I<0x01, MRM_FD, (outs), (ins), "rdpru", []>, TB,
Requires<[HasRDPRU]>;
}
@@ -786,6 +803,6 @@ let Uses = [ECX], Defs = [EAX, EDX] in
let SchedRW = [WriteSystem] in {
let Uses = [RAX, RBX, RCX, RDX], Defs = [RAX, RBX, RCX, RDX, EFLAGS] in
- def PCONFIG : I<0x01, MRM_C5, (outs), (ins), "pconfig", []>, PS,
+ def PCONFIG : I<0x01, MRM_C5, (outs), (ins), "pconfig", []>, TB,
Requires<[HasPCONFIG]>;
} // SchedRW
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTBM.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTBM.td
index ed514038a12e..09200f0c1a9f 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTBM.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTBM.td
@@ -46,11 +46,11 @@ multiclass tbm_binary_rm<bits<8> opc, Format FormReg, Format FormMem,
let hasSideEffects = 0 in {
def rr : I<opc, FormReg, (outs RC:$dst), (ins RC:$src),
!strconcat(OpcodeStr,"\t{$src, $dst|$dst, $src}"), []>,
- XOP_4V, XOP9, Sched<[Sched]>;
+ XOP, VVVV, XOP9, Sched<[Sched]>;
let mayLoad = 1 in
def rm : I<opc, FormMem, (outs RC:$dst), (ins x86memop:$src),
!strconcat(OpcodeStr,"\t{$src, $dst|$dst, $src}"), []>,
- XOP_4V, XOP9, Sched<[Sched.Folded]>;
+ XOP, VVVV, XOP9, Sched<[Sched.Folded]>;
}
}
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTDX.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTDX.td
index 8d7cd6082095..fe01677b2ea1 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTDX.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTDX.td
@@ -17,23 +17,17 @@
// 64-bit only instructions
let SchedRW = [WriteSystem], Predicates = [In64BitMode] in {
// SEAMCALL - Call to SEAM VMX-root Operation Module
-def SEAMCALL : I<0x01, MRM_CF, (outs), (ins),
- "seamcall", []>, PD;
+def SEAMCALL : I<0x01, MRM_CF, (outs), (ins), "seamcall", []>, TB, PD;
// SEAMRET - Return to Legacy VMX-root Operation
-def SEAMRET : I<0x01, MRM_CD, (outs), (ins),
- "seamret", []>, PD;
+def SEAMRET : I<0x01, MRM_CD, (outs), (ins), "seamret", []>, TB, PD;
// SEAMOPS - SEAM Operations
-def SEAMOPS : I<0x01, MRM_CE, (outs), (ins),
- "seamops", []>, PD;
-
+def SEAMOPS : I<0x01, MRM_CE, (outs), (ins), "seamops", []>, TB, PD;
} // SchedRW
// common instructions
let SchedRW = [WriteSystem] in {
// TDCALL - Call SEAM Module Functions
-def TDCALL : I<0x01, MRM_CC, (outs), (ins),
- "tdcall", []>, PD;
-
+def TDCALL : I<0x01, MRM_CC, (outs), (ins), "tdcall", []>, TB, PD;
} // SchedRW
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTSX.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTSX.td
index 7671eb4676ee..57604b682d54 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTSX.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrTSX.td
@@ -37,11 +37,11 @@ def XABORT_DEF : I<0, Pseudo, (outs), (ins), "# XABORT DEF", []>;
}
def XEND : I<0x01, MRM_D5, (outs), (ins),
- "xend", [(int_x86_xend)]>, PS, Requires<[HasRTM]>;
+ "xend", [(int_x86_xend)]>, TB, Requires<[HasRTM]>;
let Defs = [EFLAGS] in
def XTEST : I<0x01, MRM_D6, (outs), (ins),
- "xtest", [(set EFLAGS, (X86xtest))]>, PS, Requires<[HasRTM]>;
+ "xtest", [(set EFLAGS, (X86xtest))]>, TB, Requires<[HasRTM]>;
def XABORT : Ii8<0xc6, MRM_F8, (outs), (ins i8imm:$imm),
"xabort\t$imm",
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrUtils.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrUtils.td
index 2f056f2ead62..9499753143d9 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrUtils.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrUtils.td
@@ -27,50 +27,26 @@ class REP { bit hasREPPrefix = 1; }
class TB { Map OpMap = TB; }
class T8 { Map OpMap = T8; }
class TA { Map OpMap = TA; }
-class XOP8 { Map OpMap = XOP8; Prefix OpPrefix = PS; }
-class XOP9 { Map OpMap = XOP9; Prefix OpPrefix = PS; }
-class XOPA { Map OpMap = XOPA; Prefix OpPrefix = PS; }
+class T_MAP4 { Map OpMap = T_MAP4; }
+class T_MAP5 { Map OpMap = T_MAP5; }
+class T_MAP6 { Map OpMap = T_MAP6; }
+class T_MAP7 { Map OpMap = T_MAP7; }
+class XOP8 { Map OpMap = XOP8; }
+class XOP9 { Map OpMap = XOP9; }
+class XOPA { Map OpMap = XOPA; }
class ThreeDNow { Map OpMap = ThreeDNow; }
-class T_MAP4 { Map OpMap = T_MAP4; }
-class T_MAP4PS : T_MAP4 { Prefix OpPrefix = PS; } // none
-class T_MAP4PD : T_MAP4 { Prefix OpPrefix = PD; } // 0x66
-class T_MAP4XS : T_MAP4 { Prefix OpPrefix = XS; } // 0xF3
-class T_MAP4XD : T_MAP4 { Prefix OpPrefix = XD; } // 0xF2
-class T_MAP5 { Map OpMap = T_MAP5; }
-class T_MAP5PS : T_MAP5 { Prefix OpPrefix = PS; } // none
-class T_MAP5PD : T_MAP5 { Prefix OpPrefix = PD; } // 0x66
-class T_MAP5XS : T_MAP5 { Prefix OpPrefix = XS; } // 0xF3
-class T_MAP5XD : T_MAP5 { Prefix OpPrefix = XD; } // 0xF2
-class T_MAP6 { Map OpMap = T_MAP6; }
-class T_MAP6PS : T_MAP6 { Prefix OpPrefix = PS; }
-class T_MAP6PD : T_MAP6 { Prefix OpPrefix = PD; }
-class T_MAP6XS : T_MAP6 { Prefix OpPrefix = XS; }
-class T_MAP6XD : T_MAP6 { Prefix OpPrefix = XD; }
-class T_MAP7 { Map OpMap = T_MAP7; }
-class T_MAP7XS : T_MAP7 { Prefix OpPrefix = XS; } // 0xF3
-class T_MAP7XD : T_MAP7 { Prefix OpPrefix = XD; } // 0xF2
-class OBXS { Prefix OpPrefix = XS; }
-class PS : TB { Prefix OpPrefix = PS; }
-class PD : TB { Prefix OpPrefix = PD; }
-class XD : TB { Prefix OpPrefix = XD; }
-class XS : TB { Prefix OpPrefix = XS; }
-class T8PS : T8 { Prefix OpPrefix = PS; }
-class T8PD : T8 { Prefix OpPrefix = PD; }
-class T8XD : T8 { Prefix OpPrefix = XD; }
-class T8XS : T8 { Prefix OpPrefix = XS; }
-class TAPS : TA { Prefix OpPrefix = PS; }
-class TAPD : TA { Prefix OpPrefix = PD; }
-class TAXD : TA { Prefix OpPrefix = XD; }
-class TAXS : TA { Prefix OpPrefix = XS; }
+class PS { Prefix OpPrefix = PS; }
+class PD { Prefix OpPrefix = PD; }
+class XD { Prefix OpPrefix = XD; }
+class XS { Prefix OpPrefix = XS; }
class VEX { Encoding OpEnc = EncVEX; }
class WIG { bit IgnoresW = 1; }
// Special version of REX_W that can be changed to VEX.W==0 for EVEX2VEX.
class VEX_W1X { bit hasREX_W = 1; bit EVEX_W1_VEX_W0 = 1; }
-class VEX_4V : VEX { bit hasVEX_4V = 1; }
class VEX_L { bit hasVEX_L = 1; }
class VEX_LIG { bit ignoresVEX_L = 1; }
+class VVVV { bit hasVEX_4V = 1; }
class EVEX { Encoding OpEnc = EncEVEX; }
-class EVEX_4V : EVEX { bit hasVEX_4V = 1; }
class EVEX_K { bit hasEVEX_K = 1; }
class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; }
class EVEX_B { bit hasEVEX_B = 1; }
@@ -86,29 +62,28 @@ class EVEX_CD8<int esize, CD8VForm form> {
int CD8_EltSize = !srl(esize, 3);
bits<3> CD8_Form = form.Value;
}
-class EVEX_NoCD8 : EVEX { bits<7> CD8_Scale = 0; }
+class NoCD8 { bits<7> CD8_Scale = 0; }
class XOP { Encoding OpEnc = EncXOP; }
-class XOP_4V : XOP { bit hasVEX_4V = 1; }
class EVEX2VEXOverride<string VEXInstrName> {
string EVEX2VEXOverride = VEXInstrName;
}
-class AVX512BIi8Base : PD {
+class AVX512BIi8Base : TB, PD {
Domain ExeDomain = SSEPackedInt;
ImmType ImmT = Imm8;
}
-class AVX512XSIi8Base : XS {
+class AVX512XSIi8Base : TB, XS {
Domain ExeDomain = SSEPackedInt;
ImmType ImmT = Imm8;
}
-class AVX512XDIi8Base : XD {
+class AVX512XDIi8Base : TB, XD {
Domain ExeDomain = SSEPackedInt;
ImmType ImmT = Imm8;
}
-class AVX512PSIi8Base : PS {
+class AVX512PSIi8Base : TB {
Domain ExeDomain = SSEPackedSingle;
ImmType ImmT = Imm8;
}
-class AVX512PDIi8Base : PD {
+class AVX512PDIi8Base : TB, PD {
Domain ExeDomain = SSEPackedDouble;
ImmType ImmT = Imm8;
}
@@ -116,6 +91,14 @@ class NotEVEX2VEXConvertible { bit notEVEX2VEXConvertible = 1; }
class ExplicitREX2Prefix { ExplicitOpPrefix explicitOpPrefix = ExplicitREX2; }
class ExplicitVEXPrefix { ExplicitOpPrefix explicitOpPrefix = ExplicitVEX; }
class ExplicitEVEXPrefix { ExplicitOpPrefix explicitOpPrefix = ExplicitEVEX; }
+class DefEFLAGS { list<Register> Defs = [EFLAGS]; }
+class UseEFLAGS { list<Register> Uses = [EFLAGS]; }
+class DisassembleOnly {
+ // The disassembler should know about this, but not the asmparser.
+ bit isCodeGenOnly = 1;
+ bit ForceDisassemble = 1;
+}
+
// SchedModel info for instruction that loads one value and gets the second
// (and possibly third) value from a register.
@@ -139,8 +122,7 @@ class X86TypeInfo<ValueType vt, string instrsuffix, RegisterClass regclass,
Operand immoperand, SDPatternOperator immoperator,
SDPatternOperator immnosuoperator, Operand imm8operand,
SDPatternOperator imm8operator, SDPatternOperator imm8nosuoperator,
- bit hasOddOpcode, OperandSize opSize,
- bit hasREX_W> {
+ bit hasEvenOpcode, bit hasREX_W> {
/// VT - This is the value type itself.
ValueType VT = vt;
@@ -189,15 +171,10 @@ class X86TypeInfo<ValueType vt, string instrsuffix, RegisterClass regclass,
SDPatternOperator Imm8NoSuOperator = imm8nosuoperator;
- /// HasOddOpcode - This bit is true if the instruction should have an odd (as
- /// opposed to even) opcode. Operations on i8 are usually even, operations on
- /// other datatypes are odd.
- bit HasOddOpcode = hasOddOpcode;
-
- /// OpSize - Selects whether the instruction needs a 0x66 prefix based on
- /// 16-bit vs 32-bit mode. i8/i64 set this to OpSizeFixed. i16 sets this
- /// to Opsize16. i32 sets this to OpSize32.
- OperandSize OpSize = opSize;
+ /// HasEvenOpcode - This bit is true if the instruction should have an even (as
+ /// opposed to odd) opcode. Operations on i8 are even, operations on
+ /// other datatypes are usually odd.
+ bit HasEvenOpcode = hasEvenOpcode;
/// HasREX_W - This bit is set to true if the instruction should have
/// the 0x40 REX prefix. This is set for i64 types.
@@ -208,16 +185,16 @@ def invalid_node : SDNode<"<<invalid_node>>", SDTIntLeaf,[],"<<invalid_node>>">;
def Xi8 : X86TypeInfo<i8, "b", GR8, loadi8, i8mem, Imm8, i8imm,
imm_su, imm, i8imm, invalid_node, invalid_node,
- 0, OpSizeFixed, 0>;
+ 1, 0>;
def Xi16 : X86TypeInfo<i16, "w", GR16, loadi16, i16mem, Imm16, i16imm,
imm_su, imm, i16i8imm, i16immSExt8_su, i16immSExt8,
- 1, OpSize16, 0>;
+ 0, 0>;
def Xi32 : X86TypeInfo<i32, "l", GR32, loadi32, i32mem, Imm32, i32imm,
imm_su, imm, i32i8imm, i32immSExt8_su, i32immSExt8,
- 1, OpSize32, 0>;
+ 0, 0>;
def Xi64 : X86TypeInfo<i64, "q", GR64, loadi64, i64mem, Imm32S, i64i32imm,
- i64immSExt32_su, i64immSExt32, i64i8imm, i64immSExt8_su,
- i64immSExt8, 1, OpSizeFixed, 1>;
+ i64immSExt32_su, i64immSExt32, i64i8imm, i64immSExt8_su,
+ i64immSExt8, 0, 1>;
// Group template arguments that can be derived from the vector type (EltNum x
// EltVT). These are things like the register class for the writemask, etc.
@@ -585,26 +562,26 @@ class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE1]>;
+ : I<o, F, outs, ins, asm, pattern>, TB, XS, Requires<[UseSSE1]>;
class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE1]>;
+ : Ii8<o, F, outs, ins, asm, pattern>, TB, XS, Requires<[UseSSE1]>;
class PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, PS,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, TB,
Requires<[UseSSE1]>;
class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedSingle>, PS,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedSingle>, TB,
Requires<[UseSSE1]>;
class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, !strconcat("v", asm), pattern>, XS,
+ : I<o, F, outs, ins, !strconcat("v", asm), pattern>, TB, XS,
Requires<[HasAVX]>;
class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, !strconcat("v", asm), pattern, SSEPackedSingle>, PS,
- Requires<[HasAVX]>;
+ : I<o, F, outs, ins, !strconcat("v", asm), pattern, SSEPackedSingle>,
+ TB, Requires<[HasAVX]>;
// SSE2 Instruction Templates:
//
@@ -626,49 +603,49 @@ class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm,
class SDI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, XD, Requires<[UseSSE2]>;
+ : I<o, F, outs, ins, asm, pattern>, TB, XD, Requires<[UseSSE2]>;
class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, XD, Requires<[UseSSE2]>;
+ : Ii8<o, F, outs, ins, asm, pattern>, TB, XD, Requires<[UseSSE2]>;
class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
+ : I<o, F, outs, ins, asm, pattern>, TB, XS, Requires<[UseSSE2]>;
class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>;
+ : Ii8<o, F, outs, ins, asm, pattern>, TB, XS, Requires<[UseSSE2]>;
class PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, TB, PD,
Requires<[UseSSE2]>;
class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedDouble>, TB, PD,
Requires<[UseSSE2]>;
class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, !strconcat("v", asm), pattern>, XD,
+ : I<o, F, outs, ins, !strconcat("v", asm), pattern>, TB, XD,
Requires<[UseAVX]>;
class VS2SI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, !strconcat("v", asm), pattern>, XS,
+ : I<o, F, outs, ins, !strconcat("v", asm), pattern>, TB, XS,
Requires<[HasAVX]>;
class VPDI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
: I<o, F, outs, ins, !strconcat("v", asm), pattern, SSEPackedDouble>,
- PD, Requires<[HasAVX]>;
+ TB, PD, Requires<[HasAVX]>;
class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, !strconcat("v", asm), pattern>, PD,
+ : I<o, F, outs, ins, !strconcat("v", asm), pattern>, TB, PD,
Requires<[UseAVX]>;
class S2I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, PD, Requires<[UseSSE2]>;
+ : I<o, F, outs, ins, asm, pattern>, TB, PD, Requires<[UseSSE2]>;
class MMXSDIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, XD, Requires<[HasMMX, HasSSE2]>;
+ : Ii8<o, F, outs, ins, asm, pattern>, TB, XD, Requires<[HasMMX, HasSSE2]>;
class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasMMX, HasSSE2]>;
+ : Ii8<o, F, outs, ins, asm, pattern>, TB, XS, Requires<[HasMMX, HasSSE2]>;
// SSE3 Instruction Templates:
//
@@ -678,15 +655,15 @@ class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, XS,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, TB, XS,
Requires<[UseSSE3]>;
class S3DI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, XD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, TB, XD,
Requires<[UseSSE3]>;
class S3I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, TB, PD,
Requires<[UseSSE3]>;
@@ -703,19 +680,19 @@ class S3I<bits<8> o, Format F, dag outs, dag ins, string asm,
class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, PD,
Requires<[UseSSSE3]>;
class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
Requires<[UseSSSE3]>;
class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PS,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8,
Requires<[HasMMX, HasSSSE3]>;
class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPS,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA,
Requires<[HasMMX, HasSSSE3]>;
// SSE4.1 Instruction Templates:
@@ -725,11 +702,11 @@ class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm,
//
class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, PD,
Requires<[UseSSE41]>;
class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
Requires<[UseSSE41]>;
// SSE4.2 Instruction Templates:
@@ -737,13 +714,13 @@ class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
// SS428I - SSE 4.2 instructions with T8 prefix.
class SS428I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, PD,
Requires<[UseSSE42]>;
// SS42AI = SSE 4.2 instructions with TA prefix
class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
Requires<[UseSSE42]>;
// CRC32I - SSE 4.2 CRC32 instructions.
@@ -751,42 +728,42 @@ class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm,
// controlled by the SSE42 flag.
class CRC32I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, T8XD, Requires<[HasCRC32]>;
+ : I<o, F, outs, ins, asm, pattern>, T8, XD, Requires<[HasCRC32]>;
// AVX Instruction Templates:
// Instructions introduced in AVX (no SSE equivalent forms)
//
-// AVX8I - AVX instructions with T8PD prefix.
-// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8.
+// AVX8I - AVX instructions with T8, PD prefix.
+// AVXAIi8 - AVX instructions with TA, PD prefix and ImmT = Imm8.
class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, PD,
Requires<[HasAVX]>;
class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
Requires<[HasAVX]>;
// AVX2 Instruction Templates:
// Instructions introduced in AVX2 (no SSE equivalent forms)
//
-// AVX28I - AVX2 instructions with T8PD prefix.
-// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8.
+// AVX28I - AVX2 instructions with T8, PD prefix.
+// AVX2AIi8 - AVX2 instructions with TA, PD prefix and ImmT = Imm8.
class AVX28I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, PD,
Requires<[HasAVX2]>;
class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
Requires<[HasAVX2]>;
// AVX-512 Instruction Templates:
// Instructions introduced in AVX-512 (no SSE equivalent forms)
//
-// AVX5128I - AVX-512 instructions with T8PD prefix.
-// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8.
+// AVX5128I - AVX-512 instructions with T8, PD prefix.
+// AVX512AIi8 - AVX-512 instructions with TA, PD prefix and ImmT = Imm8.
// AVX512PDI - AVX-512 instructions with PD, double packed.
// AVX512PSI - AVX-512 instructions with PS, single packed.
// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes.
@@ -796,39 +773,39 @@ class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, PD,
Requires<[HasAVX512]>;
-class AVX5128IBase : T8PD {
+class AVX5128IBase : T8, PD {
Domain ExeDomain = SSEPackedInt;
}
class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8XS,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, XS,
Requires<[HasAVX512]>;
class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, XS,
+ : I<o, F, outs, ins, asm, pattern>, TB, XS,
Requires<[HasAVX512]>;
class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, XD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, TB, XD,
Requires<[HasAVX512]>;
class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, TB, PD,
Requires<[HasAVX512]>;
-class AVX512BIBase : PD {
+class AVX512BIBase : TB, PD {
Domain ExeDomain = SSEPackedInt;
}
class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, PD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TB, PD,
Requires<[HasAVX512]>;
class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
Requires<[HasAVX512]>;
-class AVX512AIi8Base : TAPD {
+class AVX512AIi8Base : TA, PD {
ImmType ImmT = Imm8;
}
class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
@@ -837,11 +814,11 @@ class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm,
Requires<[HasAVX512]>;
class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, TB, PD,
Requires<[HasAVX512]>;
class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, PS,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, TB,
Requires<[HasAVX512]>;
class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern, Domain d>
@@ -851,8 +828,8 @@ class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm,
: I<o, F, outs, ins, asm, pattern, d>, Requires<[HasAVX512]>;
class AVX512FMA3S<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : I<o, F, outs, ins, asm, pattern>, T8PD,
- EVEX_4V, Requires<[HasAVX512]>;
+ : I<o, F, outs, ins, asm, pattern>, T8, PD,
+ EVEX, VVVV, Requires<[HasAVX512]>;
class AVX512<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
@@ -864,46 +841,46 @@ class AVX512<bits<8> o, Format F, dag outs, dag ins, string asm,
// These use the same encoding as the SSE4.2 T8 and TA encodings.
class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD,
+ : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8, PD,
Requires<[NoAVX, HasAES]>;
class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
Requires<[NoAVX, HasAES]>;
// PCLMUL Instruction Templates
class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD;
+ : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD;
// FMA3 Instruction Templates
class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : I<o, F, outs, ins, asm, pattern>, T8PD,
- VEX_4V, FMASC, Requires<[HasFMA, NoFMA4, NoVLX]>;
+ : I<o, F, outs, ins, asm, pattern>, T8, PD,
+ VEX, VVVV, FMASC, Requires<[HasFMA, NoFMA4, NoVLX]>;
class FMA3S<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : I<o, F, outs, ins, asm, pattern>, T8PD,
- VEX_4V, FMASC, Requires<[HasFMA, NoFMA4, NoAVX512]>;
+ : I<o, F, outs, ins, asm, pattern>, T8, PD,
+ VEX, VVVV, FMASC, Requires<[HasFMA, NoFMA4, NoAVX512]>;
class FMA3S_Int<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : I<o, F, outs, ins, asm, pattern>, T8PD,
- VEX_4V, FMASC, Requires<[HasFMA, NoAVX512]>;
+ : I<o, F, outs, ins, asm, pattern>, T8, PD,
+ VEX, VVVV, FMASC, Requires<[HasFMA, NoAVX512]>;
// FMA4 Instruction Templates
class FMA4<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : Ii8Reg<o, F, outs, ins, asm, pattern>, TAPD,
- VEX_4V, FMASC, Requires<[HasFMA4, NoVLX]>;
+ : Ii8Reg<o, F, outs, ins, asm, pattern>, TA, PD,
+ VEX, VVVV, FMASC, Requires<[HasFMA4, NoVLX]>;
class FMA4S<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : Ii8Reg<o, F, outs, ins, asm, pattern>, TAPD,
- VEX_4V, FMASC, Requires<[HasFMA4, NoAVX512]>;
+ : Ii8Reg<o, F, outs, ins, asm, pattern>, TA, PD,
+ VEX, VVVV, FMASC, Requires<[HasFMA4, NoAVX512]>;
class FMA4S_Int<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : Ii8Reg<o, F, outs, ins, asm, pattern>, TAPD,
- VEX_4V, FMASC, Requires<[HasFMA4]>;
+ : Ii8Reg<o, F, outs, ins, asm, pattern>, TA, PD,
+ VEX, VVVV, FMASC, Requires<[HasFMA4]>;
// XOP 2, 3 and 4 Operand Instruction Template
class IXOP<bits<8> o, Format F, dag outs, dag ins, string asm,
@@ -925,8 +902,8 @@ class IXOPi8Reg<bits<8> o, Format F, dag outs, dag ins, string asm,
// XOP 5 operand instruction (VEX encoding!)
class IXOP5<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag>pattern>
- : Ii8Reg<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD,
- VEX_4V, Requires<[HasXOP]>;
+ : Ii8Reg<o, F, outs, ins, asm, pattern, SSEPackedInt>, TA, PD,
+ VEX, VVVV, Requires<[HasXOP]>;
// X86-64 Instruction templates...
//
@@ -959,57 +936,36 @@ class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm,
// MMX Instruction templates
//
-
// MMXI - MMX instructions with TB prefix.
-// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode.
-// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode.
-// MMX2I - MMX / SSE2 instructions with PD prefix.
-// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
+// MMXRI - MMX instructions with TB prefix and REX.W.
// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix.
-// MMXID - MMX instructions with XD prefix.
-// MMXIS - MMX instructions with XS prefix.
class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX]>;
-class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm,
- list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX,Not64BitMode]>;
-class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm,
- list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX,In64BitMode]>;
+ : I<o, F, outs, ins, asm, pattern>, TB, Requires<[HasMMX]>;
class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, PS, REX_W,
+ : I<o, F, outs, ins, asm, pattern>, TB, REX_W,
Requires<[HasMMX,In64BitMode]>;
-class MMX2I<bits<8> o, Format F, dag outs, dag ins, string asm,
- list<dag> pattern>
- : I<o, F, outs, ins, asm, pattern>, PD, Requires<[HasMMX]>;
class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm,
list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX]>;
-class MMXID<bits<8> o, Format F, dag outs, dag ins, string asm,
- list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, XD, Requires<[HasMMX]>;
-class MMXIS<bits<8> o, Format F, dag outs, dag ins, string asm,
- list<dag> pattern>
- : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasMMX]>;
+ : Ii8<o, F, outs, ins, asm, pattern>, TB, Requires<[HasMMX]>;
/// ITy - This instruction base class takes the type info for the instruction.
/// Using this, it:
/// 1. Concatenates together the instruction mnemonic with the appropriate
/// suffix letter, a tab, and the arguments.
-/// 2. Infers whether the instruction should have a 0x66 prefix byte.
-/// 3. Infers whether the instruction should have a 0x40 REX_W prefix.
-/// 4. Infers whether the low bit of the opcode should be 0 (for i8 operations)
+/// 2. Infers whether the instruction should have a 0x40 REX_W prefix.
+/// 3. Infers whether the low bit of the opcode should be 0 (for i8 operations)
/// or 1 (for i16,i32,i64 operations).
class ITy<bits<8> opcode, Format f, X86TypeInfo typeinfo, dag outs, dag ins,
string mnemonic, string args, list<dag> pattern>
: I<{opcode{7}, opcode{6}, opcode{5}, opcode{4},
- opcode{3}, opcode{2}, opcode{1}, typeinfo.HasOddOpcode },
- f, outs, ins,
+ opcode{3}, opcode{2}, opcode{1},
+ !if(!eq(typeinfo.HasEvenOpcode, 1), 0, opcode{0})}, f, outs, ins,
!strconcat(mnemonic, "{", typeinfo.InstrSuffix, "}\t", args), pattern> {
- // Infer instruction prefixes from type info.
- let OpSize = typeinfo.OpSize;
+ let hasSideEffects = 0;
let hasREX_W = typeinfo.HasREX_W;
}
+
+defvar binop_args = "{$src2, $src1|$src1, $src2}";
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrVMX.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrVMX.td
index 5289819119ce..7cc468fe15ad 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrVMX.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrVMX.td
@@ -17,33 +17,33 @@
let SchedRW = [WriteSystem] in {
// 66 0F 38 80
def INVEPT32 : I<0x80, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2),
- "invept\t{$src2, $src1|$src1, $src2}", []>, T8PD,
+ "invept\t{$src2, $src1|$src1, $src2}", []>, T8, PD,
Requires<[Not64BitMode]>;
def INVEPT64 : I<0x80, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
- "invept\t{$src2, $src1|$src1, $src2}", []>, T8PD,
+ "invept\t{$src2, $src1|$src1, $src2}", []>, T8, PD,
Requires<[In64BitMode]>;
def INVEPT64_EVEX : I<0xF0, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
"invept\t{$src2, $src1|$src1, $src2}", []>,
- EVEX_NoCD8, T_MAP4XS, Requires<[In64BitMode]>;
+ EVEX, NoCD8, T_MAP4, XS, Requires<[In64BitMode]>;
// 66 0F 38 81
def INVVPID32 : I<0x81, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2),
- "invvpid\t{$src2, $src1|$src1, $src2}", []>, T8PD,
+ "invvpid\t{$src2, $src1|$src1, $src2}", []>, T8, PD,
Requires<[Not64BitMode]>;
def INVVPID64 : I<0x81, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
- "invvpid\t{$src2, $src1|$src1, $src2}", []>, T8PD,
+ "invvpid\t{$src2, $src1|$src1, $src2}", []>, T8, PD,
Requires<[In64BitMode]>;
def INVVPID64_EVEX : I<0xF1, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
"invvpid\t{$src2, $src1|$src1, $src2}", []>,
- EVEX_NoCD8, T_MAP4XS, Requires<[In64BitMode]>;
+ EVEX, NoCD8, T_MAP4, XS, Requires<[In64BitMode]>;
// 0F 01 C1
def VMCALL : I<0x01, MRM_C1, (outs), (ins), "vmcall", []>, TB;
def VMCLEARm : I<0xC7, MRM6m, (outs), (ins i64mem:$vmcs),
- "vmclear\t$vmcs", []>, PD;
+ "vmclear\t$vmcs", []>, TB, PD;
// OF 01 D4
-def VMFUNC : I<0x01, MRM_D4, (outs), (ins), "vmfunc", []>, PS;
+def VMFUNC : I<0x01, MRM_D4, (outs), (ins), "vmfunc", []>, TB;
// 0F 01 C2
def VMLAUNCH : I<0x01, MRM_C2, (outs), (ins), "vmlaunch", []>, TB;
@@ -51,35 +51,35 @@ def VMLAUNCH : I<0x01, MRM_C2, (outs), (ins), "vmlaunch", []>, TB;
// 0F 01 C3
def VMRESUME : I<0x01, MRM_C3, (outs), (ins), "vmresume", []>, TB;
def VMPTRLDm : I<0xC7, MRM6m, (outs), (ins i64mem:$vmcs),
- "vmptrld\t$vmcs", []>, PS;
+ "vmptrld\t$vmcs", []>, TB;
def VMPTRSTm : I<0xC7, MRM7m, (outs), (ins i64mem:$vmcs),
- "vmptrst\t$vmcs", []>, PS;
+ "vmptrst\t$vmcs", []>, TB;
def VMREAD64rr : I<0x78, MRMDestReg, (outs GR64:$dst), (ins GR64:$src),
- "vmread{q}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[In64BitMode]>;
+ "vmread{q}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[In64BitMode]>;
def VMREAD32rr : I<0x78, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
- "vmread{l}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[Not64BitMode]>;
+ "vmread{l}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[Not64BitMode]>;
let mayStore = 1 in {
def VMREAD64mr : I<0x78, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
- "vmread{q}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[In64BitMode]>;
+ "vmread{q}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[In64BitMode]>;
def VMREAD32mr : I<0x78, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
- "vmread{l}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[Not64BitMode]>;
+ "vmread{l}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[Not64BitMode]>;
} // mayStore
def VMWRITE64rr : I<0x79, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
- "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[In64BitMode]>;
+ "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[In64BitMode]>;
def VMWRITE32rr : I<0x79, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
- "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[Not64BitMode]>;
+ "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[Not64BitMode]>;
let mayLoad = 1 in {
def VMWRITE64rm : I<0x79, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
- "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[In64BitMode]>;
+ "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[In64BitMode]>;
def VMWRITE32rm : I<0x79, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
- "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, PS, Requires<[Not64BitMode]>;
+ "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, TB, Requires<[Not64BitMode]>;
} // mayLoad
// 0F 01 C4
def VMXOFF : I<0x01, MRM_C4, (outs), (ins), "vmxoff", []>, TB;
def VMXON : I<0xC7, MRM6m, (outs), (ins i64mem:$vmxon),
- "vmxon\t$vmxon", []>, XS;
+ "vmxon\t$vmxon", []>, TB, XS;
} // SchedRW
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrXOP.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrXOP.td
index a62bb2e855c9..1504d77bfb86 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrXOP.td
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrXOP.td
@@ -105,7 +105,7 @@ multiclass xop3op<bits<8> opc, string OpcodeStr, SDNode OpNode,
[(set VR128:$dst,
(vt128 (OpNode (vt128 VR128:$src1),
(vt128 (load addr:$src2)))))]>,
- XOP_4V, REX_W, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ XOP, VVVV, REX_W, Sched<[sched.Folded, sched.ReadAfterFold]>;
def mr : IXOP<opc, MRMSrcMem4VOp3, (outs VR128:$dst),
(ins i128mem:$src1, VR128:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
@@ -119,7 +119,7 @@ multiclass xop3op<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins VR128:$src1, VR128:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[]>,
- XOP_4V, REX_W, Sched<[sched]>;
+ XOP, VVVV, REX_W, Sched<[sched]>;
}
let ExeDomain = SSEPackedInt in {
@@ -173,7 +173,7 @@ multiclass xop4opm2<bits<8> opc, string OpcodeStr, Intrinsic Int,
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set VR128:$dst,
- (Int VR128:$src1, VR128:$src2, VR128:$src3))]>, XOP_4V,
+ (Int VR128:$src1, VR128:$src2, VR128:$src3))]>, XOP, VVVV,
Sched<[sched]>;
def rm : IXOPi8Reg<opc, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, i128mem:$src2, VR128:$src3),
@@ -181,7 +181,7 @@ multiclass xop4opm2<bits<8> opc, string OpcodeStr, Intrinsic Int,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set VR128:$dst,
(Int VR128:$src1, (load addr:$src2),
- VR128:$src3))]>, XOP_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ VR128:$src3))]>, XOP, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
let ExeDomain = SSEPackedInt in {
@@ -252,7 +252,7 @@ multiclass xopvpcom<bits<8> opc, string Suffix, SDNode OpNode, ValueType vt128,
[(set VR128:$dst,
(vt128 (OpNode (vt128 VR128:$src1), (vt128 VR128:$src2),
timm:$cc)))]>,
- XOP_4V, Sched<[sched]>;
+ XOP, VVVV, Sched<[sched]>;
def mi : IXOPi8<opc, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, i128mem:$src2, u8imm:$cc),
!strconcat("vpcom", Suffix,
@@ -261,7 +261,7 @@ multiclass xopvpcom<bits<8> opc, string Suffix, SDNode OpNode, ValueType vt128,
(vt128 (OpNode (vt128 VR128:$src1),
(vt128 (load addr:$src2)),
timm:$cc)))]>,
- XOP_4V, Sched<[sched.Folded, sched.ReadAfterFold]>;
+ XOP, VVVV, Sched<[sched.Folded, sched.ReadAfterFold]>;
}
def : Pat<(OpNode (load addr:$src2),
@@ -288,7 +288,7 @@ multiclass xop4op<bits<8> opc, string OpcodeStr, SDNode OpNode,
[(set VR128:$dst,
(vt128 (OpNode (vt128 VR128:$src1), (vt128 VR128:$src2),
(vt128 VR128:$src3))))]>,
- XOP_4V, Sched<[sched]>;
+ XOP, VVVV, Sched<[sched]>;
def rrm : IXOPi8Reg<opc, MRMSrcMemOp4, (outs VR128:$dst),
(ins VR128:$src1, VR128:$src2, i128mem:$src3),
!strconcat(OpcodeStr,
@@ -296,7 +296,7 @@ multiclass xop4op<bits<8> opc, string OpcodeStr, SDNode OpNode,
[(set VR128:$dst,
(vt128 (OpNode (vt128 VR128:$src1), (vt128 VR128:$src2),
(vt128 (load addr:$src3)))))]>,
- XOP_4V, REX_W, Sched<[sched.Folded, sched.ReadAfterFold, sched.ReadAfterFold]>;
+ XOP, VVVV, REX_W, Sched<[sched.Folded, sched.ReadAfterFold, sched.ReadAfterFold]>;
def rmr : IXOPi8Reg<opc, MRMSrcMem, (outs VR128:$dst),
(ins VR128:$src1, i128mem:$src2, VR128:$src3),
!strconcat(OpcodeStr,
@@ -304,7 +304,7 @@ multiclass xop4op<bits<8> opc, string OpcodeStr, SDNode OpNode,
[(set VR128:$dst,
(v16i8 (OpNode (vt128 VR128:$src1), (vt128 (load addr:$src2)),
(vt128 VR128:$src3))))]>,
- XOP_4V, Sched<[sched.Folded, sched.ReadAfterFold,
+ XOP, VVVV, Sched<[sched.Folded, sched.ReadAfterFold,
// 128mem:$src2
ReadDefault, ReadDefault, ReadDefault, ReadDefault,
ReadDefault,
@@ -316,7 +316,7 @@ multiclass xop4op<bits<8> opc, string OpcodeStr, SDNode OpNode,
(ins VR128:$src1, VR128:$src2, VR128:$src3),
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
- []>, XOP_4V, REX_W, Sched<[sched]>;
+ []>, XOP, VVVV, REX_W, Sched<[sched]>;
}
let ExeDomain = SSEPackedInt in {
@@ -333,7 +333,7 @@ multiclass xop4op_int<bits<8> opc, string OpcodeStr, RegisterClass RC,
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set RC:$dst, (VT (or (and RC:$src3, RC:$src1),
- (X86andnp RC:$src3, RC:$src2))))]>, XOP_4V,
+ (X86andnp RC:$src3, RC:$src2))))]>, XOP, VVVV,
Sched<[sched]>;
// FIXME: We can't write a pattern for this in tablegen.
let hasSideEffects = 0, mayLoad = 1 in
@@ -342,14 +342,14 @@ multiclass xop4op_int<bits<8> opc, string OpcodeStr, RegisterClass RC,
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[]>,
- XOP_4V, REX_W, Sched<[sched.Folded, sched.ReadAfterFold, sched.ReadAfterFold]>;
+ XOP, VVVV, REX_W, Sched<[sched.Folded, sched.ReadAfterFold, sched.ReadAfterFold]>;
def rmr : IXOPi8Reg<opc, MRMSrcMem, (outs RC:$dst),
(ins RC:$src1, x86memop:$src2, RC:$src3),
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
[(set RC:$dst, (VT (or (and RC:$src3, RC:$src1),
(X86andnp RC:$src3, (load addr:$src2)))))]>,
- XOP_4V, Sched<[sched.Folded, sched.ReadAfterFold,
+ XOP, VVVV, Sched<[sched.Folded, sched.ReadAfterFold,
// x86memop:$src2
ReadDefault, ReadDefault, ReadDefault, ReadDefault,
ReadDefault,
@@ -361,7 +361,7 @@ multiclass xop4op_int<bits<8> opc, string OpcodeStr, RegisterClass RC,
(ins RC:$src1, RC:$src2, RC:$src3),
!strconcat(OpcodeStr,
"\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
- []>, XOP_4V, REX_W, Sched<[sched]>;
+ []>, XOP, VVVV, REX_W, Sched<[sched]>;
}
let ExeDomain = SSEPackedInt in {
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86MacroFusion.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86MacroFusion.cpp
index 82667b8cdbdb..c0fa9aa70324 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86MacroFusion.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86MacroFusion.cpp
@@ -68,7 +68,8 @@ static bool shouldScheduleAdjacent(const TargetInstrInfo &TII,
namespace llvm {
std::unique_ptr<ScheduleDAGMutation> createX86MacroFusionDAGMutation() {
- return createBranchMacroFusionDAGMutation(shouldScheduleAdjacent);
+ return createMacroFusionDAGMutation(shouldScheduleAdjacent,
+ /*BranchOnly=*/true);
}
} // end namespace llvm
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86Subtarget.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86Subtarget.cpp
index d63f1ca1695b..07f535685e8f 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -69,11 +69,11 @@ X86Subtarget::classifyGlobalReference(const GlobalValue *GV) const {
unsigned char
X86Subtarget::classifyLocalReference(const GlobalValue *GV) const {
+ CodeModel::Model CM = TM.getCodeModel();
// Tagged globals have non-zero upper bits, which makes direct references
- // require a 64-bit immediate. On the small code model this causes relocation
- // errors, so we go through the GOT instead.
- if (AllowTaggedGlobals && TM.getCodeModel() == CodeModel::Small && GV &&
- !isa<Function>(GV))
+ // require a 64-bit immediate. With the small/medium code models this causes
+ // relocation errors, so we go through the GOT instead.
+ if (AllowTaggedGlobals && CM != CodeModel::Large && GV && !isa<Function>(GV))
return X86II::MO_GOTPCREL_NORELAX;
// If we're not PIC, it's not very interesting.
@@ -83,7 +83,6 @@ X86Subtarget::classifyLocalReference(const GlobalValue *GV) const {
if (is64Bit()) {
// 64-bit ELF PIC local references may use GOTOFF relocations.
if (isTargetELF()) {
- CodeModel::Model CM = TM.getCodeModel();
assert(CM != CodeModel::Tiny &&
"Tiny codesize model not supported on X86");
// In the large code model, all text is far from any global data, so we
diff --git a/contrib/llvm-project/llvm/lib/TargetParser/ARMTargetParserCommon.cpp b/contrib/llvm-project/llvm/lib/TargetParser/ARMTargetParserCommon.cpp
index 10b80cad4347..6d3a59d532fd 100644
--- a/contrib/llvm-project/llvm/lib/TargetParser/ARMTargetParserCommon.cpp
+++ b/contrib/llvm-project/llvm/lib/TargetParser/ARMTargetParserCommon.cpp
@@ -134,13 +134,13 @@ ARM::EndianKind ARM::parseArchEndian(StringRef Arch) {
}
// Parse a branch protection specification, which has the form
-// standard | none | [bti,pac-ret[+b-key,+leaf]*]
+// standard | none | [bti,pac-ret[+b-key,+leaf,+pc]*]
// Returns true on success, with individual elements of the specification
// returned in `PBP`. Returns false in error, with `Err` containing
// an erroneous part of the spec.
bool ARM::parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP,
StringRef &Err) {
- PBP = {"none", "a_key", false};
+ PBP = {"none", "a_key", false, false};
if (Spec == "none")
return true; // defaults are ok
@@ -166,6 +166,8 @@ bool ARM::parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP,
PBP.Scope = "all";
else if (PACOpt == "b-key")
PBP.Key = "b_key";
+ else if (PACOpt == "pc")
+ PBP.BranchProtectionPAuthLR = true;
else
break;
}
diff --git a/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp b/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp
index e61fcb248fae..11c5000acc07 100644
--- a/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp
+++ b/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp
@@ -1131,37 +1131,59 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
case 23:
CPU = "znver1";
*Type = X86::AMDFAM17H;
- if ((Model >= 0x30 && Model <= 0x3f) || Model == 0x71) {
+ if ((Model >= 0x30 && Model <= 0x3f) || (Model == 0x47) ||
+ (Model >= 0x60 && Model <= 0x67) || (Model >= 0x68 && Model <= 0x6f) ||
+ (Model >= 0x70 && Model <= 0x7f) || (Model >= 0x84 && Model <= 0x87) ||
+ (Model >= 0x90 && Model <= 0x97) || (Model >= 0x98 && Model <= 0x9f) ||
+ (Model >= 0xa0 && Model <= 0xaf)) {
+ // Family 17h Models 30h-3Fh (Starship) Zen 2
+ // Family 17h Models 47h (Cardinal) Zen 2
+ // Family 17h Models 60h-67h (Renoir) Zen 2
+ // Family 17h Models 68h-6Fh (Lucienne) Zen 2
+ // Family 17h Models 70h-7Fh (Matisse) Zen 2
+ // Family 17h Models 84h-87h (ProjectX) Zen 2
+ // Family 17h Models 90h-97h (VanGogh) Zen 2
+ // Family 17h Models 98h-9Fh (Mero) Zen 2
+ // Family 17h Models A0h-AFh (Mendocino) Zen 2
CPU = "znver2";
*Subtype = X86::AMDFAM17H_ZNVER2;
- break; // 30h-3fh, 71h: Zen2
+ break;
}
- if (Model <= 0x0f) {
+ if ((Model >= 0x10 && Model <= 0x1f) || (Model >= 0x20 && Model <= 0x2f)) {
+ // Family 17h Models 10h-1Fh (Raven1) Zen
+ // Family 17h Models 10h-1Fh (Picasso) Zen+
+ // Family 17h Models 20h-2Fh (Raven2 x86) Zen
*Subtype = X86::AMDFAM17H_ZNVER1;
- break; // 00h-0Fh: Zen1
+ break;
}
break;
case 25:
CPU = "znver3";
*Type = X86::AMDFAM19H;
- if (Model <= 0x0f || (Model >= 0x20 && Model <= 0x5f)) {
- // Family 19h Models 00h-0Fh - Zen3
- // Family 19h Models 20h-2Fh - Zen3
- // Family 19h Models 30h-3Fh - Zen3
- // Family 19h Models 40h-4Fh - Zen3+
- // Family 19h Models 50h-5Fh - Zen3+
+ if ((Model >= 0x00 && Model <= 0x0f) || (Model >= 0x20 && Model <= 0x2f) ||
+ (Model >= 0x30 && Model <= 0x3f) || (Model >= 0x40 && Model <= 0x4f) ||
+ (Model >= 0x50 && Model <= 0x5f)) {
+ // Family 19h Models 00h-0Fh (Genesis, Chagall) Zen 3
+ // Family 19h Models 20h-2Fh (Vermeer) Zen 3
+ // Family 19h Models 30h-3Fh (Badami) Zen 3
+ // Family 19h Models 40h-4Fh (Rembrandt) Zen 3+
+ // Family 19h Models 50h-5Fh (Cezanne) Zen 3
*Subtype = X86::AMDFAM19H_ZNVER3;
break;
}
- if ((Model >= 0x10 && Model <= 0x1f) ||
- (Model >= 0x60 && Model <= 0x74) ||
- (Model >= 0x78 && Model <= 0x7b) ||
- (Model >= 0xA0 && Model <= 0xAf)) {
+ if ((Model >= 0x10 && Model <= 0x1f) || (Model >= 0x60 && Model <= 0x6f) ||
+ (Model >= 0x70 && Model <= 0x77) || (Model >= 0x78 && Model <= 0x7f) ||
+ (Model >= 0xa0 && Model <= 0xaf)) {
+ // Family 19h Models 10h-1Fh (Stones; Storm Peak) Zen 4
+ // Family 19h Models 60h-6Fh (Raphael) Zen 4
+ // Family 19h Models 70h-77h (Phoenix, Hawkpoint1) Zen 4
+ // Family 19h Models 78h-7Fh (Phoenix 2, Hawkpoint2) Zen 4
+ // Family 19h Models A0h-AFh (Stones-Dense) Zen 4
CPU = "znver4";
*Subtype = X86::AMDFAM19H_ZNVER4;
break; // "znver4"
}
- break; // family 19h
+ break;
default:
break; // Unknown AMD CPU.
}
diff --git a/contrib/llvm-project/llvm/lib/TargetParser/Triple.cpp b/contrib/llvm-project/llvm/lib/TargetParser/Triple.cpp
index ac04dab04897..d475650c2d18 100644
--- a/contrib/llvm-project/llvm/lib/TargetParser/Triple.cpp
+++ b/contrib/llvm-project/llvm/lib/TargetParser/Triple.cpp
@@ -819,8 +819,6 @@ static Triple::SubArchType parseSubArch(StringRef SubArchName) {
}
static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
- if (T.isOSDarwin())
- return Triple::MachO;
switch (T.getArch()) {
case Triple::UnknownArch:
case Triple::aarch64:
@@ -829,12 +827,13 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::thumb:
case Triple::x86:
case Triple::x86_64:
- if (T.isOSWindows())
+ switch (T.getOS()) {
+ case Triple::Win32:
+ case Triple::UEFI:
return Triple::COFF;
- else if (T.isUEFI())
- return Triple::COFF;
- return Triple::ELF;
-
+ default:
+ return T.isOSDarwin() ? Triple::MachO : Triple::ELF;
+ }
case Triple::aarch64_be:
case Triple::amdgcn:
case Triple::amdil64:
@@ -887,6 +886,8 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::ppc:
if (T.isOSAIX())
return Triple::XCOFF;
+ if (T.isOSDarwin())
+ return Triple::MachO;
return Triple::ELF;
case Triple::systemz:
diff --git a/contrib/llvm-project/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp b/contrib/llvm-project/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
new file mode 100644
index 000000000000..40b57b5e40ea
--- /dev/null
+++ b/contrib/llvm-project/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
@@ -0,0 +1,429 @@
+//===- DylibReader.cpp -------------- TAPI MachO Dylib Reader --*- 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// Implements the TAPI Reader for Mach-O dynamic libraries.
+///
+//===----------------------------------------------------------------------===//
+
+#include "llvm/TextAPI/DylibReader.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Object/Binary.h"
+#include "llvm/Object/MachOUniversal.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/TargetParser/Triple.h"
+#include "llvm/TextAPI/RecordsSlice.h"
+#include "llvm/TextAPI/TextAPIError.h"
+#include <iomanip>
+#include <set>
+#include <sstream>
+#include <string>
+#include <tuple>
+
+using namespace llvm;
+using namespace llvm::object;
+using namespace llvm::MachO;
+using namespace llvm::MachO::DylibReader;
+
+using TripleVec = std::vector<Triple>;
+static typename TripleVec::iterator emplace(TripleVec &Container, Triple &&T) {
+ auto I = partition_point(Container, [=](const Triple &CT) {
+ return std::forward_as_tuple(CT.getArch(), CT.getOS(),
+ CT.getEnvironment()) <
+ std::forward_as_tuple(T.getArch(), T.getOS(), T.getEnvironment());
+ });
+
+ if (I != Container.end() && *I == T)
+ return I;
+ return Container.emplace(I, T);
+}
+
+static TripleVec constructTriples(MachOObjectFile *Obj,
+ const Architecture ArchT) {
+ auto getOSVersionStr = [](uint32_t V) {
+ PackedVersion OSVersion(V);
+ std::string Vers;
+ raw_string_ostream VStream(Vers);
+ VStream << OSVersion;
+ return VStream.str();
+ };
+ auto getOSVersion = [&](const MachOObjectFile::LoadCommandInfo &cmd) {
+ auto Vers = Obj->getVersionMinLoadCommand(cmd);
+ return getOSVersionStr(Vers.version);
+ };
+
+ TripleVec Triples;
+ bool IsIntel = ArchitectureSet(ArchT).hasX86();
+ auto Arch = getArchitectureName(ArchT);
+
+ for (const auto &cmd : Obj->load_commands()) {
+ std::string OSVersion;
+ switch (cmd.C.cmd) {
+ case MachO::LC_VERSION_MIN_MACOSX:
+ OSVersion = getOSVersion(cmd);
+ emplace(Triples, {Arch, "apple", "macos" + OSVersion});
+ break;
+ case MachO::LC_VERSION_MIN_IPHONEOS:
+ OSVersion = getOSVersion(cmd);
+ if (IsIntel)
+ emplace(Triples, {Arch, "apple", "ios" + OSVersion, "simulator"});
+ else
+ emplace(Triples, {Arch, "apple", "ios" + OSVersion});
+ break;
+ case MachO::LC_VERSION_MIN_TVOS:
+ OSVersion = getOSVersion(cmd);
+ if (IsIntel)
+ emplace(Triples, {Arch, "apple", "tvos" + OSVersion, "simulator"});
+ else
+ emplace(Triples, {Arch, "apple", "tvos" + OSVersion});
+ break;
+ case MachO::LC_VERSION_MIN_WATCHOS:
+ OSVersion = getOSVersion(cmd);
+ if (IsIntel)
+ emplace(Triples, {Arch, "apple", "watchos" + OSVersion, "simulator"});
+ else
+ emplace(Triples, {Arch, "apple", "watchos" + OSVersion});
+ break;
+ case MachO::LC_BUILD_VERSION: {
+ OSVersion = getOSVersionStr(Obj->getBuildVersionLoadCommand(cmd).minos);
+ switch (Obj->getBuildVersionLoadCommand(cmd).platform) {
+ case MachO::PLATFORM_MACOS:
+ emplace(Triples, {Arch, "apple", "macos" + OSVersion});
+ break;
+ case MachO::PLATFORM_IOS:
+ emplace(Triples, {Arch, "apple", "ios" + OSVersion});
+ break;
+ case MachO::PLATFORM_TVOS:
+ emplace(Triples, {Arch, "apple", "tvos" + OSVersion});
+ break;
+ case MachO::PLATFORM_WATCHOS:
+ emplace(Triples, {Arch, "apple", "watchos" + OSVersion});
+ break;
+ case MachO::PLATFORM_BRIDGEOS:
+ emplace(Triples, {Arch, "apple", "bridgeos" + OSVersion});
+ break;
+ case MachO::PLATFORM_MACCATALYST:
+ emplace(Triples, {Arch, "apple", "ios" + OSVersion, "macabi"});
+ break;
+ case MachO::PLATFORM_IOSSIMULATOR:
+ emplace(Triples, {Arch, "apple", "ios" + OSVersion, "simulator"});
+ break;
+ case MachO::PLATFORM_TVOSSIMULATOR:
+ emplace(Triples, {Arch, "apple", "tvos" + OSVersion, "simulator"});
+ break;
+ case MachO::PLATFORM_WATCHOSSIMULATOR:
+ emplace(Triples, {Arch, "apple", "watchos" + OSVersion, "simulator"});
+ break;
+ case MachO::PLATFORM_DRIVERKIT:
+ emplace(Triples, {Arch, "apple", "driverkit" + OSVersion});
+ break;
+ default:
+ break; // Skip any others.
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ // Record unknown platform for older binaries that don't enforce platform
+ // load commands.
+ if (Triples.empty())
+ emplace(Triples, {Arch, "apple", "unknown"});
+
+ return Triples;
+}
+
+static Error readMachOHeader(MachOObjectFile *Obj, RecordsSlice &Slice) {
+ auto H = Obj->getHeader();
+ auto &BA = Slice.getBinaryAttrs();
+
+ switch (H.filetype) {
+ default:
+ llvm_unreachable("unsupported binary type");
+ case MachO::MH_DYLIB:
+ BA.File = FileType::MachO_DynamicLibrary;
+ break;
+ case MachO::MH_DYLIB_STUB:
+ BA.File = FileType::MachO_DynamicLibrary_Stub;
+ break;
+ case MachO::MH_BUNDLE:
+ BA.File = FileType::MachO_Bundle;
+ break;
+ }
+
+ if (H.flags & MachO::MH_TWOLEVEL)
+ BA.TwoLevelNamespace = true;
+ if (H.flags & MachO::MH_APP_EXTENSION_SAFE)
+ BA.AppExtensionSafe = true;
+
+ for (const auto &LCI : Obj->load_commands()) {
+ switch (LCI.C.cmd) {
+ case MachO::LC_ID_DYLIB: {
+ auto DLLC = Obj->getDylibIDLoadCommand(LCI);
+ BA.InstallName = Slice.copyString(LCI.Ptr + DLLC.dylib.name);
+ BA.CurrentVersion = DLLC.dylib.current_version;
+ BA.CompatVersion = DLLC.dylib.compatibility_version;
+ break;
+ }
+ case MachO::LC_REEXPORT_DYLIB: {
+ auto DLLC = Obj->getDylibIDLoadCommand(LCI);
+ BA.RexportedLibraries.emplace_back(
+ Slice.copyString(LCI.Ptr + DLLC.dylib.name));
+ break;
+ }
+ case MachO::LC_SUB_FRAMEWORK: {
+ auto SFC = Obj->getSubFrameworkCommand(LCI);
+ BA.ParentUmbrella = Slice.copyString(LCI.Ptr + SFC.umbrella);
+ break;
+ }
+ case MachO::LC_SUB_CLIENT: {
+ auto SCLC = Obj->getSubClientCommand(LCI);
+ BA.AllowableClients.emplace_back(Slice.copyString(LCI.Ptr + SCLC.client));
+ break;
+ }
+ case MachO::LC_UUID: {
+ auto UUIDLC = Obj->getUuidCommand(LCI);
+ std::stringstream Stream;
+ for (unsigned I = 0; I < 16; ++I) {
+ if (I == 4 || I == 6 || I == 8 || I == 10)
+ Stream << '-';
+ Stream << std::setfill('0') << std::setw(2) << std::uppercase
+ << std::hex << static_cast<int>(UUIDLC.uuid[I]);
+ }
+ BA.UUID = Slice.copyString(Stream.str());
+ break;
+ }
+ case MachO::LC_RPATH: {
+ auto RPLC = Obj->getRpathCommand(LCI);
+ BA.RPaths.emplace_back(Slice.copyString(LCI.Ptr + RPLC.path));
+ break;
+ }
+ case MachO::LC_SEGMENT_SPLIT_INFO: {
+ auto SSILC = Obj->getLinkeditDataLoadCommand(LCI);
+ if (SSILC.datasize == 0)
+ BA.OSLibNotForSharedCache = true;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ for (auto &Sect : Obj->sections()) {
+ auto SectName = Sect.getName();
+ if (!SectName)
+ return SectName.takeError();
+ if (*SectName != "__objc_imageinfo" && *SectName != "__image_info")
+ continue;
+
+ auto Content = Sect.getContents();
+ if (!Content)
+ return Content.takeError();
+
+ if ((Content->size() >= 8) && (Content->front() == 0)) {
+ uint32_t Flags;
+ if (Obj->isLittleEndian()) {
+ auto *p =
+ reinterpret_cast<const support::ulittle32_t *>(Content->data() + 4);
+ Flags = *p;
+ } else {
+ auto *p =
+ reinterpret_cast<const support::ubig32_t *>(Content->data() + 4);
+ Flags = *p;
+ }
+ BA.SwiftABI = (Flags >> 8) & 0xFF;
+ }
+ }
+ return Error::success();
+}
+
+static Error readSymbols(MachOObjectFile *Obj, RecordsSlice &Slice,
+ const ParseOption &Opt) {
+
+ auto parseExport = [](const auto ExportFlags,
+ auto Addr) -> std::tuple<SymbolFlags, RecordLinkage> {
+ SymbolFlags Flags = SymbolFlags::None;
+ switch (ExportFlags & MachO::EXPORT_SYMBOL_FLAGS_KIND_MASK) {
+ case MachO::EXPORT_SYMBOL_FLAGS_KIND_REGULAR:
+ if (ExportFlags & MachO::EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION)
+ Flags |= SymbolFlags::WeakDefined;
+ break;
+ case MachO::EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL:
+ Flags |= SymbolFlags::ThreadLocalValue;
+ break;
+ }
+
+ RecordLinkage Linkage = (ExportFlags & MachO::EXPORT_SYMBOL_FLAGS_REEXPORT)
+ ? RecordLinkage::Rexported
+ : RecordLinkage::Exported;
+ return {Flags, Linkage};
+ };
+
+ Error Err = Error::success();
+
+ StringMap<std::pair<SymbolFlags, RecordLinkage>> Exports;
+ // Collect symbols from export trie first. Sometimes, there are more exports
+ // in the trie than in n-list due to stripping. This is common for swift
+ // mangled symbols.
+ for (auto &Sym : Obj->exports(Err)) {
+ auto [Flags, Linkage] = parseExport(Sym.flags(), Sym.address());
+ Slice.addRecord(Sym.name(), Flags, GlobalRecord::Kind::Unknown, Linkage);
+ Exports[Sym.name()] = {Flags, Linkage};
+ }
+
+ for (const auto &Sym : Obj->symbols()) {
+ auto FlagsOrErr = Sym.getFlags();
+ if (!FlagsOrErr)
+ return FlagsOrErr.takeError();
+ auto Flags = *FlagsOrErr;
+
+ auto NameOrErr = Sym.getName();
+ if (!NameOrErr)
+ return NameOrErr.takeError();
+ auto Name = *NameOrErr;
+
+ RecordLinkage Linkage = RecordLinkage::Unknown;
+ SymbolFlags RecordFlags = SymbolFlags::None;
+
+ if (Opt.Undefineds && (Flags & SymbolRef::SF_Undefined)) {
+ Linkage = RecordLinkage::Undefined;
+ if (Flags & SymbolRef::SF_Weak)
+ RecordFlags |= SymbolFlags::WeakReferenced;
+ } else if (Flags & SymbolRef::SF_Exported) {
+ auto Exp = Exports.find(Name);
+ // This should never be possible when binaries are produced with Apple
+ // linkers. However it is possible to craft dylibs where the export trie
+ // is either malformed or has conflicting symbols compared to n_list.
+ if (Exp != Exports.end())
+ std::tie(RecordFlags, Linkage) = Exp->second;
+ else
+ Linkage = RecordLinkage::Exported;
+ } else if (Flags & SymbolRef::SF_Hidden) {
+ Linkage = RecordLinkage::Internal;
+ } else
+ continue;
+
+ auto TypeOrErr = Sym.getType();
+ if (!TypeOrErr)
+ return TypeOrErr.takeError();
+ auto Type = *TypeOrErr;
+
+ GlobalRecord::Kind GV = (Type & SymbolRef::ST_Function)
+ ? GlobalRecord::Kind::Function
+ : GlobalRecord::Kind::Variable;
+
+ if (GV == GlobalRecord::Kind::Function)
+ RecordFlags |= SymbolFlags::Text;
+ else
+ RecordFlags |= SymbolFlags::Data;
+
+ Slice.addRecord(Name, RecordFlags, GV, Linkage);
+ }
+ return Err;
+}
+
+static Error load(MachOObjectFile *Obj, RecordsSlice &Slice,
+ const ParseOption &Opt, const Architecture Arch) {
+ if (Arch == AK_unknown)
+ return make_error<TextAPIError>(TextAPIErrorCode::UnsupportedTarget);
+
+ if (Opt.MachOHeader)
+ if (auto Err = readMachOHeader(Obj, Slice))
+ return Err;
+
+ if (Opt.SymbolTable)
+ if (auto Err = readSymbols(Obj, Slice, Opt))
+ return Err;
+
+ return Error::success();
+}
+
+Expected<Records> DylibReader::readFile(MemoryBufferRef Buffer,
+ const ParseOption &Opt) {
+ Records Results;
+
+ auto BinOrErr = createBinary(Buffer);
+ if (!BinOrErr)
+ return BinOrErr.takeError();
+
+ Binary &Bin = *BinOrErr.get();
+ if (auto *Obj = dyn_cast<MachOObjectFile>(&Bin)) {
+ const auto Arch = getArchitectureFromCpuType(Obj->getHeader().cputype,
+ Obj->getHeader().cpusubtype);
+ if (!Opt.Archs.has(Arch))
+ return make_error<TextAPIError>(TextAPIErrorCode::NoSuchArchitecture);
+
+ auto Triples = constructTriples(Obj, Arch);
+ for (const auto &T : Triples) {
+ if (mapToPlatformType(T) == PLATFORM_UNKNOWN)
+ return make_error<TextAPIError>(TextAPIErrorCode::UnsupportedTarget);
+ Results.emplace_back(std::make_shared<RecordsSlice>(RecordsSlice({T})));
+ if (auto Err = load(Obj, *Results.back(), Opt, Arch))
+ return std::move(Err);
+ Results.back()->getBinaryAttrs().Path = Buffer.getBufferIdentifier();
+ }
+ return Results;
+ }
+
+ // Only expect MachO universal binaries at this point.
+ assert(isa<MachOUniversalBinary>(&Bin) &&
+ "Expected a MachO universal binary.");
+ auto *UB = cast<MachOUniversalBinary>(&Bin);
+
+ for (auto OI = UB->begin_objects(), OE = UB->end_objects(); OI != OE; ++OI) {
+ // Skip architecture if not requested.
+ auto Arch =
+ getArchitectureFromCpuType(OI->getCPUType(), OI->getCPUSubType());
+ if (!Opt.Archs.has(Arch))
+ continue;
+
+ // Skip unknown architectures.
+ if (Arch == AK_unknown)
+ continue;
+
+ // This can fail if the object is an archive.
+ auto ObjOrErr = OI->getAsObjectFile();
+
+ // Skip the archive and consume the error.
+ if (!ObjOrErr) {
+ consumeError(ObjOrErr.takeError());
+ continue;
+ }
+
+ auto &Obj = *ObjOrErr.get();
+ switch (Obj.getHeader().filetype) {
+ default:
+ break;
+ case MachO::MH_BUNDLE:
+ case MachO::MH_DYLIB:
+ case MachO::MH_DYLIB_STUB:
+ for (const auto &T : constructTriples(&Obj, Arch)) {
+ Results.emplace_back(std::make_shared<RecordsSlice>(RecordsSlice({T})));
+ if (auto Err = load(&Obj, *Results.back(), Opt, Arch))
+ return std::move(Err);
+ }
+ break;
+ }
+ }
+
+ if (Results.empty())
+ return make_error<TextAPIError>(TextAPIErrorCode::EmptyResults);
+ return Results;
+}
+
+Expected<std::unique_ptr<InterfaceFile>>
+DylibReader::get(MemoryBufferRef Buffer) {
+ ParseOption Options;
+ auto SlicesOrErr = readFile(Buffer, Options);
+ if (!SlicesOrErr)
+ return SlicesOrErr.takeError();
+
+ return convertToInterfaceFile(*SlicesOrErr);
+}
diff --git a/contrib/llvm-project/llvm/lib/TextAPI/RecordVisitor.cpp b/contrib/llvm-project/llvm/lib/TextAPI/RecordVisitor.cpp
new file mode 100644
index 000000000000..cee04e644755
--- /dev/null
+++ b/contrib/llvm-project/llvm/lib/TextAPI/RecordVisitor.cpp
@@ -0,0 +1,65 @@
+//===- RecordVisitor.cpp --------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// Implements the TAPI Record Visitor.
+///
+//===----------------------------------------------------------------------===//
+
+#include "llvm/TextAPI/RecordVisitor.h"
+
+using namespace llvm;
+using namespace llvm::MachO;
+
+RecordVisitor::~RecordVisitor() {}
+void RecordVisitor::visitObjCInterface(const ObjCInterfaceRecord &) {}
+void RecordVisitor::visitObjCCategory(const ObjCCategoryRecord &) {}
+
+static bool shouldSkipRecord(const Record &R, const bool RecordUndefs) {
+ if (R.isExported())
+ return false;
+
+ // Skip non exported symbols unless for flat namespace libraries.
+ return !(RecordUndefs && R.isUndefined());
+}
+
+void SymbolConverter::visitGlobal(const GlobalRecord &GR) {
+ auto [SymName, SymKind] = parseSymbol(GR.getName(), GR.getFlags());
+ if (shouldSkipRecord(GR, RecordUndefs))
+ return;
+ Symbols->addGlobal(SymKind, SymName, GR.getFlags(), Targ);
+}
+
+void SymbolConverter::addIVars(const ArrayRef<ObjCIVarRecord *> IVars,
+ StringRef ContainerName) {
+ for (auto *IV : IVars) {
+ if (shouldSkipRecord(*IV, RecordUndefs))
+ continue;
+ std::string Name =
+ ObjCIVarRecord::createScopedName(ContainerName, IV->getName());
+ Symbols->addGlobal(SymbolKind::ObjectiveCInstanceVariable, Name,
+ IV->getFlags(), Targ);
+ }
+}
+
+void SymbolConverter::visitObjCInterface(const ObjCInterfaceRecord &ObjCR) {
+ if (!shouldSkipRecord(ObjCR, RecordUndefs)) {
+ Symbols->addGlobal(SymbolKind::ObjectiveCClass, ObjCR.getName(),
+ ObjCR.getFlags(), Targ);
+ if (ObjCR.hasExceptionAttribute())
+ Symbols->addGlobal(SymbolKind::ObjectiveCClassEHType, ObjCR.getName(),
+ ObjCR.getFlags(), Targ);
+ }
+
+ addIVars(ObjCR.getObjCIVars(), ObjCR.getName());
+ for (const auto *Cat : ObjCR.getObjCCategories())
+ addIVars(Cat->getObjCIVars(), ObjCR.getName());
+}
+
+void SymbolConverter::visitObjCCategory(const ObjCCategoryRecord &Cat) {
+ addIVars(Cat.getObjCIVars(), Cat.getName());
+}
diff --git a/contrib/llvm-project/llvm/lib/TextAPI/RecordsSlice.cpp b/contrib/llvm-project/llvm/lib/TextAPI/RecordsSlice.cpp
index a220b255aea3..7ceffc7c9284 100644
--- a/contrib/llvm-project/llvm/lib/TextAPI/RecordsSlice.cpp
+++ b/contrib/llvm-project/llvm/lib/TextAPI/RecordsSlice.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/TextAPI/RecordsSlice.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/TextAPI/Record.h"
#include "llvm/TextAPI/Symbol.h"
#include <utility>
@@ -142,8 +143,10 @@ GlobalRecord *RecordsSlice::addGlobal(StringRef Name, RecordLinkage Linkage,
if (Result.second)
Result.first->second =
std::make_unique<GlobalRecord>(Name, Linkage, Flags, GV);
- else
+ else {
updateLinkage(Result.first->second.get(), Linkage);
+ updateFlags(Result.first->second.get(), Flags);
+ }
return Result.first->second.get();
}
@@ -164,6 +167,19 @@ ObjCInterfaceRecord *RecordsSlice::addObjCInterface(StringRef Name,
return Result.first->second.get();
}
+SymbolFlags Record::mergeFlags(SymbolFlags Flags, RecordLinkage Linkage) {
+ // Add Linkage properties into Flags.
+ switch (Linkage) {
+ case RecordLinkage::Rexported:
+ Flags |= SymbolFlags::Rexported;
+ return Flags;
+ case RecordLinkage::Undefined:
+ Flags |= SymbolFlags::Undefined;
+ return Flags;
+ default:
+ return Flags;
+ }
+}
bool ObjCInterfaceRecord::addObjCCategory(ObjCCategoryRecord *Record) {
auto Result = Categories.insert({Name, Record});
@@ -188,11 +204,26 @@ ObjCCategoryRecord *RecordsSlice::addObjCCategory(StringRef ClassToExtend,
return Result.first->second.get();
}
+std::vector<ObjCIVarRecord *> ObjCContainerRecord::getObjCIVars() const {
+ std::vector<ObjCIVarRecord *> Records;
+ llvm::for_each(IVars,
+ [&](auto &Record) { Records.push_back(Record.second.get()); });
+ return Records;
+}
+
+std::vector<ObjCCategoryRecord *>
+ObjCInterfaceRecord::getObjCCategories() const {
+ std::vector<ObjCCategoryRecord *> Records;
+ llvm::for_each(Categories,
+ [&](auto &Record) { Records.push_back(Record.second); });
+ return Records;
+}
+
ObjCIVarRecord *ObjCContainerRecord::addObjCIVar(StringRef IVar,
RecordLinkage Linkage) {
auto Result = IVars.insert({IVar, nullptr});
if (Result.second)
- Result.first->second = std::make_unique<ObjCIVarRecord>(Name, Linkage);
+ Result.first->second = std::make_unique<ObjCIVarRecord>(IVar, Linkage);
return Result.first->second.get();
}
@@ -222,3 +253,88 @@ RecordsSlice::BinaryAttrs &RecordsSlice::getBinaryAttrs() {
BA = std::make_unique<BinaryAttrs>();
return *BA;
}
+
+void RecordsSlice::visit(RecordVisitor &V) const {
+ for (auto &G : Globals)
+ V.visitGlobal(*G.second);
+ for (auto &C : Classes)
+ V.visitObjCInterface(*C.second);
+ for (auto &Cat : Categories)
+ V.visitObjCCategory(*Cat.second);
+}
+
+static std::unique_ptr<InterfaceFile>
+createInterfaceFile(const Records &Slices, StringRef InstallName) {
+ // Pickup symbols first.
+ auto Symbols = std::make_unique<SymbolSet>();
+ for (auto &S : Slices) {
+ if (S->empty())
+ continue;
+ auto &BA = S->getBinaryAttrs();
+ if (BA.InstallName != InstallName)
+ continue;
+
+ SymbolConverter Converter(Symbols.get(), S->getTarget(),
+ !BA.TwoLevelNamespace);
+ S->visit(Converter);
+ }
+
+ auto File = std::make_unique<InterfaceFile>(std::move(Symbols));
+ File->setInstallName(InstallName);
+ // Assign other attributes.
+ for (auto &S : Slices) {
+ if (S->empty())
+ continue;
+ auto &BA = S->getBinaryAttrs();
+ if (BA.InstallName != InstallName)
+ continue;
+ const Target &Targ = S->getTarget();
+ File->addTarget(Targ);
+ if (File->getFileType() == FileType::Invalid)
+ File->setFileType(BA.File);
+ if (BA.AppExtensionSafe && !File->isApplicationExtensionSafe())
+ File->setApplicationExtensionSafe();
+ if (BA.TwoLevelNamespace && !File->isTwoLevelNamespace())
+ File->setTwoLevelNamespace();
+ if (BA.OSLibNotForSharedCache && !File->isOSLibNotForSharedCache())
+ File->setOSLibNotForSharedCache();
+ if (File->getCurrentVersion().empty())
+ File->setCurrentVersion(BA.CurrentVersion);
+ if (File->getCompatibilityVersion().empty())
+ File->setCompatibilityVersion(BA.CompatVersion);
+ if (File->getSwiftABIVersion() == 0)
+ File->setSwiftABIVersion(BA.SwiftABI);
+ if (File->getPath().empty())
+ File->setPath(BA.Path);
+ if (!BA.ParentUmbrella.empty())
+ File->addParentUmbrella(Targ, BA.ParentUmbrella);
+ for (const auto &Client : BA.AllowableClients)
+ File->addAllowableClient(Client, Targ);
+ for (const auto &Lib : BA.RexportedLibraries)
+ File->addReexportedLibrary(Lib, Targ);
+ }
+
+ return File;
+}
+
+std::unique_ptr<InterfaceFile>
+llvm::MachO::convertToInterfaceFile(const Records &Slices) {
+ std::unique_ptr<InterfaceFile> File;
+ if (Slices.empty())
+ return File;
+
+ SetVector<StringRef> InstallNames;
+ for (auto &S : Slices) {
+ auto Name = S->getBinaryAttrs().InstallName;
+ if (Name.empty())
+ continue;
+ InstallNames.insert(Name);
+ }
+
+ File = createInterfaceFile(Slices, *InstallNames.begin());
+ for (auto it = std::next(InstallNames.begin()); it != InstallNames.end();
+ ++it)
+ File->addDocument(createInterfaceFile(Slices, *it));
+
+ return File;
+}
diff --git a/contrib/llvm-project/llvm/lib/TextAPI/Utils.cpp b/contrib/llvm-project/llvm/lib/TextAPI/Utils.cpp
new file mode 100644
index 000000000000..6d85083e0b54
--- /dev/null
+++ b/contrib/llvm-project/llvm/lib/TextAPI/Utils.cpp
@@ -0,0 +1,40 @@
+//===- Utils.cpp ----------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Implements utility functions for TextAPI Darwin operations.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/TextAPI/Utils.h"
+
+using namespace llvm;
+using namespace llvm::MachO;
+
+void llvm::MachO::replace_extension(SmallVectorImpl<char> &Path,
+ const Twine &Extension) {
+ StringRef P(Path.begin(), Path.size());
+ auto ParentPath = sys::path::parent_path(P);
+ auto Filename = sys::path::filename(P);
+
+ if (!ParentPath.ends_with(Filename.str() + ".framework")) {
+ sys::path::replace_extension(Path, Extension);
+ return;
+ }
+ // Framework dylibs do not have a file extension, in those cases the new
+ // extension is appended. e.g. given Path: "Foo.framework/Foo" and Extension:
+ // "tbd", the result is "Foo.framework/Foo.tbd".
+ SmallString<8> Storage;
+ StringRef Ext = Extension.toStringRef(Storage);
+
+ // Append '.' if needed.
+ if (!Ext.empty() && Ext[0] != '.')
+ Path.push_back('.');
+
+ // Append extension.
+ Path.append(Ext.begin(), Ext.end());
+}
diff --git a/contrib/llvm-project/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/contrib/llvm-project/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
index 781bc9a058e1..834903857a88 100644
--- a/contrib/llvm-project/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
+++ b/contrib/llvm-project/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
@@ -171,7 +171,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
if (!Def) {
llvm::errs() << "error parsing definition\n"
- << errorToErrorCode(Def.takeError()).message();
+ << errorToErrorCode(Def.takeError()).message() << "\n";
return 1;
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/contrib/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 8e1f782f7cd8..b2618e35b085 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -291,42 +291,15 @@ static const Value *getPointerOperand(const Instruction *I,
}
/// Helper function to create a pointer based on \p Ptr, and advanced by \p
-/// Offset bytes. To aid later analysis the method tries to build
-/// getelement pointer instructions that traverse the natural type of \p Ptr if
-/// possible. If that fails, the remaining offset is adjusted byte-wise, hence
-/// through a cast to i8*.
-///
-/// TODO: This could probably live somewhere more prominantly if it doesn't
-/// already exist.
-static Value *constructPointer(Type *PtrElemTy, Value *Ptr, int64_t Offset,
- IRBuilder<NoFolder> &IRB, const DataLayout &DL) {
- assert(Offset >= 0 && "Negative offset not supported yet!");
+/// Offset bytes.
+static Value *constructPointer(Value *Ptr, int64_t Offset,
+ IRBuilder<NoFolder> &IRB) {
LLVM_DEBUG(dbgs() << "Construct pointer: " << *Ptr << " + " << Offset
<< "-bytes\n");
- if (Offset) {
- Type *Ty = PtrElemTy;
- APInt IntOffset(DL.getIndexTypeSizeInBits(Ptr->getType()), Offset);
- SmallVector<APInt> IntIndices = DL.getGEPIndicesForOffset(Ty, IntOffset);
-
- SmallVector<Value *, 4> ValIndices;
- std::string GEPName = Ptr->getName().str();
- for (const APInt &Index : IntIndices) {
- ValIndices.push_back(IRB.getInt(Index));
- GEPName += "." + std::to_string(Index.getZExtValue());
- }
-
- // Create a GEP for the indices collected above.
- Ptr = IRB.CreateGEP(PtrElemTy, Ptr, ValIndices, GEPName);
-
- // If an offset is left we use byte-wise adjustment.
- if (IntOffset != 0) {
- Ptr = IRB.CreateGEP(IRB.getInt8Ty(), Ptr, IRB.getInt(IntOffset),
- GEPName + ".b" + Twine(IntOffset.getZExtValue()));
- }
- }
-
- LLVM_DEBUG(dbgs() << "Constructed pointer: " << *Ptr << "\n");
+ if (Offset)
+ Ptr = IRB.CreateGEP(IRB.getInt8Ty(), Ptr, IRB.getInt64(Offset),
+ Ptr->getName() + ".b" + Twine(Offset));
return Ptr;
}
@@ -7487,16 +7460,15 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl {
if (auto *PrivStructType = dyn_cast<StructType>(PrivType)) {
const StructLayout *PrivStructLayout = DL.getStructLayout(PrivStructType);
for (unsigned u = 0, e = PrivStructType->getNumElements(); u < e; u++) {
- Value *Ptr = constructPointer(
- PrivType, &Base, PrivStructLayout->getElementOffset(u), IRB, DL);
+ Value *Ptr =
+ constructPointer(&Base, PrivStructLayout->getElementOffset(u), IRB);
new StoreInst(F.getArg(ArgNo + u), Ptr, &IP);
}
} else if (auto *PrivArrayType = dyn_cast<ArrayType>(PrivType)) {
Type *PointeeTy = PrivArrayType->getElementType();
uint64_t PointeeTySize = DL.getTypeStoreSize(PointeeTy);
for (unsigned u = 0, e = PrivArrayType->getNumElements(); u < e; u++) {
- Value *Ptr =
- constructPointer(PrivType, &Base, u * PointeeTySize, IRB, DL);
+ Value *Ptr = constructPointer(&Base, u * PointeeTySize, IRB);
new StoreInst(F.getArg(ArgNo + u), Ptr, &IP);
}
} else {
@@ -7521,8 +7493,8 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl {
const StructLayout *PrivStructLayout = DL.getStructLayout(PrivStructType);
for (unsigned u = 0, e = PrivStructType->getNumElements(); u < e; u++) {
Type *PointeeTy = PrivStructType->getElementType(u);
- Value *Ptr = constructPointer(
- PrivType, Base, PrivStructLayout->getElementOffset(u), IRB, DL);
+ Value *Ptr =
+ constructPointer(Base, PrivStructLayout->getElementOffset(u), IRB);
LoadInst *L = new LoadInst(PointeeTy, Ptr, "", IP);
L->setAlignment(Alignment);
ReplacementValues.push_back(L);
@@ -7531,8 +7503,7 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl {
Type *PointeeTy = PrivArrayType->getElementType();
uint64_t PointeeTySize = DL.getTypeStoreSize(PointeeTy);
for (unsigned u = 0, e = PrivArrayType->getNumElements(); u < e; u++) {
- Value *Ptr =
- constructPointer(PrivType, Base, u * PointeeTySize, IRB, DL);
+ Value *Ptr = constructPointer(Base, u * PointeeTySize, IRB);
LoadInst *L = new LoadInst(PointeeTy, Ptr, "", IP);
L->setAlignment(Alignment);
ReplacementValues.push_back(L);
diff --git a/contrib/llvm-project/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/contrib/llvm-project/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index b2665161c090..4176d561363f 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -2053,6 +2053,9 @@ private:
LLVM_DEBUG(dbgs() << "[Attributor] Done with " << SCC.size()
<< " functions, result: " << Changed << ".\n");
+ if (Changed == ChangeStatus::CHANGED)
+ OMPInfoCache.invalidateAnalyses();
+
return Changed == ChangeStatus::CHANGED;
}
@@ -3763,7 +3766,7 @@ struct AAKernelInfoFunction : AAKernelInfo {
ConstantInt *ExecModeC =
KernelInfo::getExecModeFromKernelEnvironment(KernelEnvC);
ConstantInt *AssumedExecModeC = ConstantInt::get(
- ExecModeC->getType(),
+ ExecModeC->getIntegerType(),
ExecModeC->getSExtValue() | OMP_TGT_EXEC_MODE_GENERIC_SPMD);
if (ExecModeC->getSExtValue() & OMP_TGT_EXEC_MODE_SPMD)
SPMDCompatibilityTracker.indicateOptimisticFixpoint();
@@ -3792,7 +3795,7 @@ struct AAKernelInfoFunction : AAKernelInfo {
ConstantInt *MayUseNestedParallelismC =
KernelInfo::getMayUseNestedParallelismFromKernelEnvironment(KernelEnvC);
ConstantInt *AssumedMayUseNestedParallelismC = ConstantInt::get(
- MayUseNestedParallelismC->getType(), NestedParallelism);
+ MayUseNestedParallelismC->getIntegerType(), NestedParallelism);
setMayUseNestedParallelismOfKernelEnvironment(
AssumedMayUseNestedParallelismC);
@@ -3801,7 +3804,7 @@ struct AAKernelInfoFunction : AAKernelInfo {
KernelInfo::getUseGenericStateMachineFromKernelEnvironment(
KernelEnvC);
ConstantInt *AssumedUseGenericStateMachineC =
- ConstantInt::get(UseGenericStateMachineC->getType(), false);
+ ConstantInt::get(UseGenericStateMachineC->getIntegerType(), false);
setUseGenericStateMachineOfKernelEnvironment(
AssumedUseGenericStateMachineC);
}
@@ -4280,8 +4283,9 @@ struct AAKernelInfoFunction : AAKernelInfo {
// kernel is executed in.
assert(ExecModeVal == OMP_TGT_EXEC_MODE_GENERIC &&
"Initially non-SPMD kernel has SPMD exec mode!");
- setExecModeOfKernelEnvironment(ConstantInt::get(
- ExecModeC->getType(), ExecModeVal | OMP_TGT_EXEC_MODE_GENERIC_SPMD));
+ setExecModeOfKernelEnvironment(
+ ConstantInt::get(ExecModeC->getIntegerType(),
+ ExecModeVal | OMP_TGT_EXEC_MODE_GENERIC_SPMD));
++NumOpenMPTargetRegionKernelsSPMD;
@@ -4332,7 +4336,7 @@ struct AAKernelInfoFunction : AAKernelInfo {
// If not SPMD mode, indicate we use a custom state machine now.
setUseGenericStateMachineOfKernelEnvironment(
- ConstantInt::get(UseStateMachineC->getType(), false));
+ ConstantInt::get(UseStateMachineC->getIntegerType(), false));
// If we don't actually need a state machine we are done here. This can
// happen if there simply are no parallel regions. In the resulting kernel
@@ -4658,7 +4662,7 @@ struct AAKernelInfoFunction : AAKernelInfo {
KernelInfo::getMayUseNestedParallelismFromKernelEnvironment(
AA.KernelEnvC);
ConstantInt *NewMayUseNestedParallelismC = ConstantInt::get(
- MayUseNestedParallelismC->getType(), AA.NestedParallelism);
+ MayUseNestedParallelismC->getIntegerType(), AA.NestedParallelism);
AA.setMayUseNestedParallelismOfKernelEnvironment(
NewMayUseNestedParallelismC);
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp b/contrib/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 6c6f0a0eca72..2fd8668d15e2 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -794,10 +794,9 @@ SampleProfileLoader::findIndirectCallFunctionSamples(
return R;
auto CallSite = FunctionSamples::getCallSiteIdentifier(DIL);
- auto T = FS->findCallTargetMapAt(CallSite);
Sum = 0;
- if (T)
- for (const auto &T_C : T.get())
+ if (auto T = FS->findCallTargetMapAt(CallSite))
+ for (const auto &T_C : *T)
Sum += T_C.second;
if (const FunctionSamplesMap *M = FS->findFunctionSamplesMapAt(CallSite)) {
if (M->empty())
@@ -1679,7 +1678,8 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) {
if (!FS)
continue;
auto CallSite = FunctionSamples::getCallSiteIdentifier(DIL);
- auto T = FS->findCallTargetMapAt(CallSite);
+ ErrorOr<SampleRecord::CallTargetMap> T =
+ FS->findCallTargetMapAt(CallSite);
if (!T || T.get().empty())
continue;
if (FunctionSamples::ProfileIsProbeBased) {
@@ -2261,9 +2261,8 @@ void SampleProfileMatcher::countProfileCallsiteMismatches(
// Compute number of samples in the original profile.
uint64_t CallsiteSamples = 0;
- auto CTM = FS.findCallTargetMapAt(Loc);
- if (CTM) {
- for (const auto &I : CTM.get())
+ if (auto CTM = FS.findCallTargetMapAt(Loc)) {
+ for (const auto &I : *CTM)
CallsiteSamples += I.second;
}
const auto *FSMap = FS.findFunctionSamplesMapAt(Loc);
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 5e362f4117d0..63b1e0f64a88 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -3956,35 +3956,50 @@ Value *InstCombinerImpl::foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS,
const APInt *LC, *RC;
if (match(LHS1, m_APInt(LC)) && match(RHS1, m_APInt(RC)) &&
LHS0->getType() == RHS0->getType() &&
- LHS0->getType()->isIntOrIntVectorTy() &&
- (LHS->hasOneUse() || RHS->hasOneUse())) {
+ LHS0->getType()->isIntOrIntVectorTy()) {
// Convert xor of signbit tests to signbit test of xor'd values:
// (X > -1) ^ (Y > -1) --> (X ^ Y) < 0
// (X < 0) ^ (Y < 0) --> (X ^ Y) < 0
// (X > -1) ^ (Y < 0) --> (X ^ Y) > -1
// (X < 0) ^ (Y > -1) --> (X ^ Y) > -1
bool TrueIfSignedL, TrueIfSignedR;
- if (isSignBitCheck(PredL, *LC, TrueIfSignedL) &&
+ if ((LHS->hasOneUse() || RHS->hasOneUse()) &&
+ isSignBitCheck(PredL, *LC, TrueIfSignedL) &&
isSignBitCheck(PredR, *RC, TrueIfSignedR)) {
Value *XorLR = Builder.CreateXor(LHS0, RHS0);
return TrueIfSignedL == TrueIfSignedR ? Builder.CreateIsNeg(XorLR) :
Builder.CreateIsNotNeg(XorLR);
}
- // (X > C) ^ (X < C + 2) --> X != C + 1
- // (X < C + 2) ^ (X > C) --> X != C + 1
- // Considering the correctness of this pattern, we should avoid that C is
- // non-negative and C + 2 is negative, although it will be matched by other
- // patterns.
- const APInt *C1, *C2;
- if ((PredL == CmpInst::ICMP_SGT && match(LHS1, m_APInt(C1)) &&
- PredR == CmpInst::ICMP_SLT && match(RHS1, m_APInt(C2))) ||
- (PredL == CmpInst::ICMP_SLT && match(LHS1, m_APInt(C2)) &&
- PredR == CmpInst::ICMP_SGT && match(RHS1, m_APInt(C1))))
- if (LHS0 == RHS0 && *C1 + 2 == *C2 &&
- (C1->isNegative() || C2->isNonNegative()))
- return Builder.CreateICmpNE(LHS0,
- ConstantInt::get(LHS0->getType(), *C1 + 1));
+ // Fold (icmp pred1 X, C1) ^ (icmp pred2 X, C2)
+ // into a single comparison using range-based reasoning.
+ if (LHS0 == RHS0) {
+ ConstantRange CR1 = ConstantRange::makeExactICmpRegion(PredL, *LC);
+ ConstantRange CR2 = ConstantRange::makeExactICmpRegion(PredR, *RC);
+ auto CRUnion = CR1.exactUnionWith(CR2);
+ auto CRIntersect = CR1.exactIntersectWith(CR2);
+ if (CRUnion && CRIntersect)
+ if (auto CR = CRUnion->exactIntersectWith(CRIntersect->inverse())) {
+ if (CR->isFullSet())
+ return ConstantInt::getTrue(I.getType());
+ if (CR->isEmptySet())
+ return ConstantInt::getFalse(I.getType());
+
+ CmpInst::Predicate NewPred;
+ APInt NewC, Offset;
+ CR->getEquivalentICmp(NewPred, NewC, Offset);
+
+ if ((Offset.isZero() && (LHS->hasOneUse() || RHS->hasOneUse())) ||
+ (LHS->hasOneUse() && RHS->hasOneUse())) {
+ Value *NewV = LHS0;
+ Type *Ty = LHS0->getType();
+ if (!Offset.isZero())
+ NewV = Builder.CreateAdd(NewV, ConstantInt::get(Ty, Offset));
+ return Builder.CreateICmp(NewPred, NewV,
+ ConstantInt::get(Ty, NewC));
+ }
+ }
+ }
}
// Instead of trying to imitate the folds for and/or, decompose this 'xor'
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 1539fa9a3269..3b7fe7fa2266 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -357,9 +357,9 @@ Instruction *InstCombinerImpl::simplifyMaskedStore(IntrinsicInst &II) {
// Use masked off lanes to simplify operands via SimplifyDemandedVectorElts
APInt DemandedElts = possiblyDemandedEltsInMask(ConstMask);
- APInt UndefElts(DemandedElts.getBitWidth(), 0);
- if (Value *V =
- SimplifyDemandedVectorElts(II.getOperand(0), DemandedElts, UndefElts))
+ APInt PoisonElts(DemandedElts.getBitWidth(), 0);
+ if (Value *V = SimplifyDemandedVectorElts(II.getOperand(0), DemandedElts,
+ PoisonElts))
return replaceOperand(II, 0, V);
return nullptr;
@@ -439,12 +439,12 @@ Instruction *InstCombinerImpl::simplifyMaskedScatter(IntrinsicInst &II) {
// Use masked off lanes to simplify operands via SimplifyDemandedVectorElts
APInt DemandedElts = possiblyDemandedEltsInMask(ConstMask);
- APInt UndefElts(DemandedElts.getBitWidth(), 0);
- if (Value *V =
- SimplifyDemandedVectorElts(II.getOperand(0), DemandedElts, UndefElts))
+ APInt PoisonElts(DemandedElts.getBitWidth(), 0);
+ if (Value *V = SimplifyDemandedVectorElts(II.getOperand(0), DemandedElts,
+ PoisonElts))
return replaceOperand(II, 0, V);
- if (Value *V =
- SimplifyDemandedVectorElts(II.getOperand(1), DemandedElts, UndefElts))
+ if (Value *V = SimplifyDemandedVectorElts(II.getOperand(1), DemandedElts,
+ PoisonElts))
return replaceOperand(II, 1, V);
return nullptr;
@@ -1526,9 +1526,9 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
// support.
if (auto *IIFVTy = dyn_cast<FixedVectorType>(II->getType())) {
auto VWidth = IIFVTy->getNumElements();
- APInt UndefElts(VWidth, 0);
+ APInt PoisonElts(VWidth, 0);
APInt AllOnesEltMask(APInt::getAllOnes(VWidth));
- if (Value *V = SimplifyDemandedVectorElts(II, AllOnesEltMask, UndefElts)) {
+ if (Value *V = SimplifyDemandedVectorElts(II, AllOnesEltMask, PoisonElts)) {
if (V != II)
return replaceInstUsesWith(*II, V);
return II;
@@ -1539,6 +1539,9 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
if (Instruction *I = foldCommutativeIntrinsicOverSelects(*II))
return I;
+ if (Instruction *I = foldCommutativeIntrinsicOverPhis(*II))
+ return I;
+
if (CallInst *NewCall = canonicalizeConstantArg0ToArg1(CI))
return NewCall;
}
@@ -1793,6 +1796,23 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
if (Instruction *NewMinMax = factorizeMinMaxTree(II))
return NewMinMax;
+ // Try to fold minmax with constant RHS based on range information
+ const APInt *RHSC;
+ if (match(I1, m_APIntAllowUndef(RHSC))) {
+ ICmpInst::Predicate Pred =
+ ICmpInst::getNonStrictPredicate(MinMaxIntrinsic::getPredicate(IID));
+ bool IsSigned = MinMaxIntrinsic::isSigned(IID);
+ ConstantRange LHS_CR = computeConstantRangeIncludingKnownBits(
+ I0, IsSigned, SQ.getWithInstruction(II));
+ if (!LHS_CR.isFullSet()) {
+ if (LHS_CR.icmp(Pred, *RHSC))
+ return replaceInstUsesWith(*II, I0);
+ if (LHS_CR.icmp(ICmpInst::getSwappedPredicate(Pred), *RHSC))
+ return replaceInstUsesWith(*II,
+ ConstantInt::get(II->getType(), *RHSC));
+ }
+ }
+
break;
}
case Intrinsic::bitreverse: {
@@ -4237,3 +4257,22 @@ InstCombinerImpl::foldCommutativeIntrinsicOverSelects(IntrinsicInst &II) {
return nullptr;
}
+
+Instruction *
+InstCombinerImpl::foldCommutativeIntrinsicOverPhis(IntrinsicInst &II) {
+ assert(II.isCommutative() && "Instruction should be commutative");
+
+ PHINode *LHS = dyn_cast<PHINode>(II.getOperand(0));
+ PHINode *RHS = dyn_cast<PHINode>(II.getOperand(1));
+
+ if (!LHS || !RHS)
+ return nullptr;
+
+ if (auto P = matchSymmetricPhiNodesPair(LHS, RHS)) {
+ replaceOperand(II, 0, P->first);
+ replaceOperand(II, 1, P->second);
+ return &II;
+ }
+
+ return nullptr;
+}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index 1d50fa9b6bf7..9e76a0cf17b1 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -278,6 +278,16 @@ private:
IntrinsicInst &Tramp);
Instruction *foldCommutativeIntrinsicOverSelects(IntrinsicInst &II);
+ // Match a pair of Phi Nodes like
+ // phi [a, BB0], [b, BB1] & phi [b, BB0], [a, BB1]
+ // Return the matched two operands.
+ std::optional<std::pair<Value *, Value *>>
+ matchSymmetricPhiNodesPair(PHINode *LHS, PHINode *RHS);
+
+ // Tries to fold (op phi(a, b) phi(b, a)) -> (op a, b)
+ // while op is a commutative intrinsic call.
+ Instruction *foldCommutativeIntrinsicOverPhis(IntrinsicInst &II);
+
Value *simplifyMaskedLoad(IntrinsicInst &II);
Instruction *simplifyMaskedStore(IntrinsicInst &II);
Instruction *simplifyMaskedGather(IntrinsicInst &II);
@@ -492,6 +502,11 @@ public:
/// X % (C0 * C1)
Value *SimplifyAddWithRemainder(BinaryOperator &I);
+ // Tries to fold (Binop phi(a, b) phi(b, a)) -> (Binop a, b)
+ // while Binop is commutative.
+ Value *SimplifyPhiCommutativeBinaryOp(BinaryOperator &I, Value *LHS,
+ Value *RHS);
+
// Binary Op helper for select operations where the expression can be
// efficiently reorganized.
Value *SimplifySelectsFeedingBinaryOp(BinaryOperator &I, Value *LHS,
@@ -550,7 +565,7 @@ public:
bool SimplifyDemandedInstructionBits(Instruction &Inst, KnownBits &Known);
Value *SimplifyDemandedVectorElts(Value *V, APInt DemandedElts,
- APInt &UndefElts, unsigned Depth = 0,
+ APInt &PoisonElts, unsigned Depth = 0,
bool AllowMultipleUsers = false) override;
/// Canonicalize the position of binops relative to shufflevector.
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index e5566578869d..f0ea3d9fcad5 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -350,6 +350,13 @@ Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) {
if (match(&I, m_c_Mul(m_OneUse(m_Neg(m_Value(X))), m_Value(Y))))
return BinaryOperator::CreateNeg(Builder.CreateMul(X, Y));
+ // (-X * Y) * -X --> (X * Y) * X
+ // (-X << Y) * -X --> (X << Y) * X
+ if (match(Op1, m_Neg(m_Value(X)))) {
+ if (Value *NegOp0 = Negator::Negate(false, /*IsNSW*/ false, Op0, *this))
+ return BinaryOperator::CreateMul(NegOp0, X);
+ }
+
// (X / Y) * Y = X - (X % Y)
// (X / Y) * -Y = (X % Y) - X
{
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 2dda46986f0f..20bf00344b14 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2440,9 +2440,9 @@ Instruction *InstCombinerImpl::foldVectorSelect(SelectInst &Sel) {
return nullptr;
unsigned NumElts = VecTy->getNumElements();
- APInt UndefElts(NumElts, 0);
+ APInt PoisonElts(NumElts, 0);
APInt AllOnesEltMask(APInt::getAllOnes(NumElts));
- if (Value *V = SimplifyDemandedVectorElts(&Sel, AllOnesEltMask, UndefElts)) {
+ if (Value *V = SimplifyDemandedVectorElts(&Sel, AllOnesEltMask, PoisonElts)) {
if (V != &Sel)
return replaceInstUsesWith(Sel, V);
return &Sel;
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 846116a929b1..a8a5f9831e15 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -1319,8 +1319,8 @@ Value *InstCombinerImpl::simplifyShrShlDemandedBits(
}
/// The specified value produces a vector with any number of elements.
-/// This method analyzes which elements of the operand are undef or poison and
-/// returns that information in UndefElts.
+/// This method analyzes which elements of the operand are poison and
+/// returns that information in PoisonElts.
///
/// DemandedElts contains the set of elements that are actually used by the
/// caller, and by default (AllowMultipleUsers equals false) the value is
@@ -1333,7 +1333,7 @@ Value *InstCombinerImpl::simplifyShrShlDemandedBits(
/// returned. This returns null if no change was made.
Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
APInt DemandedElts,
- APInt &UndefElts,
+ APInt &PoisonElts,
unsigned Depth,
bool AllowMultipleUsers) {
// Cannot analyze scalable type. The number of vector elements is not a
@@ -1345,18 +1345,18 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
APInt EltMask(APInt::getAllOnes(VWidth));
assert((DemandedElts & ~EltMask) == 0 && "Invalid DemandedElts!");
- if (match(V, m_Undef())) {
- // If the entire vector is undef or poison, just return this info.
- UndefElts = EltMask;
+ if (match(V, m_Poison())) {
+ // If the entire vector is poison, just return this info.
+ PoisonElts = EltMask;
return nullptr;
}
if (DemandedElts.isZero()) { // If nothing is demanded, provide poison.
- UndefElts = EltMask;
+ PoisonElts = EltMask;
return PoisonValue::get(V->getType());
}
- UndefElts = 0;
+ PoisonElts = 0;
if (auto *C = dyn_cast<Constant>(V)) {
// Check if this is identity. If so, return 0 since we are not simplifying
@@ -1370,7 +1370,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
for (unsigned i = 0; i != VWidth; ++i) {
if (!DemandedElts[i]) { // If not demanded, set to poison.
Elts.push_back(Poison);
- UndefElts.setBit(i);
+ PoisonElts.setBit(i);
continue;
}
@@ -1378,8 +1378,8 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
if (!Elt) return nullptr;
Elts.push_back(Elt);
- if (isa<UndefValue>(Elt)) // Already undef or poison.
- UndefElts.setBit(i);
+ if (isa<PoisonValue>(Elt)) // Already poison.
+ PoisonElts.setBit(i);
}
// If we changed the constant, return it.
@@ -1400,7 +1400,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
// They'll be handled when it's their turn to be visited by
// the main instcombine process.
if (Depth != 0)
- // TODO: Just compute the UndefElts information recursively.
+ // TODO: Just compute the PoisonElts information recursively.
return nullptr;
// Conservatively assume that all elements are needed.
@@ -1422,8 +1422,8 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
}
};
- APInt UndefElts2(VWidth, 0);
- APInt UndefElts3(VWidth, 0);
+ APInt PoisonElts2(VWidth, 0);
+ APInt PoisonElts3(VWidth, 0);
switch (I->getOpcode()) {
default: break;
@@ -1449,17 +1449,17 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
if (i == 0 ? match(I->getOperand(i), m_Undef())
: match(I->getOperand(i), m_Poison())) {
// If the entire vector is undefined, just return this info.
- UndefElts = EltMask;
+ PoisonElts = EltMask;
return nullptr;
}
if (I->getOperand(i)->getType()->isVectorTy()) {
- APInt UndefEltsOp(VWidth, 0);
- simplifyAndSetOp(I, i, DemandedElts, UndefEltsOp);
+ APInt PoisonEltsOp(VWidth, 0);
+ simplifyAndSetOp(I, i, DemandedElts, PoisonEltsOp);
// gep(x, undef) is not undef, so skip considering idx ops here
// Note that we could propagate poison, but we can't distinguish between
// undef & poison bits ATM
if (i == 0)
- UndefElts |= UndefEltsOp;
+ PoisonElts |= PoisonEltsOp;
}
}
@@ -1472,7 +1472,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
if (!Idx) {
// Note that we can't propagate undef elt info, because we don't know
// which elt is getting updated.
- simplifyAndSetOp(I, 0, DemandedElts, UndefElts2);
+ simplifyAndSetOp(I, 0, DemandedElts, PoisonElts2);
break;
}
@@ -1487,7 +1487,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
// was extracted from the same index in another vector with the same type,
// replace this insert with that other vector.
// Note: This is attempted before the call to simplifyAndSetOp because that
- // may change UndefElts to a value that does not match with Vec.
+ // may change PoisonElts to a value that does not match with Vec.
Value *Vec;
if (PreInsertDemandedElts == 0 &&
match(I->getOperand(1),
@@ -1496,7 +1496,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
return Vec;
}
- simplifyAndSetOp(I, 0, PreInsertDemandedElts, UndefElts);
+ simplifyAndSetOp(I, 0, PreInsertDemandedElts, PoisonElts);
// If this is inserting an element that isn't demanded, remove this
// insertelement.
@@ -1506,7 +1506,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
}
// The inserted element is defined.
- UndefElts.clearBit(IdxNo);
+ PoisonElts.clearBit(IdxNo);
break;
}
case Instruction::ShuffleVector: {
@@ -1520,17 +1520,17 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
// operand.
if (all_of(Shuffle->getShuffleMask(), [](int Elt) { return Elt == 0; }) &&
DemandedElts.isAllOnes()) {
- if (!match(I->getOperand(1), m_Undef())) {
+ if (!isa<PoisonValue>(I->getOperand(1))) {
I->setOperand(1, PoisonValue::get(I->getOperand(1)->getType()));
MadeChange = true;
}
APInt LeftDemanded(OpWidth, 1);
- APInt LHSUndefElts(OpWidth, 0);
- simplifyAndSetOp(I, 0, LeftDemanded, LHSUndefElts);
- if (LHSUndefElts[0])
- UndefElts = EltMask;
+ APInt LHSPoisonElts(OpWidth, 0);
+ simplifyAndSetOp(I, 0, LeftDemanded, LHSPoisonElts);
+ if (LHSPoisonElts[0])
+ PoisonElts = EltMask;
else
- UndefElts.clearAllBits();
+ PoisonElts.clearAllBits();
break;
}
@@ -1549,11 +1549,11 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
}
}
- APInt LHSUndefElts(OpWidth, 0);
- simplifyAndSetOp(I, 0, LeftDemanded, LHSUndefElts);
+ APInt LHSPoisonElts(OpWidth, 0);
+ simplifyAndSetOp(I, 0, LeftDemanded, LHSPoisonElts);
- APInt RHSUndefElts(OpWidth, 0);
- simplifyAndSetOp(I, 1, RightDemanded, RHSUndefElts);
+ APInt RHSPoisonElts(OpWidth, 0);
+ simplifyAndSetOp(I, 1, RightDemanded, RHSPoisonElts);
// If this shuffle does not change the vector length and the elements
// demanded by this shuffle are an identity mask, then this shuffle is
@@ -1579,7 +1579,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
return Shuffle->getOperand(0);
}
- bool NewUndefElts = false;
+ bool NewPoisonElts = false;
unsigned LHSIdx = -1u, LHSValIdx = -1u;
unsigned RHSIdx = -1u, RHSValIdx = -1u;
bool LHSUniform = true;
@@ -1587,23 +1587,23 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
for (unsigned i = 0; i < VWidth; i++) {
unsigned MaskVal = Shuffle->getMaskValue(i);
if (MaskVal == -1u) {
- UndefElts.setBit(i);
+ PoisonElts.setBit(i);
} else if (!DemandedElts[i]) {
- NewUndefElts = true;
- UndefElts.setBit(i);
+ NewPoisonElts = true;
+ PoisonElts.setBit(i);
} else if (MaskVal < OpWidth) {
- if (LHSUndefElts[MaskVal]) {
- NewUndefElts = true;
- UndefElts.setBit(i);
+ if (LHSPoisonElts[MaskVal]) {
+ NewPoisonElts = true;
+ PoisonElts.setBit(i);
} else {
LHSIdx = LHSIdx == -1u ? i : OpWidth;
LHSValIdx = LHSValIdx == -1u ? MaskVal : OpWidth;
LHSUniform = LHSUniform && (MaskVal == i);
}
} else {
- if (RHSUndefElts[MaskVal - OpWidth]) {
- NewUndefElts = true;
- UndefElts.setBit(i);
+ if (RHSPoisonElts[MaskVal - OpWidth]) {
+ NewPoisonElts = true;
+ PoisonElts.setBit(i);
} else {
RHSIdx = RHSIdx == -1u ? i : OpWidth;
RHSValIdx = RHSValIdx == -1u ? MaskVal - OpWidth : OpWidth;
@@ -1646,11 +1646,11 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
return New;
}
}
- if (NewUndefElts) {
+ if (NewPoisonElts) {
// Add additional discovered undefs.
SmallVector<int, 16> Elts;
for (unsigned i = 0; i < VWidth; ++i) {
- if (UndefElts[i])
+ if (PoisonElts[i])
Elts.push_back(PoisonMaskElem);
else
Elts.push_back(Shuffle->getMaskValue(i));
@@ -1665,12 +1665,12 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
// on the current demanded elements.
SelectInst *Sel = cast<SelectInst>(I);
if (Sel->getCondition()->getType()->isVectorTy()) {
- // TODO: We are not doing anything with UndefElts based on this call.
+ // TODO: We are not doing anything with PoisonElts based on this call.
// It is overwritten below based on the other select operands. If an
// element of the select condition is known undef, then we are free to
// choose the output value from either arm of the select. If we know that
// one of those values is undef, then the output can be undef.
- simplifyAndSetOp(I, 0, DemandedElts, UndefElts);
+ simplifyAndSetOp(I, 0, DemandedElts, PoisonElts);
}
// Next, see if we can transform the arms of the select.
@@ -1692,12 +1692,12 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
}
}
- simplifyAndSetOp(I, 1, DemandedLHS, UndefElts2);
- simplifyAndSetOp(I, 2, DemandedRHS, UndefElts3);
+ simplifyAndSetOp(I, 1, DemandedLHS, PoisonElts2);
+ simplifyAndSetOp(I, 2, DemandedRHS, PoisonElts3);
// Output elements are undefined if the element from each arm is undefined.
// TODO: This can be improved. See comment in select condition handling.
- UndefElts = UndefElts2 & UndefElts3;
+ PoisonElts = PoisonElts2 & PoisonElts3;
break;
}
case Instruction::BitCast: {
@@ -1706,7 +1706,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
if (!VTy) break;
unsigned InVWidth = cast<FixedVectorType>(VTy)->getNumElements();
APInt InputDemandedElts(InVWidth, 0);
- UndefElts2 = APInt(InVWidth, 0);
+ PoisonElts2 = APInt(InVWidth, 0);
unsigned Ratio;
if (VWidth == InVWidth) {
@@ -1735,25 +1735,25 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
break;
}
- simplifyAndSetOp(I, 0, InputDemandedElts, UndefElts2);
+ simplifyAndSetOp(I, 0, InputDemandedElts, PoisonElts2);
if (VWidth == InVWidth) {
- UndefElts = UndefElts2;
+ PoisonElts = PoisonElts2;
} else if ((VWidth % InVWidth) == 0) {
// If the number of elements in the output is a multiple of the number of
// elements in the input then an output element is undef if the
// corresponding input element is undef.
for (unsigned OutIdx = 0; OutIdx != VWidth; ++OutIdx)
- if (UndefElts2[OutIdx / Ratio])
- UndefElts.setBit(OutIdx);
+ if (PoisonElts2[OutIdx / Ratio])
+ PoisonElts.setBit(OutIdx);
} else if ((InVWidth % VWidth) == 0) {
// If the number of elements in the input is a multiple of the number of
// elements in the output then an output element is undef if all of the
// corresponding input elements are undef.
for (unsigned OutIdx = 0; OutIdx != VWidth; ++OutIdx) {
- APInt SubUndef = UndefElts2.lshr(OutIdx * Ratio).zextOrTrunc(Ratio);
+ APInt SubUndef = PoisonElts2.lshr(OutIdx * Ratio).zextOrTrunc(Ratio);
if (SubUndef.popcount() == Ratio)
- UndefElts.setBit(OutIdx);
+ PoisonElts.setBit(OutIdx);
}
} else {
llvm_unreachable("Unimp");
@@ -1762,7 +1762,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
}
case Instruction::FPTrunc:
case Instruction::FPExt:
- simplifyAndSetOp(I, 0, DemandedElts, UndefElts);
+ simplifyAndSetOp(I, 0, DemandedElts, PoisonElts);
break;
case Instruction::Call: {
@@ -1785,18 +1785,18 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
DemandedPassThrough.clearBit(i);
}
if (II->getIntrinsicID() == Intrinsic::masked_gather)
- simplifyAndSetOp(II, 0, DemandedPtrs, UndefElts2);
- simplifyAndSetOp(II, 3, DemandedPassThrough, UndefElts3);
+ simplifyAndSetOp(II, 0, DemandedPtrs, PoisonElts2);
+ simplifyAndSetOp(II, 3, DemandedPassThrough, PoisonElts3);
// Output elements are undefined if the element from both sources are.
// TODO: can strengthen via mask as well.
- UndefElts = UndefElts2 & UndefElts3;
+ PoisonElts = PoisonElts2 & PoisonElts3;
break;
}
default: {
// Handle target specific intrinsics
std::optional<Value *> V = targetSimplifyDemandedVectorEltsIntrinsic(
- *II, DemandedElts, UndefElts, UndefElts2, UndefElts3,
+ *II, DemandedElts, PoisonElts, PoisonElts2, PoisonElts3,
simplifyAndSetOp);
if (V)
return *V;
@@ -1859,18 +1859,18 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
return ShufBO;
}
- simplifyAndSetOp(I, 0, DemandedElts, UndefElts);
- simplifyAndSetOp(I, 1, DemandedElts, UndefElts2);
+ simplifyAndSetOp(I, 0, DemandedElts, PoisonElts);
+ simplifyAndSetOp(I, 1, DemandedElts, PoisonElts2);
// Output elements are undefined if both are undefined. Consider things
// like undef & 0. The result is known zero, not undef.
- UndefElts &= UndefElts2;
+ PoisonElts &= PoisonElts2;
}
- // If we've proven all of the lanes undef, return an undef value.
+ // If we've proven all of the lanes poison, return a poison value.
// TODO: Intersect w/demanded lanes
- if (UndefElts.isAllOnes())
- return UndefValue::get(I->getType());
+ if (PoisonElts.isAllOnes())
+ return PoisonValue::get(I->getType());
return MadeChange ? I : nullptr;
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index c8b58c51d4e6..18ab510aae7f 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -388,7 +388,7 @@ static APInt findDemandedEltsByAllUsers(Value *V) {
/// arbitrarily pick 64 bit as our canonical type. The actual bitwidth doesn't
/// matter, we just want a consistent type to simplify CSE.
static ConstantInt *getPreferredVectorIndex(ConstantInt *IndexC) {
- const unsigned IndexBW = IndexC->getType()->getBitWidth();
+ const unsigned IndexBW = IndexC->getBitWidth();
if (IndexBW == 64 || IndexC->getValue().getActiveBits() > 64)
return nullptr;
return ConstantInt::get(IndexC->getContext(),
@@ -581,20 +581,20 @@ Instruction *InstCombinerImpl::visitExtractElementInst(ExtractElementInst &EI) {
// If the input vector has a single use, simplify it based on this use
// property.
if (SrcVec->hasOneUse()) {
- APInt UndefElts(NumElts, 0);
+ APInt PoisonElts(NumElts, 0);
APInt DemandedElts(NumElts, 0);
DemandedElts.setBit(IndexC->getZExtValue());
if (Value *V =
- SimplifyDemandedVectorElts(SrcVec, DemandedElts, UndefElts))
+ SimplifyDemandedVectorElts(SrcVec, DemandedElts, PoisonElts))
return replaceOperand(EI, 0, V);
} else {
// If the input vector has multiple uses, simplify it based on a union
// of all elements used.
APInt DemandedElts = findDemandedEltsByAllUsers(SrcVec);
if (!DemandedElts.isAllOnes()) {
- APInt UndefElts(NumElts, 0);
+ APInt PoisonElts(NumElts, 0);
if (Value *V = SimplifyDemandedVectorElts(
- SrcVec, DemandedElts, UndefElts, 0 /* Depth */,
+ SrcVec, DemandedElts, PoisonElts, 0 /* Depth */,
true /* AllowMultipleUsers */)) {
if (V != SrcVec) {
Worklist.addValue(SrcVec);
@@ -777,10 +777,10 @@ static ShuffleOps collectShuffleElements(Value *V, SmallVectorImpl<int> &Mask,
assert(V->getType()->isVectorTy() && "Invalid shuffle!");
unsigned NumElts = cast<FixedVectorType>(V->getType())->getNumElements();
- if (match(V, m_Undef())) {
+ if (match(V, m_Poison())) {
Mask.assign(NumElts, -1);
return std::make_pair(
- PermittedRHS ? UndefValue::get(PermittedRHS->getType()) : V, nullptr);
+ PermittedRHS ? PoisonValue::get(PermittedRHS->getType()) : V, nullptr);
}
if (isa<ConstantAggregateZero>(V)) {
@@ -1633,7 +1633,8 @@ Instruction *InstCombinerImpl::visitInsertElementInst(InsertElementInst &IE) {
// bitcast (inselt undef, ScalarSrc, IdxOp)
Type *ScalarTy = ScalarSrc->getType();
Type *VecTy = VectorType::get(ScalarTy, IE.getType()->getElementCount());
- UndefValue *NewUndef = UndefValue::get(VecTy);
+ Constant *NewUndef = isa<PoisonValue>(VecOp) ? PoisonValue::get(VecTy)
+ : UndefValue::get(VecTy);
Value *NewInsElt = Builder.CreateInsertElement(NewUndef, ScalarSrc, IdxOp);
return new BitCastInst(NewInsElt, IE.getType());
}
@@ -1713,9 +1714,10 @@ Instruction *InstCombinerImpl::visitInsertElementInst(InsertElementInst &IE) {
if (auto VecTy = dyn_cast<FixedVectorType>(VecOp->getType())) {
unsigned VWidth = VecTy->getNumElements();
- APInt UndefElts(VWidth, 0);
+ APInt PoisonElts(VWidth, 0);
APInt AllOnesEltMask(APInt::getAllOnes(VWidth));
- if (Value *V = SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts)) {
+ if (Value *V = SimplifyDemandedVectorElts(&IE, AllOnesEltMask,
+ PoisonElts)) {
if (V != &IE)
return replaceInstUsesWith(IE, V);
return &IE;
@@ -1918,6 +1920,10 @@ static Value *evaluateInDifferentElementOrder(Value *V, ArrayRef<int> Mask,
assert(V->getType()->isVectorTy() && "can't reorder non-vector elements");
Type *EltTy = V->getType()->getScalarType();
+
+ if (isa<PoisonValue>(V))
+ return PoisonValue::get(FixedVectorType::get(EltTy, Mask.size()));
+
if (match(V, m_Undef()))
return UndefValue::get(FixedVectorType::get(EltTy, Mask.size()));
@@ -2639,7 +2645,7 @@ static Instruction *foldShuffleWithInsert(ShuffleVectorInst &Shuf,
assert(NewInsIndex != -1 && "Did not fold shuffle with unused operand?");
// Index is updated to the potentially translated insertion lane.
- IndexC = ConstantInt::get(IndexC->getType(), NewInsIndex);
+ IndexC = ConstantInt::get(IndexC->getIntegerType(), NewInsIndex);
return true;
};
@@ -2769,6 +2775,11 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
if (Instruction *I = simplifyBinOpSplats(SVI))
return I;
+ // Canonicalize splat shuffle to use poison RHS. Handle this explicitly in
+ // order to support scalable vectors.
+ if (match(SVI.getShuffleMask(), m_ZeroMask()) && !isa<PoisonValue>(RHS))
+ return replaceOperand(SVI, 1, PoisonValue::get(RHS->getType()));
+
if (isa<ScalableVectorType>(LHS->getType()))
return nullptr;
@@ -2855,9 +2866,9 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
if (Instruction *I = foldCastShuffle(SVI, Builder))
return I;
- APInt UndefElts(VWidth, 0);
+ APInt PoisonElts(VWidth, 0);
APInt AllOnesEltMask(APInt::getAllOnes(VWidth));
- if (Value *V = SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) {
+ if (Value *V = SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, PoisonElts)) {
if (V != &SVI)
return replaceInstUsesWith(SVI, V);
return &SVI;
@@ -3012,10 +3023,11 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
ShuffleVectorInst* LHSShuffle = dyn_cast<ShuffleVectorInst>(LHS);
ShuffleVectorInst* RHSShuffle = dyn_cast<ShuffleVectorInst>(RHS);
if (LHSShuffle)
- if (!match(LHSShuffle->getOperand(1), m_Undef()) && !match(RHS, m_Undef()))
+ if (!match(LHSShuffle->getOperand(1), m_Poison()) &&
+ !match(RHS, m_Poison()))
LHSShuffle = nullptr;
if (RHSShuffle)
- if (!match(RHSShuffle->getOperand(1), m_Undef()))
+ if (!match(RHSShuffle->getOperand(1), m_Poison()))
RHSShuffle = nullptr;
if (!LHSShuffle && !RHSShuffle)
return MadeChange ? &SVI : nullptr;
@@ -3038,7 +3050,7 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
Value* newRHS = RHS;
if (LHSShuffle) {
// case 1
- if (match(RHS, m_Undef())) {
+ if (match(RHS, m_Poison())) {
newLHS = LHSOp0;
newRHS = LHSOp1;
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index a7ddadc25de4..7f5a7b666903 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -173,14 +173,14 @@ std::optional<Value *> InstCombiner::targetSimplifyDemandedUseBitsIntrinsic(
}
std::optional<Value *> InstCombiner::targetSimplifyDemandedVectorEltsIntrinsic(
- IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts, APInt &UndefElts2,
- APInt &UndefElts3,
+ IntrinsicInst &II, APInt DemandedElts, APInt &PoisonElts,
+ APInt &PoisonElts2, APInt &PoisonElts3,
std::function<void(Instruction *, unsigned, APInt, APInt &)>
SimplifyAndSetOp) {
// Handle target specific intrinsics
if (II.getCalledFunction()->isTargetIntrinsic()) {
return TTI.simplifyDemandedVectorEltsIntrinsic(
- *this, II, DemandedElts, UndefElts, UndefElts2, UndefElts3,
+ *this, II, DemandedElts, PoisonElts, PoisonElts2, PoisonElts3,
SimplifyAndSetOp);
}
return std::nullopt;
@@ -1096,6 +1096,54 @@ Value *InstCombinerImpl::foldUsingDistributiveLaws(BinaryOperator &I) {
return SimplifySelectsFeedingBinaryOp(I, LHS, RHS);
}
+std::optional<std::pair<Value *, Value *>>
+InstCombinerImpl::matchSymmetricPhiNodesPair(PHINode *LHS, PHINode *RHS) {
+ if (LHS->getParent() != RHS->getParent())
+ return std::nullopt;
+
+ if (LHS->getNumIncomingValues() < 2)
+ return std::nullopt;
+
+ if (!equal(LHS->blocks(), RHS->blocks()))
+ return std::nullopt;
+
+ Value *L0 = LHS->getIncomingValue(0);
+ Value *R0 = RHS->getIncomingValue(0);
+
+ for (unsigned I = 1, E = LHS->getNumIncomingValues(); I != E; ++I) {
+ Value *L1 = LHS->getIncomingValue(I);
+ Value *R1 = RHS->getIncomingValue(I);
+
+ if ((L0 == L1 && R0 == R1) || (L0 == R1 && R0 == L1))
+ continue;
+
+ return std::nullopt;
+ }
+
+ return std::optional(std::pair(L0, R0));
+}
+
+Value *InstCombinerImpl::SimplifyPhiCommutativeBinaryOp(BinaryOperator &I,
+ Value *Op0,
+ Value *Op1) {
+ assert(I.isCommutative() && "Instruction should be commutative");
+
+ PHINode *LHS = dyn_cast<PHINode>(Op0);
+ PHINode *RHS = dyn_cast<PHINode>(Op1);
+
+ if (!LHS || !RHS)
+ return nullptr;
+
+ if (auto P = matchSymmetricPhiNodesPair(LHS, RHS)) {
+ Value *BI = Builder.CreateBinOp(I.getOpcode(), P->first, P->second);
+ if (auto *BO = dyn_cast<BinaryOperator>(BI))
+ BO->copyIRFlags(&I);
+ return BI;
+ }
+
+ return nullptr;
+}
+
Value *InstCombinerImpl::SimplifySelectsFeedingBinaryOp(BinaryOperator &I,
Value *LHS,
Value *RHS) {
@@ -1529,6 +1577,11 @@ Instruction *InstCombinerImpl::foldBinopWithPhiOperands(BinaryOperator &BO) {
BO.getParent() != Phi1->getParent())
return nullptr;
+ if (BO.isCommutative()) {
+ if (Value *V = SimplifyPhiCommutativeBinaryOp(BO, Phi0, Phi1))
+ return replaceInstUsesWith(BO, V);
+ }
+
// Fold if there is at least one specific constant value in phi0 or phi1's
// incoming values that comes from the same block and this specific constant
// value can be used to do optimization for specific binary operator.
@@ -1728,8 +1781,8 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
// If both arguments of the binary operation are shuffles that use the same
// mask and shuffle within a single vector, move the shuffle after the binop.
- if (match(LHS, m_Shuffle(m_Value(V1), m_Undef(), m_Mask(Mask))) &&
- match(RHS, m_Shuffle(m_Value(V2), m_Undef(), m_SpecificMask(Mask))) &&
+ if (match(LHS, m_Shuffle(m_Value(V1), m_Poison(), m_Mask(Mask))) &&
+ match(RHS, m_Shuffle(m_Value(V2), m_Poison(), m_SpecificMask(Mask))) &&
V1->getType() == V2->getType() &&
(LHS->hasOneUse() || RHS->hasOneUse() || LHS == RHS)) {
// Op(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(Op(V1, V2), Mask)
@@ -1770,9 +1823,9 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
Constant *C;
auto *InstVTy = dyn_cast<FixedVectorType>(Inst.getType());
if (InstVTy &&
- match(&Inst,
- m_c_BinOp(m_OneUse(m_Shuffle(m_Value(V1), m_Undef(), m_Mask(Mask))),
- m_ImmConstant(C))) &&
+ match(&Inst, m_c_BinOp(m_OneUse(m_Shuffle(m_Value(V1), m_Poison(),
+ m_Mask(Mask))),
+ m_ImmConstant(C))) &&
cast<FixedVectorType>(V1->getType())->getNumElements() <=
InstVTy->getNumElements()) {
assert(InstVTy->getScalarType() == V1->getType()->getScalarType() &&
@@ -1787,8 +1840,8 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
ArrayRef<int> ShMask = Mask;
unsigned SrcVecNumElts =
cast<FixedVectorType>(V1->getType())->getNumElements();
- UndefValue *UndefScalar = UndefValue::get(C->getType()->getScalarType());
- SmallVector<Constant *, 16> NewVecC(SrcVecNumElts, UndefScalar);
+ PoisonValue *PoisonScalar = PoisonValue::get(C->getType()->getScalarType());
+ SmallVector<Constant *, 16> NewVecC(SrcVecNumElts, PoisonScalar);
bool MayChange = true;
unsigned NumElts = InstVTy->getNumElements();
for (unsigned I = 0; I < NumElts; ++I) {
@@ -1801,29 +1854,29 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
// 2. The shuffle needs an element of the constant vector that can't
// be mapped to a new constant vector.
// 3. This is a widening shuffle that copies elements of V1 into the
- // extended elements (extending with undef is allowed).
- if (!CElt || (!isa<UndefValue>(NewCElt) && NewCElt != CElt) ||
+ // extended elements (extending with poison is allowed).
+ if (!CElt || (!isa<PoisonValue>(NewCElt) && NewCElt != CElt) ||
I >= SrcVecNumElts) {
MayChange = false;
break;
}
NewVecC[ShMask[I]] = CElt;
}
- // If this is a widening shuffle, we must be able to extend with undef
- // elements. If the original binop does not produce an undef in the high
+ // If this is a widening shuffle, we must be able to extend with poison
+ // elements. If the original binop does not produce a poison in the high
// lanes, then this transform is not safe.
- // Similarly for undef lanes due to the shuffle mask, we can only
- // transform binops that preserve undef.
- // TODO: We could shuffle those non-undef constant values into the
- // result by using a constant vector (rather than an undef vector)
+ // Similarly for poison lanes due to the shuffle mask, we can only
+ // transform binops that preserve poison.
+ // TODO: We could shuffle those non-poison constant values into the
+ // result by using a constant vector (rather than an poison vector)
// as operand 1 of the new binop, but that might be too aggressive
// for target-independent shuffle creation.
if (I >= SrcVecNumElts || ShMask[I] < 0) {
- Constant *MaybeUndef =
+ Constant *MaybePoison =
ConstOp1
- ? ConstantFoldBinaryOpOperands(Opcode, UndefScalar, CElt, DL)
- : ConstantFoldBinaryOpOperands(Opcode, CElt, UndefScalar, DL);
- if (!MaybeUndef || !match(MaybeUndef, m_Undef())) {
+ ? ConstantFoldBinaryOpOperands(Opcode, PoisonScalar, CElt, DL)
+ : ConstantFoldBinaryOpOperands(Opcode, CElt, PoisonScalar, DL);
+ if (!MaybePoison || !isa<PoisonValue>(MaybePoison)) {
MayChange = false;
break;
}
@@ -1831,9 +1884,10 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
}
if (MayChange) {
Constant *NewC = ConstantVector::get(NewVecC);
- // It may not be safe to execute a binop on a vector with undef elements
+ // It may not be safe to execute a binop on a vector with poison elements
// because the entire instruction can be folded to undef or create poison
// that did not exist in the original code.
+ // TODO: The shift case should not be necessary.
if (Inst.isIntDivRem() || (Inst.isShift() && ConstOp1))
NewC = getSafeVectorConstantForBinop(Opcode, NewC, ConstOp1);
@@ -2241,10 +2295,10 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
// compile-time.
if (auto *GEPFVTy = dyn_cast<FixedVectorType>(GEPType)) {
auto VWidth = GEPFVTy->getNumElements();
- APInt UndefElts(VWidth, 0);
+ APInt PoisonElts(VWidth, 0);
APInt AllOnesEltMask(APInt::getAllOnes(VWidth));
if (Value *V = SimplifyDemandedVectorElts(&GEP, AllOnesEltMask,
- UndefElts)) {
+ PoisonElts)) {
if (V != &GEP)
return replaceInstUsesWith(GEP, V);
return &GEP;
@@ -2462,7 +2516,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
Idx2);
}
ConstantInt *C;
- if (match(GEP.getOperand(1), m_OneUse(m_SExt(m_OneUse(m_NSWAdd(
+ if (match(GEP.getOperand(1), m_OneUse(m_SExtLike(m_OneUse(m_NSWAdd(
m_Value(Idx1), m_ConstantInt(C))))))) {
// %add = add nsw i32 %idx1, idx2
// %sidx = sext i32 %add to i64
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 6468d07b4f4f..afb0e6cd1548 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -2737,7 +2737,7 @@ bool AddressSanitizer::maybeInsertAsanInitAtFunctionEntry(Function &F) {
// the shadow memory.
// We cannot just ignore these methods, because they may call other
// instrumented functions.
- if (F.getName().find(" load]") != std::string::npos) {
+ if (F.getName().contains(" load]")) {
FunctionCallee AsanInitFunction =
declareSanitizerInitFunction(*F.getParent(), kAsanInitName, {});
IRBuilder<> IRB(&F.front(), F.front().begin());
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 539b7441d24b..2236e9cd44c5 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -535,7 +535,7 @@ bool MemProfiler::maybeInsertMemProfInitAtFunctionEntry(Function &F) {
// the shadow memory.
// We cannot just ignore these methods, because they may call other
// instrumented functions.
- if (F.getName().find(" load]") != std::string::npos) {
+ if (F.getName().contains(" load]")) {
FunctionCallee MemProfInitFunction =
declareSanitizerInitFunction(*F.getParent(), MemProfInitName, {});
IRBuilder<> IRB(&F.front(), F.front().begin());
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index fe672a4377a1..ce570bdfd8b8 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -603,7 +603,7 @@ void ModuleSanitizerCoverage::instrumentFunction(
Function &F, DomTreeCallback DTCallback, PostDomTreeCallback PDTCallback) {
if (F.empty())
return;
- if (F.getName().find(".module_ctor") != std::string::npos)
+ if (F.getName().contains(".module_ctor"))
return; // Should not instrument sanitizer init functions.
if (F.getName().starts_with("__sanitizer_"))
return; // Don't instrument __sanitizer_* callbacks.
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index 1fb9d7fff32f..9e40d94dd73c 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -674,8 +674,7 @@ void ConstantHoistingPass::findBaseConstants(GlobalVariable *BaseGV) {
llvm::stable_sort(ConstCandVec, [](const ConstantCandidate &LHS,
const ConstantCandidate &RHS) {
if (LHS.ConstInt->getType() != RHS.ConstInt->getType())
- return LHS.ConstInt->getType()->getBitWidth() <
- RHS.ConstInt->getType()->getBitWidth();
+ return LHS.ConstInt->getBitWidth() < RHS.ConstInt->getBitWidth();
return LHS.ConstInt->getValue().ult(RHS.ConstInt->getValue());
});
@@ -890,7 +889,7 @@ bool ConstantHoistingPass::emitBaseConstants(GlobalVariable *BaseGV) {
Type *Ty = ConstInfo.BaseExpr->getType();
Base = new BitCastInst(ConstInfo.BaseExpr, Ty, "const", IP);
} else {
- IntegerType *Ty = ConstInfo.BaseInt->getType();
+ IntegerType *Ty = ConstInfo.BaseInt->getIntegerType();
Base = new BitCastInst(ConstInfo.BaseInt, Ty, "const", IP);
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index 18266ba07898..899d7e0a11e6 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -273,7 +273,16 @@ class ConstraintInfo {
public:
ConstraintInfo(const DataLayout &DL, ArrayRef<Value *> FunctionArgs)
- : UnsignedCS(FunctionArgs), SignedCS(FunctionArgs), DL(DL) {}
+ : UnsignedCS(FunctionArgs), SignedCS(FunctionArgs), DL(DL) {
+ auto &Value2Index = getValue2Index(false);
+ // Add Arg > -1 constraints to unsigned system for all function arguments.
+ for (Value *Arg : FunctionArgs) {
+ ConstraintTy VarPos(SmallVector<int64_t, 8>(Value2Index.size() + 1, 0),
+ false, false, false);
+ VarPos.Coefficients[Value2Index[Arg]] = -1;
+ UnsignedCS.addVariableRow(VarPos.Coefficients);
+ }
+ }
DenseMap<Value *, unsigned> &getValue2Index(bool Signed) {
return Signed ? SignedCS.getValue2Index() : UnsignedCS.getValue2Index();
@@ -1365,18 +1374,34 @@ removeEntryFromStack(const StackEntry &E, ConstraintInfo &Info,
ReproducerCondStack.pop_back();
}
-/// Check if the first condition for an AND implies the second.
-static bool checkAndSecondOpImpliedByFirst(
+/// Check if either the first condition of an AND or OR is implied by the
+/// (negated in case of OR) second condition or vice versa.
+static bool checkOrAndOpImpliedByOther(
FactOrCheck &CB, ConstraintInfo &Info, Module *ReproducerModule,
SmallVectorImpl<ReproducerEntry> &ReproducerCondStack,
SmallVectorImpl<StackEntry> &DFSInStack) {
CmpInst::Predicate Pred;
Value *A, *B;
- Instruction *And = CB.getContextInst();
- if (!match(And->getOperand(0), m_ICmp(Pred, m_Value(A), m_Value(B))))
+ Instruction *JoinOp = CB.getContextInst();
+ CmpInst *CmpToCheck = cast<CmpInst>(CB.getInstructionToSimplify());
+ unsigned OtherOpIdx = JoinOp->getOperand(0) == CmpToCheck ? 1 : 0;
+
+ // Don't try to simplify the first condition of a select by the second, as
+ // this may make the select more poisonous than the original one.
+ // TODO: check if the first operand may be poison.
+ if (OtherOpIdx != 0 && isa<SelectInst>(JoinOp))
return false;
+ if (!match(JoinOp->getOperand(OtherOpIdx),
+ m_ICmp(Pred, m_Value(A), m_Value(B))))
+ return false;
+
+ // For OR, check if the negated condition implies CmpToCheck.
+ bool IsOr = match(JoinOp, m_LogicalOr());
+ if (IsOr)
+ Pred = CmpInst::getInversePredicate(Pred);
+
// Optimistically add fact from first condition.
unsigned OldSize = DFSInStack.size();
Info.addFact(Pred, A, B, CB.NumIn, CB.NumOut, DFSInStack);
@@ -1385,11 +1410,19 @@ static bool checkAndSecondOpImpliedByFirst(
bool Changed = false;
// Check if the second condition can be simplified now.
- ICmpInst *Cmp = cast<ICmpInst>(And->getOperand(1));
- if (auto ImpliedCondition = checkCondition(
- Cmp->getPredicate(), Cmp->getOperand(0), Cmp->getOperand(1), Cmp,
- Info, CB.NumIn, CB.NumOut, CB.getContextInst())) {
- And->setOperand(1, ConstantInt::getBool(And->getType(), *ImpliedCondition));
+ if (auto ImpliedCondition =
+ checkCondition(CmpToCheck->getPredicate(), CmpToCheck->getOperand(0),
+ CmpToCheck->getOperand(1), CmpToCheck, Info, CB.NumIn,
+ CB.NumOut, CB.getContextInst())) {
+ if (IsOr && isa<SelectInst>(JoinOp)) {
+ JoinOp->setOperand(
+ OtherOpIdx == 0 ? 2 : 0,
+ ConstantInt::getBool(JoinOp->getType(), *ImpliedCondition));
+ } else
+ JoinOp->setOperand(
+ 1 - OtherOpIdx,
+ ConstantInt::getBool(JoinOp->getType(), *ImpliedCondition));
+
Changed = true;
}
@@ -1442,6 +1475,17 @@ void ConstraintInfo::addFact(CmpInst::Predicate Pred, Value *A, Value *B,
DFSInStack.emplace_back(NumIn, NumOut, R.IsSigned,
std::move(ValuesToRelease));
+ if (!R.IsSigned) {
+ for (Value *V : NewVariables) {
+ ConstraintTy VarPos(SmallVector<int64_t, 8>(Value2Index.size() + 1, 0),
+ false, false, false);
+ VarPos.Coefficients[Value2Index[V]] = -1;
+ CSToUse.addVariableRow(VarPos.Coefficients);
+ DFSInStack.emplace_back(NumIn, NumOut, R.IsSigned,
+ SmallVector<Value *, 2>());
+ }
+ }
+
if (R.isEq()) {
// Also add the inverted constraint for equality constraints.
for (auto &Coeff : R.Coefficients)
@@ -1609,11 +1653,11 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT, LoopInfo &LI,
bool Simplified = checkAndReplaceCondition(
Cmp, Info, CB.NumIn, CB.NumOut, CB.getContextInst(),
ReproducerModule.get(), ReproducerCondStack, S.DT, ToRemove);
- if (!Simplified && match(CB.getContextInst(),
- m_LogicalAnd(m_Value(), m_Specific(Inst)))) {
+ if (!Simplified &&
+ match(CB.getContextInst(), m_LogicalOp(m_Value(), m_Value()))) {
Simplified =
- checkAndSecondOpImpliedByFirst(CB, Info, ReproducerModule.get(),
- ReproducerCondStack, DFSInStack);
+ checkOrAndOpImpliedByOther(CB, Info, ReproducerModule.get(),
+ ReproducerCondStack, DFSInStack);
}
Changed |= Simplified;
}
@@ -1687,7 +1731,8 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT, LoopInfo &LI,
#ifndef NDEBUG
unsigned SignedEntries =
count_if(DFSInStack, [](const StackEntry &E) { return E.IsSigned; });
- assert(Info.getCS(false).size() == DFSInStack.size() - SignedEntries &&
+ assert(Info.getCS(false).size() - FunctionArgs.size() ==
+ DFSInStack.size() - SignedEntries &&
"updates to CS and DFSInStack are out of sync");
assert(Info.getCS(true).size() == SignedEntries &&
"updates to CS and DFSInStack are out of sync");
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index d2dfc764d042..c44d3748a80d 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -935,11 +935,13 @@ static bool processSDiv(BinaryOperator *SDI, const ConstantRange &LCR,
UDiv->setDebugLoc(SDI->getDebugLoc());
UDiv->setIsExact(SDI->isExact());
- Value *Res = UDiv;
+ auto *Res = UDiv;
// If the operands had two different domains, we need to negate the result.
- if (Ops[0].D != Ops[1].D)
+ if (Ops[0].D != Ops[1].D) {
Res = BinaryOperator::CreateNeg(Res, Res->getName() + ".neg", SDI);
+ Res->setDebugLoc(SDI->getDebugLoc());
+ }
SDI->replaceAllUsesWith(Res);
SDI->eraseFromParent();
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index edfeb36f3422..c5bf913cda30 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -521,7 +521,7 @@ struct AllSwitchPaths {
const BasicBlock *PrevBB = Path.back();
for (const BasicBlock *BB : Path) {
- if (StateDef.count(BB) != 0) {
+ if (StateDef.contains(BB)) {
const PHINode *Phi = dyn_cast<PHINode>(StateDef[BB]);
assert(Phi && "Expected a state-defining instr to be a phi node.");
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/GVN.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/GVN.cpp
index 5e58af0edc15..e36578f3de7a 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -592,7 +592,7 @@ uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
/// Returns true if a value number exists for the specified value.
bool GVNPass::ValueTable::exists(Value *V) const {
- return valueNumbering.count(V) != 0;
+ return valueNumbering.contains(V);
}
/// lookup_or_add - Returns the value number for the specified value, assigning
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopFlatten.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
index b1add3c42976..eef94636578d 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
@@ -343,9 +343,8 @@ static bool verifyTripCount(Value *RHS, Loop *L,
// If the RHS of the compare is equal to the backedge taken count we need
// to add one to get the trip count.
if (SCEVRHS == BackedgeTCExt || SCEVRHS == BackedgeTakenCount) {
- ConstantInt *One = ConstantInt::get(ConstantRHS->getType(), 1);
- Value *NewRHS = ConstantInt::get(
- ConstantRHS->getContext(), ConstantRHS->getValue() + One->getValue());
+ Value *NewRHS = ConstantInt::get(ConstantRHS->getContext(),
+ ConstantRHS->getValue() + 1);
return setLoopComponents(NewRHS, TripCount, Increment,
IterationInstructions);
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 39607464dd00..a58bbe318563 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -7006,7 +7006,7 @@ static bool ReduceLoopStrength(Loop *L, IVUsers &IU, ScalarEvolution &SE,
LLVM_DEBUG(dbgs() << "Old term-cond:\n"
<< *OldTermCond << "\n"
- << "New term-cond:\b" << *NewTermCond << "\n");
+ << "New term-cond:\n" << *NewTermCond << "\n");
BI->setCondition(NewTermCond);
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index f14541a1a037..7cfeb019af97 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -200,6 +200,7 @@ TargetTransformInfo::UnrollingPreferences llvm::gatherUnrollingPreferences(
UP.Count = 0;
UP.DefaultUnrollRuntimeCount = 8;
UP.MaxCount = std::numeric_limits<unsigned>::max();
+ UP.MaxUpperBound = UnrollMaxUpperBound;
UP.FullUnrollMaxCount = std::numeric_limits<unsigned>::max();
UP.BEInsns = 2;
UP.Partial = false;
@@ -237,6 +238,8 @@ TargetTransformInfo::UnrollingPreferences llvm::gatherUnrollingPreferences(
UP.MaxPercentThresholdBoost = UnrollMaxPercentThresholdBoost;
if (UnrollMaxCount.getNumOccurrences() > 0)
UP.MaxCount = UnrollMaxCount;
+ if (UnrollMaxUpperBound.getNumOccurrences() > 0)
+ UP.MaxUpperBound = UnrollMaxUpperBound;
if (UnrollFullMaxCount.getNumOccurrences() > 0)
UP.FullUnrollMaxCount = UnrollFullMaxCount;
if (UnrollAllowPartial.getNumOccurrences() > 0)
@@ -777,7 +780,7 @@ shouldPragmaUnroll(Loop *L, const PragmaInfo &PInfo,
return TripCount;
if (PInfo.PragmaEnableUnroll && !TripCount && MaxTripCount &&
- MaxTripCount <= UnrollMaxUpperBound)
+ MaxTripCount <= UP.MaxUpperBound)
return MaxTripCount;
// if didn't return until here, should continue to other priorties
@@ -952,7 +955,7 @@ bool llvm::computeUnrollCount(
// cost of exact full unrolling. As such, if we have an exact count and
// found it unprofitable, we'll never chose to bounded unroll.
if (!TripCount && MaxTripCount && (UP.UpperBound || MaxOrZero) &&
- MaxTripCount <= UnrollMaxUpperBound) {
+ MaxTripCount <= UP.MaxUpperBound) {
UP.Count = MaxTripCount;
if (auto UnrollFactor = shouldFullUnroll(L, TTI, DT, SE, EphValues,
MaxTripCount, UCE, UP)) {
@@ -1026,7 +1029,7 @@ bool llvm::computeUnrollCount(
}
// Don't unroll a small upper bound loop unless user or TTI asked to do so.
- if (MaxTripCount && !UP.Force && MaxTripCount < UnrollMaxUpperBound) {
+ if (MaxTripCount && !UP.Force && MaxTripCount < UP.MaxUpperBound) {
UP.Count = 0;
return false;
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index 40b4ea92e1ff..3f02441b74ba 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -2057,7 +2057,7 @@ static void relocationViaAlloca(
for (const auto &Info : Records)
for (auto RematerializedValuePair : Info.RematerializedValues) {
Value *OriginalValue = RematerializedValuePair.second;
- if (AllocaMap.count(OriginalValue) != 0)
+ if (AllocaMap.contains(OriginalValue))
continue;
emitAllocaFor(OriginalValue);
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp
index 24da26c9f0f2..656abdb0abbf 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -3285,6 +3285,7 @@ private:
(BeginOffset > NewAllocaBeginOffset || EndOffset < NewAllocaEndOffset ||
SliceSize !=
DL.getTypeStoreSize(NewAI.getAllocatedType()).getFixedValue() ||
+ !DL.typeSizeEqualsStoreSize(NewAI.getAllocatedType()) ||
!NewAI.getAllocatedType()->isSingleValueType());
// If we're just going to emit a memcpy, the alloca hasn't changed, and the
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/DXILUpgrade.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/DXILUpgrade.cpp
index 735686ddce38..09991f628224 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/DXILUpgrade.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/DXILUpgrade.cpp
@@ -7,14 +7,26 @@
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Utils/DXILUpgrade.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Support/Debug.h"
using namespace llvm;
+#define DEBUG_TYPE "dxil-upgrade"
+
static bool handleValVerMetadata(Module &M) {
NamedMDNode *ValVer = M.getNamedMetadata("dx.valver");
if (!ValVer)
return false;
+ LLVM_DEBUG({
+ MDNode *N = ValVer->getOperand(0);
+ auto X = mdconst::extract<ConstantInt>(N->getOperand(0))->getZExtValue();
+ auto Y = mdconst::extract<ConstantInt>(N->getOperand(1))->getZExtValue();
+ dbgs() << "DXIL: validation version: " << X << "." << Y << "\n";
+ });
// We don't need the validation version internally, so we drop it.
ValVer->dropAllReferences();
ValVer->eraseFromParent();
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/FunctionComparator.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/FunctionComparator.cpp
index 79ca99d1566c..09e19be0d293 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -405,6 +405,8 @@ int FunctionComparator::cmpConstants(const Constant *L,
case Value::ConstantExprVal: {
const ConstantExpr *LE = cast<ConstantExpr>(L);
const ConstantExpr *RE = cast<ConstantExpr>(R);
+ if (int Res = cmpNumbers(LE->getOpcode(), RE->getOpcode()))
+ return Res;
unsigned NumOperandsL = LE->getNumOperands();
unsigned NumOperandsR = RE->getNumOperands();
if (int Res = cmpNumbers(NumOperandsL, NumOperandsR))
@@ -414,6 +416,29 @@ int FunctionComparator::cmpConstants(const Constant *L,
cast<Constant>(RE->getOperand(i))))
return Res;
}
+ if (LE->isCompare())
+ if (int Res = cmpNumbers(LE->getPredicate(), RE->getPredicate()))
+ return Res;
+ if (auto *GEPL = dyn_cast<GEPOperator>(LE)) {
+ auto *GEPR = cast<GEPOperator>(RE);
+ if (int Res = cmpTypes(GEPL->getSourceElementType(),
+ GEPR->getSourceElementType()))
+ return Res;
+ if (int Res = cmpNumbers(GEPL->isInBounds(), GEPR->isInBounds()))
+ return Res;
+ if (int Res = cmpNumbers(GEPL->getInRangeIndex().value_or(unsigned(-1)),
+ GEPR->getInRangeIndex().value_or(unsigned(-1))))
+ return Res;
+ }
+ if (auto *OBOL = dyn_cast<OverflowingBinaryOperator>(LE)) {
+ auto *OBOR = cast<OverflowingBinaryOperator>(RE);
+ if (int Res =
+ cmpNumbers(OBOL->hasNoUnsignedWrap(), OBOR->hasNoUnsignedWrap()))
+ return Res;
+ if (int Res =
+ cmpNumbers(OBOL->hasNoSignedWrap(), OBOR->hasNoSignedWrap()))
+ return Res;
+ }
return 0;
}
case Value::BlockAddressVal: {
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
index 1e42d7491676..f94047633022 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
@@ -64,7 +64,7 @@ bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
// sure that the return is covered. Otherwise, we can check whether there
// is a way to reach the RI from the start of the lifetime without passing
// through an end.
- if (EndBlocks.count(RI->getParent()) > 0 ||
+ if (EndBlocks.contains(RI->getParent()) ||
!isPotentiallyReachable(Start, RI, &EndBlocks, &DT, &LI)) {
++NumCoveredExits;
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 89494a7f6497..55e375670cc6 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -6293,7 +6293,7 @@ Value *SwitchLookupTable::BuildLookup(Value *Index, IRBuilder<> &Builder) {
}
case BitMapKind: {
// Type of the bitmap (e.g. i59).
- IntegerType *MapTy = BitMap->getType();
+ IntegerType *MapTy = BitMap->getIntegerType();
// Cast Index to the same type as the bitmap.
// Note: The Index is <= the number of elements in the table, so
@@ -6668,7 +6668,7 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
Value *TableIndex;
ConstantInt *TableIndexOffset;
if (UseSwitchConditionAsTableIndex) {
- TableIndexOffset = ConstantInt::get(MaxCaseVal->getType(), 0);
+ TableIndexOffset = ConstantInt::get(MaxCaseVal->getIntegerType(), 0);
TableIndex = SI->getCondition();
} else {
TableIndexOffset = MinCaseVal;
@@ -6752,7 +6752,7 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
// Get the TableIndex'th bit of the bitmask.
// If this bit is 0 (meaning hole) jump to the default destination,
// else continue with table lookup.
- IntegerType *MapTy = TableMask->getType();
+ IntegerType *MapTy = TableMask->getIntegerType();
Value *MaskIndex =
Builder.CreateZExtOrTrunc(TableIndex, MapTy, "switch.maskindex");
Value *Shifted = Builder.CreateLShr(TableMask, MaskIndex, "switch.shifted");
@@ -6975,7 +6975,7 @@ static bool simplifySwitchOfPowersOfTwo(SwitchInst *SI, IRBuilder<> &Builder,
// Replace each case with its trailing zeros number.
for (auto &Case : SI->cases()) {
auto *OrigValue = Case.getCaseValue();
- Case.setValue(ConstantInt::get(OrigValue->getType(),
+ Case.setValue(ConstantInt::get(OrigValue->getIntegerType(),
OrigValue->getValue().countr_zero()));
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 722ed03db3de..42e7c4006b42 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -27,6 +27,7 @@
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
using namespace llvm;
+using namespace llvm::PatternMatch;
#define DEBUG_TYPE "indvars"
@@ -786,8 +787,6 @@ bool SimplifyIndvar::strengthenOverflowingOperation(BinaryOperator *BO,
/// otherwise.
bool SimplifyIndvar::strengthenRightShift(BinaryOperator *BO,
Instruction *IVOperand) {
- using namespace llvm::PatternMatch;
-
if (BO->getOpcode() == Instruction::Shl) {
bool Changed = false;
ConstantRange IVRange = SE->getUnsignedRange(SE->getSCEV(IVOperand));
@@ -1763,7 +1762,7 @@ Instruction *WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU, SCEVExpander &Rewri
};
// Our raison d'etre! Eliminate sign and zero extension.
- if ((isa<SExtInst>(DU.NarrowUse) && canWidenBySExt()) ||
+ if ((match(DU.NarrowUse, m_SExtLike(m_Value())) && canWidenBySExt()) ||
(isa<ZExtInst>(DU.NarrowUse) && canWidenByZExt())) {
Value *NewDef = DU.WideDef;
if (DU.NarrowUse->getType() != WideType) {
@@ -2011,8 +2010,6 @@ PHINode *WidenIV::createWideIV(SCEVExpander &Rewriter) {
/// by looking at dominating conditions inside of the loop
void WidenIV::calculatePostIncRange(Instruction *NarrowDef,
Instruction *NarrowUser) {
- using namespace llvm::PatternMatch;
-
Value *NarrowDefLHS;
const APInt *NarrowDefRHS;
if (!match(NarrowDef, m_NSWAdd(m_Value(NarrowDefLHS),
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 9d799124074c..32913b3f5569 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3760,40 +3760,7 @@ BoUpSLP::findReusedOrderedScalars(const BoUpSLP::TreeEntry &TE) {
OrdersType CurrentOrder(NumScalars, NumScalars);
SmallVector<int> Positions;
SmallBitVector UsedPositions(NumScalars);
- DenseMap<const TreeEntry *, unsigned> UsedEntries;
- DenseMap<Value *, std::pair<const TreeEntry *, unsigned>> ValueToEntryPos;
- for (Value *V : TE.Scalars) {
- if (!isa<LoadInst, ExtractElementInst, ExtractValueInst>(V))
- continue;
- const auto *LocalSTE = getTreeEntry(V);
- if (!LocalSTE)
- continue;
- unsigned Lane =
- std::distance(LocalSTE->Scalars.begin(), find(LocalSTE->Scalars, V));
- if (Lane >= NumScalars)
- continue;
- ++UsedEntries.try_emplace(LocalSTE, 0).first->getSecond();
- ValueToEntryPos.try_emplace(V, LocalSTE, Lane);
- }
- if (UsedEntries.empty())
- return std::nullopt;
- const TreeEntry &BestSTE =
- *std::max_element(UsedEntries.begin(), UsedEntries.end(),
- [](const std::pair<const TreeEntry *, unsigned> &P1,
- const std::pair<const TreeEntry *, unsigned> &P2) {
- return P1.second < P2.second;
- })
- ->first;
- UsedEntries.erase(&BestSTE);
- const TreeEntry *SecondBestSTE = nullptr;
- if (!UsedEntries.empty())
- SecondBestSTE =
- std::max_element(UsedEntries.begin(), UsedEntries.end(),
- [](const std::pair<const TreeEntry *, unsigned> &P1,
- const std::pair<const TreeEntry *, unsigned> &P2) {
- return P1.second < P2.second;
- })
- ->first;
+ const TreeEntry *STE = nullptr;
// Try to find all gathered scalars that are gets vectorized in other
// vectorize node. Here we can have only one single tree vector node to
// correctly identify order of the gathered scalars.
@@ -3801,46 +3768,53 @@ BoUpSLP::findReusedOrderedScalars(const BoUpSLP::TreeEntry &TE) {
Value *V = TE.Scalars[I];
if (!isa<LoadInst, ExtractElementInst, ExtractValueInst>(V))
continue;
- const auto [LocalSTE, Lane] = ValueToEntryPos.lookup(V);
- if (!LocalSTE || (LocalSTE != &BestSTE && LocalSTE != SecondBestSTE))
- continue;
- if (CurrentOrder[Lane] != NumScalars) {
- if ((CurrentOrder[Lane] >= BestSTE.Scalars.size() ||
- BestSTE.Scalars[CurrentOrder[Lane]] == V) &&
- (Lane != I || LocalSTE == SecondBestSTE))
- continue;
- UsedPositions.reset(CurrentOrder[Lane]);
+ if (const auto *LocalSTE = getTreeEntry(V)) {
+ if (!STE)
+ STE = LocalSTE;
+ else if (STE != LocalSTE)
+ // Take the order only from the single vector node.
+ return std::nullopt;
+ unsigned Lane =
+ std::distance(STE->Scalars.begin(), find(STE->Scalars, V));
+ if (Lane >= NumScalars)
+ return std::nullopt;
+ if (CurrentOrder[Lane] != NumScalars) {
+ if (Lane != I)
+ continue;
+ UsedPositions.reset(CurrentOrder[Lane]);
+ }
+ // The partial identity (where only some elements of the gather node are
+ // in the identity order) is good.
+ CurrentOrder[Lane] = I;
+ UsedPositions.set(I);
}
- // The partial identity (where only some elements of the gather node are
- // in the identity order) is good.
- CurrentOrder[Lane] = I;
- UsedPositions.set(I);
}
// Need to keep the order if we have a vector entry and at least 2 scalars or
// the vectorized entry has just 2 scalars.
- if (BestSTE.Scalars.size() != 2 && UsedPositions.count() <= 1)
- return std::nullopt;
- auto IsIdentityOrder = [&](ArrayRef<unsigned> CurrentOrder) {
- for (unsigned I = 0; I < NumScalars; ++I)
- if (CurrentOrder[I] != I && CurrentOrder[I] != NumScalars)
- return false;
- return true;
- };
- if (IsIdentityOrder(CurrentOrder))
- return OrdersType();
- auto *It = CurrentOrder.begin();
- for (unsigned I = 0; I < NumScalars;) {
- if (UsedPositions.test(I)) {
- ++I;
- continue;
- }
- if (*It == NumScalars) {
- *It = I;
- ++I;
+ if (STE && (UsedPositions.count() > 1 || STE->Scalars.size() == 2)) {
+ auto &&IsIdentityOrder = [NumScalars](ArrayRef<unsigned> CurrentOrder) {
+ for (unsigned I = 0; I < NumScalars; ++I)
+ if (CurrentOrder[I] != I && CurrentOrder[I] != NumScalars)
+ return false;
+ return true;
+ };
+ if (IsIdentityOrder(CurrentOrder))
+ return OrdersType();
+ auto *It = CurrentOrder.begin();
+ for (unsigned I = 0; I < NumScalars;) {
+ if (UsedPositions.test(I)) {
+ ++I;
+ continue;
+ }
+ if (*It == NumScalars) {
+ *It = I;
+ ++I;
+ }
+ ++It;
}
- ++It;
+ return std::move(CurrentOrder);
}
- return std::move(CurrentOrder);
+ return std::nullopt;
}
namespace {
@@ -6469,7 +6443,7 @@ bool BoUpSLP::areAllUsersVectorized(
Instruction *I, const SmallDenseSet<Value *> *VectorizedVals) const {
return (I->hasOneUse() && (!VectorizedVals || VectorizedVals->contains(I))) ||
all_of(I->users(), [this](User *U) {
- return ScalarToTreeEntry.count(U) > 0 ||
+ return ScalarToTreeEntry.contains(U) ||
isVectorLikeInstWithConstOps(U) ||
(isa<ExtractElementInst>(U) && MustGather.contains(U));
});
@@ -11498,7 +11472,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
Value *V = Builder.CreateBinOp(
static_cast<Instruction::BinaryOps>(E->getOpcode()), LHS,
RHS);
- propagateIRFlags(V, E->Scalars, VL0);
+ propagateIRFlags(V, E->Scalars, VL0, !MinBWs.contains(E));
if (auto *I = dyn_cast<Instruction>(V))
V = propagateMetadata(I, E->Scalars);
@@ -15730,6 +15704,8 @@ static bool compareCmp(Value *V, Value *V2, TargetLibraryInfo &TLI,
assert(isValidElementType(V->getType()) &&
isValidElementType(V2->getType()) &&
"Expected valid element types only.");
+ if (V == V2)
+ return IsCompatibility;
auto *CI1 = cast<CmpInst>(V);
auto *CI2 = cast<CmpInst>(V2);
if (CI1->getOperand(0)->getType()->getTypeID() <
@@ -15754,6 +15730,8 @@ static bool compareCmp(Value *V, Value *V2, TargetLibraryInfo &TLI,
for (int I = 0, E = CI1->getNumOperands(); I < E; ++I) {
auto *Op1 = CI1->getOperand(CI1Preds ? I : E - I - 1);
auto *Op2 = CI2->getOperand(CI2Preds ? I : E - I - 1);
+ if (Op1 == Op2)
+ continue;
if (Op1->getValueID() < Op2->getValueID())
return !IsCompatibility;
if (Op1->getValueID() > Op2->getValueID())
@@ -15780,7 +15758,10 @@ static bool compareCmp(Value *V, Value *V2, TargetLibraryInfo &TLI,
InstructionsState S = getSameOpcode({I1, I2}, TLI);
if (S.getOpcode() && (IsCompatibility || !S.isAltShuffle()))
continue;
- return !IsCompatibility && I1->getOpcode() < I2->getOpcode();
+ if (IsCompatibility)
+ return false;
+ if (I1->getOpcode() != I2->getOpcode())
+ return I1->getOpcode() < I2->getOpcode();
}
}
return IsCompatibility;
diff --git a/contrib/llvm-project/llvm/tools/llc/llc.cpp b/contrib/llvm-project/llvm/tools/llc/llc.cpp
index 8d906cf37287..4a1957588a22 100644
--- a/contrib/llvm-project/llvm/tools/llc/llc.cpp
+++ b/contrib/llvm-project/llvm/tools/llc/llc.cpp
@@ -307,16 +307,12 @@ static std::unique_ptr<ToolOutputFile> GetOutputStream(const char *TargetName,
}
struct LLCDiagnosticHandler : public DiagnosticHandler {
- bool *HasError;
- LLCDiagnosticHandler(bool *HasErrorPtr) : HasError(HasErrorPtr) {}
bool handleDiagnostics(const DiagnosticInfo &DI) override {
+ DiagnosticHandler::handleDiagnostics(DI);
if (DI.getKind() == llvm::DK_SrcMgr) {
const auto &DISM = cast<DiagnosticInfoSrcMgr>(DI);
const SMDiagnostic &SMD = DISM.getSMDiag();
- if (SMD.getKind() == SourceMgr::DK_Error)
- *HasError = true;
-
SMD.print(nullptr, errs());
// For testing purposes, we print the LocCookie here.
@@ -326,9 +322,6 @@ struct LLCDiagnosticHandler : public DiagnosticHandler {
return true;
}
- if (DI.getSeverity() == DS_Error)
- *HasError = true;
-
if (auto *Remark = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
if (!Remark->isEnabled())
return true;
@@ -413,9 +406,7 @@ int main(int argc, char **argv) {
Context.setDiscardValueNames(DiscardValueNames);
// Set a diagnostic handler that doesn't exit on the first error
- bool HasError = false;
- Context.setDiagnosticHandler(
- std::make_unique<LLCDiagnosticHandler>(&HasError));
+ Context.setDiagnosticHandler(std::make_unique<LLCDiagnosticHandler>());
Expected<std::unique_ptr<ToolOutputFile>> RemarksFileOrErr =
setupLLVMOptimizationRemarks(Context, RemarksFilename, RemarksPasses,
@@ -757,9 +748,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
PM.run(*M);
- auto HasError =
- ((const LLCDiagnosticHandler *)(Context.getDiagHandlerPtr()))->HasError;
- if (*HasError)
+ if (Context.getDiagHandlerPtr()->HasErrors)
return 1;
// Compare the two outputs and make sure they're the same
diff --git a/contrib/llvm-project/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/contrib/llvm-project/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
index b43e9e64231e..abc4c49ecae9 100644
--- a/contrib/llvm-project/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
@@ -130,10 +130,14 @@ table {
.light-row {
background: #ffffff;
border: 1px solid #dbdbdb;
+ border-left: none;
+ border-right: none;
}
.light-row-bold {
background: #ffffff;
border: 1px solid #dbdbdb;
+ border-left: none;
+ border-right: none;
font-weight: bold;
}
.column-entry {
@@ -147,21 +151,28 @@ table {
text-align: left;
background-color: #ffffd0;
}
-.column-entry-yellow:hover {
+.column-entry-yellow:hover, tr:hover .column-entry-yellow {
background-color: #fffff0;
}
.column-entry-red {
text-align: left;
background-color: #ffd0d0;
}
-.column-entry-red:hover {
+.column-entry-red:hover, tr:hover .column-entry-red {
background-color: #fff0f0;
}
+.column-entry-gray {
+ text-align: left;
+ background-color: #fbfbfb;
+}
+.column-entry-gray:hover, tr:hover .column-entry-gray {
+ background-color: #f0f0f0;
+}
.column-entry-green {
text-align: left;
background-color: #d0ffd0;
}
-.column-entry-green:hover {
+.column-entry-green:hover, tr:hover .column-entry-green {
background-color: #f0fff0;
}
.line-number {
@@ -232,6 +243,9 @@ td:last-child {
tr:hover {
background-color: #f0f0f0;
}
+tr:last-child {
+ border-bottom: none;
+}
)";
const char *EndHeader = "</head>";
@@ -309,7 +323,9 @@ void emitTableRow(raw_ostream &OS, const CoverageViewOptions &Opts,
RSO << '(' << Hit << '/' << Total << ')';
}
const char *CellClass = "column-entry-yellow";
- if (Pctg >= Opts.HighCovWatermark)
+ if (!Total)
+ CellClass = "column-entry-gray";
+ else if (Pctg >= Opts.HighCovWatermark)
CellClass = "column-entry-green";
else if (Pctg < Opts.LowCovWatermark)
CellClass = "column-entry-red";
diff --git a/contrib/llvm-project/llvm/tools/llvm-dwp/Opts.td b/contrib/llvm-project/llvm/tools/llvm-dwp/Opts.td
index 75b56fdb670c..46593bc40eba 100644
--- a/contrib/llvm-project/llvm/tools/llvm-dwp/Opts.td
+++ b/contrib/llvm-project/llvm/tools/llvm-dwp/Opts.td
@@ -9,7 +9,10 @@ def version : F<"version", "Display the version of this program">;
def execFileNames : S<"e", "Specify the executable/library files to get the list of *.dwo from.">, MetaVarName<"<filename>">;
def outputFileName : S<"o", "Specify the output file.">, MetaVarName<"<filename>">;
-def continueOnCuIndexOverflow : S<"continue-on-cu-index-overflow", "default = continue, This turns an error when offset "
- "for .debug_*.dwo sections overfolws into a warning. = soft-stop, This produces a "
- "truncated but valid DWP file, discarding any DWO files that would not fit within "
- "the 32 bit/4GB limits of the format.">, MetaVarName<"<filename>">; \ No newline at end of file
+def continueOnCuIndexOverflow : Flag<["-", "--"], "continue-on-cu-index-overflow">;
+def continueOnCuIndexOverflow_EQ : Joined<["-", "--"], "continue-on-cu-index-overflow=">,
+ HelpText<"default = continue, This turns an error when offset \n"
+ "\t\tfor .debug_*.dwo sections overfolws into a warning. = soft-stop, This produces a \n"
+ "\t\ttruncated but valid DWP file, discarding any DWO files that would not fit within \n"
+ "\t\tthe 32 bit/4GB limits of the format.">,
+ Values<"continue,soft-stop">;
diff --git a/contrib/llvm-project/llvm/tools/llvm-dwp/llvm-dwp.cpp b/contrib/llvm-project/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 5cd4c0078a45..a6b8643a5903 100644
--- a/contrib/llvm-project/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -144,13 +144,21 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
}
OutputFilename = Args.getLastArgValue(OPT_outputFileName, "");
- if (Args.hasArg(OPT_continueOnCuIndexOverflow)) {
- ContinueOption =
- Args.getLastArgValue(OPT_continueOnCuIndexOverflow, "continue");
- if (ContinueOption == "soft-stop") {
- OverflowOptValue = OnCuIndexOverflow::SoftStop;
- } else {
+ if (Arg *Arg = Args.getLastArg(OPT_continueOnCuIndexOverflow,
+ OPT_continueOnCuIndexOverflow_EQ)) {
+ if (Arg->getOption().matches(OPT_continueOnCuIndexOverflow)) {
OverflowOptValue = OnCuIndexOverflow::Continue;
+ } else {
+ ContinueOption = Arg->getValue();
+ if (ContinueOption == "soft-stop") {
+ OverflowOptValue = OnCuIndexOverflow::SoftStop;
+ } else if (ContinueOption == "continue") {
+ OverflowOptValue = OnCuIndexOverflow::Continue;
+ } else {
+ llvm::errs() << "invalid value for --continue-on-cu-index-overflow"
+ << ContinueOption << '\n';
+ exit(1);
+ }
}
}
diff --git a/contrib/llvm-project/llvm/tools/llvm-objdump/ObjdumpOpts.td b/contrib/llvm-project/llvm/tools/llvm-objdump/ObjdumpOpts.td
index 100a95d3d925..c1dec5ced89d 100644
--- a/contrib/llvm-project/llvm/tools/llvm-objdump/ObjdumpOpts.td
+++ b/contrib/llvm-project/llvm/tools/llvm-objdump/ObjdumpOpts.td
@@ -137,6 +137,9 @@ def mattr_EQ : Joined<["--"], "mattr=">,
MetaVarName<"a1,+a2,-a3,...">,
HelpText<"Target specific attributes (--mattr=help for details)">;
+def mllvm : Separate<["-"], "mllvm">, HelpText<"Specify an argument to forward to LLVM's CommandLine library">, MetaVarName<"<arg>">;
+def : Joined<["-"], "mllvm=">, Alias<mllvm>;
+
def no_show_raw_insn : Flag<["--"], "no-show-raw-insn">,
HelpText<"When disassembling instructions, "
"do not print the instruction bytes.">;
diff --git a/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.cpp b/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.cpp
index 0f6147924f8a..d9c00c096209 100644
--- a/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.cpp
@@ -43,6 +43,7 @@ objdump::createXCOFFDumper(const object::XCOFFObjectFile &Obj) {
Error objdump::getXCOFFRelocationValueString(const XCOFFObjectFile &Obj,
const RelocationRef &Rel,
+ bool SymbolDescription,
SmallVectorImpl<char> &Result) {
symbol_iterator SymI = Rel.getSymbol();
if (SymI == Obj.symbol_end())
diff --git a/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.h b/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.h
index cf5b19f910ea..0ba6ba4cdaaa 100644
--- a/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.h
+++ b/contrib/llvm-project/llvm/tools/llvm-objdump/XCOFFDump.h
@@ -33,6 +33,7 @@ std::string getXCOFFSymbolDescription(const SymbolInfoTy &SymbolInfo,
Error getXCOFFRelocationValueString(const object::XCOFFObjectFile &Obj,
const object::RelocationRef &RelRef,
+ bool SymbolDescription,
llvm::SmallVectorImpl<char> &Result);
void dumpTracebackTable(ArrayRef<uint8_t> Bytes, uint64_t Address,
diff --git a/contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp b/contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 12bb70d5537d..7467a6062b5a 100644
--- a/contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -424,6 +424,7 @@ bool objdump::isRelocAddressLess(RelocationRef A, RelocationRef B) {
}
static Error getRelocationValueString(const RelocationRef &Rel,
+ bool SymbolDescription,
SmallVectorImpl<char> &Result) {
const ObjectFile *Obj = Rel.getObject();
if (auto *ELF = dyn_cast<ELFObjectFileBase>(Obj))
@@ -435,7 +436,8 @@ static Error getRelocationValueString(const RelocationRef &Rel,
if (auto *MachO = dyn_cast<MachOObjectFile>(Obj))
return getMachORelocationValueString(MachO, Rel, Result);
if (auto *XCOFF = dyn_cast<XCOFFObjectFile>(Obj))
- return getXCOFFRelocationValueString(*XCOFF, Rel, Result);
+ return getXCOFFRelocationValueString(*XCOFF, Rel, SymbolDescription,
+ Result);
llvm_unreachable("unknown object file format");
}
@@ -527,7 +529,7 @@ static void printRelocation(formatted_raw_ostream &OS, StringRef FileName,
SmallString<16> Name;
SmallString<32> Val;
Rel.getTypeName(Name);
- if (Error E = getRelocationValueString(Rel, Val))
+ if (Error E = getRelocationValueString(Rel, SymbolDescription, Val))
reportError(std::move(E), FileName);
OS << (Is64Bits || !LeadingAddr ? "\t\t" : "\t\t\t");
if (LeadingAddr)
@@ -1289,7 +1291,8 @@ collectLocalBranchTargets(ArrayRef<uint8_t> Bytes, MCInstrAnalysis *MIA,
uint64_t Start, uint64_t End,
std::unordered_map<uint64_t, std::string> &Labels) {
// So far only supports PowerPC and X86.
- if (!STI->getTargetTriple().isPPC() && !STI->getTargetTriple().isX86())
+ const bool isPPC = STI->getTargetTriple().isPPC();
+ if (!isPPC && !STI->getTargetTriple().isX86())
return;
if (MIA)
@@ -1299,8 +1302,8 @@ collectLocalBranchTargets(ArrayRef<uint8_t> Bytes, MCInstrAnalysis *MIA,
unsigned LabelCount = 0;
Start += SectionAddr;
End += SectionAddr;
- uint64_t Index = Start;
- while (Index < End) {
+ const bool isXCOFF = STI->getTargetTriple().isOSBinFormatXCOFF();
+ for (uint64_t Index = Start; Index < End;) {
// Disassemble a real instruction and record function-local branch labels.
MCInst Inst;
uint64_t Size;
@@ -1311,18 +1314,22 @@ collectLocalBranchTargets(ArrayRef<uint8_t> Bytes, MCInstrAnalysis *MIA,
Size = std::min<uint64_t>(ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, Index));
- if (Disassembled && MIA) {
- uint64_t Target;
- bool TargetKnown = MIA->evaluateBranch(Inst, Index, Size, Target);
- // On PowerPC, if the address of a branch is the same as the target, it
- // means that it's a function call. Do not mark the label for this case.
- if (TargetKnown && (Target >= Start && Target < End) &&
- !Labels.count(Target) &&
- !(STI->getTargetTriple().isPPC() && Target == Index))
- Labels[Target] = ("L" + Twine(LabelCount++)).str();
- MIA->updateState(Inst, Index);
- } else if (!Disassembled && MIA) {
- MIA->resetState();
+ if (MIA) {
+ if (Disassembled) {
+ uint64_t Target;
+ bool TargetKnown = MIA->evaluateBranch(Inst, Index, Size, Target);
+ if (TargetKnown && (Target >= Start && Target < End) &&
+ !Labels.count(Target)) {
+ // On PowerPC and AIX, a function call is encoded as a branch to 0.
+ // On other PowerPC platforms (ELF), a function call is encoded as
+ // a branch to self. Do not add a label for these cases.
+ if (!(isPPC &&
+ ((Target == 0 && isXCOFF) || (Target == Index && !isXCOFF))))
+ Labels[Target] = ("L" + Twine(LabelCount++)).str();
+ }
+ MIA->updateState(Inst, Index);
+ } else
+ MIA->resetState();
}
Index += Size;
}
@@ -1486,7 +1493,7 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
}
std::map<SectionRef, std::vector<RelocationRef>> RelocMap;
- if (InlineRelocs)
+ if (InlineRelocs || Obj.isXCOFF())
RelocMap = getRelocsMap(Obj);
bool Is64Bits = Obj.getBytesInAddress() > 4;
@@ -1948,6 +1955,13 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
continue;
}
+ // Skip relocations from symbols that are not dumped.
+ for (; RelCur != RelEnd; ++RelCur) {
+ uint64_t Offset = RelCur->getOffset() - RelAdjustment;
+ if (Index <= Offset)
+ break;
+ }
+
bool DumpARMELFData = false;
bool DumpTracebackTableForXCOFFFunction =
Obj.isXCOFF() && Section.isText() && TracebackTable &&
@@ -1978,6 +1992,8 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
DT->InstrAnalysis->resetState();
while (Index < End) {
+ uint64_t RelOffset;
+
// ARM and AArch64 ELF binaries can interleave data and text in the
// same section. We rely on the markers introduced to understand what
// we need to dump. If the data marker is within a function, it is
@@ -2012,6 +2028,26 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
}
}
+ auto findRel = [&]() {
+ while (RelCur != RelEnd) {
+ RelOffset = RelCur->getOffset() - RelAdjustment;
+ // If this relocation is hidden, skip it.
+ if (getHidden(*RelCur) || SectionAddr + RelOffset < StartAddress) {
+ ++RelCur;
+ continue;
+ }
+
+ // Stop when RelCur's offset is past the disassembled
+ // instruction/data.
+ if (RelOffset >= Index + Size)
+ return false;
+ if (RelOffset >= Index)
+ return true;
+ ++RelCur;
+ }
+ return false;
+ };
+
if (DumpARMELFData) {
Size = dumpARMELFData(SectionAddr, Index, End, Obj, Bytes,
MappingSymbols, *DT->SubtargetInfo, FOS);
@@ -2022,7 +2058,7 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
uint64_t MaxOffset = End - Index;
// For --reloc: print zero blocks patched by relocations, so that
// relocations can be shown in the dump.
- if (RelCur != RelEnd)
+ if (InlineRelocs && RelCur != RelEnd)
MaxOffset = std::min(RelCur->getOffset() - RelAdjustment - Index,
MaxOffset);
@@ -2080,17 +2116,19 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
DT->InstPrinter->setCommentStream(llvm::nulls());
- // If disassembly has failed, avoid analysing invalid/incomplete
- // instruction information. Otherwise, try to resolve the target
- // address (jump target or memory operand address) and print it on the
+ // If disassembly succeeds, we try to resolve the target address
+ // (jump target or memory operand address) and print it to the
// right of the instruction.
+ //
+ // Otherwise, we don't print anything else so that we avoid
+ // analyzing invalid or incomplete instruction information.
if (Disassembled && DT->InstrAnalysis) {
- // Branch targets are printed just after the instructions.
llvm::raw_ostream *TargetOS = &FOS;
uint64_t Target;
bool PrintTarget = DT->InstrAnalysis->evaluateBranch(
Inst, SectionAddr + Index, Size, Target);
- if (!PrintTarget)
+
+ if (!PrintTarget) {
if (std::optional<uint64_t> MaybeTarget =
DT->InstrAnalysis->evaluateMemoryOperandAddress(
Inst, DT->SubtargetInfo.get(), SectionAddr + Index,
@@ -2104,6 +2142,8 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
*TargetOS << "0x" << Twine::utohexstr(Target);
}
}
+ }
+
if (PrintTarget) {
// In a relocatable object, the target's section must reside in
// the same section as the call instruction or it is accessed
@@ -2113,7 +2153,8 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
// In that case, locate the section(s) containing the target
// address and find the symbol in one of those, if possible.
//
- // N.B. We don't walk the relocations in the relocatable case yet.
+ // N.B. Except for XCOFF, we don't walk the relocations in the
+ // relocatable case yet.
std::vector<const SectionSymbolsTy *> TargetSectionSymbols;
if (!Obj.isRelocatableObject()) {
auto It = llvm::partition_point(
@@ -2159,19 +2200,65 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
break;
}
+ // Branch targets are printed just after the instructions.
// Print the labels corresponding to the target if there's any.
bool BBAddrMapLabelAvailable = BBAddrMapLabels.count(Target);
bool LabelAvailable = AllLabels.count(Target);
+
if (TargetSym != nullptr) {
uint64_t TargetAddress = TargetSym->Addr;
uint64_t Disp = Target - TargetAddress;
std::string TargetName = Demangle ? demangle(TargetSym->Name)
: TargetSym->Name.str();
+ bool RelFixedUp = false;
+ SmallString<32> Val;
*TargetOS << " <";
- if (!Disp) {
- // Always Print the binary symbol precisely corresponding to
- // the target address.
+ // On XCOFF, we use relocations, even without -r, so we
+ // can print the correct name for an extern function call.
+ if (Obj.isXCOFF() && findRel()) {
+ // Check for possible branch relocations and
+ // branches to fixup code.
+ bool BranchRelocationType = true;
+ XCOFF::RelocationType RelocType;
+ if (Obj.is64Bit()) {
+ const XCOFFRelocation64 *Reloc =
+ reinterpret_cast<XCOFFRelocation64 *>(
+ RelCur->getRawDataRefImpl().p);
+ RelFixedUp = Reloc->isFixupIndicated();
+ RelocType = Reloc->Type;
+ } else {
+ const XCOFFRelocation32 *Reloc =
+ reinterpret_cast<XCOFFRelocation32 *>(
+ RelCur->getRawDataRefImpl().p);
+ RelFixedUp = Reloc->isFixupIndicated();
+ RelocType = Reloc->Type;
+ }
+ BranchRelocationType =
+ RelocType == XCOFF::R_BA || RelocType == XCOFF::R_BR ||
+ RelocType == XCOFF::R_RBA || RelocType == XCOFF::R_RBR;
+
+ // If we have a valid relocation, try to print its
+ // corresponding symbol name. Multiple relocations on the
+ // same instruction are not handled.
+ // Branches to fixup code will have the RelFixedUp flag set in
+ // the RLD. For these instructions, we print the correct
+ // branch target, but print the referenced symbol as a
+ // comment.
+ if (Error E = getRelocationValueString(*RelCur, false, Val)) {
+ // If -r was used, this error will be printed later.
+ // Otherwise, we ignore the error and print what
+ // would have been printed without using relocations.
+ consumeError(std::move(E));
+ *TargetOS << TargetName;
+ RelFixedUp = false; // Suppress comment for RLD sym name
+ } else if (BranchRelocationType && !RelFixedUp)
+ *TargetOS << Val;
+ else
+ *TargetOS << TargetName;
+ if (Disp)
+ *TargetOS << "+0x" << Twine::utohexstr(Disp);
+ } else if (!Disp) {
*TargetOS << TargetName;
} else if (BBAddrMapLabelAvailable) {
*TargetOS << BBAddrMapLabels[Target].front();
@@ -2183,6 +2270,12 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
*TargetOS << TargetName << "+0x" << Twine::utohexstr(Disp);
}
*TargetOS << ">";
+ if (RelFixedUp && !InlineRelocs) {
+ // We have fixup code for a relocation. We print the
+ // referenced symbol as a comment.
+ *TargetOS << "\t# " << Val;
+ }
+
} else if (BBAddrMapLabelAvailable) {
*TargetOS << " <" << BBAddrMapLabels[Target].front() << ">";
} else if (LabelAvailable) {
@@ -2208,36 +2301,20 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
if (BTF)
printBTFRelocation(FOS, *BTF, {Index, Section.getIndex()}, LVP);
- // Hexagon does this in pretty printer
- if (Obj.getArch() != Triple::hexagon) {
- // Print relocation for instruction and data.
- while (RelCur != RelEnd) {
- uint64_t Offset = RelCur->getOffset() - RelAdjustment;
- // If this relocation is hidden, skip it.
- if (getHidden(*RelCur) || SectionAddr + Offset < StartAddress) {
- ++RelCur;
- continue;
- }
-
- // Stop when RelCur's offset is past the disassembled
- // instruction/data. Note that it's possible the disassembled data
- // is not the complete data: we might see the relocation printed in
- // the middle of the data, but this matches the binutils objdump
- // output.
- if (Offset >= Index + Size)
- break;
-
+ // Hexagon handles relocs in pretty printer
+ if (InlineRelocs && Obj.getArch() != Triple::hexagon) {
+ while (findRel()) {
// When --adjust-vma is used, update the address printed.
if (RelCur->getSymbol() != Obj.symbol_end()) {
Expected<section_iterator> SymSI =
RelCur->getSymbol()->getSection();
if (SymSI && *SymSI != Obj.section_end() &&
shouldAdjustVA(**SymSI))
- Offset += AdjustVMA;
+ RelOffset += AdjustVMA;
}
printRelocation(FOS, Obj.getFileName(), *RelCur,
- SectionAddr + Offset, Is64Bits);
+ SectionAddr + RelOffset, Is64Bits);
LVP.printAfterOtherLine(FOS, true);
++RelCur;
}
@@ -2421,7 +2498,8 @@ void Dumper::printRelocations() {
if (Address < StartAddress || Address > StopAddress || getHidden(Reloc))
continue;
Reloc.getTypeName(RelocName);
- if (Error E = getRelocationValueString(Reloc, ValueStr))
+ if (Error E =
+ getRelocationValueString(Reloc, SymbolDescription, ValueStr))
reportUniqueWarning(std::move(E));
outs() << format(Fmt.data(), Address) << " "
@@ -3313,10 +3391,13 @@ static void parseObjdumpOptions(const llvm::opt::InputArgList &InputArgs) {
DisassemblerOptions.push_back(V.str());
}
}
- if (AsmSyntax) {
- const char *Argv[] = {"llvm-objdump", AsmSyntax};
- llvm::cl::ParseCommandLineOptions(2, Argv);
- }
+ SmallVector<const char *> Args = {"llvm-objdump"};
+ for (const opt::Arg *A : InputArgs.filtered(OBJDUMP_mllvm))
+ Args.push_back(A->getValue());
+ if (AsmSyntax)
+ Args.push_back(AsmSyntax);
+ if (Args.size() > 1)
+ llvm::cl::ParseCommandLineOptions(Args.size(), Args.data());
// Look up any provided build IDs, then append them to the input filenames.
for (const opt::Arg *A : InputArgs.filtered(OBJDUMP_build_id)) {
diff --git a/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp b/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 322b7da2678f..12b81d411cfa 100644
--- a/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -1651,10 +1651,10 @@ struct SampleOverlapStats {
namespace {
struct FuncSampleStats {
- uint64_t SampleSum;
- uint64_t MaxSample;
- uint64_t HotBlockCount;
- FuncSampleStats() : SampleSum(0), MaxSample(0), HotBlockCount(0) {}
+ uint64_t SampleSum = 0;
+ uint64_t MaxSample = 0;
+ uint64_t HotBlockCount = 0;
+ FuncSampleStats() = default;
FuncSampleStats(uint64_t SampleSum, uint64_t MaxSample,
uint64_t HotBlockCount)
: SampleSum(SampleSum), MaxSample(MaxSample),
@@ -2563,12 +2563,10 @@ static int overlap_main(int argc, const char *argv[]) {
namespace {
struct ValueSitesStats {
- ValueSitesStats()
- : TotalNumValueSites(0), TotalNumValueSitesWithValueProfile(0),
- TotalNumValues(0) {}
- uint64_t TotalNumValueSites;
- uint64_t TotalNumValueSitesWithValueProfile;
- uint64_t TotalNumValues;
+ ValueSitesStats() = default;
+ uint64_t TotalNumValueSites = 0;
+ uint64_t TotalNumValueSitesWithValueProfile = 0;
+ uint64_t TotalNumValues = 0;
std::vector<unsigned> ValueSitesHistogram;
};
} // namespace
@@ -2867,13 +2865,12 @@ static void showSectionInfo(sampleprof::SampleProfileReader *Reader,
namespace {
struct HotFuncInfo {
std::string FuncName;
- uint64_t TotalCount;
- double TotalCountPercent;
- uint64_t MaxCount;
- uint64_t EntryCount;
+ uint64_t TotalCount = 0;
+ double TotalCountPercent = 0.0f;
+ uint64_t MaxCount = 0;
+ uint64_t EntryCount = 0;
- HotFuncInfo()
- : TotalCount(0), TotalCountPercent(0.0f), MaxCount(0), EntryCount(0) {}
+ HotFuncInfo() = default;
HotFuncInfo(StringRef FN, uint64_t TS, double TSP, uint64_t MS, uint64_t ES)
: FuncName(FN.begin(), FN.end()), TotalCount(TS), TotalCountPercent(TSP),
diff --git a/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp b/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp
index f2851a52671b..abf7ba6ba1c3 100644
--- a/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1558,139 +1558,139 @@ const EnumEntry<unsigned> ElfHeaderMipsFlags[] = {
};
const EnumEntry<unsigned> ElfHeaderAMDGPUFlagsABIVersion3[] = {
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_NONE),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R630),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RS880),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV670),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV710),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV730),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV770),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CEDAR),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CYPRESS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_JUNIPER),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_REDWOOD),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_SUMO),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_BARTS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAICOS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAYMAN),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_TURKS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX601),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX602),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX700),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX701),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX702),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX703),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX704),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX705),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX801),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX802),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX803),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX805),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX810),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX900),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX902),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX904),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX906),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX908),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX909),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90A),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90C),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX940),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX941),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX942),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1010),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1011),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1012),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1013),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1030),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1031),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1032),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1033),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1034),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1035),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1036),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1100),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1101),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1102),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1103),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1150),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1151),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1200),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1201),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_V3),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_V3),
+ ENUM_ENT(EF_AMDGPU_MACH_NONE, "none"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R600, "r600"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R630, "r630"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RS880, "rs880"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV670, "rv670"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV710, "rv710"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV730, "rv730"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV770, "rv770"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CEDAR, "cedar"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CYPRESS, "cypress"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_JUNIPER, "juniper"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_REDWOOD, "redwood"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_SUMO, "sumo"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_BARTS, "barts"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAICOS, "caicos"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAYMAN, "cayman"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_TURKS, "turks"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX600, "gfx600"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX601, "gfx601"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX602, "gfx602"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX700, "gfx700"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX701, "gfx701"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX702, "gfx702"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX703, "gfx703"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX704, "gfx704"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX705, "gfx705"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX801, "gfx801"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX802, "gfx802"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX803, "gfx803"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX805, "gfx805"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX810, "gfx810"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX900, "gfx900"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX902, "gfx902"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX904, "gfx904"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX906, "gfx906"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX908, "gfx908"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX909, "gfx909"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90A, "gfx90a"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90C, "gfx90c"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX940, "gfx940"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX941, "gfx941"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX942, "gfx942"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1010, "gfx1010"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1011, "gfx1011"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1012, "gfx1012"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1013, "gfx1013"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1030, "gfx1030"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1031, "gfx1031"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1032, "gfx1032"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1033, "gfx1033"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1034, "gfx1034"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1035, "gfx1035"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1036, "gfx1036"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1100, "gfx1100"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1101, "gfx1101"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1102, "gfx1102"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1103, "gfx1103"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1150, "gfx1150"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1151, "gfx1151"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1200, "gfx1200"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1201, "gfx1201"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_V3, "xnack"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_V3, "sramecc"),
};
const EnumEntry<unsigned> ElfHeaderAMDGPUFlagsABIVersion4[] = {
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_NONE),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_R630),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RS880),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV670),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV710),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV730),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_RV770),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CEDAR),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CYPRESS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_JUNIPER),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_REDWOOD),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_SUMO),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_BARTS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAICOS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_CAYMAN),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_R600_TURKS),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX600),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX601),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX602),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX700),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX701),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX702),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX703),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX704),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX705),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX801),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX802),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX803),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX805),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX810),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX900),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX902),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX904),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX906),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX908),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX909),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90A),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX90C),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX940),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX941),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX942),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1010),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1011),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1012),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1013),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1030),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1031),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1032),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1033),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1034),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1035),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1036),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1100),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1101),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1102),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1103),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1150),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1151),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1200),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_MACH_AMDGCN_GFX1201),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_ANY_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_OFF_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_XNACK_ON_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_ANY_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_OFF_V4),
- LLVM_READOBJ_ENUM_ENT(ELF, EF_AMDGPU_FEATURE_SRAMECC_ON_V4),
+ ENUM_ENT(EF_AMDGPU_MACH_NONE, "none"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R600, "r600"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_R630, "r630"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RS880, "rs880"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV670, "rv670"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV710, "rv710"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV730, "rv730"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_RV770, "rv770"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CEDAR, "cedar"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CYPRESS, "cypress"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_JUNIPER, "juniper"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_REDWOOD, "redwood"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_SUMO, "sumo"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_BARTS, "barts"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAICOS, "caicos"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_CAYMAN, "cayman"),
+ ENUM_ENT(EF_AMDGPU_MACH_R600_TURKS, "turks"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX600, "gfx600"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX601, "gfx601"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX602, "gfx602"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX700, "gfx700"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX701, "gfx701"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX702, "gfx702"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX703, "gfx703"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX704, "gfx704"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX705, "gfx705"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX801, "gfx801"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX802, "gfx802"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX803, "gfx803"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX805, "gfx805"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX810, "gfx810"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX900, "gfx900"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX902, "gfx902"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX904, "gfx904"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX906, "gfx906"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX908, "gfx908"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX909, "gfx909"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90A, "gfx90a"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX90C, "gfx90c"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX940, "gfx940"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX941, "gfx941"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX942, "gfx942"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1010, "gfx1010"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1011, "gfx1011"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1012, "gfx1012"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1013, "gfx1013"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1030, "gfx1030"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1031, "gfx1031"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1032, "gfx1032"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1033, "gfx1033"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1034, "gfx1034"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1035, "gfx1035"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1036, "gfx1036"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1100, "gfx1100"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1101, "gfx1101"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1102, "gfx1102"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1103, "gfx1103"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1150, "gfx1150"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1151, "gfx1151"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1200, "gfx1200"),
+ ENUM_ENT(EF_AMDGPU_MACH_AMDGCN_GFX1201, "gfx1201"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_ANY_V4, "xnack"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_OFF_V4, "xnack-"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_XNACK_ON_V4, "xnack+"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_ANY_V4, "sramecc"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_OFF_V4, "sramecc-"),
+ ENUM_ENT(EF_AMDGPU_FEATURE_SRAMECC_ON_V4, "sramecc+"),
};
const EnumEntry<unsigned> ElfHeaderNVPTXFlags[] = {
@@ -3599,7 +3599,18 @@ template <class ELFT> void GNUELFDumper<ELFT>::printFileHeaders() {
if (e.e_version == ELF::EV_CURRENT)
OS << " (current)";
OS << "\n";
- Str = enumToString(e.e_ident[ELF::EI_OSABI], ArrayRef(ElfOSABI));
+ auto OSABI = ArrayRef(ElfOSABI);
+ if (e.e_ident[ELF::EI_OSABI] >= ELF::ELFOSABI_FIRST_ARCH &&
+ e.e_ident[ELF::EI_OSABI] <= ELF::ELFOSABI_LAST_ARCH) {
+ switch (e.e_machine) {
+ case ELF::EM_AMDGPU:
+ OSABI = ArrayRef(AMDGPUElfOSABI);
+ break;
+ default:
+ break;
+ }
+ }
+ Str = enumToString(e.e_ident[ELF::EI_OSABI], OSABI);
printFields(OS, "OS/ABI:", Str);
printFields(OS,
"ABI Version:", std::to_string(e.e_ident[ELF::EI_ABIVERSION]));
@@ -3646,6 +3657,28 @@ template <class ELFT> void GNUELFDumper<ELFT>::printFileHeaders() {
else if (e.e_machine == EM_CUDA)
ElfFlags = printFlags(e.e_flags, ArrayRef(ElfHeaderNVPTXFlags),
unsigned(ELF::EF_CUDA_SM));
+ else if (e.e_machine == EM_AMDGPU) {
+ switch (e.e_ident[ELF::EI_ABIVERSION]) {
+ default:
+ break;
+ case 0:
+ // ELFOSABI_AMDGPU_PAL, ELFOSABI_AMDGPU_MESA3D support *_V3 flags.
+ [[fallthrough]];
+ case ELF::ELFABIVERSION_AMDGPU_HSA_V3:
+ ElfFlags =
+ printFlags(e.e_flags, ArrayRef(ElfHeaderAMDGPUFlagsABIVersion3),
+ unsigned(ELF::EF_AMDGPU_MACH));
+ break;
+ case ELF::ELFABIVERSION_AMDGPU_HSA_V4:
+ case ELF::ELFABIVERSION_AMDGPU_HSA_V5:
+ ElfFlags =
+ printFlags(e.e_flags, ArrayRef(ElfHeaderAMDGPUFlagsABIVersion4),
+ unsigned(ELF::EF_AMDGPU_MACH),
+ unsigned(ELF::EF_AMDGPU_FEATURE_XNACK_V4),
+ unsigned(ELF::EF_AMDGPU_FEATURE_SRAMECC_V4));
+ break;
+ }
+ }
Str = "0x" + utohexstr(e.e_flags);
if (!ElfFlags.empty())
Str = Str + ", " + ElfFlags;
diff --git a/contrib/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/contrib/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index f774f0c1018b..73724e662f9e 100644
--- a/contrib/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/contrib/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -985,7 +985,7 @@ void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info,
bool IsIsolatedToken = true;
for (size_t i = 0, e = String.size(); i != e; ++i) {
char Char = String[i];
- if (Variant.BreakCharacters.find(Char) != std::string::npos) {
+ if (Variant.BreakCharacters.contains(Char)) {
if (InTok) {
addAsmOperand(String.slice(Prev, i), false);
Prev = i;
@@ -994,7 +994,7 @@ void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info,
InTok = true;
continue;
}
- if (Variant.TokenizingCharacters.find(Char) != std::string::npos) {
+ if (Variant.TokenizingCharacters.contains(Char)) {
if (InTok) {
addAsmOperand(String.slice(Prev, i), IsIsolatedToken);
InTok = false;
@@ -1005,7 +1005,7 @@ void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info,
IsIsolatedToken = true;
continue;
}
- if (Variant.SeparatorCharacters.find(Char) != std::string::npos) {
+ if (Variant.SeparatorCharacters.contains(Char)) {
if (InTok) {
addAsmOperand(String.slice(Prev, i), IsIsolatedToken);
InTok = false;
@@ -3317,7 +3317,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " unsigned MCK);\n\n";
}
- OS << "#endif // GET_ASSEMBLER_HEADER_INFO\n\n";
+ OS << "#endif // GET_ASSEMBLER_HEADER\n\n";
// Emit the operand match diagnostic enum names.
OS << "\n#ifdef GET_OPERAND_DIAGNOSTIC_TYPES\n";
diff --git a/contrib/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp b/contrib/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp
index 0220927295cf..e0cd5fad3254 100644
--- a/contrib/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ b/contrib/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp
@@ -438,6 +438,10 @@ void AsmWriterEmitter::EmitGetMnemonic(
O << " // Emit the opcode for the instruction.\n";
O << BitsString;
+ // Make sure we don't return an invalid pointer if bits is 0
+ O << " if (Bits == 0)\n"
+ " return {nullptr, Bits};\n";
+
// Return mnemonic string and bits.
O << " return {AsmStrs+(Bits & " << (1 << AsmStrBits) - 1
<< ")-1, Bits};\n\n";
diff --git a/contrib/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/contrib/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index 94799267e896..6fd5698e7372 100644
--- a/contrib/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/contrib/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -737,24 +737,35 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx,
case Matcher::EmitRegister: {
const EmitRegisterMatcher *Matcher = cast<EmitRegisterMatcher>(N);
const CodeGenRegister *Reg = Matcher->getReg();
+ MVT::SimpleValueType VT = Matcher->getVT();
// If the enum value of the register is larger than one byte can handle,
// use EmitRegister2.
if (Reg && Reg->EnumValue > 255) {
- OS << "OPC_EmitRegister2, " << getEnumName(Matcher->getVT()) << ", ";
+ OS << "OPC_EmitRegister2, " << getEnumName(VT) << ", ";
OS << "TARGET_VAL(" << getQualifiedName(Reg->TheDef) << "),\n";
return 4;
+ }
+ unsigned OpBytes;
+ switch (VT) {
+ case MVT::i32:
+ case MVT::i64:
+ OpBytes = 1;
+ OS << "OPC_EmitRegisterI" << MVT(VT).getSizeInBits() << ", ";
+ break;
+ default:
+ OpBytes = 2;
+ OS << "OPC_EmitRegister, " << getEnumName(VT) << ", ";
+ break;
+ }
+ if (Reg) {
+ OS << getQualifiedName(Reg->TheDef) << ",\n";
} else {
- OS << "OPC_EmitRegister, " << getEnumName(Matcher->getVT()) << ", ";
- if (Reg) {
- OS << getQualifiedName(Reg->TheDef) << ",\n";
- } else {
- OS << "0 ";
- if (!OmitComments)
- OS << "/*zero_reg*/";
- OS << ",\n";
- }
- return 3;
+ OS << "0 ";
+ if (!OmitComments)
+ OS << "/*zero_reg*/";
+ OS << ",\n";
}
+ return OpBytes + 1;
}
case Matcher::EmitConvertToTarget: {
diff --git a/contrib/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp b/contrib/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
index 83025205310e..d3299e281031 100644
--- a/contrib/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
+++ b/contrib/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
@@ -32,8 +32,10 @@ struct ManualMapEntry {
};
// List of instructions requiring explicitly aligned memory.
-const char *ExplicitAlign[] = {"MOVDQA", "MOVAPS", "MOVAPD", "MOVNTPS",
- "MOVNTPD", "MOVNTDQ", "MOVNTDQA"};
+const char *ExplicitAlign[] = {
+ "MOVDQA", "MOVAPS", "MOVAPD", "MOVNTPS", "MOVNTPD",
+ "MOVNTDQ", "MOVNTDQA", "SHA1MSG1", "SHA1MSG2", "SHA1NEXTE",
+ "SHA1RNDS4", "SHA256MSG1", "SHA256MSG2", "SHA256RNDS2"};
// List of instructions NOT requiring explicit memory alignment.
const char *ExplicitUnalign[] = {"MOVDQU", "MOVUPS", "MOVUPD",